@kdcloudjs/table 1.1.4 → 1.1.5-canary.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@kdcloudjs/table.css +1 -1
- package/dist/@kdcloudjs/table.js +905 -346
- 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 +19 -8
- package/es/table/base/table.d.ts +3 -1
- package/es/table/base/table.js +35 -56
- package/es/table/base/utils.d.ts +7 -0
- package/es/table/base/utils.js +36 -2
- package/es/table/common-views.js +1 -1
- package/es/table/pipeline/features/colGroupExtendable.d.ts +8 -0
- package/es/table/pipeline/features/colGroupExtendable.js +105 -0
- package/es/table/pipeline/features/columnDrag.js +5 -4
- package/es/table/pipeline/features/columnFilter.d.ts +8 -2
- package/es/table/pipeline/features/columnFilter.js +43 -19
- package/es/table/pipeline/features/columnResizeWidth.js +1 -1
- package/es/table/pipeline/features/contextMenu.d.ts +5 -1
- package/es/table/pipeline/features/contextMenu.js +18 -28
- package/es/table/pipeline/features/filter/DefaultFilterContent.js +27 -7
- 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 +5 -2
- package/es/table/pipeline/features/filter/Filter.js +65 -37
- 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 +180 -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 +1 -1
- package/es/table/pipeline/pipeline.js +4 -9
- 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 +19 -8
- package/lib/table/base/table.d.ts +3 -1
- package/lib/table/base/table.js +35 -56
- package/lib/table/base/utils.d.ts +7 -0
- package/lib/table/base/utils.js +43 -2
- package/lib/table/common-views.js +1 -1
- package/lib/table/pipeline/features/colGroupExtendable.d.ts +8 -0
- package/lib/table/pipeline/features/colGroupExtendable.js +126 -0
- package/lib/table/pipeline/features/columnDrag.js +5 -4
- package/lib/table/pipeline/features/columnFilter.d.ts +8 -2
- package/lib/table/pipeline/features/columnFilter.js +41 -19
- package/lib/table/pipeline/features/columnResizeWidth.js +1 -1
- package/lib/table/pipeline/features/contextMenu.d.ts +5 -1
- package/lib/table/pipeline/features/contextMenu.js +17 -28
- package/lib/table/pipeline/features/filter/DefaultFilterContent.js +28 -6
- 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 +5 -2
- package/lib/table/pipeline/features/filter/Filter.js +68 -37
- 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 +183 -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 +1 -1
- package/lib/table/pipeline/pipeline.js +4 -9
- 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,17 +98,17 @@ 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',
|
|
98
105
|
'--bgcolor': 'white',
|
|
99
|
-
'--hover-bgcolor': 'var(--hover-color, #
|
|
106
|
+
'--hover-bgcolor': 'var(--hover-color, #f5f5f5)',
|
|
100
107
|
'--highlight-bgcolor': '#eee',
|
|
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 //\u89E3\u51B3\u90E8\u5206\u6D4F\u89C8\u5668(chrome109)\u6700\u540E\u4E00\u4E2A\u5355\u5143\u683C\u7684\u5217\u5BBD\u62D6\u62FD\u533A\u57DF\u7EDD\u5BF9\u5B9A\u4F4D\u8D85\u51FA\u8868\u683C\uFF0C\u5BFC\u81F4\u8868\u683C\u7AD6\u5206\u5272\u7EBF\u65E0\u6CD5\u5BF9\u9F50\n .", " th.", " .", "{\n right: 0;\n width: 5px;\n &::after{\n left: 4px;\n }\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, Classes.tableHeaderRow, Classes.last, 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
|
@@ -47,6 +47,8 @@ export interface BaseTableProps {
|
|
|
47
47
|
scrollbarWidth?: number;
|
|
48
48
|
/** 使用来自外层 div 的边框代替单元格的外边框 */
|
|
49
49
|
useOuterBorder?: boolean;
|
|
50
|
+
/** 显示表格单元格边框线 */
|
|
51
|
+
bordered?: boolean;
|
|
50
52
|
/** 表格是否在加载中 */
|
|
51
53
|
isLoading?: boolean;
|
|
52
54
|
/** 数据为空时,单元格的高度 */
|
|
@@ -75,7 +77,7 @@ export interface BaseTableProps {
|
|
|
75
77
|
getTableProps?(): React.HTMLAttributes<HTMLTableElement>;
|
|
76
78
|
setTableWidth?(tableWidth: number): void;
|
|
77
79
|
setTableDomHelper?(domHelper: TableDOMHelper): void;
|
|
78
|
-
|
|
80
|
+
setRowHeightManager?(rowHeightManager: any): void;
|
|
79
81
|
cssVariables?: {
|
|
80
82
|
[key: string]: any;
|
|
81
83
|
};
|
package/es/table/base/table.js
CHANGED
|
@@ -3,15 +3,15 @@ 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
|
-
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(
|
|
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(_e2) { throw _e2; }, 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(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
15
15
|
|
|
16
16
|
function _unsupportedIterableToArray(o, minLen) { var _context2; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context2 = Object.prototype.toString.call(o)).call(_context2, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
17
|
|
|
@@ -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,35 +467,36 @@ 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",
|
|
522
498
|
value: function componentDidMount() {
|
|
523
|
-
var _a, _b, _c, _d; // console.log('did mount start')
|
|
499
|
+
var _a, _b, _c, _d, _e, _f; // console.log('did mount start')
|
|
524
500
|
// console.log('update dom helper start')
|
|
525
501
|
|
|
526
502
|
|
|
@@ -532,13 +508,16 @@ 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);
|
|
520
|
+
(_f = (_e = this.props).setRowHeightManager) === null || _f === void 0 ? void 0 : _f.call(_e, this.rowHeightManager);
|
|
542
521
|
}
|
|
543
522
|
}, {
|
|
544
523
|
key: "componentDidUpdate",
|
|
@@ -571,7 +550,7 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
571
550
|
var currentHasFooter = this.props.footerDataSource.length > 0;
|
|
572
551
|
|
|
573
552
|
if (!prevHasFooter && currentHasFooter) {
|
|
574
|
-
getTableScrollFooterDOM(this.domHelper).scrollLeft = this.domHelper.
|
|
553
|
+
getTableScrollFooterDOM(this.domHelper).scrollLeft = this.domHelper.virtual.scrollLeft;
|
|
575
554
|
}
|
|
576
555
|
}
|
|
577
556
|
}
|
|
@@ -607,15 +586,15 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
607
586
|
|
|
608
587
|
this.rootSubscription.add(combineLatest([richVisibleRects$.pipe(op.map(function (p) {
|
|
609
588
|
return p.clipRect;
|
|
610
|
-
}), op.distinctUntilChanged(shallowEqual)), this.props$.pipe(op.startWith(null), op.pairwise(), op.filter(function (
|
|
611
|
-
var
|
|
612
|
-
prevProps =
|
|
613
|
-
props =
|
|
589
|
+
}), op.distinctUntilChanged(shallowEqual)), this.props$.pipe(op.startWith(null), op.pairwise(), op.filter(function (_ref) {
|
|
590
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
591
|
+
prevProps = _ref2[0],
|
|
592
|
+
props = _ref2[1];
|
|
614
593
|
|
|
615
594
|
return prevProps == null || !prevProps.isLoading && props.isLoading;
|
|
616
|
-
}))]).subscribe(function (
|
|
617
|
-
var
|
|
618
|
-
clipRect =
|
|
595
|
+
}))]).subscribe(function (_ref3) {
|
|
596
|
+
var _ref4 = _slicedToArray(_ref3, 1),
|
|
597
|
+
clipRect = _ref4[0];
|
|
619
598
|
|
|
620
599
|
var loadingIndicator = _this2.domHelper.getLoadingIndicator();
|
|
621
600
|
|
|
@@ -634,9 +613,9 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
634
613
|
horizontal = _this2$lastInfo$useVi.horizontal,
|
|
635
614
|
vertical = _this2$lastInfo$useVi.vertical;
|
|
636
615
|
return horizontal || vertical;
|
|
637
|
-
}), op.map(function (
|
|
638
|
-
var clipRect =
|
|
639
|
-
offsetY =
|
|
616
|
+
}), op.map(function (_ref5) {
|
|
617
|
+
var clipRect = _ref5.clipRect,
|
|
618
|
+
offsetY = _ref5.offsetY;
|
|
640
619
|
return {
|
|
641
620
|
maxRenderHeight: clipRect.bottom - clipRect.top,
|
|
642
621
|
maxRenderWidth: clipRect.right - clipRect.left,
|
|
@@ -653,9 +632,9 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
653
632
|
})).subscribe(function (sizeAndOffset) {
|
|
654
633
|
_this2.setState(sizeAndOffset);
|
|
655
634
|
}));
|
|
656
|
-
this.rootSubscription.add(richVisibleRects$.pipe(op.map(function (
|
|
657
|
-
var clipRect =
|
|
658
|
-
offsetY =
|
|
635
|
+
this.rootSubscription.add(richVisibleRects$.pipe(op.map(function (_ref6) {
|
|
636
|
+
var clipRect = _ref6.clipRect,
|
|
637
|
+
offsetY = _ref6.offsetY;
|
|
659
638
|
return {
|
|
660
639
|
maxRenderHeight: clipRect.bottom - clipRect.top,
|
|
661
640
|
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
|
+
};
|
package/es/table/common-views.js
CHANGED
|
@@ -67,4 +67,4 @@ export var icons = {
|
|
|
67
67
|
CaretRight: CaretRightIcon,
|
|
68
68
|
Info: InfoIcon
|
|
69
69
|
};
|
|
70
|
-
export var ContextMenuStyleWrap = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &.", "{\n border: 1px solid #e9ecf1;\n border-radius: 2px;\n background-color: #Fff;\n box-shadow: 0px 0px 5px 0px rgb(154 154 154 / 50%);\n cursor: default;\n font-size:
|
|
70
|
+
export var ContextMenuStyleWrap = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &.", "{\n border: 1px solid #e9ecf1;\n border-radius: 2px;\n background-color: #Fff;\n box-shadow: 0px 0px 5px 0px rgb(154 154 154 / 50%);\n cursor: default;\n font-size: 12px;\n position:absolute;\n z-index: 1050;\n max-width: 600px;\n padding: 8px 0;\n }\n\n .", "{\n width:100%;\n display: table;\n }\n\n .", " .", "{\n display: table-row;\n color: #212121;\n }\n\n .", " .", "{\n background-color: var(--hover-bgcolor);\n }\n\n .", " .", " .", "{\n display: table-cell;\n padding: 8px 12px;\n max-width: 576px;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n line-height: 16px;\n }\n .", " .", ".", "{\n opacity: .5;\n }\n\n"])), MenuClasses.menu, MenuClasses.menuList, MenuClasses.menuList, MenuClasses.menuOption, MenuClasses.menuList, MenuClasses.menuOptionActive, MenuClasses.menuList, MenuClasses.menuOption, MenuClasses.menuOptionText, MenuClasses.menuList, MenuClasses.menuOption, MenuClasses.menuOptionDisable);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TablePipeline } from "../pipeline";
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface colGroupExtendOption {
|
|
4
|
+
onChangeExtendStatus?({}: any, {}: any): void;
|
|
5
|
+
extendStatus?: {};
|
|
6
|
+
extendIcon?: ReactNode | ((extendStatus: boolean) => ReactNode);
|
|
7
|
+
}
|
|
8
|
+
export declare const colGroupExtendable: (opts?: colGroupExtendOption) => (pipeline: TablePipeline) => TablePipeline;
|
|
@@ -0,0 +1,105 @@
|
|
|
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 curColState = curState[col.code];
|
|
64
|
+
var displaycolExtendIcon = typeof opts.extendIcon === 'function' ? opts.extendIcon(curColState) : opts.extendIcon;
|
|
65
|
+
var addIconNode = /*#__PURE__*/React.createElement(React.Fragment, null, internals.safeRenderHeader(_extends({}, col)), /*#__PURE__*/React.createElement(ExtendIconStyle, {
|
|
66
|
+
onClick: function onClick() {
|
|
67
|
+
toggle(col);
|
|
68
|
+
}
|
|
69
|
+
}, displaycolExtendIcon || /*#__PURE__*/React.createElement(ExpandIcon, {
|
|
70
|
+
style: {
|
|
71
|
+
userSelect: 'none',
|
|
72
|
+
marginLeft: 2,
|
|
73
|
+
flexShrink: 0,
|
|
74
|
+
cursor: "pointer",
|
|
75
|
+
verticalAlign: 'middle'
|
|
76
|
+
},
|
|
77
|
+
className: cx(_defineProperty({}, Classes.tableExtendIcon, true)),
|
|
78
|
+
size: 14,
|
|
79
|
+
isExtend: curColState
|
|
80
|
+
})));
|
|
81
|
+
result.title = addIconNode;
|
|
82
|
+
return result;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return makeRecursiveMapper(function (col) {
|
|
86
|
+
var _a;
|
|
87
|
+
|
|
88
|
+
var _ref2 = (col === null || col === void 0 ? void 0 : col.features) || {},
|
|
89
|
+
showExtendIcon = _ref2.showExtendIcon;
|
|
90
|
+
|
|
91
|
+
if (showExtendIcon === true && ((_a = col.children) === null || _a === void 0 ? void 0 : _a.length) > 1) {
|
|
92
|
+
var _context;
|
|
93
|
+
|
|
94
|
+
col = addIcon(col);
|
|
95
|
+
curState[col.code] === false && _spliceInstanceProperty(_context = col.children).call(_context, 1, col.children.length);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return col;
|
|
99
|
+
})(columns);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
pipeline.columns(processColumns(columns));
|
|
103
|
+
return pipeline;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
@@ -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 () {
|