bkui-vue 1.0.3-beta.3 → 1.0.3-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,8 @@ import "../button/button.less";
25
25
  import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon__3efece53__ from "../icon/";
26
26
  import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_popover_9b03f19d__ from "../popover";
27
27
  import "../popover/popover.less";
28
+ import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_input_d525237e__ from "../input";
29
+ import "../input/input.less";
28
30
  /******/ // The require scope
29
31
  /******/ var __webpack_require__ = {};
30
32
  /******/
@@ -120,7 +122,7 @@ function defineProperty_defineProperty(obj, key, value) {
120
122
  ;// CONCATENATED MODULE: external "vue"
121
123
  var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
122
124
  var external_vue_y = x => () => x
123
- const external_vue_namespaceObject = external_vue_x({ ["Fragment"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Fragment, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createTextVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["inject"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.inject, ["isVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.isVNode, ["mergeProps"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps, ["nextTick"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.nextTick, ["onBeforeUnmount"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["provide"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.provide, ["reactive"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.reactive, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["resolveComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent, ["toRef"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.toRef, ["toRefs"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.toRefs, ["unref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.unref, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch });
125
+ const external_vue_namespaceObject = external_vue_x({ ["Fragment"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Fragment, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createTextVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["inject"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.inject, ["isProxy"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.isProxy, ["isVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.isVNode, ["mergeProps"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps, ["nextTick"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.nextTick, ["onBeforeUnmount"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["provide"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.provide, ["reactive"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.reactive, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["toRaw"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.toRaw, ["toRef"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.toRef, ["toRefs"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.toRefs, ["unref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.unref, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch });
124
126
  ;// CONCATENATED MODULE: ../../packages/table/src/const.ts
125
127
 
126
128
  /*
@@ -452,6 +454,13 @@ var tableProps = {
452
454
  * 是否显示Head
453
455
  */
454
456
  showHead: shared_namespaceObject.PropTypes.bool.def(true),
457
+ /**
458
+ * 排序时对需要排序的字符串数值进行格式化
459
+ * 这里需要配置为正则或者回调函数,(str) => string | number | boolean
460
+ * 如果配置为正则,程序会提取匹配到的第一个结果尝试转换为数值
461
+ * 如果为多个,程序会顺序执行所有正则表达式,直到转换成功
462
+ */
463
+ sortValFormat: shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.any).def(['']),
455
464
  /**
456
465
  * table header config
457
466
  */
@@ -1600,195 +1609,6 @@ function v4(options, buf, offset) {
1600
1609
  }
1601
1610
 
1602
1611
  /* harmony default export */ const esm_browser_v4 = (v4);
1603
- ;// CONCATENATED MODULE: ../../packages/table/src/plugins/use-pagination.tsx
1604
-
1605
-
1606
-
1607
- function use_pagination_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1608
- function use_pagination_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? use_pagination_ownKeys(Object(t), !0).forEach(function (r) { defineProperty_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : use_pagination_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1609
- /*
1610
- * Tencent is pleased to support the open source community by making
1611
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1612
- *
1613
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1614
- *
1615
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1616
- *
1617
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1618
- *
1619
- * ---------------------------------------------------
1620
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1621
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1622
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1623
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1624
- *
1625
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1626
- * the Software.
1627
- *
1628
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1629
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1630
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1631
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1632
- * IN THE SOFTWARE.
1633
- */
1634
-
1635
-
1636
- /**
1637
- * 处理 Prop中的分页配置
1638
- * prop中的配置会覆盖本地的配置
1639
- * @param propPagination 用户传入的配置
1640
- * @param defVal 默认配置
1641
- * @returns 返回值
1642
- */
1643
- var resolvePaginationOption = function resolvePaginationOption(propPagination, defVal) {
1644
- if (!!propPagination) {
1645
- if (typeof_typeof(propPagination) === 'object') {
1646
- var current = Object.prototype.hasOwnProperty.call(propPagination, 'current') ? propPagination.current : propPagination.value;
1647
- if (!/\d+/.test(current)) {
1648
- current = 1;
1649
- }
1650
- return use_pagination_objectSpread(use_pagination_objectSpread(use_pagination_objectSpread({}, defVal), propPagination), {}, {
1651
- current: current
1652
- });
1653
- }
1654
- return defVal;
1655
- }
1656
- return {};
1657
- };
1658
- /* harmony default export */ const use_pagination = (function (props) {
1659
- var startIndex = (0,external_vue_namespaceObject.ref)(0);
1660
- var endIndex = (0,external_vue_namespaceObject.ref)(0);
1661
- /**
1662
- * 分页配置
1663
- * 用于配置分页组件
1664
- * pagination 为Prop传入配置
1665
- * 方便兼容内置分页功能,此处需要单独处理count
1666
- */
1667
- var propsData = (0,external_vue_namespaceObject.computed)(function () {
1668
- return props.data;
1669
- });
1670
- var localPagination = (0,external_vue_namespaceObject.ref)(null);
1671
- var indexData = (0,external_vue_namespaceObject.reactive)([]);
1672
- // 当前分页缓存,用于支持内置前端分页,用户无需接收change事件来自行处理数据分割
1673
- var pagination = (0,external_vue_namespaceObject.reactive)({
1674
- count: 0,
1675
- limit: 10,
1676
- current: 1,
1677
- align: 'right',
1678
- layout: ['total', 'limit', 'list']
1679
- });
1680
- var resolveLocalPagination = function resolveLocalPagination() {
1681
- if (!props.pagination) {
1682
- return;
1683
- }
1684
- localPagination.value = props.remotePagination ? pagination : use_pagination_objectSpread(use_pagination_objectSpread({}, pagination), {}, {
1685
- count: indexData.length
1686
- });
1687
- };
1688
- /**
1689
- * 重置当前分页开始位置 & 结束位置
1690
- * 如果未启用分页,则开始位置为0,结束位置为 data.length
1691
- * @returns
1692
- */
1693
- var resetStartEndIndex = function resetStartEndIndex() {
1694
- if (!props.pagination || props.remotePagination) {
1695
- startIndex.value = 0;
1696
- endIndex.value = indexData.length;
1697
- return;
1698
- }
1699
- // 如果是前端分页
1700
- startIndex.value = (pagination.current - 1) * pagination.limit;
1701
- endIndex.value = pagination.current * pagination.limit;
1702
- };
1703
- /**
1704
- * 当前页分页数据
1705
- */
1706
- var pageData = (0,external_vue_namespaceObject.reactive)([]);
1707
- var sort = function sort(sourceData, sortFn, column, type, sortScope) {
1708
- if (typeof sortFn === 'function') {
1709
- sourceData.sort(function (a, b) {
1710
- return sortFn(a, b, type, column, sortScope);
1711
- });
1712
- }
1713
- };
1714
- /**
1715
- * 初始化排序动作
1716
- * @param data
1717
- * @param sortColumns
1718
- */
1719
- var multiSort = function multiSort(data, sortColumns) {
1720
- sortColumns.forEach(function (item) {
1721
- sort(data, item.schema[COLUMN_ATTRIBUTE.COL_SORT_FN], item.column, item.schema[COLUMN_ATTRIBUTE.COL_SORT_TYPE], item.schema[COLUMN_ATTRIBUTE.COL_SORT_SCOPE]);
1722
- });
1723
- };
1724
- var filter = function filter(sourceData, filterFn) {
1725
- if (typeof filterFn === 'function') {
1726
- var filterVals = sourceData.filter(function (row, index) {
1727
- return filterFn(row, index, indexData);
1728
- });
1729
- sourceData.length = 0;
1730
- sourceData.push.apply(sourceData, _toConsumableArray(filterVals));
1731
- }
1732
- return sourceData;
1733
- };
1734
- var resolveIndexData = function resolveIndexData() {
1735
- return new Promise(function (resolve) {
1736
- (0,external_vue_namespaceObject.nextTick)(function () {
1737
- var target = propsData.value.slice();
1738
- indexData.length = 0;
1739
- indexData.push.apply(indexData, _toConsumableArray(target));
1740
- resolve();
1741
- });
1742
- });
1743
- };
1744
- var resolvePageData = function resolvePageData(filterFn, sortFn, column, type, sortScope, multiCol) {
1745
- var sourceData = indexData.slice();
1746
- if (multiCol !== null && multiCol !== void 0 && multiCol.length) {
1747
- multiSort(sourceData, multiCol);
1748
- }
1749
- pageData.length = 0;
1750
- pageData.push.apply(pageData, _toConsumableArray(sourceData.slice(startIndex.value, endIndex.value)));
1751
- filter(pageData, filterFn);
1752
- sort(pageData, sortFn, column, type, sortScope);
1753
- resolveLocalPagination();
1754
- };
1755
- var resolvePageDataBySortList = function resolvePageDataBySortList(multiCol) {
1756
- resolvePageData(null, null, null, null, null, multiCol);
1757
- };
1758
- var multiFilter = function multiFilter(filterFnList) {
1759
- var sourceData = indexData.slice();
1760
- var target = filterFnList.reduce(function (result, fn) {
1761
- return filter(result, fn);
1762
- }, sourceData);
1763
- pageData.length = 0;
1764
- pageData.push.apply(pageData, _toConsumableArray(target));
1765
- };
1766
- var handlePaginationChange = function handlePaginationChange() {
1767
- pagination = resolvePaginationOption(props.pagination, pagination);
1768
- resolveLocalPagination();
1769
- resetStartEndIndex();
1770
- resolvePageData();
1771
- };
1772
- handlePaginationChange();
1773
- (0,external_vue_namespaceObject.watch)(function () {
1774
- return [props.pagination];
1775
- }, function () {
1776
- handlePaginationChange();
1777
- }, {
1778
- deep: true
1779
- });
1780
- return {
1781
- pageData: pageData,
1782
- indexData: indexData,
1783
- localPagination: localPagination,
1784
- resolvePageData: resolvePageData,
1785
- resolveIndexData: resolveIndexData,
1786
- resolvePageDataBySortList: resolvePageDataBySortList,
1787
- resetStartEndIndex: resetStartEndIndex,
1788
- multiFilter: multiFilter,
1789
- sort: sort
1790
- };
1791
- });
1792
1612
  ;// CONCATENATED MODULE: external "lodash/debounce"
1793
1613
  var debounce_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
1794
1614
  var debounce_y = x => () => x
@@ -2765,6 +2585,7 @@ function utils_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
2765
2585
 
2766
2586
 
2767
2587
 
2588
+
2768
2589
  /**
2769
2590
  * 解析Prop值 | 可能为多种类型 & 函数返回的场景
2770
2591
  * @param prop 当前Prop
@@ -2945,6 +2766,10 @@ var resolveHeadConfig = function resolveHeadConfig(props) {
2945
2766
  height: headHeight
2946
2767
  }, thead);
2947
2768
  };
2769
+ var getRegExp = function getRegExp(val) {
2770
+ var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'ig';
2771
+ return new RegExp("".concat(val).replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'), flags);
2772
+ };
2948
2773
  /**
2949
2774
  * 获取当前行指定列的内容
2950
2775
  * @param row 当前行
@@ -2953,11 +2778,29 @@ var resolveHeadConfig = function resolveHeadConfig(props) {
2953
2778
  * @param index 当前行Index
2954
2779
  * @returns
2955
2780
  */
2956
- var getRowText = function getRowText(row, key) {
2781
+ var getRowText = function getRowText(row, key, format) {
2782
+ var result;
2957
2783
  if (typeof row === 'string' || typeof row === 'number' || typeof row === 'boolean') {
2958
- return row;
2784
+ result = row;
2959
2785
  }
2960
- return (0,get_namespaceObject["default"])(row, key);
2786
+ if (typeof_typeof(row) === 'object') {
2787
+ result = (0,get_namespaceObject["default"])(row, key);
2788
+ }
2789
+ if (format !== null && format !== void 0 && format.length) {
2790
+ format.forEach(function (reg) {
2791
+ if (typeof reg === 'function') {
2792
+ result = reg(result, row, key);
2793
+ } else if (typeof result === 'string') {
2794
+ var _matches$;
2795
+ var matches = result.match(typeof reg === 'string' ? getRegExp(reg) : reg);
2796
+ result = (_matches$ = matches === null || matches === void 0 ? void 0 : matches[1]) !== null && _matches$ !== void 0 ? _matches$ : result;
2797
+ }
2798
+ });
2799
+ if (/^-?\d+.?\d*$/.test(result)) {
2800
+ result = Number(result);
2801
+ }
2802
+ }
2803
+ return result;
2961
2804
  };
2962
2805
  /**
2963
2806
  * 获取当前行指定列的值
@@ -3106,9 +2949,10 @@ var skipThisColumn = function skipThisColumn(columns, colIndex, row, rowIndex) {
3106
2949
  };
3107
2950
  var getSortFn = function getSortFn(column, sortType) {
3108
2951
  var _column$sort, _column$sort2;
2952
+ var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
3109
2953
  var fieldName = column.field;
3110
2954
  var getVal = function getVal(row) {
3111
- return getRowText(row, fieldName);
2955
+ return getRowText(row, fieldName, format);
3112
2956
  };
3113
2957
  var sortFn0 = function sortFn0(a, b) {
3114
2958
  var _getVal, _getVal2;
@@ -3134,6 +2978,7 @@ var getNextSortType = function getNextSortType(sortType) {
3134
2978
  return Object.keys(steps)[(steps[sortType] + 1) % 3];
3135
2979
  };
3136
2980
  var resolveSort = function resolveSort(sort, column) {
2981
+ var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
3137
2982
  if (typeof sort === 'string') {
3138
2983
  return {
3139
2984
  value: sort
@@ -3152,7 +2997,7 @@ var resolveSort = function resolveSort(sort, column) {
3152
2997
  }, sort);
3153
2998
  }
3154
2999
  return Object.assign({}, {
3155
- sortFn: getSortFn(column, (_sort$value = sort.value) !== null && _sort$value !== void 0 ? _sort$value : SORT_OPTION.NULL)
3000
+ sortFn: getSortFn(column, (_sort$value = sort.value) !== null && _sort$value !== void 0 ? _sort$value : SORT_OPTION.NULL, format)
3156
3001
  }, sort);
3157
3002
  }
3158
3003
  return null;
@@ -3193,6 +3038,202 @@ var resolveColumnSortProp = function resolveColumnSortProp(col, props) {
3193
3038
  active: !!col.sort
3194
3039
  };
3195
3040
  };
3041
+ var getRawData = function getRawData(data) {
3042
+ if ((0,external_vue_namespaceObject.isProxy)(data)) {
3043
+ return (0,external_vue_namespaceObject.toRaw)(data);
3044
+ }
3045
+ return data;
3046
+ };
3047
+ ;// CONCATENATED MODULE: ../../packages/table/src/plugins/use-pagination.tsx
3048
+
3049
+
3050
+
3051
+ function use_pagination_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3052
+ function use_pagination_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? use_pagination_ownKeys(Object(t), !0).forEach(function (r) { defineProperty_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : use_pagination_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3053
+ /*
3054
+ * Tencent is pleased to support the open source community by making
3055
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
3056
+ *
3057
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
3058
+ *
3059
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
3060
+ *
3061
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
3062
+ *
3063
+ * ---------------------------------------------------
3064
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
3065
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
3066
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
3067
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3068
+ *
3069
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
3070
+ * the Software.
3071
+ *
3072
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
3073
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3074
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
3075
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
3076
+ * IN THE SOFTWARE.
3077
+ */
3078
+
3079
+
3080
+
3081
+ /**
3082
+ * 处理 Prop中的分页配置
3083
+ * prop中的配置会覆盖本地的配置
3084
+ * @param propPagination 用户传入的配置
3085
+ * @param defVal 默认配置
3086
+ * @returns 返回值
3087
+ */
3088
+ var resolvePaginationOption = function resolvePaginationOption(propPagination, defVal) {
3089
+ if (!!propPagination) {
3090
+ if (typeof_typeof(propPagination) === 'object') {
3091
+ var current = Object.prototype.hasOwnProperty.call(propPagination, 'current') ? propPagination.current : propPagination.value;
3092
+ if (!/\d+/.test(current)) {
3093
+ current = 1;
3094
+ }
3095
+ return use_pagination_objectSpread(use_pagination_objectSpread(use_pagination_objectSpread({}, defVal), propPagination), {}, {
3096
+ current: current
3097
+ });
3098
+ }
3099
+ return defVal;
3100
+ }
3101
+ return {};
3102
+ };
3103
+ /* harmony default export */ const use_pagination = (function (props) {
3104
+ var startIndex = (0,external_vue_namespaceObject.ref)(0);
3105
+ var endIndex = (0,external_vue_namespaceObject.ref)(0);
3106
+ /**
3107
+ * 分页配置
3108
+ * 用于配置分页组件
3109
+ * pagination 为Prop传入配置
3110
+ * 方便兼容内置分页功能,此处需要单独处理count
3111
+ */
3112
+ var propsData = (0,external_vue_namespaceObject.computed)(function () {
3113
+ return props.data;
3114
+ });
3115
+ var localPagination = (0,external_vue_namespaceObject.ref)(null);
3116
+ var indexData = (0,external_vue_namespaceObject.reactive)([]);
3117
+ // 当前分页缓存,用于支持内置前端分页,用户无需接收change事件来自行处理数据分割
3118
+ var pagination = (0,external_vue_namespaceObject.reactive)({
3119
+ count: 0,
3120
+ limit: 10,
3121
+ current: 1,
3122
+ align: 'right',
3123
+ layout: ['total', 'limit', 'list']
3124
+ });
3125
+ var resolveLocalPagination = function resolveLocalPagination() {
3126
+ if (!props.pagination) {
3127
+ return;
3128
+ }
3129
+ localPagination.value = props.remotePagination ? pagination : use_pagination_objectSpread(use_pagination_objectSpread({}, pagination), {}, {
3130
+ count: indexData.length
3131
+ });
3132
+ };
3133
+ /**
3134
+ * 重置当前分页开始位置 & 结束位置
3135
+ * 如果未启用分页,则开始位置为0,结束位置为 data.length
3136
+ * @returns
3137
+ */
3138
+ var resetStartEndIndex = function resetStartEndIndex() {
3139
+ if (!props.pagination || props.remotePagination) {
3140
+ startIndex.value = 0;
3141
+ endIndex.value = indexData.length;
3142
+ return;
3143
+ }
3144
+ // 如果是前端分页
3145
+ startIndex.value = (pagination.current - 1) * pagination.limit;
3146
+ endIndex.value = pagination.current * pagination.limit;
3147
+ };
3148
+ /**
3149
+ * 当前页分页数据
3150
+ */
3151
+ var pageData = (0,external_vue_namespaceObject.reactive)([]);
3152
+ var sort = function sort(sourceData, sortFn, column, type, sortScope) {
3153
+ if (typeof sortFn === 'function') {
3154
+ sourceData.sort(function (a, b) {
3155
+ return sortFn(a, b, type, column, sortScope);
3156
+ });
3157
+ }
3158
+ };
3159
+ /**
3160
+ * 初始化排序动作
3161
+ * @param data
3162
+ * @param sortColumns
3163
+ */
3164
+ var multiSort = function multiSort(data, sortColumns) {
3165
+ sortColumns.forEach(function (item) {
3166
+ sort(data, item.schema[COLUMN_ATTRIBUTE.COL_SORT_FN], item.column, item.schema[COLUMN_ATTRIBUTE.COL_SORT_TYPE], item.schema[COLUMN_ATTRIBUTE.COL_SORT_SCOPE]);
3167
+ });
3168
+ };
3169
+ var filter = function filter(sourceData, filterFn) {
3170
+ if (typeof filterFn === 'function') {
3171
+ var filterVals = sourceData.filter(function (row, index) {
3172
+ return filterFn(row, index, indexData);
3173
+ });
3174
+ sourceData.length = 0;
3175
+ sourceData.push.apply(sourceData, _toConsumableArray(filterVals));
3176
+ }
3177
+ return sourceData;
3178
+ };
3179
+ var resolveIndexData = function resolveIndexData() {
3180
+ return new Promise(function (resolve) {
3181
+ (0,external_vue_namespaceObject.nextTick)(function () {
3182
+ var target = propsData.value.slice();
3183
+ indexData.length = 0;
3184
+ indexData.push.apply(indexData, _toConsumableArray(getRawData(target)));
3185
+ resolve();
3186
+ });
3187
+ });
3188
+ };
3189
+ var resolvePageData = function resolvePageData(filterFn, sortFn, column, type, sortScope, multiCol) {
3190
+ var sourceData = indexData.slice();
3191
+ if (multiCol !== null && multiCol !== void 0 && multiCol.length) {
3192
+ multiSort(sourceData, multiCol);
3193
+ }
3194
+ pageData.length = 0;
3195
+ pageData.push.apply(pageData, _toConsumableArray(sourceData.slice(startIndex.value, endIndex.value)));
3196
+ filter(pageData, filterFn);
3197
+ sort(pageData, sortFn, column, type, sortScope);
3198
+ resolveLocalPagination();
3199
+ };
3200
+ var resolvePageDataBySortList = function resolvePageDataBySortList(multiCol) {
3201
+ resolvePageData(null, null, null, null, null, multiCol);
3202
+ };
3203
+ var multiFilter = function multiFilter(filterFnList) {
3204
+ var sourceData = indexData.slice();
3205
+ var target = filterFnList.reduce(function (result, fn) {
3206
+ return filter(result, fn);
3207
+ }, sourceData);
3208
+ pageData.length = 0;
3209
+ pageData.push.apply(pageData, _toConsumableArray(getRawData(target)));
3210
+ };
3211
+ var handlePaginationChange = function handlePaginationChange() {
3212
+ pagination = resolvePaginationOption(props.pagination, pagination);
3213
+ resolveLocalPagination();
3214
+ resetStartEndIndex();
3215
+ resolvePageData();
3216
+ };
3217
+ handlePaginationChange();
3218
+ (0,external_vue_namespaceObject.watch)(function () {
3219
+ return [props.pagination];
3220
+ }, function () {
3221
+ handlePaginationChange();
3222
+ }, {
3223
+ deep: true
3224
+ });
3225
+ return {
3226
+ pageData: pageData,
3227
+ indexData: indexData,
3228
+ localPagination: localPagination,
3229
+ resolvePageData: resolvePageData,
3230
+ resolveIndexData: resolveIndexData,
3231
+ resolvePageDataBySortList: resolvePageDataBySortList,
3232
+ resetStartEndIndex: resetStartEndIndex,
3233
+ multiFilter: multiFilter,
3234
+ sort: sort
3235
+ };
3236
+ });
3196
3237
  ;// CONCATENATED MODULE: ../../packages/table/src/use-attributes.ts
3197
3238
 
3198
3239
 
@@ -3580,7 +3621,7 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
3580
3621
  if (typeof item === 'string') {
3581
3622
  return getRowValue(row, item) === item;
3582
3623
  }
3583
- return item === row;
3624
+ return getRawData(item) === getRawData(row);
3584
3625
  });
3585
3626
  }
3586
3627
  return false;
@@ -3606,7 +3647,8 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
3606
3647
  (_formatData$data = formatData.data).push.apply(_formatData$data, _toConsumableArray(data));
3607
3648
  var hasSelectedRow = false;
3608
3649
  var hasUnSelectedRow = false;
3609
- (data || []).forEach(function (row, index) {
3650
+ (data || []).forEach(function (item, index) {
3651
+ var row = getRawData(item);
3610
3652
  var rowId = getRowId(row, esm_browser_v4(), props);
3611
3653
  var isSelected = isRowSelected(row);
3612
3654
  if (isSelected) {
@@ -3647,7 +3689,8 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
3647
3689
  * @param attrName
3648
3690
  * @param attrValue
3649
3691
  */
3650
- var setRowAttribute = function setRowAttribute(row, attrName, attrValue) {
3692
+ var setRowAttribute = function setRowAttribute(item, attrName, attrValue) {
3693
+ var row = getRawData(item);
3651
3694
  var target = formatData.dataSchema.get(row);
3652
3695
  if (target && Object.prototype.hasOwnProperty.call(target, attrName)) {
3653
3696
  target[attrName] = attrValue;
@@ -3688,8 +3731,9 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
3688
3731
  var setRowExpand = function setRowExpand(row, isExpand) {
3689
3732
  setRowAttribute(row, TABLE_ROW_ATTRIBUTE.ROW_EXPAND, isExpand);
3690
3733
  };
3691
- var getRowAttribute = function getRowAttribute(row, attrName) {
3734
+ var getRowAttribute = function getRowAttribute(item, attrName) {
3692
3735
  var _formatData$dataSchem6;
3736
+ var row = getRawData(item);
3693
3737
  return (_formatData$dataSchem6 = formatData.dataSchema.get(row)) === null || _formatData$dataSchem6 === void 0 ? void 0 : _formatData$dataSchem6[attrName];
3694
3738
  };
3695
3739
  var toggleRowSelection = function toggleRowSelection(row) {
@@ -4435,6 +4479,18 @@ const directives_namespaceObject = directives_x({ ["bkEllipsisInstance"]: () =>
4435
4479
  if (typeof disabled === 'function') {
4436
4480
  disabled = Reflect.apply(disabled, _this, [props.column, props.row]);
4437
4481
  }
4482
+ /**
4483
+ * 当表格中的字段或数据需要做解释说明时,可增加 [下划线] 提示,hover 可查看解释说明的 tooltips
4484
+ */
4485
+ if (props.column.explain) {
4486
+ disabled = false;
4487
+ mode = 'static';
4488
+ if (typeof_typeof(props.column.explain) === 'object') {
4489
+ content = function content() {
4490
+ return resolvePropVal(props.column.explain, 'content', [props.column, props.row]);
4491
+ };
4492
+ }
4493
+ }
4438
4494
  if (props.isHead) {
4439
4495
  var _props$column$showOve, _props$column;
4440
4496
  disabled = !((_props$column$showOve = (_props$column = props.column) === null || _props$column === void 0 || (_props$column = _props$column.showOverflowTooltip) === null || _props$column === void 0 ? void 0 : _props$column.showHead) !== null && _props$column$showOve !== void 0 ? _props$column$showOve : true);
@@ -4450,18 +4506,6 @@ const directives_namespaceObject = directives_x({ ["bkEllipsisInstance"]: () =>
4450
4506
  };
4451
4507
  }
4452
4508
  }
4453
- /**
4454
- * 当表格中的字段或数据需要做解释说明时,可增加 [下划线] 提示,hover 可查看解释说明的 tooltips
4455
- */
4456
- if (props.column.explain) {
4457
- disabled = false;
4458
- mode = 'static';
4459
- if (typeof_typeof(props.column.explain) === 'object') {
4460
- content = function content() {
4461
- return resolvePropVal(props.column.explain, 'content', [props.column, props.row]);
4462
- };
4463
- }
4464
- }
4465
4509
  return {
4466
4510
  disabled: disabled,
4467
4511
  content: content,
@@ -5083,6 +5127,14 @@ function _isSlot(s) {
5083
5127
  onDrop: onDrop
5084
5128
  };
5085
5129
  });
5130
+ ;// CONCATENATED MODULE: external "../input"
5131
+ var input_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
5132
+ var input_y = x => () => x
5133
+ const input_namespaceObject = input_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_input_d525237e__["default"] });
5134
+ ;// CONCATENATED MODULE: external "../input/input.less"
5135
+ var input_less_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
5136
+ var input_less_y = x => () => x
5137
+ const input_less_namespaceObject = input_less_x({ });
5086
5138
  ;// CONCATENATED MODULE: ../../packages/table/src/plugins/head-filter.tsx
5087
5139
 
5088
5140
 
@@ -5128,6 +5180,8 @@ function _isSlot(s) {
5128
5180
 
5129
5181
 
5130
5182
 
5183
+
5184
+
5131
5185
  function head_filter_isSlot(s) {
5132
5186
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !(0,external_vue_namespaceObject.isVNode)(s);
5133
5187
  }
@@ -5368,7 +5422,7 @@ function head_filter_isSlot(s) {
5368
5422
  "class": headFilterContentClass
5369
5423
  }, [(0,external_vue_namespaceObject.createVNode)("div", {
5370
5424
  "style": "padding: 4px 10px;"
5371
- }, [(0,external_vue_namespaceObject.createVNode)((0,external_vue_namespaceObject.resolveComponent)("bk-input"), {
5425
+ }, [(0,external_vue_namespaceObject.createVNode)(input_namespaceObject["default"], {
5372
5426
  "modelValue": searchValue.value,
5373
5427
  "onUpdate:modelValue": function onUpdateModelValue($event) {
5374
5428
  return searchValue.value = $event;
@@ -5482,7 +5536,8 @@ function _slicedToArray(arr, i) {
5482
5536
  props: {
5483
5537
  column: IColumnType,
5484
5538
  defaultSort: shared_namespaceObject.PropTypes.oneOf(SORT_OPTIONS).def(SORT_OPTION.NULL),
5485
- active: shared_namespaceObject.PropTypes.bool
5539
+ active: shared_namespaceObject.PropTypes.bool,
5540
+ sortValFormat: shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.any).def([''])
5486
5541
  },
5487
5542
  emits: ['change'],
5488
5543
  setup: function setup(props, _ref) {
@@ -5520,8 +5575,8 @@ function _slicedToArray(arr, i) {
5520
5575
  if (sortType.value === type) {
5521
5576
  currentSort = SORT_OPTION.NULL;
5522
5577
  }
5523
- var execFn = getSortFn(props.column, currentSort);
5524
- var sort = resolveSort(props.column.sort, props.column);
5578
+ var execFn = getSortFn(props.column, currentSort, props.sortValFormat);
5579
+ var sort = resolveSort(props.column.sort, props.column, props.sortValFormat);
5525
5580
  if ((sort === null || sort === void 0 ? void 0 : sort.value) === 'custom') {
5526
5581
  var _sort$sortFn;
5527
5582
  emit('change', (_sort$sortFn = sort === null || sort === void 0 ? void 0 : sort.sortFn) !== null && _sort$sortFn !== void 0 ? _sort$sortFn : execFn, currentSort);
@@ -5632,7 +5687,7 @@ function use_head_cell_isSlot(s) {
5632
5687
  var type = tableResp.getColumnAttribute(column, COLUMN_ATTRIBUTE.COL_SORT_TYPE);
5633
5688
  nextSort.value = getNextSortType(type);
5634
5689
  var sortFn = function sortFn(a, b) {
5635
- return getSortFnByColumn(column, getSortFn(column, nextSort.value), a, b);
5690
+ return getSortFnByColumn(column, getSortFn(column, nextSort.value, props.sortValFormat), a, b);
5636
5691
  };
5637
5692
  tableResp.setColumnAttribute(column, COLUMN_ATTRIBUTE.COL_SORT_TYPE, nextSort.value);
5638
5693
  tableResp.setColumnAttribute(column, COLUMN_ATTRIBUTE.COL_SORT_FN, sortFn);
@@ -5718,7 +5773,8 @@ function use_head_cell_isSlot(s) {
5718
5773
  "column": column,
5719
5774
  "defaultSort": active.value ? nextSort.value : SORT_OPTION.NULL,
5720
5775
  "onChange": handleSortClick,
5721
- "active": active.value
5776
+ "active": active.value,
5777
+ "sortValFormat": props.sortValFormat
5722
5778
  }, null);
5723
5779
  };
5724
5780
  var getFilterCell = function getFilterCell(column, index) {
@@ -8,6 +8,9 @@ declare const _default: import("vue").DefineComponent<{
8
8
  active: import("vue-types").VueTypeValidableDef<boolean> & {
9
9
  default: boolean;
10
10
  };
11
+ sortValFormat: import("vue-types").VueTypeDef<any[]> & {
12
+ default: () => any[];
13
+ };
11
14
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
12
15
  column: import("vue-types").VueTypeDef<Column>;
13
16
  defaultSort: import("vue-types").VueTypeDef<SORT_OPTION> & {
@@ -16,10 +19,14 @@ declare const _default: import("vue").DefineComponent<{
16
19
  active: import("vue-types").VueTypeValidableDef<boolean> & {
17
20
  default: boolean;
18
21
  };
22
+ sortValFormat: import("vue-types").VueTypeDef<any[]> & {
23
+ default: () => any[];
24
+ };
19
25
  }>> & {
20
26
  onChange?: (...args: any[]) => any;
21
27
  }, {
22
28
  active: boolean;
29
+ sortValFormat: any[];
23
30
  defaultSort: SORT_OPTION;
24
31
  }, {}>;
25
32
  export default _default;