amis-core 6.13.0-beta.8 → 6.13.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.js +4 -2
- package/esm/SchemaRenderer.js +4 -4
- package/esm/Scoped.js +1 -1
- package/esm/StatusScoped.js +1 -1
- package/esm/StyleManager.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +2 -2
- package/esm/actions/Action.js +60 -15
- package/esm/actions/AjaxAction.js +2 -2
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.js +48 -43
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +7 -7
- package/esm/actions/DialogAction.js +8 -8
- package/esm/actions/DrawerAction.js +8 -8
- package/esm/actions/EmailAction.js +1 -1
- package/esm/actions/EventAction.js +9 -9
- 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/PrintAction.js +1 -1
- package/esm/actions/StatusAction.js +1 -1
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/actions/WaitAction.js +1 -1
- package/esm/components/Animations.js +7 -7
- package/esm/components/CustomStyle.js +1 -1
- package/esm/components/ErrorBoundary.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +7 -7
- package/esm/components/PopOver.js +9 -7
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +1 -1
- package/esm/globalVar.js +1 -1
- package/esm/globalVarClientHandler.js +1 -1
- package/esm/globalVarDefaultValueHandler.js +1 -1
- package/esm/index.d.ts +4 -4
- package/esm/index.js +8 -8
- package/esm/locale.js +1 -1
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.d.ts +7 -1
- package/esm/renderers/Form.js +72 -21
- package/esm/renderers/Item.d.ts +75 -33
- package/esm/renderers/Item.js +8 -2
- package/esm/renderers/Options.d.ts +14 -8
- package/esm/renderers/Options.js +1 -1
- 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 +0 -1
- package/esm/renderers/wrapControl.js +21 -11
- package/esm/store/app.d.ts +1 -0
- package/esm/store/app.js +14 -8
- package/esm/store/combo.d.ts +126 -0
- package/esm/store/combo.js +24 -2
- package/esm/store/crud.d.ts +1 -0
- package/esm/store/crud.js +5 -2
- package/esm/store/form.d.ts +50 -0
- package/esm/store/form.js +3 -3
- package/esm/store/formItem.d.ts +1 -0
- package/esm/store/formItem.js +4 -2
- package/esm/store/iRenderer.js +1 -1
- 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.d.ts +5 -0
- package/esm/store/modal.js +14 -2
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.js +1 -1
- package/esm/store/root.d.ts +3 -0
- package/esm/store/root.js +73 -20
- package/esm/store/service.js +8 -8
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +102 -1
- package/esm/store/table.js +9 -3
- package/esm/store/table2.js +1 -1
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +10 -6
- 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/animations.js +1 -1
- package/esm/utils/api.js +1 -1
- package/esm/utils/arraySlice.js +1 -1
- package/esm/utils/attachmentAdpator.js +1 -1
- package/esm/utils/autobind.js +1 -1
- package/esm/utils/browser.js +1 -1
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/concatData.js +1 -1
- package/esm/utils/dataMapping.js +1 -1
- package/esm/utils/date.js +12 -12
- package/esm/utils/debug.js +1 -1
- 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.js +2 -2
- package/esm/utils/getPageId.js +1 -1
- 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.js +3 -3
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.js +1 -1
- package/esm/utils/image.js +1 -1
- package/esm/utils/index.d.ts +1 -1
- package/esm/utils/index.js +9 -9
- 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/labelToString.js +1 -1
- package/esm/utils/loopTooMuch.js +1 -1
- package/esm/utils/makeSorter.js +1 -1
- package/esm/utils/math.js +1 -1
- 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.js +1 -1
- 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/printElement.js +1 -1
- package/esm/utils/renderer-event.js +1 -1
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.d.ts +3 -1
- package/esm/utils/resize-sensor.js +63 -29
- package/esm/utils/resolveCondition.js +2 -2
- package/esm/utils/resolveVariable.js +1 -1
- package/esm/utils/resolveVariableAndFilter.js +4 -3
- 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.d.ts +12 -1
- package/esm/utils/style-helper.js +30 -18
- package/esm/utils/style.d.ts +13 -0
- package/esm/utils/style.js +44 -4
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.js +1 -1
- package/esm/utils/tpl-builtin.d.ts +1 -0
- package/esm/utils/tpl-builtin.js +7 -3
- 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/validateId.js +1 -1
- package/esm/utils/validations.js +2 -2
- package/esm/utils/visitedCache.js +1 -1
- package/lib/Root.js +1 -1
- package/lib/RootRenderer.d.ts +1 -1
- package/lib/RootRenderer.js +4 -2
- package/lib/SchemaRenderer.js +3 -3
- package/lib/Scoped.js +1 -1
- package/lib/StatusScoped.js +1 -1
- package/lib/StyleManager.js +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +2 -2
- package/lib/actions/Action.js +62 -14
- package/lib/actions/AjaxAction.js +2 -2
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.js +48 -43
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +7 -7
- package/lib/actions/DialogAction.js +8 -8
- package/lib/actions/DrawerAction.js +8 -8
- package/lib/actions/EmailAction.js +1 -1
- package/lib/actions/EventAction.js +9 -9
- 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/PrintAction.js +1 -1
- package/lib/actions/StatusAction.js +1 -1
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/actions/WaitAction.js +1 -1
- package/lib/components/Animations.js +7 -7
- package/lib/components/CustomStyle.js +1 -1
- package/lib/components/ErrorBoundary.js +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.js +7 -7
- package/lib/components/PopOver.js +9 -7
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +1 -1
- package/lib/globalVar.js +1 -1
- package/lib/globalVarClientHandler.js +1 -1
- package/lib/globalVarDefaultValueHandler.js +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.js +12 -6
- package/lib/locale.js +1 -1
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.d.ts +7 -1
- package/lib/renderers/Form.js +71 -20
- package/lib/renderers/Item.d.ts +75 -33
- package/lib/renderers/Item.js +8 -2
- package/lib/renderers/Options.d.ts +14 -8
- package/lib/renderers/Options.js +1 -1
- 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 +0 -1
- package/lib/renderers/wrapControl.js +21 -11
- package/lib/store/app.d.ts +1 -0
- package/lib/store/app.js +14 -8
- package/lib/store/combo.d.ts +150 -25
- package/lib/store/combo.js +24 -2
- package/lib/store/crud.d.ts +1 -0
- package/lib/store/crud.js +5 -2
- package/lib/store/form.d.ts +60 -11
- package/lib/store/form.js +3 -3
- package/lib/store/formItem.d.ts +1 -0
- package/lib/store/formItem.js +4 -2
- package/lib/store/iRenderer.js +1 -1
- 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.d.ts +5 -0
- package/lib/store/modal.js +14 -2
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.js +1 -1
- package/lib/store/root.d.ts +3 -1
- package/lib/store/root.js +72 -19
- package/lib/store/service.js +8 -8
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +122 -22
- package/lib/store/table.js +9 -3
- package/lib/store/table2.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +10 -6
- 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/animations.js +1 -1
- package/lib/utils/api.js +1 -1
- package/lib/utils/arraySlice.js +1 -1
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/browser.js +1 -1
- package/lib/utils/columnsSplit.js +1 -1
- package/lib/utils/concatData.js +1 -1
- package/lib/utils/dataMapping.js +1 -1
- package/lib/utils/date.js +12 -12
- package/lib/utils/debug.js +1 -1
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.js +1 -1
- 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/getPageId.js +1 -1
- 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.js +3 -3
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.js +1 -1
- package/lib/utils/image.js +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +22 -20
- 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/labelToString.js +1 -1
- package/lib/utils/loopTooMuch.js +1 -1
- package/lib/utils/makeSorter.js +1 -1
- package/lib/utils/math.js +1 -1
- 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.js +1 -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/printElement.js +1 -1
- package/lib/utils/renderer-event.js +1 -1
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.d.ts +3 -1
- package/lib/utils/resize-sensor.js +64 -28
- package/lib/utils/resolveCondition.js +2 -2
- package/lib/utils/resolveVariable.js +1 -1
- package/lib/utils/resolveVariableAndFilter.js +3 -2
- 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.d.ts +12 -1
- package/lib/utils/style-helper.js +30 -17
- package/lib/utils/style.d.ts +13 -0
- package/lib/utils/style.js +45 -3
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.js +1 -1
- package/lib/utils/tpl-builtin.d.ts +1 -0
- package/lib/utils/tpl-builtin.js +7 -2
- 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/validateId.js +1 -1
- package/lib/utils/validations.js +2 -2
- package/lib/utils/visitedCache.js +1 -1
- package/package.json +5 -3
package/lib/store/formItem.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.13.0
|
|
2
|
+
* amis-core v6.13.0
|
|
3
3
|
* Copyright 2018-2025 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -18,9 +18,9 @@ var tpl = require('../utils/tpl.js');
|
|
|
18
18
|
require('amis-formula');
|
|
19
19
|
require('moment');
|
|
20
20
|
var object = require('../utils/object.js');
|
|
21
|
+
var resolveVariableAndFilter = require('../utils/resolveVariableAndFilter.js');
|
|
21
22
|
require('../utils/memoryParse.js');
|
|
22
23
|
require('@rc-component/mini-decimal');
|
|
23
|
-
var resolveVariableAndFilter = require('../utils/resolveVariableAndFilter.js');
|
|
24
24
|
var dataMapping = require('../utils/dataMapping.js');
|
|
25
25
|
require('../utils/filter.js');
|
|
26
26
|
var api = require('../utils/api.js');
|
|
@@ -81,6 +81,7 @@ var FormItemStore = node.StoreNode.named('FormItemStore')
|
|
|
81
81
|
itemsRef: mobxStateTree.types.optional(mobxStateTree.types.array(mobxStateTree.types.string), []),
|
|
82
82
|
inited: false,
|
|
83
83
|
validated: false,
|
|
84
|
+
validatedAt: 0,
|
|
84
85
|
validating: false,
|
|
85
86
|
multiple: false,
|
|
86
87
|
delimiter: ',',
|
|
@@ -419,6 +420,7 @@ var FormItemStore = node.StoreNode.named('FormItemStore')
|
|
|
419
420
|
}
|
|
420
421
|
}
|
|
421
422
|
self.validating = false;
|
|
423
|
+
self.validatedAt = Date.now();
|
|
422
424
|
return [2 /*return*/, self.valid];
|
|
423
425
|
}
|
|
424
426
|
});
|
package/lib/store/iRenderer.js
CHANGED
package/lib/store/index.js
CHANGED
package/lib/store/list.js
CHANGED
package/lib/store/manager.js
CHANGED
package/lib/store/modal.d.ts
CHANGED
|
@@ -34,8 +34,10 @@ export declare const ModalStore: import("mobx-state-tree").IModelType<{
|
|
|
34
34
|
} & {
|
|
35
35
|
form: import("mobx-state-tree").IType<any, any, any>;
|
|
36
36
|
entered: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
37
|
+
dragging: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
37
38
|
resizeCoord: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
38
39
|
schema: import("mobx-state-tree").IType<any, any, any>;
|
|
40
|
+
isFullscreen: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
39
41
|
}, {
|
|
40
42
|
readonly parentStore: any;
|
|
41
43
|
readonly __: any;
|
|
@@ -83,12 +85,15 @@ export declare const ModalStore: import("mobx-state-tree").IModelType<{
|
|
|
83
85
|
checkRemote: (api: import("..").Api, data?: object | undefined, options?: import("..").fetchOptions | undefined) => Promise<any>;
|
|
84
86
|
} & {
|
|
85
87
|
readonly formData: object;
|
|
88
|
+
readonly inDragging: boolean;
|
|
86
89
|
} & {
|
|
87
90
|
setEntered(value: boolean): void;
|
|
91
|
+
setDragging(value: boolean): void;
|
|
88
92
|
setFormData(obj: any): void;
|
|
89
93
|
reset(): void;
|
|
90
94
|
setResizeCoord(value: number): void;
|
|
91
95
|
setSchema(schema: any): void;
|
|
96
|
+
setFullScreen(isFullscreen?: boolean): void;
|
|
92
97
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
93
98
|
export type IModalStore = Instance<typeof ModalStore>;
|
|
94
99
|
export type SModalStore = SnapshotIn<typeof ModalStore>;
|
package/lib/store/modal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.13.0
|
|
2
|
+
* amis-core v6.13.0
|
|
3
3
|
* Copyright 2018-2025 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -16,13 +16,18 @@ var ModalStore = service.ServiceStore.named('ModalStore')
|
|
|
16
16
|
.props({
|
|
17
17
|
form: mobxStateTree.types.frozen(),
|
|
18
18
|
entered: false,
|
|
19
|
+
dragging: false,
|
|
19
20
|
resizeCoord: 0,
|
|
20
|
-
schema: mobxStateTree.types.frozen()
|
|
21
|
+
schema: mobxStateTree.types.frozen(),
|
|
22
|
+
isFullscreen: false
|
|
21
23
|
})
|
|
22
24
|
.views(function (self) {
|
|
23
25
|
return {
|
|
24
26
|
get formData() {
|
|
25
27
|
return object.createObject(self.data, self.form);
|
|
28
|
+
},
|
|
29
|
+
get inDragging() {
|
|
30
|
+
return self.dragging;
|
|
26
31
|
}
|
|
27
32
|
};
|
|
28
33
|
})
|
|
@@ -31,6 +36,9 @@ var ModalStore = service.ServiceStore.named('ModalStore')
|
|
|
31
36
|
setEntered: function (value) {
|
|
32
37
|
self.entered = value;
|
|
33
38
|
},
|
|
39
|
+
setDragging: function (value) {
|
|
40
|
+
self.dragging = value;
|
|
41
|
+
},
|
|
34
42
|
setFormData: function (obj) {
|
|
35
43
|
self.form = obj;
|
|
36
44
|
},
|
|
@@ -47,6 +55,10 @@ var ModalStore = service.ServiceStore.named('ModalStore')
|
|
|
47
55
|
return;
|
|
48
56
|
}
|
|
49
57
|
self.schema = schema;
|
|
58
|
+
},
|
|
59
|
+
setFullScreen: function (isFullscreen) {
|
|
60
|
+
if (isFullscreen === void 0) { isFullscreen = false; }
|
|
61
|
+
self.isFullscreen = isFullscreen;
|
|
50
62
|
}
|
|
51
63
|
};
|
|
52
64
|
});
|
package/lib/store/node.js
CHANGED
package/lib/store/pagination.js
CHANGED
package/lib/store/root.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
1
|
import { Instance } from 'mobx-state-tree';
|
|
3
2
|
import { GlobalVariableItem, GlobalVariableState, GlobalVariableItemFull } from '../globalVar';
|
|
4
3
|
export declare const RootStore: import("mobx-state-tree").IModelType<{
|
|
@@ -94,6 +93,7 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
|
|
|
94
93
|
readonly nextGlobalData: any;
|
|
95
94
|
readonly downStream: any;
|
|
96
95
|
} & {
|
|
96
|
+
updateContextBySetter(context: any): void;
|
|
97
97
|
updateContext(context: any, isInit?: boolean): void;
|
|
98
98
|
updateGlobalVarState(key: string, state: Partial<GlobalVariableState>): void;
|
|
99
99
|
setGlobalVars: (vars?: Array<GlobalVariableItem>) => Promise<any>;
|
|
@@ -107,7 +107,9 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
|
|
|
107
107
|
updateLocation(location?: any, parseFn?: Function): void;
|
|
108
108
|
init: (schema: any) => Promise<any>;
|
|
109
109
|
syncGlobalVarStates: () => void;
|
|
110
|
+
syncLegacyGlobalVarStates: () => void;
|
|
110
111
|
addSyncGlobalVarStatePendingTask: (fn: (callback: () => void) => void, callback?: () => void) => void;
|
|
112
|
+
afterCreate(): void;
|
|
111
113
|
afterDestroy(): void;
|
|
112
114
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
113
115
|
export type IRootStore = Instance<typeof RootStore>;
|
package/lib/store/root.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.13.0
|
|
2
|
+
* amis-core v6.13.0
|
|
3
3
|
* Copyright 2018-2025 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -11,27 +11,27 @@ 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('amis-formula');
|
|
15
|
+
require('moment');
|
|
16
|
+
var object = require('../utils/object.js');
|
|
17
|
+
require('../utils/memoryParse.js');
|
|
18
|
+
require('@rc-component/mini-decimal');
|
|
19
|
+
var isPlainObject = require('lodash/isPlainObject');
|
|
20
|
+
require('../utils/filter.js');
|
|
14
21
|
require('../utils/api.js');
|
|
15
22
|
require('file-saver');
|
|
16
23
|
require('../utils/browser.js');
|
|
17
24
|
require('../utils/ColorScale.js');
|
|
18
25
|
require('../utils/columnsSplit.js');
|
|
19
|
-
var object = require('../utils/object.js');
|
|
20
|
-
require('../utils/memoryParse.js');
|
|
21
|
-
require('amis-formula');
|
|
22
|
-
var isPlainObject = require('lodash/isPlainObject');
|
|
23
26
|
require('../utils/DataSchema.js');
|
|
24
27
|
require('../utils/DataScope.js');
|
|
25
|
-
require('moment');
|
|
26
28
|
require('../utils/debug.js');
|
|
27
29
|
require('../utils/dom.js');
|
|
28
30
|
require('../utils/errors.js');
|
|
29
31
|
require('../utils/tpl.js');
|
|
30
|
-
require('../utils/filter.js');
|
|
31
32
|
require('lodash/isObject');
|
|
32
33
|
require('lodash/isString');
|
|
33
34
|
require('lodash/isBoolean');
|
|
34
|
-
require('@rc-component/mini-decimal');
|
|
35
35
|
require('../utils/highlight.js');
|
|
36
36
|
require('../utils/icon.js');
|
|
37
37
|
require('../utils/image.js');
|
|
@@ -53,7 +53,7 @@ require('uncontrollable');
|
|
|
53
53
|
require('hoist-non-react-statics');
|
|
54
54
|
require('../utils/validations.js');
|
|
55
55
|
require('../utils/resolveCondition.js');
|
|
56
|
-
require('mobx');
|
|
56
|
+
var mobx = require('mobx');
|
|
57
57
|
require('../utils/Animation.js');
|
|
58
58
|
var globalVar = require('../globalVar.js');
|
|
59
59
|
|
|
@@ -422,17 +422,18 @@ var RootStore = service.ServiceStore.named('RootStore')
|
|
|
422
422
|
}
|
|
423
423
|
// 设置全局变量,返回一个Promise
|
|
424
424
|
var setGlobalVars = mobxStateTree.flow(function setGlobalVars(vars) {
|
|
425
|
-
var _a, newVars, updateVars, removeVars,
|
|
426
|
-
return tslib.__generator(this, function (
|
|
427
|
-
switch (
|
|
425
|
+
var _a, newVars, updateVars, removeVars, globalVars;
|
|
426
|
+
return tslib.__generator(this, function (_b) {
|
|
427
|
+
switch (_b.label) {
|
|
428
428
|
case 0:
|
|
429
429
|
_a = diffVariables(vars || [], self.globalVars), newVars = _a.newVars, updateVars = _a.updateVars, removeVars = _a.removeVars;
|
|
430
|
-
// 初始化全局变量
|
|
431
|
-
_b = self;
|
|
432
430
|
return [4 /*yield*/, initializeGlobalVars(newVars, updateVars)];
|
|
433
431
|
case 1:
|
|
434
|
-
|
|
435
|
-
|
|
432
|
+
globalVars = _b.sent();
|
|
433
|
+
if (!mobxStateTree.isAlive(self)) {
|
|
434
|
+
return [2 /*return*/];
|
|
435
|
+
}
|
|
436
|
+
self.globalVars = globalVars;
|
|
436
437
|
removeVars.forEach(function (item) {
|
|
437
438
|
self.globalVarTempStates.delete(item.key);
|
|
438
439
|
});
|
|
@@ -613,6 +614,8 @@ var RootStore = service.ServiceStore.named('RootStore')
|
|
|
613
614
|
self.globalVarTempStates.forEach(function (state, key) {
|
|
614
615
|
self.globalVarStates.set(key, tslib.__assign({}, state));
|
|
615
616
|
});
|
|
617
|
+
}
|
|
618
|
+
function syncLegacyGlobalVarStates() {
|
|
616
619
|
if (self.legacyGlobalTempContext.__page !== self.context.__page ||
|
|
617
620
|
self.legacyGlobalTempContext.appVariables !== self.context.appVariables) {
|
|
618
621
|
Object.assign(self.context, self.legacyGlobalTempContext);
|
|
@@ -629,11 +632,40 @@ var RootStore = service.ServiceStore.named('RootStore')
|
|
|
629
632
|
if (pendingCount === 0) {
|
|
630
633
|
callbacks.forEach(function (callback) { return callback(); });
|
|
631
634
|
callbacks = [];
|
|
632
|
-
|
|
635
|
+
if (mobxStateTree.isAlive(self)) {
|
|
636
|
+
self.syncGlobalVarStates();
|
|
637
|
+
self.syncLegacyGlobalVarStates();
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
function observeSet(obj, callback) {
|
|
643
|
+
if (!obj || obj.__observed) {
|
|
644
|
+
// 如果已经被观察过了,就不需要再观察了
|
|
645
|
+
return obj;
|
|
646
|
+
}
|
|
647
|
+
var timer = 0;
|
|
648
|
+
return new Proxy(tslib.__assign({}, obj), {
|
|
649
|
+
get: function (target, prop) {
|
|
650
|
+
if (prop === '__observed') {
|
|
651
|
+
return true;
|
|
652
|
+
}
|
|
653
|
+
return Reflect.get(target, prop);
|
|
654
|
+
},
|
|
655
|
+
set: function (target, prop, value) {
|
|
656
|
+
Reflect.set(target, prop, value);
|
|
657
|
+
cancelAnimationFrame(timer);
|
|
658
|
+
timer = requestAnimationFrame(function () { return callback(target); });
|
|
659
|
+
console.warn("Don't modify the context directly.");
|
|
660
|
+
return true;
|
|
633
661
|
}
|
|
634
662
|
});
|
|
635
663
|
}
|
|
636
664
|
return {
|
|
665
|
+
updateContextBySetter: function (context) {
|
|
666
|
+
this.updateContext(context);
|
|
667
|
+
self.data = object.cloneObject(self.data);
|
|
668
|
+
},
|
|
637
669
|
updateContext: function (context, isInit) {
|
|
638
670
|
// 因为 context 不是受控属性,直接共用引用好了
|
|
639
671
|
// 否则还会触发孩子节点的重新渲染
|
|
@@ -641,9 +673,22 @@ var RootStore = service.ServiceStore.named('RootStore')
|
|
|
641
673
|
var _a = context || {}, __page = _a.__page, appVariables = _a.appVariables, rest = tslib.__rest(_a, ["__page", "appVariables"]);
|
|
642
674
|
// 对历史用法做兼容
|
|
643
675
|
if (__page || appVariables) {
|
|
676
|
+
// 有部分用户直接在自定义动作脚本里面修改 __page 或者 appVariables 变量
|
|
677
|
+
// 奇怪的是之前的实现方式这种修改是会更新变更的
|
|
678
|
+
// 所以这里用 Proxy 来解决不更新的问题
|
|
679
|
+
__page = __page
|
|
680
|
+
? observeSet(__page, function (__page) {
|
|
681
|
+
return self.updateContextBySetter(tslib.__assign(tslib.__assign({}, self.context), { __page: __page }));
|
|
682
|
+
})
|
|
683
|
+
: __page;
|
|
684
|
+
appVariables = appVariables
|
|
685
|
+
? observeSet(appVariables, function (appVariables) {
|
|
686
|
+
return self.updateContextBySetter(tslib.__assign(tslib.__assign({}, self.context), { appVariables: appVariables }));
|
|
687
|
+
})
|
|
688
|
+
: appVariables;
|
|
644
689
|
if (isInit) {
|
|
645
|
-
self.context.__page =
|
|
646
|
-
self.context.appVariables =
|
|
690
|
+
self.context.__page = __page;
|
|
691
|
+
self.context.appVariables = appVariables;
|
|
647
692
|
}
|
|
648
693
|
self.legacyGlobalTempContext.__page = __page;
|
|
649
694
|
self.legacyGlobalTempContext.appVariables = appVariables;
|
|
@@ -671,7 +716,15 @@ var RootStore = service.ServiceStore.named('RootStore')
|
|
|
671
716
|
},
|
|
672
717
|
init: init,
|
|
673
718
|
syncGlobalVarStates: syncGlobalVarStates,
|
|
719
|
+
syncLegacyGlobalVarStates: syncLegacyGlobalVarStates,
|
|
674
720
|
addSyncGlobalVarStatePendingTask: addSyncGlobalVarStatePendingTask,
|
|
721
|
+
afterCreate: function () {
|
|
722
|
+
mobxStateTree.addDisposer(self, mobx.reaction(function () { return self.nextGlobalData; }, function () {
|
|
723
|
+
return self.addSyncGlobalVarStatePendingTask(function (callback) {
|
|
724
|
+
return requestAnimationFrame(callback);
|
|
725
|
+
});
|
|
726
|
+
}));
|
|
727
|
+
},
|
|
675
728
|
afterDestroy: function () {
|
|
676
729
|
lazySaveGlobalVarValues.flush();
|
|
677
730
|
}
|
package/lib/store/service.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.13.0
|
|
2
|
+
* amis-core v6.13.0
|
|
3
3
|
* Copyright 2018-2025 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -16,25 +16,25 @@ var api = require('../utils/api.js');
|
|
|
16
16
|
var replaceText = require('../utils/replaceText.js');
|
|
17
17
|
var concatData = require('../utils/concatData.js');
|
|
18
18
|
var envOverwrite = require('../envOverwrite.js');
|
|
19
|
+
require('amis-formula');
|
|
20
|
+
require('moment');
|
|
21
|
+
var object = require('../utils/object.js');
|
|
22
|
+
require('../utils/memoryParse.js');
|
|
23
|
+
require('@rc-component/mini-decimal');
|
|
24
|
+
require('lodash/isPlainObject');
|
|
25
|
+
require('../utils/filter.js');
|
|
19
26
|
require('file-saver');
|
|
20
27
|
require('../utils/browser.js');
|
|
21
28
|
require('../utils/ColorScale.js');
|
|
22
29
|
require('../utils/columnsSplit.js');
|
|
23
|
-
require('../utils/memoryParse.js');
|
|
24
|
-
require('amis-formula');
|
|
25
|
-
require('lodash/isPlainObject');
|
|
26
|
-
var object = require('../utils/object.js');
|
|
27
30
|
require('../utils/DataSchema.js');
|
|
28
31
|
require('../utils/DataScope.js');
|
|
29
|
-
require('moment');
|
|
30
32
|
require('../utils/debug.js');
|
|
31
33
|
require('../utils/dom.js');
|
|
32
34
|
var tpl = require('../utils/tpl.js');
|
|
33
|
-
require('../utils/filter.js');
|
|
34
35
|
require('lodash/isObject');
|
|
35
36
|
require('lodash/isString');
|
|
36
37
|
require('lodash/isBoolean');
|
|
37
|
-
require('@rc-component/mini-decimal');
|
|
38
38
|
require('../utils/highlight.js');
|
|
39
39
|
require('../utils/icon.js');
|
|
40
40
|
require('../utils/image.js');
|
package/lib/store/status.js
CHANGED