app模板、应用模板、组件模板、widget模板
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1464 lines
42 KiB

4 years ago
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "/dist/";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 577);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 10:
  90. /***/ (function(module, exports) {
  91. module.exports = require("tis-ui/lib/utils/util");
  92. /***/ }),
  93. /***/ 13:
  94. /***/ (function(module, exports) {
  95. module.exports = require("tis-ui/lib/mixins/emitter");
  96. /***/ }),
  97. /***/ 2:
  98. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  99. "use strict";
  100. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  101. /* globals __VUE_SSR_CONTEXT__ */
  102. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  103. // This module is a runtime utility for cleaner component module output and will
  104. // be included in the final webpack user bundle.
  105. function normalizeComponent (
  106. scriptExports,
  107. render,
  108. staticRenderFns,
  109. functionalTemplate,
  110. injectStyles,
  111. scopeId,
  112. moduleIdentifier, /* server only */
  113. shadowMode /* vue-cli only */
  114. ) {
  115. // Vue.extend constructor export interop
  116. var options = typeof scriptExports === 'function'
  117. ? scriptExports.options
  118. : scriptExports
  119. // render functions
  120. if (render) {
  121. options.render = render
  122. options.staticRenderFns = staticRenderFns
  123. options._compiled = true
  124. }
  125. // functional template
  126. if (functionalTemplate) {
  127. options.functional = true
  128. }
  129. // scopedId
  130. if (scopeId) {
  131. options._scopeId = 'data-v-' + scopeId
  132. }
  133. var hook
  134. if (moduleIdentifier) { // server build
  135. hook = function (context) {
  136. // 2.3 injection
  137. context =
  138. context || // cached call
  139. (this.$vnode && this.$vnode.ssrContext) || // stateful
  140. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  141. // 2.2 with runInNewContext: true
  142. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  143. context = __VUE_SSR_CONTEXT__
  144. }
  145. // inject component styles
  146. if (injectStyles) {
  147. injectStyles.call(this, context)
  148. }
  149. // register component module identifier for async chunk inferrence
  150. if (context && context._registeredComponents) {
  151. context._registeredComponents.add(moduleIdentifier)
  152. }
  153. }
  154. // used by ssr in case component is cached and beforeCreate
  155. // never gets called
  156. options._ssrRegister = hook
  157. } else if (injectStyles) {
  158. hook = shadowMode
  159. ? function () {
  160. injectStyles.call(
  161. this,
  162. (options.functional ? this.parent : this).$root.$options.shadowRoot
  163. )
  164. }
  165. : injectStyles
  166. }
  167. if (hook) {
  168. if (options.functional) {
  169. // for template-only hot-reload because in that case the render fn doesn't
  170. // go through the normalizer
  171. options._injectStyles = hook
  172. // register for functional component in vue file
  173. var originalRender = options.render
  174. options.render = function renderWithStyleInjection (h, context) {
  175. hook.call(context)
  176. return originalRender(h, context)
  177. }
  178. } else {
  179. // inject component registration as beforeCreate hook
  180. var existing = options.beforeCreate
  181. options.beforeCreate = existing
  182. ? [].concat(existing, hook)
  183. : [hook]
  184. }
  185. }
  186. return {
  187. exports: scriptExports,
  188. options: options
  189. }
  190. }
  191. /***/ }),
  192. /***/ 50:
  193. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  194. "use strict";
  195. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getCell; });
  196. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return orderBy; });
  197. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getColumnById; });
  198. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getColumnByKey; });
  199. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getColumnByCell; });
  200. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getRowIdentity; });
  201. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getKeysMap; });
  202. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return mergeOptions; });
  203. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return parseWidth; });
  204. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return parseMinWidth; });
  205. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return parseHeight; });
  206. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return compose; });
  207. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return toggleRowStatus; });
  208. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return walkTreeNode; });
  209. /* harmony import */ var tis_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
  210. /* harmony import */ var tis_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(tis_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0__);
  211. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  212. var getCell = function getCell(event) {
  213. var cell = event.target;
  214. while (cell && cell.tagName.toUpperCase() !== 'HTML') {
  215. if (cell.tagName.toUpperCase() === 'TD') {
  216. return cell;
  217. }
  218. cell = cell.parentNode;
  219. }
  220. return null;
  221. };
  222. var isObject = function isObject(obj) {
  223. return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object';
  224. };
  225. var orderBy = function orderBy(array, sortKey, reverse, sortMethod, sortBy) {
  226. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  227. return array;
  228. }
  229. if (typeof reverse === 'string') {
  230. reverse = reverse === 'descending' ? -1 : 1;
  231. } else {
  232. reverse = reverse && reverse < 0 ? -1 : 1;
  233. }
  234. var getKey = sortMethod ? null : function (value, index) {
  235. if (sortBy) {
  236. if (!Array.isArray(sortBy)) {
  237. sortBy = [sortBy];
  238. }
  239. return sortBy.map(function (by) {
  240. if (typeof by === 'string') {
  241. return Object(tis_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0__["getValueByPath"])(value, by);
  242. } else {
  243. return by(value, index, array);
  244. }
  245. });
  246. }
  247. if (sortKey !== '$key') {
  248. if (isObject(value) && '$value' in value) value = value.$value;
  249. }
  250. return [isObject(value) ? Object(tis_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0__["getValueByPath"])(value, sortKey) : value];
  251. };
  252. var compare = function compare(a, b) {
  253. if (sortMethod) {
  254. return sortMethod(a.value, b.value);
  255. }
  256. for (var i = 0, len = a.key.length; i < len; i++) {
  257. if (a.key[i] < b.key[i]) {
  258. return -1;
  259. }
  260. if (a.key[i] > b.key[i]) {
  261. return 1;
  262. }
  263. }
  264. return 0;
  265. };
  266. return array.map(function (value, index) {
  267. return {
  268. value: value,
  269. index: index,
  270. key: getKey ? getKey(value, index) : null
  271. };
  272. }).sort(function (a, b) {
  273. var order = compare(a, b);
  274. if (!order) {
  275. // make stable https://en.wikipedia.org/wiki/Sorting_algorithm#Stability
  276. order = a.index - b.index;
  277. }
  278. return order * reverse;
  279. }).map(function (item) {
  280. return item.value;
  281. });
  282. };
  283. var getColumnById = function getColumnById(table, columnId) {
  284. var column = null;
  285. table.columns.forEach(function (item) {
  286. if (item.id === columnId) {
  287. column = item;
  288. }
  289. });
  290. return column;
  291. };
  292. var getColumnByKey = function getColumnByKey(table, columnKey) {
  293. var column = null;
  294. for (var i = 0; i < table.columns.length; i++) {
  295. var item = table.columns[i];
  296. if (item.columnKey === columnKey) {
  297. column = item;
  298. break;
  299. }
  300. }
  301. return column;
  302. };
  303. var getColumnByCell = function getColumnByCell(table, cell) {
  304. var matches = (cell.className || '').match(/el-table_[^\s]+/gm);
  305. if (matches) {
  306. return getColumnById(table, matches[0]);
  307. }
  308. return null;
  309. };
  310. var getRowIdentity = function getRowIdentity(row, rowKey) {
  311. if (!row) throw new Error('row is required when get row identity');
  312. if (typeof rowKey === 'string') {
  313. if (rowKey.indexOf('.') < 0) {
  314. return row[rowKey];
  315. }
  316. var key = rowKey.split('.');
  317. var current = row;
  318. for (var i = 0; i < key.length; i++) {
  319. current = current[key[i]];
  320. }
  321. return current;
  322. } else if (typeof rowKey === 'function') {
  323. return rowKey.call(null, row);
  324. }
  325. };
  326. var getKeysMap = function getKeysMap(array, rowKey) {
  327. var arrayMap = {};
  328. (array || []).forEach(function (row, index) {
  329. arrayMap[getRowIdentity(row, rowKey)] = { row: row, index: index };
  330. });
  331. return arrayMap;
  332. };
  333. function hasOwn(obj, key) {
  334. return Object.prototype.hasOwnProperty.call(obj, key);
  335. }
  336. function mergeOptions(defaults, config) {
  337. var options = {};
  338. var key = void 0;
  339. for (key in defaults) {
  340. options[key] = defaults[key];
  341. }
  342. for (key in config) {
  343. if (hasOwn(config, key)) {
  344. var value = config[key];
  345. if (typeof value !== 'undefined') {
  346. options[key] = value;
  347. }
  348. }
  349. }
  350. return options;
  351. }
  352. function parseWidth(width) {
  353. if (width !== undefined) {
  354. width = parseInt(width, 10);
  355. if (isNaN(width)) {
  356. width = null;
  357. }
  358. }
  359. return width;
  360. }
  361. function parseMinWidth(minWidth) {
  362. if (typeof minWidth !== 'undefined') {
  363. minWidth = parseWidth(minWidth);
  364. if (isNaN(minWidth)) {
  365. minWidth = 80;
  366. }
  367. }
  368. return minWidth;
  369. };
  370. function parseHeight(height) {
  371. if (typeof height === 'number') {
  372. return height;
  373. }
  374. if (typeof height === 'string') {
  375. if (/^\d+(?:px)?$/.test(height)) {
  376. return parseInt(height, 10);
  377. } else {
  378. return height;
  379. }
  380. }
  381. return null;
  382. }
  383. // https://github.com/reduxjs/redux/blob/master/src/compose.js
  384. function compose() {
  385. for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
  386. funcs[_key] = arguments[_key];
  387. }
  388. if (funcs.length === 0) {
  389. return function (arg) {
  390. return arg;
  391. };
  392. }
  393. if (funcs.length === 1) {
  394. return funcs[0];
  395. }
  396. return funcs.reduce(function (a, b) {
  397. return function () {
  398. return a(b.apply(undefined, arguments));
  399. };
  400. });
  401. }
  402. function toggleRowStatus(statusArr, row, newVal) {
  403. var changed = false;
  404. var index = statusArr.indexOf(row);
  405. var included = index !== -1;
  406. var addRow = function addRow() {
  407. statusArr.push(row);
  408. changed = true;
  409. };
  410. var removeRow = function removeRow() {
  411. statusArr.splice(index, 1);
  412. changed = true;
  413. };
  414. if (typeof newVal === 'boolean') {
  415. if (newVal && !included) {
  416. addRow();
  417. } else if (!newVal && included) {
  418. removeRow();
  419. }
  420. } else {
  421. if (included) {
  422. removeRow();
  423. } else {
  424. addRow();
  425. }
  426. }
  427. return changed;
  428. }
  429. function walkTreeNode(root, cb) {
  430. var childrenKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'children';
  431. var lazyKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'hasChildren';
  432. var isNil = function isNil(array) {
  433. return !(Array.isArray(array) && array.length);
  434. };
  435. function _walker(parent, children, level) {
  436. cb(parent, children, level);
  437. children.forEach(function (item) {
  438. if (item[lazyKey]) {
  439. cb(item, null, level + 1);
  440. return;
  441. }
  442. var children = item[childrenKey];
  443. if (!isNil(children)) {
  444. _walker(item, children, level + 1);
  445. }
  446. });
  447. }
  448. root.forEach(function (item) {
  449. if (item[lazyKey]) {
  450. cb(item, null, 0);
  451. return;
  452. }
  453. var children = item[childrenKey];
  454. if (!isNil(children)) {
  455. _walker(item, children, 0);
  456. }
  457. });
  458. }
  459. /***/ }),
  460. /***/ 577:
  461. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  462. "use strict";
  463. // ESM COMPAT FLAG
  464. __webpack_require__.r(__webpack_exports__);
  465. // EXTERNAL MODULE: external "tis-ui/lib/utils/util"
  466. var util_ = __webpack_require__(10);
  467. // CONCATENATED MODULE: ./packages/table/src/config.js
  468. var cellStarts = {
  469. default: {
  470. order: ''
  471. },
  472. selection: {
  473. width: 48,
  474. minWidth: 48,
  475. realWidth: 48,
  476. order: '',
  477. className: 'el-table-column--selection'
  478. },
  479. expand: {
  480. width: 48,
  481. minWidth: 48,
  482. realWidth: 48,
  483. order: ''
  484. },
  485. index: {
  486. width: 48,
  487. minWidth: 48,
  488. realWidth: 48,
  489. order: ''
  490. }
  491. };
  492. // 这些选项不应该被覆盖
  493. var cellForced = {
  494. selection: {
  495. renderHeader: function renderHeader(h, _ref) {
  496. var store = _ref.store;
  497. return h('tis-checkbox', {
  498. attrs: {
  499. disabled: store.states.data && store.states.data.length === 0,
  500. indeterminate: store.states.selection.length > 0 && !this.isAllSelected,
  501. value: this.isAllSelected },
  502. nativeOn: {
  503. 'click': this.toggleAllSelection
  504. }
  505. });
  506. },
  507. renderCell: function renderCell(h, _ref2) {
  508. var row = _ref2.row,
  509. column = _ref2.column,
  510. store = _ref2.store,
  511. $index = _ref2.$index;
  512. return h('tis-checkbox', {
  513. nativeOn: {
  514. 'click': function click(event) {
  515. return event.stopPropagation();
  516. }
  517. },
  518. attrs: {
  519. value: store.isSelected(row),
  520. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false
  521. },
  522. on: {
  523. 'input': function input() {
  524. store.commit('rowSelectedChanged', row);
  525. }
  526. }
  527. });
  528. },
  529. sortable: false,
  530. resizable: false
  531. },
  532. index: {
  533. renderHeader: function renderHeader(h, _ref3) {
  534. var column = _ref3.column;
  535. return column.label || '#';
  536. },
  537. renderCell: function renderCell(h, _ref4) {
  538. var $index = _ref4.$index,
  539. column = _ref4.column;
  540. var i = $index + 1;
  541. var index = column.index;
  542. if (typeof index === 'number') {
  543. i = $index + index;
  544. } else if (typeof index === 'function') {
  545. i = index($index);
  546. }
  547. return h('div', [i]);
  548. },
  549. sortable: false
  550. },
  551. expand: {
  552. renderHeader: function renderHeader(h, _ref5) {
  553. var column = _ref5.column;
  554. return column.label || '';
  555. },
  556. renderCell: function renderCell(h, _ref6) {
  557. var row = _ref6.row,
  558. store = _ref6.store;
  559. var classes = ['el-table__expand-icon'];
  560. if (store.states.expandRows.indexOf(row) > -1) {
  561. classes.push('el-table__expand-icon--expanded');
  562. }
  563. var callback = function callback(e) {
  564. e.stopPropagation();
  565. store.toggleRowExpansion(row);
  566. };
  567. return h(
  568. 'div',
  569. { 'class': classes,
  570. on: {
  571. 'click': callback
  572. }
  573. },
  574. [h('i', { 'class': 'el-icon el-icon-arrow-right' })]
  575. );
  576. },
  577. sortable: false,
  578. resizable: false,
  579. className: 'el-table__expand-column'
  580. }
  581. };
  582. function defaultRenderCell(h, _ref7) {
  583. var row = _ref7.row,
  584. column = _ref7.column,
  585. $index = _ref7.$index;
  586. var property = column.property;
  587. var value = property && Object(util_["getPropByPath"])(row, property).v;
  588. if (column && column.formatter) {
  589. return column.formatter(row, column, value, $index);
  590. }
  591. return value;
  592. }
  593. function treeCellPrefix(h, _ref8) {
  594. var row = _ref8.row,
  595. treeNode = _ref8.treeNode,
  596. store = _ref8.store;
  597. if (!treeNode) return null;
  598. var ele = [];
  599. var callback = function callback(e) {
  600. e.stopPropagation();
  601. store.loadOrToggle(row);
  602. };
  603. if (treeNode.indent) {
  604. ele.push(h('span', { 'class': 'el-table__indent', style: { 'padding-left': treeNode.indent + 'px' } }));
  605. }
  606. if (typeof treeNode.expanded === 'boolean' && !treeNode.noLazyChildren) {
  607. var expandClasses = ['el-table__expand-icon', treeNode.expanded ? 'el-table__expand-icon--expanded' : ''];
  608. var iconClasses = ['el-icon-arrow-right'];
  609. if (treeNode.loading) {
  610. iconClasses = ['el-icon-loading'];
  611. }
  612. ele.push(h(
  613. 'div',
  614. { 'class': expandClasses,
  615. on: {
  616. 'click': callback
  617. }
  618. },
  619. [h('i', { 'class': iconClasses })]
  620. ));
  621. } else {
  622. ele.push(h('span', { 'class': 'el-table__placeholder' }));
  623. }
  624. return ele;
  625. }
  626. // EXTERNAL MODULE: ./packages/table/src/util.js
  627. var util = __webpack_require__(50);
  628. // EXTERNAL MODULE: ./packages/checkbox/index.js + 5 modules
  629. var packages_checkbox = __webpack_require__(68);
  630. // CONCATENATED MODULE: ./packages/table/src/table-column.js
  631. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  632. var columnIdSeed = 1;
  633. /* harmony default export */ var table_column = ({
  634. name: 'TisTableColumn',
  635. props: {
  636. type: {
  637. type: String,
  638. default: 'default'
  639. },
  640. label: String,
  641. className: String,
  642. labelClassName: String,
  643. property: String,
  644. prop: String,
  645. width: {},
  646. minWidth: {},
  647. renderHeader: Function,
  648. sortable: {
  649. type: [Boolean, String],
  650. default: false
  651. },
  652. sortMethod: Function,
  653. sortBy: [String, Function, Array],
  654. resizable: {
  655. type: Boolean,
  656. default: true
  657. },
  658. columnKey: String,
  659. align: String,
  660. headerAlign: String,
  661. showTooltipWhenOverflow: Boolean,
  662. showOverflowTooltip: Boolean,
  663. fixed: [Boolean, String],
  664. formatter: Function,
  665. selectable: Function,
  666. reserveSelection: Boolean,
  667. filterMethod: Function,
  668. filteredValue: Array,
  669. filters: Array,
  670. filterPlacement: String,
  671. filterMultiple: {
  672. type: Boolean,
  673. default: true
  674. },
  675. index: [Number, Function],
  676. sortOrders: {
  677. type: Array,
  678. default: function _default() {
  679. return ['ascending', 'descending', null];
  680. },
  681. validator: function validator(val) {
  682. return val.every(function (order) {
  683. return ['ascending', 'descending', null].indexOf(order) > -1;
  684. });
  685. }
  686. }
  687. },
  688. data: function data() {
  689. return {
  690. isSubColumn: false,
  691. columns: []
  692. };
  693. },
  694. computed: {
  695. owner: function owner() {
  696. var parent = this.$parent;
  697. while (parent && !parent.tableId) {
  698. parent = parent.$parent;
  699. }
  700. return parent;
  701. },
  702. columnOrTableParent: function columnOrTableParent() {
  703. var parent = this.$parent;
  704. while (parent && !parent.tableId && !parent.columnId) {
  705. parent = parent.$parent;
  706. }
  707. return parent;
  708. },
  709. realWidth: function realWidth() {
  710. return Object(util["l" /* parseWidth */])(this.width);
  711. },
  712. realMinWidth: function realMinWidth() {
  713. return Object(util["k" /* parseMinWidth */])(this.minWidth);
  714. },
  715. realAlign: function realAlign() {
  716. return this.align ? 'is-' + this.align : null;
  717. },
  718. realHeaderAlign: function realHeaderAlign() {
  719. return this.headerAlign ? 'is-' + this.headerAlign : this.realAlign;
  720. }
  721. },
  722. methods: {
  723. getPropsData: function getPropsData() {
  724. var _this = this;
  725. for (var _len = arguments.length, props = Array(_len), _key = 0; _key < _len; _key++) {
  726. props[_key] = arguments[_key];
  727. }
  728. return props.reduce(function (prev, cur) {
  729. if (Array.isArray(cur)) {
  730. cur.forEach(function (key) {
  731. prev[key] = _this[key];
  732. });
  733. }
  734. return prev;
  735. }, {});
  736. },
  737. getColumnElIndex: function getColumnElIndex(children, child) {
  738. return [].indexOf.call(children, child);
  739. },
  740. setColumnWidth: function setColumnWidth(column) {
  741. if (this.realWidth) {
  742. column.width = this.realWidth;
  743. }
  744. if (this.realMinWidth) {
  745. column.minWidth = this.realMinWidth;
  746. }
  747. if (!column.minWidth) {
  748. column.minWidth = 80;
  749. }
  750. column.realWidth = column.width === undefined ? column.minWidth : column.width;
  751. return column;
  752. },
  753. setColumnForcedProps: function setColumnForcedProps(column) {
  754. // 对于特定类型的 column,某些属性不允许设置
  755. var type = column.type;
  756. var source = cellForced[type] || {};
  757. Object.keys(source).forEach(function (prop) {
  758. var value = source[prop];
  759. if (value !== undefined) {
  760. column[prop] = prop === 'className' ? column[prop] + ' ' + value : value;
  761. }
  762. });
  763. return column;
  764. },
  765. setColumnRenders: function setColumnRenders(column) {
  766. var _this2 = this;
  767. var h = this.$createElement;
  768. // renderHeader 属性不推荐使用。
  769. if (this.renderHeader) {
  770. console.warn('[Element Warn][TableColumn]Comparing to render-header, scoped-slot header is easier to use. We recommend users to use scoped-slot header.');
  771. } else if (column.type !== 'selection') {
  772. column.renderHeader = function (h, scope) {
  773. var renderHeader = _this2.$scopedSlots.header;
  774. return renderHeader ? renderHeader(scope) : column.label;
  775. };
  776. }
  777. var originRenderCell = column.renderCell;
  778. // TODO: 这里的实现调整
  779. if (column.type === 'expand') {
  780. // 对于展开行,renderCell 不允许配置的。在上一步中已经设置过,这里需要简单封装一下。
  781. column.renderCell = function (h, data) {
  782. return h(
  783. 'div',
  784. { 'class': 'cell' },
  785. [originRenderCell(h, data)]
  786. );
  787. };
  788. this.owner.renderExpanded = function (h, data) {
  789. return _this2.$scopedSlots.default ? _this2.$scopedSlots.default(data) : _this2.$slots.default;
  790. };
  791. } else {
  792. originRenderCell = originRenderCell || defaultRenderCell;
  793. // 对 renderCell 进行包装
  794. column.renderCell = function (h, data) {
  795. var children = null;
  796. if (_this2.$scopedSlots.default) {
  797. children = _this2.$scopedSlots.default(data);
  798. } else {
  799. children = originRenderCell(h, data);
  800. }
  801. var prefix = treeCellPrefix(h, data);
  802. var props = {
  803. class: 'cell',
  804. style: {}
  805. };
  806. if (column.showOverflowTooltip) {
  807. props.class += ' el-tooltip';
  808. props.style = { width: (data.column.realWidth || data.column.width) - 1 + 'px' };
  809. }
  810. return h(
  811. 'div',
  812. props,
  813. [prefix, children]
  814. );
  815. };
  816. }
  817. return column;
  818. },
  819. registerNormalWatchers: function registerNormalWatchers() {
  820. var _this3 = this;
  821. var props = ['label', 'property', 'filters', 'filterMultiple', 'sortable', 'index', 'formatter', 'className', 'labelClassName', 'showOverflowTooltip'];
  822. // 一些属性具有别名
  823. var aliases = {
  824. prop: 'property',
  825. realAlign: 'align',
  826. realHeaderAlign: 'headerAlign',
  827. realWidth: 'width'
  828. };
  829. var allAliases = props.reduce(function (prev, cur) {
  830. prev[cur] = cur;
  831. return prev;
  832. }, aliases);
  833. Object.keys(allAliases).forEach(function (key) {
  834. var columnKey = aliases[key];
  835. _this3.$watch(key, function (newVal) {
  836. _this3.columnConfig[columnKey] = newVal;
  837. });
  838. });
  839. },
  840. registerComplexWatchers: function registerComplexWatchers() {
  841. var _this4 = this;
  842. var props = ['fixed'];
  843. var aliases = {
  844. realWidth: 'width',
  845. realMinWidth: 'minWidth'
  846. };
  847. var allAliases = props.reduce(function (prev, cur) {
  848. prev[cur] = cur;
  849. return prev;
  850. }, aliases);
  851. Object.keys(allAliases).forEach(function (key) {
  852. var columnKey = aliases[key];
  853. _this4.$watch(key, function (newVal) {
  854. _this4.columnConfig[columnKey] = newVal;
  855. var updateColumns = columnKey === 'fixed';
  856. _this4.owner.store.scheduleLayout(updateColumns);
  857. });
  858. });
  859. }
  860. },
  861. components: {
  862. ElCheckbox: packages_checkbox["default"]
  863. },
  864. beforeCreate: function beforeCreate() {
  865. this.row = {};
  866. this.column = {};
  867. this.$index = 0;
  868. this.columnId = '';
  869. },
  870. created: function created() {
  871. var parent = this.columnOrTableParent;
  872. this.isSubColumn = this.owner !== parent;
  873. this.columnId = (parent.tableId || parent.columnId) + '_column_' + columnIdSeed++;
  874. var type = this.type || 'default';
  875. var sortable = this.sortable === '' ? true : this.sortable;
  876. var defaults = _extends({}, cellStarts[type], {
  877. id: this.columnId,
  878. type: type,
  879. property: this.prop || this.property,
  880. align: this.realAlign,
  881. headerAlign: this.realHeaderAlign,
  882. showOverflowTooltip: this.showOverflowTooltip || this.showTooltipWhenOverflow,
  883. // filter 相关属性
  884. filterable: this.filters || this.filterMethod,
  885. filteredValue: [],
  886. filterPlacement: '',
  887. isColumnGroup: false,
  888. filterOpened: false,
  889. // sort 相关属性
  890. sortable: sortable,
  891. // index 列
  892. index: this.index
  893. });
  894. var basicProps = ['columnKey', 'label', 'className', 'labelClassName', 'type', 'renderHeader', 'formatter', 'fixed', 'resizable'];
  895. var sortProps = ['sortMethod', 'sortBy', 'sortOrders'];
  896. var selectProps = ['selectable', 'reserveSelection'];
  897. var filterProps = ['filterMethod', 'filters', 'filterMultiple', 'filterOpened', 'filteredValue', 'filterPlacement'];
  898. var column = this.getPropsData(basicProps, sortProps, selectProps, filterProps);
  899. column = Object(util["h" /* mergeOptions */])(defaults, column);
  900. // 注意 compose 中函数执行的顺序是从右到左
  901. var chains = Object(util["a" /* compose */])(this.setColumnRenders, this.setColumnWidth, this.setColumnForcedProps);
  902. column = chains(column);
  903. this.columnConfig = column;
  904. // 注册 watcher
  905. this.registerNormalWatchers();
  906. this.registerComplexWatchers();
  907. },
  908. mounted: function mounted() {
  909. var owner = this.owner;
  910. var parent = this.columnOrTableParent;
  911. var children = this.isSubColumn ? parent.$el.children : parent.$refs.hiddenColumns.children;
  912. var columnIndex = this.getColumnElIndex(children, this.$el);
  913. owner.store.commit('insertColumn', this.columnConfig, columnIndex, this.isSubColumn ? parent.columnConfig : null);
  914. },
  915. destroyed: function destroyed() {
  916. if (!this.$parent) return;
  917. var parent = this.$parent;
  918. this.owner.store.commit('removeColumn', this.columnConfig, this.isSubColumn ? parent.columnConfig : null);
  919. },
  920. render: function render(h) {
  921. // slots 也要渲染,需要计算合并表头
  922. return h('div', this.$slots.default);
  923. }
  924. });
  925. // CONCATENATED MODULE: ./packages/table-column/index.js
  926. /* istanbul ignore next */
  927. table_column.install = function (Vue) {
  928. Vue.component(table_column.name, table_column);
  929. };
  930. /* harmony default export */ var packages_table_column = __webpack_exports__["default"] = (table_column);
  931. /***/ }),
  932. /***/ 68:
  933. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  934. "use strict";
  935. // ESM COMPAT FLAG
  936. __webpack_require__.r(__webpack_exports__);
  937. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/checkbox/src/checkbox.vue?vue&type=template&id=d0387074&
  938. var render = function() {
  939. var _vm = this
  940. var _h = _vm.$createElement
  941. var _c = _vm._self._c || _h
  942. return _c(
  943. "label",
  944. {
  945. staticClass: "el-checkbox",
  946. class: [
  947. _vm.border && _vm.checkboxSize
  948. ? "el-checkbox--" + _vm.checkboxSize
  949. : "",
  950. { "is-disabled": _vm.isDisabled },
  951. { "is-bordered": _vm.border },
  952. { "is-checked": _vm.isChecked }
  953. ],
  954. attrs: { id: _vm.id }
  955. },
  956. [
  957. _c(
  958. "span",
  959. {
  960. staticClass: "el-checkbox__input",
  961. class: {
  962. "is-disabled": _vm.isDisabled,
  963. "is-checked": _vm.isChecked,
  964. "is-indeterminate": _vm.indeterminate,
  965. "is-focus": _vm.focus
  966. },
  967. attrs: {
  968. tabindex: _vm.indeterminate ? 0 : false,
  969. role: _vm.indeterminate ? "checkbox" : false,
  970. "aria-checked": _vm.indeterminate ? "mixed" : false
  971. }
  972. },
  973. [
  974. _c("span", { staticClass: "el-checkbox__inner" }),
  975. _vm.trueLabel || _vm.falseLabel
  976. ? _c("input", {
  977. directives: [
  978. {
  979. name: "model",
  980. rawName: "v-model",
  981. value: _vm.model,
  982. expression: "model"
  983. }
  984. ],
  985. staticClass: "el-checkbox__original",
  986. attrs: {
  987. type: "checkbox",
  988. "aria-hidden": _vm.indeterminate ? "true" : "false",
  989. name: _vm.name,
  990. disabled: _vm.isDisabled,
  991. "true-value": _vm.trueLabel,
  992. "false-value": _vm.falseLabel
  993. },
  994. domProps: {
  995. checked: Array.isArray(_vm.model)
  996. ? _vm._i(_vm.model, null) > -1
  997. : _vm._q(_vm.model, _vm.trueLabel)
  998. },
  999. on: {
  1000. change: [
  1001. function($event) {
  1002. var $$a = _vm.model,
  1003. $$el = $event.target,
  1004. $$c = $$el.checked ? _vm.trueLabel : _vm.falseLabel
  1005. if (Array.isArray($$a)) {
  1006. var $$v = null,
  1007. $$i = _vm._i($$a, $$v)
  1008. if ($$el.checked) {
  1009. $$i < 0 && (_vm.model = $$a.concat([$$v]))
  1010. } else {
  1011. $$i > -1 &&
  1012. (_vm.model = $$a
  1013. .slice(0, $$i)
  1014. .concat($$a.slice($$i + 1)))
  1015. }
  1016. } else {
  1017. _vm.model = $$c
  1018. }
  1019. },
  1020. _vm.handleChange
  1021. ],
  1022. focus: function($event) {
  1023. _vm.focus = true
  1024. },
  1025. blur: function($event) {
  1026. _vm.focus = false
  1027. }
  1028. }
  1029. })
  1030. : _c("input", {
  1031. directives: [
  1032. {
  1033. name: "model",
  1034. rawName: "v-model",
  1035. value: _vm.model,
  1036. expression: "model"
  1037. }
  1038. ],
  1039. staticClass: "el-checkbox__original",
  1040. attrs: {
  1041. type: "checkbox",
  1042. "aria-hidden": _vm.indeterminate ? "true" : "false",
  1043. disabled: _vm.isDisabled,
  1044. name: _vm.name
  1045. },
  1046. domProps: {
  1047. value: _vm.label,
  1048. checked: Array.isArray(_vm.model)
  1049. ? _vm._i(_vm.model, _vm.label) > -1
  1050. : _vm.model
  1051. },
  1052. on: {
  1053. change: [
  1054. function($event) {
  1055. var $$a = _vm.model,
  1056. $$el = $event.target,
  1057. $$c = $$el.checked ? true : false
  1058. if (Array.isArray($$a)) {
  1059. var $$v = _vm.label,
  1060. $$i = _vm._i($$a, $$v)
  1061. if ($$el.checked) {
  1062. $$i < 0 && (_vm.model = $$a.concat([$$v]))
  1063. } else {
  1064. $$i > -1 &&
  1065. (_vm.model = $$a
  1066. .slice(0, $$i)
  1067. .concat($$a.slice($$i + 1)))
  1068. }
  1069. } else {
  1070. _vm.model = $$c
  1071. }
  1072. },
  1073. _vm.handleChange
  1074. ],
  1075. focus: function($event) {
  1076. _vm.focus = true
  1077. },
  1078. blur: function($event) {
  1079. _vm.focus = false
  1080. }
  1081. }
  1082. })
  1083. ]
  1084. ),
  1085. _vm.$slots.default || _vm.label
  1086. ? _c(
  1087. "span",
  1088. { staticClass: "el-checkbox__label" },
  1089. [
  1090. _vm._t("default"),
  1091. !_vm.$slots.default ? [_vm._v(_vm._s(_vm.label))] : _vm._e()
  1092. ],
  1093. 2
  1094. )
  1095. : _vm._e()
  1096. ]
  1097. )
  1098. }
  1099. var staticRenderFns = []
  1100. render._withStripped = true
  1101. // CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue?vue&type=template&id=d0387074&
  1102. // EXTERNAL MODULE: external "tis-ui/lib/mixins/emitter"
  1103. var emitter_ = __webpack_require__(13);
  1104. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  1105. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/checkbox/src/checkbox.vue?vue&type=script&lang=js&
  1106. //
  1107. //
  1108. //
  1109. //
  1110. //
  1111. //
  1112. //
  1113. //
  1114. //
  1115. //
  1116. //
  1117. //
  1118. //
  1119. //
  1120. //
  1121. //
  1122. //
  1123. //
  1124. //
  1125. //
  1126. //
  1127. //
  1128. //
  1129. //
  1130. //
  1131. //
  1132. //
  1133. //
  1134. //
  1135. //
  1136. //
  1137. //
  1138. //
  1139. //
  1140. //
  1141. //
  1142. //
  1143. //
  1144. //
  1145. //
  1146. //
  1147. //
  1148. //
  1149. //
  1150. //
  1151. //
  1152. //
  1153. //
  1154. //
  1155. //
  1156. //
  1157. //
  1158. //
  1159. //
  1160. //
  1161. /* harmony default export */ var checkboxvue_type_script_lang_js_ = ({
  1162. name: 'TisCheckbox',
  1163. mixins: [emitter_default.a],
  1164. inject: {
  1165. elForm: {
  1166. default: ''
  1167. },
  1168. elFormItem: {
  1169. default: ''
  1170. }
  1171. },
  1172. componentName: 'TisCheckbox',
  1173. data: function data() {
  1174. return {
  1175. selfModel: false,
  1176. focus: false,
  1177. isLimitExceeded: false
  1178. };
  1179. },
  1180. computed: {
  1181. model: {
  1182. get: function get() {
  1183. return this.isGroup ? this.store : this.value !== undefined ? this.value : this.selfModel;
  1184. },
  1185. set: function set(val) {
  1186. if (this.isGroup) {
  1187. this.isLimitExceeded = false;
  1188. this._checkboxGroup.min !== undefined && val.length < this._checkboxGroup.min && (this.isLimitExceeded = true);
  1189. this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (this.isLimitExceeded = true);
  1190. this.isLimitExceeded === false && this.dispatch('TisCheckboxGroup', 'input', [val]);
  1191. } else {
  1192. this.$emit('input', val);
  1193. this.selfModel = val;
  1194. }
  1195. }
  1196. },
  1197. isChecked: function isChecked() {
  1198. if ({}.toString.call(this.model) === '[object Boolean]') {
  1199. return this.model;
  1200. } else if (Array.isArray(this.model)) {
  1201. return this.model.indexOf(this.label) > -1;
  1202. } else if (this.model !== null && this.model !== undefined) {
  1203. return this.model === this.trueLabel;
  1204. }
  1205. },
  1206. isGroup: function isGroup() {
  1207. var parent = this.$parent;
  1208. while (parent) {
  1209. if (parent.$options.componentName !== 'TisCheckboxGroup') {
  1210. parent = parent.$parent;
  1211. } else {
  1212. this._checkboxGroup = parent;
  1213. return true;
  1214. }
  1215. }
  1216. return false;
  1217. },
  1218. store: function store() {
  1219. return this._checkboxGroup ? this._checkboxGroup.value : this.value;
  1220. },
  1221. /* used to make the isDisabled judgment under max/min props */
  1222. isLimitDisabled: function isLimitDisabled() {
  1223. var _checkboxGroup = this._checkboxGroup,
  1224. max = _checkboxGroup.max,
  1225. min = _checkboxGroup.min;
  1226. return !!(max || min) && this.model.length >= max && !this.isChecked || this.model.length <= min && this.isChecked;
  1227. },
  1228. isDisabled: function isDisabled() {
  1229. return this.isGroup ? this._checkboxGroup.disabled || this.disabled || (this.elForm || {}).disabled || this.isLimitDisabled : this.disabled || (this.elForm || {}).disabled;
  1230. },
  1231. _elFormItemSize: function _elFormItemSize() {
  1232. return (this.elFormItem || {}).elFormItemSize;
  1233. },
  1234. checkboxSize: function checkboxSize() {
  1235. var temCheckboxSize = this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
  1236. return this.isGroup ? this._checkboxGroup.checkboxGroupSize || temCheckboxSize : temCheckboxSize;
  1237. }
  1238. },
  1239. props: {
  1240. value: {},
  1241. label: {},
  1242. indeterminate: Boolean,
  1243. disabled: Boolean,
  1244. checked: Boolean,
  1245. name: String,
  1246. trueLabel: [String, Number],
  1247. falseLabel: [String, Number],
  1248. id: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
  1249. controls: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
  1250. border: Boolean,
  1251. size: String
  1252. },
  1253. methods: {
  1254. addToStore: function addToStore() {
  1255. if (Array.isArray(this.model) && this.model.indexOf(this.label) === -1) {
  1256. this.model.push(this.label);
  1257. } else {
  1258. this.model = this.trueLabel || true;
  1259. }
  1260. },
  1261. handleChange: function handleChange(ev) {
  1262. var _this = this;
  1263. if (this.isLimitExceeded) return;
  1264. var value = void 0;
  1265. if (ev.target.checked) {
  1266. value = this.trueLabel === undefined ? true : this.trueLabel;
  1267. } else {
  1268. value = this.falseLabel === undefined ? false : this.falseLabel;
  1269. }
  1270. this.$emit('change', value, ev);
  1271. this.$nextTick(function () {
  1272. if (_this.isGroup) {
  1273. _this.dispatch('TisCheckboxGroup', 'change', [_this._checkboxGroup.value]);
  1274. }
  1275. });
  1276. }
  1277. },
  1278. created: function created() {
  1279. this.checked && this.addToStore();
  1280. },
  1281. mounted: function mounted() {
  1282. // 为indeterminate元素 添加aria-controls 属性
  1283. if (this.indeterminate) {
  1284. this.$el.setAttribute('aria-controls', this.controls);
  1285. }
  1286. },
  1287. watch: {
  1288. value: function value(_value) {
  1289. this.dispatch('ElFormItem', 'el.form.change', _value);
  1290. }
  1291. }
  1292. });
  1293. // CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue?vue&type=script&lang=js&
  1294. /* harmony default export */ var src_checkboxvue_type_script_lang_js_ = (checkboxvue_type_script_lang_js_);
  1295. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  1296. var componentNormalizer = __webpack_require__(2);
  1297. // CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue
  1298. /* normalize component */
  1299. var component = Object(componentNormalizer["a" /* default */])(
  1300. src_checkboxvue_type_script_lang_js_,
  1301. render,
  1302. staticRenderFns,
  1303. false,
  1304. null,
  1305. null,
  1306. null
  1307. )
  1308. /* hot reload */
  1309. if (false) { var api; }
  1310. component.options.__file = "packages/checkbox/src/checkbox.vue"
  1311. /* harmony default export */ var src_checkbox = (component.exports);
  1312. // CONCATENATED MODULE: ./packages/checkbox/index.js
  1313. /* istanbul ignore next */
  1314. src_checkbox.install = function (Vue) {
  1315. Vue.component(src_checkbox.name, src_checkbox);
  1316. };
  1317. /* harmony default export */ var packages_checkbox = __webpack_exports__["default"] = (src_checkbox);
  1318. /***/ })
  1319. /******/ });