@kdcloudjs/table 1.1.4 → 1.1.5-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 +860 -310
- 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 +11 -2
- package/es/table/base/styles.js +18 -7
- package/es/table/base/table.d.ts +2 -0
- package/es/table/base/table.js +32 -54
- package/es/table/base/utils.d.ts +7 -0
- package/es/table/base/utils.js +36 -2
- package/es/table/pipeline/features/colGroupExtendable.d.ts +6 -0
- package/es/table/pipeline/features/colGroupExtendable.js +103 -0
- package/es/table/pipeline/features/columnDrag.js +5 -4
- package/es/table/pipeline/features/columnFilter.d.ts +4 -2
- package/es/table/pipeline/features/columnFilter.js +39 -19
- 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 +3 -2
- package/es/table/pipeline/features/filter/Filter.js +54 -35
- package/es/table/pipeline/features/filter/FilterPanel.d.ts +2 -1
- package/es/table/pipeline/features/filter/FilterPanel.js +40 -21
- 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 +2 -0
- package/es/table/pipeline/features/index.js +3 -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 +170 -30
- 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 +20 -21
- package/es/table/pipeline/pipeline.d.ts +5 -1
- package/es/table/pipeline/pipeline.js +11 -10
- package/es/table/utils/element.d.ts +1 -0
- package/es/table/utils/element.js +4 -0
- package/es/table/utils/keyCode.d.ts +5 -0
- package/es/table/utils/keyCode.js +5 -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 +11 -2
- package/lib/table/base/styles.js +18 -7
- package/lib/table/base/table.d.ts +2 -0
- package/lib/table/base/table.js +32 -54
- package/lib/table/base/utils.d.ts +7 -0
- package/lib/table/base/utils.js +43 -2
- package/lib/table/pipeline/features/colGroupExtendable.d.ts +6 -0
- package/lib/table/pipeline/features/colGroupExtendable.js +124 -0
- package/lib/table/pipeline/features/columnDrag.js +5 -4
- package/lib/table/pipeline/features/columnFilter.d.ts +4 -2
- package/lib/table/pipeline/features/columnFilter.js +37 -19
- 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 +3 -2
- package/lib/table/pipeline/features/filter/Filter.js +57 -35
- package/lib/table/pipeline/features/filter/FilterPanel.d.ts +2 -1
- package/lib/table/pipeline/features/filter/FilterPanel.js +42 -20
- 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 +2 -0
- package/lib/table/pipeline/features/index.js +23 -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 +173 -32
- 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 +21 -23
- package/lib/table/pipeline/pipeline.d.ts +5 -1
- package/lib/table/pipeline/pipeline.js +12 -10
- package/lib/table/utils/element.d.ts +1 -0
- package/lib/table/utils/element.js +6 -0
- package/lib/table/utils/keyCode.d.ts +5 -0
- package/lib/table/utils/keyCode.js +12 -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;
|
|
@@ -37,9 +38,12 @@ export declare const Classes: {
|
|
|
37
38
|
readonly tableHeaderCellLine: string;
|
|
38
39
|
readonly tableFilterTrigger: string;
|
|
39
40
|
readonly tableSortIcon: string;
|
|
41
|
+
readonly tableExtendIcon: string;
|
|
40
42
|
readonly button: string;
|
|
41
43
|
readonly buttonPrimary: string;
|
|
42
44
|
readonly filterIcon: string;
|
|
45
|
+
readonly rangeSelection: string;
|
|
46
|
+
readonly tableCellRangeSingleCell: string;
|
|
43
47
|
readonly tableCellRangeSelected: string;
|
|
44
48
|
readonly tableCellRangeTop: string;
|
|
45
49
|
readonly tableCellRangeLeft: string;
|
|
@@ -60,6 +64,9 @@ export declare const Classes: {
|
|
|
60
64
|
readonly leaf: string;
|
|
61
65
|
readonly expanded: string;
|
|
62
66
|
readonly collapsed: string;
|
|
67
|
+
readonly popup: string;
|
|
68
|
+
readonly popupHeader: string;
|
|
69
|
+
readonly popupBody: string;
|
|
63
70
|
};
|
|
64
71
|
export declare const MenuClasses: {
|
|
65
72
|
menu: string;
|
|
@@ -112,13 +119,13 @@ export declare type BaseTableCSSVariables = Partial<{
|
|
|
112
119
|
'--border-color': string;
|
|
113
120
|
/** 单元格边框,默认为 1px solid #dfe3e8 */
|
|
114
121
|
'--cell-border': string;
|
|
115
|
-
/** 单元格上下边框,默认为 #dfe3e8 */
|
|
122
|
+
/** 单元格上下边框,默认为 none ,默认值为 1px solid #dfe3e8 */
|
|
116
123
|
'--cell-border-horizontal': string;
|
|
117
124
|
/** 单元格左右边框,默认为 #dfe3e8 */
|
|
118
125
|
'--cell-border-vertical': string;
|
|
119
126
|
/** 表头单元格边框,默认为 1px solid #dfe3e8 */
|
|
120
127
|
'--header-cell-border': string;
|
|
121
|
-
/** 表头单元格上下边框,默认为 1px solid #dfe3e8 */
|
|
128
|
+
/** 表头单元格上下边框,默认为 none ,默认值为 1px solid #dfe3e8 */
|
|
122
129
|
'--header-cell-border-horizontal': string;
|
|
123
130
|
/** 表头单元格左右边框,默认为 1px solid #dfe3e8 */
|
|
124
131
|
'--header-cell-border-vertical': string;
|
|
@@ -148,7 +155,9 @@ export declare const defaultCSSVariables: {
|
|
|
148
155
|
'--cell-border-horizontal': string;
|
|
149
156
|
'---cell-border-vertical': string;
|
|
150
157
|
'--header-cell-border': string;
|
|
158
|
+
'--cell-border-vertical': string;
|
|
151
159
|
'--header-cell-border-horizontal': string;
|
|
160
|
+
'--header-cell-border-vertical': string;
|
|
152
161
|
};
|
|
153
162
|
export declare const variableConst: string;
|
|
154
163
|
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"),
|
|
@@ -50,9 +51,12 @@ export var Classes = {
|
|
|
50
51
|
tableHeaderCellLine: "".concat(prefix, "table-header-cell-line"),
|
|
51
52
|
tableFilterTrigger: "".concat(prefix, "filter-trigger"),
|
|
52
53
|
tableSortIcon: "".concat(prefix, "sort-icon"),
|
|
54
|
+
tableExtendIcon: "".concat(prefix, "extend-icon"),
|
|
53
55
|
button: "".concat(prefix, "btn"),
|
|
54
56
|
buttonPrimary: "".concat(prefix, "btn-primary"),
|
|
55
57
|
filterIcon: "".concat(prefix, "filter-icon"),
|
|
58
|
+
rangeSelection: "".concat(prefix, "range-selection"),
|
|
59
|
+
tableCellRangeSingleCell: "".concat(prefix, "table-cell-range-single-cell"),
|
|
56
60
|
tableCellRangeSelected: "".concat(prefix, "table-cell-range-selected"),
|
|
57
61
|
tableCellRangeTop: "".concat(prefix, "table-cell-range-top"),
|
|
58
62
|
tableCellRangeLeft: "".concat(prefix, "table-cell-range-left"),
|
|
@@ -72,7 +76,10 @@ export var Classes = {
|
|
|
72
76
|
rowSpan: "".concat(prefix, "row-span"),
|
|
73
77
|
leaf: "".concat(prefix, "leaf"),
|
|
74
78
|
expanded: "".concat(prefix, "expanded"),
|
|
75
|
-
collapsed: "".concat(prefix, "collapsed")
|
|
79
|
+
collapsed: "".concat(prefix, "collapsed"),
|
|
80
|
+
popup: "".concat(prefix, "popup"),
|
|
81
|
+
popupHeader: "".concat(prefix, "popup-header"),
|
|
82
|
+
popupBody: "".concat(prefix, "popup-body")
|
|
76
83
|
};
|
|
77
84
|
export var MenuClasses = {
|
|
78
85
|
menu: "".concat(prefix, "table-menu"),
|
|
@@ -91,7 +98,7 @@ var Z = {
|
|
|
91
98
|
scrollItem: 30,
|
|
92
99
|
loadingIndicator: 40
|
|
93
100
|
};
|
|
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
|
|
101
|
+
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
102
|
export var defaultCSSVariables = {
|
|
96
103
|
'--row-height': '48px',
|
|
97
104
|
'--color': '#333',
|
|
@@ -101,7 +108,7 @@ export var defaultCSSVariables = {
|
|
|
101
108
|
'--primary-color': '#5582F3',
|
|
102
109
|
'--primary-color-level1': 'rgb(242, 248, 255)',
|
|
103
110
|
'--primary-color-level2': 'rgb(135, 173, 255)',
|
|
104
|
-
'--icon-color': '#
|
|
111
|
+
'--icon-color': '#666666',
|
|
105
112
|
'--strong-border-color': '#d9d9d9',
|
|
106
113
|
'--header-row-height': '32px',
|
|
107
114
|
'--header-color': '#333',
|
|
@@ -117,11 +124,15 @@ export var defaultCSSVariables = {
|
|
|
117
124
|
'--cell-border-horizontal': '1px solid #dfe3e8',
|
|
118
125
|
'---cell-border-vertical': '1px solid #dfe3e8',
|
|
119
126
|
'--header-cell-border': '1px solid #dfe3e8',
|
|
120
|
-
'--
|
|
127
|
+
'--cell-border-vertical': '1px solid #dfe3e8',
|
|
128
|
+
'--header-cell-border-horizontal': '1px solid #dfe3e8',
|
|
129
|
+
'--header-cell-border-vertical': '1px solid #dfe3e8'
|
|
121
130
|
};
|
|
122
131
|
export var variableConst = getCssVariableText(defaultCSSVariables);
|
|
123
|
-
|
|
124
|
-
|
|
132
|
+
var notBorderedStyleMixin = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n --cell-border-vertical: none;\n --header-cell-border-vertical: none;\n"])));
|
|
133
|
+
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);
|
|
134
|
+
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 &:focus {\n outline: none\n }\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 .", " {\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.tableSortIcon, Classes.tableExtendIcon, Classes.verticalScrollPlaceholder, Classes.tableFooter, Classes.verticalScrollPlaceholder, Classes.tableHeaderCellResize);
|
|
135
|
+
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
136
|
|
|
126
137
|
function getCssVariableText(obj) {
|
|
127
138
|
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);
|
|
@@ -571,7 +549,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
571
549
|
var currentHasFooter = this.props.footerDataSource.length > 0;
|
|
572
550
|
|
|
573
551
|
if (!prevHasFooter && currentHasFooter) {
|
|
574
|
-
getTableScrollFooterDOM(this.domHelper).scrollLeft = this.domHelper.
|
|
552
|
+
getTableScrollFooterDOM(this.domHelper).scrollLeft = this.domHelper.virtual.scrollLeft;
|
|
575
553
|
}
|
|
576
554
|
}
|
|
577
555
|
}
|
|
@@ -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,11 @@ 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';
|
|
25
|
+
import { hasScroll } from '../utils/element';
|
|
23
26
|
/** styled-components 类库的版本,ali-react-table 同时支持 v3 和 v5 */
|
|
24
27
|
|
|
25
28
|
export var STYLED_VERSION = styledComponents.createGlobalStyle != null ? 'v5' : 'v3';
|
|
@@ -136,7 +139,12 @@ export function syncScrollLeft(elements, callback) {
|
|
|
136
139
|
return;
|
|
137
140
|
}
|
|
138
141
|
|
|
139
|
-
var scrollLeft = ele.scrollLeft;
|
|
142
|
+
var scrollLeft = ele.scrollLeft; // 某一元素当滚动条消失时会触发scroll事件(scrolLeft重置为0),不同步其他其他元素的scrollLeft
|
|
143
|
+
|
|
144
|
+
if (scrollLeft === 0 && !hasScroll(ele)) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
140
148
|
publishScrollLeft(ele, scrollLeft);
|
|
141
149
|
callback(scrollLeft);
|
|
142
150
|
};
|
|
@@ -211,4 +219,30 @@ export function getTableScrollHeaderDOM(domHelper) {
|
|
|
211
219
|
}
|
|
212
220
|
export function getTableScrollFooterDOM(domHelper) {
|
|
213
221
|
return browserType.isIE ? domHelper.tableFooterMain : domHelper.tableFooter;
|
|
214
|
-
}
|
|
222
|
+
}
|
|
223
|
+
export var cssPolifill = function cssPolifill(_ref) {
|
|
224
|
+
var variables = _ref.variables,
|
|
225
|
+
enableCSSVariables = _ref.enableCSSVariables,
|
|
226
|
+
bordered = _ref.bordered;
|
|
227
|
+
|
|
228
|
+
if (enableCSSVariables === false) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
var conditionCSSVariables = {}; // 默认情况下存在td、th无左右边框,开启`bordered`属性后才开启,否则隐藏这两种属性
|
|
233
|
+
|
|
234
|
+
if (!bordered) {
|
|
235
|
+
conditionCSSVariables['--cell-border-vertical'] = 'none';
|
|
236
|
+
conditionCSSVariables['--header-cell-border-vertical'] = 'none';
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
cssVars({
|
|
240
|
+
// exclude: 'link[href*="semantic-ui"]',
|
|
241
|
+
// onlyLegacy: false,
|
|
242
|
+
// rootElement: rootElement,
|
|
243
|
+
include: 'style[data-styled]',
|
|
244
|
+
variables: _extends({}, defaultCSSVariables, variables, conditionCSSVariables),
|
|
245
|
+
watch: true,
|
|
246
|
+
silent: true
|
|
247
|
+
});
|
|
248
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TablePipeline } from "../pipeline";
|
|
2
|
+
export interface colGroupExtendOption {
|
|
3
|
+
onChangeExtendStatus?({}: any, {}: any): void;
|
|
4
|
+
extendStatus?: {};
|
|
5
|
+
}
|
|
6
|
+
export declare const colGroupExtendable: (opts?: colGroupExtendOption) => (pipeline: TablePipeline) => TablePipeline;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
3
|
+
import _taggedTemplateLiteral from "@babel/runtime-corejs3/helpers/taggedTemplateLiteral";
|
|
4
|
+
|
|
5
|
+
var _templateObject;
|
|
6
|
+
|
|
7
|
+
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import styled from 'styled-components';
|
|
10
|
+
import { internals } from '../../internals';
|
|
11
|
+
import { makeRecursiveMapper } from '../../utils';
|
|
12
|
+
import cx from 'classnames';
|
|
13
|
+
import { Classes } from '../../base/styles';
|
|
14
|
+
var ExtendIconStyle = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size:12px;\n margin-left:4px;\n"])));
|
|
15
|
+
var stateKey = 'colExtend';
|
|
16
|
+
|
|
17
|
+
var ExpandIcon = function ExpandIcon(_ref) {
|
|
18
|
+
var style = _ref.style,
|
|
19
|
+
className = _ref.className,
|
|
20
|
+
size = _ref.size,
|
|
21
|
+
isExtend = _ref.isExtend;
|
|
22
|
+
return isExtend ? /*#__PURE__*/React.createElement("svg", {
|
|
23
|
+
className: className,
|
|
24
|
+
width: size,
|
|
25
|
+
height: size,
|
|
26
|
+
style: style,
|
|
27
|
+
viewBox: "96 96 896 896"
|
|
28
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
29
|
+
d: "M678.347087 178.347087C690.550972 166.143203 690.550972 146.356797 678.347087 134.152913C666.143203 121.949029 646.356797 121.949029 634.152913 134.152913L290.402913 477.902913C278.199029 490.106797 278.199029 509.893203 290.402913 522.097087L634.152913 865.847087C646.356797 878.050972 666.143203 878.050972 678.347087 865.847087C690.550972 853.643203 690.550972 833.856797 678.347087 821.652913L356.694175 500L678.347087 178.347087z"
|
|
30
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
31
|
+
className: className,
|
|
32
|
+
width: size,
|
|
33
|
+
height: size,
|
|
34
|
+
style: style,
|
|
35
|
+
viewBox: "96 96 896 896"
|
|
36
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
37
|
+
d: "M321.652913 178.347087C309.449029 166.143203 309.449029 146.356797 321.652913 134.152913C333.856797 121.949029 353.643203 121.949029 365.847088 134.152913L709.597087 477.902913C721.800972 490.106797 721.800972 509.893203 709.597087 522.097087L365.847088 865.847087C353.643203 878.050972 333.856797 878.050972 321.652913 865.847087C309.449029 853.643203 309.449029 833.856797 321.652913 821.652913L643.305825 500L321.652913 178.347087z"
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export var colGroupExtendable = function colGroupExtendable() {
|
|
42
|
+
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
43
|
+
return function (pipeline) {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
|
|
46
|
+
var columns = pipeline.getColumns();
|
|
47
|
+
var curState = (_b = (_a = opts.extendStatus) !== null && _a !== void 0 ? _a : pipeline.getStateAtKey(stateKey)) !== null && _b !== void 0 ? _b : {};
|
|
48
|
+
|
|
49
|
+
var processColumns = function processColumns(columns) {
|
|
50
|
+
// 当组合列可伸缩,且处于收缩状态时,只渲染一个子列,其他不渲染
|
|
51
|
+
var toggle = function toggle(col) {
|
|
52
|
+
// 对应的 col 进行状态切换
|
|
53
|
+
var changedValue = _defineProperty({}, col.code, !curState[col.code]);
|
|
54
|
+
|
|
55
|
+
curState[col.code] = !curState[col.code];
|
|
56
|
+
pipeline.setStateAtKey(stateKey, _extends({}, curState));
|
|
57
|
+
(opts === null || opts === void 0 ? void 0 : opts.onChangeExtendStatus) && opts.onChangeExtendStatus(curState, changedValue);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var addIcon = function addIcon(col) {
|
|
61
|
+
var result = _extends({}, col);
|
|
62
|
+
|
|
63
|
+
var addIconNode = /*#__PURE__*/React.createElement(React.Fragment, null, internals.safeRenderHeader(_extends({}, col)), /*#__PURE__*/React.createElement(ExtendIconStyle, {
|
|
64
|
+
onClick: function onClick() {
|
|
65
|
+
toggle(col);
|
|
66
|
+
}
|
|
67
|
+
}, /*#__PURE__*/React.createElement(ExpandIcon, {
|
|
68
|
+
style: {
|
|
69
|
+
userSelect: 'none',
|
|
70
|
+
marginLeft: 2,
|
|
71
|
+
flexShrink: 0,
|
|
72
|
+
cursor: "pointer",
|
|
73
|
+
verticalAlign: 'middle'
|
|
74
|
+
},
|
|
75
|
+
className: cx(_defineProperty({}, Classes.tableExtendIcon, true)),
|
|
76
|
+
size: 16,
|
|
77
|
+
isExtend: curState[col.code]
|
|
78
|
+
})));
|
|
79
|
+
result.title = addIconNode;
|
|
80
|
+
return result;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return makeRecursiveMapper(function (col) {
|
|
84
|
+
var _a;
|
|
85
|
+
|
|
86
|
+
var _ref2 = (col === null || col === void 0 ? void 0 : col.features) || {},
|
|
87
|
+
showExtendIcon = _ref2.showExtendIcon;
|
|
88
|
+
|
|
89
|
+
if (showExtendIcon === true && ((_a = col.children) === null || _a === void 0 ? void 0 : _a.length) > 1) {
|
|
90
|
+
var _context;
|
|
91
|
+
|
|
92
|
+
col = addIcon(col);
|
|
93
|
+
curState[col.code] === false && _spliceInstanceProperty(_context = col.children).call(_context, 1, col.children.length);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return col;
|
|
97
|
+
})(columns);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
pipeline.columns(processColumns(columns));
|
|
101
|
+
return pipeline;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
@@ -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
|
|
|
@@ -241,13 +241,14 @@ export function columnDrag() {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
function handleMouseUp(e) {
|
|
244
|
-
e.stopPropagation();
|
|
245
244
|
document.body.removeEventListener('mousemove', handleMouseMove);
|
|
246
245
|
document.body.removeEventListener('mouseup', handleMouseUp);
|
|
247
|
-
window.removeEventListener('selectstart', disableSelect);
|
|
246
|
+
window.removeEventListener('selectstart', disableSelect);
|
|
248
247
|
|
|
249
248
|
if (_isMoveWhenClicking(mouseDownClientX, mouseDownClientY, e.clientX, e.clientY)) {
|
|
250
|
-
|
|
249
|
+
e.stopPropagation(); // 存在移动就阻止冒泡
|
|
250
|
+
|
|
251
|
+
currentTarget.addEventListener('click', stopClickPropagation); // 阻止列头点击事件,防止拖动后触发列头过滤事件
|
|
251
252
|
}
|
|
252
253
|
|
|
253
254
|
window.requestAnimationFrame(function () {
|
|
@@ -12,9 +12,11 @@ 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
|
+
/** 是否隐藏过滤弹出菜单header区域 */
|
|
20
|
+
hideFilterPopupHeader?: boolean;
|
|
19
21
|
}
|
|
20
22
|
export declare function filter(opts?: FilterFeatureOptions): (pipeline: TablePipeline) => TablePipeline;
|