@kdcloudjs/table 1.1.3 → 1.1.4-canary.1
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/@kdcloudjs/table.css +1 -1
- package/dist/@kdcloudjs/table.js +599 -268
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +10 -9
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/es/table/base/html-table.js +1 -1
- package/es/table/base/styles.d.ts +7 -2
- package/es/table/base/styles.js +13 -6
- package/es/table/base/table.d.ts +2 -0
- package/es/table/base/table.js +31 -53
- package/es/table/base/utils.d.ts +7 -0
- package/es/table/base/utils.js +29 -1
- package/es/table/pipeline/features/columnDrag.js +21 -11
- package/es/table/pipeline/features/columnFilter.d.ts +2 -2
- package/es/table/pipeline/features/columnFilter.js +35 -15
- package/es/table/pipeline/features/columnResizeWidth.js +1 -1
- package/es/table/pipeline/features/filter/DefaultFilterContent.js +22 -2
- package/es/table/pipeline/features/filter/DefaultFilterIcon.d.ts +5 -0
- package/es/table/pipeline/features/filter/DefaultFilterIcon.js +20 -0
- package/es/table/pipeline/features/filter/Filter.d.ts +1 -1
- package/es/table/pipeline/features/filter/Filter.js +16 -20
- package/es/table/pipeline/features/filter/FilterPanel.js +21 -15
- package/es/table/pipeline/features/filter/util.js +4 -4
- package/es/table/pipeline/features/footerDataSource.d.ts +9 -0
- package/es/table/pipeline/features/footerDataSource.js +25 -0
- package/es/table/pipeline/features/index.d.ts +1 -0
- package/es/table/pipeline/features/index.js +2 -1
- package/es/table/pipeline/features/multiSelect.js +7 -2
- package/es/table/pipeline/features/rangeSelection.d.ts +1 -1
- package/es/table/pipeline/features/rangeSelection.js +156 -28
- package/es/table/pipeline/features/singleSelect.js +4 -0
- package/es/table/pipeline/features/treeMode.d.ts +2 -0
- package/es/table/pipeline/features/treeMode.js +18 -20
- package/es/table/pipeline/pipeline.d.ts +5 -1
- package/es/table/pipeline/pipeline.js +12 -11
- package/es/table/utils/keyCode.d.ts +4 -0
- package/es/table/utils/keyCode.js +4 -0
- package/es/table/utils/mergeCellProps.js +2 -6
- package/lib/table/base/html-table.js +1 -1
- package/lib/table/base/styles.d.ts +7 -2
- package/lib/table/base/styles.js +13 -6
- package/lib/table/base/table.d.ts +2 -0
- package/lib/table/base/table.js +31 -53
- package/lib/table/base/utils.d.ts +7 -0
- package/lib/table/base/utils.js +35 -1
- package/lib/table/pipeline/features/columnDrag.js +21 -11
- package/lib/table/pipeline/features/columnFilter.d.ts +2 -2
- package/lib/table/pipeline/features/columnFilter.js +33 -15
- package/lib/table/pipeline/features/columnResizeWidth.js +1 -1
- package/lib/table/pipeline/features/filter/DefaultFilterContent.js +23 -1
- package/lib/table/pipeline/features/filter/DefaultFilterIcon.d.ts +5 -0
- package/lib/table/pipeline/features/filter/DefaultFilterIcon.js +30 -0
- package/lib/table/pipeline/features/filter/Filter.d.ts +1 -1
- package/lib/table/pipeline/features/filter/Filter.js +17 -20
- package/lib/table/pipeline/features/filter/FilterPanel.js +21 -14
- package/lib/table/pipeline/features/filter/util.js +4 -4
- package/lib/table/pipeline/features/footerDataSource.d.ts +9 -0
- package/lib/table/pipeline/features/footerDataSource.js +41 -0
- package/lib/table/pipeline/features/index.d.ts +1 -0
- package/lib/table/pipeline/features/index.js +15 -1
- package/lib/table/pipeline/features/multiSelect.js +6 -1
- package/lib/table/pipeline/features/rangeSelection.d.ts +1 -1
- package/lib/table/pipeline/features/rangeSelection.js +158 -30
- package/lib/table/pipeline/features/singleSelect.js +4 -0
- package/lib/table/pipeline/features/treeMode.d.ts +2 -0
- package/lib/table/pipeline/features/treeMode.js +19 -22
- package/lib/table/pipeline/pipeline.d.ts +5 -1
- package/lib/table/pipeline/pipeline.js +13 -11
- package/lib/table/utils/keyCode.d.ts +4 -0
- package/lib/table/utils/keyCode.js +11 -0
- package/lib/table/utils/mergeCellProps.js +2 -6
- package/package.json +3 -3
|
@@ -124,7 +124,7 @@ export function HtmlTable(_ref) {
|
|
|
124
124
|
positionStyle.left = hozInfo.stickyLeftMap.get(colIndex);
|
|
125
125
|
} else if (colIndex >= fullFlatCount - rightFlatCount) {
|
|
126
126
|
positionStyle.position = 'sticky';
|
|
127
|
-
positionStyle.right = hozInfo.stickyRightMap.get(colIndex) - stickyRightOffset;
|
|
127
|
+
positionStyle.right = hozInfo.stickyRightMap.get(colIndex) - (typeof stickyRightOffset === 'number' ? stickyRightOffset : 0);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
return /*#__PURE__*/React.createElement('td', _extends(_extends(_extends(_extends({
|
|
@@ -2,6 +2,7 @@ export declare const LOCK_SHADOW_PADDING = 20;
|
|
|
2
2
|
export declare const Classes: {
|
|
3
3
|
/** BaseTable 表格组件的外层包裹 div */
|
|
4
4
|
readonly artTableWrapper: string;
|
|
5
|
+
readonly artTableBordered: string;
|
|
5
6
|
readonly artTable: string;
|
|
6
7
|
readonly tableHeaderMain: string;
|
|
7
8
|
readonly tableHeader: string;
|
|
@@ -40,6 +41,8 @@ export declare const Classes: {
|
|
|
40
41
|
readonly button: string;
|
|
41
42
|
readonly buttonPrimary: string;
|
|
42
43
|
readonly filterIcon: string;
|
|
44
|
+
readonly rangeSelection: string;
|
|
45
|
+
readonly tableCellRangeSingleCell: string;
|
|
43
46
|
readonly tableCellRangeSelected: string;
|
|
44
47
|
readonly tableCellRangeTop: string;
|
|
45
48
|
readonly tableCellRangeLeft: string;
|
|
@@ -112,13 +115,13 @@ export declare type BaseTableCSSVariables = Partial<{
|
|
|
112
115
|
'--border-color': string;
|
|
113
116
|
/** 单元格边框,默认为 1px solid #dfe3e8 */
|
|
114
117
|
'--cell-border': string;
|
|
115
|
-
/** 单元格上下边框,默认为 #dfe3e8 */
|
|
118
|
+
/** 单元格上下边框,默认为 none ,默认值为 1px solid #dfe3e8 */
|
|
116
119
|
'--cell-border-horizontal': string;
|
|
117
120
|
/** 单元格左右边框,默认为 #dfe3e8 */
|
|
118
121
|
'--cell-border-vertical': string;
|
|
119
122
|
/** 表头单元格边框,默认为 1px solid #dfe3e8 */
|
|
120
123
|
'--header-cell-border': string;
|
|
121
|
-
/** 表头单元格上下边框,默认为 1px solid #dfe3e8 */
|
|
124
|
+
/** 表头单元格上下边框,默认为 none ,默认值为 1px solid #dfe3e8 */
|
|
122
125
|
'--header-cell-border-horizontal': string;
|
|
123
126
|
/** 表头单元格左右边框,默认为 1px solid #dfe3e8 */
|
|
124
127
|
'--header-cell-border-vertical': string;
|
|
@@ -148,7 +151,9 @@ export declare const defaultCSSVariables: {
|
|
|
148
151
|
'--cell-border-horizontal': string;
|
|
149
152
|
'---cell-border-vertical': string;
|
|
150
153
|
'--header-cell-border': string;
|
|
154
|
+
'--cell-border-vertical': string;
|
|
151
155
|
'--header-cell-border-horizontal': string;
|
|
156
|
+
'--header-cell-border-vertical': string;
|
|
152
157
|
};
|
|
153
158
|
export declare const variableConst: string;
|
|
154
159
|
export declare const StyledArtTableWrapper: any;
|
package/es/table/base/styles.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime-corejs3/helpers/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
4
4
|
|
|
5
5
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
6
6
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
@@ -10,6 +10,7 @@ var prefix = 'kd-';
|
|
|
10
10
|
export var Classes = {
|
|
11
11
|
/** BaseTable 表格组件的外层包裹 div */
|
|
12
12
|
artTableWrapper: "".concat(prefix, "table-wrapper"),
|
|
13
|
+
artTableBordered: "".concat(prefix, "table-bordered"),
|
|
13
14
|
artTable: "".concat(prefix, "table"),
|
|
14
15
|
tableHeaderMain: "".concat(prefix, "table-header-main"),
|
|
15
16
|
tableHeader: "".concat(prefix, "table-header"),
|
|
@@ -53,6 +54,8 @@ export var Classes = {
|
|
|
53
54
|
button: "".concat(prefix, "btn"),
|
|
54
55
|
buttonPrimary: "".concat(prefix, "btn-primary"),
|
|
55
56
|
filterIcon: "".concat(prefix, "filter-icon"),
|
|
57
|
+
rangeSelection: "".concat(prefix, "range-selection"),
|
|
58
|
+
tableCellRangeSingleCell: "".concat(prefix, "table-cell-range-single-cell"),
|
|
56
59
|
tableCellRangeSelected: "".concat(prefix, "table-cell-range-selected"),
|
|
57
60
|
tableCellRangeTop: "".concat(prefix, "table-cell-range-top"),
|
|
58
61
|
tableCellRangeLeft: "".concat(prefix, "table-cell-range-left"),
|
|
@@ -91,7 +94,7 @@ var Z = {
|
|
|
91
94
|
scrollItem: 30,
|
|
92
95
|
loadingIndicator: 40
|
|
93
96
|
};
|
|
94
|
-
var outerBorderStyleMixin = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-top: 1px solid #cccccc;\n border-right: 1px solid #cccccc;\n border-bottom: 1px solid #cccccc;\n border-left: 1px solid #cccccc;\n\n td.", ",\n th.", " {\n border-left: none;\n }\n td.", ",\n th.", " {\n
|
|
97
|
+
var outerBorderStyleMixin = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-top: 1px solid #cccccc;\n border-right: 1px solid #cccccc;\n border-bottom: 1px solid #cccccc;\n border-left: 1px solid #cccccc;\n\n td.", ",\n th.", " {\n border-left: none;\n }\n td.", ",\n th.", " {\n border-right: none;\n }\n\n thead tr.", " th,\n tbody tr.", " td {\n border-top: none;\n }\n &.has-footer tfoot tr.", " td {\n border-bottom: none;\n }\n &:not(.has-footer) tbody tr.", " td {\n border-bottom: none;\n }\n td.", ":not(.", "){\n border-left: var(---cell-border-vertical);\n }\n td.", ":not(.", "){\n border-right: var(---cell-border-vertical);\n }\n"])), Classes.first, Classes.first, Classes.last, Classes.last, Classes.first, Classes.first, Classes.last, Classes.last, Classes.rowSpan, Classes.first, Classes.rowSpan, Classes.last);
|
|
95
98
|
export var defaultCSSVariables = {
|
|
96
99
|
'--row-height': '48px',
|
|
97
100
|
'--color': '#333',
|
|
@@ -101,7 +104,7 @@ export var defaultCSSVariables = {
|
|
|
101
104
|
'--primary-color': '#5582F3',
|
|
102
105
|
'--primary-color-level1': 'rgb(242, 248, 255)',
|
|
103
106
|
'--primary-color-level2': 'rgb(135, 173, 255)',
|
|
104
|
-
'--icon-color': '#
|
|
107
|
+
'--icon-color': '#666666',
|
|
105
108
|
'--strong-border-color': '#d9d9d9',
|
|
106
109
|
'--header-row-height': '32px',
|
|
107
110
|
'--header-color': '#333',
|
|
@@ -117,11 +120,15 @@ export var defaultCSSVariables = {
|
|
|
117
120
|
'--cell-border-horizontal': '1px solid #dfe3e8',
|
|
118
121
|
'---cell-border-vertical': '1px solid #dfe3e8',
|
|
119
122
|
'--header-cell-border': '1px solid #dfe3e8',
|
|
120
|
-
'--
|
|
123
|
+
'--cell-border-vertical': '1px solid #dfe3e8',
|
|
124
|
+
'--header-cell-border-horizontal': '1px solid #dfe3e8',
|
|
125
|
+
'--header-cell-border-vertical': '1px solid #dfe3e8'
|
|
121
126
|
};
|
|
122
127
|
export var variableConst = getCssVariableText(defaultCSSVariables);
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
var notBorderedStyleMixin = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n --cell-border-vertical: none;\n --header-cell-border-vertical: none;\n"])));
|
|
129
|
+
var borderedStyleMixin = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n //th\u9690\u85CF\u5217\u5BBD\u62D6\u62FD\u7684\u80CC\u666F\u8272\uFF0C\u4F7F\u7528th\u7684\u53F3\u8FB9\u6846\u4EE3\u66FF\n .", "::after{\n background-color: inherit;\n }\n"])), Classes.tableHeaderCellResize);
|
|
130
|
+
export var StyledArtTableWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n :root {\n ", "\n }\n ", "\n\n box-sizing: border-box;\n * {\n box-sizing: border-box;\n }\n cursor: default;\n color: var(--color);\n font-size: var(--font-size);\n line-height: var(--line-height);\n position: relative;\n\n // \u8868\u683C\u5916\u8FB9\u6846\u7531 art-table-wrapper \u63D0\u4F9B\uFF0C\u800C\u4E0D\u662F\u7531\u5355\u5143\u683C\u63D0\u4F9B\n &.use-outer-border {\n ", ";\n }\n\n // \u8868\u683C\u4E0D\u542F\u7528\u8FB9\u6846\u7EBF\uFF0C\u9690\u85CFth\u3001td\u7684\u5355\u5143\u683C\u5DE6\u53F3\u8FB9\u6846\u7EBF\n &:not(.", ") {\n ", "\n }\n &.", "{\n ", "\n }\n\n .no-scrollbar {\n ::-webkit-scrollbar {\n display: none;\n }\n }\n\n .", " {\n overflow: auto;\n flex-shrink: 1;\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n }\n\n .", " {\n overflow: hidden;\n background: var(--header-bgcolor);\n display: flex;\n flex-shrink: 0;\n border-bottom: var(--header-cell-border-horizontal);\n }\n\n .", " {\n display: flex;\n // justify-content: flex-start;\n align-items: center;\n height: inherit;\n }\n\n .", " {\n overflow-x:auto;\n flex-shrink: 0;\n flex-grow: 0;\n scrollbar-width: none; // \u517C\u5BB9\u706B\u72D0\n & {\n ::-webkit-scrollbar {\n display:none;\n }\n }\n }\n\n .", " {\n display: flex;\n flex: none;\n }\n .", ", .", " {\n background: var(--bgcolor);\n overflow: auto;\n overflow-x: hidden;\n overflow-anchor: none;\n position:relative;\n &.empty {\n position: relative;\n }\n }\n\n .", " {\n position: relative;\n }\n .", ", .", " {\n .", "{\n background-color: #e6effb !important;\n }\n .", "{\n border-top: 1px solid #0E5FD8 !important;\n }\n .", "{\n border-left: 1px solid #0E5FD8 !important;\n }\n .", "{\n border-bottom: 1px solid #0E5FD8 !important;\n }\n .", "{\n border-right: 1px solid #0E5FD8 !important;\n }\n }\n \n .", " {\n user-select:none;\n }\n\n\n &.sticky-header .", " {\n position: sticky;\n top: 0;\n z-index: ", ";\n }\n\n &.sticky-footer .", " {\n position: sticky;\n bottom: 0;\n z-index: ", ";\n }\n\n table {\n width: 0;\n table-layout: fixed;\n border-collapse: separate;\n border-spacing: 0;\n display: table;\n margin: 0;\n padding: 0;\n flex-shrink: 0;\n flex-grow: 0;\n position:relative;\n }\n\n // \u5728 tr \u4E0A\u8BBE\u7F6E .no-hover \u53EF\u4EE5\u7981\u7528\u9F20\u6807\u60AC\u505C\u6548\u679C\n tr:not(.no-hover):hover > td {\n background: var(--hover-bgcolor);\n }\n // \u4F7F\u7528 js \u6DFB\u52A0\u60AC\u6D6E\u6548\u679C\n tr:not(.no-hover).row-hover > td {\n background: var(--hover-bgcolor);\n }\n // \u5728 tr \u8BBE\u7F6E highlight \u53EF\u4EE5\u4E3A\u5E95\u4E0B\u7684 td \u8BBE\u7F6E\u4E3A\u9AD8\u4EAE\u8272\n // \u800C\u8BBE\u7F6E .no-highlight \u7684\u8BDD\u5219\u53EF\u4EE5\u7981\u7528\u9AD8\u4EAE\u6548\u679C\uFF1B\n tr:not(.no-highlight).highlight > td {\n background: var(--highlight-bgcolor);\n }\n\n th {\n font-weight: normal;\n text-align: left;\n padding: var(--cell-padding);\n height: var(--header-row-height);\n color: var(--header-color);\n background: var(--header-bgcolor);\n border:1px solid transparent;\n border-right: var(--header-cell-border-vertical);\n border-bottom: var(--header-cell-border-horizontal);\n position: relative;\n }\n\n th.resizeable{\n border-right: var(--header-cell-border-vertical)\n }\n\n th.", " {\n border-right: var(--header-cell-border-vertical);\n border-bottom: none;\n }\n\n tr.", " th {\n border-top: var(--header-cell-border-horizontal);\n }\n th.", " {\n border-left: var(--header-cell-border-vertical);\n }\n\n td {\n padding: var(--cell-padding);\n background: var(--bgcolor);\n height: var(--row-height);\n border:1px solid transparent;\n border-right: var(--cell-border-vertical);\n border-bottom: var(--cell-border-horizontal);\n word-break: break-all;\n }\n td.", " {\n border-left: var(--cell-border-vertical);\n }\n tr.", " td {\n border-top: var(--cell-border-horizontal);\n }\n &.has-header tbody tr.", " td {\n border-top: none;\n }\n &.has-footer tbody tr.", " td {\n border-bottom: none;\n }\n\n .", ",\n .", " {\n z-index: ", ";\n }\n\n //#region \u9501\u5217\u9634\u5F71\n .", " {\n position: absolute;\n top: 0;\n bottom: 0;\n z-index: ", ";\n pointer-events: none;\n overflow: hidden;\n\n .", " {\n height: 100%;\n }\n\n .", " {\n margin-right: ", "px;\n box-shadow: none;\n\n &.show-shadow {\n box-shadow: var(--lock-shadow);\n border-right: var(--cell-border-vertical);\n }\n }\n\n .", " {\n margin-left: ", "px;\n box-shadow: none;\n\n &.show-shadow {\n box-shadow: var(--lock-shadow);\n border-left: var(--cell-border-vertical);\n }\n }\n }\n //#endregion\n\n //#region \u7A7A\u8868\u683C\u5C55\u73B0\n .", " {\n pointer-events: none;\n color: #99a3b3;\n font-size: 12px;\n text-align: center;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n\n .empty-image {\n width: 50px;\n height: 50px;\n }\n\n .empty-tips {\n margin-top: 16px;\n line-height: 1.5;\n }\n }\n //#endregion\n\n //#region IE\u517C\u5BB9\n &.ie-polyfill-wrapper {\n //\u9501\u5B9A\u5217\u517C\u5BB9 \u4EC5\u5728\u9501\u5B9A\u5217\u7684\u60C5\u51B5\u4E0B\u751F\u6548\n .", " {\n overflow-x: hidden;\n }\n .", ", .", " {\n position:relative;\n }\n .", " {\n overflow: hidden;\n }\n .", " {\n position: relative;\n }\n\n .", " {\n overflow: auto;\n overflow-x: hidden;\n overflow-anchor: none;\n }\n\n .", ", .", "{\n position: absolute;\n z-index: ", ";\n top: 0;\n }\n .", "{\n left:0;\n }\n .", "{\n right:0;\n }\n\n .", "{\n .", "{\n position: absolute;\n top: 0;\n width: 100%;\n z-index: ", ";\n }\n }\n\n tr:not(.no-hover).row-hover > td {\n background: var(--hover-bgcolor);\n }\n }\n //#endregion\n\n //#region \u7C98\u6027\u6EDA\u52A8\u6761\n .", " {\n overflow-y: hidden;\n overflow-x: auto;\n z-index: ", ";\n flex-shrink: 0;\n flex-grow: 0;\n border-top: 1px solid var(--border-color);\n background: var(--bgcolor);\n }\n\n .", " {\n // \u5FC5\u987B\u6709\u9AD8\u5EA6\u624D\u80FD\u51FA\u73B0\u6EDA\u52A8\u6761\n height: 1px;\n visibility: hidden;\n }\n //#endregion\n\n //#region \u52A0\u8F7D\u6837\u5F0F\n .", " {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: auto;\n\n .", " {\n filter: none;\n width: 100%;\n height: 100%;\n overflow: hidden;//\u5217\u5168\u90E8\u56FA\u5B9A\u65F6\uFF0C\u5B58\u5728\u53CC\u6A2A\u5411\u6EDA\u52A8\u6761\n display: flex;\n position: relative;\n flex-direction: column;\n }\n\n .", " {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n pointer-events: none;\n }\n\n .", " {\n position: sticky;\n z-index: ", ";\n transform: translateY(-50%);\n }\n }\n //#endregion\n\n //#region \u8868\u683C\u8FC7\u6EE4\n .", " {\n color:var(--icon-color);\n &.active{\n color:var(--primary-color);\n }\n padding: 6px 4px;\n &:hover{\n background-color: #e5e5e5;\n }\n }\n .", " {\n display: flex\n }\n //#endregion\n\n //#region \u8868\u683C\u6392\u5E8F\n .", " {\n color:var(--icon-color);\n &.active{\n color:var(--primary-color);\n }\n }\n //#endregion\n\n //#region \u6EDA\u52A8\u6761\u5360\u4F4D\n .", " {\n visibility: hidden;\n flex-shrink: 0;\n }\n .", " .", " {\n border-top: var(--cell-border-horizontal);\n }\n //#endregion\n \n //#region \u62D6\u62FD\u5217\u5BBD\u5927\u5C0F\n .", "::after{\n background-color: var(--border-color);\n }\n //#endregion\n\n "])), variableConst, variableConst, outerBorderStyleMixin, Classes.artTableBordered, notBorderedStyleMixin, Classes.artTableBordered, borderedStyleMixin, Classes.artTable, Classes.tableHeader, Classes.tableHeaderCellContent, Classes.virtual, Classes.tableFooter, Classes.tableBody, Classes.tableFooter, Classes.tableRow, Classes.tableBody, Classes.tableFooter, Classes.tableCellRangeSelected, Classes.tableCellRangeTop, Classes.tableCellRangeLeft, Classes.tableCellRangeBottom, Classes.tableCellRangeRight, Classes.rangeSelection, Classes.tableHeader, Z.header, Classes.tableFooter, Z.footer, Classes.leaf, Classes.first, Classes.first, Classes.first, Classes.first, Classes.first, Classes.last, Classes.lockLeft, Classes.lockRight, Z.lock, Classes.lockShadowMask, Z.lockShadow, Classes.lockShadow, Classes.leftLockShadow, LOCK_SHADOW_PADDING, Classes.rightLockShadow, LOCK_SHADOW_PADDING, Classes.emptyWrapper, Classes.virtual, Classes.tableBody, Classes.tableFooter, Classes.tableHeaderMain, Classes.tableHeader, Classes.tableFooterMain, Classes.fixedLeft, Classes.fixedRight, Z.lock, Classes.fixedLeft, Classes.fixedRight, Classes.rowDetailContainer, Classes.rowDetailItem, Z.rowDetail, Classes.stickyScroll, Z.scrollItem, Classes.stickyScrollItem, Classes.loadingWrapper, Classes.loadingContentWrapper, Classes.loadingIndicatorWrapper, Classes.loadingIndicator, Z.loadingIndicator, Classes.tableFilterTrigger, Classes.filterIcon, Classes.tableSortIcon, Classes.verticalScrollPlaceholder, Classes.tableFooter, Classes.verticalScrollPlaceholder, Classes.tableHeaderCellResize);
|
|
131
|
+
export var ButtonCSS = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n ", "\n //#region \u6309\u94AE\n .", "{\n color: var(--color);\n background:#ffffff;\n border:1px solid var(--strong-border-color);\n border-radius: 2px;\n cursor: pointer;\n &:hover{\n color: var(--primary-color);\n border:1px solid var(--primary-color);\n }\n }\n .", " {\n color:#ffffff;\n background-color: var(--primary-color);\n border:none;\n &:hover{\n color:#ffffff;\n background-color: var(--primary-color-level2);\n border:none;\n }\n }\n//#endregion\n"])), variableConst, Classes.button, Classes.buttonPrimary);
|
|
125
132
|
|
|
126
133
|
function getCssVariableText(obj) {
|
|
127
134
|
return _Object$keys(obj).reduce(function (acc, key) {
|
package/es/table/base/table.d.ts
CHANGED
package/es/table/base/table.js
CHANGED
|
@@ -3,13 +3,13 @@ import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
|
3
3
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
4
4
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
5
5
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
6
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
6
7
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
7
8
|
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
8
9
|
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
9
10
|
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
10
11
|
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
11
12
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
12
|
-
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
13
13
|
|
|
14
14
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
15
15
|
|
|
@@ -37,37 +37,10 @@ import { getFullRenderRange, makeRowHeightManager } from './helpers/rowHeightMan
|
|
|
37
37
|
import { TableDOMHelper } from './helpers/TableDOMUtils';
|
|
38
38
|
import { HtmlTable } from './html-table';
|
|
39
39
|
import Loading from './loading';
|
|
40
|
-
import { Classes, LOCK_SHADOW_PADDING, StyledArtTableWrapper
|
|
41
|
-
import { addResizeObserver, getScrollbarSize, OVERSCAN_SIZE, shallowEqual, STYLED_REF_PROP, sum, syncScrollLeft, throttledWindowResize$, getTableScrollFooterDOM, getTableScrollHeaderDOM } from './utils';
|
|
42
|
-
import cssVars from 'css-vars-ponyfill';
|
|
40
|
+
import { Classes, LOCK_SHADOW_PADDING, StyledArtTableWrapper } from './styles';
|
|
41
|
+
import { addResizeObserver, getScrollbarSize, OVERSCAN_SIZE, shallowEqual, STYLED_REF_PROP, sum, syncScrollLeft, throttledWindowResize$, getTableScrollFooterDOM, getTableScrollHeaderDOM, cssPolifill } from './utils';
|
|
43
42
|
import { console, browserType } from '../utils';
|
|
44
43
|
import getTableRenderTemplate from './renderTemplates';
|
|
45
|
-
|
|
46
|
-
var cssPolifill = function cssPolifill(_ref) {
|
|
47
|
-
var variables = _ref.variables,
|
|
48
|
-
enableCSSVariables = _ref.enableCSSVariables;
|
|
49
|
-
|
|
50
|
-
// const style = document.createElement('style')
|
|
51
|
-
// style.type = 'text/css'
|
|
52
|
-
// style.innerHTML = '.aaa{ --color: red; }'
|
|
53
|
-
// document.getElementsByTagName('head').item(0).appendChild(style)
|
|
54
|
-
// const variableNames = variableConst.match(/--.*?(?=:)/g)
|
|
55
|
-
// variables = variableNames.map((name) => rootElement.style[name])
|
|
56
|
-
if (enableCSSVariables === false) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
cssVars({
|
|
61
|
-
// exclude: 'link[href*="semantic-ui"]',
|
|
62
|
-
// onlyLegacy: false,
|
|
63
|
-
// rootElement: rootElement,
|
|
64
|
-
include: 'style[data-styled]',
|
|
65
|
-
variables: _extends({}, defaultCSSVariables, variables),
|
|
66
|
-
watch: true,
|
|
67
|
-
silent: true
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
|
|
71
44
|
var propsDotEmptyContentDeprecatedWarned = false;
|
|
72
45
|
|
|
73
46
|
function warnPropsDotEmptyContentIsDeprecated() {
|
|
@@ -477,6 +450,8 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
477
450
|
}, {
|
|
478
451
|
key: "render",
|
|
479
452
|
value: function render() {
|
|
453
|
+
var _cx;
|
|
454
|
+
|
|
480
455
|
// console.log('render table')
|
|
481
456
|
var info = calculateRenderInfo(this);
|
|
482
457
|
this.lastInfo = info;
|
|
@@ -492,30 +467,31 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
492
467
|
isLoading = _this$props6.isLoading,
|
|
493
468
|
getTableProps = _this$props6.getTableProps,
|
|
494
469
|
footerDataSource = _this$props6.footerDataSource,
|
|
495
|
-
components = _this$props6.components
|
|
496
|
-
|
|
470
|
+
components = _this$props6.components,
|
|
471
|
+
bordered = _this$props6.bordered;
|
|
472
|
+
var artTableWrapperClassName = cx(Classes.artTableWrapper, (_cx = {
|
|
497
473
|
'use-outer-border': useOuterBorder,
|
|
498
474
|
empty: dataSource.length === 0,
|
|
499
475
|
lock: info.hasLockColumn,
|
|
500
476
|
'has-header': hasHeader,
|
|
501
477
|
'sticky-header': isStickyHeader !== null && isStickyHeader !== void 0 ? isStickyHeader : isStickyHead,
|
|
502
478
|
'has-footer': footerDataSource.length > 0,
|
|
503
|
-
'sticky-footer': isStickyFooter
|
|
504
|
-
|
|
505
|
-
}, className);
|
|
479
|
+
'sticky-footer': isStickyFooter
|
|
480
|
+
}, _defineProperty(_cx, Classes.artTableBordered, bordered), _defineProperty(_cx, 'ie-polyfill-wrapper', browserType.isIE), _cx), className);
|
|
506
481
|
|
|
507
482
|
var artTableWrapperProps = _defineProperty({
|
|
508
483
|
className: artTableWrapperClassName,
|
|
509
484
|
style: style
|
|
510
485
|
}, STYLED_REF_PROP, this.artTableWrapperRef);
|
|
511
486
|
|
|
487
|
+
var tableProps = getTableProps() || {};
|
|
512
488
|
return /*#__PURE__*/React.createElement(StyledArtTableWrapper, _extends({}, artTableWrapperProps), /*#__PURE__*/React.createElement(Loading, {
|
|
513
489
|
visible: isLoading,
|
|
514
490
|
LoadingIcon: components.LoadingIcon,
|
|
515
491
|
LoadingContentWrapper: components.LoadingContentWrapper
|
|
516
|
-
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
517
|
-
className: Classes.artTable
|
|
518
|
-
}
|
|
492
|
+
}, /*#__PURE__*/React.createElement("div", _extends({}, tableProps, {
|
|
493
|
+
className: cx(Classes.artTable, tableProps.className)
|
|
494
|
+
}), this.renderTableHeader(info), this.renderTableBody(info), this.renderTableFooter(info), this.renderLockShadows(info)), this.renderStickyScroll(info)));
|
|
519
495
|
}
|
|
520
496
|
}, {
|
|
521
497
|
key: "componentDidMount",
|
|
@@ -532,10 +508,12 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
532
508
|
|
|
533
509
|
var _this$props7 = this.props,
|
|
534
510
|
cssVariables = _this$props7.cssVariables,
|
|
535
|
-
enableCSSVariables = _this$props7.enableCSSVariables
|
|
511
|
+
enableCSSVariables = _this$props7.enableCSSVariables,
|
|
512
|
+
bordered = _this$props7.bordered;
|
|
536
513
|
cssPolifill({
|
|
537
514
|
variables: cssVariables || {},
|
|
538
|
-
enableCSSVariables: enableCSSVariables
|
|
515
|
+
enableCSSVariables: enableCSSVariables,
|
|
516
|
+
bordered: bordered
|
|
539
517
|
});
|
|
540
518
|
(_b = (_a = this.props).setTableWidth) === null || _b === void 0 ? void 0 : _b.call(_a, this.domHelper.tableBody.clientWidth);
|
|
541
519
|
(_d = (_c = this.props).setTableDomHelper) === null || _d === void 0 ? void 0 : _d.call(_c, this.domHelper);
|
|
@@ -607,15 +585,15 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
607
585
|
|
|
608
586
|
this.rootSubscription.add(combineLatest([richVisibleRects$.pipe(op.map(function (p) {
|
|
609
587
|
return p.clipRect;
|
|
610
|
-
}), op.distinctUntilChanged(shallowEqual)), this.props$.pipe(op.startWith(null), op.pairwise(), op.filter(function (
|
|
611
|
-
var
|
|
612
|
-
prevProps =
|
|
613
|
-
props =
|
|
588
|
+
}), op.distinctUntilChanged(shallowEqual)), this.props$.pipe(op.startWith(null), op.pairwise(), op.filter(function (_ref) {
|
|
589
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
590
|
+
prevProps = _ref2[0],
|
|
591
|
+
props = _ref2[1];
|
|
614
592
|
|
|
615
593
|
return prevProps == null || !prevProps.isLoading && props.isLoading;
|
|
616
|
-
}))]).subscribe(function (
|
|
617
|
-
var
|
|
618
|
-
clipRect =
|
|
594
|
+
}))]).subscribe(function (_ref3) {
|
|
595
|
+
var _ref4 = _slicedToArray(_ref3, 1),
|
|
596
|
+
clipRect = _ref4[0];
|
|
619
597
|
|
|
620
598
|
var loadingIndicator = _this2.domHelper.getLoadingIndicator();
|
|
621
599
|
|
|
@@ -634,9 +612,9 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
634
612
|
horizontal = _this2$lastInfo$useVi.horizontal,
|
|
635
613
|
vertical = _this2$lastInfo$useVi.vertical;
|
|
636
614
|
return horizontal || vertical;
|
|
637
|
-
}), op.map(function (
|
|
638
|
-
var clipRect =
|
|
639
|
-
offsetY =
|
|
615
|
+
}), op.map(function (_ref5) {
|
|
616
|
+
var clipRect = _ref5.clipRect,
|
|
617
|
+
offsetY = _ref5.offsetY;
|
|
640
618
|
return {
|
|
641
619
|
maxRenderHeight: clipRect.bottom - clipRect.top,
|
|
642
620
|
maxRenderWidth: clipRect.right - clipRect.left,
|
|
@@ -653,9 +631,9 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
653
631
|
})).subscribe(function (sizeAndOffset) {
|
|
654
632
|
_this2.setState(sizeAndOffset);
|
|
655
633
|
}));
|
|
656
|
-
this.rootSubscription.add(richVisibleRects$.pipe(op.map(function (
|
|
657
|
-
var clipRect =
|
|
658
|
-
offsetY =
|
|
634
|
+
this.rootSubscription.add(richVisibleRects$.pipe(op.map(function (_ref6) {
|
|
635
|
+
var clipRect = _ref6.clipRect,
|
|
636
|
+
offsetY = _ref6.offsetY;
|
|
659
637
|
return {
|
|
660
638
|
maxRenderHeight: clipRect.bottom - clipRect.top,
|
|
661
639
|
maxRenderWidth: clipRect.right - clipRect.left,
|
package/es/table/base/utils.d.ts
CHANGED
|
@@ -36,4 +36,11 @@ export declare function shallowEqual<T>(objA: T, objB: T): boolean;
|
|
|
36
36
|
export declare function composeRowPropsGetter(getRowProps: (record: any, rowIndex: number) => React.HTMLAttributes<HTMLTableRowElement>, pendingRowProps?: React.HTMLAttributes<HTMLTableRowElement>): (record: any, rowIndex: number) => React.HTMLAttributes<HTMLTableRowElement>;
|
|
37
37
|
export declare function getTableScrollHeaderDOM(domHelper: TableDOMHelper): HTMLDivElement;
|
|
38
38
|
export declare function getTableScrollFooterDOM(domHelper: TableDOMHelper): HTMLDivElement;
|
|
39
|
+
export declare const cssPolifill: ({ variables, enableCSSVariables, bordered }: {
|
|
40
|
+
variables: {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
};
|
|
43
|
+
enableCSSVariables?: boolean;
|
|
44
|
+
bordered?: boolean;
|
|
45
|
+
}) => void;
|
|
39
46
|
export {};
|
package/es/table/base/utils.js
CHANGED
|
@@ -18,8 +18,10 @@ import { asyncScheduler, BehaviorSubject, defer, fromEvent, Subscription } from
|
|
|
18
18
|
import { map, throttleTime } from 'rxjs/operators';
|
|
19
19
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
20
20
|
import * as styledComponents from 'styled-components';
|
|
21
|
+
import cssVars from 'css-vars-ponyfill';
|
|
21
22
|
import mergeCellProps from '../utils/mergeCellProps';
|
|
22
23
|
import { browserType } from '../utils';
|
|
24
|
+
import { defaultCSSVariables } from './styles';
|
|
23
25
|
/** styled-components 类库的版本,ali-react-table 同时支持 v3 和 v5 */
|
|
24
26
|
|
|
25
27
|
export var STYLED_VERSION = styledComponents.createGlobalStyle != null ? 'v5' : 'v3';
|
|
@@ -211,4 +213,30 @@ export function getTableScrollHeaderDOM(domHelper) {
|
|
|
211
213
|
}
|
|
212
214
|
export function getTableScrollFooterDOM(domHelper) {
|
|
213
215
|
return browserType.isIE ? domHelper.tableFooterMain : domHelper.tableFooter;
|
|
214
|
-
}
|
|
216
|
+
}
|
|
217
|
+
export var cssPolifill = function cssPolifill(_ref) {
|
|
218
|
+
var variables = _ref.variables,
|
|
219
|
+
enableCSSVariables = _ref.enableCSSVariables,
|
|
220
|
+
bordered = _ref.bordered;
|
|
221
|
+
|
|
222
|
+
if (enableCSSVariables === false) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
var conditionCSSVariables = {}; // 默认情况下存在td、th无左右边框,开启`bordered`属性后才开启,否则隐藏这两种属性
|
|
227
|
+
|
|
228
|
+
if (!bordered) {
|
|
229
|
+
conditionCSSVariables['--cell-border-vertical'] = 'none';
|
|
230
|
+
conditionCSSVariables['--header-cell-border-vertical'] = 'none';
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
cssVars({
|
|
234
|
+
// exclude: 'link[href*="semantic-ui"]',
|
|
235
|
+
// onlyLegacy: false,
|
|
236
|
+
// rootElement: rootElement,
|
|
237
|
+
include: 'style[data-styled]',
|
|
238
|
+
variables: _extends({}, defaultCSSVariables, variables, conditionCSSVariables),
|
|
239
|
+
watch: true,
|
|
240
|
+
silent: true
|
|
241
|
+
});
|
|
242
|
+
};
|
|
@@ -65,7 +65,7 @@ export function columnDrag() {
|
|
|
65
65
|
},
|
|
66
66
|
headerCellProps: mergeCellProps(col.headerCellProps, {
|
|
67
67
|
onMouseDown: !isLeaf || path.length > 1 ? undefined : function (e) {
|
|
68
|
-
if (e.button !== 0) {
|
|
68
|
+
if (e.button !== 0 || !e.currentTarget.contains(e.target)) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -91,6 +91,8 @@ export function columnDrag() {
|
|
|
91
91
|
var currentTarget = e.currentTarget;
|
|
92
92
|
var rect = e.currentTarget.parentElement.getClientRects()[0];
|
|
93
93
|
var startX = rect.left;
|
|
94
|
+
var mouseDownClientX = e.clientX;
|
|
95
|
+
var mouseDownClientY = e.clientY;
|
|
94
96
|
var moveData = [];
|
|
95
97
|
var allColumns = collectNodes(columns);
|
|
96
98
|
var tableBodyClientRect = tableBody.getBoundingClientRect();
|
|
@@ -110,8 +112,6 @@ export function columnDrag() {
|
|
|
110
112
|
}
|
|
111
113
|
};
|
|
112
114
|
|
|
113
|
-
var stopClickPropagationFlag = false;
|
|
114
|
-
|
|
115
115
|
function handleMouseMove(e) {
|
|
116
116
|
var client = {
|
|
117
117
|
clientX: e.clientX,
|
|
@@ -125,12 +125,6 @@ export function columnDrag() {
|
|
|
125
125
|
if (e.clientX - leftPosition < 20) {
|
|
126
126
|
return;
|
|
127
127
|
} else {
|
|
128
|
-
// 阻止列头点击事件,防止拖动后触发列头过滤事件
|
|
129
|
-
if (stopClickPropagationFlag === false) {
|
|
130
|
-
stopClickPropagationFlag = true;
|
|
131
|
-
currentTarget.addEventListener('click', stopClickPropagation);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
128
|
e.stopPropagation();
|
|
135
129
|
}
|
|
136
130
|
|
|
@@ -247,14 +241,19 @@ export function columnDrag() {
|
|
|
247
241
|
}
|
|
248
242
|
|
|
249
243
|
function handleMouseUp(e) {
|
|
250
|
-
e.stopPropagation();
|
|
251
244
|
document.body.removeEventListener('mousemove', handleMouseMove);
|
|
252
245
|
document.body.removeEventListener('mouseup', handleMouseUp);
|
|
253
246
|
window.removeEventListener('selectstart', disableSelect);
|
|
247
|
+
|
|
248
|
+
if (_isMoveWhenClicking(mouseDownClientX, mouseDownClientY, e.clientX, e.clientY)) {
|
|
249
|
+
e.stopPropagation(); // 存在移动就阻止冒泡
|
|
250
|
+
|
|
251
|
+
currentTarget.addEventListener('click', stopClickPropagation); // 阻止列头点击事件,防止拖动后触发列头过滤事件
|
|
252
|
+
}
|
|
253
|
+
|
|
254
254
|
window.requestAnimationFrame(function () {
|
|
255
255
|
// 取消阻止列头点击事件
|
|
256
256
|
currentTarget.removeEventListener('click', stopClickPropagation);
|
|
257
|
-
stopClickPropagationFlag = false;
|
|
258
257
|
currentTarget = null;
|
|
259
258
|
|
|
260
259
|
var _moveData = moveData,
|
|
@@ -373,4 +372,15 @@ function moveAllChildren(cols, cloumnsTranslateData, width, isMinus) {
|
|
|
373
372
|
moveAllChildren(children, cloumnsTranslateData, width);
|
|
374
373
|
}
|
|
375
374
|
});
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function _isMoveWhenClicking(mouseDownClientX, mouseDownClientY, mouseUpClientX, mouseUpClientY) {
|
|
378
|
+
var xDiff = mouseUpClientX - mouseDownClientX;
|
|
379
|
+
var yDiff = mouseUpClientY - mouseDownClientY; // 鼠标点按和松开的偏移量大于5px,认为存在移动
|
|
380
|
+
|
|
381
|
+
if (Math.sqrt(xDiff * xDiff + yDiff * yDiff) > 5) {
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
return false;
|
|
376
386
|
}
|
|
@@ -12,8 +12,8 @@ export interface FilterFeatureOptions {
|
|
|
12
12
|
keepDataSource?: boolean;
|
|
13
13
|
/** 过滤模式。单列过滤 single,多列过滤 multiple,默认为多选 */
|
|
14
14
|
mode?: 'single' | 'multiple';
|
|
15
|
-
|
|
16
|
-
filterIcon?: ReactNode;
|
|
15
|
+
/** 过滤图标 */
|
|
16
|
+
filterIcon?: ReactNode | ((filtered: boolean) => ReactNode);
|
|
17
17
|
/** 是否对触发弹出过滤面板 的 click 事件调用 event.stopPropagation() */
|
|
18
18
|
stopClickEventPropagation?: boolean;
|
|
19
19
|
}
|
|
@@ -39,7 +39,7 @@ export function filter() {
|
|
|
39
39
|
return _mapInstanceProperty(columns).call(columns, dfs);
|
|
40
40
|
|
|
41
41
|
function dfs(col) {
|
|
42
|
-
var _a, _b, _c, _d, _e;
|
|
42
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
43
43
|
|
|
44
44
|
var result = _extends({}, col);
|
|
45
45
|
|
|
@@ -81,12 +81,13 @@ export function filter() {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
var filterPanel = (_d = col.features) === null || _d === void 0 ? void 0 : _d.filterPanel;
|
|
84
|
-
|
|
84
|
+
var colFilterIcon = (_f = (_e = col.features) === null || _e === void 0 ? void 0 : _e.filterIcon) !== null && _f !== void 0 ? _f : filterIcon;
|
|
85
|
+
result.title = _concatInstanceProperty(_context = []).call(_context, _toConsumableArray(_concatInstanceProperty(_context2 = []).call(_context2, (_g = result.title) !== null && _g !== void 0 ? _g : [internals.safeRenderHeader(_extends(_extends({}, col), {
|
|
85
86
|
title: null
|
|
86
87
|
}))])), [/*#__PURE__*/React.createElement(Filter, {
|
|
87
88
|
key: "filter",
|
|
88
89
|
FilterPanelContent: filterPanel,
|
|
89
|
-
filterIcon:
|
|
90
|
+
filterIcon: colFilterIcon,
|
|
90
91
|
filterModel: inputFiltersMap.get(col.code),
|
|
91
92
|
setFilterModel: handleFilterChanged,
|
|
92
93
|
setFilter: setFilter,
|
|
@@ -134,8 +135,8 @@ export function filter() {
|
|
|
134
135
|
return [item.key, _extends({}, item)];
|
|
135
136
|
}));
|
|
136
137
|
|
|
137
|
-
function isMatchedFilterCondition(record
|
|
138
|
-
return
|
|
138
|
+
function isMatchedFilterCondition(record) {
|
|
139
|
+
return filtersKeys.every(function (key) {
|
|
139
140
|
var _a, _b;
|
|
140
141
|
|
|
141
142
|
var filterItem = inputFiltersMap.get(key);
|
|
@@ -149,24 +150,43 @@ export function filter() {
|
|
|
149
150
|
} else {
|
|
150
151
|
console.warn("\u5217[".concat(key, "]\u672A\u914D\u7F6E\u7B5B\u9009\u51FD\u6570\uFF0C\u8BF7\u8BBE\u7F6E column.features.filterable \u6765\u4F5C\u4E3A\u8BE5\u5217\u7684\u7B5B\u9009\u51FD\u6570, \u76EE\u524D\u4F7F\u7528\u9ED8\u8BA4\u5305\u542B\u7B5B\u9009\u51FD\u6570"));
|
|
151
152
|
comparisonFn = _filterInstanceProperty(defaultFilterOptionsMap.get('contain'));
|
|
152
|
-
}
|
|
153
|
+
}
|
|
153
154
|
|
|
154
|
-
|
|
155
|
-
return !comparisonFn(_filterInstanceProperty(filterItem), filterItem)(internals.safeGetValue(columnsMap.get(key), record, rowIndex), record);
|
|
155
|
+
return comparisonFn(_filterInstanceProperty(filterItem), filterItem)(internals.safeGetValue(columnsMap.get(key), record, -1), record);
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
return dataSource
|
|
160
|
-
if (isMatchedFilterCondition(record, rowIndex)) {
|
|
161
|
-
return _concatInstanceProperty(pre).call(pre, [record]);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return pre;
|
|
165
|
-
}, []);
|
|
159
|
+
return layeredFilter(dataSource, isMatchedFilterCondition);
|
|
166
160
|
}
|
|
167
161
|
|
|
168
162
|
pipeline.dataSource(processDataSource(dataSource));
|
|
169
163
|
pipeline.columns(processColumns(columns));
|
|
170
164
|
return pipeline;
|
|
171
165
|
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function layeredFilter(array, matchFn) {
|
|
169
|
+
return dfs(array);
|
|
170
|
+
|
|
171
|
+
function dfs(rows) {
|
|
172
|
+
var _context6;
|
|
173
|
+
|
|
174
|
+
var parentMatched = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
175
|
+
return _filterInstanceProperty(_context6 = _mapInstanceProperty(rows).call(rows, function (row) {
|
|
176
|
+
var currentMatched = matchFn(row);
|
|
177
|
+
|
|
178
|
+
if (isLeafNode(row)) {
|
|
179
|
+
return (parentMatched || currentMatched) && _extends({}, row);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
var children = row.children;
|
|
183
|
+
|
|
184
|
+
var rowAfterFilterChildren = _extends(_extends({}, row), {
|
|
185
|
+
children: dfs(children, parentMatched || currentMatched)
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
var matchedByChildren = !isLeafNode(rowAfterFilterChildren);
|
|
189
|
+
return (parentMatched || currentMatched || matchedByChildren) && rowAfterFilterChildren;
|
|
190
|
+
})).call(_context6, Boolean);
|
|
191
|
+
}
|
|
172
192
|
}
|
|
@@ -12,7 +12,7 @@ import * as op from 'rxjs/operators';
|
|
|
12
12
|
import { mergeCellProps, collectNodes, makeRecursiveMapper, isGroupColumn } from '../../utils';
|
|
13
13
|
import { internals } from '../../internals';
|
|
14
14
|
import { Classes } from '../../base/styles';
|
|
15
|
-
var TableHeaderCellResize = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: -5px;\n height: 100%;\n width: 10px;\n cursor: ew-resize;\n display: flex;\n flex-direction: column;\n align-items: center;\n z-index:1;\n\n &:after {\n content: \"\";\n position: absolute;\n display: block;\n left: calc(50% - 1px);\n width: 1px;\n height: calc(100% - 14px);\n top: 7px;\n
|
|
15
|
+
var TableHeaderCellResize = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: -5px;\n height: 100%;\n width: 10px;\n cursor: ew-resize;\n display: flex;\n flex-direction: column;\n align-items: center;\n z-index:1;\n\n &:after {\n content: \"\";\n position: absolute;\n display: block;\n left: calc(50% - 1px);\n width: 1px;\n height: calc(100% - 14px);\n top: 7px;\n }\n"])));
|
|
16
16
|
var TableHeaderGroupCellResize = styled(TableHeaderCellResize)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &:after {\n height: 100%;\n top: 0;\n }\n"])));
|
|
17
17
|
|
|
18
18
|
function clamp(min, x, max) {
|