amis-core 6.13.0-beta.9 → 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 +2 -2
- 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 +7 -7
- 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 +100 -0
- package/esm/store/table.js +2 -2
- 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.js +2 -2
- 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.js +4 -2
- package/lib/SchemaRenderer.js +2 -2
- 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 +10 -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 +76 -34
- 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 -24
- 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 -10
- 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 -0
- 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 +120 -20
- package/lib/store/table.js +2 -2
- 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.js +2 -2
- 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/esm/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
|
|
|
@@ -12,13 +12,18 @@ var ModalStore = ServiceStore.named('ModalStore')
|
|
|
12
12
|
.props({
|
|
13
13
|
form: types.frozen(),
|
|
14
14
|
entered: false,
|
|
15
|
+
dragging: false,
|
|
15
16
|
resizeCoord: 0,
|
|
16
|
-
schema: types.frozen()
|
|
17
|
+
schema: types.frozen(),
|
|
18
|
+
isFullscreen: false
|
|
17
19
|
})
|
|
18
20
|
.views(function (self) {
|
|
19
21
|
return {
|
|
20
22
|
get formData() {
|
|
21
23
|
return createObject(self.data, self.form);
|
|
24
|
+
},
|
|
25
|
+
get inDragging() {
|
|
26
|
+
return self.dragging;
|
|
22
27
|
}
|
|
23
28
|
};
|
|
24
29
|
})
|
|
@@ -27,6 +32,9 @@ var ModalStore = ServiceStore.named('ModalStore')
|
|
|
27
32
|
setEntered: function (value) {
|
|
28
33
|
self.entered = value;
|
|
29
34
|
},
|
|
35
|
+
setDragging: function (value) {
|
|
36
|
+
self.dragging = value;
|
|
37
|
+
},
|
|
30
38
|
setFormData: function (obj) {
|
|
31
39
|
self.form = obj;
|
|
32
40
|
},
|
|
@@ -43,6 +51,10 @@ var ModalStore = ServiceStore.named('ModalStore')
|
|
|
43
51
|
return;
|
|
44
52
|
}
|
|
45
53
|
self.schema = schema;
|
|
54
|
+
},
|
|
55
|
+
setFullScreen: function (isFullscreen) {
|
|
56
|
+
if (isFullscreen === void 0) { isFullscreen = false; }
|
|
57
|
+
self.isFullscreen = isFullscreen;
|
|
46
58
|
}
|
|
47
59
|
};
|
|
48
60
|
});
|
package/esm/store/node.js
CHANGED
package/esm/store/pagination.js
CHANGED
package/esm/store/root.d.ts
CHANGED
|
@@ -94,6 +94,7 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
|
|
|
94
94
|
readonly nextGlobalData: any;
|
|
95
95
|
readonly downStream: any;
|
|
96
96
|
} & {
|
|
97
|
+
updateContextBySetter(context: any): void;
|
|
97
98
|
updateContext(context: any, isInit?: boolean): void;
|
|
98
99
|
updateGlobalVarState(key: string, state: Partial<GlobalVariableState>): void;
|
|
99
100
|
setGlobalVars: (vars?: Array<GlobalVariableItem>) => Promise<any>;
|
|
@@ -107,7 +108,9 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
|
|
|
107
108
|
updateLocation(location?: any, parseFn?: Function): void;
|
|
108
109
|
init: (schema: any) => Promise<any>;
|
|
109
110
|
syncGlobalVarStates: () => void;
|
|
111
|
+
syncLegacyGlobalVarStates: () => void;
|
|
110
112
|
addSyncGlobalVarStatePendingTask: (fn: (callback: () => void) => void, callback?: () => void) => void;
|
|
113
|
+
afterCreate(): void;
|
|
111
114
|
afterDestroy(): void;
|
|
112
115
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
113
116
|
export type IRootStore = Instance<typeof RootStore>;
|
package/esm/store/root.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.13.0
|
|
2
|
+
* amis-core v6.13.0
|
|
3
3
|
* Copyright 2018-2025 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __assign, __generator, __rest, __values, __awaiter, __read } from 'tslib';
|
|
7
|
-
import { types, flow } from 'mobx-state-tree';
|
|
7
|
+
import { types, flow, isAlive, addDisposer } from 'mobx-state-tree';
|
|
8
8
|
import { parseQuery, isObjectShallowModified } from '../utils/helper.js';
|
|
9
9
|
import { ServiceStore } from './service.js';
|
|
10
|
+
import 'amis-formula';
|
|
11
|
+
import 'moment';
|
|
12
|
+
import { extractObjectChain, createObjectFromChain, cloneObject } from '../utils/object.js';
|
|
13
|
+
import '../utils/memoryParse.js';
|
|
14
|
+
import '@rc-component/mini-decimal';
|
|
15
|
+
import isPlainObject from 'lodash/isPlainObject';
|
|
16
|
+
import '../utils/filter.js';
|
|
10
17
|
import '../utils/api.js';
|
|
11
18
|
import 'file-saver';
|
|
12
19
|
import '../utils/browser.js';
|
|
13
20
|
import '../utils/ColorScale.js';
|
|
14
21
|
import 'react';
|
|
15
22
|
import 'lodash/chunk';
|
|
16
|
-
import { extractObjectChain, createObjectFromChain, cloneObject } from '../utils/object.js';
|
|
17
|
-
import '../utils/memoryParse.js';
|
|
18
|
-
import 'amis-formula';
|
|
19
|
-
import isPlainObject from 'lodash/isPlainObject';
|
|
20
23
|
import '../utils/DataSchema.js';
|
|
21
24
|
import '../utils/DataScope.js';
|
|
22
|
-
import 'moment';
|
|
23
25
|
import '../utils/debug.js';
|
|
24
26
|
import 'react-dom';
|
|
25
27
|
import '../utils/errors.js';
|
|
26
28
|
import '../utils/tpl.js';
|
|
27
|
-
import '../utils/filter.js';
|
|
28
29
|
import 'lodash/isObject';
|
|
29
30
|
import 'lodash/isString';
|
|
30
31
|
import 'lodash/isBoolean';
|
|
31
|
-
import '@rc-component/mini-decimal';
|
|
32
32
|
import '../utils/image.js';
|
|
33
33
|
import 'lodash/isEqual';
|
|
34
34
|
import '../actions/Action.js';
|
|
@@ -46,7 +46,7 @@ import 'uncontrollable';
|
|
|
46
46
|
import 'hoist-non-react-statics';
|
|
47
47
|
import '../utils/validations.js';
|
|
48
48
|
import '../utils/resolveCondition.js';
|
|
49
|
-
import 'mobx';
|
|
49
|
+
import { reaction } from 'mobx';
|
|
50
50
|
import '../utils/Animation.js';
|
|
51
51
|
import { createGlobalVarState, buildGlobalVariable } from '../globalVar.js';
|
|
52
52
|
|
|
@@ -410,17 +410,18 @@ var RootStore = ServiceStore.named('RootStore')
|
|
|
410
410
|
}
|
|
411
411
|
// 设置全局变量,返回一个Promise
|
|
412
412
|
var setGlobalVars = flow(function setGlobalVars(vars) {
|
|
413
|
-
var _a, newVars, updateVars, removeVars,
|
|
414
|
-
return __generator(this, function (
|
|
415
|
-
switch (
|
|
413
|
+
var _a, newVars, updateVars, removeVars, globalVars;
|
|
414
|
+
return __generator(this, function (_b) {
|
|
415
|
+
switch (_b.label) {
|
|
416
416
|
case 0:
|
|
417
417
|
_a = diffVariables(vars || [], self.globalVars), newVars = _a.newVars, updateVars = _a.updateVars, removeVars = _a.removeVars;
|
|
418
|
-
// 初始化全局变量
|
|
419
|
-
_b = self;
|
|
420
418
|
return [4 /*yield*/, initializeGlobalVars(newVars, updateVars)];
|
|
421
419
|
case 1:
|
|
422
|
-
|
|
423
|
-
|
|
420
|
+
globalVars = _b.sent();
|
|
421
|
+
if (!isAlive(self)) {
|
|
422
|
+
return [2 /*return*/];
|
|
423
|
+
}
|
|
424
|
+
self.globalVars = globalVars;
|
|
424
425
|
removeVars.forEach(function (item) {
|
|
425
426
|
self.globalVarTempStates.delete(item.key);
|
|
426
427
|
});
|
|
@@ -601,6 +602,8 @@ var RootStore = ServiceStore.named('RootStore')
|
|
|
601
602
|
self.globalVarTempStates.forEach(function (state, key) {
|
|
602
603
|
self.globalVarStates.set(key, __assign({}, state));
|
|
603
604
|
});
|
|
605
|
+
}
|
|
606
|
+
function syncLegacyGlobalVarStates() {
|
|
604
607
|
if (self.legacyGlobalTempContext.__page !== self.context.__page ||
|
|
605
608
|
self.legacyGlobalTempContext.appVariables !== self.context.appVariables) {
|
|
606
609
|
Object.assign(self.context, self.legacyGlobalTempContext);
|
|
@@ -617,11 +620,40 @@ var RootStore = ServiceStore.named('RootStore')
|
|
|
617
620
|
if (pendingCount === 0) {
|
|
618
621
|
callbacks.forEach(function (callback) { return callback(); });
|
|
619
622
|
callbacks = [];
|
|
620
|
-
self
|
|
623
|
+
if (isAlive(self)) {
|
|
624
|
+
self.syncGlobalVarStates();
|
|
625
|
+
self.syncLegacyGlobalVarStates();
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
function observeSet(obj, callback) {
|
|
631
|
+
if (!obj || obj.__observed) {
|
|
632
|
+
// 如果已经被观察过了,就不需要再观察了
|
|
633
|
+
return obj;
|
|
634
|
+
}
|
|
635
|
+
var timer = 0;
|
|
636
|
+
return new Proxy(__assign({}, obj), {
|
|
637
|
+
get: function (target, prop) {
|
|
638
|
+
if (prop === '__observed') {
|
|
639
|
+
return true;
|
|
640
|
+
}
|
|
641
|
+
return Reflect.get(target, prop);
|
|
642
|
+
},
|
|
643
|
+
set: function (target, prop, value) {
|
|
644
|
+
Reflect.set(target, prop, value);
|
|
645
|
+
cancelAnimationFrame(timer);
|
|
646
|
+
timer = requestAnimationFrame(function () { return callback(target); });
|
|
647
|
+
console.warn("Don't modify the context directly.");
|
|
648
|
+
return true;
|
|
621
649
|
}
|
|
622
650
|
});
|
|
623
651
|
}
|
|
624
652
|
return {
|
|
653
|
+
updateContextBySetter: function (context) {
|
|
654
|
+
this.updateContext(context);
|
|
655
|
+
self.data = cloneObject(self.data);
|
|
656
|
+
},
|
|
625
657
|
updateContext: function (context, isInit) {
|
|
626
658
|
// 因为 context 不是受控属性,直接共用引用好了
|
|
627
659
|
// 否则还会触发孩子节点的重新渲染
|
|
@@ -629,9 +661,22 @@ var RootStore = ServiceStore.named('RootStore')
|
|
|
629
661
|
var _a = context || {}, __page = _a.__page, appVariables = _a.appVariables, rest = __rest(_a, ["__page", "appVariables"]);
|
|
630
662
|
// 对历史用法做兼容
|
|
631
663
|
if (__page || appVariables) {
|
|
664
|
+
// 有部分用户直接在自定义动作脚本里面修改 __page 或者 appVariables 变量
|
|
665
|
+
// 奇怪的是之前的实现方式这种修改是会更新变更的
|
|
666
|
+
// 所以这里用 Proxy 来解决不更新的问题
|
|
667
|
+
__page = __page
|
|
668
|
+
? observeSet(__page, function (__page) {
|
|
669
|
+
return self.updateContextBySetter(__assign(__assign({}, self.context), { __page: __page }));
|
|
670
|
+
})
|
|
671
|
+
: __page;
|
|
672
|
+
appVariables = appVariables
|
|
673
|
+
? observeSet(appVariables, function (appVariables) {
|
|
674
|
+
return self.updateContextBySetter(__assign(__assign({}, self.context), { appVariables: appVariables }));
|
|
675
|
+
})
|
|
676
|
+
: appVariables;
|
|
632
677
|
if (isInit) {
|
|
633
|
-
self.context.__page =
|
|
634
|
-
self.context.appVariables =
|
|
678
|
+
self.context.__page = __page;
|
|
679
|
+
self.context.appVariables = appVariables;
|
|
635
680
|
}
|
|
636
681
|
self.legacyGlobalTempContext.__page = __page;
|
|
637
682
|
self.legacyGlobalTempContext.appVariables = appVariables;
|
|
@@ -659,7 +704,15 @@ var RootStore = ServiceStore.named('RootStore')
|
|
|
659
704
|
},
|
|
660
705
|
init: init,
|
|
661
706
|
syncGlobalVarStates: syncGlobalVarStates,
|
|
707
|
+
syncLegacyGlobalVarStates: syncLegacyGlobalVarStates,
|
|
662
708
|
addSyncGlobalVarStatePendingTask: addSyncGlobalVarStatePendingTask,
|
|
709
|
+
afterCreate: function () {
|
|
710
|
+
addDisposer(self, reaction(function () { return self.nextGlobalData; }, function () {
|
|
711
|
+
return self.addSyncGlobalVarStatePendingTask(function (callback) {
|
|
712
|
+
return requestAnimationFrame(callback);
|
|
713
|
+
});
|
|
714
|
+
}));
|
|
715
|
+
},
|
|
663
716
|
afterDestroy: function () {
|
|
664
717
|
lazySaveGlobalVarValues.flush();
|
|
665
718
|
}
|
package/esm/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
|
|
|
@@ -12,26 +12,26 @@ import { normalizeApiResponseData } from '../utils/api.js';
|
|
|
12
12
|
import { replaceText } from '../utils/replaceText.js';
|
|
13
13
|
import { concatData } from '../utils/concatData.js';
|
|
14
14
|
import { envOverwrite } from '../envOverwrite.js';
|
|
15
|
+
import 'amis-formula';
|
|
16
|
+
import 'moment';
|
|
17
|
+
import { isObject, extendObject } from '../utils/object.js';
|
|
18
|
+
import '../utils/memoryParse.js';
|
|
19
|
+
import '@rc-component/mini-decimal';
|
|
20
|
+
import 'lodash/isPlainObject';
|
|
21
|
+
import '../utils/filter.js';
|
|
15
22
|
import 'file-saver';
|
|
16
23
|
import '../utils/browser.js';
|
|
17
24
|
import '../utils/ColorScale.js';
|
|
18
25
|
import 'react';
|
|
19
26
|
import 'lodash/chunk';
|
|
20
|
-
import '../utils/memoryParse.js';
|
|
21
|
-
import 'amis-formula';
|
|
22
|
-
import 'lodash/isPlainObject';
|
|
23
|
-
import { isObject, extendObject } from '../utils/object.js';
|
|
24
27
|
import '../utils/DataSchema.js';
|
|
25
28
|
import '../utils/DataScope.js';
|
|
26
|
-
import 'moment';
|
|
27
29
|
import '../utils/debug.js';
|
|
28
30
|
import 'react-dom';
|
|
29
31
|
import { filter } from '../utils/tpl.js';
|
|
30
|
-
import '../utils/filter.js';
|
|
31
32
|
import 'lodash/isObject';
|
|
32
33
|
import 'lodash/isString';
|
|
33
34
|
import 'lodash/isBoolean';
|
|
34
|
-
import '@rc-component/mini-decimal';
|
|
35
35
|
import '../utils/image.js';
|
|
36
36
|
import 'lodash/isEqual';
|
|
37
37
|
import '../actions/Action.js';
|
package/esm/store/status.js
CHANGED