amis-core 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/Root.d.ts +1 -1
- package/esm/Root.js +1 -1
- package/esm/RootRenderer.d.ts +1 -1
- package/esm/RootRenderer.js +21 -4
- package/esm/SchemaRenderer.d.ts +2 -1
- package/esm/SchemaRenderer.js +1 -1
- package/esm/Scoped.js +30 -2
- package/esm/WithRootStore.d.ts +4 -8
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- package/esm/actions/Action.d.ts +2 -1
- package/esm/actions/Action.js +33 -11
- package/esm/actions/AjaxAction.js +1 -1
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.js +1 -1
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +2 -1
- package/esm/actions/DialogAction.d.ts +1 -1
- package/esm/actions/DialogAction.js +8 -3
- package/esm/actions/DrawerAction.js +1 -1
- package/esm/actions/EmailAction.js +1 -1
- package/esm/actions/LinkAction.js +1 -1
- package/esm/actions/LoopAction.js +1 -1
- package/esm/actions/PageAction.js +1 -1
- package/esm/actions/ParallelAction.js +1 -1
- package/esm/actions/SwitchAction.js +18 -15
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/LazyComponent.d.ts +3 -3
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.d.ts +1 -1
- package/esm/components/Overlay.js +2 -1
- package/esm/components/PopOver.d.ts +2 -4
- package/esm/components/PopOver.js +2 -1
- package/esm/env.d.ts +3 -7
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +3 -1
- package/esm/index.d.ts +2 -3
- package/esm/index.js +7 -5
- package/esm/locale.d.ts +1 -3
- package/esm/locale.js +1 -1
- package/esm/renderers/Form.js +17 -15
- package/esm/renderers/Item.d.ts +9 -15
- package/esm/renderers/Item.js +2 -1
- package/esm/renderers/Options.js +2 -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 +4 -8
- package/esm/renderers/wrapControl.js +21 -30
- package/esm/store/app.d.ts +4 -2
- package/esm/store/app.js +1 -1
- package/esm/store/combo.d.ts +12 -6
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +5 -2
- package/esm/store/crud.js +32 -12
- package/esm/store/form.d.ts +4 -2
- package/esm/store/form.js +1 -1
- package/esm/store/formItem.js +5 -4
- package/esm/store/iRenderer.d.ts +5 -2
- package/esm/store/iRenderer.js +15 -3
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +4 -2
- package/esm/store/list.js +5 -5
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.d.ts +4 -2
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.d.ts +4 -2
- package/esm/store/pagination.js +1 -1
- package/esm/store/root.d.ts +4 -2
- package/esm/store/root.js +1 -1
- package/esm/store/service.d.ts +4 -2
- package/esm/store/service.js +1 -1
- package/esm/store/table.d.ts +12 -6
- package/esm/store/table.js +12 -2
- package/esm/store/table2.d.ts +4 -2
- package/esm/store/table2.js +1 -1
- package/esm/theme.d.ts +2 -4
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +39 -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 +3 -4
- package/esm/utils/attachmentAdpator.js +1 -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.d.ts +1 -0
- 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.d.ts +1 -0
- package/esm/utils/formula.js +6 -2
- 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/index.d.ts +2 -0
- 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/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 +7 -3
- 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.d.ts +5 -0
- package/esm/utils/resolveCondition.js +306 -0
- package/esm/utils/resolveVariable.js +1 -1
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.d.ts +1 -0
- package/esm/utils/resolveVariableAndFilterForAsync.js +46 -0
- 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 +1 -1
- 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.d.ts +7 -0
- package/esm/utils/tpl.js +23 -3
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.js +1 -1
- package/lib/Root.d.ts +1 -1
- package/lib/Root.js +1 -1
- package/lib/RootRenderer.d.ts +1 -1
- package/lib/RootRenderer.js +21 -4
- package/lib/SchemaRenderer.d.ts +2 -1
- package/lib/SchemaRenderer.js +1 -1
- package/lib/Scoped.js +30 -2
- package/lib/WithRootStore.d.ts +4 -8
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +1 -1
- package/lib/actions/Action.d.ts +2 -1
- package/lib/actions/Action.js +32 -10
- package/lib/actions/AjaxAction.js +1 -1
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.js +1 -1
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +2 -1
- package/lib/actions/DialogAction.d.ts +1 -1
- package/lib/actions/DialogAction.js +8 -3
- package/lib/actions/DrawerAction.js +1 -1
- package/lib/actions/EmailAction.js +1 -1
- package/lib/actions/LinkAction.js +1 -1
- package/lib/actions/LoopAction.js +1 -1
- package/lib/actions/PageAction.js +1 -1
- package/lib/actions/ParallelAction.js +1 -1
- package/lib/actions/SwitchAction.js +17 -14
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/LazyComponent.d.ts +3 -3
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.d.ts +1 -1
- package/lib/components/Overlay.js +2 -1
- package/lib/components/PopOver.d.ts +2 -4
- package/lib/components/PopOver.js +2 -1
- package/lib/env.d.ts +3 -7
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +3 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.js +18 -2
- package/lib/locale.d.ts +1 -3
- package/lib/locale.js +1 -1
- package/lib/renderers/Form.js +16 -14
- package/lib/renderers/Item.d.ts +9 -15
- package/lib/renderers/Item.js +2 -1
- package/lib/renderers/Options.js +2 -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 +4 -8
- package/lib/renderers/wrapControl.js +20 -28
- package/lib/store/app.d.ts +4 -2
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +12 -6
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +5 -2
- package/lib/store/crud.js +31 -11
- package/lib/store/form.d.ts +4 -2
- package/lib/store/form.js +1 -1
- package/lib/store/formItem.js +5 -4
- package/lib/store/iRenderer.d.ts +5 -2
- package/lib/store/iRenderer.js +15 -3
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +4 -2
- package/lib/store/list.js +5 -5
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.d.ts +4 -2
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.d.ts +4 -2
- package/lib/store/pagination.js +1 -1
- package/lib/store/root.d.ts +4 -2
- package/lib/store/root.js +1 -1
- package/lib/store/service.d.ts +4 -2
- package/lib/store/service.js +1 -1
- package/lib/store/table.d.ts +12 -6
- package/lib/store/table.js +12 -2
- package/lib/store/table2.d.ts +4 -2
- package/lib/store/table2.js +1 -1
- package/lib/theme.d.ts +2 -4
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +39 -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 +2 -3
- package/lib/utils/attachmentAdpator.js +1 -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.d.ts +1 -0
- 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.d.ts +1 -0
- package/lib/utils/formula.js +6 -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/index.d.ts +2 -0
- 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/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 +7 -3
- 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.d.ts +5 -0
- package/lib/utils/resolveCondition.js +322 -0
- package/lib/utils/resolveVariable.js +1 -1
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.d.ts +1 -0
- package/lib/utils/resolveVariableAndFilterForAsync.js +50 -0
- 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 +1 -1
- 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.d.ts +7 -0
- package/lib/utils/tpl.js +22 -1
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validations.js +1 -1
- package/package.json +5 -5
package/esm/Root.d.ts
CHANGED
package/esm/Root.js
CHANGED
package/esm/RootRenderer.d.ts
CHANGED
|
@@ -23,5 +23,5 @@ export declare class RootRenderer extends React.Component<RootRendererProps> {
|
|
|
23
23
|
handleDrawerClose(): void;
|
|
24
24
|
openFeedback(dialog: any, ctx: any): Promise<unknown>;
|
|
25
25
|
reloadTarget(scoped: IScopedContext, target: string, data?: any): void;
|
|
26
|
-
render(): React.
|
|
26
|
+
render(): string | number | boolean | JSX.Element | React.ReactFragment | null | undefined;
|
|
27
27
|
}
|
package/esm/RootRenderer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -111,11 +111,11 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
111
111
|
}
|
|
112
112
|
else if (action.actionType === 'dialog') {
|
|
113
113
|
store.setCurrentAction(action);
|
|
114
|
-
store.openDialog(ctx);
|
|
114
|
+
store.openDialog(ctx, undefined, undefined, delegate);
|
|
115
115
|
}
|
|
116
116
|
else if (action.actionType === 'drawer') {
|
|
117
117
|
store.setCurrentAction(action);
|
|
118
|
-
store.openDrawer(ctx);
|
|
118
|
+
store.openDrawer(ctx, undefined, undefined, delegate);
|
|
119
119
|
}
|
|
120
120
|
else if (action.actionType === 'toast') {
|
|
121
121
|
(_b = (_a = action.toast) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.forEach(function (item) {
|
|
@@ -149,7 +149,7 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
149
149
|
redirect = action.redirect && filter(action.redirect, store.data);
|
|
150
150
|
redirect && env.jumpTo(redirect, action);
|
|
151
151
|
action.reload &&
|
|
152
|
-
this.reloadTarget(delegate || this.context, action.reload, store.data);
|
|
152
|
+
this.reloadTarget(delegate || this.context, filter(action.reload, ctx), store.data);
|
|
153
153
|
return [2 /*return*/];
|
|
154
154
|
}
|
|
155
155
|
});
|
|
@@ -181,6 +181,7 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
183
|
RootRenderer.prototype.handleDialogConfirm = function (values, action) {
|
|
184
|
+
var _a;
|
|
184
185
|
var args = [];
|
|
185
186
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
186
187
|
args[_i - 2] = arguments[_i];
|
|
@@ -195,7 +196,13 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
195
196
|
dialog.onConfirm.apply(dialog, __spreadArray([values, action], __read(args), false)) === false) {
|
|
196
197
|
return;
|
|
197
198
|
}
|
|
199
|
+
var dialogAction = store.action;
|
|
200
|
+
var reload = (_a = action.reload) !== null && _a !== void 0 ? _a : dialogAction.reload;
|
|
201
|
+
var scoped = store.getDialogScoped() || this.context;
|
|
198
202
|
store.closeDialog(true);
|
|
203
|
+
if (reload) {
|
|
204
|
+
scoped.reload(reload, store.data);
|
|
205
|
+
}
|
|
199
206
|
};
|
|
200
207
|
RootRenderer.prototype.handleDialogClose = function (confirmed) {
|
|
201
208
|
if (confirmed === void 0) { confirmed = false; }
|
|
@@ -203,6 +210,7 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
203
210
|
store.closeDialog(confirmed);
|
|
204
211
|
};
|
|
205
212
|
RootRenderer.prototype.handleDrawerConfirm = function (values, action) {
|
|
213
|
+
var _a;
|
|
206
214
|
var args = [];
|
|
207
215
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
208
216
|
args[_i - 2] = arguments[_i];
|
|
@@ -217,7 +225,16 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
217
225
|
drawer.onConfirm.apply(drawer, __spreadArray([values, action], __read(args), false)) === false) {
|
|
218
226
|
return;
|
|
219
227
|
}
|
|
228
|
+
var drawerAction = store.action;
|
|
229
|
+
var reload = (_a = action.reload) !== null && _a !== void 0 ? _a : drawerAction.reload;
|
|
230
|
+
var scoped = store.getDrawerScoped() || this.context;
|
|
220
231
|
store.closeDrawer();
|
|
232
|
+
// 稍等会,等动画结束。
|
|
233
|
+
setTimeout(function () {
|
|
234
|
+
if (reload) {
|
|
235
|
+
scoped.reload(reload, store.data);
|
|
236
|
+
}
|
|
237
|
+
}, 300);
|
|
221
238
|
};
|
|
222
239
|
RootRenderer.prototype.handleDrawerClose = function () {
|
|
223
240
|
var store = this.store;
|
package/esm/SchemaRenderer.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RendererConfig, RendererEnv, RendererProps } from './factory';
|
|
3
|
+
import { IScopedContext } from './Scoped';
|
|
3
4
|
import { Schema, SchemaNode } from './types';
|
|
4
5
|
import { RendererEvent } from './utils/renderer-event';
|
|
5
6
|
interface SchemaRendererProps extends Partial<RendererProps> {
|
|
@@ -9,7 +10,7 @@ interface SchemaRendererProps extends Partial<RendererProps> {
|
|
|
9
10
|
}
|
|
10
11
|
export declare class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
|
11
12
|
static displayName: string;
|
|
12
|
-
static contextType: React.Context<
|
|
13
|
+
static contextType: React.Context<IScopedContext>;
|
|
13
14
|
rendererKey: string;
|
|
14
15
|
renderer: RendererConfig | null;
|
|
15
16
|
ref: any;
|
package/esm/SchemaRenderer.js
CHANGED
package/esm/Scoped.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -16,6 +16,33 @@ import { isPureVariable } from './utils/isPureVariable.js';
|
|
|
16
16
|
import { dataMapping } from './utils/dataMapping.js';
|
|
17
17
|
import './utils/filter.js';
|
|
18
18
|
import { findTree, eachTree, qsparse, qsstringify, parseQuery, autobind } from './utils/helper.js';
|
|
19
|
+
import './utils/api.js';
|
|
20
|
+
import './utils/ColorScale.js';
|
|
21
|
+
import 'lodash/chunk';
|
|
22
|
+
import './utils/DataSchema.js';
|
|
23
|
+
import './utils/DataScope.js';
|
|
24
|
+
import './utils/debug.js';
|
|
25
|
+
import 'react-dom';
|
|
26
|
+
import './utils/errors.js';
|
|
27
|
+
import { filter } from './utils/tpl.js';
|
|
28
|
+
import 'classnames';
|
|
29
|
+
import 'lodash/isObject';
|
|
30
|
+
import 'lodash/isString';
|
|
31
|
+
import 'lodash/isBoolean';
|
|
32
|
+
import 'lodash';
|
|
33
|
+
import './utils/image.js';
|
|
34
|
+
import './actions/Action.js';
|
|
35
|
+
import 'lodash/debounce';
|
|
36
|
+
import 'lodash/cloneDeep';
|
|
37
|
+
import './utils/resize-sensor.js';
|
|
38
|
+
import 'react-overlays/useRootClose';
|
|
39
|
+
import './utils/SimpleMap.js';
|
|
40
|
+
import 'lodash/mapValues';
|
|
41
|
+
import 'lodash/camelCase';
|
|
42
|
+
import 'uncontrollable';
|
|
43
|
+
import './utils/validations.js';
|
|
44
|
+
import './utils/resolveCondition.js';
|
|
45
|
+
import './utils/Animation.js';
|
|
19
46
|
|
|
20
47
|
/**
|
|
21
48
|
* @file 用来创建一个域,在这个域里面会把里面的运行时实例注册进来,方便组件之间的通信。
|
|
@@ -58,7 +85,8 @@ function createScopedTools(path, parent, env) {
|
|
|
58
85
|
}, this);
|
|
59
86
|
}
|
|
60
87
|
var resolved = find(components, function (component) {
|
|
61
|
-
return component.props.name
|
|
88
|
+
return filter(component.props.name, component.props.data) === name ||
|
|
89
|
+
component.props.id === name;
|
|
62
90
|
});
|
|
63
91
|
return resolved || (parent && parent.getComponentByName(name));
|
|
64
92
|
},
|
package/esm/WithRootStore.d.ts
CHANGED
|
@@ -335,12 +335,10 @@ export declare function withRootStore<T extends React.ComponentType<React.Compon
|
|
|
335
335
|
}>>(ComposedComponent: T): {
|
|
336
336
|
new (props: JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">> | Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">>>): {
|
|
337
337
|
render(): JSX.Element;
|
|
338
|
-
context:
|
|
338
|
+
context: unknown;
|
|
339
339
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
340
340
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
341
|
-
readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore"
|
|
342
|
-
children?: React.ReactNode;
|
|
343
|
-
}>;
|
|
341
|
+
readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">>>;
|
|
344
342
|
state: Readonly<{}>;
|
|
345
343
|
refs: {
|
|
346
344
|
[key: string]: React.ReactInstance;
|
|
@@ -360,12 +358,10 @@ export declare function withRootStore<T extends React.ComponentType<React.Compon
|
|
|
360
358
|
};
|
|
361
359
|
new (props: JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">>, context: any): {
|
|
362
360
|
render(): JSX.Element;
|
|
363
|
-
context:
|
|
361
|
+
context: unknown;
|
|
364
362
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
365
363
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
366
|
-
readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore"
|
|
367
|
-
children?: React.ReactNode;
|
|
368
|
-
}>;
|
|
364
|
+
readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "rootStore">>>;
|
|
369
365
|
state: Readonly<{}>;
|
|
370
366
|
refs: {
|
|
371
367
|
[key: string]: React.ReactInstance;
|
package/esm/WithRootStore.js
CHANGED
package/esm/WithStore.js
CHANGED
package/esm/actions/Action.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { RendererProps } from '../factory';
|
|
3
|
+
import { ConditionGroupValue } from '../types';
|
|
3
4
|
import { RendererEvent } from '../utils/renderer-event';
|
|
4
5
|
import { IBreakAction } from './BreakAction';
|
|
5
6
|
import { IContinueAction } from './ContinueAction';
|
|
@@ -21,7 +22,7 @@ export interface ListenerAction {
|
|
|
21
22
|
outputVar?: string;
|
|
22
23
|
preventDefault?: boolean;
|
|
23
24
|
stopPropagation?: boolean;
|
|
24
|
-
expression?: string;
|
|
25
|
+
expression?: string | ConditionGroupValue;
|
|
25
26
|
execOn?: string;
|
|
26
27
|
}
|
|
27
28
|
export interface ILogicAction extends ListenerAction {
|
package/esm/actions/Action.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __awaiter, __generator, __values, __assign } from 'tslib';
|
|
7
7
|
import omit from 'lodash/omit';
|
|
8
8
|
import '../utils/helper.js';
|
|
9
|
-
import {
|
|
9
|
+
import { evalExpressionWithConditionBuilder } from '../utils/tpl.js';
|
|
10
10
|
import 'amis-formula';
|
|
11
11
|
import 'moment';
|
|
12
12
|
import { createObject } from '../utils/object.js';
|
|
@@ -154,7 +154,7 @@ var runActions = function (actions, renderer, event) { return __awaiter(void 0,
|
|
|
154
154
|
}); };
|
|
155
155
|
// 执行动作,与原有动作处理打通
|
|
156
156
|
var runAction = function (actionInstrance, actionConfig, renderer, event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
157
|
-
var additional, mergeData, expression, preventDefault, stopPropagation, args, afterMappingData, actionData, data;
|
|
157
|
+
var additional, mergeData, expression, isStop, preventDefault, stopPropagation, args, afterMappingData, actionData, data, stoped, actionResult;
|
|
158
158
|
var _a, _b, _c;
|
|
159
159
|
return __generator(this, function (_d) {
|
|
160
160
|
switch (_d.label) {
|
|
@@ -173,13 +173,30 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
|
|
|
173
173
|
? createObject(renderer.props.data.__super, additional)
|
|
174
174
|
: additional, renderer.props.data), event.data);
|
|
175
175
|
expression = (_a = actionConfig.expression) !== null && _a !== void 0 ? _a : actionConfig.execOn;
|
|
176
|
-
|
|
176
|
+
isStop = false;
|
|
177
|
+
if (!expression) return [3 /*break*/, 2];
|
|
178
|
+
return [4 /*yield*/, evalExpressionWithConditionBuilder(expression, mergeData, true)];
|
|
179
|
+
case 1:
|
|
180
|
+
isStop = !(_d.sent());
|
|
181
|
+
_d.label = 2;
|
|
182
|
+
case 2:
|
|
183
|
+
if (isStop) {
|
|
177
184
|
return [2 /*return*/];
|
|
178
185
|
}
|
|
179
|
-
preventDefault =
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
186
|
+
preventDefault = false;
|
|
187
|
+
if (!actionConfig.preventDefault) return [3 /*break*/, 4];
|
|
188
|
+
return [4 /*yield*/, evalExpressionWithConditionBuilder(actionConfig.preventDefault, mergeData, false)];
|
|
189
|
+
case 3:
|
|
190
|
+
preventDefault = _d.sent();
|
|
191
|
+
_d.label = 4;
|
|
192
|
+
case 4:
|
|
193
|
+
stopPropagation = false;
|
|
194
|
+
if (!actionConfig.stopPropagation) return [3 /*break*/, 6];
|
|
195
|
+
return [4 /*yield*/, evalExpressionWithConditionBuilder(actionConfig.stopPropagation, mergeData, false)];
|
|
196
|
+
case 5:
|
|
197
|
+
stopPropagation = _d.sent();
|
|
198
|
+
_d.label = 6;
|
|
199
|
+
case 6:
|
|
183
200
|
args = dataMapping(actionConfig.args, mergeData, function (key) {
|
|
184
201
|
return ['adaptor', 'responseAdaptor', 'requestAdaptor', 'responseData'].includes(key);
|
|
185
202
|
});
|
|
@@ -194,15 +211,20 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
|
|
|
194
211
|
: event.data;
|
|
195
212
|
(_b = console.group) === null || _b === void 0 ? void 0 : _b.call(console, "run action ".concat(actionConfig.actionType));
|
|
196
213
|
console.debug("[".concat(actionConfig.actionType, "] action args, data"), args, data);
|
|
214
|
+
stoped = false;
|
|
197
215
|
return [4 /*yield*/, actionInstrance.run(__assign(__assign({}, actionConfig), { args: args, data: data }), renderer, event, mergeData)];
|
|
198
|
-
case
|
|
199
|
-
_d.sent();
|
|
216
|
+
case 7:
|
|
217
|
+
actionResult = _d.sent();
|
|
218
|
+
// 二次确认弹窗如果取消,则终止后续动作
|
|
219
|
+
if ((actionConfig === null || actionConfig === void 0 ? void 0 : actionConfig.actionType) === 'confirmDialog' && !actionResult) {
|
|
220
|
+
stoped = true;
|
|
221
|
+
}
|
|
200
222
|
console.debug("[".concat(actionConfig.actionType, "] action end event"), event);
|
|
201
223
|
(_c = console.groupEnd) === null || _c === void 0 ? void 0 : _c.call(console);
|
|
202
224
|
// 阻止原有动作执行
|
|
203
225
|
preventDefault && event.preventDefault();
|
|
204
226
|
// 阻止后续动作执行
|
|
205
|
-
stopPropagation && event.stopPropagation();
|
|
227
|
+
(stopPropagation || stoped) && event.stopPropagation();
|
|
206
228
|
return [2 /*return*/];
|
|
207
229
|
}
|
|
208
230
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -36,6 +36,7 @@ import 'lodash/camelCase';
|
|
|
36
36
|
import 'uncontrollable';
|
|
37
37
|
import 'hoist-non-react-statics';
|
|
38
38
|
import '../utils/validations.js';
|
|
39
|
+
import '../utils/resolveCondition.js';
|
|
39
40
|
import '../utils/Animation.js';
|
|
40
41
|
|
|
41
42
|
/**
|
|
@@ -56,5 +56,5 @@ export declare class AlertAction implements RendererAction {
|
|
|
56
56
|
* confirm确认提示动作
|
|
57
57
|
*/
|
|
58
58
|
export declare class ConfirmAction implements RendererAction {
|
|
59
|
-
run(action: IConfirmAction, renderer: ListenerContext, event: RendererEvent<any>): Promise<
|
|
59
|
+
run(action: IConfirmAction, renderer: ListenerContext, event: RendererEvent<any>): Promise<any>;
|
|
60
60
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -85,9 +85,14 @@ var ConfirmAction = /** @class */ (function () {
|
|
|
85
85
|
ConfirmAction.prototype.run = function (action, renderer, event) {
|
|
86
86
|
var _a, _b, _c, _d;
|
|
87
87
|
return __awaiter(this, void 0, void 0, function () {
|
|
88
|
+
var confirmed;
|
|
88
89
|
return __generator(this, function (_e) {
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
switch (_e.label) {
|
|
91
|
+
case 0: return [4 /*yield*/, ((_b = (_a = event.context.env).confirm) === null || _b === void 0 ? void 0 : _b.call(_a, (_c = action.args) === null || _c === void 0 ? void 0 : _c.msg, (_d = action.args) === null || _d === void 0 ? void 0 : _d.title))];
|
|
92
|
+
case 1:
|
|
93
|
+
confirmed = _e.sent();
|
|
94
|
+
return [2 /*return*/, confirmed];
|
|
95
|
+
}
|
|
91
96
|
});
|
|
92
97
|
});
|
|
93
98
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __awaiter, __generator, __values } from 'tslib';
|
|
7
|
-
import {
|
|
7
|
+
import { evalExpressionWithConditionBuilder } from '../utils/tpl.js';
|
|
8
8
|
import { registerAction, runActions } from './Action.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -15,41 +15,44 @@ var SwitchAction = /** @class */ (function () {
|
|
|
15
15
|
}
|
|
16
16
|
SwitchAction.prototype.run = function (action, renderer, event, mergeData) {
|
|
17
17
|
return __awaiter(this, void 0, void 0, function () {
|
|
18
|
-
var _a, _b, branch, e_1_1;
|
|
18
|
+
var _a, _b, branch, isPass, e_1_1;
|
|
19
19
|
var e_1, _c;
|
|
20
20
|
return __generator(this, function (_d) {
|
|
21
21
|
switch (_d.label) {
|
|
22
22
|
case 0:
|
|
23
|
-
_d.trys.push([0,
|
|
23
|
+
_d.trys.push([0, 6, 7, 8]);
|
|
24
24
|
_a = __values(action.children || []), _b = _a.next();
|
|
25
25
|
_d.label = 1;
|
|
26
26
|
case 1:
|
|
27
|
-
if (!!_b.done) return [3 /*break*/,
|
|
27
|
+
if (!!_b.done) return [3 /*break*/, 5];
|
|
28
28
|
branch = _b.value;
|
|
29
29
|
if (!branch.expression) {
|
|
30
|
-
return [3 /*break*/,
|
|
30
|
+
return [3 /*break*/, 4];
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
return [4 /*yield*/, runActions(branch, renderer, event)];
|
|
32
|
+
return [4 /*yield*/, evalExpressionWithConditionBuilder(branch.expression, mergeData)];
|
|
34
33
|
case 2:
|
|
34
|
+
isPass = _d.sent();
|
|
35
|
+
if (!isPass) return [3 /*break*/, 4];
|
|
36
|
+
return [4 /*yield*/, runActions(branch, renderer, event)];
|
|
37
|
+
case 3:
|
|
35
38
|
_d.sent();
|
|
36
39
|
// 去掉runAllMatch,这里只做排他,多个可以直接通过expression
|
|
37
|
-
return [3 /*break*/,
|
|
38
|
-
case
|
|
40
|
+
return [3 /*break*/, 5];
|
|
41
|
+
case 4:
|
|
39
42
|
_b = _a.next();
|
|
40
43
|
return [3 /*break*/, 1];
|
|
41
|
-
case
|
|
42
|
-
case
|
|
44
|
+
case 5: return [3 /*break*/, 8];
|
|
45
|
+
case 6:
|
|
43
46
|
e_1_1 = _d.sent();
|
|
44
47
|
e_1 = { error: e_1_1 };
|
|
45
|
-
return [3 /*break*/,
|
|
46
|
-
case
|
|
48
|
+
return [3 /*break*/, 8];
|
|
49
|
+
case 7:
|
|
47
50
|
try {
|
|
48
51
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
49
52
|
}
|
|
50
53
|
finally { if (e_1) throw e_1.error; }
|
|
51
54
|
return [7 /*endfinally*/];
|
|
52
|
-
case
|
|
55
|
+
case 8: return [2 /*return*/];
|
|
53
56
|
}
|
|
54
57
|
});
|
|
55
58
|
});
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import React from 'react';
|
|
7
7
|
export interface LazyComponentProps {
|
|
8
|
-
component?: React.
|
|
9
|
-
getComponent?: () => Promise<React.
|
|
8
|
+
component?: React.ElementType;
|
|
9
|
+
getComponent?: () => Promise<React.ElementType>;
|
|
10
10
|
placeholder?: React.ReactNode;
|
|
11
11
|
unMountOnHidden?: boolean;
|
|
12
12
|
childProps?: object;
|
|
@@ -15,7 +15,7 @@ export interface LazyComponentProps {
|
|
|
15
15
|
}
|
|
16
16
|
export interface LazyComponentState {
|
|
17
17
|
visible: boolean;
|
|
18
|
-
component?: React.
|
|
18
|
+
component?: React.ElementType;
|
|
19
19
|
}
|
|
20
20
|
export default class LazyComponent extends React.Component<LazyComponentProps, LazyComponentState> {
|
|
21
21
|
static defaultProps: {
|
|
@@ -13,7 +13,7 @@ interface OverlayProps {
|
|
|
13
13
|
shouldUpdatePosition?: boolean;
|
|
14
14
|
rootClose?: boolean;
|
|
15
15
|
onHide?(props: any, ...args: any[]): any;
|
|
16
|
-
container?:
|
|
16
|
+
container?: HTMLElement | (() => HTMLElement | null | undefined);
|
|
17
17
|
containerSelector?: string;
|
|
18
18
|
target?: React.ReactNode | Function;
|
|
19
19
|
watchTargetSizeChange?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -38,6 +38,7 @@ import 'lodash/camelCase';
|
|
|
38
38
|
import 'uncontrollable';
|
|
39
39
|
import 'hoist-non-react-statics';
|
|
40
40
|
import '../utils/validations.js';
|
|
41
|
+
import '../utils/resolveCondition.js';
|
|
41
42
|
import '../utils/Animation.js';
|
|
42
43
|
|
|
43
44
|
/**
|
|
@@ -58,12 +58,10 @@ declare const _default: {
|
|
|
58
58
|
childRef(ref: any): void;
|
|
59
59
|
getWrappedInstance(): any;
|
|
60
60
|
render(): JSX.Element;
|
|
61
|
-
context:
|
|
61
|
+
context: unknown;
|
|
62
62
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<PopOverPorps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
63
63
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
64
|
-
readonly props: Readonly<Omit<PopOverPorps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOutterProps
|
|
65
|
-
children?: React.ReactNode;
|
|
66
|
-
}>;
|
|
64
|
+
readonly props: Readonly<Omit<PopOverPorps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOutterProps>;
|
|
67
65
|
state: Readonly<{}>;
|
|
68
66
|
refs: {
|
|
69
67
|
[key: string]: React.ReactInstance;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -37,6 +37,7 @@ import 'lodash/camelCase';
|
|
|
37
37
|
import 'uncontrollable';
|
|
38
38
|
import 'hoist-non-react-statics';
|
|
39
39
|
import '../utils/validations.js';
|
|
40
|
+
import '../utils/resolveCondition.js';
|
|
40
41
|
import '../utils/Animation.js';
|
|
41
42
|
|
|
42
43
|
/**
|