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/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.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
|
|
|
@@ -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 = {};
|
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';
|
|
@@ -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;
|
package/esm/index.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
|
|
|
@@ -26,7 +26,7 @@ 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';
|
|
@@ -55,6 +55,7 @@ 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 } 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';
|
|
@@ -62,12 +63,13 @@ export { string2regExp } from './utils/string2regExp.js';
|
|
|
62
63
|
export { buildStyle } from './utils/style.js';
|
|
63
64
|
export { 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 { 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
71
|
export { addStyle, findOrCreactStyle, formatStyle, insertCustomStyle, insertStyle, valueMap } from './utils/style-helper.js';
|
|
72
|
+
export { getConditionComputers, registerConditionComputer, resolveCondition } 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,7 +104,7 @@ 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';
|
|
@@ -131,7 +133,7 @@ export { StoreNode } from './store/node.js';
|
|
|
131
133
|
*/
|
|
132
134
|
var classPrefix = getClassPrefix();
|
|
133
135
|
// @ts-ignore
|
|
134
|
-
var version = '2.
|
|
136
|
+
var version = '2.9.0';
|
|
135
137
|
function render(schema, props, options, pathPrefix) {
|
|
136
138
|
if (props === void 0) { props = {}; }
|
|
137
139
|
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.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
|
|
|
@@ -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 v2.
|
|
2
|
+
* amis-core v2.9.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';
|
package/esm/renderers/Options.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
|
|
|
@@ -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([
|
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;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { __extends, __awaiter, __generator
|
|
6
|
+
import { __extends, __assign, __awaiter, __generator } from 'tslib';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import debounce from 'lodash/debounce';
|
|
9
9
|
import isEqual from 'lodash/isEqual';
|
|
10
10
|
import { ComboStore } from '../store/combo.js';
|
|
11
11
|
import { guid, promisify, anyChanged } from '../utils/helper.js';
|
|
12
|
-
import { isExpression, FormulaExec, replaceExpression, isNeedFormula } from '../utils/formula.js';
|
|
12
|
+
import { isExpression, FormulaExec, replaceExpression, isNowFormula, isNeedFormula } from '../utils/formula.js';
|
|
13
13
|
import { ScopedContext } from '../Scoped.js';
|
|
14
14
|
import { FormItemStore } from '../store/formItem.js';
|
|
15
15
|
import { isAlive } from 'mobx-state-tree';
|
|
@@ -17,6 +17,7 @@ import { observer } from 'mobx-react';
|
|
|
17
17
|
import hoistNonReactStatic from 'hoist-non-react-statics';
|
|
18
18
|
import { withRootStore } from '../WithRootStore.js';
|
|
19
19
|
import { TableStore } from '../store/table.js';
|
|
20
|
+
import pick from 'lodash/pick';
|
|
20
21
|
import { getVariable } from '../utils/getVariable.js';
|
|
21
22
|
|
|
22
23
|
function wrapControl(ComposedComponent) {
|
|
@@ -32,7 +33,7 @@ function wrapControl(ComposedComponent) {
|
|
|
32
33
|
trailing: true,
|
|
33
34
|
leading: false
|
|
34
35
|
});
|
|
35
|
-
var _c = _this.props, form = _c.formStore, formItem = _c.formItem, rootStore = _c.rootStore, store = _c.store, onChange = _c.onChange, data = _c.data, inputGroupControl = _c.inputGroupControl, _d = _c.$schema, name = _d.name, id = _d.id, type = _d.type, required = _d.required, validations = _d.validations, validationErrors = _d.validationErrors, unique = _d.unique, value = _d.value
|
|
36
|
+
var _c = _this.props, form = _c.formStore, formItem = _c.formItem, rootStore = _c.rootStore, store = _c.store, onChange = _c.onChange, data = _c.data, inputGroupControl = _c.inputGroupControl, _d = _c.$schema, name = _d.name, id = _d.id, type = _d.type, required = _d.required, validations = _d.validations, validationErrors = _d.validationErrors, unique = _d.unique, value = _d.value; _d.multiple; var delimiter = _d.delimiter, valueField = _d.valueField, labelField = _d.labelField, joinValues = _d.joinValues, extractValue = _d.extractValue, selectFirst = _d.selectFirst, autoFill = _d.autoFill, clearValueOnHidden = _d.clearValueOnHidden, validateApi = _d.validateApi, minLength = _d.minLength, maxLength = _d.maxLength, validateOnChange = _d.validateOnChange, label = _d.label;
|
|
36
37
|
_this.getValue = _this.getValue.bind(_this);
|
|
37
38
|
_this.setValue = _this.setValue.bind(_this);
|
|
38
39
|
_this.handleChange = _this.handleChange.bind(_this);
|
|
@@ -63,31 +64,7 @@ function wrapControl(ComposedComponent) {
|
|
|
63
64
|
_this.model = model;
|
|
64
65
|
// @issue 打算干掉这个
|
|
65
66
|
formItem === null || formItem === void 0 ? void 0 : formItem.addSubFormItem(model);
|
|
66
|
-
model.config({
|
|
67
|
-
id: id,
|
|
68
|
-
type: type,
|
|
69
|
-
required: required,
|
|
70
|
-
unique: unique,
|
|
71
|
-
value: value,
|
|
72
|
-
isValueSchemaExp: isExpression(value),
|
|
73
|
-
rules: validations,
|
|
74
|
-
messages: validationErrors,
|
|
75
|
-
multiple: multiple,
|
|
76
|
-
delimiter: delimiter,
|
|
77
|
-
valueField: valueField,
|
|
78
|
-
labelField: labelField,
|
|
79
|
-
joinValues: joinValues,
|
|
80
|
-
extractValue: extractValue,
|
|
81
|
-
selectFirst: selectFirst,
|
|
82
|
-
autoFill: autoFill,
|
|
83
|
-
clearValueOnHidden: clearValueOnHidden,
|
|
84
|
-
validateApi: validateApi,
|
|
85
|
-
minLength: minLength,
|
|
86
|
-
maxLength: maxLength,
|
|
87
|
-
validateOnChange: validateOnChange,
|
|
88
|
-
label: label,
|
|
89
|
-
inputGroupControl: inputGroupControl
|
|
90
|
-
});
|
|
67
|
+
model.config(__assign(__assign({}, pick(__assign(__assign({}, ComposedComponent.defaultProps), _this.props.$schema), ['multiple'])), { id: id, type: type, required: required, unique: unique, value: value, isValueSchemaExp: isExpression(value), rules: validations, messages: validationErrors, delimiter: delimiter, valueField: valueField, labelField: labelField, joinValues: joinValues, extractValue: extractValue, selectFirst: selectFirst, autoFill: autoFill, clearValueOnHidden: clearValueOnHidden, validateApi: validateApi, minLength: minLength, maxLength: maxLength, validateOnChange: validateOnChange, label: label, inputGroupControl: inputGroupControl }));
|
|
91
68
|
// issue 这个逻辑应该在 combo 里面自己实现。
|
|
92
69
|
if (_this.model.unique &&
|
|
93
70
|
((_a = form === null || form === void 0 ? void 0 : form.parentStore) === null || _a === void 0 ? void 0 : _a.storeType) === ComboStore.name) {
|
|
@@ -209,10 +186,12 @@ function wrapControl(ComposedComponent) {
|
|
|
209
186
|
else if (model &&
|
|
210
187
|
typeof props.defaultValue !== 'undefined' &&
|
|
211
188
|
isExpression(props.defaultValue)) {
|
|
189
|
+
var nowFormulaChecked = isNowFormula(props.defaultValue);
|
|
212
190
|
// 渲染器中的 defaultValue 优先(备注: SchemaRenderer中会将 value 改成 defaultValue)
|
|
213
191
|
if (!isEqual(props.defaultValue, prevProps.defaultValue) ||
|
|
214
192
|
(props.data !== prevProps.data &&
|
|
215
|
-
isNeedFormula(props.defaultValue, props.data, prevProps.data)
|
|
193
|
+
(isNeedFormula(props.defaultValue, props.data, prevProps.data) ||
|
|
194
|
+
nowFormulaChecked))) {
|
|
216
195
|
var curResult = FormulaExec['formula'](props.defaultValue, props.data);
|
|
217
196
|
var prevResult = FormulaExec['formula'](prevProps.defaultValue, prevProps.data);
|
|
218
197
|
if (!isEqual(curResult, prevResult) &&
|
|
@@ -223,6 +202,14 @@ function wrapControl(ComposedComponent) {
|
|
|
223
202
|
props.onChange(curResult, model.name, false);
|
|
224
203
|
}
|
|
225
204
|
}
|
|
205
|
+
else if (nowFormulaChecked) {
|
|
206
|
+
var nowData = props.data[model.name];
|
|
207
|
+
// now 表达式,计算后的值永远相同
|
|
208
|
+
model.changeTmpValue(nowData);
|
|
209
|
+
if (props.onChange) {
|
|
210
|
+
props.onChange(nowData, model.name, false);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
226
213
|
}
|
|
227
214
|
}
|
|
228
215
|
else if (model) {
|
|
@@ -420,6 +407,10 @@ function wrapControl(ComposedComponent) {
|
|
|
420
407
|
if ((onFormItemChange === null || onFormItemChange === void 0 ? void 0 : onFormItemChange(value, oldValue, this.model, form)) === false) {
|
|
421
408
|
return;
|
|
422
409
|
}
|
|
410
|
+
// onFormItemChange 可能会触发组件销毁,再次读取 this.model 为 undefined
|
|
411
|
+
if (!this.model) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
423
414
|
var validated = this.model.validated;
|
|
424
415
|
onChange === null || onChange === void 0 ? void 0 : onChange(value, name, submitOnChange === true);
|
|
425
416
|
if (
|
package/esm/store/app.d.ts
CHANGED
|
@@ -54,10 +54,12 @@ export declare const AppStore: import("mobx-state-tree").IModelType<{
|
|
|
54
54
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
55
55
|
changeValue(name: string, value: any, changePristine?: boolean | undefined, force?: boolean | undefined, otherModifier?: ((data: Object) => void) | undefined): void;
|
|
56
56
|
setCurrentAction(action: object): void;
|
|
57
|
-
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
57
|
+
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
58
58
|
closeDialog(result?: any): void;
|
|
59
|
-
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
59
|
+
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
60
60
|
closeDrawer(result?: any): void;
|
|
61
|
+
getDialogScoped(): import("..").IScopedContext | null;
|
|
62
|
+
getDrawerScoped(): import("..").IScopedContext | null;
|
|
61
63
|
} & {
|
|
62
64
|
readonly loading: boolean;
|
|
63
65
|
} & {
|
package/esm/store/app.js
CHANGED
package/esm/store/combo.d.ts
CHANGED
|
@@ -1775,10 +1775,12 @@ export declare const ComboStore: import("mobx-state-tree").IModelType<{
|
|
|
1775
1775
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
1776
1776
|
changeValue(name: string, value: any, changePristine?: boolean | undefined, force?: boolean | undefined, otherModifier?: ((data: Object) => void) | undefined): void;
|
|
1777
1777
|
setCurrentAction(action: object): void;
|
|
1778
|
-
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
1778
|
+
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
1779
1779
|
closeDialog(result?: any): void;
|
|
1780
|
-
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
1780
|
+
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
1781
1781
|
closeDrawer(result?: any): void;
|
|
1782
|
+
getDialogScoped(): import("..").IScopedContext | null;
|
|
1783
|
+
getDrawerScoped(): import("..").IScopedContext | null;
|
|
1782
1784
|
} & {
|
|
1783
1785
|
readonly forms: ({
|
|
1784
1786
|
id: string;
|
|
@@ -1834,10 +1836,12 @@ export declare const ComboStore: import("mobx-state-tree").IModelType<{
|
|
|
1834
1836
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
1835
1837
|
changeValue(name: string, value: any, changePristine?: boolean | undefined, force?: boolean | undefined, otherModifier?: ((data: Object) => void) | undefined): void;
|
|
1836
1838
|
setCurrentAction(action: object): void;
|
|
1837
|
-
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
1839
|
+
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
1838
1840
|
closeDialog(result?: any): void;
|
|
1839
|
-
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
1841
|
+
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
1840
1842
|
closeDrawer(result?: any): void;
|
|
1843
|
+
getDialogScoped(): import("..").IScopedContext | null;
|
|
1844
|
+
getDrawerScoped(): import("..").IScopedContext | null;
|
|
1841
1845
|
} & {
|
|
1842
1846
|
readonly loading: boolean;
|
|
1843
1847
|
} & {
|
|
@@ -7091,10 +7095,12 @@ export declare const ComboStore: import("mobx-state-tree").IModelType<{
|
|
|
7091
7095
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
7092
7096
|
changeValue(name: string, value: any, changePristine?: boolean | undefined, force?: boolean | undefined, otherModifier?: ((data: Object) => void) | undefined): void;
|
|
7093
7097
|
setCurrentAction(action: object): void;
|
|
7094
|
-
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
7098
|
+
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
7095
7099
|
closeDialog(result?: any): void;
|
|
7096
|
-
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
7100
|
+
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
7097
7101
|
closeDrawer(result?: any): void;
|
|
7102
|
+
getDialogScoped(): import("..").IScopedContext | null;
|
|
7103
|
+
getDrawerScoped(): import("..").IScopedContext | null;
|
|
7098
7104
|
} & {
|
|
7099
7105
|
readonly loading: boolean;
|
|
7100
7106
|
} & {
|
package/esm/store/combo.js
CHANGED