bkui-vue 1.0.3-beta.1 → 1.0.3-beta.10
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.
- package/README.md +1 -0
- package/dist/index.cjs.js +61 -61
- package/dist/index.esm.js +11749 -11679
- package/dist/index.umd.js +61 -61
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/affix/index.js +1 -0
- package/lib/alert/index.js +1 -0
- package/lib/animate-number/index.js +1 -0
- package/lib/backtop/index.js +1 -0
- package/lib/badge/index.js +1 -0
- package/lib/breadcrumb/index.js +1 -0
- package/lib/button/index.js +1 -0
- package/lib/card/index.js +1 -0
- package/lib/cascader/index.js +1 -0
- package/lib/checkbox/index.js +1 -0
- package/lib/code-diff/index.js +1 -0
- package/lib/collapse/index.js +1 -0
- package/lib/collapse-transition/index.js +1 -0
- package/lib/color-picker/index.js +1 -0
- package/lib/components.js +0 -4
- package/lib/config-provider/index.js +1 -0
- package/lib/container/index.js +1 -0
- package/lib/date-picker/index.js +1 -0
- package/lib/dialog/index.js +1 -0
- package/lib/directives/index.js +1 -0
- package/lib/dist.index.js +0 -1
- package/lib/divider/index.js +1 -0
- package/lib/dropdown/index.js +1 -0
- package/lib/exception/index.js +1 -0
- package/lib/fixed-navbar/index.js +1 -0
- package/lib/form/form.css +1 -0
- package/lib/form/form.less +2 -0
- package/lib/form/form.variable.css +1 -0
- package/lib/form/index.js +1 -0
- package/lib/hooks.js +1 -8
- package/lib/icon/index.js +1 -0
- package/lib/image/index.js +1 -0
- package/lib/index.js +0 -1
- package/lib/info-box/index.js +1 -0
- package/lib/input/index.js +1 -0
- package/lib/link/index.js +1 -0
- package/lib/loading/index.js +1 -0
- package/lib/locale/index.js +1 -0
- package/lib/menu/index.js +1 -0
- package/lib/message/index.js +1 -0
- package/lib/modal/index.js +1 -0
- package/lib/navigation/index.js +1 -0
- package/lib/notify/index.js +1 -0
- package/lib/overflow-title/index.js +1 -0
- package/lib/pagination/index.js +1 -1
- package/lib/plugin-popover/index.js +11 -5
- package/lib/plugins/index.js +1 -0
- package/lib/pop-confirm/index.js +1 -0
- package/lib/popover/index.js +11 -5
- package/lib/popover2/index.js +1 -0
- package/lib/preset.js +14 -20
- package/lib/process/index.js +1 -0
- package/lib/progress/index.js +1 -0
- package/lib/radio/index.js +1 -0
- package/lib/rate/index.js +1 -0
- package/lib/resize-layout/index.js +1 -0
- package/lib/search-select/index.js +1 -0
- package/lib/select/index.js +1 -0
- package/lib/shared/index.js +1 -0
- package/lib/sideslider/index.js +1 -0
- package/lib/slider/index.js +1 -0
- package/lib/steps/index.js +1 -0
- package/lib/styles/reset.css +3 -1
- package/lib/styles/reset.less +3 -1
- package/lib/styles/reset.variable.css +3 -1
- package/lib/swiper/index.js +1 -0
- package/lib/switcher/index.js +1 -0
- package/lib/tab/index.js +1 -0
- package/lib/table/index.d.ts +15 -0
- package/lib/table/index.js +386 -245
- package/lib/table/plugins/head-sort.d.ts +7 -0
- package/lib/table/plugins/use-draggable.d.ts +2 -2
- package/lib/table/plugins/use-pagination.d.ts +2 -1
- package/lib/table/props.d.ts +9 -0
- package/lib/table/table.css +15 -16
- package/lib/table/table.d.ts +7 -0
- package/lib/table/table.less +27 -14
- package/lib/table/table.variable.css +15 -16
- package/lib/table/use-attributes.d.ts +40 -1
- package/lib/table/use-common.d.ts +1 -0
- package/lib/table/utils.d.ts +5 -4
- package/lib/table-column/index.js +11 -0
- package/lib/tag/index.js +1 -0
- package/lib/tag-input/index.js +1 -0
- package/lib/time-picker/index.js +1 -0
- package/lib/timeline/index.js +1 -0
- package/lib/transfer/index.js +1 -0
- package/lib/tree/index.js +1 -0
- package/lib/upload/index.js +1 -0
- package/lib/virtual-render/index.js +1 -0
- package/package.json +3 -2
package/lib/table/index.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import "../styles/reset.css";
|
1
2
|
import "./table.less";
|
2
3
|
import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03__ from "../shared";
|
3
4
|
import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "vue";
|
@@ -24,6 +25,8 @@ import "../button/button.less";
|
|
24
25
|
import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon__3efece53__ from "../icon/";
|
25
26
|
import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_popover_9b03f19d__ from "../popover";
|
26
27
|
import "../popover/popover.less";
|
28
|
+
import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_input_d525237e__ from "../input";
|
29
|
+
import "../input/input.less";
|
27
30
|
/******/ // The require scope
|
28
31
|
/******/ var __webpack_require__ = {};
|
29
32
|
/******/
|
@@ -119,7 +122,7 @@ function defineProperty_defineProperty(obj, key, value) {
|
|
119
122
|
;// CONCATENATED MODULE: external "vue"
|
120
123
|
var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
121
124
|
var external_vue_y = x => () => x
|
122
|
-
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, ["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 });
|
123
126
|
;// CONCATENATED MODULE: ../../packages/table/src/const.ts
|
124
127
|
|
125
128
|
/*
|
@@ -451,6 +454,13 @@ var tableProps = {
|
|
451
454
|
* 是否显示Head
|
452
455
|
*/
|
453
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(['']),
|
454
464
|
/**
|
455
465
|
* table header config
|
456
466
|
*/
|
@@ -706,6 +716,9 @@ var TableColumnProp = {
|
|
706
716
|
mounted: function mounted() {
|
707
717
|
this.updateColumnDefine();
|
708
718
|
},
|
719
|
+
updated: function updated() {
|
720
|
+
this.updateColumnDefineByParent();
|
721
|
+
},
|
709
722
|
methods: {
|
710
723
|
updateColumnDefine: function updateColumnDefine() {
|
711
724
|
var unmounted = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
@@ -1599,183 +1612,6 @@ function v4(options, buf, offset) {
|
|
1599
1612
|
}
|
1600
1613
|
|
1601
1614
|
/* harmony default export */ const esm_browser_v4 = (v4);
|
1602
|
-
;// CONCATENATED MODULE: ../../packages/table/src/plugins/use-pagination.tsx
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
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; }
|
1607
|
-
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; }
|
1608
|
-
/*
|
1609
|
-
* Tencent is pleased to support the open source community by making
|
1610
|
-
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
1611
|
-
*
|
1612
|
-
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
1613
|
-
*
|
1614
|
-
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
|
1615
|
-
*
|
1616
|
-
* License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
|
1617
|
-
*
|
1618
|
-
* ---------------------------------------------------
|
1619
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
1620
|
-
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
1621
|
-
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
1622
|
-
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
1623
|
-
*
|
1624
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
1625
|
-
* the Software.
|
1626
|
-
*
|
1627
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
1628
|
-
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
1629
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
1630
|
-
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
1631
|
-
* IN THE SOFTWARE.
|
1632
|
-
*/
|
1633
|
-
|
1634
|
-
|
1635
|
-
/**
|
1636
|
-
* 处理 Prop中的分页配置
|
1637
|
-
* prop中的配置会覆盖本地的配置
|
1638
|
-
* @param propPagination 用户传入的配置
|
1639
|
-
* @param defVal 默认配置
|
1640
|
-
* @returns 返回值
|
1641
|
-
*/
|
1642
|
-
var resolvePaginationOption = function resolvePaginationOption(propPagination, defVal) {
|
1643
|
-
if (!!propPagination) {
|
1644
|
-
if (typeof_typeof(propPagination) === 'object') {
|
1645
|
-
var current = Object.prototype.hasOwnProperty.call(propPagination, 'current') ? propPagination.current : propPagination.value;
|
1646
|
-
if (!/\d+/.test(current)) {
|
1647
|
-
current = 1;
|
1648
|
-
}
|
1649
|
-
return use_pagination_objectSpread(use_pagination_objectSpread(use_pagination_objectSpread({}, defVal), propPagination), {}, {
|
1650
|
-
current: current
|
1651
|
-
});
|
1652
|
-
}
|
1653
|
-
return defVal;
|
1654
|
-
}
|
1655
|
-
return {};
|
1656
|
-
};
|
1657
|
-
/* harmony default export */ const use_pagination = (function (props) {
|
1658
|
-
var startIndex = (0,external_vue_namespaceObject.ref)(0);
|
1659
|
-
var endIndex = (0,external_vue_namespaceObject.ref)(0);
|
1660
|
-
/**
|
1661
|
-
* 分页配置
|
1662
|
-
* 用于配置分页组件
|
1663
|
-
* pagination 为Prop传入配置
|
1664
|
-
* 方便兼容内置分页功能,此处需要单独处理count
|
1665
|
-
*/
|
1666
|
-
var localPagination = (0,external_vue_namespaceObject.ref)(null);
|
1667
|
-
var indexData = (0,external_vue_namespaceObject.computed)(function () {
|
1668
|
-
return props.data;
|
1669
|
-
});
|
1670
|
-
// 当前分页缓存,用于支持内置前端分页,用户无需接收change事件来自行处理数据分割
|
1671
|
-
var pagination = (0,external_vue_namespaceObject.reactive)({
|
1672
|
-
count: 0,
|
1673
|
-
limit: 10,
|
1674
|
-
current: 1,
|
1675
|
-
align: 'right',
|
1676
|
-
layout: ['total', 'limit', 'list']
|
1677
|
-
});
|
1678
|
-
var resolveLocalPagination = function resolveLocalPagination() {
|
1679
|
-
if (!props.pagination) {
|
1680
|
-
return;
|
1681
|
-
}
|
1682
|
-
localPagination.value = props.remotePagination ? pagination : use_pagination_objectSpread(use_pagination_objectSpread({}, pagination), {}, {
|
1683
|
-
count: indexData.value.length
|
1684
|
-
});
|
1685
|
-
};
|
1686
|
-
/**
|
1687
|
-
* 重置当前分页开始位置 & 结束位置
|
1688
|
-
* 如果未启用分页,则开始位置为0,结束位置为 data.length
|
1689
|
-
* @returns
|
1690
|
-
*/
|
1691
|
-
var resetStartEndIndex = function resetStartEndIndex() {
|
1692
|
-
if (!props.pagination || props.remotePagination) {
|
1693
|
-
startIndex.value = 0;
|
1694
|
-
endIndex.value = indexData.value.length;
|
1695
|
-
return;
|
1696
|
-
}
|
1697
|
-
// 如果是前端分页
|
1698
|
-
startIndex.value = (pagination.current - 1) * pagination.limit;
|
1699
|
-
endIndex.value = pagination.current * pagination.limit;
|
1700
|
-
};
|
1701
|
-
/**
|
1702
|
-
* 当前页分页数据
|
1703
|
-
*/
|
1704
|
-
var pageData = (0,external_vue_namespaceObject.reactive)([]);
|
1705
|
-
var sort = function sort(sourceData, sortFn, column, type, sortScope) {
|
1706
|
-
if (typeof sortFn === 'function') {
|
1707
|
-
sourceData.sort(function (a, b) {
|
1708
|
-
return sortFn(a, b, type, column, sortScope);
|
1709
|
-
});
|
1710
|
-
}
|
1711
|
-
};
|
1712
|
-
/**
|
1713
|
-
* 初始化排序动作
|
1714
|
-
* @param data
|
1715
|
-
* @param sortColumns
|
1716
|
-
*/
|
1717
|
-
var multiSort = function multiSort(data, sortColumns) {
|
1718
|
-
sortColumns.forEach(function (item) {
|
1719
|
-
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]);
|
1720
|
-
});
|
1721
|
-
};
|
1722
|
-
var filter = function filter(sourceData, filterFn) {
|
1723
|
-
if (typeof filterFn === 'function') {
|
1724
|
-
var filterVals = sourceData.filter(function (row, index) {
|
1725
|
-
return filterFn(row, index, indexData.value);
|
1726
|
-
});
|
1727
|
-
sourceData.length = 0;
|
1728
|
-
sourceData.push.apply(sourceData, _toConsumableArray(filterVals));
|
1729
|
-
}
|
1730
|
-
return sourceData;
|
1731
|
-
};
|
1732
|
-
var resolvePageData = function resolvePageData(filterFn, sortFn, column, type, sortScope, multiCol) {
|
1733
|
-
var sourceData = indexData.value.slice();
|
1734
|
-
if (multiCol !== null && multiCol !== void 0 && multiCol.length) {
|
1735
|
-
multiSort(sourceData, multiCol);
|
1736
|
-
}
|
1737
|
-
pageData.length = 0;
|
1738
|
-
pageData.push.apply(pageData, _toConsumableArray(sourceData.slice(startIndex.value, endIndex.value)));
|
1739
|
-
filter(pageData, filterFn);
|
1740
|
-
sort(pageData, sortFn, column, type, sortScope);
|
1741
|
-
resolveLocalPagination();
|
1742
|
-
};
|
1743
|
-
var resolvePageDataBySortList = function resolvePageDataBySortList(multiCol) {
|
1744
|
-
resolvePageData(null, null, null, null, null, multiCol);
|
1745
|
-
};
|
1746
|
-
var multiFilter = function multiFilter(filterFnList) {
|
1747
|
-
var sourceData = indexData.value.slice();
|
1748
|
-
var target = filterFnList.reduce(function (result, fn) {
|
1749
|
-
return filter(result, fn);
|
1750
|
-
}, sourceData);
|
1751
|
-
pageData.length = 0;
|
1752
|
-
pageData.push.apply(pageData, _toConsumableArray(target));
|
1753
|
-
};
|
1754
|
-
var handlePaginationChange = function handlePaginationChange() {
|
1755
|
-
pagination = resolvePaginationOption(props.pagination, pagination);
|
1756
|
-
resolveLocalPagination();
|
1757
|
-
resetStartEndIndex();
|
1758
|
-
resolvePageData();
|
1759
|
-
};
|
1760
|
-
handlePaginationChange();
|
1761
|
-
(0,external_vue_namespaceObject.watch)(function () {
|
1762
|
-
return [props.pagination];
|
1763
|
-
}, function () {
|
1764
|
-
handlePaginationChange();
|
1765
|
-
}, {
|
1766
|
-
deep: true
|
1767
|
-
});
|
1768
|
-
return {
|
1769
|
-
pageData: pageData,
|
1770
|
-
indexData: indexData,
|
1771
|
-
localPagination: localPagination,
|
1772
|
-
resolvePageData: resolvePageData,
|
1773
|
-
resolvePageDataBySortList: resolvePageDataBySortList,
|
1774
|
-
resetStartEndIndex: resetStartEndIndex,
|
1775
|
-
multiFilter: multiFilter,
|
1776
|
-
sort: sort
|
1777
|
-
};
|
1778
|
-
});
|
1779
1615
|
;// CONCATENATED MODULE: external "lodash/debounce"
|
1780
1616
|
var debounce_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
1781
1617
|
var debounce_y = x => () => x
|
@@ -2752,6 +2588,7 @@ function utils_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
|
|
2752
2588
|
|
2753
2589
|
|
2754
2590
|
|
2591
|
+
|
2755
2592
|
/**
|
2756
2593
|
* 解析Prop值 | 可能为多种类型 & 函数返回的场景
|
2757
2594
|
* @param prop 当前Prop
|
@@ -2932,6 +2769,10 @@ var resolveHeadConfig = function resolveHeadConfig(props) {
|
|
2932
2769
|
height: headHeight
|
2933
2770
|
}, thead);
|
2934
2771
|
};
|
2772
|
+
var getRegExp = function getRegExp(val) {
|
2773
|
+
var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'ig';
|
2774
|
+
return new RegExp("".concat(val).replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'), flags);
|
2775
|
+
};
|
2935
2776
|
/**
|
2936
2777
|
* 获取当前行指定列的内容
|
2937
2778
|
* @param row 当前行
|
@@ -2940,11 +2781,29 @@ var resolveHeadConfig = function resolveHeadConfig(props) {
|
|
2940
2781
|
* @param index 当前行Index
|
2941
2782
|
* @returns
|
2942
2783
|
*/
|
2943
|
-
var getRowText = function getRowText(row, key) {
|
2784
|
+
var getRowText = function getRowText(row, key, format) {
|
2785
|
+
var result;
|
2944
2786
|
if (typeof row === 'string' || typeof row === 'number' || typeof row === 'boolean') {
|
2945
|
-
|
2787
|
+
result = row;
|
2946
2788
|
}
|
2947
|
-
|
2789
|
+
if (typeof_typeof(row) === 'object') {
|
2790
|
+
result = (0,get_namespaceObject["default"])(row, key);
|
2791
|
+
}
|
2792
|
+
if (format !== null && format !== void 0 && format.length) {
|
2793
|
+
format.forEach(function (reg) {
|
2794
|
+
if (typeof reg === 'function') {
|
2795
|
+
result = reg(result, row, key);
|
2796
|
+
} else if (typeof result === 'string') {
|
2797
|
+
var _matches$;
|
2798
|
+
var matches = result.match(typeof reg === 'string' ? getRegExp(reg) : reg);
|
2799
|
+
result = (_matches$ = matches === null || matches === void 0 ? void 0 : matches[1]) !== null && _matches$ !== void 0 ? _matches$ : result;
|
2800
|
+
}
|
2801
|
+
});
|
2802
|
+
if (/^-?\d+.?\d*$/.test(result)) {
|
2803
|
+
result = Number(result);
|
2804
|
+
}
|
2805
|
+
}
|
2806
|
+
return result;
|
2948
2807
|
};
|
2949
2808
|
/**
|
2950
2809
|
* 获取当前行指定列的值
|
@@ -3085,7 +2944,7 @@ var skipThisColumn = function skipThisColumn(columns, colIndex, row, rowIndex) {
|
|
3085
2944
|
for (var i = colIndex; i > 0; i--) {
|
3086
2945
|
var colspan = resolveColumnSpan(columns[i], i, row, rowIndex, 'colspan');
|
3087
2946
|
if (colspan > 1) {
|
3088
|
-
skip = colspan - 1
|
2947
|
+
skip = colspan - 1;
|
3089
2948
|
break;
|
3090
2949
|
}
|
3091
2950
|
}
|
@@ -3093,9 +2952,10 @@ var skipThisColumn = function skipThisColumn(columns, colIndex, row, rowIndex) {
|
|
3093
2952
|
};
|
3094
2953
|
var getSortFn = function getSortFn(column, sortType) {
|
3095
2954
|
var _column$sort, _column$sort2;
|
2955
|
+
var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
3096
2956
|
var fieldName = column.field;
|
3097
2957
|
var getVal = function getVal(row) {
|
3098
|
-
return getRowText(row, fieldName);
|
2958
|
+
return getRowText(row, fieldName, format);
|
3099
2959
|
};
|
3100
2960
|
var sortFn0 = function sortFn0(a, b) {
|
3101
2961
|
var _getVal, _getVal2;
|
@@ -3121,6 +2981,7 @@ var getNextSortType = function getNextSortType(sortType) {
|
|
3121
2981
|
return Object.keys(steps)[(steps[sortType] + 1) % 3];
|
3122
2982
|
};
|
3123
2983
|
var resolveSort = function resolveSort(sort, column) {
|
2984
|
+
var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
3124
2985
|
if (typeof sort === 'string') {
|
3125
2986
|
return {
|
3126
2987
|
value: sort
|
@@ -3139,7 +3000,7 @@ var resolveSort = function resolveSort(sort, column) {
|
|
3139
3000
|
}, sort);
|
3140
3001
|
}
|
3141
3002
|
return Object.assign({}, {
|
3142
|
-
sortFn: getSortFn(column, (_sort$value = sort.value) !== null && _sort$value !== void 0 ? _sort$value : SORT_OPTION.NULL)
|
3003
|
+
sortFn: getSortFn(column, (_sort$value = sort.value) !== null && _sort$value !== void 0 ? _sort$value : SORT_OPTION.NULL, format)
|
3143
3004
|
}, sort);
|
3144
3005
|
}
|
3145
3006
|
return null;
|
@@ -3180,6 +3041,202 @@ var resolveColumnSortProp = function resolveColumnSortProp(col, props) {
|
|
3180
3041
|
active: !!col.sort
|
3181
3042
|
};
|
3182
3043
|
};
|
3044
|
+
var getRawData = function getRawData(data) {
|
3045
|
+
if ((0,external_vue_namespaceObject.isProxy)(data)) {
|
3046
|
+
return (0,external_vue_namespaceObject.toRaw)(data);
|
3047
|
+
}
|
3048
|
+
return data;
|
3049
|
+
};
|
3050
|
+
;// CONCATENATED MODULE: ../../packages/table/src/plugins/use-pagination.tsx
|
3051
|
+
|
3052
|
+
|
3053
|
+
|
3054
|
+
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; }
|
3055
|
+
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; }
|
3056
|
+
/*
|
3057
|
+
* Tencent is pleased to support the open source community by making
|
3058
|
+
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
3059
|
+
*
|
3060
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
3061
|
+
*
|
3062
|
+
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
|
3063
|
+
*
|
3064
|
+
* License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
|
3065
|
+
*
|
3066
|
+
* ---------------------------------------------------
|
3067
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
3068
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
3069
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
3070
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
3071
|
+
*
|
3072
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
3073
|
+
* the Software.
|
3074
|
+
*
|
3075
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
3076
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
3077
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
3078
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
3079
|
+
* IN THE SOFTWARE.
|
3080
|
+
*/
|
3081
|
+
|
3082
|
+
|
3083
|
+
|
3084
|
+
/**
|
3085
|
+
* 处理 Prop中的分页配置
|
3086
|
+
* prop中的配置会覆盖本地的配置
|
3087
|
+
* @param propPagination 用户传入的配置
|
3088
|
+
* @param defVal 默认配置
|
3089
|
+
* @returns 返回值
|
3090
|
+
*/
|
3091
|
+
var resolvePaginationOption = function resolvePaginationOption(propPagination, defVal) {
|
3092
|
+
if (!!propPagination) {
|
3093
|
+
if (typeof_typeof(propPagination) === 'object') {
|
3094
|
+
var current = Object.prototype.hasOwnProperty.call(propPagination, 'current') ? propPagination.current : propPagination.value;
|
3095
|
+
if (!/\d+/.test(current)) {
|
3096
|
+
current = 1;
|
3097
|
+
}
|
3098
|
+
return use_pagination_objectSpread(use_pagination_objectSpread(use_pagination_objectSpread({}, defVal), propPagination), {}, {
|
3099
|
+
current: current
|
3100
|
+
});
|
3101
|
+
}
|
3102
|
+
return defVal;
|
3103
|
+
}
|
3104
|
+
return {};
|
3105
|
+
};
|
3106
|
+
/* harmony default export */ const use_pagination = (function (props) {
|
3107
|
+
var startIndex = (0,external_vue_namespaceObject.ref)(0);
|
3108
|
+
var endIndex = (0,external_vue_namespaceObject.ref)(0);
|
3109
|
+
/**
|
3110
|
+
* 分页配置
|
3111
|
+
* 用于配置分页组件
|
3112
|
+
* pagination 为Prop传入配置
|
3113
|
+
* 方便兼容内置分页功能,此处需要单独处理count
|
3114
|
+
*/
|
3115
|
+
var propsData = (0,external_vue_namespaceObject.computed)(function () {
|
3116
|
+
return props.data;
|
3117
|
+
});
|
3118
|
+
var localPagination = (0,external_vue_namespaceObject.ref)(null);
|
3119
|
+
var indexData = (0,external_vue_namespaceObject.reactive)([]);
|
3120
|
+
// 当前分页缓存,用于支持内置前端分页,用户无需接收change事件来自行处理数据分割
|
3121
|
+
var pagination = (0,external_vue_namespaceObject.reactive)({
|
3122
|
+
count: 0,
|
3123
|
+
limit: 10,
|
3124
|
+
current: 1,
|
3125
|
+
align: 'right',
|
3126
|
+
layout: ['total', 'limit', 'list']
|
3127
|
+
});
|
3128
|
+
var resolveLocalPagination = function resolveLocalPagination() {
|
3129
|
+
if (!props.pagination) {
|
3130
|
+
return;
|
3131
|
+
}
|
3132
|
+
localPagination.value = props.remotePagination ? pagination : use_pagination_objectSpread(use_pagination_objectSpread({}, pagination), {}, {
|
3133
|
+
count: indexData.length
|
3134
|
+
});
|
3135
|
+
};
|
3136
|
+
/**
|
3137
|
+
* 重置当前分页开始位置 & 结束位置
|
3138
|
+
* 如果未启用分页,则开始位置为0,结束位置为 data.length
|
3139
|
+
* @returns
|
3140
|
+
*/
|
3141
|
+
var resetStartEndIndex = function resetStartEndIndex() {
|
3142
|
+
if (!props.pagination || props.remotePagination) {
|
3143
|
+
startIndex.value = 0;
|
3144
|
+
endIndex.value = indexData.length;
|
3145
|
+
return;
|
3146
|
+
}
|
3147
|
+
// 如果是前端分页
|
3148
|
+
startIndex.value = (pagination.current - 1) * pagination.limit;
|
3149
|
+
endIndex.value = pagination.current * pagination.limit;
|
3150
|
+
};
|
3151
|
+
/**
|
3152
|
+
* 当前页分页数据
|
3153
|
+
*/
|
3154
|
+
var pageData = (0,external_vue_namespaceObject.reactive)([]);
|
3155
|
+
var sort = function sort(sourceData, sortFn, column, type, sortScope) {
|
3156
|
+
if (typeof sortFn === 'function') {
|
3157
|
+
sourceData.sort(function (a, b) {
|
3158
|
+
return sortFn(a, b, type, column, sortScope);
|
3159
|
+
});
|
3160
|
+
}
|
3161
|
+
};
|
3162
|
+
/**
|
3163
|
+
* 初始化排序动作
|
3164
|
+
* @param data
|
3165
|
+
* @param sortColumns
|
3166
|
+
*/
|
3167
|
+
var multiSort = function multiSort(data, sortColumns) {
|
3168
|
+
sortColumns.forEach(function (item) {
|
3169
|
+
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]);
|
3170
|
+
});
|
3171
|
+
};
|
3172
|
+
var filter = function filter(sourceData, filterFn) {
|
3173
|
+
if (typeof filterFn === 'function') {
|
3174
|
+
var filterVals = sourceData.filter(function (row, index) {
|
3175
|
+
return filterFn(row, index, indexData);
|
3176
|
+
});
|
3177
|
+
sourceData.length = 0;
|
3178
|
+
sourceData.push.apply(sourceData, _toConsumableArray(filterVals));
|
3179
|
+
}
|
3180
|
+
return sourceData;
|
3181
|
+
};
|
3182
|
+
var resolveIndexData = function resolveIndexData() {
|
3183
|
+
return new Promise(function (resolve) {
|
3184
|
+
(0,external_vue_namespaceObject.nextTick)(function () {
|
3185
|
+
var target = propsData.value.slice();
|
3186
|
+
indexData.length = 0;
|
3187
|
+
indexData.push.apply(indexData, _toConsumableArray(getRawData(target)));
|
3188
|
+
resolve();
|
3189
|
+
});
|
3190
|
+
});
|
3191
|
+
};
|
3192
|
+
var resolvePageData = function resolvePageData(filterFn, sortFn, column, type, sortScope, multiCol) {
|
3193
|
+
var sourceData = indexData.slice();
|
3194
|
+
if (multiCol !== null && multiCol !== void 0 && multiCol.length) {
|
3195
|
+
multiSort(sourceData, multiCol);
|
3196
|
+
}
|
3197
|
+
pageData.length = 0;
|
3198
|
+
pageData.push.apply(pageData, _toConsumableArray(sourceData.slice(startIndex.value, endIndex.value)));
|
3199
|
+
filter(pageData, filterFn);
|
3200
|
+
sort(pageData, sortFn, column, type, sortScope);
|
3201
|
+
resolveLocalPagination();
|
3202
|
+
};
|
3203
|
+
var resolvePageDataBySortList = function resolvePageDataBySortList(multiCol) {
|
3204
|
+
resolvePageData(null, null, null, null, null, multiCol);
|
3205
|
+
};
|
3206
|
+
var multiFilter = function multiFilter(filterFnList) {
|
3207
|
+
var sourceData = indexData.slice();
|
3208
|
+
var target = filterFnList.reduce(function (result, fn) {
|
3209
|
+
return filter(result, fn);
|
3210
|
+
}, sourceData);
|
3211
|
+
pageData.length = 0;
|
3212
|
+
pageData.push.apply(pageData, _toConsumableArray(getRawData(target)));
|
3213
|
+
};
|
3214
|
+
var handlePaginationChange = function handlePaginationChange() {
|
3215
|
+
pagination = resolvePaginationOption(props.pagination, pagination);
|
3216
|
+
resolveLocalPagination();
|
3217
|
+
resetStartEndIndex();
|
3218
|
+
resolvePageData();
|
3219
|
+
};
|
3220
|
+
handlePaginationChange();
|
3221
|
+
(0,external_vue_namespaceObject.watch)(function () {
|
3222
|
+
return [props.pagination];
|
3223
|
+
}, function () {
|
3224
|
+
handlePaginationChange();
|
3225
|
+
}, {
|
3226
|
+
deep: true
|
3227
|
+
});
|
3228
|
+
return {
|
3229
|
+
pageData: pageData,
|
3230
|
+
indexData: indexData,
|
3231
|
+
localPagination: localPagination,
|
3232
|
+
resolvePageData: resolvePageData,
|
3233
|
+
resolveIndexData: resolveIndexData,
|
3234
|
+
resolvePageDataBySortList: resolvePageDataBySortList,
|
3235
|
+
resetStartEndIndex: resetStartEndIndex,
|
3236
|
+
multiFilter: multiFilter,
|
3237
|
+
sort: sort
|
3238
|
+
};
|
3239
|
+
});
|
3183
3240
|
;// CONCATENATED MODULE: ../../packages/table/src/use-attributes.ts
|
3184
3241
|
|
3185
3242
|
|
@@ -3250,12 +3307,14 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
3250
3307
|
});
|
3251
3308
|
var _usePagination = use_pagination(props),
|
3252
3309
|
pageData = _usePagination.pageData,
|
3310
|
+
indexData = _usePagination.indexData,
|
3253
3311
|
localPagination = _usePagination.localPagination,
|
3254
3312
|
resolvePageData = _usePagination.resolvePageData,
|
3255
3313
|
resolvePageDataBySortList = _usePagination.resolvePageDataBySortList,
|
3256
3314
|
multiFilter = _usePagination.multiFilter,
|
3257
3315
|
sort = _usePagination.sort,
|
3258
|
-
resetStartEndIndex = _usePagination.resetStartEndIndex
|
3316
|
+
resetStartEndIndex = _usePagination.resetStartEndIndex,
|
3317
|
+
resolveIndexData = _usePagination.resolveIndexData;
|
3259
3318
|
var updateSettings = function updateSettings(settings, rowHeight) {
|
3260
3319
|
if (settings) {
|
3261
3320
|
var _ref2, _ref3;
|
@@ -3391,6 +3450,13 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
3391
3450
|
var type = getColumnAttribute(column, COLUMN_ATTRIBUTE.COL_SORT_TYPE);
|
3392
3451
|
var scope = getColumnAttribute(column, COLUMN_ATTRIBUTE.COL_SORT_SCOPE);
|
3393
3452
|
if (type === SORT_OPTION.NULL) {
|
3453
|
+
resolveIndexData().then(function () {
|
3454
|
+
resolvePageData();
|
3455
|
+
});
|
3456
|
+
return;
|
3457
|
+
}
|
3458
|
+
if (scope === 'all') {
|
3459
|
+
sort(indexData, fn, column, type, scope);
|
3394
3460
|
resolvePageData();
|
3395
3461
|
return;
|
3396
3462
|
}
|
@@ -3558,7 +3624,7 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
3558
3624
|
if (typeof item === 'string') {
|
3559
3625
|
return getRowValue(row, item) === item;
|
3560
3626
|
}
|
3561
|
-
return item === row;
|
3627
|
+
return getRawData(item) === getRawData(row);
|
3562
3628
|
});
|
3563
3629
|
}
|
3564
3630
|
return false;
|
@@ -3584,7 +3650,8 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
3584
3650
|
(_formatData$data = formatData.data).push.apply(_formatData$data, _toConsumableArray(data));
|
3585
3651
|
var hasSelectedRow = false;
|
3586
3652
|
var hasUnSelectedRow = false;
|
3587
|
-
(data || []).forEach(function (
|
3653
|
+
(data || []).forEach(function (item, index) {
|
3654
|
+
var row = getRawData(item);
|
3588
3655
|
var rowId = getRowId(row, esm_browser_v4(), props);
|
3589
3656
|
var isSelected = isRowSelected(row);
|
3590
3657
|
if (isSelected) {
|
@@ -3625,7 +3692,8 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
3625
3692
|
* @param attrName
|
3626
3693
|
* @param attrValue
|
3627
3694
|
*/
|
3628
|
-
var setRowAttribute = function setRowAttribute(
|
3695
|
+
var setRowAttribute = function setRowAttribute(item, attrName, attrValue) {
|
3696
|
+
var row = getRawData(item);
|
3629
3697
|
var target = formatData.dataSchema.get(row);
|
3630
3698
|
if (target && Object.prototype.hasOwnProperty.call(target, attrName)) {
|
3631
3699
|
target[attrName] = attrValue;
|
@@ -3666,8 +3734,9 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
3666
3734
|
var setRowExpand = function setRowExpand(row, isExpand) {
|
3667
3735
|
setRowAttribute(row, TABLE_ROW_ATTRIBUTE.ROW_EXPAND, isExpand);
|
3668
3736
|
};
|
3669
|
-
var getRowAttribute = function getRowAttribute(
|
3737
|
+
var getRowAttribute = function getRowAttribute(item, attrName) {
|
3670
3738
|
var _formatData$dataSchem6;
|
3739
|
+
var row = getRawData(item);
|
3671
3740
|
return (_formatData$dataSchem6 = formatData.dataSchema.get(row)) === null || _formatData$dataSchem6 === void 0 ? void 0 : _formatData$dataSchem6[attrName];
|
3672
3741
|
};
|
3673
3742
|
var toggleRowSelection = function toggleRowSelection(row) {
|
@@ -3828,6 +3897,9 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
3828
3897
|
var resolvedIndex = sourceIndex < targetIndex ? sourceIndex : sourceIndex + 1;
|
3829
3898
|
pageData.splice(resolvedIndex, 1);
|
3830
3899
|
};
|
3900
|
+
var setIndexData = function setIndexData() {
|
3901
|
+
return resolveIndexData();
|
3902
|
+
};
|
3831
3903
|
return {
|
3832
3904
|
formatColumns: formatColumns,
|
3833
3905
|
formatDataSchema: formatDataSchema,
|
@@ -3864,7 +3936,8 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
3864
3936
|
changePageRowIndex: changePageRowIndex,
|
3865
3937
|
pageData: pageData,
|
3866
3938
|
localPagination: localPagination,
|
3867
|
-
formatData: formatData
|
3939
|
+
formatData: formatData,
|
3940
|
+
setIndexData: setIndexData
|
3868
3941
|
};
|
3869
3942
|
});
|
3870
3943
|
;// CONCATENATED MODULE: ../../packages/table/src/use-column.ts
|
@@ -4036,10 +4109,12 @@ var useClass = function useClass(props, targetColumns, root, TableSchema, pageDa
|
|
4036
4109
|
});
|
4037
4110
|
var config = resolveHeadConfig(props);
|
4038
4111
|
var headStyle = (0,external_vue_namespaceObject.computed)(function () {
|
4112
|
+
var _props$thead$color, _props$thead;
|
4039
4113
|
return {
|
4040
4114
|
'--row-height': "".concat(resolvePropVal(config, 'height', ['thead']), "px"),
|
4041
4115
|
'--scroll-head-left': "-".concat(TableSchema.formatData.layout.translateX, "px"),
|
4042
|
-
'--scroll-left': "".concat(TableSchema.formatData.layout.translateX, "px")
|
4116
|
+
'--scroll-left': "".concat(TableSchema.formatData.layout.translateX, "px"),
|
4117
|
+
'--background-color': DEF_COLOR[(_props$thead$color = (_props$thead = props.thead) === null || _props$thead === void 0 ? void 0 : _props$thead.color) !== null && _props$thead$color !== void 0 ? _props$thead$color : IHeadColor.DEF1]
|
4043
4118
|
};
|
4044
4119
|
});
|
4045
4120
|
var contentClass = defineProperty_defineProperty({}, resolveClassName('table-body'), true);
|
@@ -4407,6 +4482,18 @@ const directives_namespaceObject = directives_x({ ["bkEllipsisInstance"]: () =>
|
|
4407
4482
|
if (typeof disabled === 'function') {
|
4408
4483
|
disabled = Reflect.apply(disabled, _this, [props.column, props.row]);
|
4409
4484
|
}
|
4485
|
+
/**
|
4486
|
+
* 当表格中的字段或数据需要做解释说明时,可增加 [下划线] 提示,hover 可查看解释说明的 tooltips
|
4487
|
+
*/
|
4488
|
+
if (props.column.explain) {
|
4489
|
+
disabled = false;
|
4490
|
+
mode = 'static';
|
4491
|
+
if (typeof_typeof(props.column.explain) === 'object') {
|
4492
|
+
content = function content() {
|
4493
|
+
return resolvePropVal(props.column.explain, 'content', [props.column, props.row]);
|
4494
|
+
};
|
4495
|
+
}
|
4496
|
+
}
|
4410
4497
|
if (props.isHead) {
|
4411
4498
|
var _props$column$showOve, _props$column;
|
4412
4499
|
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);
|
@@ -4422,18 +4509,6 @@ const directives_namespaceObject = directives_x({ ["bkEllipsisInstance"]: () =>
|
|
4422
4509
|
};
|
4423
4510
|
}
|
4424
4511
|
}
|
4425
|
-
/**
|
4426
|
-
* 当表格中的字段或数据需要做解释说明时,可增加 [下划线] 提示,hover 可查看解释说明的 tooltips
|
4427
|
-
*/
|
4428
|
-
if (props.column.explain) {
|
4429
|
-
disabled = false;
|
4430
|
-
mode = 'static';
|
4431
|
-
if (typeof_typeof(props.column.explain) === 'object') {
|
4432
|
-
content = function content() {
|
4433
|
-
return resolvePropVal(props.column.explain, 'content', [props.column, props.row]);
|
4434
|
-
};
|
4435
|
-
}
|
4436
|
-
}
|
4437
4512
|
return {
|
4438
4513
|
disabled: disabled,
|
4439
4514
|
content: content,
|
@@ -4977,6 +5052,30 @@ function _isSlot(s) {
|
|
4977
5052
|
if (!props.rowDraggable) {
|
4978
5053
|
return {};
|
4979
5054
|
}
|
5055
|
+
var placeDiv = document.createElement('div');
|
5056
|
+
placeDiv.style.setProperty('height', '20px');
|
5057
|
+
placeDiv.style.setProperty('width', '100%');
|
5058
|
+
placeDiv.style.setProperty('background', '#E2EDFF');
|
5059
|
+
placeDiv.style.setProperty('cursor', 'move');
|
5060
|
+
['dragenter', 'dragover'].forEach(function (type) {
|
5061
|
+
placeDiv.addEventListener(type, function (event) {
|
5062
|
+
event.preventDefault();
|
5063
|
+
event.stopPropagation();
|
5064
|
+
event.dataTransfer.dropEffect = 'move';
|
5065
|
+
});
|
5066
|
+
});
|
5067
|
+
var lastDragRow = null;
|
5068
|
+
var insertPlaceDiv = function insertPlaceDiv(target, placement) {
|
5069
|
+
if (placement === '--top') {
|
5070
|
+
target.parentNode.insertBefore(placeDiv, target);
|
5071
|
+
return;
|
5072
|
+
}
|
5073
|
+
if (target.nextElementSibling === null) {
|
5074
|
+
target.parentNode.appendChild(placeDiv);
|
5075
|
+
return;
|
5076
|
+
}
|
5077
|
+
target.parentNode.insertBefore(placeDiv, target.nextElementSibling);
|
5078
|
+
};
|
4980
5079
|
var beforeEventFire = function beforeEventFire(fn) {
|
4981
5080
|
if (props.rowDraggable) {
|
4982
5081
|
fn === null || fn === void 0 || fn();
|
@@ -4990,9 +5089,10 @@ function _isSlot(s) {
|
|
4990
5089
|
var _target$getBoundingCl = target.getBoundingClientRect(),
|
4991
5090
|
top = _target$getBoundingCl.top,
|
4992
5091
|
bottom = _target$getBoundingCl.bottom;
|
4993
|
-
var
|
5092
|
+
var placement = y - top > bottom - y ? '--bottom' : '--top';
|
4994
5093
|
removeDragClass(target);
|
4995
|
-
target.classList.add(
|
5094
|
+
target.classList.add(placement);
|
5095
|
+
insertPlaceDiv(target, placement);
|
4996
5096
|
};
|
4997
5097
|
var removeDragClass = function removeDragClass(target) {
|
4998
5098
|
var classList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['--bottom', '--top'];
|
@@ -5003,19 +5103,25 @@ function _isSlot(s) {
|
|
5003
5103
|
var onDragstart = function onDragstart(event) {
|
5004
5104
|
beforeEventFire(function () {
|
5005
5105
|
var target = getTargetRow(event);
|
5106
|
+
placeDiv.style.setProperty('height', "".concat(target.offsetHeight, "px"));
|
5107
|
+
placeDiv.style.setProperty('width', "".concat(target.offsetWidth, "px"));
|
5006
5108
|
target.classList.add('--drag-start');
|
5109
|
+
event.dataTransfer.setDragImage(target, 0, 0);
|
5007
5110
|
event.dataTransfer.setData('text/plain', null);
|
5008
|
-
event.dataTransfer.dropEffect = '
|
5111
|
+
event.dataTransfer.dropEffect = 'move';
|
5009
5112
|
var rowIndex = event.target.dataset.rowIndex;
|
5010
5113
|
event.dataTransfer.setData('data-row-index', rowIndex);
|
5011
5114
|
});
|
5012
5115
|
};
|
5013
5116
|
var onDragenter = function onDragenter(event) {
|
5117
|
+
var target = getTargetRow(event);
|
5118
|
+
event.preventDefault();
|
5119
|
+
event.stopPropagation();
|
5014
5120
|
beforeEventFire(function () {
|
5015
5121
|
event.dataTransfer.dropEffect = 'move';
|
5016
|
-
var target = getTargetRow(event);
|
5017
5122
|
target.classList.add('--drag-enter');
|
5018
5123
|
setTargetRowPlacement(target, event);
|
5124
|
+
lastDragRow = target;
|
5019
5125
|
});
|
5020
5126
|
};
|
5021
5127
|
var onDragleave = function onDragleave(event) {
|
@@ -5026,22 +5132,29 @@ function _isSlot(s) {
|
|
5026
5132
|
};
|
5027
5133
|
var onDragover = function onDragover(event) {
|
5028
5134
|
event.preventDefault();
|
5135
|
+
event.stopPropagation();
|
5029
5136
|
event.dataTransfer.dropEffect = 'move';
|
5030
5137
|
var target = getTargetRow(event);
|
5031
5138
|
setTargetRowPlacement(target, event);
|
5032
5139
|
};
|
5033
|
-
var
|
5140
|
+
var onDragend = function onDragend(event) {
|
5141
|
+
var _event$target$dataset;
|
5034
5142
|
event.preventDefault();
|
5035
5143
|
event.stopPropagation();
|
5036
|
-
|
5144
|
+
placeDiv.remove();
|
5145
|
+
if (!lastDragRow) {
|
5146
|
+
return;
|
5147
|
+
}
|
5148
|
+
var target = lastDragRow;
|
5037
5149
|
var rowIndex = target.dataset.rowIndex;
|
5038
5150
|
var targetIndex = Number(rowIndex);
|
5039
|
-
var sourceIndex = event.
|
5151
|
+
var sourceIndex = (_event$target$dataset = event.target.dataset) === null || _event$target$dataset === void 0 ? void 0 : _event$target$dataset.rowIndex;
|
5040
5152
|
if (target.classList.contains('--bottom')) {
|
5041
5153
|
targetIndex = targetIndex + 1;
|
5042
5154
|
}
|
5043
5155
|
resp.changePageRowIndex(Number(sourceIndex), targetIndex);
|
5044
5156
|
removeDragClass(target, ['--drag-enter', '--bottom', '--top']);
|
5157
|
+
lastDragRow = null;
|
5045
5158
|
ctx.emit(EMIT_EVENTS.DRAG_END, {
|
5046
5159
|
sourceEvent: event,
|
5047
5160
|
data: resp.pageData
|
@@ -5052,9 +5165,17 @@ function _isSlot(s) {
|
|
5052
5165
|
onDragleave: onDragleave,
|
5053
5166
|
onDragstart: onDragstart,
|
5054
5167
|
onDragover: onDragover,
|
5055
|
-
|
5168
|
+
onDragend: onDragend
|
5056
5169
|
};
|
5057
5170
|
});
|
5171
|
+
;// CONCATENATED MODULE: external "../input"
|
5172
|
+
var input_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
5173
|
+
var input_y = x => () => x
|
5174
|
+
const input_namespaceObject = input_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_input_d525237e__["default"] });
|
5175
|
+
;// CONCATENATED MODULE: external "../input/input.less"
|
5176
|
+
var input_less_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
5177
|
+
var input_less_y = x => () => x
|
5178
|
+
const input_less_namespaceObject = input_less_x({ });
|
5058
5179
|
;// CONCATENATED MODULE: ../../packages/table/src/plugins/head-filter.tsx
|
5059
5180
|
|
5060
5181
|
|
@@ -5100,6 +5221,8 @@ function _isSlot(s) {
|
|
5100
5221
|
|
5101
5222
|
|
5102
5223
|
|
5224
|
+
|
5225
|
+
|
5103
5226
|
function head_filter_isSlot(s) {
|
5104
5227
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !(0,external_vue_namespaceObject.isVNode)(s);
|
5105
5228
|
}
|
@@ -5122,6 +5245,7 @@ function head_filter_isSlot(s) {
|
|
5122
5245
|
var _filter$value$checked, _filter$value;
|
5123
5246
|
return (_filter$value$checked = (_filter$value = filter.value) === null || _filter$value === void 0 ? void 0 : _filter$value.checked) !== null && _filter$value$checked !== void 0 ? _filter$value$checked : [];
|
5124
5247
|
});
|
5248
|
+
var searchValue = (0,external_vue_namespaceObject.ref)('');
|
5125
5249
|
var state = (0,external_vue_namespaceObject.reactive)({
|
5126
5250
|
isOpen: false,
|
5127
5251
|
checked: checked.value
|
@@ -5152,21 +5276,28 @@ function head_filter_isSlot(s) {
|
|
5152
5276
|
isOpen && setTimeout(function () {
|
5153
5277
|
refVirtualRender.value.reset();
|
5154
5278
|
});
|
5279
|
+
if (!isOpen) {
|
5280
|
+
searchValue.value = '';
|
5281
|
+
}
|
5155
5282
|
};
|
5156
5283
|
var theme = "light ".concat(resolveClassName('table-head-filter'));
|
5157
5284
|
var localData = (0,external_vue_namespaceObject.computed)(function () {
|
5158
5285
|
var _filter$value$list = filter.value.list,
|
5159
5286
|
list = _filter$value$list === void 0 ? [] : _filter$value$list;
|
5160
|
-
|
5287
|
+
var filterList = list.filter(function (l) {
|
5288
|
+
return getRegExp(searchValue.value).test(l.value);
|
5289
|
+
});
|
5290
|
+
console.log(' filterList: ', filterList);
|
5291
|
+
return filterList;
|
5161
5292
|
});
|
5162
|
-
var getRegExp = function getRegExp(
|
5293
|
+
var getRegExp = function getRegExp(val) {
|
5163
5294
|
var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'ig';
|
5164
|
-
return new RegExp("".concat(
|
5295
|
+
return new RegExp("".concat(val).replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'), flags);
|
5165
5296
|
};
|
5166
5297
|
var defaultFilterFn = function defaultFilterFn(checked, row) {
|
5167
5298
|
var match = filter.value.match;
|
5168
5299
|
var matchText = getRowText(row, resolvePropVal(column, 'field', [column, row]));
|
5169
|
-
if (match
|
5300
|
+
if (match !== 'fuzzy') {
|
5170
5301
|
return checked.includes(matchText);
|
5171
5302
|
}
|
5172
5303
|
return checked.some(function (str) {
|
@@ -5330,7 +5461,14 @@ function head_filter_isSlot(s) {
|
|
5330
5461
|
content: function content() {
|
5331
5462
|
return (0,external_vue_namespaceObject.createVNode)("div", {
|
5332
5463
|
"class": headFilterContentClass
|
5333
|
-
}, [(0,external_vue_namespaceObject.createVNode)(
|
5464
|
+
}, [(0,external_vue_namespaceObject.createVNode)("div", {
|
5465
|
+
"style": "padding: 4px 10px;"
|
5466
|
+
}, [(0,external_vue_namespaceObject.createVNode)(input_namespaceObject["default"], {
|
5467
|
+
"modelValue": searchValue.value,
|
5468
|
+
"onUpdate:modelValue": function onUpdateModelValue($event) {
|
5469
|
+
return searchValue.value = $event;
|
5470
|
+
}
|
5471
|
+
}, null)]), (0,external_vue_namespaceObject.createVNode)(checkbox_namespaceObject.BkCheckboxGroup, {
|
5334
5472
|
"class": "content-list"
|
5335
5473
|
}, {
|
5336
5474
|
"default": function _default() {
|
@@ -5439,7 +5577,8 @@ function _slicedToArray(arr, i) {
|
|
5439
5577
|
props: {
|
5440
5578
|
column: IColumnType,
|
5441
5579
|
defaultSort: shared_namespaceObject.PropTypes.oneOf(SORT_OPTIONS).def(SORT_OPTION.NULL),
|
5442
|
-
active: shared_namespaceObject.PropTypes.bool
|
5580
|
+
active: shared_namespaceObject.PropTypes.bool,
|
5581
|
+
sortValFormat: shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.any).def([''])
|
5443
5582
|
},
|
5444
5583
|
emits: ['change'],
|
5445
5584
|
setup: function setup(props, _ref) {
|
@@ -5477,8 +5616,8 @@ function _slicedToArray(arr, i) {
|
|
5477
5616
|
if (sortType.value === type) {
|
5478
5617
|
currentSort = SORT_OPTION.NULL;
|
5479
5618
|
}
|
5480
|
-
var execFn = getSortFn(props.column, currentSort);
|
5481
|
-
var sort = resolveSort(props.column.sort, props.column);
|
5619
|
+
var execFn = getSortFn(props.column, currentSort, props.sortValFormat);
|
5620
|
+
var sort = resolveSort(props.column.sort, props.column, props.sortValFormat);
|
5482
5621
|
if ((sort === null || sort === void 0 ? void 0 : sort.value) === 'custom') {
|
5483
5622
|
var _sort$sortFn;
|
5484
5623
|
emit('change', (_sort$sortFn = sort === null || sort === void 0 ? void 0 : sort.sortFn) !== null && _sort$sortFn !== void 0 ? _sort$sortFn : execFn, currentSort);
|
@@ -5589,7 +5728,7 @@ function use_head_cell_isSlot(s) {
|
|
5589
5728
|
var type = tableResp.getColumnAttribute(column, COLUMN_ATTRIBUTE.COL_SORT_TYPE);
|
5590
5729
|
nextSort.value = getNextSortType(type);
|
5591
5730
|
var sortFn = function sortFn(a, b) {
|
5592
|
-
return getSortFnByColumn(column, getSortFn(column, nextSort.value), a, b);
|
5731
|
+
return getSortFnByColumn(column, getSortFn(column, nextSort.value, props.sortValFormat), a, b);
|
5593
5732
|
};
|
5594
5733
|
tableResp.setColumnAttribute(column, COLUMN_ATTRIBUTE.COL_SORT_TYPE, nextSort.value);
|
5595
5734
|
tableResp.setColumnAttribute(column, COLUMN_ATTRIBUTE.COL_SORT_FN, sortFn);
|
@@ -5675,7 +5814,8 @@ function use_head_cell_isSlot(s) {
|
|
5675
5814
|
"column": column,
|
5676
5815
|
"defaultSort": active.value ? nextSort.value : SORT_OPTION.NULL,
|
5677
5816
|
"onChange": handleSortClick,
|
5678
|
-
"active": active.value
|
5817
|
+
"active": active.value,
|
5818
|
+
"sortValFormat": props.sortValFormat
|
5679
5819
|
}, null);
|
5680
5820
|
};
|
5681
5821
|
var getFilterCell = function getFilterCell(column, index) {
|
@@ -6001,7 +6141,7 @@ function use_render_isSlot(s) {
|
|
6001
6141
|
}
|
6002
6142
|
return '';
|
6003
6143
|
};
|
6004
|
-
var getRowSpanConfig = function getRowSpanConfig(row,
|
6144
|
+
var getRowSpanConfig = function getRowSpanConfig(row, rowIndex, preRow, col, store) {
|
6005
6145
|
var _store$get$get, _store$get;
|
6006
6146
|
if (!store.has(row)) {
|
6007
6147
|
store.set(row, new WeakMap());
|
@@ -6016,7 +6156,7 @@ function use_render_isSlot(s) {
|
|
6016
6156
|
_ref$skipRowLen = _ref.skipRowLen,
|
6017
6157
|
skipRowLen = _ref$skipRowLen === void 0 ? 0 : _ref$skipRowLen;
|
6018
6158
|
var skipRow = false;
|
6019
|
-
var rowspan = resolveColumnSpan(col, null, row,
|
6159
|
+
var rowspan = resolveColumnSpan(col, null, row, rowIndex, 'rowspan');
|
6020
6160
|
if (skipRowLen > 1) {
|
6021
6161
|
skipRowLen = skipRowLen - 1;
|
6022
6162
|
skipRow = true;
|
@@ -6089,7 +6229,7 @@ function use_render_isSlot(s) {
|
|
6089
6229
|
rowspan = _resolveCellSpan.rowspan;
|
6090
6230
|
var _tableResp$getColumnA = tableResp.getColumnAttribute(column, COLUMN_ATTRIBUTE.COL_SPAN),
|
6091
6231
|
skipCol = _tableResp$getColumnA.skipCol;
|
6092
|
-
var _ref2 = needRowSpan && !isChild ? getRowSpanConfig(row,
|
6232
|
+
var _ref2 = needRowSpan && !isChild ? getRowSpanConfig(row, rowIndex, preRow, column, rowSpanMap) : {
|
6093
6233
|
skipRow: false
|
6094
6234
|
},
|
6095
6235
|
skipRow = _ref2.skipRow;
|
@@ -6473,7 +6613,6 @@ function table_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
|
|
6473
6613
|
hasFooter = _useClass.hasFooter,
|
6474
6614
|
footerStyle = _useClass.footerStyle,
|
6475
6615
|
tableBodyClass = _useClass.tableBodyClass,
|
6476
|
-
fixedBottomBorder = _useClass.fixedBottomBorder,
|
6477
6616
|
resizeColumnClass = _useClass.resizeColumnClass,
|
6478
6617
|
tableBodyContentClass = _useClass.tableBodyContentClass,
|
6479
6618
|
loadingRowClass = _useClass.loadingRowClass,
|
@@ -6513,27 +6652,30 @@ function table_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
|
|
6513
6652
|
}
|
6514
6653
|
};
|
6515
6654
|
var isFirstLoad = (0,external_vue_namespaceObject.ref)(true);
|
6655
|
+
// const tableWidth = ref(null);
|
6516
6656
|
(0,external_vue_namespaceObject.watch)(function () {
|
6517
6657
|
return [props.data, columns];
|
6518
6658
|
}, function () {
|
6519
|
-
tableSchema.
|
6520
|
-
|
6521
|
-
|
6522
|
-
|
6523
|
-
|
6524
|
-
|
6525
|
-
|
6526
|
-
|
6527
|
-
|
6528
|
-
|
6529
|
-
|
6530
|
-
updateOffsetRight();
|
6531
|
-
resolveFixedColumns(tableOffsetRight.value);
|
6532
|
-
/**
|
6533
|
-
* 确保在所有数据渲染完毕再执行fix column计算
|
6534
|
-
*/
|
6659
|
+
tableSchema.setIndexData().then(function () {
|
6660
|
+
tableSchema.formatColumns(columns);
|
6661
|
+
tableSchema.formatDataSchema(props.data);
|
6662
|
+
tableSchema.resetStartEndIndex();
|
6663
|
+
if (isFirstLoad.value) {
|
6664
|
+
tableSchema.resolveByDefColumns();
|
6665
|
+
isFirstLoad.value = false;
|
6666
|
+
} else {
|
6667
|
+
tableSchema.resolvePageData();
|
6668
|
+
}
|
6669
|
+
registerResizeEvent();
|
6535
6670
|
(0,external_vue_namespaceObject.nextTick)(function () {
|
6536
|
-
|
6671
|
+
updateOffsetRight();
|
6672
|
+
resolveFixedColumns(tableOffsetRight.value);
|
6673
|
+
/**
|
6674
|
+
* 确保在所有数据渲染完毕再执行fix column计算
|
6675
|
+
*/
|
6676
|
+
(0,external_vue_namespaceObject.nextTick)(function () {
|
6677
|
+
resetTableHeight(root.value);
|
6678
|
+
});
|
6537
6679
|
});
|
6538
6680
|
});
|
6539
6681
|
}, {
|
@@ -6650,9 +6792,8 @@ function table_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
|
|
6650
6792
|
return renderTableBodySchema(scope.data);
|
6651
6793
|
},
|
6652
6794
|
afterSection: function afterSection() {
|
6653
|
-
return [
|
6654
|
-
|
6655
|
-
}, null), (0,external_vue_namespaceObject.createVNode)("div", {
|
6795
|
+
return [// <div class={fixedBottomBorder.value}></div>,
|
6796
|
+
(0,external_vue_namespaceObject.createVNode)("div", {
|
6656
6797
|
"class": resizeColumnClass,
|
6657
6798
|
"style": resizeColumnStyle.value
|
6658
6799
|
}, null)];
|