@kdcloudjs/table 1.1.3 → 1.1.4-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@kdcloudjs/table.css +1 -1
- package/dist/@kdcloudjs/table.js +599 -268
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +10 -9
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/es/table/base/html-table.js +1 -1
- package/es/table/base/styles.d.ts +7 -2
- package/es/table/base/styles.js +13 -6
- package/es/table/base/table.d.ts +2 -0
- package/es/table/base/table.js +31 -53
- package/es/table/base/utils.d.ts +7 -0
- package/es/table/base/utils.js +29 -1
- package/es/table/pipeline/features/columnDrag.js +21 -11
- package/es/table/pipeline/features/columnFilter.d.ts +2 -2
- package/es/table/pipeline/features/columnFilter.js +35 -15
- package/es/table/pipeline/features/columnResizeWidth.js +1 -1
- package/es/table/pipeline/features/filter/DefaultFilterContent.js +22 -2
- package/es/table/pipeline/features/filter/DefaultFilterIcon.d.ts +5 -0
- package/es/table/pipeline/features/filter/DefaultFilterIcon.js +20 -0
- package/es/table/pipeline/features/filter/Filter.d.ts +1 -1
- package/es/table/pipeline/features/filter/Filter.js +16 -20
- package/es/table/pipeline/features/filter/FilterPanel.js +21 -15
- package/es/table/pipeline/features/filter/util.js +4 -4
- package/es/table/pipeline/features/footerDataSource.d.ts +9 -0
- package/es/table/pipeline/features/footerDataSource.js +25 -0
- package/es/table/pipeline/features/index.d.ts +1 -0
- package/es/table/pipeline/features/index.js +2 -1
- package/es/table/pipeline/features/multiSelect.js +7 -2
- package/es/table/pipeline/features/rangeSelection.d.ts +1 -1
- package/es/table/pipeline/features/rangeSelection.js +156 -28
- package/es/table/pipeline/features/singleSelect.js +4 -0
- package/es/table/pipeline/features/treeMode.d.ts +2 -0
- package/es/table/pipeline/features/treeMode.js +18 -20
- package/es/table/pipeline/pipeline.d.ts +5 -1
- package/es/table/pipeline/pipeline.js +12 -11
- package/es/table/utils/keyCode.d.ts +4 -0
- package/es/table/utils/keyCode.js +4 -0
- package/es/table/utils/mergeCellProps.js +2 -6
- package/lib/table/base/html-table.js +1 -1
- package/lib/table/base/styles.d.ts +7 -2
- package/lib/table/base/styles.js +13 -6
- package/lib/table/base/table.d.ts +2 -0
- package/lib/table/base/table.js +31 -53
- package/lib/table/base/utils.d.ts +7 -0
- package/lib/table/base/utils.js +35 -1
- package/lib/table/pipeline/features/columnDrag.js +21 -11
- package/lib/table/pipeline/features/columnFilter.d.ts +2 -2
- package/lib/table/pipeline/features/columnFilter.js +33 -15
- package/lib/table/pipeline/features/columnResizeWidth.js +1 -1
- package/lib/table/pipeline/features/filter/DefaultFilterContent.js +23 -1
- package/lib/table/pipeline/features/filter/DefaultFilterIcon.d.ts +5 -0
- package/lib/table/pipeline/features/filter/DefaultFilterIcon.js +30 -0
- package/lib/table/pipeline/features/filter/Filter.d.ts +1 -1
- package/lib/table/pipeline/features/filter/Filter.js +17 -20
- package/lib/table/pipeline/features/filter/FilterPanel.js +21 -14
- package/lib/table/pipeline/features/filter/util.js +4 -4
- package/lib/table/pipeline/features/footerDataSource.d.ts +9 -0
- package/lib/table/pipeline/features/footerDataSource.js +41 -0
- package/lib/table/pipeline/features/index.d.ts +1 -0
- package/lib/table/pipeline/features/index.js +15 -1
- package/lib/table/pipeline/features/multiSelect.js +6 -1
- package/lib/table/pipeline/features/rangeSelection.d.ts +1 -1
- package/lib/table/pipeline/features/rangeSelection.js +158 -30
- package/lib/table/pipeline/features/singleSelect.js +4 -0
- package/lib/table/pipeline/features/treeMode.d.ts +2 -0
- package/lib/table/pipeline/features/treeMode.js +19 -22
- package/lib/table/pipeline/pipeline.d.ts +5 -1
- package/lib/table/pipeline/pipeline.js +13 -11
- package/lib/table/utils/keyCode.d.ts +4 -0
- package/lib/table/utils/keyCode.js +11 -0
- package/lib/table/utils/mergeCellProps.js +2 -6
- package/package.json +3 -3
|
@@ -32,6 +32,8 @@ export interface TreeModeFeatureOptions {
|
|
|
32
32
|
stopClickEventPropagation?: boolean;
|
|
33
33
|
/** 指定表格每一行元信息的记录字段 */
|
|
34
34
|
treeMetaKey?: string | symbol;
|
|
35
|
+
/** 指定展开列 */
|
|
36
|
+
expandColCode?: string;
|
|
35
37
|
}
|
|
36
38
|
export declare function treeMode(opts?: TreeModeFeatureOptions): (pipeline: TablePipeline) => TablePipeline;
|
|
37
39
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
1
2
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
2
3
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
3
|
-
import _toArray from "@babel/runtime-corejs3/helpers/toArray";
|
|
4
4
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
5
5
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
6
6
|
import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
|
|
7
7
|
|
|
8
8
|
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; } } }; }
|
|
9
9
|
|
|
10
|
-
function _unsupportedIterableToArray(o, minLen) { var
|
|
10
|
+
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); }
|
|
11
11
|
|
|
12
12
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
13
13
|
|
|
@@ -15,7 +15,7 @@ import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
|
15
15
|
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
16
16
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
17
17
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
18
|
-
import
|
|
18
|
+
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
|
|
19
19
|
import cx from 'classnames';
|
|
20
20
|
import React from 'react';
|
|
21
21
|
import { ExpansionCell, icons, InlineFlexCell } from '../../common-views';
|
|
@@ -31,11 +31,6 @@ export function treeMode() {
|
|
|
31
31
|
var stateKey = 'treeMode';
|
|
32
32
|
var ctx = pipeline.ctx;
|
|
33
33
|
var primaryKey = pipeline.ensurePrimaryKey('treeMode');
|
|
34
|
-
|
|
35
|
-
if (typeof primaryKey !== 'string') {
|
|
36
|
-
throw new Error('treeMode 仅支持字符串作为 primaryKey');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
34
|
var openKeys = (_c = (_b = (_a = opts.openKeys) !== null && _a !== void 0 ? _a : pipeline.getStateAtKey(stateKey)) !== null && _b !== void 0 ? _b : opts.defaultOpenKeys) !== null && _c !== void 0 ? _c : [];
|
|
40
35
|
var openKeySet = new _Set(openKeys);
|
|
41
36
|
|
|
@@ -90,7 +85,7 @@ export function treeMode() {
|
|
|
90
85
|
try {
|
|
91
86
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
92
87
|
var node = _step.value;
|
|
93
|
-
var rowKey = node
|
|
88
|
+
var rowKey = internals.safeGetRowKey(primaryKey, node, -1);
|
|
94
89
|
var expanded = openKeySet.has(rowKey);
|
|
95
90
|
var isLeaf = isLeafNode(node, {
|
|
96
91
|
depth: depth,
|
|
@@ -120,18 +115,20 @@ export function treeMode() {
|
|
|
120
115
|
}
|
|
121
116
|
|
|
122
117
|
function processColumns(columns) {
|
|
123
|
-
var _context2;
|
|
124
|
-
|
|
125
118
|
if (columns.length === 0) {
|
|
126
119
|
return columns;
|
|
127
120
|
}
|
|
128
121
|
|
|
129
|
-
var
|
|
130
|
-
|
|
131
|
-
|
|
122
|
+
var expandColIndex = _findIndexInstanceProperty(columns).call(columns, function (_ref) {
|
|
123
|
+
var code = _ref.code;
|
|
124
|
+
return code && opts.expandColCode === code;
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
expandColIndex = expandColIndex === -1 ? 0 : expandColIndex;
|
|
128
|
+
var expandCol = columns[expandColIndex];
|
|
132
129
|
|
|
133
130
|
var render = function render(value, record, recordIndex) {
|
|
134
|
-
var content = internals.safeRender(
|
|
131
|
+
var content = internals.safeRender(expandCol, record, recordIndex);
|
|
135
132
|
|
|
136
133
|
if (record[treeMetaKey] == null) {
|
|
137
134
|
// 没有 treeMeta 信息的话,就返回原先的渲染结果
|
|
@@ -191,7 +188,7 @@ export function treeMode() {
|
|
|
191
188
|
};
|
|
192
189
|
|
|
193
190
|
var getCellProps = function getCellProps(value, record, rowIndex) {
|
|
194
|
-
var prevProps = internals.safeGetCellProps(
|
|
191
|
+
var prevProps = internals.safeGetCellProps(expandCol, record, rowIndex);
|
|
195
192
|
|
|
196
193
|
if (record[treeMetaKey] == null) {
|
|
197
194
|
// 没有 treeMeta 信息的话,就返回原先的 cellProps
|
|
@@ -220,15 +217,16 @@ export function treeMode() {
|
|
|
220
217
|
});
|
|
221
218
|
};
|
|
222
219
|
|
|
223
|
-
|
|
220
|
+
columns[expandColIndex] = _extends(_extends({}, expandCol), {
|
|
224
221
|
title: /*#__PURE__*/React.createElement("span", {
|
|
225
222
|
style: {
|
|
226
223
|
marginLeft: iconIndent + iconWidth + iconGap
|
|
227
224
|
}
|
|
228
|
-
}, internals.safeRenderHeader(
|
|
225
|
+
}, internals.safeRenderHeader(expandCol)),
|
|
229
226
|
render: render,
|
|
230
|
-
getCellProps: clickArea === 'cell' ? getCellProps :
|
|
231
|
-
})
|
|
227
|
+
getCellProps: clickArea === 'cell' ? getCellProps : expandCol.getCellProps
|
|
228
|
+
});
|
|
229
|
+
return _toConsumableArray(columns);
|
|
232
230
|
}
|
|
233
231
|
};
|
|
234
232
|
}
|
|
@@ -36,7 +36,7 @@ export declare class TablePipeline {
|
|
|
36
36
|
private _tableProps;
|
|
37
37
|
private _dataSource;
|
|
38
38
|
private _columns;
|
|
39
|
-
private _footerDataSource
|
|
39
|
+
private _footerDataSource?;
|
|
40
40
|
static defaultIndents: TablePipelineIndentsConfig;
|
|
41
41
|
readonly ctx: TablePipelineCtx;
|
|
42
42
|
private readonly state;
|
|
@@ -88,6 +88,10 @@ export declare class TablePipeline {
|
|
|
88
88
|
setFeatureOptions(optionKey: string, value: any): void;
|
|
89
89
|
/** 获取 BaseTable 的 props,结果中包含 dataSource/columns/primaryKey/getRowProps 四个字段 */
|
|
90
90
|
getProps(this: TablePipeline): TableProps;
|
|
91
|
+
/**
|
|
92
|
+
* 清除范围选中内容
|
|
93
|
+
*/
|
|
94
|
+
clearRangeSelection(): void;
|
|
91
95
|
}
|
|
92
96
|
export declare function useTablePipeline(ctx?: Partial<TablePipelineCtx>): TablePipeline;
|
|
93
97
|
export {};
|
|
@@ -8,6 +8,7 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
|
8
8
|
import { useState, useRef } from 'react';
|
|
9
9
|
import { mergeCellProps } from '../utils';
|
|
10
10
|
import { autoFillTableWidth, tableWidthKey } from './features/autoFill';
|
|
11
|
+
import { rangeSelectionKey } from './features/rangeSelection';
|
|
11
12
|
/**
|
|
12
13
|
* 表格数据处理流水线。TablePipeline 提供了表格数据处理过程中的一些上下方与工具方法,包括……
|
|
13
14
|
*
|
|
@@ -270,25 +271,25 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
270
271
|
var preTableWidth = _this2.getStateAtKey(tableWidthKey);
|
|
271
272
|
|
|
272
273
|
if (preTableWidth !== tableWidth) {
|
|
273
|
-
_this2.setStateAtKey(tableWidthKey, tableWidth);
|
|
274
|
+
tableWidth && _this2.setStateAtKey(tableWidthKey, tableWidth);
|
|
274
275
|
}
|
|
275
276
|
};
|
|
276
277
|
|
|
277
278
|
result.setTableDomHelper = function (domHelper) {
|
|
278
279
|
_this2.ref.current.domHelper = domHelper;
|
|
279
|
-
};
|
|
280
|
-
// result.clearRangeSelectionStatus = () => {
|
|
281
|
-
// const { rangeSelectedChange } = this.getFeatureOptions(rangeSelectionKey)
|
|
282
|
-
// const rangeSelection = this.getStateAtKey(rangeSelectionKey)
|
|
283
|
-
// if (rangeSelection) {
|
|
284
|
-
// rangeSelectedChange?.(null)
|
|
285
|
-
// }
|
|
286
|
-
// }
|
|
287
|
-
// }
|
|
288
|
-
|
|
280
|
+
};
|
|
289
281
|
|
|
290
282
|
return result;
|
|
291
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* 清除范围选中内容
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
}, {
|
|
289
|
+
key: "clearRangeSelection",
|
|
290
|
+
value: function clearRangeSelection() {
|
|
291
|
+
this.setStateAtKey(rangeSelectionKey, null);
|
|
292
|
+
}
|
|
292
293
|
}]);
|
|
293
294
|
|
|
294
295
|
return TablePipeline;
|
|
@@ -5,13 +5,9 @@ import cx from 'classnames';
|
|
|
5
5
|
|
|
6
6
|
function composeEventHandler(handler1, handler2) {
|
|
7
7
|
return function () {
|
|
8
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9
|
-
args[_key] = arguments[_key];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
8
|
// 先执行原有的事件回调函数
|
|
13
|
-
handler1(
|
|
14
|
-
handler2(
|
|
9
|
+
handler1.apply(void 0, arguments);
|
|
10
|
+
handler2.apply(void 0, arguments); // 事件回调函数没有返回值,故这里不进行 return
|
|
15
11
|
};
|
|
16
12
|
}
|
|
17
13
|
/** 合并两个 cellProps(单元格属性)对象,返回一个合并后的全新对象。
|
|
@@ -141,7 +141,7 @@ function HtmlTable(_ref) {
|
|
|
141
141
|
positionStyle.left = hozInfo.stickyLeftMap.get(colIndex);
|
|
142
142
|
} else if (colIndex >= fullFlatCount - rightFlatCount) {
|
|
143
143
|
positionStyle.position = 'sticky';
|
|
144
|
-
positionStyle.right = hozInfo.stickyRightMap.get(colIndex) - stickyRightOffset;
|
|
144
|
+
positionStyle.right = hozInfo.stickyRightMap.get(colIndex) - (typeof stickyRightOffset === 'number' ? stickyRightOffset : 0);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
return /*#__PURE__*/_react.default.createElement('td', (0, _extends2.default)((0, _extends2.default)((0, _extends2.default)((0, _extends2.default)({
|
|
@@ -2,6 +2,7 @@ export declare const LOCK_SHADOW_PADDING = 20;
|
|
|
2
2
|
export declare const Classes: {
|
|
3
3
|
/** BaseTable 表格组件的外层包裹 div */
|
|
4
4
|
readonly artTableWrapper: string;
|
|
5
|
+
readonly artTableBordered: string;
|
|
5
6
|
readonly artTable: string;
|
|
6
7
|
readonly tableHeaderMain: string;
|
|
7
8
|
readonly tableHeader: string;
|
|
@@ -40,6 +41,8 @@ export declare const Classes: {
|
|
|
40
41
|
readonly button: string;
|
|
41
42
|
readonly buttonPrimary: string;
|
|
42
43
|
readonly filterIcon: string;
|
|
44
|
+
readonly rangeSelection: string;
|
|
45
|
+
readonly tableCellRangeSingleCell: string;
|
|
43
46
|
readonly tableCellRangeSelected: string;
|
|
44
47
|
readonly tableCellRangeTop: string;
|
|
45
48
|
readonly tableCellRangeLeft: string;
|
|
@@ -112,13 +115,13 @@ export declare type BaseTableCSSVariables = Partial<{
|
|
|
112
115
|
'--border-color': string;
|
|
113
116
|
/** 单元格边框,默认为 1px solid #dfe3e8 */
|
|
114
117
|
'--cell-border': string;
|
|
115
|
-
/** 单元格上下边框,默认为 #dfe3e8 */
|
|
118
|
+
/** 单元格上下边框,默认为 none ,默认值为 1px solid #dfe3e8 */
|
|
116
119
|
'--cell-border-horizontal': string;
|
|
117
120
|
/** 单元格左右边框,默认为 #dfe3e8 */
|
|
118
121
|
'--cell-border-vertical': string;
|
|
119
122
|
/** 表头单元格边框,默认为 1px solid #dfe3e8 */
|
|
120
123
|
'--header-cell-border': string;
|
|
121
|
-
/** 表头单元格上下边框,默认为 1px solid #dfe3e8 */
|
|
124
|
+
/** 表头单元格上下边框,默认为 none ,默认值为 1px solid #dfe3e8 */
|
|
122
125
|
'--header-cell-border-horizontal': string;
|
|
123
126
|
/** 表头单元格左右边框,默认为 1px solid #dfe3e8 */
|
|
124
127
|
'--header-cell-border-vertical': string;
|
|
@@ -148,7 +151,9 @@ export declare const defaultCSSVariables: {
|
|
|
148
151
|
'--cell-border-horizontal': string;
|
|
149
152
|
'---cell-border-vertical': string;
|
|
150
153
|
'--header-cell-border': string;
|
|
154
|
+
'--cell-border-vertical': string;
|
|
151
155
|
'--header-cell-border-horizontal': string;
|
|
156
|
+
'--header-cell-border-vertical': string;
|
|
152
157
|
};
|
|
153
158
|
export declare const variableConst: string;
|
|
154
159
|
export declare const StyledArtTableWrapper: any;
|
package/lib/table/base/styles.js
CHANGED
|
@@ -21,7 +21,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime-cor
|
|
|
21
21
|
|
|
22
22
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
23
|
|
|
24
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
24
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
25
25
|
|
|
26
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
27
|
|
|
@@ -33,6 +33,7 @@ var prefix = 'kd-';
|
|
|
33
33
|
var Classes = {
|
|
34
34
|
/** BaseTable 表格组件的外层包裹 div */
|
|
35
35
|
artTableWrapper: "".concat(prefix, "table-wrapper"),
|
|
36
|
+
artTableBordered: "".concat(prefix, "table-bordered"),
|
|
36
37
|
artTable: "".concat(prefix, "table"),
|
|
37
38
|
tableHeaderMain: "".concat(prefix, "table-header-main"),
|
|
38
39
|
tableHeader: "".concat(prefix, "table-header"),
|
|
@@ -76,6 +77,8 @@ var Classes = {
|
|
|
76
77
|
button: "".concat(prefix, "btn"),
|
|
77
78
|
buttonPrimary: "".concat(prefix, "btn-primary"),
|
|
78
79
|
filterIcon: "".concat(prefix, "filter-icon"),
|
|
80
|
+
rangeSelection: "".concat(prefix, "range-selection"),
|
|
81
|
+
tableCellRangeSingleCell: "".concat(prefix, "table-cell-range-single-cell"),
|
|
79
82
|
tableCellRangeSelected: "".concat(prefix, "table-cell-range-selected"),
|
|
80
83
|
tableCellRangeTop: "".concat(prefix, "table-cell-range-top"),
|
|
81
84
|
tableCellRangeLeft: "".concat(prefix, "table-cell-range-left"),
|
|
@@ -116,7 +119,7 @@ var Z = {
|
|
|
116
119
|
scrollItem: 30,
|
|
117
120
|
loadingIndicator: 40
|
|
118
121
|
};
|
|
119
|
-
var outerBorderStyleMixin = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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
|
|
122
|
+
var outerBorderStyleMixin = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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);
|
|
120
123
|
var defaultCSSVariables = {
|
|
121
124
|
'--row-height': '48px',
|
|
122
125
|
'--color': '#333',
|
|
@@ -126,7 +129,7 @@ var defaultCSSVariables = {
|
|
|
126
129
|
'--primary-color': '#5582F3',
|
|
127
130
|
'--primary-color-level1': 'rgb(242, 248, 255)',
|
|
128
131
|
'--primary-color-level2': 'rgb(135, 173, 255)',
|
|
129
|
-
'--icon-color': '#
|
|
132
|
+
'--icon-color': '#666666',
|
|
130
133
|
'--strong-border-color': '#d9d9d9',
|
|
131
134
|
'--header-row-height': '32px',
|
|
132
135
|
'--header-color': '#333',
|
|
@@ -142,16 +145,20 @@ var defaultCSSVariables = {
|
|
|
142
145
|
'--cell-border-horizontal': '1px solid #dfe3e8',
|
|
143
146
|
'---cell-border-vertical': '1px solid #dfe3e8',
|
|
144
147
|
'--header-cell-border': '1px solid #dfe3e8',
|
|
145
|
-
'--
|
|
148
|
+
'--cell-border-vertical': '1px solid #dfe3e8',
|
|
149
|
+
'--header-cell-border-horizontal': '1px solid #dfe3e8',
|
|
150
|
+
'--header-cell-border-vertical': '1px solid #dfe3e8'
|
|
146
151
|
};
|
|
147
152
|
exports.defaultCSSVariables = defaultCSSVariables;
|
|
148
153
|
var variableConst = getCssVariableText(defaultCSSVariables);
|
|
149
154
|
exports.variableConst = variableConst;
|
|
155
|
+
var notBorderedStyleMixin = (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n --cell-border-vertical: none;\n --header-cell-border-vertical: none;\n"])));
|
|
156
|
+
var borderedStyleMixin = (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\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);
|
|
150
157
|
|
|
151
|
-
var StyledArtTableWrapper = _styledComponents.default.div(
|
|
158
|
+
var StyledArtTableWrapper = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n :root {\n ", "\n }\n ", "\n\n box-sizing: border-box;\n * {\n box-sizing: border-box;\n }\n cursor: default;\n color: var(--color);\n font-size: var(--font-size);\n line-height: var(--line-height);\n position: relative;\n\n // \u8868\u683C\u5916\u8FB9\u6846\u7531 art-table-wrapper \u63D0\u4F9B\uFF0C\u800C\u4E0D\u662F\u7531\u5355\u5143\u683C\u63D0\u4F9B\n &.use-outer-border {\n ", ";\n }\n\n // \u8868\u683C\u4E0D\u542F\u7528\u8FB9\u6846\u7EBF\uFF0C\u9690\u85CFth\u3001td\u7684\u5355\u5143\u683C\u5DE6\u53F3\u8FB9\u6846\u7EBF\n &:not(.", ") {\n ", "\n }\n &.", "{\n ", "\n }\n\n .no-scrollbar {\n ::-webkit-scrollbar {\n display: none;\n }\n }\n\n .", " {\n overflow: auto;\n flex-shrink: 1;\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n }\n\n .", " {\n overflow: hidden;\n background: var(--header-bgcolor);\n display: flex;\n flex-shrink: 0;\n border-bottom: var(--header-cell-border-horizontal);\n }\n\n .", " {\n display: flex;\n // justify-content: flex-start;\n align-items: center;\n height: inherit;\n }\n\n .", " {\n overflow-x:auto;\n flex-shrink: 0;\n flex-grow: 0;\n scrollbar-width: none; // \u517C\u5BB9\u706B\u72D0\n & {\n ::-webkit-scrollbar {\n display:none;\n }\n }\n }\n\n .", " {\n display: flex;\n flex: none;\n }\n .", ", .", " {\n background: var(--bgcolor);\n overflow: auto;\n overflow-x: hidden;\n overflow-anchor: none;\n position:relative;\n &.empty {\n position: relative;\n }\n }\n\n .", " {\n position: relative;\n }\n .", ", .", " {\n .", "{\n background-color: #e6effb !important;\n }\n .", "{\n border-top: 1px solid #0E5FD8 !important;\n }\n .", "{\n border-left: 1px solid #0E5FD8 !important;\n }\n .", "{\n border-bottom: 1px solid #0E5FD8 !important;\n }\n .", "{\n border-right: 1px solid #0E5FD8 !important;\n }\n }\n \n .", " {\n user-select:none;\n }\n\n\n &.sticky-header .", " {\n position: sticky;\n top: 0;\n z-index: ", ";\n }\n\n &.sticky-footer .", " {\n position: sticky;\n bottom: 0;\n z-index: ", ";\n }\n\n table {\n width: 0;\n table-layout: fixed;\n border-collapse: separate;\n border-spacing: 0;\n display: table;\n margin: 0;\n padding: 0;\n flex-shrink: 0;\n flex-grow: 0;\n position:relative;\n }\n\n // \u5728 tr \u4E0A\u8BBE\u7F6E .no-hover \u53EF\u4EE5\u7981\u7528\u9F20\u6807\u60AC\u505C\u6548\u679C\n tr:not(.no-hover):hover > td {\n background: var(--hover-bgcolor);\n }\n // \u4F7F\u7528 js \u6DFB\u52A0\u60AC\u6D6E\u6548\u679C\n tr:not(.no-hover).row-hover > td {\n background: var(--hover-bgcolor);\n }\n // \u5728 tr \u8BBE\u7F6E highlight \u53EF\u4EE5\u4E3A\u5E95\u4E0B\u7684 td \u8BBE\u7F6E\u4E3A\u9AD8\u4EAE\u8272\n // \u800C\u8BBE\u7F6E .no-highlight \u7684\u8BDD\u5219\u53EF\u4EE5\u7981\u7528\u9AD8\u4EAE\u6548\u679C\uFF1B\n tr:not(.no-highlight).highlight > td {\n background: var(--highlight-bgcolor);\n }\n\n th {\n font-weight: normal;\n text-align: left;\n padding: var(--cell-padding);\n height: var(--header-row-height);\n color: var(--header-color);\n background: var(--header-bgcolor);\n border:1px solid transparent;\n border-right: var(--header-cell-border-vertical);\n border-bottom: var(--header-cell-border-horizontal);\n position: relative;\n }\n\n th.resizeable{\n border-right: var(--header-cell-border-vertical)\n }\n\n th.", " {\n border-right: var(--header-cell-border-vertical);\n border-bottom: none;\n }\n\n tr.", " th {\n border-top: var(--header-cell-border-horizontal);\n }\n th.", " {\n border-left: var(--header-cell-border-vertical);\n }\n\n td {\n padding: var(--cell-padding);\n background: var(--bgcolor);\n height: var(--row-height);\n border:1px solid transparent;\n border-right: var(--cell-border-vertical);\n border-bottom: var(--cell-border-horizontal);\n word-break: break-all;\n }\n td.", " {\n border-left: var(--cell-border-vertical);\n }\n tr.", " td {\n border-top: var(--cell-border-horizontal);\n }\n &.has-header tbody tr.", " td {\n border-top: none;\n }\n &.has-footer tbody tr.", " td {\n border-bottom: none;\n }\n\n .", ",\n .", " {\n z-index: ", ";\n }\n\n //#region \u9501\u5217\u9634\u5F71\n .", " {\n position: absolute;\n top: 0;\n bottom: 0;\n z-index: ", ";\n pointer-events: none;\n overflow: hidden;\n\n .", " {\n height: 100%;\n }\n\n .", " {\n margin-right: ", "px;\n box-shadow: none;\n\n &.show-shadow {\n box-shadow: var(--lock-shadow);\n border-right: var(--cell-border-vertical);\n }\n }\n\n .", " {\n margin-left: ", "px;\n box-shadow: none;\n\n &.show-shadow {\n box-shadow: var(--lock-shadow);\n border-left: var(--cell-border-vertical);\n }\n }\n }\n //#endregion\n\n //#region \u7A7A\u8868\u683C\u5C55\u73B0\n .", " {\n pointer-events: none;\n color: #99a3b3;\n font-size: 12px;\n text-align: center;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n\n .empty-image {\n width: 50px;\n height: 50px;\n }\n\n .empty-tips {\n margin-top: 16px;\n line-height: 1.5;\n }\n }\n //#endregion\n\n //#region IE\u517C\u5BB9\n &.ie-polyfill-wrapper {\n //\u9501\u5B9A\u5217\u517C\u5BB9 \u4EC5\u5728\u9501\u5B9A\u5217\u7684\u60C5\u51B5\u4E0B\u751F\u6548\n .", " {\n overflow-x: hidden;\n }\n .", ", .", " {\n position:relative;\n }\n .", " {\n overflow: hidden;\n }\n .", " {\n position: relative;\n }\n\n .", " {\n overflow: auto;\n overflow-x: hidden;\n overflow-anchor: none;\n }\n\n .", ", .", "{\n position: absolute;\n z-index: ", ";\n top: 0;\n }\n .", "{\n left:0;\n }\n .", "{\n right:0;\n }\n\n .", "{\n .", "{\n position: absolute;\n top: 0;\n width: 100%;\n z-index: ", ";\n }\n }\n\n tr:not(.no-hover).row-hover > td {\n background: var(--hover-bgcolor);\n }\n }\n //#endregion\n\n //#region \u7C98\u6027\u6EDA\u52A8\u6761\n .", " {\n overflow-y: hidden;\n overflow-x: auto;\n z-index: ", ";\n flex-shrink: 0;\n flex-grow: 0;\n border-top: 1px solid var(--border-color);\n background: var(--bgcolor);\n }\n\n .", " {\n // \u5FC5\u987B\u6709\u9AD8\u5EA6\u624D\u80FD\u51FA\u73B0\u6EDA\u52A8\u6761\n height: 1px;\n visibility: hidden;\n }\n //#endregion\n\n //#region \u52A0\u8F7D\u6837\u5F0F\n .", " {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: auto;\n\n .", " {\n filter: none;\n width: 100%;\n height: 100%;\n overflow: hidden;//\u5217\u5168\u90E8\u56FA\u5B9A\u65F6\uFF0C\u5B58\u5728\u53CC\u6A2A\u5411\u6EDA\u52A8\u6761\n display: flex;\n position: relative;\n flex-direction: column;\n }\n\n .", " {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n pointer-events: none;\n }\n\n .", " {\n position: sticky;\n z-index: ", ";\n transform: translateY(-50%);\n }\n }\n //#endregion\n\n //#region \u8868\u683C\u8FC7\u6EE4\n .", " {\n color:var(--icon-color);\n &.active{\n color:var(--primary-color);\n }\n padding: 6px 4px;\n &:hover{\n background-color: #e5e5e5;\n }\n }\n .", " {\n display: flex\n }\n //#endregion\n\n //#region \u8868\u683C\u6392\u5E8F\n .", " {\n color:var(--icon-color);\n &.active{\n color:var(--primary-color);\n }\n }\n //#endregion\n\n //#region \u6EDA\u52A8\u6761\u5360\u4F4D\n .", " {\n visibility: hidden;\n flex-shrink: 0;\n }\n .", " .", " {\n border-top: var(--cell-border-horizontal);\n }\n //#endregion\n \n //#region \u62D6\u62FD\u5217\u5BBD\u5927\u5C0F\n .", "::after{\n background-color: var(--border-color);\n }\n //#endregion\n\n "])), variableConst, variableConst, outerBorderStyleMixin, Classes.artTableBordered, notBorderedStyleMixin, Classes.artTableBordered, borderedStyleMixin, Classes.artTable, Classes.tableHeader, Classes.tableHeaderCellContent, Classes.virtual, Classes.tableFooter, Classes.tableBody, Classes.tableFooter, Classes.tableRow, Classes.tableBody, Classes.tableFooter, Classes.tableCellRangeSelected, Classes.tableCellRangeTop, Classes.tableCellRangeLeft, Classes.tableCellRangeBottom, Classes.tableCellRangeRight, Classes.rangeSelection, Classes.tableHeader, Z.header, Classes.tableFooter, Z.footer, Classes.leaf, Classes.first, Classes.first, Classes.first, Classes.first, Classes.first, Classes.last, Classes.lockLeft, Classes.lockRight, Z.lock, Classes.lockShadowMask, Z.lockShadow, Classes.lockShadow, Classes.leftLockShadow, LOCK_SHADOW_PADDING, Classes.rightLockShadow, LOCK_SHADOW_PADDING, Classes.emptyWrapper, Classes.virtual, Classes.tableBody, Classes.tableFooter, Classes.tableHeaderMain, Classes.tableHeader, Classes.tableFooterMain, Classes.fixedLeft, Classes.fixedRight, Z.lock, Classes.fixedLeft, Classes.fixedRight, Classes.rowDetailContainer, Classes.rowDetailItem, Z.rowDetail, Classes.stickyScroll, Z.scrollItem, Classes.stickyScrollItem, Classes.loadingWrapper, Classes.loadingContentWrapper, Classes.loadingIndicatorWrapper, Classes.loadingIndicator, Z.loadingIndicator, Classes.tableFilterTrigger, Classes.filterIcon, Classes.tableSortIcon, Classes.verticalScrollPlaceholder, Classes.tableFooter, Classes.verticalScrollPlaceholder, Classes.tableHeaderCellResize);
|
|
152
159
|
|
|
153
160
|
exports.StyledArtTableWrapper = StyledArtTableWrapper;
|
|
154
|
-
var ButtonCSS = (0, _styledComponents.css)(
|
|
161
|
+
var ButtonCSS = (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\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);
|
|
155
162
|
exports.ButtonCSS = ButtonCSS;
|
|
156
163
|
|
|
157
164
|
function getCssVariableText(obj) {
|
package/lib/table/base/table.js
CHANGED
|
@@ -31,6 +31,8 @@ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable
|
|
|
31
31
|
|
|
32
32
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
|
33
33
|
|
|
34
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
35
|
+
|
|
34
36
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
35
37
|
|
|
36
38
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
@@ -43,8 +45,6 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
43
45
|
|
|
44
46
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
|
|
45
47
|
|
|
46
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
47
|
-
|
|
48
48
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
49
49
|
|
|
50
50
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -73,8 +73,6 @@ var _styles = require("./styles");
|
|
|
73
73
|
|
|
74
74
|
var _utils = require("./utils");
|
|
75
75
|
|
|
76
|
-
var _cssVarsPonyfill = _interopRequireDefault(require("css-vars-ponyfill"));
|
|
77
|
-
|
|
78
76
|
var _utils2 = require("../utils");
|
|
79
77
|
|
|
80
78
|
var _renderTemplates = _interopRequireDefault(require("./renderTemplates"));
|
|
@@ -93,31 +91,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
93
91
|
|
|
94
92
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
95
93
|
|
|
96
|
-
var cssPolifill = function cssPolifill(_ref) {
|
|
97
|
-
var variables = _ref.variables,
|
|
98
|
-
enableCSSVariables = _ref.enableCSSVariables;
|
|
99
|
-
|
|
100
|
-
// const style = document.createElement('style')
|
|
101
|
-
// style.type = 'text/css'
|
|
102
|
-
// style.innerHTML = '.aaa{ --color: red; }'
|
|
103
|
-
// document.getElementsByTagName('head').item(0).appendChild(style)
|
|
104
|
-
// const variableNames = variableConst.match(/--.*?(?=:)/g)
|
|
105
|
-
// variables = variableNames.map((name) => rootElement.style[name])
|
|
106
|
-
if (enableCSSVariables === false) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
(0, _cssVarsPonyfill.default)({
|
|
111
|
-
// exclude: 'link[href*="semantic-ui"]',
|
|
112
|
-
// onlyLegacy: false,
|
|
113
|
-
// rootElement: rootElement,
|
|
114
|
-
include: 'style[data-styled]',
|
|
115
|
-
variables: (0, _extends2.default)({}, _styles.defaultCSSVariables, variables),
|
|
116
|
-
watch: true,
|
|
117
|
-
silent: true
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
|
|
121
94
|
var propsDotEmptyContentDeprecatedWarned = false;
|
|
122
95
|
|
|
123
96
|
function warnPropsDotEmptyContentIsDeprecated() {
|
|
@@ -526,6 +499,8 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
526
499
|
}, {
|
|
527
500
|
key: "render",
|
|
528
501
|
value: function render() {
|
|
502
|
+
var _cx;
|
|
503
|
+
|
|
529
504
|
// console.log('render table')
|
|
530
505
|
var info = (0, _calculations.calculateRenderInfo)(this);
|
|
531
506
|
this.lastInfo = info;
|
|
@@ -541,28 +516,29 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
541
516
|
isLoading = _this$props6.isLoading,
|
|
542
517
|
getTableProps = _this$props6.getTableProps,
|
|
543
518
|
footerDataSource = _this$props6.footerDataSource,
|
|
544
|
-
components = _this$props6.components
|
|
545
|
-
|
|
519
|
+
components = _this$props6.components,
|
|
520
|
+
bordered = _this$props6.bordered;
|
|
521
|
+
var artTableWrapperClassName = (0, _classnames.default)(_styles.Classes.artTableWrapper, (_cx = {
|
|
546
522
|
'use-outer-border': useOuterBorder,
|
|
547
523
|
empty: dataSource.length === 0,
|
|
548
524
|
lock: info.hasLockColumn,
|
|
549
525
|
'has-header': hasHeader,
|
|
550
526
|
'sticky-header': isStickyHeader !== null && isStickyHeader !== void 0 ? isStickyHeader : isStickyHead,
|
|
551
527
|
'has-footer': footerDataSource.length > 0,
|
|
552
|
-
'sticky-footer': isStickyFooter
|
|
553
|
-
|
|
554
|
-
}, className);
|
|
528
|
+
'sticky-footer': isStickyFooter
|
|
529
|
+
}, (0, _defineProperty2.default)(_cx, _styles.Classes.artTableBordered, bordered), (0, _defineProperty2.default)(_cx, 'ie-polyfill-wrapper', _utils2.browserType.isIE), _cx), className);
|
|
555
530
|
var artTableWrapperProps = (0, _defineProperty2.default)({
|
|
556
531
|
className: artTableWrapperClassName,
|
|
557
532
|
style: style
|
|
558
533
|
}, _utils.STYLED_REF_PROP, this.artTableWrapperRef);
|
|
534
|
+
var tableProps = getTableProps() || {};
|
|
559
535
|
return /*#__PURE__*/_react.default.createElement(_styles.StyledArtTableWrapper, (0, _extends2.default)({}, artTableWrapperProps), /*#__PURE__*/_react.default.createElement(_loading.default, {
|
|
560
536
|
visible: isLoading,
|
|
561
537
|
LoadingIcon: components.LoadingIcon,
|
|
562
538
|
LoadingContentWrapper: components.LoadingContentWrapper
|
|
563
|
-
}, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
|
|
564
|
-
className: _styles.Classes.artTable
|
|
565
|
-
}
|
|
539
|
+
}, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, tableProps, {
|
|
540
|
+
className: (0, _classnames.default)(_styles.Classes.artTable, tableProps.className)
|
|
541
|
+
}), this.renderTableHeader(info), this.renderTableBody(info), this.renderTableFooter(info), this.renderLockShadows(info)), this.renderStickyScroll(info)));
|
|
566
542
|
}
|
|
567
543
|
}, {
|
|
568
544
|
key: "componentDidMount",
|
|
@@ -579,10 +555,12 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
579
555
|
|
|
580
556
|
var _this$props7 = this.props,
|
|
581
557
|
cssVariables = _this$props7.cssVariables,
|
|
582
|
-
enableCSSVariables = _this$props7.enableCSSVariables
|
|
583
|
-
|
|
558
|
+
enableCSSVariables = _this$props7.enableCSSVariables,
|
|
559
|
+
bordered = _this$props7.bordered;
|
|
560
|
+
(0, _utils.cssPolifill)({
|
|
584
561
|
variables: cssVariables || {},
|
|
585
|
-
enableCSSVariables: enableCSSVariables
|
|
562
|
+
enableCSSVariables: enableCSSVariables,
|
|
563
|
+
bordered: bordered
|
|
586
564
|
});
|
|
587
565
|
(_b = (_a = this.props).setTableWidth) === null || _b === void 0 ? void 0 : _b.call(_a, this.domHelper.tableBody.clientWidth);
|
|
588
566
|
(_d = (_c = this.props).setTableDomHelper) === null || _d === void 0 ? void 0 : _d.call(_c, this.domHelper);
|
|
@@ -654,15 +632,15 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
654
632
|
|
|
655
633
|
this.rootSubscription.add((0, _rxjs.combineLatest)([richVisibleRects$.pipe(op.map(function (p) {
|
|
656
634
|
return p.clipRect;
|
|
657
|
-
}), op.distinctUntilChanged(_utils.shallowEqual)), this.props$.pipe(op.startWith(null), op.pairwise(), op.filter(function (
|
|
658
|
-
var
|
|
659
|
-
prevProps =
|
|
660
|
-
props =
|
|
635
|
+
}), op.distinctUntilChanged(_utils.shallowEqual)), this.props$.pipe(op.startWith(null), op.pairwise(), op.filter(function (_ref) {
|
|
636
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
637
|
+
prevProps = _ref2[0],
|
|
638
|
+
props = _ref2[1];
|
|
661
639
|
|
|
662
640
|
return prevProps == null || !prevProps.isLoading && props.isLoading;
|
|
663
|
-
}))]).subscribe(function (
|
|
664
|
-
var
|
|
665
|
-
clipRect =
|
|
641
|
+
}))]).subscribe(function (_ref3) {
|
|
642
|
+
var _ref4 = (0, _slicedToArray2.default)(_ref3, 1),
|
|
643
|
+
clipRect = _ref4[0];
|
|
666
644
|
|
|
667
645
|
var loadingIndicator = _this2.domHelper.getLoadingIndicator();
|
|
668
646
|
|
|
@@ -681,9 +659,9 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
681
659
|
horizontal = _this2$lastInfo$useVi.horizontal,
|
|
682
660
|
vertical = _this2$lastInfo$useVi.vertical;
|
|
683
661
|
return horizontal || vertical;
|
|
684
|
-
}), op.map(function (
|
|
685
|
-
var clipRect =
|
|
686
|
-
offsetY =
|
|
662
|
+
}), op.map(function (_ref5) {
|
|
663
|
+
var clipRect = _ref5.clipRect,
|
|
664
|
+
offsetY = _ref5.offsetY;
|
|
687
665
|
return {
|
|
688
666
|
maxRenderHeight: clipRect.bottom - clipRect.top,
|
|
689
667
|
maxRenderWidth: clipRect.right - clipRect.left,
|
|
@@ -700,9 +678,9 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
700
678
|
})).subscribe(function (sizeAndOffset) {
|
|
701
679
|
_this2.setState(sizeAndOffset);
|
|
702
680
|
}));
|
|
703
|
-
this.rootSubscription.add(richVisibleRects$.pipe(op.map(function (
|
|
704
|
-
var clipRect =
|
|
705
|
-
offsetY =
|
|
681
|
+
this.rootSubscription.add(richVisibleRects$.pipe(op.map(function (_ref6) {
|
|
682
|
+
var clipRect = _ref6.clipRect,
|
|
683
|
+
offsetY = _ref6.offsetY;
|
|
706
684
|
return {
|
|
707
685
|
maxRenderHeight: clipRect.bottom - clipRect.top,
|
|
708
686
|
maxRenderWidth: clipRect.right - clipRect.left,
|
|
@@ -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/lib/table/base/utils.js
CHANGED
|
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
23
23
|
});
|
|
24
24
|
exports.addResizeObserver = exports.STYLED_VERSION = exports.STYLED_REF_PROP = exports.OVERSCAN_SIZE = exports.AUTO_VIRTUAL_THRESHOLD = void 0;
|
|
25
25
|
exports.composeRowPropsGetter = composeRowPropsGetter;
|
|
26
|
+
exports.cssPolifill = void 0;
|
|
26
27
|
exports.getScrollbarSize = getScrollbarSize;
|
|
27
28
|
exports.getTableScrollFooterDOM = getTableScrollFooterDOM;
|
|
28
29
|
exports.getTableScrollHeaderDOM = getTableScrollHeaderDOM;
|
|
@@ -49,10 +50,14 @@ var _resizeObserverPolyfill = _interopRequireDefault(require("resize-observer-po
|
|
|
49
50
|
|
|
50
51
|
var styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
51
52
|
|
|
53
|
+
var _cssVarsPonyfill = _interopRequireDefault(require("css-vars-ponyfill"));
|
|
54
|
+
|
|
52
55
|
var _mergeCellProps = _interopRequireDefault(require("../utils/mergeCellProps"));
|
|
53
56
|
|
|
54
57
|
var _utils = require("../utils");
|
|
55
58
|
|
|
59
|
+
var _styles = require("./styles");
|
|
60
|
+
|
|
56
61
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
57
62
|
|
|
58
63
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -268,4 +273,33 @@ function getTableScrollHeaderDOM(domHelper) {
|
|
|
268
273
|
|
|
269
274
|
function getTableScrollFooterDOM(domHelper) {
|
|
270
275
|
return _utils.browserType.isIE ? domHelper.tableFooterMain : domHelper.tableFooter;
|
|
271
|
-
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
var cssPolifill = function cssPolifill(_ref) {
|
|
279
|
+
var variables = _ref.variables,
|
|
280
|
+
enableCSSVariables = _ref.enableCSSVariables,
|
|
281
|
+
bordered = _ref.bordered;
|
|
282
|
+
|
|
283
|
+
if (enableCSSVariables === false) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
var conditionCSSVariables = {}; // 默认情况下存在td、th无左右边框,开启`bordered`属性后才开启,否则隐藏这两种属性
|
|
288
|
+
|
|
289
|
+
if (!bordered) {
|
|
290
|
+
conditionCSSVariables['--cell-border-vertical'] = 'none';
|
|
291
|
+
conditionCSSVariables['--header-cell-border-vertical'] = 'none';
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
(0, _cssVarsPonyfill.default)({
|
|
295
|
+
// exclude: 'link[href*="semantic-ui"]',
|
|
296
|
+
// onlyLegacy: false,
|
|
297
|
+
// rootElement: rootElement,
|
|
298
|
+
include: 'style[data-styled]',
|
|
299
|
+
variables: (0, _extends2.default)({}, _styles.defaultCSSVariables, variables, conditionCSSVariables),
|
|
300
|
+
watch: true,
|
|
301
|
+
silent: true
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
exports.cssPolifill = cssPolifill;
|