amis-core 3.2.0 → 3.3.0
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/esm/Root.js +1 -1
- package/esm/RootRenderer.d.ts +1 -1
- package/esm/RootRenderer.js +3 -3
- package/esm/SchemaRenderer.js +5 -2
- package/esm/Scoped.d.ts +4 -1
- package/esm/Scoped.js +8 -5
- package/esm/StatusScoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- package/esm/actions/Action.d.ts +1 -0
- package/esm/actions/Action.js +62 -37
- package/esm/actions/AjaxAction.d.ts +6 -8
- package/esm/actions/AjaxAction.js +20 -18
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.d.ts +1 -2
- package/esm/actions/CmptAction.js +46 -31
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +2 -2
- package/esm/actions/DialogAction.js +5 -6
- package/esm/actions/DrawerAction.js +4 -4
- package/esm/actions/EmailAction.js +1 -1
- package/esm/actions/LinkAction.js +1 -1
- package/esm/actions/LoopAction.js +1 -1
- package/esm/actions/PageAction.js +1 -1
- package/esm/actions/ParallelAction.js +1 -1
- package/esm/actions/StatusAction.d.ts +15 -0
- package/esm/actions/StatusAction.js +49 -0
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/actions/index.d.ts +1 -0
- package/esm/components/CustomStyle.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +2 -2
- package/esm/components/PopOver.js +2 -2
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +2 -2
- package/esm/index.d.ts +2 -1
- package/esm/index.js +13 -13
- package/esm/locale.js +1 -1
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.d.ts +6 -6
- package/esm/renderers/Form.js +168 -124
- package/esm/renderers/Item.d.ts +42 -66
- package/esm/renderers/Item.js +11 -41
- package/esm/renderers/Options.js +1 -2
- package/esm/renderers/Placeholder.js +1 -1
- package/esm/renderers/builtin.js +1 -1
- package/esm/renderers/register.js +1 -1
- package/esm/renderers/wrapControl.js +101 -47
- package/esm/store/app.js +8 -4
- package/esm/store/combo.d.ts +444 -1912
- package/esm/store/combo.js +9 -2
- package/esm/store/crud.d.ts +1 -0
- package/esm/store/crud.js +11 -5
- package/esm/store/form.d.ts +132 -892
- package/esm/store/form.js +83 -81
- package/esm/store/formItem.d.ts +5 -2
- package/esm/store/formItem.js +13 -2
- package/esm/store/iRenderer.js +2 -2
- package/esm/store/index.js +1 -1
- package/esm/store/list.js +1 -1
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.js +1 -1
- package/esm/store/root.js +2 -2
- package/esm/store/service.js +4 -4
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +503 -2040
- package/esm/store/table.js +79 -55
- package/esm/store/table2.d.ts +49 -0
- package/esm/store/table2.js +37 -4
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +17 -3
- package/esm/utils/Animation.js +1 -1
- package/esm/utils/ColorScale.js +1 -1
- package/esm/utils/DataSchema.js +1 -1
- package/esm/utils/DataScope.js +1 -1
- package/esm/utils/RootClose.js +1 -1
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/api.d.ts +2 -2
- package/esm/utils/api.js +113 -81
- package/esm/utils/arraySlice.js +1 -1
- package/esm/utils/attachmentAdpator.js +1 -1
- package/esm/utils/autobind.js +1 -1
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/dataMapping.js +4 -2
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.d.ts +2 -0
- package/esm/utils/debug.js +34 -7
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.js +1 -1
- package/esm/utils/errors.js +1 -1
- package/esm/utils/escapeHtml.js +1 -1
- package/esm/utils/filter-schema.js +1 -1
- package/esm/utils/filter.js +1 -1
- package/esm/utils/formatDuration.js +1 -1
- package/esm/utils/formula.d.ts +0 -1
- package/esm/utils/formula.js +6 -9
- package/esm/utils/getVariable.js +1 -1
- package/esm/utils/grammar.js +1 -1
- package/esm/utils/handleAction.js +1 -1
- package/esm/utils/helper.d.ts +11 -1
- package/esm/utils/helper.js +14 -2
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.d.ts +4 -2
- package/esm/utils/icon.js +3 -2
- package/esm/utils/image.js +1 -1
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/isPureVariable.js +1 -1
- package/esm/utils/json-schema-2-amis-schema.js +1 -1
- package/esm/utils/keyToPath.js +1 -1
- package/esm/utils/makeSorter.js +1 -1
- package/esm/utils/math.d.ts +3 -0
- package/esm/utils/math.js +52 -0
- package/esm/utils/memoryParse.js +1 -1
- package/esm/utils/normalizeLink.js +1 -1
- package/esm/utils/normalizeOptions.js +1 -1
- package/esm/utils/object.d.ts +7 -0
- package/esm/utils/object.js +13 -2
- package/esm/utils/offset.js +1 -1
- package/esm/utils/offsetParent.js +1 -1
- package/esm/utils/optionValueCompare.js +2 -2
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.js +1 -1
- package/esm/utils/renderer-event.d.ts +1 -1
- package/esm/utils/renderer-event.js +14 -6
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.js +1 -1
- package/esm/utils/resolveCondition.js +1 -1
- package/esm/utils/resolveVariable.js +1 -1
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.js +1 -1
- package/esm/utils/scrollPosition.js +1 -1
- package/esm/utils/string2regExp.js +1 -1
- package/esm/utils/stripNumber.js +1 -1
- package/esm/utils/style-helper.js +1 -1
- package/esm/utils/style.js +1 -1
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.js +1 -1
- package/esm/utils/tpl-builtin.js +1 -1
- package/esm/utils/tpl-lodash.js +1 -1
- package/esm/utils/tpl.js +1 -1
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.js +1 -1
- package/lib/Root.js +10 -7
- package/lib/RootRenderer.d.ts +1 -1
- package/lib/RootRenderer.js +11 -8
- package/lib/SchemaRenderer.js +12 -6
- package/lib/Scoped.d.ts +4 -1
- package/lib/Scoped.js +18 -13
- package/lib/StatusScoped.js +5 -2
- package/lib/WithRootStore.js +5 -2
- package/lib/WithStore.js +5 -2
- package/lib/actions/Action.d.ts +1 -0
- package/lib/actions/Action.js +62 -37
- package/lib/actions/AjaxAction.d.ts +6 -8
- package/lib/actions/AjaxAction.js +20 -18
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.d.ts +1 -2
- package/lib/actions/CmptAction.js +46 -31
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +8 -5
- package/lib/actions/DialogAction.js +5 -6
- package/lib/actions/DrawerAction.js +4 -4
- package/lib/actions/EmailAction.js +1 -1
- package/lib/actions/LinkAction.js +1 -1
- package/lib/actions/LoopAction.js +1 -1
- package/lib/actions/PageAction.js +1 -1
- package/lib/actions/ParallelAction.js +1 -1
- package/lib/actions/StatusAction.d.ts +15 -0
- package/lib/actions/StatusAction.js +53 -0
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/actions/index.d.ts +1 -0
- package/lib/components/CustomStyle.js +1 -1
- package/lib/components/LazyComponent.js +12 -14
- package/lib/components/Overlay.js +14 -14
- package/lib/components/PopOver.js +11 -10
- package/lib/env.js +4 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +11 -9
- package/lib/index.d.ts +2 -1
- package/lib/index.js +21 -19
- package/lib/locale.js +6 -3
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.d.ts +6 -6
- package/lib/renderers/Form.js +180 -131
- package/lib/renderers/Item.d.ts +42 -66
- package/lib/renderers/Item.js +51 -75
- package/lib/renderers/Options.js +10 -5
- package/lib/renderers/Placeholder.js +1 -1
- package/lib/renderers/builtin.js +1 -1
- package/lib/renderers/register.js +1 -1
- package/lib/renderers/wrapControl.js +104 -47
- package/lib/store/app.js +14 -7
- package/lib/store/combo.d.ts +444 -1912
- package/lib/store/combo.js +9 -2
- package/lib/store/crud.d.ts +1 -0
- package/lib/store/crud.js +11 -5
- package/lib/store/form.d.ts +132 -892
- package/lib/store/form.js +81 -79
- package/lib/store/formItem.d.ts +5 -2
- package/lib/store/formItem.js +13 -2
- package/lib/store/iRenderer.js +8 -5
- package/lib/store/index.js +1 -1
- package/lib/store/list.js +1 -1
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.js +1 -1
- package/lib/store/root.js +8 -5
- package/lib/store/service.js +4 -4
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +503 -2040
- package/lib/store/table.js +79 -55
- package/lib/store/table2.d.ts +49 -0
- package/lib/store/table2.js +36 -3
- package/lib/theme.js +6 -3
- package/lib/types.d.ts +17 -3
- package/lib/utils/Animation.js +1 -1
- package/lib/utils/ColorScale.js +1 -1
- package/lib/utils/DataSchema.js +1 -1
- package/lib/utils/DataScope.js +1 -1
- package/lib/utils/RootClose.js +1 -1
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/api.d.ts +2 -2
- package/lib/utils/api.js +113 -81
- package/lib/utils/arraySlice.js +1 -1
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/columnsSplit.js +8 -6
- package/lib/utils/dataMapping.js +4 -2
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.d.ts +2 -0
- package/lib/utils/debug.js +61 -33
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.js +7 -5
- package/lib/utils/errors.js +1 -1
- package/lib/utils/escapeHtml.js +1 -1
- package/lib/utils/filter-schema.js +1 -1
- package/lib/utils/filter.js +1 -1
- package/lib/utils/formatDuration.js +1 -1
- package/lib/utils/formula.d.ts +0 -1
- package/lib/utils/formula.js +6 -10
- package/lib/utils/getVariable.js +1 -1
- package/lib/utils/grammar.js +1 -1
- package/lib/utils/handleAction.js +1 -1
- package/lib/utils/helper.d.ts +11 -1
- package/lib/utils/helper.js +14 -1
- package/lib/utils/highlight.js +8 -9
- package/lib/utils/icon.d.ts +4 -2
- package/lib/utils/icon.js +12 -10
- package/lib/utils/image.js +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/isPureVariable.js +1 -1
- package/lib/utils/json-schema-2-amis-schema.js +1 -1
- package/lib/utils/keyToPath.js +1 -1
- package/lib/utils/makeSorter.js +1 -1
- package/lib/utils/math.d.ts +3 -0
- package/lib/utils/math.js +58 -0
- package/lib/utils/memoryParse.js +1 -1
- package/lib/utils/normalizeLink.js +1 -1
- package/lib/utils/normalizeOptions.js +1 -1
- package/lib/utils/object.d.ts +7 -0
- package/lib/utils/object.js +13 -1
- package/lib/utils/offset.js +1 -1
- package/lib/utils/offsetParent.js +1 -1
- package/lib/utils/optionValueCompare.js +7 -3
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.js +1 -1
- package/lib/utils/renderer-event.d.ts +1 -1
- package/lib/utils/renderer-event.js +13 -5
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.js +1 -1
- package/lib/utils/resolveCondition.js +1 -1
- package/lib/utils/resolveVariable.js +1 -1
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.js +1 -1
- package/lib/utils/scrollPosition.js +1 -1
- package/lib/utils/string2regExp.js +1 -1
- package/lib/utils/stripNumber.js +1 -1
- package/lib/utils/style-helper.js +1 -1
- package/lib/utils/style.js +1 -1
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.js +1 -1
- package/lib/utils/tpl-builtin.js +1 -1
- package/lib/utils/tpl-lodash.js +1 -1
- package/lib/utils/tpl.js +1 -1
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validations.js +1 -1
- package/package.json +5 -5
package/lib/store/table.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.3.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -41,6 +41,7 @@ var Column = mobxStateTree.types
|
|
|
41
41
|
type: mobxStateTree.types.optional(mobxStateTree.types.string, 'plain'),
|
|
42
42
|
name: mobxStateTree.types.maybe(mobxStateTree.types.string),
|
|
43
43
|
value: mobxStateTree.types.frozen(),
|
|
44
|
+
id: '',
|
|
44
45
|
groupName: '',
|
|
45
46
|
toggled: false,
|
|
46
47
|
toggable: true,
|
|
@@ -54,6 +55,8 @@ var Column = mobxStateTree.types
|
|
|
54
55
|
fixed: '',
|
|
55
56
|
index: 0,
|
|
56
57
|
rawIndex: 0,
|
|
58
|
+
width: 0,
|
|
59
|
+
minWidth: 0,
|
|
57
60
|
breakpoint: mobxStateTree.types.optional(mobxStateTree.types.frozen(), undefined),
|
|
58
61
|
pristine: mobxStateTree.types.optional(mobxStateTree.types.frozen(), undefined),
|
|
59
62
|
remark: mobxStateTree.types.optional(mobxStateTree.types.frozen(), undefined),
|
|
@@ -76,6 +79,12 @@ var Column = mobxStateTree.types
|
|
|
76
79
|
self.enableSearch = value;
|
|
77
80
|
var table = mobxStateTree.getParent(self, 2);
|
|
78
81
|
table.persistSaveToggledColumns();
|
|
82
|
+
},
|
|
83
|
+
setWidth: function (value, minWidth) {
|
|
84
|
+
self.width = value;
|
|
85
|
+
if (typeof minWidth === 'number') {
|
|
86
|
+
self.minWidth = minWidth;
|
|
87
|
+
}
|
|
79
88
|
}
|
|
80
89
|
}); });
|
|
81
90
|
var Row = mobxStateTree.types
|
|
@@ -268,6 +277,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
268
277
|
formsRef: mobxStateTree.types.optional(mobxStateTree.types.array(mobxStateTree.types.frozen()), []),
|
|
269
278
|
maxKeepItemSelectionLength: Infinity,
|
|
270
279
|
keepItemSelectionOnPageChange: false,
|
|
280
|
+
useFixedLayout: false,
|
|
271
281
|
// 导出 Excel 按钮的 loading 状态
|
|
272
282
|
exportExcelLoading: false,
|
|
273
283
|
searchFormExpanded: false // 用来控制搜索框是否展开了,那个自动根据 searchable 生成的表单 autoGenerateFilter
|
|
@@ -325,23 +335,6 @@ var TableStore = iRenderer.iRendererStore
|
|
|
325
335
|
helper.isBreakpoint(item.breakpoint);
|
|
326
336
|
});
|
|
327
337
|
}
|
|
328
|
-
function getLeftFixedColumns() {
|
|
329
|
-
if (self.dragging) {
|
|
330
|
-
return [];
|
|
331
|
-
}
|
|
332
|
-
var columns = getFilteredColumns().filter(function (item) { return item.fixed === 'left'; });
|
|
333
|
-
// 有才带过去,没有就不带了
|
|
334
|
-
if (columns.length) {
|
|
335
|
-
columns = getFilteredColumns().filter(function (item) { return item.fixed === 'left' || /^__/.test(item.type); });
|
|
336
|
-
}
|
|
337
|
-
return columns;
|
|
338
|
-
}
|
|
339
|
-
function getRightFixedColumns() {
|
|
340
|
-
if (self.dragging) {
|
|
341
|
-
return [];
|
|
342
|
-
}
|
|
343
|
-
return getFilteredColumns().filter(function (item) { return item.fixed === 'right'; });
|
|
344
|
-
}
|
|
345
338
|
function isSelected(row) {
|
|
346
339
|
return !!~self.selectedRows.indexOf(row);
|
|
347
340
|
}
|
|
@@ -453,7 +446,11 @@ var TableStore = iRenderer.iRendererStore
|
|
|
453
446
|
(item.has.length === 1 && item.label === item.has[0].label)
|
|
454
447
|
? 2
|
|
455
448
|
: 1;
|
|
456
|
-
return tslib.__assign(tslib.__assign({}, item), { rowSpan: rowSpan, label: rowSpan === 2 ? item.label || item.has[0].label : item.label })
|
|
449
|
+
return tslib.__assign(tslib.__assign({}, item), { rowSpan: rowSpan, label: rowSpan === 2 ? item.label || item.has[0].label : item.label, fixed: item.has.every(function (column) { return column.fixed; })
|
|
450
|
+
? item.has[0].fixed
|
|
451
|
+
: undefined, get width() {
|
|
452
|
+
return item.has.reduce(function (a, b) { return a + b.width; }, 0);
|
|
453
|
+
} });
|
|
457
454
|
});
|
|
458
455
|
}
|
|
459
456
|
function getFirstToggledColumnIndex() {
|
|
@@ -486,12 +483,6 @@ var TableStore = iRenderer.iRendererStore
|
|
|
486
483
|
get footableColumns() {
|
|
487
484
|
return getFootableColumns();
|
|
488
485
|
},
|
|
489
|
-
get leftFixedColumns() {
|
|
490
|
-
return getLeftFixedColumns();
|
|
491
|
-
},
|
|
492
|
-
get rightFixedColumns() {
|
|
493
|
-
return getRightFixedColumns();
|
|
494
|
-
},
|
|
495
486
|
get toggableColumns() {
|
|
496
487
|
return getToggableColumns();
|
|
497
488
|
},
|
|
@@ -576,6 +567,55 @@ var TableStore = iRenderer.iRendererStore
|
|
|
576
567
|
}
|
|
577
568
|
});
|
|
578
569
|
return list;
|
|
570
|
+
},
|
|
571
|
+
get columnWidthReady() {
|
|
572
|
+
return getFilteredColumns().every(function (column) { return column.width; });
|
|
573
|
+
},
|
|
574
|
+
getStickyStyles: function (column, columns) {
|
|
575
|
+
var stickyClassName = '';
|
|
576
|
+
var style = {};
|
|
577
|
+
var autoFixLeftColumns = ['__checkme', '__dragme', '__expandme'];
|
|
578
|
+
if (column.fixed === 'left' ||
|
|
579
|
+
autoFixLeftColumns.includes(column.type)) {
|
|
580
|
+
stickyClassName = 'is-sticky is-sticky-left';
|
|
581
|
+
var index = columns.indexOf(column) - 1;
|
|
582
|
+
if (columns
|
|
583
|
+
.slice(index + 2)
|
|
584
|
+
.every(function (col) {
|
|
585
|
+
return !((col && col.fixed === 'left') ||
|
|
586
|
+
autoFixLeftColumns.includes(col.type));
|
|
587
|
+
})) {
|
|
588
|
+
stickyClassName += ' is-sticky-last-left';
|
|
589
|
+
}
|
|
590
|
+
var left = 0;
|
|
591
|
+
while (index >= 0) {
|
|
592
|
+
var col = columns[index];
|
|
593
|
+
if ((col && col.fixed === 'left') ||
|
|
594
|
+
autoFixLeftColumns.includes(col.type)) {
|
|
595
|
+
left += col.width;
|
|
596
|
+
}
|
|
597
|
+
index--;
|
|
598
|
+
}
|
|
599
|
+
style.left = left;
|
|
600
|
+
}
|
|
601
|
+
else if (column.fixed === 'right') {
|
|
602
|
+
stickyClassName = 'is-sticky is-sticky-right';
|
|
603
|
+
var right = 0;
|
|
604
|
+
var index = columns.indexOf(column) + 1;
|
|
605
|
+
if (columns.slice(0, index - 1).every(function (col) { return col.fixed !== 'right'; })) {
|
|
606
|
+
stickyClassName += ' is-sticky-first-right';
|
|
607
|
+
}
|
|
608
|
+
var len = columns.length;
|
|
609
|
+
while (index < len) {
|
|
610
|
+
var col = columns[index];
|
|
611
|
+
if (col && col.fixed === 'right') {
|
|
612
|
+
right += col.width;
|
|
613
|
+
}
|
|
614
|
+
index++;
|
|
615
|
+
}
|
|
616
|
+
style.right = right;
|
|
617
|
+
}
|
|
618
|
+
return [style, stickyClassName];
|
|
579
619
|
}
|
|
580
620
|
};
|
|
581
621
|
})
|
|
@@ -616,12 +656,6 @@ var TableStore = iRenderer.iRendererStore
|
|
|
616
656
|
var columns = config.columns
|
|
617
657
|
.filter(function (column) { return column; })
|
|
618
658
|
.concat();
|
|
619
|
-
if (!columns.length) {
|
|
620
|
-
columns.push({
|
|
621
|
-
type: 'text',
|
|
622
|
-
label: '空'
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
659
|
// 更新列顺序,afterCreate生命周期中更新columns不会触发组件的render
|
|
626
660
|
var key = getPersistDataKey(columns);
|
|
627
661
|
var data = localStorage.getItem(key);
|
|
@@ -638,28 +672,10 @@ var TableStore = iRenderer.iRendererStore
|
|
|
638
672
|
});
|
|
639
673
|
}
|
|
640
674
|
}
|
|
641
|
-
columns
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
});
|
|
646
|
-
columns.unshift({
|
|
647
|
-
type: '__checkme',
|
|
648
|
-
fixed: 'left',
|
|
649
|
-
toggable: false,
|
|
650
|
-
className: 'Table-checkCell'
|
|
651
|
-
});
|
|
652
|
-
columns.unshift({
|
|
653
|
-
type: '__dragme',
|
|
654
|
-
toggable: false,
|
|
655
|
-
className: 'Table-dragCell'
|
|
656
|
-
});
|
|
657
|
-
columns = columns.map(function (item, index) { return (tslib.__assign(tslib.__assign({}, item), { index: index, rawIndex: index - PARTITION_INDEX, type: item.type || 'plain', pristine: item, toggled: item.toggled !== false, breakpoint: item.breakpoint, isPrimary: index === PARTITION_INDEX, className: item.className || '',
|
|
658
|
-
/** 提前映射变量,方便后续view中使用 */
|
|
659
|
-
label: isPureVariable.isPureVariable(item.label)
|
|
660
|
-
? resolveVariableAndFilter.resolveVariableAndFilter(item.label, self.data)
|
|
661
|
-
: item.label })); });
|
|
662
|
-
self.columns.replace(columns);
|
|
675
|
+
updateColumns(columns);
|
|
676
|
+
}
|
|
677
|
+
if (config.tableLayout === 'fixed') {
|
|
678
|
+
self.useFixedLayout = true;
|
|
663
679
|
}
|
|
664
680
|
}
|
|
665
681
|
function updateColumns(columns) {
|
|
@@ -687,15 +703,18 @@ var TableStore = iRenderer.iRendererStore
|
|
|
687
703
|
toggable: false,
|
|
688
704
|
className: 'Table-dragCell'
|
|
689
705
|
});
|
|
690
|
-
columns = columns.map(function (item, index) { return (tslib.__assign(tslib.__assign({}, item), { index: index, rawIndex: index - PARTITION_INDEX, type: item.type || 'plain', pristine: item.pristine || item, toggled: item.toggled !== false, breakpoint: item.breakpoint, isPrimary: index === PARTITION_INDEX,
|
|
706
|
+
columns = columns.map(function (item, index) { return (tslib.__assign(tslib.__assign({}, item), { id: helper.guid(), index: index, width: 0, minWidth: 0, rawIndex: index - PARTITION_INDEX, type: item.type || 'plain', pristine: item.pristine || item, toggled: item.toggled !== false, breakpoint: item.breakpoint, isPrimary: index === PARTITION_INDEX,
|
|
691
707
|
/** 提前映射变量,方便后续view中使用 */
|
|
692
708
|
label: isPureVariable.isPureVariable(item.label)
|
|
693
709
|
? resolveVariableAndFilter.resolveVariableAndFilter(item.label, self.data)
|
|
694
710
|
: item.label })); });
|
|
695
711
|
self.columns.replace(columns);
|
|
696
|
-
|
|
712
|
+
self.useFixedLayout = self.columns.some(function (column) { return column.pristine.width; });
|
|
697
713
|
}
|
|
698
714
|
}
|
|
715
|
+
function invalidTableColumnWidth() {
|
|
716
|
+
self.columns.forEach(function (column) { return column.setWidth(0); });
|
|
717
|
+
}
|
|
699
718
|
function combineCell(arr, keys) {
|
|
700
719
|
if (!keys.length || !arr.length) {
|
|
701
720
|
return arr;
|
|
@@ -838,6 +857,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
838
857
|
self.expandedRows.replace(getExpandAllRows(self.rows));
|
|
839
858
|
}
|
|
840
859
|
self.dragging = false;
|
|
860
|
+
invalidTableColumnWidth(); // 更新内容需要重新计算表格布局
|
|
841
861
|
}
|
|
842
862
|
// 获取所有层级的子节点id
|
|
843
863
|
function getExpandAllRows(arr) {
|
|
@@ -1142,6 +1162,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1142
1162
|
return {
|
|
1143
1163
|
update: update,
|
|
1144
1164
|
updateColumns: updateColumns,
|
|
1165
|
+
invalidTableColumnWidth: invalidTableColumnWidth,
|
|
1145
1166
|
initRows: initRows,
|
|
1146
1167
|
updateSelected: updateSelected,
|
|
1147
1168
|
toggleAll: toggleAll,
|
|
@@ -1164,6 +1185,9 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1164
1185
|
persistSaveToggledColumns: persistSaveToggledColumns,
|
|
1165
1186
|
setSearchFormExpanded: setSearchFormExpanded,
|
|
1166
1187
|
toggleSearchFormExpanded: toggleSearchFormExpanded,
|
|
1188
|
+
setUseFixedLayout: function (value) {
|
|
1189
|
+
self.useFixedLayout = !!value;
|
|
1190
|
+
},
|
|
1167
1191
|
// events
|
|
1168
1192
|
afterCreate: function () {
|
|
1169
1193
|
setTimeout(function () {
|
package/lib/store/table2.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Instance, SnapshotIn, IAnyModelType } from 'mobx-state-tree';
|
|
2
2
|
import { Api, fetchOptions } from '../types';
|
|
3
|
+
import { IFormStore } from './form';
|
|
3
4
|
export declare const Column: import("mobx-state-tree").IModelType<{
|
|
4
5
|
title: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
5
6
|
name: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
@@ -140,6 +141,7 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
140
141
|
pageSize: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
141
142
|
dragging: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
142
143
|
rowSelectionKeyField: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
144
|
+
formsRef: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<any, any, any>>, [undefined]>;
|
|
143
145
|
}, {
|
|
144
146
|
readonly parentStore: any;
|
|
145
147
|
readonly __: any;
|
|
@@ -458,6 +460,52 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
458
460
|
reset(): void;
|
|
459
461
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>))[];
|
|
460
462
|
readonly keyField: string;
|
|
463
|
+
readonly modified: number;
|
|
464
|
+
readonly modifiedRows: ({
|
|
465
|
+
storeType: string;
|
|
466
|
+
id: string;
|
|
467
|
+
parentId: string;
|
|
468
|
+
name: string;
|
|
469
|
+
pristine: any;
|
|
470
|
+
data: any;
|
|
471
|
+
index: number;
|
|
472
|
+
newIndex: number;
|
|
473
|
+
depth: number;
|
|
474
|
+
children: import("mobx-state-tree").IMSTArray<IAnyModelType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<IAnyModelType>, [undefined]>>;
|
|
475
|
+
path: string;
|
|
476
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
477
|
+
readonly checked: boolean;
|
|
478
|
+
readonly modified: boolean;
|
|
479
|
+
readonly moved: boolean;
|
|
480
|
+
readonly locals: any;
|
|
481
|
+
getDataWithModifiedChilden(): any;
|
|
482
|
+
} & {
|
|
483
|
+
replaceWith(data: any): void;
|
|
484
|
+
change(values: object, savePristine?: boolean): void;
|
|
485
|
+
reset(): void;
|
|
486
|
+
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
487
|
+
storeType: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
488
|
+
id: import("mobx-state-tree").ISimpleType<string>;
|
|
489
|
+
parentId: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
490
|
+
name: import("mobx-state-tree").ISimpleType<string>;
|
|
491
|
+
pristine: import("mobx-state-tree").IType<any, any, any>;
|
|
492
|
+
data: import("mobx-state-tree").IType<any, any, any>;
|
|
493
|
+
index: import("mobx-state-tree").ISimpleType<number>;
|
|
494
|
+
newIndex: import("mobx-state-tree").ISimpleType<number>;
|
|
495
|
+
depth: import("mobx-state-tree").ISimpleType<number>;
|
|
496
|
+
children: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<IAnyModelType>, [undefined]>;
|
|
497
|
+
path: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
498
|
+
}, {
|
|
499
|
+
readonly checked: boolean;
|
|
500
|
+
readonly modified: boolean;
|
|
501
|
+
readonly moved: boolean;
|
|
502
|
+
readonly locals: any;
|
|
503
|
+
getDataWithModifiedChilden(): any;
|
|
504
|
+
} & {
|
|
505
|
+
replaceWith(data: any): void;
|
|
506
|
+
change(values: object, savePristine?: boolean): void;
|
|
507
|
+
reset(): void;
|
|
508
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>)[];
|
|
461
509
|
} & {
|
|
462
510
|
update: (config: Partial<STableStore2>) => void;
|
|
463
511
|
persistSaveToggledColumns: () => void;
|
|
@@ -472,6 +520,7 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
472
520
|
toggleAllColumns: () => void;
|
|
473
521
|
afterCreate(): void;
|
|
474
522
|
saveRemote: (api: Api, data?: object, options?: fetchOptions) => Promise<any>;
|
|
523
|
+
addForm: (form: IFormStore, rowIndex: number) => void;
|
|
475
524
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
476
525
|
export type ITableStore2 = Instance<typeof TableStore2>;
|
|
477
526
|
export type STableStore2 = SnapshotIn<typeof TableStore2>;
|
package/lib/store/table2.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.3.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -158,7 +158,8 @@ var TableStore2 = service.ServiceStore.named('TableStore2')
|
|
|
158
158
|
pageNo: 1,
|
|
159
159
|
pageSize: 10,
|
|
160
160
|
dragging: false,
|
|
161
|
-
rowSelectionKeyField: 'id'
|
|
161
|
+
rowSelectionKeyField: 'id',
|
|
162
|
+
formsRef: mobxStateTree.types.optional(mobxStateTree.types.array(mobxStateTree.types.frozen()), [])
|
|
162
163
|
})
|
|
163
164
|
.views(function (self) {
|
|
164
165
|
function getToggable() {
|
|
@@ -219,6 +220,25 @@ var TableStore2 = service.ServiceStore.named('TableStore2')
|
|
|
219
220
|
function getMoved() {
|
|
220
221
|
return getMovedRows().length;
|
|
221
222
|
}
|
|
223
|
+
function getModifiedRows(rows, modifiedRows) {
|
|
224
|
+
if (rows === void 0) { rows = []; }
|
|
225
|
+
if (modifiedRows === void 0) { modifiedRows = []; }
|
|
226
|
+
rows = rows && rows.length ? rows : self.rows;
|
|
227
|
+
rows.forEach(function (item) {
|
|
228
|
+
if (item.children && item.children.length) {
|
|
229
|
+
getModifiedRows(item.children, modifiedRows);
|
|
230
|
+
}
|
|
231
|
+
var diff = helper.difference(item.data, item.pristine);
|
|
232
|
+
var hasDifference = Object.keys(diff).length;
|
|
233
|
+
if (hasDifference) {
|
|
234
|
+
modifiedRows.push(item);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
return modifiedRows;
|
|
238
|
+
}
|
|
239
|
+
function getModified() {
|
|
240
|
+
return getModifiedRows().length;
|
|
241
|
+
}
|
|
222
242
|
return {
|
|
223
243
|
get toggable() {
|
|
224
244
|
return getToggable();
|
|
@@ -268,6 +288,12 @@ var TableStore2 = service.ServiceStore.named('TableStore2')
|
|
|
268
288
|
},
|
|
269
289
|
get keyField() {
|
|
270
290
|
return self.rowSelectionKeyField;
|
|
291
|
+
},
|
|
292
|
+
get modified() {
|
|
293
|
+
return getModified();
|
|
294
|
+
},
|
|
295
|
+
get modifiedRows() {
|
|
296
|
+
return getModifiedRows();
|
|
271
297
|
}
|
|
272
298
|
};
|
|
273
299
|
})
|
|
@@ -536,6 +562,12 @@ var TableStore2 = service.ServiceStore.named('TableStore2')
|
|
|
536
562
|
self.rows.replace(rows);
|
|
537
563
|
self.dragging = false;
|
|
538
564
|
}
|
|
565
|
+
function addForm(form, rowIndex) {
|
|
566
|
+
self.formsRef.push({
|
|
567
|
+
id: form.id,
|
|
568
|
+
rowIndex: rowIndex
|
|
569
|
+
});
|
|
570
|
+
}
|
|
539
571
|
return {
|
|
540
572
|
update: update,
|
|
541
573
|
persistSaveToggledColumns: persistSaveToggledColumns,
|
|
@@ -566,7 +598,8 @@ var TableStore2 = service.ServiceStore.named('TableStore2')
|
|
|
566
598
|
}
|
|
567
599
|
}, 200);
|
|
568
600
|
},
|
|
569
|
-
saveRemote: saveRemote
|
|
601
|
+
saveRemote: saveRemote,
|
|
602
|
+
addForm: addForm
|
|
570
603
|
};
|
|
571
604
|
});
|
|
572
605
|
|
package/lib/theme.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.3.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -18,6 +18,9 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
18
18
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
19
|
var hoistNonReactStatic__default = /*#__PURE__*/_interopDefaultLegacy(hoistNonReactStatic);
|
|
20
20
|
|
|
21
|
+
var __react_jsx__ = require('react');
|
|
22
|
+
var _J$X_ = (__react_jsx__["default"] || __react_jsx__).createElement;
|
|
23
|
+
(__react_jsx__["default"] || __react_jsx__).Fragment;
|
|
21
24
|
var themes = {
|
|
22
25
|
default: {},
|
|
23
26
|
cxd: {
|
|
@@ -122,8 +125,8 @@ function themeable(ComposedComponent) {
|
|
|
122
125
|
var refConfig = ((_a = ComposedComponent.prototype) === null || _a === void 0 ? void 0 : _a.isReactComponent)
|
|
123
126
|
? { ref: this.childRef }
|
|
124
127
|
: { forwardedRef: this.childRef };
|
|
125
|
-
var body = (
|
|
126
|
-
return this.context ? (body) : (
|
|
128
|
+
var body = (_J$X_(ComposedComponent, tslib.__assign({}, config.getComponentConfig(ComposedComponent.themeKey), this.props, injectedProps, refConfig)));
|
|
129
|
+
return this.context ? (body) : (_J$X_(ThemeContext.Provider, { value: theme }, body));
|
|
127
130
|
};
|
|
128
131
|
return class_1;
|
|
129
132
|
}(React__default["default"].Component)),
|
package/lib/types.d.ts
CHANGED
|
@@ -183,8 +183,9 @@ export interface ApiObject extends BaseApiObject {
|
|
|
183
183
|
operationName?: string;
|
|
184
184
|
body?: PlainObject;
|
|
185
185
|
query?: PlainObject;
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
mockResponse?: PlainObject;
|
|
187
|
+
adaptor?: (payload: object, response: fetcherResult, api: ApiObject, context: any) => any;
|
|
188
|
+
requestAdaptor?: (api: ApiObject, context: any) => ApiObject | Promise<ApiObject>;
|
|
188
189
|
/** 是否过滤为空字符串的 query 参数 */
|
|
189
190
|
filterEmptyQuery?: boolean;
|
|
190
191
|
}
|
|
@@ -211,7 +212,7 @@ export interface fetchOptions {
|
|
|
211
212
|
errorMessage?: string;
|
|
212
213
|
autoAppend?: boolean;
|
|
213
214
|
beforeSend?: (data: any) => any;
|
|
214
|
-
onSuccess?: (json: Payload) => any;
|
|
215
|
+
onSuccess?: (json: Payload, data: any) => any;
|
|
215
216
|
onFailed?: (json: Payload) => any;
|
|
216
217
|
silent?: boolean;
|
|
217
218
|
[propName: string]: any;
|
|
@@ -497,6 +498,19 @@ export interface BaseSchemaWithoutType {
|
|
|
497
498
|
style?: {
|
|
498
499
|
[propName: string]: any;
|
|
499
500
|
};
|
|
501
|
+
/**
|
|
502
|
+
* 编辑器配置,运行时可以忽略
|
|
503
|
+
*/
|
|
504
|
+
editorSetting?: {
|
|
505
|
+
/**
|
|
506
|
+
* 组件名称,通常是业务名称方便定位
|
|
507
|
+
*/
|
|
508
|
+
displayName?: string;
|
|
509
|
+
/**
|
|
510
|
+
* 编辑器假数据,方便展示
|
|
511
|
+
*/
|
|
512
|
+
mock?: any;
|
|
513
|
+
};
|
|
500
514
|
}
|
|
501
515
|
export type OperatorType = 'equal' | 'not_equal' | 'is_empty' | 'is_not_empty' | 'like' | 'not_like' | 'starts_with' | 'ends_with' | 'less' | 'less_or_equal' | 'greater' | 'greater_or_equal' | 'between' | 'not_between' | 'select_equals' | 'select_not_equals' | 'select_any_in' | 'select_not_any_in' | {
|
|
502
516
|
label: string;
|
package/lib/utils/Animation.js
CHANGED
package/lib/utils/ColorScale.js
CHANGED
package/lib/utils/DataSchema.js
CHANGED
package/lib/utils/DataScope.js
CHANGED
package/lib/utils/RootClose.js
CHANGED
package/lib/utils/SimpleMap.js
CHANGED
package/lib/utils/api.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare function str2function(contents: string, ...args: Array<string>):
|
|
|
14
14
|
export declare function str2AsyncFunction(contents: string, ...args: Array<string>): Function | null;
|
|
15
15
|
export declare function responseAdaptor(ret: fetcherResult, api: ApiObject): Payload;
|
|
16
16
|
export declare function wrapFetcher(fn: (config: fetcherConfig) => Promise<fetcherResult>, tracker?: (eventTrack: EventTrack, data: any) => void): any;
|
|
17
|
-
export declare function wrapAdaptor(promise: Promise<fetcherResult>, api: ApiObject): Promise<Payload>;
|
|
17
|
+
export declare function wrapAdaptor(promise: Promise<fetcherResult>, api: ApiObject, context: any): Promise<Payload>;
|
|
18
18
|
/**
|
|
19
19
|
* 请求远程 js 文件然后 new Function 执行,用于 schemaApi 支持 JavaScript
|
|
20
20
|
* @param api
|
|
@@ -24,7 +24,7 @@ export declare function jsFetcher(fetcher: (config: fetcherConfig) => Promise<fe
|
|
|
24
24
|
export declare function jsonpFetcher(api: ApiObject): Promise<fetcherResult>;
|
|
25
25
|
export declare function isApiOutdatedWithData(prevApi: Api | undefined, nextApi: Api | undefined, prevData: any, nextData: any): nextApi is Api;
|
|
26
26
|
export declare function isApiOutdated(prevApi: Api | undefined, nextApi: Api | undefined, prevData: any, nextData: any): nextApi is Api;
|
|
27
|
-
export declare function isValidApi(api: string): boolean
|
|
27
|
+
export declare function isValidApi(api: string): boolean;
|
|
28
28
|
export declare function isEffectiveApi(api?: Api, data?: any, initFetch?: boolean, initFetchOn?: string): api is Api;
|
|
29
29
|
export declare function isSameApi(apiA: ApiObject | ApiCacheConfig, apiB: ApiObject | ApiCacheConfig): boolean;
|
|
30
30
|
export declare function getApiCache(api: ApiObject): ApiCacheConfig | undefined;
|