amis-core 3.5.3 → 3.6.1
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 +1 -1
- package/esm/SchemaRenderer.js +1 -1
- package/esm/Scoped.d.ts +2 -0
- package/esm/Scoped.js +48 -6
- package/esm/StatusScoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +27 -12
- package/esm/actions/Action.js +30 -22
- 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 +3 -3
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +3 -3
- package/esm/actions/CustomAction.js +1 -1
- package/esm/actions/DialogAction.js +1 -1
- package/esm/actions/DrawerAction.js +1 -1
- package/esm/actions/EmailAction.js +1 -1
- package/esm/actions/LinkAction.js +5 -5
- 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.js +1 -1
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +3 -3
- package/esm/components/CustomStyle.js +1 -1
- package/esm/components/ErrorBoundary.d.ts +20 -0
- package/esm/components/ErrorBoundary.js +41 -0
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +1 -1
- package/esm/components/PopOver.d.ts +4 -0
- package/esm/components/PopOver.js +66 -3
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +1 -1
- package/esm/index.d.ts +2 -1
- package/esm/index.js +4 -3
- package/esm/locale.js +1 -1
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.d.ts +1 -1
- package/esm/renderers/Form.js +16 -8
- package/esm/renderers/Item.d.ts +54 -0
- package/esm/renderers/Item.js +1 -1
- package/esm/renderers/Options.d.ts +4 -0
- package/esm/renderers/Options.js +5 -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.js +4 -6
- package/esm/store/app.js +1 -1
- package/esm/store/combo.d.ts +24 -24
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +9 -1
- package/esm/store/crud.js +29 -13
- package/esm/store/form.d.ts +10 -10
- package/esm/store/form.js +1 -1
- package/esm/store/formItem.js +16 -7
- 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.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.js +1 -1
- package/esm/store/root.js +1 -1
- package/esm/store/service.js +1 -1
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +21 -20
- package/esm/store/table.js +8 -12
- package/esm/store/table2.js +1 -1
- package/esm/theme.js +1 -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.js +1 -1
- package/esm/utils/RootClose.js +1 -1
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/api.js +1 -1
- package/esm/utils/arraySlice.js +1 -1
- package/esm/utils/attachmentAdpator.js +3 -1
- 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.js +1 -1
- 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.d.ts +2 -1
- package/esm/utils/filter-schema.js +14 -5
- package/esm/utils/filter.js +1 -1
- package/esm/utils/formatDuration.js +1 -1
- package/esm/utils/formula.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 +1 -1
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.js +1 -1
- package/esm/utils/image.js +1 -1
- 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.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/renderer-event.js +1 -1
- 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 +5 -3
- 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 +1 -1
- package/lib/RootRenderer.js +1 -1
- package/lib/SchemaRenderer.js +1 -1
- package/lib/Scoped.d.ts +2 -0
- package/lib/Scoped.js +47 -5
- package/lib/StatusScoped.js +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +26 -11
- package/lib/actions/Action.js +29 -21
- 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 +3 -3
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +3 -3
- package/lib/actions/CustomAction.js +1 -1
- package/lib/actions/DialogAction.js +1 -1
- package/lib/actions/DrawerAction.js +1 -1
- package/lib/actions/EmailAction.js +1 -1
- package/lib/actions/LinkAction.js +5 -5
- 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.js +1 -1
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +3 -3
- package/lib/components/CustomStyle.js +1 -1
- package/lib/components/ErrorBoundary.d.ts +20 -0
- package/lib/components/ErrorBoundary.js +52 -0
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.js +1 -1
- package/lib/components/PopOver.d.ts +4 -0
- package/lib/components/PopOver.js +64 -1
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +5 -2
- package/lib/locale.js +1 -1
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.d.ts +1 -1
- package/lib/renderers/Form.js +16 -8
- package/lib/renderers/Item.d.ts +55 -1
- package/lib/renderers/Item.js +1 -1
- package/lib/renderers/Options.d.ts +4 -0
- package/lib/renderers/Options.js +5 -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.js +4 -6
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +25 -24
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +9 -1
- package/lib/store/crud.js +29 -13
- package/lib/store/form.d.ts +11 -10
- package/lib/store/form.js +1 -1
- package/lib/store/formItem.js +16 -7
- 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.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.js +1 -1
- package/lib/store/root.js +1 -1
- package/lib/store/service.js +1 -1
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +22 -20
- package/lib/store/table.js +8 -12
- package/lib/store/table2.js +1 -1
- package/lib/theme.js +1 -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.js +1 -1
- package/lib/utils/RootClose.js +1 -1
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/api.js +1 -1
- package/lib/utils/arraySlice.js +1 -1
- package/lib/utils/attachmentAdpator.js +3 -1
- 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.js +1 -1
- 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.d.ts +2 -1
- package/lib/utils/filter-schema.js +14 -4
- package/lib/utils/filter.js +1 -1
- package/lib/utils/formatDuration.js +1 -1
- package/lib/utils/formula.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 +1 -1
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.js +1 -1
- package/lib/utils/image.js +1 -1
- 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.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/renderer-event.js +1 -1
- 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 +5 -3
- 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 +3 -3
package/esm/utils/position.js
CHANGED
package/esm/utils/prettyBytes.js
CHANGED
package/esm/utils/replaceText.js
CHANGED
package/esm/utils/stripNumber.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.6.1
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -163,14 +163,16 @@ function formatStyle(themeCss, classNames, id, defaultData) {
|
|
|
163
163
|
style_1['top-left-border-radius'] || 0,
|
|
164
164
|
style_1['top-right-border-radius'] || 0,
|
|
165
165
|
style_1['bottom-right-border-radius'] || 0,
|
|
166
|
-
style_1['bottom-left-border-radius'] || 0
|
|
166
|
+
style_1['bottom-left-border-radius'] || 0,
|
|
167
|
+
(weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''
|
|
167
168
|
].join(' '));
|
|
168
169
|
}
|
|
169
170
|
else {
|
|
170
171
|
Object.keys(style_1).forEach(function (k) {
|
|
171
172
|
if (k !== '$$id') {
|
|
172
173
|
var value = style_1[k];
|
|
173
|
-
value &&
|
|
174
|
+
value &&
|
|
175
|
+
fn(k, value + ((weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''));
|
|
174
176
|
}
|
|
175
177
|
});
|
|
176
178
|
}
|
package/esm/utils/style.js
CHANGED
package/esm/utils/toNumber.js
CHANGED
package/esm/utils/tokenize.js
CHANGED
package/esm/utils/tpl-builtin.js
CHANGED
package/esm/utils/tpl-lodash.js
CHANGED
package/esm/utils/tpl.js
CHANGED
package/esm/utils/validations.js
CHANGED
package/lib/Root.js
CHANGED
package/lib/RootRenderer.js
CHANGED
package/lib/SchemaRenderer.js
CHANGED
package/lib/Scoped.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { RendererEnv, RendererProps } from './factory';
|
|
7
7
|
import { RendererData, ActionObject } from './types';
|
|
8
|
+
import { ListenerAction } from './actions';
|
|
8
9
|
/**
|
|
9
10
|
* target 里面可能包含 ?xxx=xxx,这种情况下,需要把 ?xxx=xxx 保留下来,然后对前面的部分进行 filter
|
|
10
11
|
* 因为后面会对 query 部分做不一样的处理。会保留原始的值。而不是会转成字符串。
|
|
@@ -36,6 +37,7 @@ export interface IScopedContext {
|
|
|
36
37
|
close: (target: string) => void;
|
|
37
38
|
closeById: (target: string) => void;
|
|
38
39
|
getComponentsByRefPath: (session: string, path: string) => ScopedComponentType[];
|
|
40
|
+
doAction: (actions: ListenerAction | ListenerAction[], ctx: any) => void;
|
|
39
41
|
}
|
|
40
42
|
type AliasIScopedContext = IScopedContext;
|
|
41
43
|
export declare const ScopedContext: React.Context<IScopedContext>;
|
package/lib/Scoped.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.6.1
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -14,9 +14,9 @@ var values = require('lodash/values');
|
|
|
14
14
|
var hoistNonReactStatic = require('hoist-non-react-statics');
|
|
15
15
|
var amisFormula = require('amis-formula');
|
|
16
16
|
require('moment');
|
|
17
|
-
require('
|
|
18
|
-
var getVariable = require('./utils/getVariable.js');
|
|
17
|
+
var object = require('./utils/object.js');
|
|
19
18
|
var isPureVariable = require('./utils/isPureVariable.js');
|
|
19
|
+
var getVariable = require('./utils/getVariable.js');
|
|
20
20
|
var dataMapping = require('./utils/dataMapping.js');
|
|
21
21
|
require('./utils/filter.js');
|
|
22
22
|
var helper = require('./utils/helper.js');
|
|
@@ -29,6 +29,7 @@ require('./utils/debug.js');
|
|
|
29
29
|
require('./utils/dom.js');
|
|
30
30
|
require('./utils/errors.js');
|
|
31
31
|
var tpl = require('./utils/tpl.js');
|
|
32
|
+
require('lodash/isPlainObject');
|
|
32
33
|
require('lodash/isObject');
|
|
33
34
|
require('lodash/isString');
|
|
34
35
|
require('lodash/isBoolean');
|
|
@@ -36,8 +37,7 @@ require('./utils/highlight.js');
|
|
|
36
37
|
require('./utils/icon.js');
|
|
37
38
|
require('./utils/image.js');
|
|
38
39
|
require('lodash/isEqual');
|
|
39
|
-
require('./
|
|
40
|
-
require('lodash/debounce');
|
|
40
|
+
var rendererEvent = require('./utils/renderer-event.js');
|
|
41
41
|
require('lodash/cloneDeep');
|
|
42
42
|
require('./utils/resize-sensor.js');
|
|
43
43
|
require('react-overlays/useRootClose');
|
|
@@ -53,6 +53,24 @@ require('./utils/validations.js');
|
|
|
53
53
|
require('./utils/resolveCondition.js');
|
|
54
54
|
require('mobx');
|
|
55
55
|
require('./utils/Animation.js');
|
|
56
|
+
require('./actions/LoopAction.js');
|
|
57
|
+
require('./actions/BreakAction.js');
|
|
58
|
+
require('./actions/ContinueAction.js');
|
|
59
|
+
require('./actions/SwitchAction.js');
|
|
60
|
+
require('./actions/ParallelAction.js');
|
|
61
|
+
require('./actions/CustomAction.js');
|
|
62
|
+
require('./actions/BroadcastAction.js');
|
|
63
|
+
require('./actions/CmptAction.js');
|
|
64
|
+
require('./actions/StatusAction.js');
|
|
65
|
+
require('./actions/AjaxAction.js');
|
|
66
|
+
require('./actions/CopyAction.js');
|
|
67
|
+
require('./actions/DialogAction.js');
|
|
68
|
+
require('./actions/DrawerAction.js');
|
|
69
|
+
require('./actions/EmailAction.js');
|
|
70
|
+
require('./actions/LinkAction.js');
|
|
71
|
+
require('./actions/ToastAction.js');
|
|
72
|
+
require('./actions/PageAction.js');
|
|
73
|
+
var Action = require('./actions/Action.js');
|
|
56
74
|
|
|
57
75
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
58
76
|
|
|
@@ -311,6 +329,30 @@ function createScopedTools(path, parent, env, rendererType) {
|
|
|
311
329
|
if (component && component.props.show) {
|
|
312
330
|
closeDialog(component);
|
|
313
331
|
}
|
|
332
|
+
},
|
|
333
|
+
doAction: function (actions, ctx) {
|
|
334
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
335
|
+
var renderer, rendererEvent$1;
|
|
336
|
+
return tslib.__generator(this, function (_a) {
|
|
337
|
+
switch (_a.label) {
|
|
338
|
+
case 0:
|
|
339
|
+
renderer = this.getComponents()[0];
|
|
340
|
+
rendererEvent$1 = rendererEvent.createRendererEvent('embed', {
|
|
341
|
+
env: env,
|
|
342
|
+
nativeEvent: undefined,
|
|
343
|
+
data: object.createObject(renderer.props.data, ctx),
|
|
344
|
+
scoped: this
|
|
345
|
+
});
|
|
346
|
+
return [4 /*yield*/, Action.runActions(actions, renderer, rendererEvent$1)];
|
|
347
|
+
case 1:
|
|
348
|
+
_a.sent();
|
|
349
|
+
if (rendererEvent$1.prevented) {
|
|
350
|
+
return [2 /*return*/];
|
|
351
|
+
}
|
|
352
|
+
return [2 /*return*/];
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
});
|
|
314
356
|
}
|
|
315
357
|
};
|
|
316
358
|
amisFormula.registerFunction('GETRENDERERDATA', function (componentId, path, scoped) {
|
package/lib/StatusScoped.js
CHANGED
package/lib/WithRootStore.js
CHANGED
package/lib/WithStore.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.6.1
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -72,12 +72,10 @@ function HocStoreFactory(renderer) {
|
|
|
72
72
|
var detectField = props.detectField, rest = tslib.__rest(props, ["detectField"]);
|
|
73
73
|
var exprProps = {};
|
|
74
74
|
if (!detectField || detectField === 'data') {
|
|
75
|
-
exprProps = filterSchema.getExprProperties(rest, store.data
|
|
75
|
+
exprProps = filterSchema.getExprProperties(rest, store.data);
|
|
76
76
|
_this.state = tslib.__assign({}, exprProps);
|
|
77
|
-
_this.unReaction = mobx.reaction(function () {
|
|
78
|
-
return
|
|
79
|
-
}, function () {
|
|
80
|
-
return _this.setState(tslib.__assign({}, filterSchema.getExprProperties(_this.props, store.data, undefined, _this.props)));
|
|
77
|
+
_this.unReaction = mobx.reaction(function () { return JSON.stringify(filterSchema.getExprProperties(_this.props, store.data)); }, function () {
|
|
78
|
+
return _this.setState(tslib.__assign({}, filterSchema.getExprProperties(_this.props, store.data)));
|
|
81
79
|
});
|
|
82
80
|
}
|
|
83
81
|
return _this;
|
|
@@ -97,10 +95,24 @@ function HocStoreFactory(renderer) {
|
|
|
97
95
|
return data;
|
|
98
96
|
};
|
|
99
97
|
StoreFactory.prototype.componentDidUpdate = function (prevProps) {
|
|
100
|
-
var
|
|
98
|
+
var _this = this;
|
|
99
|
+
var _a, _b, _c, _d;
|
|
101
100
|
var props = this.props;
|
|
102
101
|
var store = this.store;
|
|
103
|
-
|
|
102
|
+
// dialog 场景下 schema 是显示的时候更新的,
|
|
103
|
+
// 所以 schema 里面有表达式属性其实是监听不到变化的
|
|
104
|
+
// 所以这里需要根据新属性重新 reaction 一下
|
|
105
|
+
if ((!props.detectField || props.detectField === 'data') &&
|
|
106
|
+
filterSchema.hasExprPropertiesChanged(this.props, prevProps)) {
|
|
107
|
+
var state = filterSchema.getExprProperties(this.props, store.data);
|
|
108
|
+
helper.isObjectShallowModified(state, this.state) && this.setState(state);
|
|
109
|
+
// 需要重新监听
|
|
110
|
+
(_a = this.unReaction) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
111
|
+
this.unReaction = mobx.reaction(function () { return JSON.stringify(filterSchema.getExprProperties(props, store.data)); }, function () {
|
|
112
|
+
return _this.setState(tslib.__assign({}, filterSchema.getExprProperties(_this.props, store.data)));
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
var shouldSync = (_b = renderer.shouldSyncSuperStore) === null || _b === void 0 ? void 0 : _b.call(renderer, store, props, prevProps);
|
|
104
116
|
if (shouldSync === false) {
|
|
105
117
|
return;
|
|
106
118
|
}
|
|
@@ -135,10 +147,13 @@ function HocStoreFactory(renderer) {
|
|
|
135
147
|
? tslib.__assign({}, store.data) : helper.syncDataFromSuper(store.data, props.store.data, prevProps.scope, store, props.syncSuperStore === true)), props.updatePristineAfterStoreDataReInit === false);
|
|
136
148
|
}
|
|
137
149
|
else if (props.data && props.data.__super) {
|
|
138
|
-
store.initData(object.extendObject(props.data,
|
|
150
|
+
store.initData(object.extendObject(props.data,
|
|
151
|
+
// 有远程数据
|
|
152
|
+
// 或者顶级 store
|
|
153
|
+
store.hasRemoteData || !store.path.includes('/')
|
|
139
154
|
? tslib.__assign(tslib.__assign({}, store.data), props.data) : // combo 不需要同步,如果要同步,在 Combo.tsx 里面已经实现了相关逻辑
|
|
140
155
|
// 目前主要的问题是,如果 combo 中表单项名字和 combo 本身的名字一样,会导致里面的值会被覆盖成数组
|
|
141
|
-
((
|
|
156
|
+
((_c = props.store) === null || _c === void 0 ? void 0 : _c.storeType) === 'ComboStore'
|
|
142
157
|
? undefined
|
|
143
158
|
: helper.syncDataFromSuper(props.data, props.data.__super, prevProps.data.__super, store, false)), props.updatePristineAfterStoreDataReInit === false);
|
|
144
159
|
}
|
|
@@ -155,7 +170,7 @@ function HocStoreFactory(renderer) {
|
|
|
155
170
|
helper.isObjectShallowModified(props.data.__super, prevProps.data.__super, false)) {
|
|
156
171
|
store.initData(object.createObject(props.data.__super, tslib.__assign(tslib.__assign({}, props.data), store.data)), props.updatePristineAfterStoreDataReInit === false ||
|
|
157
172
|
(store.storeType === 'FormStore' &&
|
|
158
|
-
((
|
|
173
|
+
((_d = prevProps.store) === null || _d === void 0 ? void 0 : _d.storeType) === 'CRUDStore'));
|
|
159
174
|
}
|
|
160
175
|
// nextProps.data.__super !== props.data.__super) &&
|
|
161
176
|
}
|
package/lib/actions/Action.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.6.1
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -189,10 +189,10 @@ var runActions = function (actions, renderer, event) { return tslib.__awaiter(vo
|
|
|
189
189
|
}); };
|
|
190
190
|
// 执行动作,与原有动作处理打通
|
|
191
191
|
var runAction = function (actionInstrance, actionConfig, renderer, event) { return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
192
|
-
var additional, action, mergeData, expression, isStop, preventDefault, key, api, args, afterMappingData, actionData, data, stopped, actionResult, stopPropagation;
|
|
193
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
194
|
-
return tslib.__generator(this, function (
|
|
195
|
-
switch (
|
|
192
|
+
var additional, action, mergeData, expression, isStop, preventDefault, key, api, cmptFlag, targetComponent, args, afterMappingData, actionData, data, stopped, actionResult, stopPropagation;
|
|
193
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
194
|
+
return tslib.__generator(this, function (_v) {
|
|
195
|
+
switch (_v.label) {
|
|
196
196
|
case 0:
|
|
197
197
|
additional = {
|
|
198
198
|
event: event
|
|
@@ -214,8 +214,8 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
|
|
|
214
214
|
if (!expression) return [3 /*break*/, 2];
|
|
215
215
|
return [4 /*yield*/, tpl.evalExpressionWithConditionBuilder(expression, mergeData, true)];
|
|
216
216
|
case 1:
|
|
217
|
-
isStop = !(
|
|
218
|
-
|
|
217
|
+
isStop = !(_v.sent());
|
|
218
|
+
_v.label = 2;
|
|
219
219
|
case 2:
|
|
220
220
|
if (isStop) {
|
|
221
221
|
return [2 /*return*/];
|
|
@@ -224,8 +224,8 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
|
|
|
224
224
|
if (!action.preventDefault) return [3 /*break*/, 4];
|
|
225
225
|
return [4 /*yield*/, tpl.evalExpressionWithConditionBuilder(action.preventDefault, mergeData, false)];
|
|
226
226
|
case 3:
|
|
227
|
-
preventDefault =
|
|
228
|
-
|
|
227
|
+
preventDefault = _v.sent();
|
|
228
|
+
_v.label = 4;
|
|
229
229
|
case 4:
|
|
230
230
|
key = {
|
|
231
231
|
componentId: dataMapping.dataMapping(action.componentId, mergeData),
|
|
@@ -249,14 +249,22 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
|
|
|
249
249
|
(_q = action.args) === null || _q === void 0 ? true : delete _q.options;
|
|
250
250
|
(_r = action.args) === null || _r === void 0 ? true : delete _r.messages;
|
|
251
251
|
}
|
|
252
|
+
cmptFlag = key.componentId || key.componentName;
|
|
253
|
+
targetComponent = cmptFlag
|
|
254
|
+
? (_s = event.context.scoped) === null || _s === void 0 ? void 0 : _s[action.componentId ? 'getComponentById' : 'getComponentByName'](cmptFlag)
|
|
255
|
+
: renderer;
|
|
252
256
|
args = dataMapping.dataMapping(action.args, mergeData, function (key) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
'responseAdaptor',
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
'condition'
|
|
259
|
-
|
|
257
|
+
var _a;
|
|
258
|
+
var actionIgnoreKey = {
|
|
259
|
+
ajax: ['adaptor', 'responseAdaptor', 'requestAdaptor', 'responseData']
|
|
260
|
+
};
|
|
261
|
+
var cmptIgnoreMap = {
|
|
262
|
+
'input-table': ['condition']
|
|
263
|
+
};
|
|
264
|
+
var curCmptType = (_a = targetComponent === null || targetComponent === void 0 ? void 0 : targetComponent.props) === null || _a === void 0 ? void 0 : _a.type;
|
|
265
|
+
var curActionType = action.actionType;
|
|
266
|
+
var ignoreKey = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read((actionIgnoreKey[curActionType] || [])), false), tslib.__read((cmptIgnoreMap[curCmptType] || [])), false);
|
|
267
|
+
return ignoreKey.includes(key);
|
|
260
268
|
});
|
|
261
269
|
afterMappingData = dataMapping.dataMapping(action.data, mergeData);
|
|
262
270
|
actionData = args && Object.keys(args).length
|
|
@@ -266,12 +274,12 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
|
|
|
266
274
|
!['ajax', 'download', 'dialog', 'drawer'].includes(action.actionType) // 避免非法配置影响对actionData的判断,导致动作配置中的数据映射失败
|
|
267
275
|
? actionData
|
|
268
276
|
: mergeData;
|
|
269
|
-
(
|
|
277
|
+
(_t = console.group) === null || _t === void 0 ? void 0 : _t.call(console, "run action ".concat(action.actionType));
|
|
270
278
|
console.debug("[".concat(action.actionType, "] action args, data"), args, data);
|
|
271
279
|
stopped = false;
|
|
272
280
|
return [4 /*yield*/, actionInstrance.run(tslib.__assign(tslib.__assign(tslib.__assign({}, action), { args: args, data: action.actionType === 'reload' ? actionData : data }), key), renderer, event, mergeData)];
|
|
273
281
|
case 5:
|
|
274
|
-
actionResult =
|
|
282
|
+
actionResult = _v.sent();
|
|
275
283
|
// 二次确认弹窗如果取消,则终止后续动作
|
|
276
284
|
if ((action === null || action === void 0 ? void 0 : action.actionType) === 'confirmDialog' && !actionResult) {
|
|
277
285
|
stopped = true;
|
|
@@ -281,11 +289,11 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
|
|
|
281
289
|
if (!action.stopPropagation) return [3 /*break*/, 7];
|
|
282
290
|
return [4 /*yield*/, tpl.evalExpressionWithConditionBuilder(action.stopPropagation, mergeData, false)];
|
|
283
291
|
case 6:
|
|
284
|
-
stopPropagation =
|
|
285
|
-
|
|
292
|
+
stopPropagation = _v.sent();
|
|
293
|
+
_v.label = 7;
|
|
286
294
|
case 7:
|
|
287
295
|
console.debug("[".concat(action.actionType, "] action end event"), event);
|
|
288
|
-
(
|
|
296
|
+
(_u = console.groupEnd) === null || _u === void 0 ? void 0 : _u.call(console);
|
|
289
297
|
// 阻止原有动作执行
|
|
290
298
|
preventDefault && event.preventDefault();
|
|
291
299
|
// 阻止后续动作执行
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.6.1
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -34,7 +34,7 @@ var AjaxAction = /** @class */ (function () {
|
|
|
34
34
|
return tslib.__generator(this, function (_p) {
|
|
35
35
|
switch (_p.label) {
|
|
36
36
|
case 0:
|
|
37
|
-
if (!((_a =
|
|
37
|
+
if (!((_a = event.context.env) === null || _a === void 0 ? void 0 : _a.fetcher)) {
|
|
38
38
|
throw new Error('env.fetcher is required!');
|
|
39
39
|
}
|
|
40
40
|
if (!action.api) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.6.1
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -34,7 +34,7 @@ var CmptAction = /** @class */ (function () {
|
|
|
34
34
|
dataMergeMode = action.dataMergeMode || 'merge';
|
|
35
35
|
path = (_a = action.args) === null || _a === void 0 ? void 0 : _a.path;
|
|
36
36
|
if (!(action.actionType === 'setValue' && path && typeof path === 'string')) return [3 /*break*/, 2];
|
|
37
|
-
beforeSetData = (_c = (_b =
|
|
37
|
+
beforeSetData = (_c = (_b = event === null || event === void 0 ? void 0 : event.context) === null || _b === void 0 ? void 0 : _b.env) === null || _c === void 0 ? void 0 : _c.beforeSetData;
|
|
38
38
|
if (!(beforeSetData && typeof beforeSetData === 'function')) return [3 /*break*/, 2];
|
|
39
39
|
return [4 /*yield*/, beforeSetData(renderer, action, event)];
|
|
40
40
|
case 1:
|
|
@@ -47,7 +47,7 @@ var CmptAction = /** @class */ (function () {
|
|
|
47
47
|
component = key
|
|
48
48
|
? (_d = event.context.scoped) === null || _d === void 0 ? void 0 : _d[action.componentId ? 'getComponentById' : 'getComponentByName'](key)
|
|
49
49
|
: renderer;
|
|
50
|
-
// 如果key
|
|
50
|
+
// 如果key指定了,但是没找到组件,则报错
|
|
51
51
|
if (key && !component) {
|
|
52
52
|
msg = '尝试执行一个不存在的目标组件动作,请检查目标组件非隐藏状态,且正确指定了componentId或componentName';
|
|
53
53
|
if (action.ignoreError === false) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.6.1
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -24,11 +24,11 @@ var CopyAction = /** @class */ (function () {
|
|
|
24
24
|
var _a, _b, _c, _d, _e, _f;
|
|
25
25
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
26
26
|
return tslib.__generator(this, function (_g) {
|
|
27
|
-
if (!((_a =
|
|
27
|
+
if (!((_a = event.context.env) === null || _a === void 0 ? void 0 : _a.copy)) {
|
|
28
28
|
throw new Error('env.copy is required!');
|
|
29
29
|
}
|
|
30
30
|
if ((_b = action.args) === null || _b === void 0 ? void 0 : _b.content) {
|
|
31
|
-
(_d = (_c =
|
|
31
|
+
(_d = (_c = event.context.env) === null || _c === void 0 ? void 0 : _c.copy) === null || _d === void 0 ? void 0 : _d.call(_c, action.args.content, {
|
|
32
32
|
format: (_f = (_e = action.args) === null || _e === void 0 ? void 0 : _e.copyFormat) !== null && _f !== void 0 ? _f : 'text/html'
|
|
33
33
|
});
|
|
34
34
|
}
|