123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699 |
- 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");
- /***/ })
- /******/ });
|