amis-core 2.9.0 → 3.1.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.d.ts +89 -4
- package/esm/Root.js +15 -4
- package/esm/RootRenderer.d.ts +3 -1
- package/esm/RootRenderer.js +9 -3
- package/esm/SchemaRenderer.d.ts +4 -2
- package/esm/SchemaRenderer.js +32 -24
- package/esm/Scoped.d.ts +8 -0
- package/esm/Scoped.js +20 -5
- package/esm/StatusScoped.d.ts +58 -0
- package/esm/StatusScoped.js +54 -0
- package/esm/WithRootStore.d.ts +2 -2
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +6 -2
- package/esm/actions/Action.d.ts +1 -0
- package/esm/actions/Action.js +19 -5
- package/esm/actions/AjaxAction.js +1 -1
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.js +8 -7
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +4 -4
- package/esm/actions/DialogAction.d.ts +16 -2
- package/esm/actions/DialogAction.js +23 -7
- package/esm/actions/DrawerAction.js +1 -1
- 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/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/CustomStyle.d.ts +13 -0
- package/esm/components/CustomStyle.js +18 -0
- package/esm/components/LazyComponent.d.ts +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.d.ts +3 -3
- package/esm/components/Overlay.js +1 -1
- package/esm/components/PopOver.d.ts +2 -2
- package/esm/components/PopOver.js +1 -1
- package/esm/env.d.ts +10 -2
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -5
- package/esm/factory.d.ts +5 -3
- package/esm/factory.js +3 -3
- package/esm/index.d.ts +11 -4
- package/esm/index.js +55 -33
- package/esm/locale.d.ts +2 -2
- package/esm/locale.js +10 -3
- package/esm/renderers/Form.d.ts +3 -2
- package/esm/renderers/Form.js +216 -180
- package/esm/renderers/Item.d.ts +55 -41
- package/esm/renderers/Item.js +30 -19
- package/esm/renderers/Options.js +11 -4
- 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 +2 -2
- package/esm/renderers/wrapControl.js +13 -16
- package/esm/store/app.d.ts +1 -0
- package/esm/store/app.js +1 -1
- package/esm/store/combo.d.ts +3 -0
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +2 -0
- package/esm/store/crud.js +31 -9
- package/esm/store/form.d.ts +1 -0
- package/esm/store/form.js +10 -4
- package/esm/store/formItem.js +2 -2
- package/esm/store/iRenderer.d.ts +1 -0
- package/esm/store/iRenderer.js +54 -13
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +1 -0
- package/esm/store/list.js +7 -3
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.d.ts +1 -0
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.d.ts +1 -0
- package/esm/store/pagination.js +2 -2
- package/esm/store/root.d.ts +4 -6
- package/esm/store/root.js +53 -24
- package/esm/store/service.d.ts +1 -0
- package/esm/store/service.js +1 -1
- package/esm/store/status.d.ts +12 -0
- package/esm/store/status.js +38 -0
- package/esm/store/table.d.ts +28 -23
- package/esm/store/table.js +26 -5
- package/esm/store/table2.d.ts +7 -6
- package/esm/store/table2.js +27 -23
- package/esm/theme.d.ts +1 -1
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +7 -1
- 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.d.ts +3 -5
- package/esm/utils/DataScope.js +88 -31
- package/esm/utils/RootClose.js +1 -1
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/api.js +14 -5
- package/esm/utils/attachmentAdpator.js +2 -2
- package/esm/utils/autobind.js +1 -1
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/dataMapping.js +1 -1
- package/esm/utils/date.d.ts +7 -0
- package/esm/utils/date.js +34 -2
- package/esm/utils/debug.js +4 -4
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.d.ts +3 -0
- package/esm/utils/dom.js +47 -10
- 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.js +2 -2
- package/esm/utils/getVariable.js +1 -1
- package/esm/utils/grammar.js +3 -3
- package/esm/utils/handleAction.js +1 -1
- package/esm/utils/helper.d.ts +9 -2
- package/esm/utils/helper.js +52 -20
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.d.ts +6 -1
- package/esm/utils/icon.js +6 -1
- package/esm/utils/image.js +1 -1
- package/esm/utils/isPureVariable.js +3 -3
- 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/memoryParse.d.ts +17 -0
- package/esm/utils/memoryParse.js +26 -0
- package/esm/utils/normalizeLink.js +1 -1
- package/esm/utils/normalizeOptions.js +4 -2
- package/esm/utils/object.d.ts +2 -0
- package/esm/utils/object.js +27 -2
- package/esm/utils/offset.js +1 -1
- package/esm/utils/offsetParent.js +1 -1
- package/esm/utils/optionValueCompare.js +1 -1
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.js +1 -1
- package/esm/utils/renderer-event.js +35 -32
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.js +1 -1
- package/esm/utils/resolveCondition.d.ts +1 -0
- package/esm/utils/resolveCondition.js +19 -4
- package/esm/utils/resolveVariable.js +4 -3
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
- package/esm/utils/resolveVariableAndFilterForAsync.js +23 -5
- 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.d.ts +12 -4
- package/esm/utils/style-helper.js +96 -19
- package/esm/utils/style.js +2 -2
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.js +1 -1
- package/esm/utils/tpl-builtin.d.ts +2 -1
- package/esm/utils/tpl-builtin.js +19 -2
- package/esm/utils/tpl-lodash.js +3 -2
- package/esm/utils/tpl.d.ts +2 -0
- package/esm/utils/tpl.js +24 -2
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.d.ts +4 -1
- package/esm/utils/validations.js +27 -12
- package/lib/Root.d.ts +89 -4
- package/lib/Root.js +15 -4
- package/lib/RootRenderer.d.ts +3 -1
- package/lib/RootRenderer.js +8 -2
- package/lib/SchemaRenderer.d.ts +4 -2
- package/lib/SchemaRenderer.js +32 -23
- package/lib/Scoped.d.ts +8 -0
- package/lib/Scoped.js +20 -4
- package/lib/StatusScoped.d.ts +58 -0
- package/lib/StatusScoped.js +63 -0
- package/lib/WithRootStore.d.ts +2 -2
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +6 -2
- package/lib/actions/Action.d.ts +1 -0
- package/lib/actions/Action.js +19 -5
- package/lib/actions/AjaxAction.js +1 -1
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.js +8 -7
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +4 -4
- package/lib/actions/DialogAction.d.ts +16 -2
- package/lib/actions/DialogAction.js +23 -7
- package/lib/actions/DrawerAction.js +1 -1
- 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/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/CustomStyle.d.ts +13 -0
- package/lib/components/CustomStyle.js +22 -0
- package/lib/components/LazyComponent.d.ts +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.d.ts +3 -3
- package/lib/components/Overlay.js +1 -1
- package/lib/components/PopOver.d.ts +2 -2
- package/lib/components/PopOver.js +1 -1
- package/lib/env.d.ts +10 -2
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -5
- package/lib/factory.d.ts +5 -3
- package/lib/factory.js +3 -3
- package/lib/index.d.ts +11 -4
- package/lib/index.js +61 -23
- package/lib/locale.d.ts +2 -2
- package/lib/locale.js +10 -3
- package/lib/renderers/Form.d.ts +3 -2
- package/lib/renderers/Form.js +215 -179
- package/lib/renderers/Item.d.ts +55 -41
- package/lib/renderers/Item.js +30 -19
- package/lib/renderers/Options.js +11 -4
- 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 +2 -2
- package/lib/renderers/wrapControl.js +12 -15
- package/lib/store/app.d.ts +1 -0
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +3 -0
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +2 -0
- package/lib/store/crud.js +31 -9
- package/lib/store/form.d.ts +1 -0
- package/lib/store/form.js +10 -4
- package/lib/store/formItem.js +2 -2
- package/lib/store/iRenderer.d.ts +1 -0
- package/lib/store/iRenderer.js +53 -12
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +1 -0
- package/lib/store/list.js +7 -3
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.d.ts +1 -0
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.d.ts +1 -0
- package/lib/store/pagination.js +2 -2
- package/lib/store/root.d.ts +4 -6
- package/lib/store/root.js +52 -23
- package/lib/store/service.d.ts +1 -0
- package/lib/store/service.js +1 -1
- package/lib/store/status.d.ts +12 -0
- package/lib/store/status.js +42 -0
- package/lib/store/table.d.ts +28 -23
- package/lib/store/table.js +26 -5
- package/lib/store/table2.d.ts +7 -6
- package/lib/store/table2.js +27 -23
- package/lib/theme.d.ts +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +7 -1
- 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.d.ts +3 -5
- package/lib/utils/DataScope.js +86 -29
- package/lib/utils/RootClose.js +1 -1
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/api.js +13 -4
- package/lib/utils/attachmentAdpator.js +2 -2
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/columnsSplit.js +1 -1
- package/lib/utils/dataMapping.js +1 -1
- package/lib/utils/date.d.ts +7 -0
- package/lib/utils/date.js +34 -1
- package/lib/utils/debug.js +4 -4
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.d.ts +3 -0
- package/lib/utils/dom.js +48 -9
- 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.js +2 -2
- package/lib/utils/getVariable.js +1 -1
- package/lib/utils/grammar.js +3 -3
- package/lib/utils/handleAction.js +1 -1
- package/lib/utils/helper.d.ts +9 -2
- package/lib/utils/helper.js +53 -19
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.d.ts +6 -1
- package/lib/utils/icon.js +6 -1
- package/lib/utils/image.js +1 -1
- package/lib/utils/isPureVariable.js +3 -3
- 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/memoryParse.d.ts +17 -0
- package/lib/utils/memoryParse.js +30 -0
- package/lib/utils/normalizeLink.js +1 -1
- package/lib/utils/normalizeOptions.js +4 -2
- package/lib/utils/object.d.ts +2 -0
- package/lib/utils/object.js +28 -1
- package/lib/utils/offset.js +1 -1
- package/lib/utils/offsetParent.js +1 -1
- package/lib/utils/optionValueCompare.js +1 -1
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.js +1 -1
- package/lib/utils/renderer-event.js +35 -32
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.js +1 -1
- package/lib/utils/resolveCondition.d.ts +1 -0
- package/lib/utils/resolveCondition.js +19 -3
- package/lib/utils/resolveVariable.js +3 -2
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
- package/lib/utils/resolveVariableAndFilterForAsync.js +22 -3
- 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.d.ts +12 -4
- package/lib/utils/style-helper.js +101 -18
- package/lib/utils/style.js +2 -2
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.js +1 -1
- package/lib/utils/tpl-builtin.d.ts +2 -1
- package/lib/utils/tpl-builtin.js +19 -2
- package/lib/utils/tpl-lodash.js +3 -2
- package/lib/utils/tpl.d.ts +2 -0
- package/lib/utils/tpl.js +24 -1
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validations.d.ts +4 -1
- package/lib/utils/validations.js +27 -12
- package/package.json +3 -3
package/lib/store/crud.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -122,9 +122,25 @@ var CRUDStore = service.ServiceStore.named('CRUDStore')
|
|
|
122
122
|
// value可能为null、undefined、''、0
|
|
123
123
|
value = getVariable.getVariable(self.query, key);
|
|
124
124
|
if (value != null) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
if (Array.isArray(value)) {
|
|
126
|
+
if (value.length > 0) {
|
|
127
|
+
var arr_1 = tslib.__spreadArray([], tslib.__read(items_1), false);
|
|
128
|
+
var arrItems_1 = [];
|
|
129
|
+
value.forEach(function (item) {
|
|
130
|
+
arrItems_1 = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(arrItems_1), false), tslib.__read(matchSorter.matchSorter(arr_1, item, {
|
|
131
|
+
keys: [key]
|
|
132
|
+
})), false);
|
|
133
|
+
});
|
|
134
|
+
items_1 = items_1.filter(function (item) {
|
|
135
|
+
return arrItems_1.find(function (a) { return a === item; });
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
items_1 = matchSorter.matchSorter(items_1, value, {
|
|
141
|
+
keys: [key]
|
|
142
|
+
});
|
|
143
|
+
}
|
|
128
144
|
}
|
|
129
145
|
}
|
|
130
146
|
});
|
|
@@ -226,14 +242,16 @@ var CRUDStore = service.ServiceStore.named('CRUDStore')
|
|
|
226
242
|
(value = getVariable.getVariable(self.query, key))) {
|
|
227
243
|
if (Array.isArray(value)) {
|
|
228
244
|
if (value.length > 0) {
|
|
229
|
-
var
|
|
230
|
-
var
|
|
245
|
+
var arr_2 = tslib.__spreadArray([], tslib.__read(filteredItems_1), false);
|
|
246
|
+
var arrItems_2 = [];
|
|
231
247
|
value.forEach(function (item) {
|
|
232
|
-
|
|
248
|
+
arrItems_2 = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(arrItems_2), false), tslib.__read(matchSorter.matchSorter(arr_2, item, {
|
|
233
249
|
keys: [key]
|
|
234
250
|
})), false);
|
|
235
251
|
});
|
|
236
|
-
filteredItems_1 = filteredItems_1.filter(function (item) {
|
|
252
|
+
filteredItems_1 = filteredItems_1.filter(function (item) {
|
|
253
|
+
return arrItems_2.find(function (a) { return a === item; });
|
|
254
|
+
});
|
|
237
255
|
}
|
|
238
256
|
}
|
|
239
257
|
else {
|
|
@@ -470,6 +488,9 @@ var CRUDStore = service.ServiceStore.named('CRUDStore')
|
|
|
470
488
|
var updateColumns = function (columns) {
|
|
471
489
|
self.columns = columns;
|
|
472
490
|
};
|
|
491
|
+
var updateTotal = function (total) {
|
|
492
|
+
self.total = total || 0;
|
|
493
|
+
};
|
|
473
494
|
return {
|
|
474
495
|
getData: getData,
|
|
475
496
|
updateSelectData: updateSelectData,
|
|
@@ -487,7 +508,8 @@ var CRUDStore = service.ServiceStore.named('CRUDStore')
|
|
|
487
508
|
setInnerModalOpened: setInnerModalOpened,
|
|
488
509
|
initFromScope: initFromScope,
|
|
489
510
|
exportAsCSV: exportAsCSV,
|
|
490
|
-
updateColumns: updateColumns
|
|
511
|
+
updateColumns: updateColumns,
|
|
512
|
+
updateTotal: updateTotal
|
|
491
513
|
};
|
|
492
514
|
});
|
|
493
515
|
|
package/lib/store/form.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
54
54
|
getValueByName(name: string, canAccessSuper?: boolean): any;
|
|
55
55
|
getPristineValueByName(name: string): any;
|
|
56
56
|
} & {
|
|
57
|
+
setTopStore(value: any): void;
|
|
57
58
|
initData(data?: object, skipSetPristine?: boolean): void;
|
|
58
59
|
reset(): void;
|
|
59
60
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
package/lib/store/form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -167,7 +167,13 @@ var FormStore = service.ServiceStore.named('FormStore')
|
|
|
167
167
|
function setValues(values, tag, replace) {
|
|
168
168
|
self.updateData(values, tag, replace);
|
|
169
169
|
// 如果数据域中有数据变化,就都reset一下,去掉之前残留的验证消息
|
|
170
|
-
self.items.forEach(function (item) {
|
|
170
|
+
self.items.forEach(function (item) {
|
|
171
|
+
var value = item.value;
|
|
172
|
+
if (typeof value !== 'undefined' && value !== item.tmpValue) {
|
|
173
|
+
item.changeTmpValue(value);
|
|
174
|
+
}
|
|
175
|
+
item.reset();
|
|
176
|
+
});
|
|
171
177
|
// 同步 options
|
|
172
178
|
syncOptions();
|
|
173
179
|
}
|
|
@@ -179,7 +185,7 @@ var FormStore = service.ServiceStore.named('FormStore')
|
|
|
179
185
|
var prev = self.data;
|
|
180
186
|
var data = object.cloneObject(self.data);
|
|
181
187
|
if (value !== origin) {
|
|
182
|
-
if (prev.__prev) {
|
|
188
|
+
if (prev.hasOwnProperty('__prev')) {
|
|
183
189
|
// 基于之前的 __prev 改
|
|
184
190
|
var prevData = object.cloneObject(prev.__prev);
|
|
185
191
|
object.setVariable(prevData, name, origin);
|
|
@@ -223,7 +229,7 @@ var FormStore = service.ServiceStore.named('FormStore')
|
|
|
223
229
|
function deleteValueByName(name) {
|
|
224
230
|
var prev = self.data;
|
|
225
231
|
var data = object.cloneObject(self.data);
|
|
226
|
-
if (prev.__prev) {
|
|
232
|
+
if (prev.hasOwnProperty('__prev')) {
|
|
227
233
|
// 基于之前的 __prev 改
|
|
228
234
|
var prevData = object.cloneObject(prev.__prev);
|
|
229
235
|
object.setVariable(prevData, name, getVariable.getVariable(prev, name));
|
package/lib/store/formItem.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -740,7 +740,7 @@ var FormItemStore = node.StoreNode.named('FormItemStore')
|
|
|
740
740
|
? tpl.evalExpression(item.visibleOn, data) !== false
|
|
741
741
|
: item.hiddenOn
|
|
742
742
|
? tpl.evalExpression(item.hiddenOn, data) !== true
|
|
743
|
-
: item.visible !== false
|
|
743
|
+
: item.visible !== false && item.hidden !== true;
|
|
744
744
|
})
|
|
745
745
|
.map(function (item, index) {
|
|
746
746
|
var disabled = tpl.evalExpression(item.disabledOn, data);
|
package/lib/store/iRenderer.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare const iRendererStore: import("mobx-state-tree").IModelType<{
|
|
|
33
33
|
getValueByName(name: string, canAccessSuper?: boolean): any;
|
|
34
34
|
getPristineValueByName(name: string): any;
|
|
35
35
|
} & {
|
|
36
|
+
setTopStore(value: any): void;
|
|
36
37
|
initData(data?: object, skipSetPristine?: boolean): void;
|
|
37
38
|
reset(): void;
|
|
38
39
|
updateData(data?: object, tag?: object, replace?: boolean): void;
|
package/lib/store/iRenderer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -18,6 +18,35 @@ var dataMapping = require('../utils/dataMapping.js');
|
|
|
18
18
|
require('../utils/filter.js');
|
|
19
19
|
var SimpleMap = require('../utils/SimpleMap.js');
|
|
20
20
|
var node = require('./node.js');
|
|
21
|
+
require('../utils/api.js');
|
|
22
|
+
require('../utils/ColorScale.js');
|
|
23
|
+
require('react');
|
|
24
|
+
require('lodash/chunk');
|
|
25
|
+
require('../utils/DataSchema.js');
|
|
26
|
+
require('../utils/DataScope.js');
|
|
27
|
+
require('../utils/debug.js');
|
|
28
|
+
require('react-dom');
|
|
29
|
+
require('../utils/errors.js');
|
|
30
|
+
require('../utils/tpl.js');
|
|
31
|
+
require('lodash/isPlainObject');
|
|
32
|
+
require('classnames');
|
|
33
|
+
require('lodash/isObject');
|
|
34
|
+
require('lodash/isString');
|
|
35
|
+
require('lodash/isBoolean');
|
|
36
|
+
require('lodash');
|
|
37
|
+
require('../utils/image.js');
|
|
38
|
+
require('../actions/Action.js');
|
|
39
|
+
require('lodash/debounce');
|
|
40
|
+
require('lodash/cloneDeep');
|
|
41
|
+
require('../utils/resize-sensor.js');
|
|
42
|
+
require('react-overlays/useRootClose');
|
|
43
|
+
require('lodash/mapValues');
|
|
44
|
+
require('lodash/camelCase');
|
|
45
|
+
require('uncontrollable');
|
|
46
|
+
require('hoist-non-react-statics');
|
|
47
|
+
require('../utils/validations.js');
|
|
48
|
+
require('../utils/resolveCondition.js');
|
|
49
|
+
require('../utils/Animation.js');
|
|
21
50
|
|
|
22
51
|
var iRendererStore = node.StoreNode.named('iRendererStore')
|
|
23
52
|
.props({
|
|
@@ -45,7 +74,11 @@ var iRendererStore = node.StoreNode.named('iRendererStore')
|
|
|
45
74
|
var dialogCallbacks = new SimpleMap.SimpleMap();
|
|
46
75
|
var dialogScoped = null;
|
|
47
76
|
var drawerScoped = null;
|
|
77
|
+
var top = null;
|
|
48
78
|
return {
|
|
79
|
+
setTopStore: function (value) {
|
|
80
|
+
top = value;
|
|
81
|
+
},
|
|
49
82
|
initData: function (data, skipSetPristine) {
|
|
50
83
|
if (data === void 0) { data = {}; }
|
|
51
84
|
if (skipSetPristine === void 0) { skipSetPristine = false; }
|
|
@@ -85,7 +118,7 @@ var iRendererStore = node.StoreNode.named('iRendererStore')
|
|
|
85
118
|
}
|
|
86
119
|
var prev = self.data;
|
|
87
120
|
var data = object.cloneObject(self.data);
|
|
88
|
-
if (prev.__prev) {
|
|
121
|
+
if (prev.hasOwnProperty('__prev')) {
|
|
89
122
|
// 基于之前的 __prev 改
|
|
90
123
|
var prevData = object.cloneObject(prev.__prev);
|
|
91
124
|
object.setVariable(prevData, name, origin);
|
|
@@ -131,13 +164,17 @@ var iRendererStore = node.StoreNode.named('iRendererStore')
|
|
|
131
164
|
self.action = action;
|
|
132
165
|
},
|
|
133
166
|
openDialog: function (ctx, additonal, callback, scoped) {
|
|
134
|
-
var
|
|
167
|
+
var chain = object.extractObjectChain(ctx);
|
|
168
|
+
chain.length === 1 && chain.unshift(self.data);
|
|
135
169
|
if (additonal) {
|
|
136
|
-
|
|
170
|
+
chain.splice(chain.length - 1, 0, additonal);
|
|
137
171
|
}
|
|
138
|
-
var data = object.
|
|
172
|
+
var data = object.createObjectFromChain(chain);
|
|
139
173
|
if (self.action.dialog && self.action.dialog.data) {
|
|
140
|
-
self.dialogData =
|
|
174
|
+
self.dialogData = object.createObjectFromChain([
|
|
175
|
+
top === null || top === void 0 ? void 0 : top.context,
|
|
176
|
+
dataMapping.dataMapping(self.action.dialog.data, data)
|
|
177
|
+
]);
|
|
141
178
|
var clonedAction = tslib.__assign(tslib.__assign({}, self.action), { dialog: tslib.__assign({}, self.action.dialog) });
|
|
142
179
|
delete clonedAction.dialog.data;
|
|
143
180
|
self.action = clonedAction;
|
|
@@ -159,15 +196,19 @@ var iRendererStore = node.StoreNode.named('iRendererStore')
|
|
|
159
196
|
}
|
|
160
197
|
},
|
|
161
198
|
openDrawer: function (ctx, additonal, callback, scoped) {
|
|
162
|
-
var
|
|
199
|
+
var chain = object.extractObjectChain(ctx);
|
|
200
|
+
chain.length === 1 && chain.unshift(self.data);
|
|
163
201
|
if (additonal) {
|
|
164
|
-
|
|
202
|
+
chain.splice(chain.length - 1, 0, additonal);
|
|
165
203
|
}
|
|
166
|
-
var data = object.
|
|
204
|
+
var data = object.createObjectFromChain(chain);
|
|
167
205
|
if (self.action.drawer.data) {
|
|
168
|
-
self.drawerData =
|
|
169
|
-
|
|
170
|
-
|
|
206
|
+
self.drawerData = object.createObjectFromChain([
|
|
207
|
+
top === null || top === void 0 ? void 0 : top.context,
|
|
208
|
+
dataMapping.dataMapping(self.action.drawer.data, data)
|
|
209
|
+
]);
|
|
210
|
+
var clonedAction = tslib.__assign(tslib.__assign({}, self.action), { drawer: tslib.__assign({}, self.action.drawer) });
|
|
211
|
+
delete clonedAction.drawer.data;
|
|
171
212
|
self.action = clonedAction;
|
|
172
213
|
}
|
|
173
214
|
else {
|
package/lib/store/index.js
CHANGED
package/lib/store/list.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ export declare const ListStore: import("mobx-state-tree").IModelType<{
|
|
|
99
99
|
getValueByName(name: string, canAccessSuper?: boolean): any;
|
|
100
100
|
getPristineValueByName(name: string): any;
|
|
101
101
|
} & {
|
|
102
|
+
setTopStore(value: any): void;
|
|
102
103
|
initData(data?: object, skipSetPristine?: boolean): void;
|
|
103
104
|
reset(): void;
|
|
104
105
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
package/lib/store/list.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -42,8 +42,12 @@ var Item = mobxStateTree.types
|
|
|
42
42
|
return self.index !== self.newIndex;
|
|
43
43
|
},
|
|
44
44
|
get locals() {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
var listStore = mobxStateTree.getParent(self, 2);
|
|
46
|
+
return object.createObject(object.extendObject(listStore.data, {
|
|
47
|
+
index: self.index,
|
|
48
|
+
// 只有table时,也可以获取选中行
|
|
49
|
+
selectedItems: listStore.selectedItems.map(function (item) { return item.data; }),
|
|
50
|
+
unSelectedItems: listStore.unSelectedItems.map(function (item) { return item.data; })
|
|
47
51
|
}), self.data);
|
|
48
52
|
},
|
|
49
53
|
get checkable() {
|
package/lib/store/manager.js
CHANGED
package/lib/store/modal.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export declare const ModalStore: import("mobx-state-tree").IModelType<{
|
|
|
47
47
|
getValueByName(name: string, canAccessSuper?: boolean): any;
|
|
48
48
|
getPristineValueByName(name: string): any;
|
|
49
49
|
} & {
|
|
50
|
+
setTopStore(value: any): void;
|
|
50
51
|
initData(data?: object, skipSetPristine?: boolean): void;
|
|
51
52
|
reset(): void;
|
|
52
53
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
package/lib/store/modal.js
CHANGED
package/lib/store/node.js
CHANGED
|
@@ -38,6 +38,7 @@ export declare const PaginationStore: import("mobx-state-tree").IModelType<{
|
|
|
38
38
|
getValueByName(name: string, canAccessSuper?: boolean): any;
|
|
39
39
|
getPristineValueByName(name: string): any;
|
|
40
40
|
} & {
|
|
41
|
+
setTopStore(value: any): void;
|
|
41
42
|
initData(data?: object, skipSetPristine?: boolean): void;
|
|
42
43
|
reset(): void;
|
|
43
44
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
package/lib/store/pagination.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
10
|
require('../utils/helper.js');
|
|
11
|
+
require('tslib');
|
|
11
12
|
require('amis-formula');
|
|
12
13
|
require('moment');
|
|
13
14
|
var object = require('../utils/object.js');
|
|
14
15
|
var resolveVariable = require('../utils/resolveVariable.js');
|
|
15
|
-
require('tslib');
|
|
16
16
|
require('lodash/isPlainObject');
|
|
17
17
|
require('../utils/filter.js');
|
|
18
18
|
var iRenderer = require('./iRenderer.js');
|
package/lib/store/root.d.ts
CHANGED
|
@@ -31,9 +31,6 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
|
|
|
31
31
|
runtimeError: import("mobx-state-tree").IType<any, any, any>;
|
|
32
32
|
runtimeErrorStack: import("mobx-state-tree").IType<any, any, any>;
|
|
33
33
|
query: import("mobx-state-tree").IType<any, any, any>;
|
|
34
|
-
visibleState: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
35
|
-
disableState: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
36
|
-
staticState: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
37
34
|
}, {
|
|
38
35
|
readonly parentStore: any;
|
|
39
36
|
readonly __: any;
|
|
@@ -49,6 +46,7 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
|
|
|
49
46
|
getValueByName(name: string, canAccessSuper?: boolean): any;
|
|
50
47
|
getPristineValueByName(name: string): any;
|
|
51
48
|
} & {
|
|
49
|
+
setTopStore(value: any): void;
|
|
52
50
|
initData(data?: object, skipSetPristine?: boolean): void;
|
|
53
51
|
reset(): void;
|
|
54
52
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
@@ -75,13 +73,13 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
|
|
|
75
73
|
saveRemote: (api: import("..").Api, data?: object | undefined, options?: import("..").fetchOptions | undefined) => Promise<any>;
|
|
76
74
|
fetchSchema: (api: import("..").Api, data?: object | undefined, options?: import("..").fetchOptions | undefined) => Promise<any>;
|
|
77
75
|
checkRemote: (api: import("..").Api, data?: object | undefined, options?: import("..").fetchOptions | undefined) => Promise<any>;
|
|
76
|
+
} & {
|
|
77
|
+
context: {};
|
|
78
78
|
} & {
|
|
79
79
|
readonly downStream: any;
|
|
80
80
|
} & {
|
|
81
|
+
setContext(context: any): void;
|
|
81
82
|
setRuntimeError(error: any, errorStack: any): void;
|
|
82
83
|
updateLocation(location?: any, parseFn?: Function): void;
|
|
83
|
-
setVisible(id: string, value: boolean): void;
|
|
84
|
-
setDisable(id: string, value: boolean): void;
|
|
85
|
-
setStatic(id: string, value: boolean): void;
|
|
86
84
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
87
85
|
export type IRootStore = Instance<typeof RootStore>;
|
package/lib/store/root.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -11,46 +11,75 @@ var tslib = require('tslib');
|
|
|
11
11
|
var mobxStateTree = require('mobx-state-tree');
|
|
12
12
|
var helper = require('../utils/helper.js');
|
|
13
13
|
var service = require('./service.js');
|
|
14
|
+
require('../utils/api.js');
|
|
15
|
+
require('../utils/ColorScale.js');
|
|
16
|
+
require('react');
|
|
17
|
+
require('lodash/chunk');
|
|
18
|
+
require('amis-formula');
|
|
19
|
+
require('lodash/isPlainObject');
|
|
14
20
|
var object = require('../utils/object.js');
|
|
21
|
+
require('../utils/DataSchema.js');
|
|
22
|
+
require('../utils/DataScope.js');
|
|
23
|
+
require('moment');
|
|
24
|
+
require('../utils/debug.js');
|
|
25
|
+
require('react-dom');
|
|
26
|
+
require('../utils/errors.js');
|
|
27
|
+
require('../utils/tpl.js');
|
|
28
|
+
require('classnames');
|
|
29
|
+
require('../utils/filter.js');
|
|
30
|
+
require('lodash/isObject');
|
|
31
|
+
require('lodash/isString');
|
|
32
|
+
require('lodash/isBoolean');
|
|
33
|
+
require('lodash');
|
|
34
|
+
require('../utils/image.js');
|
|
35
|
+
require('../actions/Action.js');
|
|
36
|
+
require('lodash/debounce');
|
|
37
|
+
require('lodash/cloneDeep');
|
|
38
|
+
require('../utils/resize-sensor.js');
|
|
39
|
+
require('react-overlays/useRootClose');
|
|
40
|
+
require('../utils/SimpleMap.js');
|
|
41
|
+
require('lodash/mapValues');
|
|
42
|
+
require('lodash/camelCase');
|
|
43
|
+
require('uncontrollable');
|
|
44
|
+
require('hoist-non-react-statics');
|
|
45
|
+
require('../utils/validations.js');
|
|
46
|
+
require('../utils/resolveCondition.js');
|
|
47
|
+
require('../utils/Animation.js');
|
|
15
48
|
|
|
16
49
|
var RootStore = service.ServiceStore.named('RootStore')
|
|
17
50
|
.props({
|
|
18
51
|
runtimeError: mobxStateTree.types.frozen(),
|
|
19
52
|
runtimeErrorStack: mobxStateTree.types.frozen(),
|
|
20
|
-
query: mobxStateTree.types.frozen()
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
53
|
+
query: mobxStateTree.types.frozen()
|
|
54
|
+
})
|
|
55
|
+
.volatile(function (self) {
|
|
56
|
+
return {
|
|
57
|
+
context: {}
|
|
58
|
+
};
|
|
24
59
|
})
|
|
25
60
|
.views(function (self) { return ({
|
|
26
61
|
get downStream() {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
62
|
+
var result = self.data;
|
|
63
|
+
if (self.context || self.query) {
|
|
64
|
+
var chain = object.extractObjectChain(result);
|
|
65
|
+
self.context && chain.unshift(self.context);
|
|
66
|
+
self.query &&
|
|
67
|
+
chain.splice(chain.length - 1, 0, tslib.__assign(tslib.__assign({}, self.query), { __query: self.query }));
|
|
68
|
+
result = object.createObjectFromChain(chain);
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
30
71
|
}
|
|
31
72
|
}); })
|
|
32
73
|
.actions(function (self) { return ({
|
|
74
|
+
setContext: function (context) {
|
|
75
|
+
self.context = context;
|
|
76
|
+
},
|
|
33
77
|
setRuntimeError: function (error, errorStack) {
|
|
34
78
|
self.runtimeError = error;
|
|
35
79
|
self.runtimeErrorStack = errorStack;
|
|
36
80
|
},
|
|
37
81
|
updateLocation: function (location, parseFn) {
|
|
38
82
|
self.query = parseFn ? parseFn(location) : helper.parseQuery(location);
|
|
39
|
-
},
|
|
40
|
-
setVisible: function (id, value) {
|
|
41
|
-
var _a;
|
|
42
|
-
var state = tslib.__assign(tslib.__assign({}, self.visibleState), (_a = {}, _a[id] = value, _a));
|
|
43
|
-
self.visibleState = state;
|
|
44
|
-
},
|
|
45
|
-
setDisable: function (id, value) {
|
|
46
|
-
var _a;
|
|
47
|
-
var state = tslib.__assign(tslib.__assign({}, self.disableState), (_a = {}, _a[id] = value, _a));
|
|
48
|
-
self.disableState = state;
|
|
49
|
-
},
|
|
50
|
-
setStatic: function (id, value) {
|
|
51
|
-
var _a;
|
|
52
|
-
var state = tslib.__assign(tslib.__assign({}, self.staticState), (_a = {}, _a[id] = value, _a));
|
|
53
|
-
self.staticState = state;
|
|
54
83
|
}
|
|
55
84
|
}); });
|
|
56
85
|
|
package/lib/store/service.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export declare const ServiceStore: import("mobx-state-tree").IModelType<{
|
|
|
43
43
|
getValueByName(name: string, canAccessSuper?: boolean): any;
|
|
44
44
|
getPristineValueByName(name: string): any;
|
|
45
45
|
} & {
|
|
46
|
+
setTopStore(value: any): void;
|
|
46
47
|
initData(data?: object, skipSetPristine?: boolean): void;
|
|
47
48
|
reset(): void;
|
|
48
49
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
package/lib/store/service.js
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Instance } from 'mobx-state-tree';
|
|
2
|
+
export declare const StatusStore: import("mobx-state-tree").IModelType<{
|
|
3
|
+
visibleState: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
4
|
+
disableState: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
5
|
+
staticState: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
6
|
+
}, {
|
|
7
|
+
setVisible(key: string, value?: boolean): void;
|
|
8
|
+
setDisable(key: string, value?: boolean): void;
|
|
9
|
+
setStatic(key: string, value?: boolean): void;
|
|
10
|
+
resetAll(): void;
|
|
11
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
12
|
+
export type IStatusStore = Instance<typeof StatusStore>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v3.1.0
|
|
3
|
+
* Copyright 2018-2023 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
10
|
+
var tslib = require('tslib');
|
|
11
|
+
var mobxStateTree = require('mobx-state-tree');
|
|
12
|
+
|
|
13
|
+
var StatusStore = mobxStateTree.types
|
|
14
|
+
.model('StatusStore', {
|
|
15
|
+
visibleState: mobxStateTree.types.optional(mobxStateTree.types.frozen(), {}),
|
|
16
|
+
disableState: mobxStateTree.types.optional(mobxStateTree.types.frozen(), {}),
|
|
17
|
+
staticState: mobxStateTree.types.optional(mobxStateTree.types.frozen(), {})
|
|
18
|
+
})
|
|
19
|
+
.actions(function (self) { return ({
|
|
20
|
+
setVisible: function (key, value) {
|
|
21
|
+
var _a;
|
|
22
|
+
var state = tslib.__assign(tslib.__assign({}, self.visibleState), (_a = {}, _a[key] = value, _a));
|
|
23
|
+
self.visibleState = state;
|
|
24
|
+
},
|
|
25
|
+
setDisable: function (key, value) {
|
|
26
|
+
var _a;
|
|
27
|
+
var state = tslib.__assign(tslib.__assign({}, self.disableState), (_a = {}, _a[key] = value, _a));
|
|
28
|
+
self.disableState = state;
|
|
29
|
+
},
|
|
30
|
+
setStatic: function (key, value) {
|
|
31
|
+
var _a;
|
|
32
|
+
var state = tslib.__assign(tslib.__assign({}, self.staticState), (_a = {}, _a[key] = value, _a));
|
|
33
|
+
self.staticState = state;
|
|
34
|
+
},
|
|
35
|
+
resetAll: function () {
|
|
36
|
+
self.visibleState = {};
|
|
37
|
+
self.disableState = {};
|
|
38
|
+
self.staticState = {};
|
|
39
|
+
}
|
|
40
|
+
}); });
|
|
41
|
+
|
|
42
|
+
exports.StatusStore = StatusStore;
|