amis 1.10.1-beta.0 → 1.10.2
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/lib/Schema.d.ts +1 -1
- package/lib/Schema.js.map +1 -1
- package/lib/components/Avatar.d.ts +10 -10
- package/lib/components/ListGroup.d.ts +10 -10
- package/lib/components/Range.js +8 -2
- package/lib/components/Range.js.map +2 -2
- package/lib/components/ResultBox.d.ts +41 -40
- package/lib/components/ResultBox.js +23 -19
- package/lib/components/ResultBox.js.map +2 -2
- package/lib/components/Select.js +5 -3
- package/lib/components/Select.js.map +2 -2
- package/lib/components/Steps.d.ts +1 -0
- package/lib/components/Steps.js +8 -6
- package/lib/components/Steps.js.map +2 -2
- package/lib/components/condition-builder/index.d.ts +12 -2
- package/lib/components/condition-builder/index.js +40 -4
- package/lib/components/condition-builder/index.js.map +2 -2
- package/lib/components/formula/Editor.js +1 -1
- package/lib/components/formula/Editor.js.map +2 -2
- package/lib/components/formula/VariableList.js +2 -2
- package/lib/components/formula/VariableList.js.map +2 -2
- package/lib/components/table/index.d.ts +9 -7
- package/lib/components/table/index.js +102 -102
- package/lib/components/table/index.js.map +2 -2
- package/lib/helper.css.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/lib/index.js.map +2 -2
- package/lib/renderers/Action.js +18 -11
- package/lib/renderers/Action.js.map +2 -2
- package/lib/renderers/ButtonGroup.d.ts +2 -2
- package/lib/renderers/ButtonGroup.js.map +1 -1
- package/lib/renderers/CRUD.js +2 -2
- package/lib/renderers/CRUD.js.map +2 -2
- package/lib/renderers/CRUD2.d.ts +213 -0
- package/lib/renderers/CRUD2.js +724 -0
- package/lib/renderers/CRUD2.js.map +13 -0
- package/lib/renderers/Card2.d.ts +1 -1
- package/lib/renderers/Card2.js +1 -2
- package/lib/renderers/Card2.js.map +2 -2
- package/lib/renderers/Cards.d.ts +3 -0
- package/lib/renderers/Cards.js +52 -5
- package/lib/renderers/Cards.js.map +2 -2
- package/lib/renderers/Form/ConditionBuilder.d.ts +10 -0
- package/lib/renderers/Form/ConditionBuilder.js +6 -2
- package/lib/renderers/Form/ConditionBuilder.js.map +2 -2
- package/lib/renderers/Form/DiffEditor.d.ts +66 -20
- package/lib/renderers/Form/Editor.d.ts +66 -20
- package/lib/renderers/Form/Item.d.ts +4 -0
- package/lib/renderers/Form/Item.js +1 -1
- package/lib/renderers/Form/Item.js.map +2 -2
- package/lib/renderers/Form/TreeSelect.d.ts +0 -1
- package/lib/renderers/Form/TreeSelect.js +1 -9
- package/lib/renderers/Form/TreeSelect.js.map +2 -2
- package/lib/renderers/Form/index.js +8 -4
- package/lib/renderers/Form/index.js.map +2 -2
- package/lib/renderers/Icon.d.ts +1 -1
- package/lib/renderers/Icon.js +13 -8
- package/lib/renderers/Icon.js.map +2 -2
- package/lib/renderers/Table/index.d.ts +1 -0
- package/lib/renderers/Table/index.js +19 -5
- package/lib/renderers/Table/index.js.map +2 -2
- package/lib/renderers/Table-v2/index.d.ts +8 -5
- package/lib/renderers/Table-v2/index.js +83 -54
- package/lib/renderers/Table-v2/index.js.map +2 -2
- package/lib/store/combo.d.ts +72 -22
- package/lib/store/crud.d.ts +2 -0
- package/lib/store/crud.js +21 -1
- package/lib/store/crud.js.map +2 -2
- package/lib/store/form.d.ts +30 -9
- package/lib/store/form.js +28 -10
- package/lib/store/form.js.map +2 -2
- package/lib/store/formItem.d.ts +3 -1
- package/lib/store/formItem.js +3 -5
- package/lib/store/formItem.js.map +2 -2
- package/lib/store/list.d.ts +2 -0
- package/lib/store/list.js +8 -0
- package/lib/store/list.js.map +2 -2
- package/lib/store/table.d.ts +60 -18
- package/lib/themes/ang-ie11.css +166 -19
- package/lib/themes/ang.css +166 -19
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +166 -19
- package/lib/themes/antd.css +166 -19
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +166 -19
- package/lib/themes/cxd.css +166 -19
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +166 -19
- package/lib/themes/dark.css +166 -19
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default-ie11.css +166 -19
- package/lib/themes/default.css +166 -19
- package/lib/themes/default.css.map +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/icon.js +7 -0
- package/lib/utils/icon.js.map +2 -2
- package/package.json +1 -1
- package/schema.json +28 -25
- package/scss/_mixins.scss +1 -1
- package/scss/components/_condition-builder.scss +11 -0
- package/scss/components/_crud.scss +8 -3
- package/scss/components/_crud2.scss +148 -0
- package/scss/components/_result-box.scss +27 -8
- package/scss/components/_steps.scss +21 -26
- package/scss/components/_table-v2.scss +1 -3
- package/scss/components/form/_select.scss +4 -0
- package/scss/themes/_common.scss +1 -0
- package/sdk/ang-ie11.css +203 -20
- package/sdk/ang.css +203 -20
- package/sdk/antd-ie11.css +203 -20
- package/sdk/antd.css +203 -20
- package/sdk/barcode.js +51 -51
- package/sdk/charts.js +14 -14
- package/sdk/codemirror.js +7 -7
- package/sdk/color-picker.js +65 -65
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +203 -20
- package/sdk/cxd.css +203 -20
- package/sdk/dark-ie11.css +203 -20
- package/sdk/dark.css +203 -20
- package/sdk/exceljs.js +1 -1
- package/sdk/helper.css.map +1 -1
- package/sdk/markdown.js +69 -69
- package/sdk/papaparse.js +1 -1
- package/sdk/renderers/Form/CityDB.js +1 -1
- package/sdk/rest.js +16 -16
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +203 -20
- package/sdk/sdk.css +203 -20
- package/sdk/sdk.js +1344 -1340
- package/sdk/thirds/hls.js/hls.js +1 -1
- package/sdk/thirds/mpegts.js/mpegts.js +1 -1
- package/sdk/tinymce.js +57 -57
- package/src/Schema.ts +1 -0
- package/src/components/Range.tsx +14 -7
- package/src/components/ResultBox.tsx +65 -54
- package/src/components/Select.tsx +6 -5
- package/src/components/Steps.tsx +60 -18
- package/src/components/condition-builder/index.tsx +107 -8
- package/src/components/formula/Editor.tsx +1 -1
- package/src/components/formula/VariableList.tsx +2 -2
- package/src/components/table/index.tsx +190 -193
- package/src/index.tsx +1 -0
- package/src/renderers/Action.tsx +22 -11
- package/src/renderers/ButtonGroup.tsx +2 -2
- package/src/renderers/CRUD.tsx +2 -1
- package/src/renderers/CRUD2.tsx +1213 -0
- package/src/renderers/Card2.tsx +2 -3
- package/src/renderers/Cards.tsx +55 -10
- package/src/renderers/Form/ConditionBuilder.tsx +19 -2
- package/src/renderers/Form/Item.tsx +11 -1
- package/src/renderers/Form/TreeSelect.tsx +14 -16
- package/src/renderers/Form/index.tsx +11 -2
- package/src/renderers/Icon.tsx +8 -1
- package/src/renderers/Table/index.tsx +21 -5
- package/src/renderers/Table-v2/index.tsx +92 -72
- package/src/store/crud.ts +23 -1
- package/src/store/form.ts +31 -24
- package/src/store/formItem.ts +65 -52
- package/src/store/list.ts +10 -0
- package/src/types.ts +2 -1
- package/src/utils/icon.tsx +9 -0
|
@@ -157,7 +157,6 @@ var Table = /** @class */ (function (_super) {
|
|
|
157
157
|
colWidths: [],
|
|
158
158
|
hoverRow: null
|
|
159
159
|
};
|
|
160
|
-
_this.onTableContentScroll = _this.onTableContentScroll.bind(_this);
|
|
161
160
|
_this.getPopOverContainer = _this.getPopOverContainer.bind(_this);
|
|
162
161
|
return _this;
|
|
163
162
|
}
|
|
@@ -191,6 +190,9 @@ var Table = /** @class */ (function (_super) {
|
|
|
191
190
|
Table.prototype.updateTableBodyFixed = function () {
|
|
192
191
|
var tbodyDom = this.tbodyDom && this.tbodyDom.current;
|
|
193
192
|
var tdColumns = (0, tslib_1.__spreadArray)([], this.tdColumns, true);
|
|
193
|
+
if (!tbodyDom) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
194
196
|
this.updateTbodyFixedRow(tbodyDom, tdColumns);
|
|
195
197
|
this.updateHeadSummaryFixedRow(tbodyDom);
|
|
196
198
|
};
|
|
@@ -205,12 +207,7 @@ var Table = /** @class */ (function (_super) {
|
|
|
205
207
|
}
|
|
206
208
|
});
|
|
207
209
|
};
|
|
208
|
-
Table.prototype.
|
|
209
|
-
var _this = this;
|
|
210
|
-
var _a, _b;
|
|
211
|
-
if (this.props.loading) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
210
|
+
Table.prototype.updateTableFixedRows = function () {
|
|
214
211
|
if (hasFixedColumn(this.props.columns)) {
|
|
215
212
|
var headerDom = this.headerDom && this.headerDom.current;
|
|
216
213
|
if (headerDom) {
|
|
@@ -222,13 +219,16 @@ var Table = /** @class */ (function (_super) {
|
|
|
222
219
|
var tfootDom = this.tfootDom && this.tfootDom.current;
|
|
223
220
|
tfootDom && this.updateFootSummaryFixedRow(tfootDom);
|
|
224
221
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
222
|
+
};
|
|
223
|
+
Table.prototype.componentDidMount = function () {
|
|
224
|
+
var _this = this;
|
|
225
|
+
var _a, _b;
|
|
226
|
+
if (this.props.loading) {
|
|
227
|
+
return;
|
|
229
228
|
}
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
this.updateTableFixedRows();
|
|
230
|
+
var current = (_a = this.contentDom) === null || _a === void 0 ? void 0 : _a.current;
|
|
231
|
+
if ((_b = this.headerDom) === null || _b === void 0 ? void 0 : _b.current) {
|
|
232
232
|
// overflow设置为hidden的情况
|
|
233
233
|
var hiddenDomRefs = [this.headerDom, this.footDom];
|
|
234
234
|
hiddenDomRefs.forEach(function (ref) {
|
|
@@ -236,21 +236,11 @@ var Table = /** @class */ (function (_super) {
|
|
|
236
236
|
ref.current &&
|
|
237
237
|
ref.current.addEventListener('wheel', _this.onWheel.bind(_this));
|
|
238
238
|
});
|
|
239
|
-
// 横向同步滚动
|
|
240
|
-
var scrollDomRefs = [this.bodyDom];
|
|
241
|
-
scrollDomRefs.forEach(function (ref) {
|
|
242
|
-
return ref &&
|
|
243
|
-
ref.current &&
|
|
244
|
-
ref.current.addEventListener('scroll', _this.onTableScroll.bind(_this));
|
|
245
|
-
});
|
|
246
239
|
}
|
|
247
240
|
current && this.updateTableDom(current);
|
|
248
241
|
if (this.props.draggable) {
|
|
249
242
|
this.initDragging();
|
|
250
243
|
}
|
|
251
|
-
if (this.props.resizable) {
|
|
252
|
-
(_b = this.theadDom.current) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseup', this.onResizeMouseUp.bind(this));
|
|
253
|
-
}
|
|
254
244
|
this.updateStickyHeader();
|
|
255
245
|
this.updateColWidths();
|
|
256
246
|
};
|
|
@@ -260,7 +250,14 @@ var Table = /** @class */ (function (_super) {
|
|
|
260
250
|
// 数据源发生了变化
|
|
261
251
|
if (!(0, isEqual_1.default)(prevProps.dataSource, this.props.dataSource)) {
|
|
262
252
|
this.setState({ dataSource: (0, tslib_1.__spreadArray)([], this.props.dataSource, true) }, function () {
|
|
263
|
-
|
|
253
|
+
if (_this.props.draggable) {
|
|
254
|
+
if (_this.sortable) {
|
|
255
|
+
_this.destroyDragging();
|
|
256
|
+
}
|
|
257
|
+
_this.initDragging();
|
|
258
|
+
}
|
|
259
|
+
_this.updateTableFixedRows();
|
|
260
|
+
_this.updateColWidths();
|
|
264
261
|
}); // 异步加载数据需求再更新一次
|
|
265
262
|
}
|
|
266
263
|
// 选择项发生了变化触发
|
|
@@ -316,21 +313,12 @@ var Table = /** @class */ (function (_super) {
|
|
|
316
313
|
};
|
|
317
314
|
Table.prototype.componentWillUnmount = function () {
|
|
318
315
|
var _this = this;
|
|
319
|
-
this.contentDom &&
|
|
320
|
-
this.contentDom.current &&
|
|
321
|
-
this.contentDom.current.removeEventListener('scroll', this.onTableContentScroll.bind(this));
|
|
322
316
|
var hiddenDomRefs = [this.headerDom, this.footDom];
|
|
323
317
|
hiddenDomRefs.forEach(function (ref) {
|
|
324
318
|
return ref &&
|
|
325
319
|
ref.current &&
|
|
326
320
|
ref.current.removeEventListener('wheel', _this.onWheel.bind(_this));
|
|
327
321
|
});
|
|
328
|
-
var scrollDomRefs = [this.bodyDom];
|
|
329
|
-
scrollDomRefs.forEach(function (ref) {
|
|
330
|
-
return ref &&
|
|
331
|
-
ref.current &&
|
|
332
|
-
ref.current.removeEventListener('scroll', _this.onTableScroll.bind(_this));
|
|
333
|
-
});
|
|
334
322
|
this.destroyDragging();
|
|
335
323
|
};
|
|
336
324
|
Table.prototype.initDragging = function () {
|
|
@@ -365,7 +353,8 @@ var Table = /** @class */ (function (_super) {
|
|
|
365
353
|
return [2 /*return*/];
|
|
366
354
|
}
|
|
367
355
|
rowLevels = e.item.getAttribute('row-levels');
|
|
368
|
-
onDrag &&
|
|
356
|
+
onDrag &&
|
|
357
|
+
onDrag(e.oldIndex, e.newIndex, rowLevels ? rowLevels.split(',') : []);
|
|
369
358
|
return [2 /*return*/];
|
|
370
359
|
});
|
|
371
360
|
}); }
|
|
@@ -373,6 +362,7 @@ var Table = /** @class */ (function (_super) {
|
|
|
373
362
|
};
|
|
374
363
|
Table.prototype.destroyDragging = function () {
|
|
375
364
|
this.sortable && this.sortable.destroy();
|
|
365
|
+
this.sortable = null;
|
|
376
366
|
};
|
|
377
367
|
Table.prototype.updateStickyHeader = function () {
|
|
378
368
|
var _this = this;
|
|
@@ -513,69 +503,54 @@ var Table = /** @class */ (function (_super) {
|
|
|
513
503
|
})));
|
|
514
504
|
};
|
|
515
505
|
Table.prototype.onResizeMouseDown = function (event, key) {
|
|
506
|
+
var _a;
|
|
516
507
|
// 点击记录起始坐标
|
|
517
508
|
this.resizeStart = event.clientX;
|
|
518
|
-
// 记录点击的列名
|
|
519
509
|
this.resizeKey = key;
|
|
510
|
+
var index = this.tdColumns.findIndex(function (c) { return c.key === key; }) + this.getExtraColumnCount();
|
|
511
|
+
var colGroup = (_a = this.tableDom.current) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('colgroup')[0];
|
|
512
|
+
var currentWidth = 0;
|
|
513
|
+
var child = null;
|
|
514
|
+
if (colGroup && colGroup.children[index]) {
|
|
515
|
+
child = colGroup.children[index];
|
|
516
|
+
currentWidth = child.offsetWidth;
|
|
517
|
+
}
|
|
518
|
+
this.resizeWidth = currentWidth;
|
|
519
|
+
this.resizeTarget = child;
|
|
520
|
+
if (colGroup) {
|
|
521
|
+
var maxDistance = 0;
|
|
522
|
+
for (var i = 0; i < colGroup.children.length; i++) {
|
|
523
|
+
var child_1 = colGroup.children[i];
|
|
524
|
+
// 自适应列 保证有一个最小宽度
|
|
525
|
+
// 如果都设置了固定宽度 那一个都拖不动
|
|
526
|
+
if (!this.tdColumns[i].width) {
|
|
527
|
+
maxDistance += child_1.offsetWidth - DefaultCellWidth;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
this.resizeMaxDistance = maxDistance;
|
|
531
|
+
}
|
|
532
|
+
document.addEventListener('mousemove', this.onResizeMouseMove);
|
|
533
|
+
document.addEventListener('mouseup', this.onResizeMouseUp);
|
|
520
534
|
event && event.stopPropagation();
|
|
521
535
|
};
|
|
522
|
-
Table.prototype.
|
|
536
|
+
Table.prototype.onResizeMouseMove = function (event) {
|
|
523
537
|
var _this = this;
|
|
524
|
-
var _a;
|
|
525
538
|
// 点击了调整列宽
|
|
526
|
-
if (this.resizeStart && this.
|
|
539
|
+
if (this.resizeStart && this.resizeTarget) {
|
|
527
540
|
// 计算横向移动距离
|
|
528
541
|
var distance = event.clientX - this.resizeStart;
|
|
529
542
|
var tdColumns = (0, tslib_1.__spreadArray)([], this.tdColumns, true);
|
|
530
|
-
var index = tdColumns.findIndex(function (c) { return c.key === _this.resizeKey; }) +
|
|
531
|
-
this.getExtraColumnCount();
|
|
532
|
-
var colGroup = (_a = this.tableDom.current) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('colgroup')[0];
|
|
533
|
-
var currentWidth = 0;
|
|
534
|
-
if (colGroup && colGroup.children[index]) {
|
|
535
|
-
var child = colGroup.children[index];
|
|
536
|
-
currentWidth = child.offsetWidth;
|
|
537
|
-
}
|
|
538
543
|
var newWidth = 0;
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
if (colGroup.children[index]) {
|
|
552
|
-
var child = colGroup.children[index];
|
|
553
|
-
newWidth = currentWidth + Math.min(distance, maxDistance);
|
|
554
|
-
child.style.width = newWidth + 'px';
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
else {
|
|
558
|
-
// 缩短列
|
|
559
|
-
var autoColumns = [];
|
|
560
|
-
for (var i = 0; i < colGroup.children.length; i++) {
|
|
561
|
-
var child = colGroup.children[i];
|
|
562
|
-
// 自适应列 保证有一个最小宽度
|
|
563
|
-
// 如果都设置了固定宽度 那一个都拖不动
|
|
564
|
-
if (!this.tdColumns[i].width) {
|
|
565
|
-
autoColumns.push(child);
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
maxDistance = DefaultCellWidth - currentWidth;
|
|
569
|
-
if (colGroup.children[index]) {
|
|
570
|
-
var child = colGroup.children[index];
|
|
571
|
-
newWidth = currentWidth + Math.max(distance, maxDistance);
|
|
572
|
-
child.style.width = newWidth + 'px';
|
|
573
|
-
}
|
|
574
|
-
var gap_1 = Math.abs(Math.max(distance, maxDistance)) / autoColumns.length;
|
|
575
|
-
autoColumns.forEach(function (c) {
|
|
576
|
-
c.style.width = c.offsetWidth + gap_1 + 'px';
|
|
577
|
-
});
|
|
578
|
-
}
|
|
544
|
+
// 调宽列
|
|
545
|
+
if (distance > 0) {
|
|
546
|
+
newWidth =
|
|
547
|
+
this.resizeWidth + Math.min(distance, this.resizeMaxDistance);
|
|
548
|
+
this.resizeTarget.style.width = newWidth + 'px';
|
|
549
|
+
}
|
|
550
|
+
else {
|
|
551
|
+
// 缩短列
|
|
552
|
+
newWidth = Math.max(this.resizeWidth + distance, DefaultCellWidth);
|
|
553
|
+
this.resizeTarget.style.width = newWidth + 'px';
|
|
579
554
|
}
|
|
580
555
|
var column = (0, find_1.default)(tdColumns, function (c) { return c.key === _this.resizeKey; });
|
|
581
556
|
// 只有通过配置设置过的宽度保存到tdColumns
|
|
@@ -585,11 +560,18 @@ var Table = /** @class */ (function (_super) {
|
|
|
585
560
|
column.width = newWidth;
|
|
586
561
|
}
|
|
587
562
|
this.tdColumns = tdColumns;
|
|
588
|
-
this.resizeStart = 0;
|
|
589
|
-
this.resizeKey = '';
|
|
590
563
|
}
|
|
591
564
|
event && event.stopPropagation();
|
|
592
565
|
};
|
|
566
|
+
Table.prototype.onResizeMouseUp = function (event) {
|
|
567
|
+
document.removeEventListener('mousemove', this.onResizeMouseMove);
|
|
568
|
+
document.removeEventListener('mouseup', this.onResizeMouseUp);
|
|
569
|
+
this.resizeStart = 0;
|
|
570
|
+
this.resizeKey = '';
|
|
571
|
+
this.resizeWidth = 0;
|
|
572
|
+
this.resizeTarget = null;
|
|
573
|
+
this.resizeMaxDistance = 0;
|
|
574
|
+
};
|
|
593
575
|
Table.prototype.renderTHead = function () {
|
|
594
576
|
var _this = this;
|
|
595
577
|
var _a = this.props, rowSelection = _a.rowSelection, dataSource = _a.dataSource, cx = _a.classnames, onSort = _a.onSort, expandable = _a.expandable, draggable = _a.draggable, resizable = _a.resizable, onSelectAll = _a.onSelectAll, onFilter = _a.onFilter;
|
|
@@ -744,7 +726,8 @@ var Table = /** @class */ (function (_super) {
|
|
|
744
726
|
}
|
|
745
727
|
this.setState({ hoverRow: { target: target, rowIndex: rowIndex, record: record } }, function () {
|
|
746
728
|
if (onRow) {
|
|
747
|
-
onRow.onRowMouseEnter &&
|
|
729
|
+
onRow.onRowMouseEnter &&
|
|
730
|
+
onRow.onRowMouseEnter(event, record, rowIndex);
|
|
748
731
|
}
|
|
749
732
|
});
|
|
750
733
|
}
|
|
@@ -900,7 +883,8 @@ var Table = /** @class */ (function (_super) {
|
|
|
900
883
|
var isExpanded = !!(0, find_1.default)(this.state.expandedRowKeys, function (key) { return key == data[_this.getExpandableKeyField()]; }); // == 匹配 否则'3'、3匹配不上
|
|
901
884
|
// 设置缩进效果
|
|
902
885
|
var indentDom = levels.length > 0 ? (react_1.default.createElement("span", { className: cx('Table-row-indent', "indent-level-".concat(levels.length)), style: levels.length > 0
|
|
903
|
-
? { paddingLeft:
|
|
886
|
+
? { paddingLeft: indentSize * levels.length + 'px' }
|
|
887
|
+
: {} })) : null;
|
|
904
888
|
var cells = tdColumns.map(function (item, i) {
|
|
905
889
|
var _a, _b;
|
|
906
890
|
var render = item.render && typeof item.render === 'function'
|
|
@@ -917,13 +901,14 @@ var Table = /** @class */ (function (_super) {
|
|
|
917
901
|
}
|
|
918
902
|
}
|
|
919
903
|
var className = typeof item.className === 'function'
|
|
920
|
-
? item.className(data, rowIndex)
|
|
904
|
+
? item.className(data, rowIndex)
|
|
905
|
+
: '';
|
|
921
906
|
return props.rowSpan === 0 || props.colSpan === 0 ? null : (react_1.default.createElement(Cell_1.default, (0, tslib_1.__assign)({ key: i }, props, { fixed: item.fixed === true ? 'left' : item.fixed, column: item, groupId: item.groupId, className: cx((_a = {},
|
|
922
907
|
_a["".concat(className)] = !!className,
|
|
923
908
|
_a)) }),
|
|
924
909
|
react_1.default.createElement("div", { className: cx('Table-cell-wrapper', (_b = {},
|
|
925
910
|
_b[cx('Table-cell-wrapper-prefix')] = i === 0 &&
|
|
926
|
-
(!!indentDom || levels.length === 0 && hasChildrenRow),
|
|
911
|
+
(!!indentDom || (levels.length === 0 && hasChildrenRow)),
|
|
927
912
|
_b[cx("Table-cell-height-".concat(lineHeight))] = !!lineHeight,
|
|
928
913
|
_b)) },
|
|
929
914
|
i === 0 && levels.length > 0 ? indentDom : null,
|
|
@@ -965,7 +950,7 @@ var Table = /** @class */ (function (_super) {
|
|
|
965
950
|
draggable ? (react_1.default.createElement(Cell_1.default, { className: cx('Table-dragCell') },
|
|
966
951
|
react_1.default.createElement(icons_1.Icon, { icon: "drag-bar", className: "icon" }))) : null,
|
|
967
952
|
!draggable && rowSelection ? (react_1.default.createElement(Cell_1.default, { fixed: rowSelection.fixed ? 'left' : '', className: cx('Table-checkCell') },
|
|
968
|
-
react_1.default.createElement(Checkbox_1.default, (0, tslib_1.__assign)({ name: 'Table-checkbox', type: rowSelection.type || 'checkbox', partial: !isRadio && hasChildrenChecked && !isChecked, checked: isRadio ? isChecked :
|
|
953
|
+
react_1.default.createElement(Checkbox_1.default, (0, tslib_1.__assign)({ name: 'Table-checkbox', type: rowSelection.type || 'checkbox', partial: !isRadio && hasChildrenChecked && !isChecked, checked: isRadio ? isChecked : hasChildrenChecked || isChecked, onChange: function (value, shift) {
|
|
969
954
|
if (!(rowSelection && rowSelection.rowClick)) {
|
|
970
955
|
_this.selectedSingleRow(value, data);
|
|
971
956
|
}
|
|
@@ -992,7 +977,9 @@ var Table = /** @class */ (function (_super) {
|
|
|
992
977
|
react_1.default.createElement(Cell_1.default, { colSpan: tdColumns.length + colCount },
|
|
993
978
|
react_1.default.createElement("div", { className: cx('Table-empty') }, typeof placeholder === 'function'
|
|
994
979
|
? placeholder()
|
|
995
|
-
: placeholder)))) : (this.state.dataSource.map(function (data, index) {
|
|
980
|
+
: placeholder)))) : (this.state.dataSource.map(function (data, index) {
|
|
981
|
+
return _this.renderRow(data, index, []);
|
|
982
|
+
}))));
|
|
996
983
|
};
|
|
997
984
|
Table.prototype.isExpandableTable = function () {
|
|
998
985
|
var expandable = this.props.expandable;
|
|
@@ -1106,10 +1093,10 @@ var Table = /** @class */ (function (_super) {
|
|
|
1106
1093
|
// 设置了横向滚动轴 则table的table-layout为fixed
|
|
1107
1094
|
var hasScrollX = scroll && scroll.x;
|
|
1108
1095
|
var hoverRow = this.state.hoverRow;
|
|
1109
|
-
return (react_1.default.createElement("div", { ref: this.contentDom, className: cx('Table-content'), style: hasScrollX ? { overflow: 'auto hidden' } : {}, onMouseLeave: this.onMouseLeave.bind(this) },
|
|
1110
|
-
itemActions && hoverRow
|
|
1111
|
-
?
|
|
1112
|
-
|
|
1096
|
+
return (react_1.default.createElement("div", { ref: this.contentDom, className: cx('Table-content'), style: hasScrollX ? { overflow: 'auto hidden' } : {}, onMouseLeave: this.onMouseLeave.bind(this), onScroll: this.onTableContentScroll.bind(this) },
|
|
1097
|
+
itemActions && hoverRow ? (react_1.default.createElement(ItemActionsWrapper_1.default, { dom: hoverRow.target, classnames: cx }, typeof itemActions === 'function'
|
|
1098
|
+
? itemActions(hoverRow.record, hoverRow.rowIndex)
|
|
1099
|
+
: null)) : null,
|
|
1113
1100
|
react_1.default.createElement("table", { style: hasScrollX
|
|
1114
1101
|
? { width: scroll.x + 'px', tableLayout: 'fixed' }
|
|
1115
1102
|
: { tableLayout: 'auto' }, className: cx('Table-table') },
|
|
@@ -1156,10 +1143,10 @@ var Table = /** @class */ (function (_super) {
|
|
|
1156
1143
|
});
|
|
1157
1144
|
}
|
|
1158
1145
|
var hoverRow = this.state.hoverRow;
|
|
1159
|
-
return (react_1.default.createElement("div", { ref: this.bodyDom, className: cx('Table-body'), style: style, onMouseLeave: this.onMouseLeave.bind(this) },
|
|
1160
|
-
itemActions && hoverRow
|
|
1161
|
-
?
|
|
1162
|
-
|
|
1146
|
+
return (react_1.default.createElement("div", { ref: this.bodyDom, className: cx('Table-body'), style: style, onMouseLeave: this.onMouseLeave.bind(this), onScroll: this.onTableScroll.bind(this) },
|
|
1147
|
+
itemActions && hoverRow ? (react_1.default.createElement(ItemActionsWrapper_1.default, { dom: hoverRow.target, classnames: cx }, typeof itemActions === 'function'
|
|
1148
|
+
? itemActions(hoverRow.record, hoverRow.rowIndex)
|
|
1149
|
+
: null)) : null,
|
|
1163
1150
|
react_1.default.createElement("table", { className: cx('Table-table'), style: tableStyle },
|
|
1164
1151
|
this.renderColGroup(),
|
|
1165
1152
|
this.renderTBody())));
|
|
@@ -1199,6 +1186,7 @@ var Table = /** @class */ (function (_super) {
|
|
|
1199
1186
|
hasScrollY || sticky ? (this.renderScrollTable()) : (react_1.default.createElement("div", { className: cx('Table-container') }, this.renderTable())),
|
|
1200
1187
|
footer ? (react_1.default.createElement("div", { className: cx('Table-footer') }, typeof footer === 'function' ? footer() : footer)) : null));
|
|
1201
1188
|
};
|
|
1189
|
+
var _a;
|
|
1202
1190
|
Table.defaultProps = {
|
|
1203
1191
|
title: '',
|
|
1204
1192
|
className: '',
|
|
@@ -1208,6 +1196,18 @@ var Table = /** @class */ (function (_super) {
|
|
|
1208
1196
|
placeholder: '暂无数据',
|
|
1209
1197
|
showHeader: true
|
|
1210
1198
|
};
|
|
1199
|
+
(0, tslib_1.__decorate)([
|
|
1200
|
+
helper_1.autobind,
|
|
1201
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
|
1202
|
+
(0, tslib_1.__metadata)("design:paramtypes", [Object]),
|
|
1203
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
|
1204
|
+
], Table.prototype, "onResizeMouseMove", null);
|
|
1205
|
+
(0, tslib_1.__decorate)([
|
|
1206
|
+
helper_1.autobind,
|
|
1207
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
|
1208
|
+
(0, tslib_1.__metadata)("design:paramtypes", [typeof (_a = typeof MouseEvent !== "undefined" && MouseEvent) === "function" ? _a : Object]),
|
|
1209
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
|
1210
|
+
], Table.prototype, "onResizeMouseUp", null);
|
|
1211
1211
|
return Table;
|
|
1212
1212
|
}(react_1.default.PureComponent));
|
|
1213
1213
|
exports.Table = Table;
|