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/lib/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
|
|
|
@@ -20,6 +20,33 @@ var isPureVariable = require('./utils/isPureVariable.js');
|
|
|
20
20
|
var dataMapping = require('./utils/dataMapping.js');
|
|
21
21
|
require('./utils/filter.js');
|
|
22
22
|
var helper = require('./utils/helper.js');
|
|
23
|
+
require('./utils/api.js');
|
|
24
|
+
require('./utils/ColorScale.js');
|
|
25
|
+
require('lodash/chunk');
|
|
26
|
+
require('./utils/DataSchema.js');
|
|
27
|
+
require('./utils/DataScope.js');
|
|
28
|
+
require('./utils/debug.js');
|
|
29
|
+
require('react-dom');
|
|
30
|
+
require('./utils/errors.js');
|
|
31
|
+
var tpl = require('./utils/tpl.js');
|
|
32
|
+
require('classnames');
|
|
33
|
+
require('lodash/isObject');
|
|
34
|
+
require('lodash/isString');
|
|
35
|
+
require('lodash/isBoolean');
|
|
36
|
+
require('lodash');
|
|
37
|
+
require('./utils/image.js');
|
|
38
|
+
require('./actions/Action.js');
|
|
39
|
+
require('lodash/debounce');
|
|
40
|
+
require('lodash/cloneDeep');
|
|
41
|
+
require('./utils/resize-sensor.js');
|
|
42
|
+
require('react-overlays/useRootClose');
|
|
43
|
+
require('./utils/SimpleMap.js');
|
|
44
|
+
require('lodash/mapValues');
|
|
45
|
+
require('lodash/camelCase');
|
|
46
|
+
require('uncontrollable');
|
|
47
|
+
require('./utils/validations.js');
|
|
48
|
+
require('./utils/resolveCondition.js');
|
|
49
|
+
require('./utils/Animation.js');
|
|
23
50
|
|
|
24
51
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
52
|
|
|
@@ -69,7 +96,8 @@ function createScopedTools(path, parent, env) {
|
|
|
69
96
|
}, this);
|
|
70
97
|
}
|
|
71
98
|
var resolved = find__default["default"](components, function (component) {
|
|
72
|
-
return component.props.name
|
|
99
|
+
return tpl.filter(component.props.name, component.props.data) === name ||
|
|
100
|
+
component.props.id === name;
|
|
73
101
|
});
|
|
74
102
|
return resolved || (parent && parent.getComponentByName(name));
|
|
75
103
|
},
|
package/lib/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/lib/WithRootStore.js
CHANGED
package/lib/WithStore.js
CHANGED
package/lib/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/lib/actions/Action.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
|
|
|
@@ -162,7 +162,7 @@ var runActions = function (actions, renderer, event) { return tslib.__awaiter(vo
|
|
|
162
162
|
}); };
|
|
163
163
|
// 执行动作,与原有动作处理打通
|
|
164
164
|
var runAction = function (actionInstrance, actionConfig, renderer, event) { return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
165
|
-
var additional, mergeData, expression, preventDefault, stopPropagation, args, afterMappingData, actionData, data;
|
|
165
|
+
var additional, mergeData, expression, isStop, preventDefault, stopPropagation, args, afterMappingData, actionData, data, stoped, actionResult;
|
|
166
166
|
var _a, _b, _c;
|
|
167
167
|
return tslib.__generator(this, function (_d) {
|
|
168
168
|
switch (_d.label) {
|
|
@@ -181,13 +181,30 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
|
|
|
181
181
|
? object.createObject(renderer.props.data.__super, additional)
|
|
182
182
|
: additional, renderer.props.data), event.data);
|
|
183
183
|
expression = (_a = actionConfig.expression) !== null && _a !== void 0 ? _a : actionConfig.execOn;
|
|
184
|
-
|
|
184
|
+
isStop = false;
|
|
185
|
+
if (!expression) return [3 /*break*/, 2];
|
|
186
|
+
return [4 /*yield*/, tpl.evalExpressionWithConditionBuilder(expression, mergeData, true)];
|
|
187
|
+
case 1:
|
|
188
|
+
isStop = !(_d.sent());
|
|
189
|
+
_d.label = 2;
|
|
190
|
+
case 2:
|
|
191
|
+
if (isStop) {
|
|
185
192
|
return [2 /*return*/];
|
|
186
193
|
}
|
|
187
|
-
preventDefault =
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
194
|
+
preventDefault = false;
|
|
195
|
+
if (!actionConfig.preventDefault) return [3 /*break*/, 4];
|
|
196
|
+
return [4 /*yield*/, tpl.evalExpressionWithConditionBuilder(actionConfig.preventDefault, mergeData, false)];
|
|
197
|
+
case 3:
|
|
198
|
+
preventDefault = _d.sent();
|
|
199
|
+
_d.label = 4;
|
|
200
|
+
case 4:
|
|
201
|
+
stopPropagation = false;
|
|
202
|
+
if (!actionConfig.stopPropagation) return [3 /*break*/, 6];
|
|
203
|
+
return [4 /*yield*/, tpl.evalExpressionWithConditionBuilder(actionConfig.stopPropagation, mergeData, false)];
|
|
204
|
+
case 5:
|
|
205
|
+
stopPropagation = _d.sent();
|
|
206
|
+
_d.label = 6;
|
|
207
|
+
case 6:
|
|
191
208
|
args = dataMapping.dataMapping(actionConfig.args, mergeData, function (key) {
|
|
192
209
|
return ['adaptor', 'responseAdaptor', 'requestAdaptor', 'responseData'].includes(key);
|
|
193
210
|
});
|
|
@@ -202,15 +219,20 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
|
|
|
202
219
|
: event.data;
|
|
203
220
|
(_b = console.group) === null || _b === void 0 ? void 0 : _b.call(console, "run action ".concat(actionConfig.actionType));
|
|
204
221
|
console.debug("[".concat(actionConfig.actionType, "] action args, data"), args, data);
|
|
222
|
+
stoped = false;
|
|
205
223
|
return [4 /*yield*/, actionInstrance.run(tslib.__assign(tslib.__assign({}, actionConfig), { args: args, data: data }), renderer, event, mergeData)];
|
|
206
|
-
case
|
|
207
|
-
_d.sent();
|
|
224
|
+
case 7:
|
|
225
|
+
actionResult = _d.sent();
|
|
226
|
+
// 二次确认弹窗如果取消,则终止后续动作
|
|
227
|
+
if ((actionConfig === null || actionConfig === void 0 ? void 0 : actionConfig.actionType) === 'confirmDialog' && !actionResult) {
|
|
228
|
+
stoped = true;
|
|
229
|
+
}
|
|
208
230
|
console.debug("[".concat(actionConfig.actionType, "] action end event"), event);
|
|
209
231
|
(_c = console.groupEnd) === null || _c === void 0 ? void 0 : _c.call(console);
|
|
210
232
|
// 阻止原有动作执行
|
|
211
233
|
preventDefault && event.preventDefault();
|
|
212
234
|
// 阻止后续动作执行
|
|
213
|
-
stopPropagation && event.stopPropagation();
|
|
235
|
+
(stopPropagation || stoped) && event.stopPropagation();
|
|
214
236
|
return [2 /*return*/];
|
|
215
237
|
}
|
|
216
238
|
});
|
|
@@ -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
|
|
|
@@ -40,6 +40,7 @@ require('lodash/camelCase');
|
|
|
40
40
|
require('uncontrollable');
|
|
41
41
|
require('hoist-non-react-statics');
|
|
42
42
|
require('../utils/validations.js');
|
|
43
|
+
require('../utils/resolveCondition.js');
|
|
43
44
|
require('../utils/Animation.js');
|
|
44
45
|
|
|
45
46
|
/**
|
|
@@ -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
|
|
|
@@ -89,9 +89,14 @@ var ConfirmAction = /** @class */ (function () {
|
|
|
89
89
|
ConfirmAction.prototype.run = function (action, renderer, event) {
|
|
90
90
|
var _a, _b, _c, _d;
|
|
91
91
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var confirmed;
|
|
92
93
|
return tslib.__generator(this, function (_e) {
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
switch (_e.label) {
|
|
95
|
+
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))];
|
|
96
|
+
case 1:
|
|
97
|
+
confirmed = _e.sent();
|
|
98
|
+
return [2 /*return*/, confirmed];
|
|
99
|
+
}
|
|
95
100
|
});
|
|
96
101
|
});
|
|
97
102
|
};
|
|
@@ -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
|
|
|
@@ -19,41 +19,44 @@ var SwitchAction = /** @class */ (function () {
|
|
|
19
19
|
}
|
|
20
20
|
SwitchAction.prototype.run = function (action, renderer, event, mergeData) {
|
|
21
21
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
22
|
-
var _a, _b, branch, e_1_1;
|
|
22
|
+
var _a, _b, branch, isPass, e_1_1;
|
|
23
23
|
var e_1, _c;
|
|
24
24
|
return tslib.__generator(this, function (_d) {
|
|
25
25
|
switch (_d.label) {
|
|
26
26
|
case 0:
|
|
27
|
-
_d.trys.push([0,
|
|
27
|
+
_d.trys.push([0, 6, 7, 8]);
|
|
28
28
|
_a = tslib.__values(action.children || []), _b = _a.next();
|
|
29
29
|
_d.label = 1;
|
|
30
30
|
case 1:
|
|
31
|
-
if (!!_b.done) return [3 /*break*/,
|
|
31
|
+
if (!!_b.done) return [3 /*break*/, 5];
|
|
32
32
|
branch = _b.value;
|
|
33
33
|
if (!branch.expression) {
|
|
34
|
-
return [3 /*break*/,
|
|
34
|
+
return [3 /*break*/, 4];
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
return [4 /*yield*/, Action.runActions(branch, renderer, event)];
|
|
36
|
+
return [4 /*yield*/, tpl.evalExpressionWithConditionBuilder(branch.expression, mergeData)];
|
|
38
37
|
case 2:
|
|
38
|
+
isPass = _d.sent();
|
|
39
|
+
if (!isPass) return [3 /*break*/, 4];
|
|
40
|
+
return [4 /*yield*/, Action.runActions(branch, renderer, event)];
|
|
41
|
+
case 3:
|
|
39
42
|
_d.sent();
|
|
40
43
|
// 去掉runAllMatch,这里只做排他,多个可以直接通过expression
|
|
41
|
-
return [3 /*break*/,
|
|
42
|
-
case
|
|
44
|
+
return [3 /*break*/, 5];
|
|
45
|
+
case 4:
|
|
43
46
|
_b = _a.next();
|
|
44
47
|
return [3 /*break*/, 1];
|
|
45
|
-
case
|
|
46
|
-
case
|
|
48
|
+
case 5: return [3 /*break*/, 8];
|
|
49
|
+
case 6:
|
|
47
50
|
e_1_1 = _d.sent();
|
|
48
51
|
e_1 = { error: e_1_1 };
|
|
49
|
-
return [3 /*break*/,
|
|
50
|
-
case
|
|
52
|
+
return [3 /*break*/, 8];
|
|
53
|
+
case 7:
|
|
51
54
|
try {
|
|
52
55
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
53
56
|
}
|
|
54
57
|
finally { if (e_1) throw e_1.error; }
|
|
55
58
|
return [7 /*endfinally*/];
|
|
56
|
-
case
|
|
59
|
+
case 8: return [2 /*return*/];
|
|
57
60
|
}
|
|
58
61
|
});
|
|
59
62
|
});
|
|
@@ -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
|
|
|
@@ -42,6 +42,7 @@ require('lodash/camelCase');
|
|
|
42
42
|
require('uncontrollable');
|
|
43
43
|
require('hoist-non-react-statics');
|
|
44
44
|
require('../utils/validations.js');
|
|
45
|
+
require('../utils/resolveCondition.js');
|
|
45
46
|
require('../utils/Animation.js');
|
|
46
47
|
|
|
47
48
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -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
|
|
|
@@ -41,6 +41,7 @@ require('lodash/camelCase');
|
|
|
41
41
|
require('uncontrollable');
|
|
42
42
|
require('hoist-non-react-statics');
|
|
43
43
|
require('../utils/validations.js');
|
|
44
|
+
require('../utils/resolveCondition.js');
|
|
44
45
|
require('../utils/Animation.js');
|
|
45
46
|
|
|
46
47
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
package/lib/env.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export interface RendererEnv {
|
|
|
47
47
|
affixOffsetTop: number;
|
|
48
48
|
affixOffsetBottom: number;
|
|
49
49
|
richTextToken: string;
|
|
50
|
-
loadRenderer: (schema: Schema, path: string, reRender: Function) => Promise<React.
|
|
50
|
+
loadRenderer: (schema: Schema, path: string, reRender: Function) => Promise<React.ElementType> | React.ElementType | JSX.Element | void;
|
|
51
51
|
loadChartExtends?: () => void | Promise<void>;
|
|
52
52
|
useMobileUI?: boolean;
|
|
53
53
|
/**
|
|
@@ -87,15 +87,13 @@ export declare function withRendererEnv<T extends React.ComponentType<React.Comp
|
|
|
87
87
|
env?: RendererEnv | undefined;
|
|
88
88
|
}>): {
|
|
89
89
|
render(): JSX.Element;
|
|
90
|
-
context:
|
|
90
|
+
context: unknown;
|
|
91
91
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "env">> & {
|
|
92
92
|
env?: RendererEnv | undefined;
|
|
93
93
|
}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
94
94
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
95
95
|
readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "env">> & {
|
|
96
96
|
env?: RendererEnv | undefined;
|
|
97
|
-
}> & Readonly<{
|
|
98
|
-
children?: React.ReactNode;
|
|
99
97
|
}>;
|
|
100
98
|
state: Readonly<{}>;
|
|
101
99
|
refs: {
|
|
@@ -132,15 +130,13 @@ export declare function withRendererEnv<T extends React.ComponentType<React.Comp
|
|
|
132
130
|
env?: RendererEnv | undefined;
|
|
133
131
|
}, context: any): {
|
|
134
132
|
render(): JSX.Element;
|
|
135
|
-
context:
|
|
133
|
+
context: unknown;
|
|
136
134
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "env">> & {
|
|
137
135
|
env?: RendererEnv | undefined;
|
|
138
136
|
}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
139
137
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
140
138
|
readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, "env">> & {
|
|
141
139
|
env?: RendererEnv | undefined;
|
|
142
|
-
}> & Readonly<{
|
|
143
|
-
children?: React.ReactNode;
|
|
144
140
|
}>;
|
|
145
141
|
state: Readonly<{}>;
|
|
146
142
|
refs: {
|
package/lib/env.js
CHANGED
package/lib/envOverwrite.js
CHANGED
package/lib/factory.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
|
|
|
@@ -83,6 +83,8 @@ function registerRenderer(config) {
|
|
|
83
83
|
}
|
|
84
84
|
function unRegisterRenderer(config) {
|
|
85
85
|
var name = (typeof config === 'string' ? config : config.name);
|
|
86
|
+
var idx = renderers.findIndex(function (item) { return item.name === name; });
|
|
87
|
+
~idx && renderers.splice(idx, 1);
|
|
86
88
|
delete renderersMap[name];
|
|
87
89
|
// 清空渲染器定位缓存
|
|
88
90
|
cache = {};
|
package/lib/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* This source code is licensed under the Apache license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
/// <reference types="react" />
|
|
9
8
|
import { Renderer, getRendererByName, getRenderers, registerRenderer, unRegisterRenderer, resolveRenderer, filterSchema, clearStoresCache, updateEnv, addSchemaFilter, extendDefaultEnv } from './factory';
|
|
10
9
|
import type { RenderOptions, RendererConfig, RendererProps } from './factory';
|
|
11
10
|
import './renderers/builtin';
|
|
@@ -32,7 +31,7 @@ import { Schema } from './types';
|
|
|
32
31
|
import { addRootWrapper, RootRenderProps } from './Root';
|
|
33
32
|
import { EnvContext } from './env';
|
|
34
33
|
import type { RendererEnv } from './env';
|
|
35
|
-
import { evaluate, Evaluator, extendsFilters, filters, getFilters, lexer, parse, registerFilter, registerFunction } from 'amis-formula';
|
|
34
|
+
import { evaluate, evaluateForAsync, Evaluator, AsyncEvaluator, extendsFilters, filters, getFilters, lexer, parse, registerFilter, registerFunction } from 'amis-formula';
|
|
36
35
|
import type { FilterContext } from 'amis-formula';
|
|
37
36
|
import LazyComponent from './components/LazyComponent';
|
|
38
37
|
import Overlay from './components/Overlay';
|
|
@@ -40,5 +39,5 @@ import PopOver from './components/PopOver';
|
|
|
40
39
|
import { FormRenderer } from './renderers/Form';
|
|
41
40
|
import type { FormHorizontal } from './renderers/Form';
|
|
42
41
|
export declare const version = "__buildVersion";
|
|
43
|
-
export { clearStoresCache, updateEnv, Renderer, RendererProps, RenderOptions, RendererEnv, EnvContext, RegisterStore, FormItem, FormItemWrap, FormItemProps, OptionsControl, FormRenderer, FormHorizontal, utils, getRendererByName, registerRenderer, unRegisterRenderer, getRenderers, registerFormItem, getFormItemByName, registerOptionsControl, resolveRenderer, filterSchema, Scoped, ScopedContext, IScopedContext, setDefaultTheme, theme, themeable, ThemeProps, getTheme, classPrefix, getClassPrefix, classnames, makeClassnames, getDefaultLocale, setDefaultLocale, registerLocale, makeTranslator, extendLocale, removeLocaleData, localeable, LocaleProps, TranslateFn, ClassNamesFn, parse, lexer, Evaluator, FilterContext, filters, getFilters, registerFilter, extendsFilters, registerFunction, evaluate, LazyComponent, Overlay, PopOver, addSchemaFilter, OptionsControlProps, FormOptionsControl, FormControlProps, FormBaseControl, extendDefaultEnv, addRootWrapper, RendererConfig };
|
|
42
|
+
export { clearStoresCache, updateEnv, Renderer, RendererProps, RenderOptions, RendererEnv, EnvContext, RegisterStore, FormItem, FormItemWrap, FormItemProps, OptionsControl, FormRenderer, FormHorizontal, utils, getRendererByName, registerRenderer, unRegisterRenderer, getRenderers, registerFormItem, getFormItemByName, registerOptionsControl, resolveRenderer, filterSchema, Scoped, ScopedContext, IScopedContext, setDefaultTheme, theme, themeable, ThemeProps, getTheme, classPrefix, getClassPrefix, classnames, makeClassnames, getDefaultLocale, setDefaultLocale, registerLocale, makeTranslator, extendLocale, removeLocaleData, localeable, LocaleProps, TranslateFn, ClassNamesFn, parse, lexer, Evaluator, AsyncEvaluator, FilterContext, filters, getFilters, registerFilter, extendsFilters, registerFunction, evaluate, evaluateForAsync, LazyComponent, Overlay, PopOver, addSchemaFilter, OptionsControlProps, FormOptionsControl, FormControlProps, FormBaseControl, extendDefaultEnv, addRootWrapper, RendererConfig };
|
|
44
43
|
export declare function render(schema: Schema, props?: RootRenderProps, options?: RenderOptions, pathPrefix?: string): JSX.Element;
|