bkui-vue 0.0.3-beta.2-7 → 0.0.3-beta.2-9
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/dist/index.cjs.js +28 -28
- package/dist/index.esm.js +6432 -6413
- package/dist/index.umd.js +28 -28
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/table/index.js +265 -208
- package/lib/table/plugins/use-draggable.d.ts +2 -2
- package/lib/table/table.css +3 -11
- package/lib/table/table.less +12 -9
- package/lib/table/table.variable.css +3 -11
- package/lib/table/use-attributes.d.ts +1 -1
- package/lib/table/utils.d.ts +1 -0
- package/package.json +1 -1
package/lib/table/index.js
CHANGED
@@ -16,6 +16,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__exception_12c197e0__ from "../exception";
|
|
16
16
|
import * as __WEBPACK_EXTERNAL_MODULE__button_59c00871__ from "../button";
|
17
17
|
import * as __WEBPACK_EXTERNAL_MODULE__icon__2ba2075d__ from "../icon/";
|
18
18
|
import * as __WEBPACK_EXTERNAL_MODULE__popover_cf5f8dce__ from "../popover";
|
19
|
+
import * as __WEBPACK_EXTERNAL_MODULE__input_752b0149__ from "../input";
|
19
20
|
/******/ // The require scope
|
20
21
|
/******/ var __webpack_require__ = {};
|
21
22
|
/******/
|
@@ -111,7 +112,7 @@ function defineProperty_defineProperty(obj, key, value) {
|
|
111
112
|
;// CONCATENATED MODULE: external "vue"
|
112
113
|
var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
113
114
|
var external_vue_y = x => () => x
|
114
|
-
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, ["
|
115
|
+
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 });
|
115
116
|
;// CONCATENATED MODULE: ../../packages/table/src/const.ts
|
116
117
|
|
117
118
|
/*
|
@@ -1588,195 +1589,6 @@ function v4(options, buf, offset) {
|
|
1588
1589
|
}
|
1589
1590
|
|
1590
1591
|
/* harmony default export */ const esm_browser_v4 = (v4);
|
1591
|
-
;// CONCATENATED MODULE: ../../packages/table/src/plugins/use-pagination.tsx
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
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; }
|
1596
|
-
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; }
|
1597
|
-
/*
|
1598
|
-
* Tencent is pleased to support the open source community by making
|
1599
|
-
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
1600
|
-
*
|
1601
|
-
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
1602
|
-
*
|
1603
|
-
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
|
1604
|
-
*
|
1605
|
-
* License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
|
1606
|
-
*
|
1607
|
-
* ---------------------------------------------------
|
1608
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
1609
|
-
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
1610
|
-
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
1611
|
-
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
1612
|
-
*
|
1613
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
1614
|
-
* the Software.
|
1615
|
-
*
|
1616
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
1617
|
-
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
1618
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
1619
|
-
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
1620
|
-
* IN THE SOFTWARE.
|
1621
|
-
*/
|
1622
|
-
|
1623
|
-
|
1624
|
-
/**
|
1625
|
-
* 处理 Prop中的分页配置
|
1626
|
-
* prop中的配置会覆盖本地的配置
|
1627
|
-
* @param propPagination 用户传入的配置
|
1628
|
-
* @param defVal 默认配置
|
1629
|
-
* @returns 返回值
|
1630
|
-
*/
|
1631
|
-
var resolvePaginationOption = function resolvePaginationOption(propPagination, defVal) {
|
1632
|
-
if (!!propPagination) {
|
1633
|
-
if (typeof_typeof(propPagination) === 'object') {
|
1634
|
-
var current = Object.prototype.hasOwnProperty.call(propPagination, 'current') ? propPagination.current : propPagination.value;
|
1635
|
-
if (!/\d+/.test(current)) {
|
1636
|
-
current = 1;
|
1637
|
-
}
|
1638
|
-
return use_pagination_objectSpread(use_pagination_objectSpread(use_pagination_objectSpread({}, defVal), propPagination), {}, {
|
1639
|
-
current: current
|
1640
|
-
});
|
1641
|
-
}
|
1642
|
-
return defVal;
|
1643
|
-
}
|
1644
|
-
return {};
|
1645
|
-
};
|
1646
|
-
/* harmony default export */ const use_pagination = (function (props) {
|
1647
|
-
var startIndex = (0,external_vue_namespaceObject.ref)(0);
|
1648
|
-
var endIndex = (0,external_vue_namespaceObject.ref)(0);
|
1649
|
-
/**
|
1650
|
-
* 分页配置
|
1651
|
-
* 用于配置分页组件
|
1652
|
-
* pagination 为Prop传入配置
|
1653
|
-
* 方便兼容内置分页功能,此处需要单独处理count
|
1654
|
-
*/
|
1655
|
-
var propsData = (0,external_vue_namespaceObject.computed)(function () {
|
1656
|
-
return props.data;
|
1657
|
-
});
|
1658
|
-
var localPagination = (0,external_vue_namespaceObject.ref)(null);
|
1659
|
-
var indexData = (0,external_vue_namespaceObject.reactive)([]);
|
1660
|
-
// 当前分页缓存,用于支持内置前端分页,用户无需接收change事件来自行处理数据分割
|
1661
|
-
var pagination = (0,external_vue_namespaceObject.reactive)({
|
1662
|
-
count: 0,
|
1663
|
-
limit: 10,
|
1664
|
-
current: 1,
|
1665
|
-
align: 'right',
|
1666
|
-
layout: ['total', 'limit', 'list']
|
1667
|
-
});
|
1668
|
-
var resolveLocalPagination = function resolveLocalPagination() {
|
1669
|
-
if (!props.pagination) {
|
1670
|
-
return;
|
1671
|
-
}
|
1672
|
-
localPagination.value = props.remotePagination ? pagination : use_pagination_objectSpread(use_pagination_objectSpread({}, pagination), {}, {
|
1673
|
-
count: indexData.length
|
1674
|
-
});
|
1675
|
-
};
|
1676
|
-
/**
|
1677
|
-
* 重置当前分页开始位置 & 结束位置
|
1678
|
-
* 如果未启用分页,则开始位置为0,结束位置为 data.length
|
1679
|
-
* @returns
|
1680
|
-
*/
|
1681
|
-
var resetStartEndIndex = function resetStartEndIndex() {
|
1682
|
-
if (!props.pagination || props.remotePagination) {
|
1683
|
-
startIndex.value = 0;
|
1684
|
-
endIndex.value = indexData.length;
|
1685
|
-
return;
|
1686
|
-
}
|
1687
|
-
// 如果是前端分页
|
1688
|
-
startIndex.value = (pagination.current - 1) * pagination.limit;
|
1689
|
-
endIndex.value = pagination.current * pagination.limit;
|
1690
|
-
};
|
1691
|
-
/**
|
1692
|
-
* 当前页分页数据
|
1693
|
-
*/
|
1694
|
-
var pageData = (0,external_vue_namespaceObject.reactive)([]);
|
1695
|
-
var sort = function sort(sourceData, sortFn, column, type, sortScope) {
|
1696
|
-
if (typeof sortFn === 'function') {
|
1697
|
-
sourceData.sort(function (a, b) {
|
1698
|
-
return sortFn(a, b, type, column, sortScope);
|
1699
|
-
});
|
1700
|
-
}
|
1701
|
-
};
|
1702
|
-
/**
|
1703
|
-
* 初始化排序动作
|
1704
|
-
* @param data
|
1705
|
-
* @param sortColumns
|
1706
|
-
*/
|
1707
|
-
var multiSort = function multiSort(data, sortColumns) {
|
1708
|
-
sortColumns.forEach(function (item) {
|
1709
|
-
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]);
|
1710
|
-
});
|
1711
|
-
};
|
1712
|
-
var filter = function filter(sourceData, filterFn) {
|
1713
|
-
if (typeof filterFn === 'function') {
|
1714
|
-
var filterVals = sourceData.filter(function (row, index) {
|
1715
|
-
return filterFn(row, index, indexData);
|
1716
|
-
});
|
1717
|
-
sourceData.length = 0;
|
1718
|
-
sourceData.push.apply(sourceData, _toConsumableArray(filterVals));
|
1719
|
-
}
|
1720
|
-
return sourceData;
|
1721
|
-
};
|
1722
|
-
var resolveIndexData = function resolveIndexData() {
|
1723
|
-
return new Promise(function (resolve) {
|
1724
|
-
(0,external_vue_namespaceObject.nextTick)(function () {
|
1725
|
-
var target = propsData.value.slice();
|
1726
|
-
indexData.length = 0;
|
1727
|
-
indexData.push.apply(indexData, _toConsumableArray(target));
|
1728
|
-
resolve();
|
1729
|
-
});
|
1730
|
-
});
|
1731
|
-
};
|
1732
|
-
var resolvePageData = function resolvePageData(filterFn, sortFn, column, type, sortScope, multiCol) {
|
1733
|
-
var sourceData = indexData.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.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
|
-
resolveIndexData: resolveIndexData,
|
1774
|
-
resolvePageDataBySortList: resolvePageDataBySortList,
|
1775
|
-
resetStartEndIndex: resetStartEndIndex,
|
1776
|
-
multiFilter: multiFilter,
|
1777
|
-
sort: sort
|
1778
|
-
};
|
1779
|
-
});
|
1780
1592
|
;// CONCATENATED MODULE: external "lodash/debounce"
|
1781
1593
|
var debounce_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
1782
1594
|
var debounce_y = x => () => x
|
@@ -2753,6 +2565,7 @@ function utils_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
|
|
2753
2565
|
|
2754
2566
|
|
2755
2567
|
|
2568
|
+
|
2756
2569
|
/**
|
2757
2570
|
* 解析Prop值 | 可能为多种类型 & 函数返回的场景
|
2758
2571
|
* @param prop 当前Prop
|
@@ -2933,6 +2746,10 @@ var resolveHeadConfig = function resolveHeadConfig(props) {
|
|
2933
2746
|
height: headHeight
|
2934
2747
|
}, thead);
|
2935
2748
|
};
|
2749
|
+
var getRegExp = function getRegExp(val) {
|
2750
|
+
var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'ig';
|
2751
|
+
return new RegExp("".concat(val).replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'), flags);
|
2752
|
+
};
|
2936
2753
|
/**
|
2937
2754
|
* 获取当前行指定列的内容
|
2938
2755
|
* @param row 当前行
|
@@ -2946,11 +2763,9 @@ var getRowText = function getRowText(row, key, format) {
|
|
2946
2763
|
if (typeof row === 'string' || typeof row === 'number' || typeof row === 'boolean') {
|
2947
2764
|
result = row;
|
2948
2765
|
}
|
2949
|
-
|
2950
|
-
|
2951
|
-
|
2952
|
-
};
|
2953
|
-
result = (0,get_namespaceObject["default"])(row, key);
|
2766
|
+
if (typeof_typeof(row) === 'object') {
|
2767
|
+
result = (0,get_namespaceObject["default"])(row, key);
|
2768
|
+
}
|
2954
2769
|
if (format !== null && format !== void 0 && format.length) {
|
2955
2770
|
format.forEach(function (reg) {
|
2956
2771
|
if (typeof reg === 'function') {
|
@@ -3203,6 +3018,202 @@ var resolveColumnSortProp = function resolveColumnSortProp(col, props) {
|
|
3203
3018
|
active: !!col.sort
|
3204
3019
|
};
|
3205
3020
|
};
|
3021
|
+
var getRawData = function getRawData(data) {
|
3022
|
+
if ((0,external_vue_namespaceObject.isProxy)(data)) {
|
3023
|
+
return (0,external_vue_namespaceObject.toRaw)(data);
|
3024
|
+
}
|
3025
|
+
return data;
|
3026
|
+
};
|
3027
|
+
;// CONCATENATED MODULE: ../../packages/table/src/plugins/use-pagination.tsx
|
3028
|
+
|
3029
|
+
|
3030
|
+
|
3031
|
+
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; }
|
3032
|
+
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; }
|
3033
|
+
/*
|
3034
|
+
* Tencent is pleased to support the open source community by making
|
3035
|
+
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
3036
|
+
*
|
3037
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
3038
|
+
*
|
3039
|
+
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
|
3040
|
+
*
|
3041
|
+
* License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
|
3042
|
+
*
|
3043
|
+
* ---------------------------------------------------
|
3044
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
3045
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
3046
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
3047
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
3048
|
+
*
|
3049
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
3050
|
+
* the Software.
|
3051
|
+
*
|
3052
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
3053
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
3054
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
3055
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
3056
|
+
* IN THE SOFTWARE.
|
3057
|
+
*/
|
3058
|
+
|
3059
|
+
|
3060
|
+
|
3061
|
+
/**
|
3062
|
+
* 处理 Prop中的分页配置
|
3063
|
+
* prop中的配置会覆盖本地的配置
|
3064
|
+
* @param propPagination 用户传入的配置
|
3065
|
+
* @param defVal 默认配置
|
3066
|
+
* @returns 返回值
|
3067
|
+
*/
|
3068
|
+
var resolvePaginationOption = function resolvePaginationOption(propPagination, defVal) {
|
3069
|
+
if (!!propPagination) {
|
3070
|
+
if (typeof_typeof(propPagination) === 'object') {
|
3071
|
+
var current = Object.prototype.hasOwnProperty.call(propPagination, 'current') ? propPagination.current : propPagination.value;
|
3072
|
+
if (!/\d+/.test(current)) {
|
3073
|
+
current = 1;
|
3074
|
+
}
|
3075
|
+
return use_pagination_objectSpread(use_pagination_objectSpread(use_pagination_objectSpread({}, defVal), propPagination), {}, {
|
3076
|
+
current: current
|
3077
|
+
});
|
3078
|
+
}
|
3079
|
+
return defVal;
|
3080
|
+
}
|
3081
|
+
return {};
|
3082
|
+
};
|
3083
|
+
/* harmony default export */ const use_pagination = (function (props) {
|
3084
|
+
var startIndex = (0,external_vue_namespaceObject.ref)(0);
|
3085
|
+
var endIndex = (0,external_vue_namespaceObject.ref)(0);
|
3086
|
+
/**
|
3087
|
+
* 分页配置
|
3088
|
+
* 用于配置分页组件
|
3089
|
+
* pagination 为Prop传入配置
|
3090
|
+
* 方便兼容内置分页功能,此处需要单独处理count
|
3091
|
+
*/
|
3092
|
+
var propsData = (0,external_vue_namespaceObject.computed)(function () {
|
3093
|
+
return props.data;
|
3094
|
+
});
|
3095
|
+
var localPagination = (0,external_vue_namespaceObject.ref)(null);
|
3096
|
+
var indexData = (0,external_vue_namespaceObject.reactive)([]);
|
3097
|
+
// 当前分页缓存,用于支持内置前端分页,用户无需接收change事件来自行处理数据分割
|
3098
|
+
var pagination = (0,external_vue_namespaceObject.reactive)({
|
3099
|
+
count: 0,
|
3100
|
+
limit: 10,
|
3101
|
+
current: 1,
|
3102
|
+
align: 'right',
|
3103
|
+
layout: ['total', 'limit', 'list']
|
3104
|
+
});
|
3105
|
+
var resolveLocalPagination = function resolveLocalPagination() {
|
3106
|
+
if (!props.pagination) {
|
3107
|
+
return;
|
3108
|
+
}
|
3109
|
+
localPagination.value = props.remotePagination ? pagination : use_pagination_objectSpread(use_pagination_objectSpread({}, pagination), {}, {
|
3110
|
+
count: indexData.length
|
3111
|
+
});
|
3112
|
+
};
|
3113
|
+
/**
|
3114
|
+
* 重置当前分页开始位置 & 结束位置
|
3115
|
+
* 如果未启用分页,则开始位置为0,结束位置为 data.length
|
3116
|
+
* @returns
|
3117
|
+
*/
|
3118
|
+
var resetStartEndIndex = function resetStartEndIndex() {
|
3119
|
+
if (!props.pagination || props.remotePagination) {
|
3120
|
+
startIndex.value = 0;
|
3121
|
+
endIndex.value = indexData.length;
|
3122
|
+
return;
|
3123
|
+
}
|
3124
|
+
// 如果是前端分页
|
3125
|
+
startIndex.value = (pagination.current - 1) * pagination.limit;
|
3126
|
+
endIndex.value = pagination.current * pagination.limit;
|
3127
|
+
};
|
3128
|
+
/**
|
3129
|
+
* 当前页分页数据
|
3130
|
+
*/
|
3131
|
+
var pageData = (0,external_vue_namespaceObject.reactive)([]);
|
3132
|
+
var sort = function sort(sourceData, sortFn, column, type, sortScope) {
|
3133
|
+
if (typeof sortFn === 'function') {
|
3134
|
+
sourceData.sort(function (a, b) {
|
3135
|
+
return sortFn(a, b, type, column, sortScope);
|
3136
|
+
});
|
3137
|
+
}
|
3138
|
+
};
|
3139
|
+
/**
|
3140
|
+
* 初始化排序动作
|
3141
|
+
* @param data
|
3142
|
+
* @param sortColumns
|
3143
|
+
*/
|
3144
|
+
var multiSort = function multiSort(data, sortColumns) {
|
3145
|
+
sortColumns.forEach(function (item) {
|
3146
|
+
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]);
|
3147
|
+
});
|
3148
|
+
};
|
3149
|
+
var filter = function filter(sourceData, filterFn) {
|
3150
|
+
if (typeof filterFn === 'function') {
|
3151
|
+
var filterVals = sourceData.filter(function (row, index) {
|
3152
|
+
return filterFn(row, index, indexData);
|
3153
|
+
});
|
3154
|
+
sourceData.length = 0;
|
3155
|
+
sourceData.push.apply(sourceData, _toConsumableArray(filterVals));
|
3156
|
+
}
|
3157
|
+
return sourceData;
|
3158
|
+
};
|
3159
|
+
var resolveIndexData = function resolveIndexData() {
|
3160
|
+
return new Promise(function (resolve) {
|
3161
|
+
(0,external_vue_namespaceObject.nextTick)(function () {
|
3162
|
+
var target = propsData.value.slice();
|
3163
|
+
indexData.length = 0;
|
3164
|
+
indexData.push.apply(indexData, _toConsumableArray(getRawData(target)));
|
3165
|
+
resolve();
|
3166
|
+
});
|
3167
|
+
});
|
3168
|
+
};
|
3169
|
+
var resolvePageData = function resolvePageData(filterFn, sortFn, column, type, sortScope, multiCol) {
|
3170
|
+
var sourceData = indexData.slice();
|
3171
|
+
if (multiCol !== null && multiCol !== void 0 && multiCol.length) {
|
3172
|
+
multiSort(sourceData, multiCol);
|
3173
|
+
}
|
3174
|
+
pageData.length = 0;
|
3175
|
+
pageData.push.apply(pageData, _toConsumableArray(sourceData.slice(startIndex.value, endIndex.value)));
|
3176
|
+
filter(pageData, filterFn);
|
3177
|
+
sort(pageData, sortFn, column, type, sortScope);
|
3178
|
+
resolveLocalPagination();
|
3179
|
+
};
|
3180
|
+
var resolvePageDataBySortList = function resolvePageDataBySortList(multiCol) {
|
3181
|
+
resolvePageData(null, null, null, null, null, multiCol);
|
3182
|
+
};
|
3183
|
+
var multiFilter = function multiFilter(filterFnList) {
|
3184
|
+
var sourceData = indexData.slice();
|
3185
|
+
var target = filterFnList.reduce(function (result, fn) {
|
3186
|
+
return filter(result, fn);
|
3187
|
+
}, sourceData);
|
3188
|
+
pageData.length = 0;
|
3189
|
+
pageData.push.apply(pageData, _toConsumableArray(getRawData(target)));
|
3190
|
+
};
|
3191
|
+
var handlePaginationChange = function handlePaginationChange() {
|
3192
|
+
pagination = resolvePaginationOption(props.pagination, pagination);
|
3193
|
+
resolveLocalPagination();
|
3194
|
+
resetStartEndIndex();
|
3195
|
+
resolvePageData();
|
3196
|
+
};
|
3197
|
+
handlePaginationChange();
|
3198
|
+
(0,external_vue_namespaceObject.watch)(function () {
|
3199
|
+
return [props.pagination];
|
3200
|
+
}, function () {
|
3201
|
+
handlePaginationChange();
|
3202
|
+
}, {
|
3203
|
+
deep: true
|
3204
|
+
});
|
3205
|
+
return {
|
3206
|
+
pageData: pageData,
|
3207
|
+
indexData: indexData,
|
3208
|
+
localPagination: localPagination,
|
3209
|
+
resolvePageData: resolvePageData,
|
3210
|
+
resolveIndexData: resolveIndexData,
|
3211
|
+
resolvePageDataBySortList: resolvePageDataBySortList,
|
3212
|
+
resetStartEndIndex: resetStartEndIndex,
|
3213
|
+
multiFilter: multiFilter,
|
3214
|
+
sort: sort
|
3215
|
+
};
|
3216
|
+
});
|
3206
3217
|
;// CONCATENATED MODULE: ../../packages/table/src/use-attributes.ts
|
3207
3218
|
|
3208
3219
|
|
@@ -3590,7 +3601,7 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
3590
3601
|
if (typeof item === 'string') {
|
3591
3602
|
return getRowValue(row, item) === item;
|
3592
3603
|
}
|
3593
|
-
return item === row;
|
3604
|
+
return getRawData(item) === getRawData(row);
|
3594
3605
|
});
|
3595
3606
|
}
|
3596
3607
|
return false;
|
@@ -3616,7 +3627,8 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
3616
3627
|
(_formatData$data = formatData.data).push.apply(_formatData$data, _toConsumableArray(data));
|
3617
3628
|
var hasSelectedRow = false;
|
3618
3629
|
var hasUnSelectedRow = false;
|
3619
|
-
(data || []).forEach(function (
|
3630
|
+
(data || []).forEach(function (item, index) {
|
3631
|
+
var row = getRawData(item);
|
3620
3632
|
var rowId = getRowId(row, esm_browser_v4(), props);
|
3621
3633
|
var isSelected = isRowSelected(row);
|
3622
3634
|
if (isSelected) {
|
@@ -3657,7 +3669,8 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
3657
3669
|
* @param attrName
|
3658
3670
|
* @param attrValue
|
3659
3671
|
*/
|
3660
|
-
var setRowAttribute = function setRowAttribute(
|
3672
|
+
var setRowAttribute = function setRowAttribute(item, attrName, attrValue) {
|
3673
|
+
var row = getRawData(item);
|
3661
3674
|
var target = formatData.dataSchema.get(row);
|
3662
3675
|
if (target && Object.prototype.hasOwnProperty.call(target, attrName)) {
|
3663
3676
|
target[attrName] = attrValue;
|
@@ -3698,8 +3711,9 @@ function use_attributes_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
3698
3711
|
var setRowExpand = function setRowExpand(row, isExpand) {
|
3699
3712
|
setRowAttribute(row, TABLE_ROW_ATTRIBUTE.ROW_EXPAND, isExpand);
|
3700
3713
|
};
|
3701
|
-
var getRowAttribute = function getRowAttribute(
|
3714
|
+
var getRowAttribute = function getRowAttribute(item, attrName) {
|
3702
3715
|
var _formatData$dataSchem6;
|
3716
|
+
var row = getRawData(item);
|
3703
3717
|
return (_formatData$dataSchem6 = formatData.dataSchema.get(row)) === null || _formatData$dataSchem6 === void 0 ? void 0 : _formatData$dataSchem6[attrName];
|
3704
3718
|
};
|
3705
3719
|
var toggleRowSelection = function toggleRowSelection(row) {
|
@@ -4990,6 +5004,30 @@ function _isSlot(s) {
|
|
4990
5004
|
if (!props.rowDraggable) {
|
4991
5005
|
return {};
|
4992
5006
|
}
|
5007
|
+
var placeDiv = document.createElement('div');
|
5008
|
+
placeDiv.style.setProperty('height', '20px');
|
5009
|
+
placeDiv.style.setProperty('width', '100%');
|
5010
|
+
placeDiv.style.setProperty('background', '#E2EDFF');
|
5011
|
+
placeDiv.style.setProperty('cursor', 'move');
|
5012
|
+
['dragenter', 'dragover'].forEach(function (type) {
|
5013
|
+
placeDiv.addEventListener(type, function (event) {
|
5014
|
+
event.preventDefault();
|
5015
|
+
event.stopPropagation();
|
5016
|
+
event.dataTransfer.dropEffect = 'move';
|
5017
|
+
});
|
5018
|
+
});
|
5019
|
+
var lastDragRow = null;
|
5020
|
+
var insertPlaceDiv = function insertPlaceDiv(target, placement) {
|
5021
|
+
if (placement === '--top') {
|
5022
|
+
target.parentNode.insertBefore(placeDiv, target);
|
5023
|
+
return;
|
5024
|
+
}
|
5025
|
+
if (target.nextElementSibling === null) {
|
5026
|
+
target.parentNode.appendChild(placeDiv);
|
5027
|
+
return;
|
5028
|
+
}
|
5029
|
+
target.parentNode.insertBefore(placeDiv, target.nextElementSibling);
|
5030
|
+
};
|
4993
5031
|
var beforeEventFire = function beforeEventFire(fn) {
|
4994
5032
|
if (props.rowDraggable) {
|
4995
5033
|
fn === null || fn === void 0 || fn();
|
@@ -5003,9 +5041,10 @@ function _isSlot(s) {
|
|
5003
5041
|
var _target$getBoundingCl = target.getBoundingClientRect(),
|
5004
5042
|
top = _target$getBoundingCl.top,
|
5005
5043
|
bottom = _target$getBoundingCl.bottom;
|
5006
|
-
var
|
5044
|
+
var placement = y - top > bottom - y ? '--bottom' : '--top';
|
5007
5045
|
removeDragClass(target);
|
5008
|
-
target.classList.add(
|
5046
|
+
target.classList.add(placement);
|
5047
|
+
insertPlaceDiv(target, placement);
|
5009
5048
|
};
|
5010
5049
|
var removeDragClass = function removeDragClass(target) {
|
5011
5050
|
var classList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['--bottom', '--top'];
|
@@ -5016,19 +5055,25 @@ function _isSlot(s) {
|
|
5016
5055
|
var onDragstart = function onDragstart(event) {
|
5017
5056
|
beforeEventFire(function () {
|
5018
5057
|
var target = getTargetRow(event);
|
5058
|
+
placeDiv.style.setProperty('height', "".concat(target.offsetHeight, "px"));
|
5059
|
+
placeDiv.style.setProperty('width', "".concat(target.offsetWidth, "px"));
|
5019
5060
|
target.classList.add('--drag-start');
|
5061
|
+
event.dataTransfer.setDragImage(target, 0, 0);
|
5020
5062
|
event.dataTransfer.setData('text/plain', null);
|
5021
|
-
event.dataTransfer.dropEffect = '
|
5063
|
+
event.dataTransfer.dropEffect = 'move';
|
5022
5064
|
var rowIndex = event.target.dataset.rowIndex;
|
5023
5065
|
event.dataTransfer.setData('data-row-index', rowIndex);
|
5024
5066
|
});
|
5025
5067
|
};
|
5026
5068
|
var onDragenter = function onDragenter(event) {
|
5069
|
+
var target = getTargetRow(event);
|
5070
|
+
event.preventDefault();
|
5071
|
+
event.stopPropagation();
|
5027
5072
|
beforeEventFire(function () {
|
5028
5073
|
event.dataTransfer.dropEffect = 'move';
|
5029
|
-
var target = getTargetRow(event);
|
5030
5074
|
target.classList.add('--drag-enter');
|
5031
5075
|
setTargetRowPlacement(target, event);
|
5076
|
+
lastDragRow = target;
|
5032
5077
|
});
|
5033
5078
|
};
|
5034
5079
|
var onDragleave = function onDragleave(event) {
|
@@ -5039,22 +5084,29 @@ function _isSlot(s) {
|
|
5039
5084
|
};
|
5040
5085
|
var onDragover = function onDragover(event) {
|
5041
5086
|
event.preventDefault();
|
5087
|
+
event.stopPropagation();
|
5042
5088
|
event.dataTransfer.dropEffect = 'move';
|
5043
5089
|
var target = getTargetRow(event);
|
5044
5090
|
setTargetRowPlacement(target, event);
|
5045
5091
|
};
|
5046
|
-
var
|
5092
|
+
var onDragend = function onDragend(event) {
|
5093
|
+
var _event$target$dataset;
|
5047
5094
|
event.preventDefault();
|
5048
5095
|
event.stopPropagation();
|
5049
|
-
|
5096
|
+
placeDiv.remove();
|
5097
|
+
if (!lastDragRow) {
|
5098
|
+
return;
|
5099
|
+
}
|
5100
|
+
var target = lastDragRow;
|
5050
5101
|
var rowIndex = target.dataset.rowIndex;
|
5051
5102
|
var targetIndex = Number(rowIndex);
|
5052
|
-
var sourceIndex = event.
|
5103
|
+
var sourceIndex = (_event$target$dataset = event.target.dataset) === null || _event$target$dataset === void 0 ? void 0 : _event$target$dataset.rowIndex;
|
5053
5104
|
if (target.classList.contains('--bottom')) {
|
5054
5105
|
targetIndex = targetIndex + 1;
|
5055
5106
|
}
|
5056
5107
|
resp.changePageRowIndex(Number(sourceIndex), targetIndex);
|
5057
5108
|
removeDragClass(target, ['--drag-enter', '--bottom', '--top']);
|
5109
|
+
lastDragRow = null;
|
5058
5110
|
ctx.emit(EMIT_EVENTS.DRAG_END, {
|
5059
5111
|
sourceEvent: event,
|
5060
5112
|
data: resp.pageData
|
@@ -5065,9 +5117,13 @@ function _isSlot(s) {
|
|
5065
5117
|
onDragleave: onDragleave,
|
5066
5118
|
onDragstart: onDragstart,
|
5067
5119
|
onDragover: onDragover,
|
5068
|
-
|
5120
|
+
onDragend: onDragend
|
5069
5121
|
};
|
5070
5122
|
});
|
5123
|
+
;// CONCATENATED MODULE: external "../input"
|
5124
|
+
var external_input_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
5125
|
+
var external_input_y = x => () => x
|
5126
|
+
const external_input_namespaceObject = external_input_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE__input_752b0149__["default"] });
|
5071
5127
|
;// CONCATENATED MODULE: ../../packages/table/src/plugins/head-filter.tsx
|
5072
5128
|
|
5073
5129
|
|
@@ -5108,6 +5164,7 @@ function _isSlot(s) {
|
|
5108
5164
|
|
5109
5165
|
|
5110
5166
|
|
5167
|
+
|
5111
5168
|
function head_filter_isSlot(s) {
|
5112
5169
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !(0,external_vue_namespaceObject.isVNode)(s);
|
5113
5170
|
}
|
@@ -5348,7 +5405,7 @@ function head_filter_isSlot(s) {
|
|
5348
5405
|
"class": headFilterContentClass
|
5349
5406
|
}, [(0,external_vue_namespaceObject.createVNode)("div", {
|
5350
5407
|
"style": "padding: 4px 10px;"
|
5351
|
-
}, [(0,external_vue_namespaceObject.createVNode)(
|
5408
|
+
}, [(0,external_vue_namespaceObject.createVNode)(external_input_namespaceObject["default"], {
|
5352
5409
|
"modelValue": searchValue.value,
|
5353
5410
|
"onUpdate:modelValue": function onUpdateModelValue($event) {
|
5354
5411
|
return searchValue.value = $event;
|
@@ -6,12 +6,12 @@ declare const _default: (props: TablePropTypes, resp: ITableResponse, ctx: Setup
|
|
6
6
|
onDragleave?: undefined;
|
7
7
|
onDragstart?: undefined;
|
8
8
|
onDragover?: undefined;
|
9
|
-
|
9
|
+
onDragend?: undefined;
|
10
10
|
} | {
|
11
11
|
onDragenter: (event: DragEvent) => void;
|
12
12
|
onDragleave: (event: DragEvent) => void;
|
13
13
|
onDragstart: (event: DragEvent) => void;
|
14
14
|
onDragover: (event: DragEvent) => void;
|
15
|
-
|
15
|
+
onDragend: (event: DragEvent) => void;
|
16
16
|
};
|
17
17
|
export default _default;
|
package/lib/table/table.css
CHANGED
@@ -1285,17 +1285,9 @@
|
|
1285
1285
|
.bk-table .bk-table-body table tbody tr:hover.hover-highlight td:not(.empty-cell) {
|
1286
1286
|
background: #f5f7fa;
|
1287
1287
|
}
|
1288
|
-
.bk-table .bk-table-head table tbody tr.--drag-
|
1289
|
-
.bk-table .bk-table-body table tbody tr.--drag-
|
1290
|
-
|
1291
|
-
}
|
1292
|
-
.bk-table .bk-table-head table tbody tr.--drag-enter.--top,
|
1293
|
-
.bk-table .bk-table-body table tbody tr.--drag-enter.--top {
|
1294
|
-
border-top: solid 1px #3785ff;
|
1295
|
-
}
|
1296
|
-
.bk-table .bk-table-head table tbody tr.--drag-start,
|
1297
|
-
.bk-table .bk-table-body table tbody tr.--drag-start {
|
1298
|
-
background: #fff;
|
1288
|
+
.bk-table .bk-table-head table tbody tr.--drag-start td,
|
1289
|
+
.bk-table .bk-table-body table tbody tr.--drag-start td {
|
1290
|
+
background: #fff !important;
|
1299
1291
|
}
|
1300
1292
|
.bk-table .bk-table-head {
|
1301
1293
|
position: relative;
|