amis-core 3.1.1 → 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 +6 -2
- package/esm/Scoped.d.ts +4 -1
- package/esm/Scoped.js +9 -5
- package/esm/StatusScoped.js +1 -1
- package/esm/WithRootStore.d.ts +4 -24
- package/esm/WithRootStore.js +12 -4
- package/esm/WithStore.js +23 -16
- package/esm/actions/Action.d.ts +1 -0
- package/esm/actions/Action.js +70 -45
- 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 +47 -32
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +3 -2
- package/esm/actions/DialogAction.d.ts +2 -0
- package/esm/actions/DialogAction.js +39 -23
- 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 +3 -2
- package/esm/components/PopOver.js +3 -2
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +2 -2
- package/esm/index.d.ts +3 -1
- package/esm/index.js +16 -14
- package/esm/locale.js +1 -1
- package/esm/polyfills.d.ts +3 -0
- package/esm/polyfills.js +18 -0
- package/esm/renderers/Form.d.ts +7 -7
- package/esm/renderers/Form.js +182 -128
- package/esm/renderers/Item.d.ts +82 -77
- package/esm/renderers/Item.js +90 -74
- 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.d.ts +4 -24
- package/esm/renderers/wrapControl.js +140 -88
- package/esm/store/app.js +42 -4
- package/esm/store/combo.d.ts +564 -1892
- package/esm/store/combo.js +9 -2
- package/esm/store/crud.d.ts +4 -2
- package/esm/store/crud.js +17 -4
- package/esm/store/form.d.ts +182 -882
- package/esm/store/form.js +83 -81
- package/esm/store/formItem.d.ts +6 -2
- package/esm/store/formItem.js +19 -3
- package/esm/store/iRenderer.js +3 -2
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +1 -0
- package/esm/store/list.js +8 -2
- 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 +3 -2
- package/esm/store/service.js +17 -12
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +604 -2020
- package/esm/store/table.js +86 -56
- 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 +22 -5
- package/esm/utils/Animation.js +1 -1
- package/esm/utils/ColorScale.js +1 -1
- package/esm/utils/DataSchema.d.ts +3 -2
- package/esm/utils/DataSchema.js +27 -7
- package/esm/utils/DataScope.d.ts +10 -3
- package/esm/utils/DataScope.js +50 -12
- 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 +152 -112
- package/esm/utils/arraySlice.d.ts +1 -0
- package/esm/utils/arraySlice.js +76 -0
- 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 +29 -19
- 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 +4 -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 +19 -2
- package/esm/utils/helper.js +69 -10
- 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 +2 -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 +18 -9
- 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 +13 -6
- package/lib/Scoped.d.ts +4 -1
- package/lib/Scoped.js +19 -13
- package/lib/StatusScoped.js +5 -2
- package/lib/WithRootStore.d.ts +4 -24
- package/lib/WithRootStore.js +15 -4
- package/lib/WithStore.js +27 -17
- package/lib/actions/Action.d.ts +1 -0
- package/lib/actions/Action.js +70 -45
- 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 +47 -32
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +9 -5
- package/lib/actions/DialogAction.d.ts +2 -0
- package/lib/actions/DialogAction.js +39 -23
- 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 +15 -14
- package/lib/components/PopOver.js +12 -10
- package/lib/env.js +4 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +11 -9
- package/lib/index.d.ts +3 -1
- package/lib/index.js +26 -19
- package/lib/locale.js +6 -3
- package/lib/polyfills.d.ts +3 -0
- package/lib/polyfills.js +20 -0
- package/lib/renderers/Form.d.ts +7 -7
- package/lib/renderers/Form.js +194 -135
- package/lib/renderers/Item.d.ts +82 -77
- package/lib/renderers/Item.js +126 -104
- 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.d.ts +4 -24
- package/lib/renderers/wrapControl.js +143 -88
- package/lib/store/app.js +44 -3
- package/lib/store/combo.d.ts +564 -1892
- package/lib/store/combo.js +9 -2
- package/lib/store/crud.d.ts +4 -2
- package/lib/store/crud.js +17 -4
- package/lib/store/form.d.ts +182 -882
- package/lib/store/form.js +81 -79
- package/lib/store/formItem.d.ts +6 -2
- package/lib/store/formItem.js +19 -3
- package/lib/store/iRenderer.js +9 -5
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +1 -0
- package/lib/store/list.js +8 -2
- 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 +9 -5
- package/lib/store/service.js +17 -12
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +604 -2020
- package/lib/store/table.js +85 -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 +22 -5
- package/lib/utils/Animation.js +1 -1
- package/lib/utils/ColorScale.js +1 -1
- package/lib/utils/DataSchema.d.ts +3 -2
- package/lib/utils/DataSchema.js +27 -7
- package/lib/utils/DataScope.d.ts +10 -3
- package/lib/utils/DataScope.js +50 -11
- 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 +151 -111
- package/lib/utils/arraySlice.d.ts +1 -0
- package/lib/utils/arraySlice.js +80 -0
- 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 +29 -19
- 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 +10 -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 +19 -2
- package/lib/utils/helper.js +70 -9
- 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 +2 -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 +18 -9
- 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 +9 -4
package/esm/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
|
|
|
@@ -17,7 +17,7 @@ import '../utils/filter.js';
|
|
|
17
17
|
import isEqual from 'lodash/isEqual';
|
|
18
18
|
import find from 'lodash/find';
|
|
19
19
|
import sortBy from 'lodash/sortBy';
|
|
20
|
-
import { immutableExtends, flattenTree, findTree, eachTree, isVisible, hasVisibleExpression, isBreakpoint, difference, guid } from '../utils/helper.js';
|
|
20
|
+
import { immutableExtends, flattenTree, findTree, eachTree, isVisible, hasVisibleExpression, isBreakpoint, difference, guid, sortArray } from '../utils/helper.js';
|
|
21
21
|
import { evalExpression } from '../utils/tpl.js';
|
|
22
22
|
import { getStoreById } from './manager.js';
|
|
23
23
|
|
|
@@ -31,6 +31,7 @@ var Column = types
|
|
|
31
31
|
type: types.optional(types.string, 'plain'),
|
|
32
32
|
name: types.maybe(types.string),
|
|
33
33
|
value: types.frozen(),
|
|
34
|
+
id: '',
|
|
34
35
|
groupName: '',
|
|
35
36
|
toggled: false,
|
|
36
37
|
toggable: true,
|
|
@@ -44,6 +45,8 @@ var Column = types
|
|
|
44
45
|
fixed: '',
|
|
45
46
|
index: 0,
|
|
46
47
|
rawIndex: 0,
|
|
48
|
+
width: 0,
|
|
49
|
+
minWidth: 0,
|
|
47
50
|
breakpoint: types.optional(types.frozen(), undefined),
|
|
48
51
|
pristine: types.optional(types.frozen(), undefined),
|
|
49
52
|
remark: types.optional(types.frozen(), undefined),
|
|
@@ -66,6 +69,12 @@ var Column = types
|
|
|
66
69
|
self.enableSearch = value;
|
|
67
70
|
var table = getParent(self, 2);
|
|
68
71
|
table.persistSaveToggledColumns();
|
|
72
|
+
},
|
|
73
|
+
setWidth: function (value, minWidth) {
|
|
74
|
+
self.width = value;
|
|
75
|
+
if (typeof minWidth === 'number') {
|
|
76
|
+
self.minWidth = minWidth;
|
|
77
|
+
}
|
|
69
78
|
}
|
|
70
79
|
}); });
|
|
71
80
|
var Row = types
|
|
@@ -258,6 +267,7 @@ var TableStore = iRendererStore
|
|
|
258
267
|
formsRef: types.optional(types.array(types.frozen()), []),
|
|
259
268
|
maxKeepItemSelectionLength: Infinity,
|
|
260
269
|
keepItemSelectionOnPageChange: false,
|
|
270
|
+
useFixedLayout: false,
|
|
261
271
|
// 导出 Excel 按钮的 loading 状态
|
|
262
272
|
exportExcelLoading: false,
|
|
263
273
|
searchFormExpanded: false // 用来控制搜索框是否展开了,那个自动根据 searchable 生成的表单 autoGenerateFilter
|
|
@@ -315,23 +325,6 @@ var TableStore = iRendererStore
|
|
|
315
325
|
isBreakpoint(item.breakpoint);
|
|
316
326
|
});
|
|
317
327
|
}
|
|
318
|
-
function getLeftFixedColumns() {
|
|
319
|
-
if (self.dragging) {
|
|
320
|
-
return [];
|
|
321
|
-
}
|
|
322
|
-
var columns = getFilteredColumns().filter(function (item) { return item.fixed === 'left'; });
|
|
323
|
-
// 有才带过去,没有就不带了
|
|
324
|
-
if (columns.length) {
|
|
325
|
-
columns = getFilteredColumns().filter(function (item) { return item.fixed === 'left' || /^__/.test(item.type); });
|
|
326
|
-
}
|
|
327
|
-
return columns;
|
|
328
|
-
}
|
|
329
|
-
function getRightFixedColumns() {
|
|
330
|
-
if (self.dragging) {
|
|
331
|
-
return [];
|
|
332
|
-
}
|
|
333
|
-
return getFilteredColumns().filter(function (item) { return item.fixed === 'right'; });
|
|
334
|
-
}
|
|
335
328
|
function isSelected(row) {
|
|
336
329
|
return !!~self.selectedRows.indexOf(row);
|
|
337
330
|
}
|
|
@@ -443,7 +436,11 @@ var TableStore = iRendererStore
|
|
|
443
436
|
(item.has.length === 1 && item.label === item.has[0].label)
|
|
444
437
|
? 2
|
|
445
438
|
: 1;
|
|
446
|
-
return __assign(__assign({}, item), { rowSpan: rowSpan, label: rowSpan === 2 ? item.label || item.has[0].label : item.label })
|
|
439
|
+
return __assign(__assign({}, item), { rowSpan: rowSpan, label: rowSpan === 2 ? item.label || item.has[0].label : item.label, fixed: item.has.every(function (column) { return column.fixed; })
|
|
440
|
+
? item.has[0].fixed
|
|
441
|
+
: undefined, get width() {
|
|
442
|
+
return item.has.reduce(function (a, b) { return a + b.width; }, 0);
|
|
443
|
+
} });
|
|
447
444
|
});
|
|
448
445
|
}
|
|
449
446
|
function getFirstToggledColumnIndex() {
|
|
@@ -476,12 +473,6 @@ var TableStore = iRendererStore
|
|
|
476
473
|
get footableColumns() {
|
|
477
474
|
return getFootableColumns();
|
|
478
475
|
},
|
|
479
|
-
get leftFixedColumns() {
|
|
480
|
-
return getLeftFixedColumns();
|
|
481
|
-
},
|
|
482
|
-
get rightFixedColumns() {
|
|
483
|
-
return getRightFixedColumns();
|
|
484
|
-
},
|
|
485
476
|
get toggableColumns() {
|
|
486
477
|
return getToggableColumns();
|
|
487
478
|
},
|
|
@@ -566,6 +557,55 @@ var TableStore = iRendererStore
|
|
|
566
557
|
}
|
|
567
558
|
});
|
|
568
559
|
return list;
|
|
560
|
+
},
|
|
561
|
+
get columnWidthReady() {
|
|
562
|
+
return getFilteredColumns().every(function (column) { return column.width; });
|
|
563
|
+
},
|
|
564
|
+
getStickyStyles: function (column, columns) {
|
|
565
|
+
var stickyClassName = '';
|
|
566
|
+
var style = {};
|
|
567
|
+
var autoFixLeftColumns = ['__checkme', '__dragme', '__expandme'];
|
|
568
|
+
if (column.fixed === 'left' ||
|
|
569
|
+
autoFixLeftColumns.includes(column.type)) {
|
|
570
|
+
stickyClassName = 'is-sticky is-sticky-left';
|
|
571
|
+
var index = columns.indexOf(column) - 1;
|
|
572
|
+
if (columns
|
|
573
|
+
.slice(index + 2)
|
|
574
|
+
.every(function (col) {
|
|
575
|
+
return !((col && col.fixed === 'left') ||
|
|
576
|
+
autoFixLeftColumns.includes(col.type));
|
|
577
|
+
})) {
|
|
578
|
+
stickyClassName += ' is-sticky-last-left';
|
|
579
|
+
}
|
|
580
|
+
var left = 0;
|
|
581
|
+
while (index >= 0) {
|
|
582
|
+
var col = columns[index];
|
|
583
|
+
if ((col && col.fixed === 'left') ||
|
|
584
|
+
autoFixLeftColumns.includes(col.type)) {
|
|
585
|
+
left += col.width;
|
|
586
|
+
}
|
|
587
|
+
index--;
|
|
588
|
+
}
|
|
589
|
+
style.left = left;
|
|
590
|
+
}
|
|
591
|
+
else if (column.fixed === 'right') {
|
|
592
|
+
stickyClassName = 'is-sticky is-sticky-right';
|
|
593
|
+
var right = 0;
|
|
594
|
+
var index = columns.indexOf(column) + 1;
|
|
595
|
+
if (columns.slice(0, index - 1).every(function (col) { return col.fixed !== 'right'; })) {
|
|
596
|
+
stickyClassName += ' is-sticky-first-right';
|
|
597
|
+
}
|
|
598
|
+
var len = columns.length;
|
|
599
|
+
while (index < len) {
|
|
600
|
+
var col = columns[index];
|
|
601
|
+
if (col && col.fixed === 'right') {
|
|
602
|
+
right += col.width;
|
|
603
|
+
}
|
|
604
|
+
index++;
|
|
605
|
+
}
|
|
606
|
+
style.right = right;
|
|
607
|
+
}
|
|
608
|
+
return [style, stickyClassName];
|
|
569
609
|
}
|
|
570
610
|
};
|
|
571
611
|
})
|
|
@@ -606,12 +646,6 @@ var TableStore = iRendererStore
|
|
|
606
646
|
var columns = config.columns
|
|
607
647
|
.filter(function (column) { return column; })
|
|
608
648
|
.concat();
|
|
609
|
-
if (!columns.length) {
|
|
610
|
-
columns.push({
|
|
611
|
-
type: 'text',
|
|
612
|
-
label: '空'
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
649
|
// 更新列顺序,afterCreate生命周期中更新columns不会触发组件的render
|
|
616
650
|
var key = getPersistDataKey(columns);
|
|
617
651
|
var data = localStorage.getItem(key);
|
|
@@ -628,28 +662,10 @@ var TableStore = iRendererStore
|
|
|
628
662
|
});
|
|
629
663
|
}
|
|
630
664
|
}
|
|
631
|
-
columns
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
});
|
|
636
|
-
columns.unshift({
|
|
637
|
-
type: '__checkme',
|
|
638
|
-
fixed: 'left',
|
|
639
|
-
toggable: false,
|
|
640
|
-
className: 'Table-checkCell'
|
|
641
|
-
});
|
|
642
|
-
columns.unshift({
|
|
643
|
-
type: '__dragme',
|
|
644
|
-
toggable: false,
|
|
645
|
-
className: 'Table-dragCell'
|
|
646
|
-
});
|
|
647
|
-
columns = columns.map(function (item, index) { return (__assign(__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 || '',
|
|
648
|
-
/** 提前映射变量,方便后续view中使用 */
|
|
649
|
-
label: isPureVariable(item.label)
|
|
650
|
-
? resolveVariableAndFilter(item.label, self.data)
|
|
651
|
-
: item.label })); });
|
|
652
|
-
self.columns.replace(columns);
|
|
665
|
+
updateColumns(columns);
|
|
666
|
+
}
|
|
667
|
+
if (config.tableLayout === 'fixed') {
|
|
668
|
+
self.useFixedLayout = true;
|
|
653
669
|
}
|
|
654
670
|
}
|
|
655
671
|
function updateColumns(columns) {
|
|
@@ -677,15 +693,18 @@ var TableStore = iRendererStore
|
|
|
677
693
|
toggable: false,
|
|
678
694
|
className: 'Table-dragCell'
|
|
679
695
|
});
|
|
680
|
-
columns = columns.map(function (item, index) { return (__assign(__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,
|
|
696
|
+
columns = columns.map(function (item, index) { return (__assign(__assign({}, item), { id: 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,
|
|
681
697
|
/** 提前映射变量,方便后续view中使用 */
|
|
682
698
|
label: isPureVariable(item.label)
|
|
683
699
|
? resolveVariableAndFilter(item.label, self.data)
|
|
684
700
|
: item.label })); });
|
|
685
701
|
self.columns.replace(columns);
|
|
686
|
-
|
|
702
|
+
self.useFixedLayout = self.columns.some(function (column) { return column.pristine.width; });
|
|
687
703
|
}
|
|
688
704
|
}
|
|
705
|
+
function invalidTableColumnWidth() {
|
|
706
|
+
self.columns.forEach(function (column) { return column.setWidth(0); });
|
|
707
|
+
}
|
|
689
708
|
function combineCell(arr, keys) {
|
|
690
709
|
if (!keys.length || !arr.length) {
|
|
691
710
|
return arr;
|
|
@@ -828,6 +847,7 @@ var TableStore = iRendererStore
|
|
|
828
847
|
self.expandedRows.replace(getExpandAllRows(self.rows));
|
|
829
848
|
}
|
|
830
849
|
self.dragging = false;
|
|
850
|
+
invalidTableColumnWidth(); // 更新内容需要重新计算表格布局
|
|
831
851
|
}
|
|
832
852
|
// 获取所有层级的子节点id
|
|
833
853
|
function getExpandAllRows(arr) {
|
|
@@ -1022,6 +1042,11 @@ var TableStore = iRendererStore
|
|
|
1022
1042
|
self.orderBy = key;
|
|
1023
1043
|
self.orderDir = key ? direction : '';
|
|
1024
1044
|
}
|
|
1045
|
+
function changeOrder(key, direction) {
|
|
1046
|
+
setOrderByInfo(key, direction);
|
|
1047
|
+
var dir = /desc/i.test(self.orderDir) ? -1 : 1;
|
|
1048
|
+
self.rows.replace(sortArray(self.rows.concat(), self.orderBy, dir, function (item, field) { return item.data[field]; }));
|
|
1049
|
+
}
|
|
1025
1050
|
function reset() {
|
|
1026
1051
|
self.rows.forEach(function (item) { return item.reset(); });
|
|
1027
1052
|
var rows = self.rows.concat();
|
|
@@ -1127,6 +1152,7 @@ var TableStore = iRendererStore
|
|
|
1127
1152
|
return {
|
|
1128
1153
|
update: update,
|
|
1129
1154
|
updateColumns: updateColumns,
|
|
1155
|
+
invalidTableColumnWidth: invalidTableColumnWidth,
|
|
1130
1156
|
initRows: initRows,
|
|
1131
1157
|
updateSelected: updateSelected,
|
|
1132
1158
|
toggleAll: toggleAll,
|
|
@@ -1138,6 +1164,7 @@ var TableStore = iRendererStore
|
|
|
1138
1164
|
collapseAllAtDepth: collapseAllAtDepth,
|
|
1139
1165
|
clear: clear,
|
|
1140
1166
|
setOrderByInfo: setOrderByInfo,
|
|
1167
|
+
changeOrder: changeOrder,
|
|
1141
1168
|
reset: reset,
|
|
1142
1169
|
toggleDragging: toggleDragging,
|
|
1143
1170
|
stopDragging: stopDragging,
|
|
@@ -1148,6 +1175,9 @@ var TableStore = iRendererStore
|
|
|
1148
1175
|
persistSaveToggledColumns: persistSaveToggledColumns,
|
|
1149
1176
|
setSearchFormExpanded: setSearchFormExpanded,
|
|
1150
1177
|
toggleSearchFormExpanded: toggleSearchFormExpanded,
|
|
1178
|
+
setUseFixedLayout: function (value) {
|
|
1179
|
+
self.useFixedLayout = !!value;
|
|
1180
|
+
},
|
|
1151
1181
|
// events
|
|
1152
1182
|
afterCreate: function () {
|
|
1153
1183
|
setTimeout(function () {
|
package/esm/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/esm/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
|
|
|
@@ -7,7 +7,7 @@ import { __extends, __assign, __generator } from 'tslib';
|
|
|
7
7
|
import { types, getParent, flow, isAlive, getEnv } from 'mobx-state-tree';
|
|
8
8
|
import find from 'lodash/find';
|
|
9
9
|
import isEqual from 'lodash/isEqual';
|
|
10
|
-
import { immutableExtends, findTree, isEmpty, isVisible, flattenTree, isObjectShallowModified, qsstringify, eachTree, guid, hasVisibleExpression } from '../utils/helper.js';
|
|
10
|
+
import { immutableExtends, findTree, isEmpty, isVisible, flattenTree, difference, isObjectShallowModified, qsstringify, eachTree, guid, hasVisibleExpression } from '../utils/helper.js';
|
|
11
11
|
import { normalizeApiResponseData } from '../utils/api.js';
|
|
12
12
|
import { ServiceStore } from './service.js';
|
|
13
13
|
import { createObject, extendObject, isObject } from '../utils/object.js';
|
|
@@ -149,7 +149,8 @@ var TableStore2 = ServiceStore.named('TableStore2')
|
|
|
149
149
|
pageNo: 1,
|
|
150
150
|
pageSize: 10,
|
|
151
151
|
dragging: false,
|
|
152
|
-
rowSelectionKeyField: 'id'
|
|
152
|
+
rowSelectionKeyField: 'id',
|
|
153
|
+
formsRef: types.optional(types.array(types.frozen()), [])
|
|
153
154
|
})
|
|
154
155
|
.views(function (self) {
|
|
155
156
|
function getToggable() {
|
|
@@ -210,6 +211,25 @@ var TableStore2 = ServiceStore.named('TableStore2')
|
|
|
210
211
|
function getMoved() {
|
|
211
212
|
return getMovedRows().length;
|
|
212
213
|
}
|
|
214
|
+
function getModifiedRows(rows, modifiedRows) {
|
|
215
|
+
if (rows === void 0) { rows = []; }
|
|
216
|
+
if (modifiedRows === void 0) { modifiedRows = []; }
|
|
217
|
+
rows = rows && rows.length ? rows : self.rows;
|
|
218
|
+
rows.forEach(function (item) {
|
|
219
|
+
if (item.children && item.children.length) {
|
|
220
|
+
getModifiedRows(item.children, modifiedRows);
|
|
221
|
+
}
|
|
222
|
+
var diff = difference(item.data, item.pristine);
|
|
223
|
+
var hasDifference = Object.keys(diff).length;
|
|
224
|
+
if (hasDifference) {
|
|
225
|
+
modifiedRows.push(item);
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
return modifiedRows;
|
|
229
|
+
}
|
|
230
|
+
function getModified() {
|
|
231
|
+
return getModifiedRows().length;
|
|
232
|
+
}
|
|
213
233
|
return {
|
|
214
234
|
get toggable() {
|
|
215
235
|
return getToggable();
|
|
@@ -259,6 +279,12 @@ var TableStore2 = ServiceStore.named('TableStore2')
|
|
|
259
279
|
},
|
|
260
280
|
get keyField() {
|
|
261
281
|
return self.rowSelectionKeyField;
|
|
282
|
+
},
|
|
283
|
+
get modified() {
|
|
284
|
+
return getModified();
|
|
285
|
+
},
|
|
286
|
+
get modifiedRows() {
|
|
287
|
+
return getModifiedRows();
|
|
262
288
|
}
|
|
263
289
|
};
|
|
264
290
|
})
|
|
@@ -527,6 +553,12 @@ var TableStore2 = ServiceStore.named('TableStore2')
|
|
|
527
553
|
self.rows.replace(rows);
|
|
528
554
|
self.dragging = false;
|
|
529
555
|
}
|
|
556
|
+
function addForm(form, rowIndex) {
|
|
557
|
+
self.formsRef.push({
|
|
558
|
+
id: form.id,
|
|
559
|
+
rowIndex: rowIndex
|
|
560
|
+
});
|
|
561
|
+
}
|
|
530
562
|
return {
|
|
531
563
|
update: update,
|
|
532
564
|
persistSaveToggledColumns: persistSaveToggledColumns,
|
|
@@ -557,7 +589,8 @@ var TableStore2 = ServiceStore.named('TableStore2')
|
|
|
557
589
|
}
|
|
558
590
|
}, 200);
|
|
559
591
|
},
|
|
560
|
-
saveRemote: saveRemote
|
|
592
|
+
saveRemote: saveRemote,
|
|
593
|
+
addForm: addForm
|
|
561
594
|
};
|
|
562
595
|
});
|
|
563
596
|
|
package/esm/theme.js
CHANGED
package/esm/types.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ export interface BaseApiObject {
|
|
|
137
137
|
autoRefresh?: boolean;
|
|
138
138
|
/**
|
|
139
139
|
* 当开启自动刷新的时候,默认是 api 的 url 来自动跟踪变量变化的。
|
|
140
|
-
* 如果你希望监控 url 外的变量,请配置
|
|
140
|
+
* 如果你希望监控 url 外的变量,请配置 trackExpression。
|
|
141
141
|
*/
|
|
142
142
|
trackExpression?: string;
|
|
143
143
|
/**
|
|
@@ -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;
|
|
@@ -300,7 +301,10 @@ type RendererDataAlias = RendererData;
|
|
|
300
301
|
export type FunctionPropertyNames<T> = {
|
|
301
302
|
[K in keyof T]: T[K] extends Function ? K : never;
|
|
302
303
|
}[keyof T];
|
|
303
|
-
export type JSONSchema = JSONSchema7
|
|
304
|
+
export type JSONSchema = JSONSchema7 & {
|
|
305
|
+
group?: string;
|
|
306
|
+
typeLabel?: string;
|
|
307
|
+
};
|
|
304
308
|
/**
|
|
305
309
|
* 事件跟踪的定义
|
|
306
310
|
*/
|
|
@@ -494,6 +498,19 @@ export interface BaseSchemaWithoutType {
|
|
|
494
498
|
style?: {
|
|
495
499
|
[propName: string]: any;
|
|
496
500
|
};
|
|
501
|
+
/**
|
|
502
|
+
* 编辑器配置,运行时可以忽略
|
|
503
|
+
*/
|
|
504
|
+
editorSetting?: {
|
|
505
|
+
/**
|
|
506
|
+
* 组件名称,通常是业务名称方便定位
|
|
507
|
+
*/
|
|
508
|
+
displayName?: string;
|
|
509
|
+
/**
|
|
510
|
+
* 编辑器假数据,方便展示
|
|
511
|
+
*/
|
|
512
|
+
mock?: any;
|
|
513
|
+
};
|
|
497
514
|
}
|
|
498
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' | {
|
|
499
516
|
label: string;
|
package/esm/utils/Animation.js
CHANGED
package/esm/utils/ColorScale.js
CHANGED
|
@@ -13,13 +13,14 @@ export declare class DataSchema {
|
|
|
13
13
|
setSchema(schemas: Array<JSONSchema>): this;
|
|
14
14
|
addSchema(schema: JSONSchema): this;
|
|
15
15
|
removeSchema(id: string): this;
|
|
16
|
-
getSchemas():
|
|
16
|
+
getSchemas(): JSONSchema[];
|
|
17
17
|
addScope(schema?: JSONSchema | Array<JSONSchema>, id?: string): this;
|
|
18
18
|
removeScope(idOrScope: string | DataScope): this;
|
|
19
19
|
hasScope(idOrScope: string | DataScope): idOrScope is string | DataScope;
|
|
20
20
|
getScope(idOrScope: string | DataScope): DataScope;
|
|
21
21
|
switchToRoot(): this;
|
|
22
22
|
switchTo(idOrScope: string | DataScope): this;
|
|
23
|
+
pushVariable(current: DataScope, variables: any[]): void;
|
|
23
24
|
getDataPropsAsOptions(): any[];
|
|
24
|
-
getSchemaByPath(path: string):
|
|
25
|
+
getSchemaByPath(path: string): JSONSchema | null;
|
|
25
26
|
}
|
package/esm/utils/DataSchema.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
|
|
|
@@ -79,18 +79,38 @@ var DataSchema = /** @class */ (function () {
|
|
|
79
79
|
this.current = scope;
|
|
80
80
|
return this;
|
|
81
81
|
};
|
|
82
|
+
DataSchema.prototype.pushVariable = function (current, variables) {
|
|
83
|
+
if (current.tag) {
|
|
84
|
+
variables.push({
|
|
85
|
+
label: current.tag,
|
|
86
|
+
children: current.getDataPropsAsOptions()
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
variables.push.apply(variables, __spreadArray([], __read(current.getDataPropsAsOptions()), false));
|
|
91
|
+
}
|
|
92
|
+
};
|
|
82
93
|
DataSchema.prototype.getDataPropsAsOptions = function () {
|
|
94
|
+
var _a;
|
|
83
95
|
var variables = [];
|
|
84
96
|
var current = this.current;
|
|
85
97
|
while (current) {
|
|
86
|
-
if (current.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
if (current.group) {
|
|
99
|
+
var subVars = [];
|
|
100
|
+
this.pushVariable(current, subVars);
|
|
101
|
+
var index = variables.findIndex(function (item) { return item.label === (current === null || current === void 0 ? void 0 : current.group); });
|
|
102
|
+
if (~index) {
|
|
103
|
+
(_a = variables[index].children).push.apply(_a, __spreadArray([], __read(subVars), false));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
variables.push({
|
|
107
|
+
label: current.group,
|
|
108
|
+
children: subVars
|
|
109
|
+
});
|
|
110
|
+
}
|
|
91
111
|
}
|
|
92
112
|
else {
|
|
93
|
-
|
|
113
|
+
this.pushVariable(current, variables);
|
|
94
114
|
}
|
|
95
115
|
current = current.parent;
|
|
96
116
|
}
|
package/esm/utils/DataScope.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { JSONSchema } from '../types';
|
|
2
|
+
export declare const DATASCHEMA_TYPE_MAP: {
|
|
3
|
+
[type: string]: string;
|
|
4
|
+
};
|
|
2
5
|
export declare class DataScope {
|
|
3
6
|
parent?: DataScope;
|
|
4
7
|
readonly children: Array<DataScope>;
|
|
@@ -6,6 +9,7 @@ export declare class DataScope {
|
|
|
6
9
|
ref?: string;
|
|
7
10
|
name?: string;
|
|
8
11
|
tag?: string;
|
|
12
|
+
group?: string;
|
|
9
13
|
description?: string;
|
|
10
14
|
readonly schemas: Array<JSONSchema>;
|
|
11
15
|
constructor(schemas: JSONSchema | Array<JSONSchema>, id: string);
|
|
@@ -17,8 +21,11 @@ export declare class DataScope {
|
|
|
17
21
|
contains(scope: DataScope): boolean;
|
|
18
22
|
assignSchema(target: any, schema: any): any;
|
|
19
23
|
getMergedSchema(): any;
|
|
20
|
-
protected buildOptions(options: Array<any>, schema: JSONSchema, path?:
|
|
24
|
+
protected buildOptions(options: Array<any>, schema: JSONSchema, path?: {
|
|
25
|
+
label: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}, key?: string, isMember?: boolean): void;
|
|
21
28
|
getDataPropsAsOptions(): any;
|
|
22
|
-
getSchemaByPath(path: string):
|
|
23
|
-
getSchemaById(id: string):
|
|
29
|
+
getSchemaByPath(path: string): JSONSchema | null;
|
|
30
|
+
getSchemaById(id: string): JSONSchema | undefined;
|
|
24
31
|
}
|