amis-core 2.8.0 → 3.0.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 +3 -1
- package/esm/SchemaRenderer.js +7 -5
- 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 +40 -12
- 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 +12 -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 +2 -2
- 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.d.ts +2 -1
- package/esm/factory.js +5 -3
- package/esm/index.d.ts +9 -5
- package/esm/index.js +12 -9
- package/esm/locale.d.ts +1 -3
- package/esm/locale.js +1 -1
- package/esm/renderers/Form.d.ts +1 -1
- package/esm/renderers/Form.js +17 -15
- package/esm/renderers/Item.d.ts +9 -15
- package/esm/renderers/Item.js +11 -7
- package/esm/renderers/Options.js +4 -3
- 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 +46 -12
- package/esm/store/form.d.ts +4 -2
- package/esm/store/form.js +1 -1
- package/esm/store/formItem.js +6 -5
- 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 +2 -2
- 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 +36 -29
- package/esm/store/table.js +28 -5
- package/esm/store/table2.d.ts +9 -7
- package/esm/store/table2.js +23 -19
- package/esm/theme.d.ts +2 -4
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +45 -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 +11 -5
- 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 +4 -4
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.d.ts +2 -0
- package/esm/utils/dom.js +47 -10
- 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 +7 -3
- 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 +7 -0
- package/esm/utils/helper.js +28 -3
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.d.ts +6 -1
- package/esm/utils/icon.js +6 -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 +35 -32
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.js +1 -1
- package/esm/utils/resolveCondition.d.ts +6 -0
- package/esm/utils/resolveCondition.js +321 -0
- package/esm/utils/resolveVariable.js +1 -1
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.d.ts +6 -0
- package/esm/utils/resolveVariableAndFilterForAsync.js +63 -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.d.ts +9 -4
- package/esm/utils/style-helper.js +81 -16
- package/esm/utils/style.js +2 -2
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.d.ts +1 -0
- package/esm/utils/tokenize.js +34 -3
- package/esm/utils/tpl-builtin.d.ts +2 -1
- package/esm/utils/tpl-builtin.js +18 -3
- package/esm/utils/tpl-lodash.js +3 -2
- package/esm/utils/tpl.d.ts +9 -0
- package/esm/utils/tpl.js +45 -3
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.d.ts +4 -1
- package/esm/utils/validations.js +27 -12
- 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 +3 -1
- package/lib/SchemaRenderer.js +7 -4
- 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 +39 -11
- 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 +12 -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 +2 -2
- 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.d.ts +2 -1
- package/lib/factory.js +5 -3
- package/lib/index.d.ts +9 -5
- package/lib/index.js +30 -2
- package/lib/locale.d.ts +1 -3
- package/lib/locale.js +1 -1
- package/lib/renderers/Form.d.ts +1 -1
- package/lib/renderers/Form.js +16 -14
- package/lib/renderers/Item.d.ts +9 -15
- package/lib/renderers/Item.js +11 -7
- package/lib/renderers/Options.js +4 -3
- 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 +45 -11
- package/lib/store/form.d.ts +4 -2
- package/lib/store/form.js +1 -1
- package/lib/store/formItem.js +6 -5
- 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 +2 -2
- 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 +36 -29
- package/lib/store/table.js +28 -5
- package/lib/store/table2.d.ts +9 -7
- package/lib/store/table2.js +23 -19
- package/lib/theme.d.ts +2 -4
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +45 -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 +10 -4
- 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 +4 -4
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.d.ts +2 -0
- package/lib/utils/dom.js +48 -9
- 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 +7 -2
- 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 +7 -0
- package/lib/utils/helper.js +29 -2
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.d.ts +6 -1
- package/lib/utils/icon.js +6 -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 +35 -32
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.js +1 -1
- package/lib/utils/resolveCondition.d.ts +6 -0
- package/lib/utils/resolveCondition.js +338 -0
- package/lib/utils/resolveVariable.js +1 -1
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.d.ts +6 -0
- package/lib/utils/resolveVariableAndFilterForAsync.js +68 -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.d.ts +9 -4
- package/lib/utils/style-helper.js +86 -15
- package/lib/utils/style.js +2 -2
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.d.ts +1 -0
- package/lib/utils/tokenize.js +33 -1
- package/lib/utils/tpl-builtin.d.ts +2 -1
- package/lib/utils/tpl-builtin.js +17 -2
- package/lib/utils/tpl-lodash.js +3 -2
- package/lib/utils/tpl.d.ts +9 -0
- package/lib/utils/tpl.js +45 -1
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validations.d.ts +4 -1
- package/lib/utils/validations.js +27 -12
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.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
|
|
2
|
+
* amis-core v3.0.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
|
/**
|
package/esm/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/esm/env.js
CHANGED
package/esm/envOverwrite.js
CHANGED
package/esm/factory.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { fetcherResult, SchemaNode, Schema, PlainObject } from './types';
|
|
|
4
4
|
import { ThemeProps } from './theme';
|
|
5
5
|
import { LocaleProps } from './locale';
|
|
6
6
|
import type { RendererEnv } from './env';
|
|
7
|
-
import { OnEventProps } from './utils/renderer-event';
|
|
7
|
+
import { OnEventProps, RendererEvent } from './utils/renderer-event';
|
|
8
8
|
export interface TestFunc {
|
|
9
9
|
(path: string, schema?: Schema, resolveRenderer?: (path: string, schema?: Schema, props?: any) => null | RendererConfig): boolean;
|
|
10
10
|
}
|
|
@@ -35,6 +35,7 @@ export interface RendererProps extends ThemeProps, LocaleProps, OnEventProps {
|
|
|
35
35
|
style?: {
|
|
36
36
|
[propName: string]: any;
|
|
37
37
|
};
|
|
38
|
+
onBroadcast?: (type: string, rawEvent: RendererEvent<any>, ctx: any) => any;
|
|
38
39
|
[propName: string]: any;
|
|
39
40
|
}
|
|
40
41
|
export type RendererComponent = React.ComponentType<RendererProps> & {
|
package/esm/factory.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -74,6 +74,8 @@ function registerRenderer(config) {
|
|
|
74
74
|
}
|
|
75
75
|
function unRegisterRenderer(config) {
|
|
76
76
|
var name = (typeof config === 'string' ? config : config.name);
|
|
77
|
+
var idx = renderers.findIndex(function (item) { return item.name === name; });
|
|
78
|
+
~idx && renderers.splice(idx, 1);
|
|
77
79
|
delete renderersMap[name];
|
|
78
80
|
// 清空渲染器定位缓存
|
|
79
81
|
cache = {};
|
|
@@ -136,11 +138,11 @@ var defaultOptions = {
|
|
|
136
138
|
}
|
|
137
139
|
},
|
|
138
140
|
isCancel: function () {
|
|
139
|
-
console.error('Please implement isCancel. see https://baidu.
|
|
141
|
+
console.error('Please implement isCancel. see https://aisuda.bce.baidu.com/amis/zh-CN/start/getting-started#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97');
|
|
140
142
|
return false;
|
|
141
143
|
},
|
|
142
144
|
updateLocation: function () {
|
|
143
|
-
console.error('Please implement updateLocation. see https://baidu.
|
|
145
|
+
console.error('Please implement updateLocation. see https://aisuda.bce.baidu.com/amis/zh-CN/start/getting-started#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97');
|
|
144
146
|
},
|
|
145
147
|
jumpTo: function (to, action) {
|
|
146
148
|
if (to === 'goBack') {
|
package/esm/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';
|
|
@@ -15,10 +14,11 @@ export * from './types';
|
|
|
15
14
|
export * from './store';
|
|
16
15
|
import * as utils from './utils/helper';
|
|
17
16
|
import { RegisterStore } from './store';
|
|
17
|
+
import type { IColumn, IColumn2, IRow, IRow2 } from './store';
|
|
18
18
|
import { setDefaultLocale, getDefaultLocale, makeTranslator, register as registerLocale, extendLocale, removeLocaleData, localeable } from './locale';
|
|
19
19
|
import type { LocaleProps, TranslateFn } from './locale';
|
|
20
20
|
import Scoped, { ScopedContext } from './Scoped';
|
|
21
|
-
import type { IScopedContext } from './Scoped';
|
|
21
|
+
import type { ScopedComponentType, IScopedContext } from './Scoped';
|
|
22
22
|
import { classnames, getClassPrefix, setDefaultTheme, theme, getTheme, themeable, makeClassnames } from './theme';
|
|
23
23
|
import type { ClassNamesFn, ThemeProps } from './theme';
|
|
24
24
|
declare const classPrefix: string | undefined;
|
|
@@ -32,13 +32,17 @@ import { Schema } from './types';
|
|
|
32
32
|
import { addRootWrapper, RootRenderProps } from './Root';
|
|
33
33
|
import { EnvContext } from './env';
|
|
34
34
|
import type { RendererEnv } from './env';
|
|
35
|
-
import { evaluate, Evaluator, extendsFilters, filters, getFilters, lexer, parse, registerFilter, registerFunction } from 'amis-formula';
|
|
35
|
+
import { evaluate, evaluateForAsync, Evaluator, AsyncEvaluator, extendsFilters, filters, getFilters, lexer, parse, registerFilter, registerFunction } from 'amis-formula';
|
|
36
36
|
import type { FilterContext } from 'amis-formula';
|
|
37
37
|
import LazyComponent from './components/LazyComponent';
|
|
38
38
|
import Overlay from './components/Overlay';
|
|
39
39
|
import PopOver from './components/PopOver';
|
|
40
40
|
import { FormRenderer } from './renderers/Form';
|
|
41
|
-
import type { FormHorizontal } from './renderers/Form';
|
|
41
|
+
import type { FormHorizontal, FormSchemaBase } from './renderers/Form';
|
|
42
|
+
import type { OnEventProps } from './utils/index';
|
|
43
|
+
import { valueMap as styleMap } from './utils/style-helper';
|
|
44
|
+
import { RENDERER_TRANSMISSION_OMIT_PROPS } from './SchemaRenderer';
|
|
45
|
+
import type { IItem } from './store/list';
|
|
42
46
|
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 };
|
|
47
|
+
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, styleMap, RENDERER_TRANSMISSION_OMIT_PROPS, ScopedComponentType, IItem, IColumn, IRow, IColumn2, IRow2, OnEventProps, FormSchemaBase };
|
|
44
48
|
export declare function render(schema: Schema, props?: RootRenderProps, options?: RenderOptions, pathPrefix?: string): JSX.Element;
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -20,20 +20,20 @@ export { DataScope } from './utils/DataScope.js';
|
|
|
20
20
|
export { filterDate, parseDuration, relativeValueRe } from './utils/date.js';
|
|
21
21
|
import { enableDebug } from './utils/debug.js';
|
|
22
22
|
export { DebugWrapper, debug, enableDebug, warning } from './utils/debug.js';
|
|
23
|
-
export { calculatePosition, getContainer, getStyleNumber, ownerDocument } from './utils/dom.js';
|
|
23
|
+
export { calculatePosition, getContainer, getStyleNumber, ownerDocument, renderTextByKeyword } from './utils/dom.js';
|
|
24
24
|
export { ServerError } from './utils/errors.js';
|
|
25
25
|
export { escapeHtml } from './utils/escapeHtml.js';
|
|
26
26
|
export { getExprProperties } from './utils/filter-schema.js';
|
|
27
27
|
import './utils/filter.js';
|
|
28
28
|
export { formatDuration } from './utils/formatDuration.js';
|
|
29
|
-
export { FormulaExec, formulaExec, isExpression, isNeedFormula, registerFormulaExec, replaceExpression } from './utils/formula.js';
|
|
29
|
+
export { FormulaExec, formulaExec, isExpression, isNeedFormula, isNowFormula, registerFormulaExec, replaceExpression } from './utils/formula.js';
|
|
30
30
|
export { getVariable } from './utils/getVariable.js';
|
|
31
31
|
export { collectVariables } from './utils/grammar.js';
|
|
32
32
|
export { handleAction } from './utils/handleAction.js';
|
|
33
33
|
import { promisify } from './utils/helper.js';
|
|
34
34
|
import * as helper from './utils/helper.js';
|
|
35
35
|
export { helper as utils };
|
|
36
|
-
export { JSONTraverse, SkipOperation, __uri, anyChanged, autobind, bulkBindFunctions, camel, chainEvents, chainFunctions, convertArrayValueToMoment, detectPropValueChanged, difference, eachTree, everyTree, filterTree, findIndex, findObjectsWithKey, findTree, findTreeIndex, flattenTree, flattenTreeWithLeafNodes, getLevelFromClassName, getPropValue, getRange, getScrollParent, getScrollbarWidth, getTree, getTreeAncestors, getTreeDepth, getTreeParent, getWidthRate, guid, hasAbility, hasFile, hasOwnPropertyInPath, hasVisibleExpression, hashCode, immutableExtends, injectPropsToObject, isArrayChildrenModified, isBreakpoint, isClickOnInput, isDisabled, isEmpty, isMobile, isNumeric, isObjectShallowModified, isSuperDataModified, isUnfolded, isVisible, lcFirst, loadScript, makeColumnClassBuild, makeHorizontalDeeper, mapObject, mapTree, noop, normalizeNodePath, object2formData, omitControls, padArr, parseQuery, pickEventsProps, preventDefault, promisify, qsparse, qsstringify, range, removeHTMLTag, repeatCount, rmUndefined, someTree, sortArray, spliceTree, syncDataFromSuper, ucFirst, until, uuid, uuidv4, visibilityFilter } from './utils/helper.js';
|
|
36
|
+
export { JSONTraverse, SkipOperation, __uri, anyChanged, autobind, bulkBindFunctions, camel, chainEvents, chainFunctions, convertArrayValueToMoment, detectPropValueChanged, difference, eachTree, everyTree, filterTree, findIndex, findObjectsWithKey, findTree, findTreeAll, findTreeIndex, flattenTree, flattenTreeWithLeafNodes, getLevelFromClassName, getPropValue, getRange, getScrollParent, getScrollbarWidth, getTree, getTreeAncestors, getTreeDepth, getTreeParent, getWidthRate, guid, hasAbility, hasFile, hasOwnPropertyInPath, hasVisibleExpression, hashCode, immutableExtends, injectPropsToObject, isArrayChildrenModified, isBreakpoint, isClickOnInput, isDisabled, isEmpty, isMobile, isNumeric, isObjectShallowModified, isSuperDataModified, isUnfolded, isVisible, lcFirst, loadScript, loadStyle, makeColumnClassBuild, makeHorizontalDeeper, mapObject, mapTree, noop, normalizeNodePath, object2formData, omitControls, padArr, parseQuery, pickEventsProps, preventDefault, promisify, qsparse, qsstringify, range, removeHTMLTag, repeatCount, rmUndefined, someTree, sortArray, spliceTree, syncDataFromSuper, ucFirst, until, uuid, uuidv4, visibilityFilter } from './utils/helper.js';
|
|
37
37
|
export { highlight } from './utils/highlight.js';
|
|
38
38
|
export { generateIcon } from './utils/icon.js';
|
|
39
39
|
export { getImageDimensions, toDataURL } from './utils/image.js';
|
|
@@ -55,19 +55,21 @@ export { replaceText } from './utils/replaceText.js';
|
|
|
55
55
|
export { getComputedStyle, resizeSensor } from './utils/resize-sensor.js';
|
|
56
56
|
export { resolveVariable } from './utils/resolveVariable.js';
|
|
57
57
|
export { resolveVariableAndFilter } from './utils/resolveVariableAndFilter.js';
|
|
58
|
+
export { resolveVariableAndFilterForAsync, setFormulaEvalErrorHandler } from './utils/resolveVariableAndFilterForAsync.js';
|
|
58
59
|
export { RootClose } from './utils/RootClose.js';
|
|
59
60
|
export { scrollPosition } from './utils/scrollPosition.js';
|
|
60
61
|
export { SimpleMap } from './utils/SimpleMap.js';
|
|
61
62
|
export { string2regExp } from './utils/string2regExp.js';
|
|
62
63
|
export { buildStyle } from './utils/style.js';
|
|
63
|
-
export { tokenize } from './utils/tokenize.js';
|
|
64
|
+
export { asyncTokenize, tokenize } from './utils/tokenize.js';
|
|
64
65
|
export { register } from './utils/tpl-builtin.js';
|
|
65
|
-
export { evalExpression, evalJS, filter, registerTplEnginer, setCustomEvalExpression, setCustomEvalJs } from './utils/tpl.js';
|
|
66
|
+
export { asyncFilter, evalExpression, evalExpressionWithConditionBuilder, evalJS, filter, registerTplEnginer, setCustomEvalExpression, setCustomEvalJs } from './utils/tpl.js';
|
|
66
67
|
export { uncontrollable } from './utils/uncontrollable.js';
|
|
67
68
|
export { addRule, str2rules, validate, validateMessages, validateObject, validations } from './utils/validations.js';
|
|
68
69
|
export { toNumber } from './utils/toNumber.js';
|
|
69
70
|
export { decodeEntity } from './utils/decodeEntity.js';
|
|
70
|
-
export { addStyle, findOrCreactStyle, formatStyle, insertCustomStyle, insertStyle, valueMap } from './utils/style-helper.js';
|
|
71
|
+
export { addStyle, findOrCreactStyle, formatStyle, getValueByPath, inheritValueMap, insertCustomStyle, insertStyle, valueMap as styleMap, valueMap } from './utils/style-helper.js';
|
|
72
|
+
export { getConditionComputers, registerConditionComputer, resolveCondition, setConditionComputeErrorHandler } from './utils/resolveCondition.js';
|
|
71
73
|
export { default as animation } from './utils/Animation.js';
|
|
72
74
|
import { RendererStore } from './store/index.js';
|
|
73
75
|
export { RegisterStore, RendererStore } from './store/index.js';
|
|
@@ -102,11 +104,12 @@ import { envOverwrite } from './envOverwrite.js';
|
|
|
102
104
|
import { EnvContext } from './env.js';
|
|
103
105
|
export { EnvContext } from './env.js';
|
|
104
106
|
import React from 'react';
|
|
105
|
-
export { Evaluator, evaluate, extendsFilters, filters, getFilters, lexer, parse, registerFilter, registerFunction } from 'amis-formula';
|
|
107
|
+
export { AsyncEvaluator, Evaluator, evaluate, evaluateForAsync, extendsFilters, filters, getFilters, lexer, parse, registerFilter, registerFunction } from 'amis-formula';
|
|
106
108
|
export { default as LazyComponent } from './components/LazyComponent.js';
|
|
107
109
|
export { default as Overlay } from './components/Overlay.js';
|
|
108
110
|
export { default as PopOver } from './components/PopOver.js';
|
|
109
111
|
export { FormRenderer } from './renderers/Form.js';
|
|
112
|
+
export { RENDERER_TRANSMISSION_OMIT_PROPS } from './SchemaRenderer.js';
|
|
110
113
|
export { stripNumber } from './utils/stripNumber.js';
|
|
111
114
|
export { iRendererStore } from './store/iRenderer.js';
|
|
112
115
|
export { ServiceStore } from './store/service.js';
|
|
@@ -131,7 +134,7 @@ export { StoreNode } from './store/node.js';
|
|
|
131
134
|
*/
|
|
132
135
|
var classPrefix = getClassPrefix();
|
|
133
136
|
// @ts-ignore
|
|
134
|
-
var version = '
|
|
137
|
+
var version = '3.0.0';
|
|
135
138
|
function render(schema, props, options, pathPrefix) {
|
|
136
139
|
if (props === void 0) { props = {}; }
|
|
137
140
|
if (options === void 0) { options = {}; }
|
package/esm/locale.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export declare function localeable<T extends React.ComponentType<React.Component
|
|
|
25
25
|
childRef(ref: any): void;
|
|
26
26
|
getWrappedInstance(): any;
|
|
27
27
|
render(): JSX.Element;
|
|
28
|
-
context:
|
|
28
|
+
context: unknown;
|
|
29
29
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof LocaleProps>> & {
|
|
30
30
|
locale?: string | undefined;
|
|
31
31
|
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
|
@@ -34,8 +34,6 @@ export declare function localeable<T extends React.ComponentType<React.Component
|
|
|
34
34
|
readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof LocaleProps>> & {
|
|
35
35
|
locale?: string | undefined;
|
|
36
36
|
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
|
37
|
-
}> & Readonly<{
|
|
38
|
-
children?: React.ReactNode;
|
|
39
37
|
}>;
|
|
40
38
|
state: Readonly<{}>;
|
|
41
39
|
refs: {
|
package/esm/locale.js
CHANGED
package/esm/renderers/Form.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ export interface FormSchemaBase {
|
|
|
120
120
|
/**
|
|
121
121
|
* Form 用来保存数据的 api。
|
|
122
122
|
*
|
|
123
|
-
* 详情:https://baidu.
|
|
123
|
+
* 详情:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/index#%E8%A1%A8%E5%8D%95%E6%8F%90%E4%BA%A4
|
|
124
124
|
*/
|
|
125
125
|
api?: string | BaseApiObject;
|
|
126
126
|
/**
|
package/esm/renderers/Form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -10,7 +10,7 @@ import { Renderer } from '../factory.js';
|
|
|
10
10
|
import { FormStore } from '../store/form.js';
|
|
11
11
|
import { evalExpression, filter } from '../utils/tpl.js';
|
|
12
12
|
import { getExprProperties } from '../utils/filter-schema.js';
|
|
13
|
-
import { promisify, isEmpty, until, noop,
|
|
13
|
+
import { promisify, isEmpty, until, noop, difference, isVisible, repeatCount, qsparse, isObjectShallowModified, SkipOperation } from '../utils/helper.js';
|
|
14
14
|
import debounce from 'lodash/debounce';
|
|
15
15
|
import flatten from 'lodash/flatten';
|
|
16
16
|
import find from 'lodash/find';
|
|
@@ -379,7 +379,7 @@ var Form = /** @class */ (function (_super) {
|
|
|
379
379
|
};
|
|
380
380
|
Form.prototype.emitChange = function (submit) {
|
|
381
381
|
return __awaiter(this, void 0, void 0, function () {
|
|
382
|
-
var _a, onChange, store, submitOnChange, dispatchEvent, data, dispatcher;
|
|
382
|
+
var _a, onChange, store, submitOnChange, dispatchEvent, data, changeProps, dispatcher;
|
|
383
383
|
return __generator(this, function (_b) {
|
|
384
384
|
switch (_b.label) {
|
|
385
385
|
case 0:
|
|
@@ -387,12 +387,16 @@ var Form = /** @class */ (function (_super) {
|
|
|
387
387
|
if (!isAlive(store)) {
|
|
388
388
|
return [2 /*return*/];
|
|
389
389
|
}
|
|
390
|
+
changeProps = [
|
|
391
|
+
store.data,
|
|
392
|
+
difference(store.data, store.pristine),
|
|
393
|
+
this.props
|
|
394
|
+
];
|
|
390
395
|
return [4 /*yield*/, dispatchEvent('change', createObject(data, store.data))];
|
|
391
396
|
case 1:
|
|
392
397
|
dispatcher = _b.sent();
|
|
393
398
|
if (!(dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.prevented)) {
|
|
394
|
-
onChange &&
|
|
395
|
-
onChange(store.data, difference(store.data, store.pristine), this.props);
|
|
399
|
+
onChange && onChange.apply(null, changeProps);
|
|
396
400
|
}
|
|
397
401
|
store.clearRestError();
|
|
398
402
|
(submit || (submitOnChange && store.inited)) &&
|
|
@@ -500,11 +504,12 @@ var Form = /** @class */ (function (_super) {
|
|
|
500
504
|
// 走到这里代表校验成功了
|
|
501
505
|
dispatchEvent('validateSucc', _this.props.data);
|
|
502
506
|
if (target) {
|
|
503
|
-
_this.submitToTarget(target, values);
|
|
507
|
+
_this.submitToTarget(filter(target, values), values);
|
|
504
508
|
dispatchEvent('submitSucc', createObject(_this.props.data, values));
|
|
505
509
|
}
|
|
506
510
|
else if (action.actionType === 'reload') {
|
|
507
|
-
action.target &&
|
|
511
|
+
action.target &&
|
|
512
|
+
_this.reloadTarget(filter(action.target, values), values);
|
|
508
513
|
}
|
|
509
514
|
else if (action.actionType === 'dialog') {
|
|
510
515
|
store.openDialog(data);
|
|
@@ -605,15 +610,12 @@ var Form = /** @class */ (function (_super) {
|
|
|
605
610
|
finalRedirect && env.jumpTo(finalRedirect, action);
|
|
606
611
|
}
|
|
607
612
|
else if (action.reload || reload) {
|
|
608
|
-
_this.reloadTarget(action.reload || reload, store.data);
|
|
613
|
+
_this.reloadTarget(filter(action.reload || reload, store.data), store.data);
|
|
609
614
|
}
|
|
610
615
|
action.close && _this.closeTarget(action.close);
|
|
611
616
|
return values;
|
|
612
617
|
})
|
|
613
618
|
.catch(function (reason) {
|
|
614
|
-
if (reason instanceof SkipOperation) {
|
|
615
|
-
return;
|
|
616
|
-
}
|
|
617
619
|
onFailed && onFailed(reason, store.errors);
|
|
618
620
|
if (throwErrors) {
|
|
619
621
|
throw reason;
|
|
@@ -672,7 +674,8 @@ var Form = /** @class */ (function (_super) {
|
|
|
672
674
|
case 4:
|
|
673
675
|
redirect = action.redirect && filter(action.redirect, store.data);
|
|
674
676
|
redirect && env.jumpTo(redirect, action);
|
|
675
|
-
action.reload &&
|
|
677
|
+
action.reload &&
|
|
678
|
+
this.reloadTarget(filter(action.reload, store.data), store.data);
|
|
676
679
|
action.close && this.closeTarget(action.close);
|
|
677
680
|
return [2 /*return*/];
|
|
678
681
|
}
|
|
@@ -688,7 +691,7 @@ var Form = /** @class */ (function (_super) {
|
|
|
688
691
|
else if (action.actionType === 'reload') {
|
|
689
692
|
store.setCurrentAction(action);
|
|
690
693
|
if (action.target) {
|
|
691
|
-
this.reloadTarget(action.target, data);
|
|
694
|
+
this.reloadTarget(filter(action.target, data), data);
|
|
692
695
|
}
|
|
693
696
|
else {
|
|
694
697
|
this.receive(data);
|
|
@@ -868,8 +871,7 @@ var Form = /** @class */ (function (_super) {
|
|
|
868
871
|
*/
|
|
869
872
|
disabled: disabled ||
|
|
870
873
|
control.disabled ||
|
|
871
|
-
(form.loading ? true : undefined) }, control.static || isStatic
|
|
872
|
-
? { static: true } : {}), { btnDisabled: disabled || form.loading || form.validating, onAction: this.handleAction, onQuery: this.handleQuery, onChange: this.handleChange, onBulkChange: this.handleBulkChange, addHook: this.addHook, removeHook: this.removeHook, renderFormItems: this.renderFormItems, formItemDispatchEvent: this.formItemDispatchEvent(dispatchEvent), formPristine: form.pristine });
|
|
874
|
+
(form.loading ? true : undefined) }, (control.static || isStatic ? { static: true } : {})), { btnDisabled: disabled || form.loading || form.validating, onAction: this.handleAction, onQuery: this.handleQuery, onChange: this.handleChange, onBulkChange: this.handleBulkChange, addHook: this.addHook, removeHook: this.removeHook, renderFormItems: this.renderFormItems, formItemDispatchEvent: this.formItemDispatchEvent(dispatchEvent), formPristine: form.pristine });
|
|
873
875
|
var subSchema = __assign({}, control);
|
|
874
876
|
if (subSchema.$ref) {
|
|
875
877
|
subSchema = __assign(__assign({}, resolveDefinitions(subSchema.$ref)), subSchema);
|
package/esm/renderers/Item.d.ts
CHANGED
|
@@ -461,15 +461,11 @@ export declare class FormItemWrap extends React.Component<FormItemProps> {
|
|
|
461
461
|
export declare const detectProps: string[];
|
|
462
462
|
export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (Control: FormControlComponent) => {
|
|
463
463
|
new (props: Omit<any, "rootStore"> | Readonly<Omit<any, "rootStore">>): {
|
|
464
|
-
render(): JSX.Element;
|
|
465
|
-
|
|
466
|
-
*/
|
|
467
|
-
context: any;
|
|
464
|
+
render(): JSX.Element;
|
|
465
|
+
context: unknown;
|
|
468
466
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<any, "rootStore">>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
469
467
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
470
|
-
readonly props: Readonly<Omit<any, "rootStore"
|
|
471
|
-
children?: React.ReactNode;
|
|
472
|
-
}>;
|
|
468
|
+
readonly props: Readonly<Omit<any, "rootStore">>;
|
|
473
469
|
state: Readonly<{}>;
|
|
474
470
|
refs: {
|
|
475
471
|
[key: string]: React.ReactInstance;
|
|
@@ -488,15 +484,11 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
488
484
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<any, "rootStore">>, nextState: Readonly<{}>, nextContext: any): void;
|
|
489
485
|
};
|
|
490
486
|
new (props: Omit<any, "rootStore">, context: any): {
|
|
491
|
-
render(): JSX.Element;
|
|
492
|
-
|
|
493
|
-
*/
|
|
494
|
-
context: any;
|
|
487
|
+
render(): JSX.Element;
|
|
488
|
+
context: unknown;
|
|
495
489
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<any, "rootStore">>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
496
490
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
497
|
-
readonly props: Readonly<Omit<any, "rootStore"
|
|
498
|
-
children?: React.ReactNode;
|
|
499
|
-
}>;
|
|
491
|
+
readonly props: Readonly<Omit<any, "rootStore">>;
|
|
500
492
|
state: Readonly<{}>;
|
|
501
493
|
refs: {
|
|
502
494
|
[key: string]: React.ReactInstance;
|
|
@@ -862,7 +854,9 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
862
854
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>>;
|
|
863
855
|
ComposedComponent: React.ComponentType<any>;
|
|
864
856
|
} & hoistNonReactStatic.NonReactStatics<any, {}> & {
|
|
865
|
-
ComposedComponent: any;
|
|
857
|
+
ComposedComponent: any; /**
|
|
858
|
+
* 配置 label className
|
|
859
|
+
*/
|
|
866
860
|
} & {
|
|
867
861
|
ComposedComponent: any;
|
|
868
862
|
};
|
package/esm/renderers/Item.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -45,6 +45,7 @@ import 'lodash/camelCase';
|
|
|
45
45
|
import { insertCustomStyle } from '../utils/style-helper.js';
|
|
46
46
|
import 'uncontrollable';
|
|
47
47
|
import '../utils/validations.js';
|
|
48
|
+
import '../utils/resolveCondition.js';
|
|
48
49
|
import '../utils/Animation.js';
|
|
49
50
|
import Overlay from '../components/Overlay.js';
|
|
50
51
|
import PopOver from '../components/PopOver.js';
|
|
@@ -333,7 +334,8 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
333
334
|
var controlSize = size || defaultSize;
|
|
334
335
|
return renderControl(__assign(__assign({}, rest), { onOpenDialog: this.handleOpenDialog, type: type, classnames: cx, formItem: model, className: cx("Form-control", (_a = {
|
|
335
336
|
'is-inline': !!rest.inline && !mobileUI,
|
|
336
|
-
'is-error': model && !model.valid
|
|
337
|
+
'is-error': model && !model.valid,
|
|
338
|
+
'is-full': size === 'full'
|
|
337
339
|
},
|
|
338
340
|
_a["Form-control--withSize Form-control--size".concat(ucFirst(controlSize))] = sizeMutable !== false &&
|
|
339
341
|
typeof controlSize === 'string' &&
|
|
@@ -344,15 +346,15 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
344
346
|
return null;
|
|
345
347
|
};
|
|
346
348
|
FormItemWrap.prototype.render = function () {
|
|
347
|
-
var _a = this.props, formMode = _a.formMode, inputOnly = _a.inputOnly, wrap = _a.wrap, render = _a.render, model = _a.formItem, css = _a.css, id = _a.id, labelClassName = _a.labelClassName, descriptionClassName = _a.descriptionClassName;
|
|
349
|
+
var _a = this.props, formMode = _a.formMode, inputOnly = _a.inputOnly, wrap = _a.wrap, render = _a.render, model = _a.formItem, css = _a.css, themeCss = _a.themeCss, id = _a.id, labelClassName = _a.labelClassName, descriptionClassName = _a.descriptionClassName;
|
|
348
350
|
var mode = this.props.mode || formMode;
|
|
349
|
-
insertCustomStyle(css, [
|
|
351
|
+
insertCustomStyle(themeCss || css, [
|
|
350
352
|
{
|
|
351
353
|
key: 'labelClassName',
|
|
352
354
|
value: labelClassName
|
|
353
355
|
}
|
|
354
356
|
], id + '-label');
|
|
355
|
-
insertCustomStyle(css, [
|
|
357
|
+
insertCustomStyle(themeCss || css, [
|
|
356
358
|
{
|
|
357
359
|
key: 'descriptionClassName',
|
|
358
360
|
value: descriptionClassName
|
|
@@ -766,7 +768,8 @@ var detectProps = [
|
|
|
766
768
|
'embed',
|
|
767
769
|
'displayMode',
|
|
768
770
|
'revealPassword',
|
|
769
|
-
'loading'
|
|
771
|
+
'loading',
|
|
772
|
+
'themeCss'
|
|
770
773
|
];
|
|
771
774
|
function asFormItem(config) {
|
|
772
775
|
return function (Control) {
|
|
@@ -837,7 +840,8 @@ function asFormItem(config) {
|
|
|
837
840
|
return (React.createElement(React.Fragment, null,
|
|
838
841
|
React.createElement(Control, __assign({}, rest, { useMobileUI: useMobileUI, onOpenDialog: this.handleOpenDialog, size: config.sizeMutable !== false ? undefined : size, onFocus: this.handleFocus, onBlur: this.handleBlur, type: type, classnames: cx, ref: isSFC ? undefined : this.refFn, forwardedRef: isSFC ? this.refFn : undefined, formItem: model, className: cx("Form-control", (_a = {
|
|
839
842
|
'is-inline': !!rest.inline && !mobileUI,
|
|
840
|
-
'is-error': model && !model.valid
|
|
843
|
+
'is-error': model && !model.valid,
|
|
844
|
+
'is-full': size === 'full'
|
|
841
845
|
},
|
|
842
846
|
_a["Form-control--withSize Form-control--size".concat(ucFirst(controlSize))] = config.sizeMutable !== false &&
|
|
843
847
|
typeof controlSize === 'string' &&
|
package/esm/renderers/Options.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -47,6 +47,7 @@ import 'lodash/camelCase';
|
|
|
47
47
|
import 'uncontrollable';
|
|
48
48
|
import 'hoist-non-react-statics';
|
|
49
49
|
import '../utils/validations.js';
|
|
50
|
+
import '../utils/resolveCondition.js';
|
|
50
51
|
import '../utils/Animation.js';
|
|
51
52
|
|
|
52
53
|
var detectProps = detectProps$1.concat([
|
|
@@ -182,8 +183,8 @@ function registerOptionsControl(config) {
|
|
|
182
183
|
switch (_b.label) {
|
|
183
184
|
case 0:
|
|
184
185
|
_a = this.props, dispatchEvent = _a.dispatchEvent, options = _a.options;
|
|
185
|
-
return [4 /*yield*/, dispatchEvent(eventName, resolveEventData(this.props, { value: eventData, options: options, items: options }
|
|
186
|
-
|
|
186
|
+
return [4 /*yield*/, dispatchEvent(eventName, resolveEventData(this.props, { value: eventData, options: options, items: options } // 为了保持名字统一
|
|
187
|
+
))];
|
|
187
188
|
case 1:
|
|
188
189
|
rendererEvent = _b.sent();
|
|
189
190
|
// 返回阻塞标识
|
package/esm/renderers/builtin.js
CHANGED
|
@@ -51,12 +51,10 @@ export interface ControlProps {
|
|
|
51
51
|
export declare function wrapControl<T extends React.ComponentType<React.ComponentProps<T> & ControlProps>>(ComposedComponent: T): {
|
|
52
52
|
new (props: Omit<any, "rootStore"> | Readonly<Omit<any, "rootStore">>): {
|
|
53
53
|
render(): JSX.Element;
|
|
54
|
-
context:
|
|
54
|
+
context: unknown;
|
|
55
55
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<any, "rootStore">>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
56
56
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
57
|
-
readonly props: Readonly<Omit<any, "rootStore"
|
|
58
|
-
children?: React.ReactNode;
|
|
59
|
-
}>;
|
|
57
|
+
readonly props: Readonly<Omit<any, "rootStore">>;
|
|
60
58
|
state: Readonly<{}>;
|
|
61
59
|
refs: {
|
|
62
60
|
[key: string]: React.ReactInstance;
|
|
@@ -76,12 +74,10 @@ export declare function wrapControl<T extends React.ComponentType<React.Componen
|
|
|
76
74
|
};
|
|
77
75
|
new (props: Omit<any, "rootStore">, context: any): {
|
|
78
76
|
render(): JSX.Element;
|
|
79
|
-
context:
|
|
77
|
+
context: unknown;
|
|
80
78
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<any, "rootStore">>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
81
79
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
82
|
-
readonly props: Readonly<Omit<any, "rootStore"
|
|
83
|
-
children?: React.ReactNode;
|
|
84
|
-
}>;
|
|
80
|
+
readonly props: Readonly<Omit<any, "rootStore">>;
|
|
85
81
|
state: Readonly<{}>;
|
|
86
82
|
refs: {
|
|
87
83
|
[key: string]: React.ReactInstance;
|