module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/dist/"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 118); /******/ }) /************************************************************************/ /******/ ({ /***/ 118: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); // EXTERNAL MODULE: external "element-ui/lib/checkbox" var checkbox_ = __webpack_require__(16); var checkbox_default = /*#__PURE__*/__webpack_require__.n(checkbox_); // EXTERNAL MODULE: external "element-ui/lib/tag" var tag_ = __webpack_require__(26); var tag_default = /*#__PURE__*/__webpack_require__.n(tag_); // EXTERNAL MODULE: external "element-ui/lib/utils/merge" var merge_ = __webpack_require__(8); var merge_default = /*#__PURE__*/__webpack_require__.n(merge_); // EXTERNAL MODULE: external "element-ui/lib/utils/util" var util_ = __webpack_require__(4); // CONCATENATED MODULE: ./packages/table/src/table-column.js var columnIdSeed = 1; var defaults = { default: { order: '' }, selection: { width: 48, minWidth: 48, realWidth: 48, order: '', className: 'el-table-column--selection' }, expand: { width: 48, minWidth: 48, realWidth: 48, order: '' }, index: { width: 48, minWidth: 48, realWidth: 48, order: '' } }; var forced = { selection: { renderHeader: function renderHeader(h, _ref) { var store = _ref.store; return h('el-checkbox', { attrs: { disabled: store.states.data && store.states.data.length === 0, indeterminate: store.states.selection.length > 0 && !this.isAllSelected, value: this.isAllSelected }, nativeOn: { 'click': this.toggleAllSelection } }); }, renderCell: function renderCell(h, _ref2) { var row = _ref2.row, column = _ref2.column, store = _ref2.store, $index = _ref2.$index; return h('el-checkbox', { nativeOn: { 'click': function click(event) { return event.stopPropagation(); } }, attrs: { value: store.isSelected(row), disabled: column.selectable ? !column.selectable.call(null, row, $index) : false }, on: { 'input': function input() { store.commit('rowSelectedChanged', row); } } }); }, sortable: false, resizable: false }, index: { renderHeader: function renderHeader(h, _ref3) { var column = _ref3.column; return column.label || '#'; }, renderCell: function renderCell(h, _ref4) { var $index = _ref4.$index, column = _ref4.column; var i = $index + 1; var index = column.index; if (typeof index === 'number') { i = $index + index; } else if (typeof index === 'function') { i = index($index); } return h('div', [i]); }, sortable: false }, expand: { renderHeader: function renderHeader(h, _ref5) { var column = _ref5.column; return column.label || ''; }, renderCell: function renderCell(h, _ref6, proxy) { var row = _ref6.row, store = _ref6.store; var expanded = store.states.expandRows.indexOf(row) > -1; return h( 'div', { 'class': 'el-table__expand-icon ' + (expanded ? 'el-table__expand-icon--expanded' : ''), on: { 'click': function click(e) { return proxy.handleExpandClick(row, e); } } }, [h('i', { 'class': 'el-icon el-icon-arrow-right' })] ); }, sortable: false, resizable: false, className: 'el-table__expand-column' } }; var table_column_getDefaultColumn = function getDefaultColumn(type, options) { var column = {}; merge_default()(column, defaults[type || 'default']); for (var name in options) { if (options.hasOwnProperty(name)) { var value = options[name]; if (typeof value !== 'undefined') { column[name] = value; } } } if (!column.minWidth) { column.minWidth = 80; } column.realWidth = column.width === undefined ? column.minWidth : column.width; return column; }; var table_column_DEFAULT_RENDER_CELL = function DEFAULT_RENDER_CELL(h, _ref7) { var row = _ref7.row, column = _ref7.column, $index = _ref7.$index; var property = column.property; var value = property && Object(util_["getPropByPath"])(row, property).v; if (column && column.formatter) { return column.formatter(row, column, value, $index); } return value; }; var parseWidth = function parseWidth(width) { if (width !== undefined) { width = parseInt(width, 10); if (isNaN(width)) { width = null; } } return width; }; var parseMinWidth = function parseMinWidth(minWidth) { if (minWidth !== undefined) { minWidth = parseInt(minWidth, 10); if (isNaN(minWidth)) { minWidth = 80; } } return minWidth; }; /* harmony default export */ var table_column = ({ name: 'ElTableColumn', props: { type: { type: String, default: 'default' }, label: String, className: String, labelClassName: String, property: String, prop: String, width: {}, minWidth: {}, renderHeader: Function, sortable: { type: [String, Boolean], default: false }, sortMethod: Function, sortBy: [String, Function, Array], resizable: { type: Boolean, default: true }, context: {}, columnKey: String, align: String, headerAlign: String, showTooltipWhenOverflow: Boolean, showOverflowTooltip: Boolean, fixed: [Boolean, String], formatter: Function, selectable: Function, reserveSelection: Boolean, filterMethod: Function, filteredValue: Array, filters: Array, filterPlacement: String, filterMultiple: { type: Boolean, default: true }, index: [Number, Function], sortOrders: { type: Array, default: function _default() { return ['ascending', 'descending', null]; }, validator: function validator(val) { return val.every(function (order) { return ['ascending', 'descending', null].indexOf(order) > -1; }); } } }, data: function data() { return { isSubColumn: false, columns: [] }; }, beforeCreate: function beforeCreate() { this.row = {}; this.column = {}; this.$index = 0; }, components: { ElCheckbox: checkbox_default.a, ElTag: tag_default.a }, computed: { owner: function owner() { var parent = this.$parent; while (parent && !parent.tableId) { parent = parent.$parent; } return parent; }, columnOrTableParent: function columnOrTableParent() { var parent = this.$parent; while (parent && !parent.tableId && !parent.columnId) { parent = parent.$parent; } return parent; } }, created: function created() { var _this = this; var h = this.$createElement; this.customRender = this.$options.render; this.$options.render = function (h) { return h('div', _this.$slots.default); }; var parent = this.columnOrTableParent; var owner = this.owner; this.isSubColumn = owner !== parent; this.columnId = (parent.tableId || parent.columnId) + '_column_' + columnIdSeed++; var type = this.type; var width = parseWidth(this.width); var minWidth = parseMinWidth(this.minWidth); var isColumnGroup = false; var column = table_column_getDefaultColumn(type, { id: this.columnId, columnKey: this.columnKey, label: this.label, className: this.className, labelClassName: this.labelClassName, property: this.prop || this.property, type: type, renderCell: null, renderHeader: this.renderHeader, minWidth: minWidth, width: width, isColumnGroup: isColumnGroup, context: this.context, align: this.align ? 'is-' + this.align : null, headerAlign: this.headerAlign ? 'is-' + this.headerAlign : this.align ? 'is-' + this.align : null, sortable: this.sortable === '' ? true : this.sortable, sortMethod: this.sortMethod, sortBy: this.sortBy, resizable: this.resizable, showOverflowTooltip: this.showOverflowTooltip || this.showTooltipWhenOverflow, formatter: this.formatter, selectable: this.selectable, reserveSelection: this.reserveSelection, fixed: this.fixed === '' ? true : this.fixed, filterMethod: this.filterMethod, filters: this.filters, filterable: this.filters || this.filterMethod, filterMultiple: this.filterMultiple, filterOpened: false, filteredValue: this.filteredValue || [], filterPlacement: this.filterPlacement || '', index: this.index, sortOrders: this.sortOrders }); var source = forced[type] || {}; Object.keys(source).forEach(function (prop) { var value = source[prop]; if (value !== undefined) { if (prop === 'renderHeader') { if (type === 'selection' && column[prop]) { console.warn('[Element Warn][TableColumn]Selection column doesn\'t allow to set render-header function.'); } else { value = column[prop] || value; } } column[prop] = prop === 'className' ? column[prop] + ' ' + value : value; } }); // Deprecation warning for renderHeader property if (this.renderHeader) { console.warn('[Element Warn][TableColumn]Comparing to render-header, scoped-slot header is easier to use. We recommend users to use scoped-slot header.'); } this.columnConfig = column; var renderCell = column.renderCell; var _self = this; if (type === 'expand') { owner.renderExpanded = function (h, data) { return _self.$scopedSlots.default ? _self.$scopedSlots.default(data) : _self.$slots.default; }; column.renderCell = function (h, data) { return h( 'div', { 'class': 'cell' }, [renderCell(h, data, this._renderProxy)] ); }; return; } column.renderCell = function (h, data) { if (_self.$scopedSlots.default) { renderCell = function renderCell() { return _self.$scopedSlots.default(data); }; } if (!renderCell) { renderCell = table_column_DEFAULT_RENDER_CELL; } var children = [_self.renderTreeCell(data), renderCell(h, data)]; return _self.showOverflowTooltip || _self.showTooltipWhenOverflow ? h( 'div', { 'class': 'cell el-tooltip', style: { width: (data.column.realWidth || data.column.width) - 1 + 'px' } }, [children] ) : h( 'div', { 'class': 'cell' }, [children] ); }; }, destroyed: function destroyed() { if (!this.$parent) return; var parent = this.$parent; this.owner.store.commit('removeColumn', this.columnConfig, this.isSubColumn ? parent.columnConfig : null); }, watch: { label: function label(newVal) { if (this.columnConfig) { this.columnConfig.label = newVal; } }, prop: function prop(newVal) { if (this.columnConfig) { this.columnConfig.property = newVal; } }, property: function property(newVal) { if (this.columnConfig) { this.columnConfig.property = newVal; } }, filters: function filters(newVal) { if (this.columnConfig) { this.columnConfig.filters = newVal; } }, filterMultiple: function filterMultiple(newVal) { if (this.columnConfig) { this.columnConfig.filterMultiple = newVal; } }, align: function align(newVal) { if (this.columnConfig) { this.columnConfig.align = newVal ? 'is-' + newVal : null; if (!this.headerAlign) { this.columnConfig.headerAlign = newVal ? 'is-' + newVal : null; } } }, headerAlign: function headerAlign(newVal) { if (this.columnConfig) { this.columnConfig.headerAlign = 'is-' + (newVal ? newVal : this.align); } }, width: function width(newVal) { if (this.columnConfig) { this.columnConfig.width = parseWidth(newVal); this.owner.store.scheduleLayout(); } }, minWidth: function minWidth(newVal) { if (this.columnConfig) { this.columnConfig.minWidth = parseMinWidth(newVal); this.owner.store.scheduleLayout(); } }, fixed: function fixed(newVal) { if (this.columnConfig) { this.columnConfig.fixed = newVal; this.owner.store.scheduleLayout(true); } }, sortable: function sortable(newVal) { if (this.columnConfig) { this.columnConfig.sortable = newVal; } }, index: function index(newVal) { if (this.columnConfig) { this.columnConfig.index = newVal; } }, formatter: function formatter(newVal) { if (this.columnConfig) { this.columnConfig.formatter = newVal; } }, className: function className(newVal) { if (this.columnConfig) { this.columnConfig.className = newVal; } }, labelClassName: function labelClassName(newVal) { if (this.columnConfig) { this.columnConfig.labelClassName = newVal; } } }, methods: { renderTreeCell: function renderTreeCell(data) { var h = this.$createElement; if (!data.treeNode) return null; var ele = []; ele.push(h('span', { 'class': 'el-table__indent', style: { 'padding-left': data.treeNode.indent + 'px' } })); if (data.treeNode.hasChildren) { ele.push(h( 'div', { 'class': ['el-table__expand-icon', data.treeNode.expanded ? 'el-table__expand-icon--expanded' : ''], on: { 'click': this.handleTreeExpandIconClick.bind(this, data) } }, [h('i', { 'class': 'el-icon el-icon-arrow-right' })] )); } else { ele.push(h('span', { 'class': 'el-table__placeholder' })); } return ele; }, handleTreeExpandIconClick: function handleTreeExpandIconClick(data, e) { e.stopPropagation(); if (data.store.states.lazy && !data.treeNode.loaded) { data.store.loadData(data.row, data.treeNode); } else { data.store.toggleTreeExpansion(data.treeNode.rowKey); } } }, mounted: function mounted() { var _this2 = this; var owner = this.owner; var parent = this.columnOrTableParent; var columnIndex = void 0; if (!this.isSubColumn) { columnIndex = [].indexOf.call(parent.$refs.hiddenColumns.children, this.$el); } else { columnIndex = [].indexOf.call(parent.$el.children, this.$el); } if (this.$scopedSlots.header) { if (this.type === 'selection') { console.warn('[Element Warn][TableColumn]Selection column doesn\'t allow to set scoped-slot header.'); } else { this.columnConfig.renderHeader = function (h, scope) { return _this2.$scopedSlots.header(scope); }; } } owner.store.commit('insertColumn', this.columnConfig, columnIndex, this.isSubColumn ? parent.columnConfig : null); } }); // CONCATENATED MODULE: ./packages/table-column/index.js /* istanbul ignore next */ table_column.install = function (Vue) { Vue.component(table_column.name, table_column); }; /* harmony default export */ var packages_table_column = __webpack_exports__["default"] = (table_column); /***/ }), /***/ 16: /***/ (function(module, exports) { module.exports = require("element-ui/lib/checkbox"); /***/ }), /***/ 26: /***/ (function(module, exports) { module.exports = require("element-ui/lib/tag"); /***/ }), /***/ 4: /***/ (function(module, exports) { module.exports = require("element-ui/lib/utils/util"); /***/ }), /***/ 8: /***/ (function(module, exports) { module.exports = require("element-ui/lib/utils/merge"); /***/ }) /******/ });