amis-core 3.5.2 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/Root.js +1 -1
- package/esm/RootRenderer.d.ts +1 -1
- package/esm/RootRenderer.js +2 -2
- package/esm/SchemaRenderer.js +1 -1
- package/esm/Scoped.d.ts +2 -0
- package/esm/Scoped.js +49 -7
- 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 +31 -32
- 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.d.ts +9 -0
- package/esm/env.js +1 -1
- package/esm/envOverwrite.d.ts +1 -1
- package/esm/envOverwrite.js +15 -35
- package/esm/factory.js +1 -1
- package/esm/index.d.ts +2 -1
- package/esm/index.js +5 -4
- package/esm/locale.js +1 -1
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.d.ts +10 -4
- package/esm/renderers/Form.js +64 -32
- package/esm/renderers/Item.d.ts +54 -0
- package/esm/renderers/Item.js +1 -1
- package/esm/renderers/Options.d.ts +5 -1
- package/esm/renderers/Options.js +11 -9
- 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 +10 -17
- package/esm/store/app.js +1 -1
- package/esm/store/combo.d.ts +1154 -48
- package/esm/store/combo.js +10 -3
- package/esm/store/crud.d.ts +9 -1
- package/esm/store/crud.js +50 -15
- package/esm/store/form.d.ts +480 -20
- package/esm/store/form.js +1 -1
- package/esm/store/formItem.d.ts +23 -1
- package/esm/store/formItem.js +103 -15
- 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 +1078 -42
- package/esm/store/table.js +64 -6
- package/esm/store/table2.js +1 -4
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +8 -2
- 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.d.ts +2 -2
- package/esm/utils/helper.js +37 -29
- 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 +8 -5
- 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 +15 -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.d.ts +7 -0
- package/esm/utils/renderer-event.js +30 -18
- 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 +12 -15
- package/esm/utils/style.js +3 -2
- 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.d.ts +1 -1
- package/lib/RootRenderer.js +2 -2
- package/lib/SchemaRenderer.js +1 -1
- package/lib/Scoped.d.ts +2 -0
- package/lib/Scoped.js +48 -6
- 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 +31 -32
- 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.d.ts +9 -0
- package/lib/env.js +1 -1
- package/lib/envOverwrite.d.ts +1 -1
- package/lib/envOverwrite.js +18 -34
- package/lib/factory.js +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -3
- package/lib/locale.js +1 -1
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.d.ts +10 -4
- package/lib/renderers/Form.js +64 -32
- package/lib/renderers/Item.d.ts +54 -0
- package/lib/renderers/Item.js +1 -1
- package/lib/renderers/Options.d.ts +5 -1
- package/lib/renderers/Options.js +11 -9
- 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 +10 -17
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +1154 -49
- package/lib/store/combo.js +10 -3
- package/lib/store/crud.d.ts +9 -1
- package/lib/store/crud.js +50 -15
- package/lib/store/form.d.ts +480 -21
- package/lib/store/form.js +1 -1
- package/lib/store/formItem.d.ts +23 -1
- package/lib/store/formItem.js +104 -15
- 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 +1078 -43
- package/lib/store/table.js +63 -5
- package/lib/store/table2.js +1 -4
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +8 -2
- 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.d.ts +2 -2
- package/lib/utils/helper.js +36 -28
- 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 +8 -5
- 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 +15 -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.d.ts +7 -0
- package/lib/utils/renderer-event.js +30 -18
- 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 +12 -15
- package/lib/utils/style.js +3 -2
- 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/lib/Scoped.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.6.0
|
|
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
|
|
|
@@ -249,7 +267,7 @@ function createScopedTools(path, parent, env, rendererType) {
|
|
|
249
267
|
}
|
|
250
268
|
}
|
|
251
269
|
else {
|
|
252
|
-
var component = scoped.getComponentByName(name);
|
|
270
|
+
var component = scoped.getComponentByName(name) || scoped.getComponentById(name);
|
|
253
271
|
component &&
|
|
254
272
|
component.reload &&
|
|
255
273
|
component.reload(subPath, query, ctx);
|
|
@@ -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.0
|
|
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.0
|
|
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.0
|
|
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.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -25,16 +25,29 @@ var CmptAction = /** @class */ (function () {
|
|
|
25
25
|
CmptAction.prototype.run = function (action, renderer, event) {
|
|
26
26
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
27
27
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
28
|
-
var key, dataMergeMode,
|
|
28
|
+
var key, dataMergeMode, path, beforeSetData, res, component, msg, result, e_1;
|
|
29
29
|
var _t, _u;
|
|
30
30
|
return tslib.__generator(this, function (_v) {
|
|
31
31
|
switch (_v.label) {
|
|
32
32
|
case 0:
|
|
33
33
|
key = action.componentId || action.componentName;
|
|
34
34
|
dataMergeMode = action.dataMergeMode || 'merge';
|
|
35
|
+
path = (_a = action.args) === null || _a === void 0 ? void 0 : _a.path;
|
|
36
|
+
if (!(action.actionType === 'setValue' && path && typeof path === 'string')) return [3 /*break*/, 2];
|
|
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
|
+
if (!(beforeSetData && typeof beforeSetData === 'function')) return [3 /*break*/, 2];
|
|
39
|
+
return [4 /*yield*/, beforeSetData(renderer, action, event)];
|
|
40
|
+
case 1:
|
|
41
|
+
res = _v.sent();
|
|
42
|
+
if (res === false) {
|
|
43
|
+
return [2 /*return*/];
|
|
44
|
+
}
|
|
45
|
+
_v.label = 2;
|
|
46
|
+
case 2:
|
|
35
47
|
component = key
|
|
36
|
-
? (
|
|
37
|
-
:
|
|
48
|
+
? (_d = event.context.scoped) === null || _d === void 0 ? void 0 : _d[action.componentId ? 'getComponentById' : 'getComponentByName'](key)
|
|
49
|
+
: renderer;
|
|
50
|
+
// 如果key指定了,但是没找到组件,则报错
|
|
38
51
|
if (key && !component) {
|
|
39
52
|
msg = '尝试执行一个不存在的目标组件动作,请检查目标组件非隐藏状态,且正确指定了componentId或componentName';
|
|
40
53
|
if (action.ignoreError === false) {
|
|
@@ -44,37 +57,23 @@ var CmptAction = /** @class */ (function () {
|
|
|
44
57
|
console.warn(msg);
|
|
45
58
|
}
|
|
46
59
|
}
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return [4 /*yield*/, beforeSetData(renderer, action, event)];
|
|
55
|
-
case 1:
|
|
56
|
-
res = _v.sent();
|
|
57
|
-
if (res === false) {
|
|
58
|
-
return [2 /*return*/];
|
|
59
|
-
}
|
|
60
|
-
_v.label = 2;
|
|
61
|
-
case 2:
|
|
62
|
-
if (component === null || component === void 0 ? void 0 : component.setData) {
|
|
63
|
-
return [2 /*return*/, component === null || component === void 0 ? void 0 : component.setData((_e = action.args) === null || _e === void 0 ? void 0 : _e.value, dataMergeMode === 'override', (_f = action.args) === null || _f === void 0 ? void 0 : _f.index, (_g = action.args) === null || _g === void 0 ? void 0 : _g.condition)];
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
return [2 /*return*/, (_j = component === null || component === void 0 ? void 0 : (_h = component.props).onChange) === null || _j === void 0 ? void 0 : _j.call(_h, (_k = action.args) === null || _k === void 0 ? void 0 : _k.value)];
|
|
60
|
+
if (action.actionType === 'setValue') {
|
|
61
|
+
if (component === null || component === void 0 ? void 0 : component.setData) {
|
|
62
|
+
return [2 /*return*/, component === null || component === void 0 ? void 0 : component.setData((_e = action.args) === null || _e === void 0 ? void 0 : _e.value, dataMergeMode === 'override', (_f = action.args) === null || _f === void 0 ? void 0 : _f.index, (_g = action.args) === null || _g === void 0 ? void 0 : _g.condition)];
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return [2 /*return*/, (_j = component === null || component === void 0 ? void 0 : (_h = component.props).onChange) === null || _j === void 0 ? void 0 : _j.call(_h, (_k = action.args) === null || _k === void 0 ? void 0 : _k.value)];
|
|
66
|
+
}
|
|
67
67
|
}
|
|
68
|
-
case 3:
|
|
69
68
|
// 刷新
|
|
70
69
|
if (action.actionType === 'reload') {
|
|
71
70
|
return [2 /*return*/, (_l = component === null || component === void 0 ? void 0 : component.reload) === null || _l === void 0 ? void 0 : _l.call(component, undefined, action.data, undefined, undefined, dataMergeMode === 'override', action.args)];
|
|
72
71
|
}
|
|
73
|
-
_v.label =
|
|
74
|
-
case
|
|
75
|
-
_v.trys.push([
|
|
72
|
+
_v.label = 3;
|
|
73
|
+
case 3:
|
|
74
|
+
_v.trys.push([3, 5, , 6]);
|
|
76
75
|
return [4 /*yield*/, ((_m = component === null || component === void 0 ? void 0 : component.doAction) === null || _m === void 0 ? void 0 : _m.call(component, action, action.args, true))];
|
|
77
|
-
case
|
|
76
|
+
case 4:
|
|
78
77
|
result = _v.sent();
|
|
79
78
|
if (['validate', 'submit'].includes(action.actionType)) {
|
|
80
79
|
event.setData(object.createObject(event.data, (_t = {},
|
|
@@ -86,7 +85,7 @@ var CmptAction = /** @class */ (function () {
|
|
|
86
85
|
_t)));
|
|
87
86
|
}
|
|
88
87
|
return [2 /*return*/, result];
|
|
89
|
-
case
|
|
88
|
+
case 5:
|
|
90
89
|
e_1 = _v.sent();
|
|
91
90
|
event.setData(object.createObject(event.data, (_u = {},
|
|
92
91
|
_u[action.outputVar || "".concat(action.actionType, "Result")] = {
|
|
@@ -95,8 +94,8 @@ var CmptAction = /** @class */ (function () {
|
|
|
95
94
|
payload: (_s = (_r = component === null || component === void 0 ? void 0 : component.props) === null || _r === void 0 ? void 0 : _r.store) === null || _s === void 0 ? void 0 : _s.data
|
|
96
95
|
},
|
|
97
96
|
_u)));
|
|
98
|
-
return [3 /*break*/,
|
|
99
|
-
case
|
|
97
|
+
return [3 /*break*/, 6];
|
|
98
|
+
case 6: return [2 /*return*/];
|
|
100
99
|
}
|
|
101
100
|
});
|
|
102
101
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.6.0
|
|
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
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.6.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -22,11 +22,11 @@ var LinkAction = /** @class */ (function () {
|
|
|
22
22
|
function LinkAction() {
|
|
23
23
|
}
|
|
24
24
|
LinkAction.prototype.run = function (action, renderer, event) {
|
|
25
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
26
26
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
27
27
|
var urlObj;
|
|
28
|
-
return tslib.__generator(this, function (
|
|
29
|
-
if (!((_a =
|
|
28
|
+
return tslib.__generator(this, function (_j) {
|
|
29
|
+
if (!((_a = event.context.env) === null || _a === void 0 ? void 0 : _a.jumpTo)) {
|
|
30
30
|
throw new Error('env.jumpTo is required!');
|
|
31
31
|
}
|
|
32
32
|
urlObj = api.buildApi({
|
|
@@ -35,7 +35,7 @@ var LinkAction = /** @class */ (function () {
|
|
|
35
35
|
}, tslib.__assign(tslib.__assign({}, ((_e = (_d = action.args) === null || _d === void 0 ? void 0 : _d.params) !== null && _e !== void 0 ? _e : {})), ((_f = action.data) !== null && _f !== void 0 ? _f : {})), {
|
|
36
36
|
autoAppend: true
|
|
37
37
|
});
|
|
38
|
-
|
|
38
|
+
(_g = event.context.env) === null || _g === void 0 ? void 0 : _g.jumpTo(urlObj.url, tslib.__assign({ actionType: action.actionType, type: 'button' }, action.args), (_h = action.data) !== null && _h !== void 0 ? _h : {});
|
|
39
39
|
return [2 /*return*/];
|
|
40
40
|
});
|
|
41
41
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.6.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -20,10 +20,10 @@ var ToastAction = /** @class */ (function () {
|
|
|
20
20
|
var _a, _b, _c, _d, _e;
|
|
21
21
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
22
22
|
return tslib.__generator(this, function (_f) {
|
|
23
|
-
if (!((_a =
|
|
23
|
+
if (!((_a = event.context.env) === null || _a === void 0 ? void 0 : _a.notify)) {
|
|
24
24
|
throw new Error('env.notify is required!');
|
|
25
25
|
}
|
|
26
|
-
(_c = (_b = event.context.env).notify) === null || _c === void 0 ? void 0 : _c.call(_b, ((_d = action.args) === null || _d === void 0 ? void 0 : _d.msgType) || 'info', String((_e = action.args) === null || _e === void 0 ? void 0 : _e.msg), action.args);
|
|
26
|
+
(_c = (_b = event.context.env) === null || _b === void 0 ? void 0 : _b.notify) === null || _c === void 0 ? void 0 : _c.call(_b, ((_d = action.args) === null || _d === void 0 ? void 0 : _d.msgType) || 'info', String((_e = action.args) === null || _e === void 0 ? void 0 : _e.msg), action.args);
|
|
27
27
|
return [2 /*return*/];
|
|
28
28
|
});
|
|
29
29
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ErrorBoundary
|
|
3
|
+
* @description 捕获发生在其子组件树任何位置的 JavaScript 错误,并打印这些错误
|
|
4
|
+
* @author wibetter
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
interface ErrorBoundaryProps {
|
|
8
|
+
customErrorMsg?: string;
|
|
9
|
+
fallback?: () => void;
|
|
10
|
+
children: any;
|
|
11
|
+
}
|
|
12
|
+
interface ErrorBoundaryStates {
|
|
13
|
+
hasError: boolean;
|
|
14
|
+
}
|
|
15
|
+
export default class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryStates> {
|
|
16
|
+
constructor(props: any);
|
|
17
|
+
componentDidCatch(error: any, errorInfo: any): void;
|
|
18
|
+
render(): any;
|
|
19
|
+
}
|
|
20
|
+
export {};
|