amis-core 2.9.0 → 3.1.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 +89 -4
- package/esm/Root.js +15 -4
- package/esm/RootRenderer.d.ts +3 -1
- package/esm/RootRenderer.js +9 -3
- package/esm/SchemaRenderer.d.ts +4 -2
- package/esm/SchemaRenderer.js +32 -24
- package/esm/Scoped.d.ts +8 -0
- package/esm/Scoped.js +20 -5
- package/esm/StatusScoped.d.ts +58 -0
- package/esm/StatusScoped.js +54 -0
- package/esm/WithRootStore.d.ts +2 -2
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +6 -2
- package/esm/actions/Action.d.ts +1 -0
- package/esm/actions/Action.js +19 -5
- 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 +8 -7
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +4 -4
- package/esm/actions/DialogAction.d.ts +16 -2
- package/esm/actions/DialogAction.js +23 -7
- 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 +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/CustomStyle.d.ts +13 -0
- package/esm/components/CustomStyle.js +18 -0
- package/esm/components/LazyComponent.d.ts +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.d.ts +3 -3
- package/esm/components/Overlay.js +1 -1
- package/esm/components/PopOver.d.ts +2 -2
- package/esm/components/PopOver.js +1 -1
- package/esm/env.d.ts +10 -2
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -5
- package/esm/factory.d.ts +5 -3
- package/esm/factory.js +3 -3
- package/esm/index.d.ts +11 -4
- package/esm/index.js +55 -33
- package/esm/locale.d.ts +2 -2
- package/esm/locale.js +10 -3
- package/esm/renderers/Form.d.ts +3 -2
- package/esm/renderers/Form.js +216 -180
- package/esm/renderers/Item.d.ts +55 -41
- package/esm/renderers/Item.js +30 -19
- package/esm/renderers/Options.js +11 -4
- 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 +2 -2
- package/esm/renderers/wrapControl.js +13 -16
- package/esm/store/app.d.ts +1 -0
- package/esm/store/app.js +1 -1
- package/esm/store/combo.d.ts +3 -0
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +2 -0
- package/esm/store/crud.js +31 -9
- package/esm/store/form.d.ts +1 -0
- package/esm/store/form.js +10 -4
- package/esm/store/formItem.js +2 -2
- package/esm/store/iRenderer.d.ts +1 -0
- package/esm/store/iRenderer.js +54 -13
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +1 -0
- package/esm/store/list.js +7 -3
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.d.ts +1 -0
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.d.ts +1 -0
- package/esm/store/pagination.js +2 -2
- package/esm/store/root.d.ts +4 -6
- package/esm/store/root.js +53 -24
- package/esm/store/service.d.ts +1 -0
- package/esm/store/service.js +1 -1
- package/esm/store/status.d.ts +12 -0
- package/esm/store/status.js +38 -0
- package/esm/store/table.d.ts +28 -23
- package/esm/store/table.js +26 -5
- package/esm/store/table2.d.ts +7 -6
- package/esm/store/table2.js +27 -23
- package/esm/theme.d.ts +1 -1
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +7 -1
- 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.d.ts +3 -5
- package/esm/utils/DataScope.js +88 -31
- package/esm/utils/RootClose.js +1 -1
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/api.js +14 -5
- package/esm/utils/attachmentAdpator.js +2 -2
- 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.d.ts +7 -0
- package/esm/utils/date.js +34 -2
- package/esm/utils/debug.js +4 -4
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.d.ts +3 -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.js +2 -2
- package/esm/utils/getVariable.js +1 -1
- package/esm/utils/grammar.js +3 -3
- package/esm/utils/handleAction.js +1 -1
- package/esm/utils/helper.d.ts +9 -2
- package/esm/utils/helper.js +52 -20
- 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/isPureVariable.js +3 -3
- 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/memoryParse.d.ts +17 -0
- package/esm/utils/memoryParse.js +26 -0
- package/esm/utils/normalizeLink.js +1 -1
- package/esm/utils/normalizeOptions.js +4 -2
- package/esm/utils/object.d.ts +2 -0
- package/esm/utils/object.js +27 -2
- package/esm/utils/offset.js +1 -1
- package/esm/utils/offsetParent.js +1 -1
- package/esm/utils/optionValueCompare.js +1 -1
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.js +1 -1
- package/esm/utils/renderer-event.js +35 -32
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.js +1 -1
- package/esm/utils/resolveCondition.d.ts +1 -0
- package/esm/utils/resolveCondition.js +19 -4
- package/esm/utils/resolveVariable.js +4 -3
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
- package/esm/utils/resolveVariableAndFilterForAsync.js +23 -5
- 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 +12 -4
- package/esm/utils/style-helper.js +96 -19
- package/esm/utils/style.js +2 -2
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.js +1 -1
- package/esm/utils/tpl-builtin.d.ts +2 -1
- package/esm/utils/tpl-builtin.js +19 -2
- package/esm/utils/tpl-lodash.js +3 -2
- package/esm/utils/tpl.d.ts +2 -0
- package/esm/utils/tpl.js +24 -2
- 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 +89 -4
- package/lib/Root.js +15 -4
- package/lib/RootRenderer.d.ts +3 -1
- package/lib/RootRenderer.js +8 -2
- package/lib/SchemaRenderer.d.ts +4 -2
- package/lib/SchemaRenderer.js +32 -23
- package/lib/Scoped.d.ts +8 -0
- package/lib/Scoped.js +20 -4
- package/lib/StatusScoped.d.ts +58 -0
- package/lib/StatusScoped.js +63 -0
- package/lib/WithRootStore.d.ts +2 -2
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +6 -2
- package/lib/actions/Action.d.ts +1 -0
- package/lib/actions/Action.js +19 -5
- 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 +8 -7
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +4 -4
- package/lib/actions/DialogAction.d.ts +16 -2
- package/lib/actions/DialogAction.js +23 -7
- 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 +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/CustomStyle.d.ts +13 -0
- package/lib/components/CustomStyle.js +22 -0
- package/lib/components/LazyComponent.d.ts +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.d.ts +3 -3
- package/lib/components/Overlay.js +1 -1
- package/lib/components/PopOver.d.ts +2 -2
- package/lib/components/PopOver.js +1 -1
- package/lib/env.d.ts +10 -2
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -5
- package/lib/factory.d.ts +5 -3
- package/lib/factory.js +3 -3
- package/lib/index.d.ts +11 -4
- package/lib/index.js +61 -23
- package/lib/locale.d.ts +2 -2
- package/lib/locale.js +10 -3
- package/lib/renderers/Form.d.ts +3 -2
- package/lib/renderers/Form.js +215 -179
- package/lib/renderers/Item.d.ts +55 -41
- package/lib/renderers/Item.js +30 -19
- package/lib/renderers/Options.js +11 -4
- 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 +2 -2
- package/lib/renderers/wrapControl.js +12 -15
- package/lib/store/app.d.ts +1 -0
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +3 -0
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +2 -0
- package/lib/store/crud.js +31 -9
- package/lib/store/form.d.ts +1 -0
- package/lib/store/form.js +10 -4
- package/lib/store/formItem.js +2 -2
- package/lib/store/iRenderer.d.ts +1 -0
- package/lib/store/iRenderer.js +53 -12
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +1 -0
- package/lib/store/list.js +7 -3
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.d.ts +1 -0
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.d.ts +1 -0
- package/lib/store/pagination.js +2 -2
- package/lib/store/root.d.ts +4 -6
- package/lib/store/root.js +52 -23
- package/lib/store/service.d.ts +1 -0
- package/lib/store/service.js +1 -1
- package/lib/store/status.d.ts +12 -0
- package/lib/store/status.js +42 -0
- package/lib/store/table.d.ts +28 -23
- package/lib/store/table.js +26 -5
- package/lib/store/table2.d.ts +7 -6
- package/lib/store/table2.js +27 -23
- package/lib/theme.d.ts +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +7 -1
- 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.d.ts +3 -5
- package/lib/utils/DataScope.js +86 -29
- package/lib/utils/RootClose.js +1 -1
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/api.js +13 -4
- package/lib/utils/attachmentAdpator.js +2 -2
- 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.d.ts +7 -0
- package/lib/utils/date.js +34 -1
- package/lib/utils/debug.js +4 -4
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.d.ts +3 -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.js +2 -2
- package/lib/utils/getVariable.js +1 -1
- package/lib/utils/grammar.js +3 -3
- package/lib/utils/handleAction.js +1 -1
- package/lib/utils/helper.d.ts +9 -2
- package/lib/utils/helper.js +53 -19
- 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/isPureVariable.js +3 -3
- 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/memoryParse.d.ts +17 -0
- package/lib/utils/memoryParse.js +30 -0
- package/lib/utils/normalizeLink.js +1 -1
- package/lib/utils/normalizeOptions.js +4 -2
- package/lib/utils/object.d.ts +2 -0
- package/lib/utils/object.js +28 -1
- package/lib/utils/offset.js +1 -1
- package/lib/utils/offsetParent.js +1 -1
- package/lib/utils/optionValueCompare.js +1 -1
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.js +1 -1
- package/lib/utils/renderer-event.js +35 -32
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.js +1 -1
- package/lib/utils/resolveCondition.d.ts +1 -0
- package/lib/utils/resolveCondition.js +19 -3
- package/lib/utils/resolveVariable.js +3 -2
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
- package/lib/utils/resolveVariableAndFilterForAsync.js +22 -3
- 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 +12 -4
- package/lib/utils/style-helper.js +101 -18
- package/lib/utils/style.js +2 -2
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.js +1 -1
- package/lib/utils/tpl-builtin.d.ts +2 -1
- package/lib/utils/tpl-builtin.js +19 -2
- package/lib/utils/tpl-lodash.js +3 -2
- package/lib/utils/tpl.d.ts +2 -0
- package/lib/utils/tpl.js +24 -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 +3 -3
package/esm/renderers/Item.d.ts
CHANGED
|
@@ -379,7 +379,7 @@ export declare class FormItemWrap extends React.Component<FormItemProps> {
|
|
|
379
379
|
handleAutoFill(type: string): void;
|
|
380
380
|
updateAutoFillData(context: any): void;
|
|
381
381
|
syncAutoFill: import("lodash").DebouncedFunc<(term: any, reload?: boolean) => void>;
|
|
382
|
-
buildSchema(): JSX.Element | {
|
|
382
|
+
buildSchema(): React.JSX.Element | {
|
|
383
383
|
type: any;
|
|
384
384
|
className: string;
|
|
385
385
|
title: any;
|
|
@@ -456,12 +456,12 @@ export declare class FormItemWrap extends React.Component<FormItemProps> {
|
|
|
456
456
|
static layoutRenderers: {
|
|
457
457
|
[propsName: string]: (props: FormItemProps, renderControl: () => JSX.Element | null) => JSX.Element;
|
|
458
458
|
};
|
|
459
|
-
render(): JSX.Element | null;
|
|
459
|
+
render(): React.JSX.Element | null;
|
|
460
460
|
}
|
|
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;
|
|
464
|
+
render(): React.JSX.Element;
|
|
465
465
|
context: unknown;
|
|
466
466
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<any, "rootStore">>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
467
467
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
@@ -484,7 +484,7 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
484
484
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<any, "rootStore">>, nextState: Readonly<{}>, nextContext: any): void;
|
|
485
485
|
};
|
|
486
486
|
new (props: Omit<any, "rootStore">, context: any): {
|
|
487
|
-
render(): JSX.Element;
|
|
487
|
+
render(): React.JSX.Element;
|
|
488
488
|
context: unknown;
|
|
489
489
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<any, "rootStore">>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
490
490
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
@@ -510,9 +510,6 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
510
510
|
contextType: React.Context<{
|
|
511
511
|
storeType: string;
|
|
512
512
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
513
|
-
/**
|
|
514
|
-
* 只读条件
|
|
515
|
-
*/
|
|
516
513
|
readonly fetcher: any;
|
|
517
514
|
readonly notify: any;
|
|
518
515
|
readonly isCancel: (value: any) => boolean;
|
|
@@ -532,7 +529,9 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
532
529
|
} & {
|
|
533
530
|
onChildStoreDispose(child: any): void;
|
|
534
531
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
535
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
532
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
533
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
534
|
+
*/
|
|
536
535
|
addChildId: (id: string) => void;
|
|
537
536
|
removeChildId: (id: string) => void;
|
|
538
537
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
@@ -550,12 +549,12 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
550
549
|
} & {
|
|
551
550
|
onChildStoreDispose(child: any): void;
|
|
552
551
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
553
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
552
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
553
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
554
|
+
*/
|
|
554
555
|
addChildId: (id: string) => void;
|
|
555
556
|
removeChildId: (id: string) => void;
|
|
556
|
-
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
557
|
-
* 配置当前表单项展示模式
|
|
558
|
-
*/
|
|
557
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
559
558
|
readonly stores: {
|
|
560
559
|
[propName: string]: {
|
|
561
560
|
id: string;
|
|
@@ -572,7 +571,9 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
572
571
|
} & {
|
|
573
572
|
onChildStoreDispose(child: any): void;
|
|
574
573
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
575
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
574
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
575
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
576
|
+
*/
|
|
576
577
|
addChildId: (id: string) => void;
|
|
577
578
|
removeChildId: (id: string) => void;
|
|
578
579
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
@@ -590,7 +591,9 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
590
591
|
} & {
|
|
591
592
|
onChildStoreDispose(child: any): void;
|
|
592
593
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
593
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
594
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
595
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
596
|
+
*/
|
|
594
597
|
addChildId: (id: string) => void;
|
|
595
598
|
removeChildId: (id: string) => void;
|
|
596
599
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
@@ -600,9 +603,6 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
600
603
|
[propName: string]: any;
|
|
601
604
|
storeType: string;
|
|
602
605
|
id: string;
|
|
603
|
-
/**
|
|
604
|
-
* 表单 control 是否为 inline 模式。
|
|
605
|
-
*/
|
|
606
606
|
path: string;
|
|
607
607
|
parentId?: string | undefined;
|
|
608
608
|
}): {
|
|
@@ -620,7 +620,9 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
620
620
|
} & {
|
|
621
621
|
onChildStoreDispose(child: any): void;
|
|
622
622
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
623
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
623
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
624
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
625
|
+
*/
|
|
624
626
|
addChildId: (id: string) => void;
|
|
625
627
|
removeChildId: (id: string) => void;
|
|
626
628
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
@@ -638,7 +640,9 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
638
640
|
} & {
|
|
639
641
|
onChildStoreDispose(child: any): void;
|
|
640
642
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
641
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
643
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
644
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
645
|
+
*/
|
|
642
646
|
addChildId: (id: string) => void;
|
|
643
647
|
removeChildId: (id: string) => void;
|
|
644
648
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
@@ -657,7 +661,9 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
657
661
|
} & {
|
|
658
662
|
onChildStoreDispose(child: any): void;
|
|
659
663
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
660
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
664
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
665
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
666
|
+
*/
|
|
661
667
|
addChildId: (id: string) => void;
|
|
662
668
|
removeChildId: (id: string) => void;
|
|
663
669
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
@@ -675,16 +681,15 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
675
681
|
} & {
|
|
676
682
|
onChildStoreDispose(child: any): void;
|
|
677
683
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
678
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
684
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
685
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
686
|
+
*/
|
|
679
687
|
addChildId: (id: string) => void;
|
|
680
688
|
removeChildId: (id: string) => void;
|
|
681
689
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>): void;
|
|
682
690
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
683
691
|
storeType: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
684
692
|
}, {
|
|
685
|
-
/**
|
|
686
|
-
* 只读条件
|
|
687
|
-
*/
|
|
688
693
|
readonly fetcher: any;
|
|
689
694
|
readonly notify: any;
|
|
690
695
|
readonly isCancel: (value: any) => boolean;
|
|
@@ -704,7 +709,9 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
704
709
|
} & {
|
|
705
710
|
onChildStoreDispose(child: any): void;
|
|
706
711
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
707
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
712
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
713
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
714
|
+
*/
|
|
708
715
|
addChildId: (id: string) => void;
|
|
709
716
|
removeChildId: (id: string) => void;
|
|
710
717
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
@@ -722,12 +729,12 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
722
729
|
} & {
|
|
723
730
|
onChildStoreDispose(child: any): void;
|
|
724
731
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
725
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
732
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
733
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
734
|
+
*/
|
|
726
735
|
addChildId: (id: string) => void;
|
|
727
736
|
removeChildId: (id: string) => void;
|
|
728
|
-
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
729
|
-
* 配置当前表单项展示模式
|
|
730
|
-
*/
|
|
737
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
731
738
|
readonly stores: {
|
|
732
739
|
[propName: string]: {
|
|
733
740
|
id: string;
|
|
@@ -744,7 +751,9 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
744
751
|
} & {
|
|
745
752
|
onChildStoreDispose(child: any): void;
|
|
746
753
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
747
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
754
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
755
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
756
|
+
*/
|
|
748
757
|
addChildId: (id: string) => void;
|
|
749
758
|
removeChildId: (id: string) => void;
|
|
750
759
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
@@ -762,7 +771,9 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
762
771
|
} & {
|
|
763
772
|
onChildStoreDispose(child: any): void;
|
|
764
773
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
765
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
774
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
775
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
776
|
+
*/
|
|
766
777
|
addChildId: (id: string) => void;
|
|
767
778
|
removeChildId: (id: string) => void;
|
|
768
779
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
@@ -772,9 +783,6 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
772
783
|
[propName: string]: any;
|
|
773
784
|
storeType: string;
|
|
774
785
|
id: string;
|
|
775
|
-
/**
|
|
776
|
-
* 表单 control 是否为 inline 模式。
|
|
777
|
-
*/
|
|
778
786
|
path: string;
|
|
779
787
|
parentId?: string | undefined;
|
|
780
788
|
}): {
|
|
@@ -792,7 +800,9 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
792
800
|
} & {
|
|
793
801
|
onChildStoreDispose(child: any): void;
|
|
794
802
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
795
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
803
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
804
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
805
|
+
*/
|
|
796
806
|
addChildId: (id: string) => void;
|
|
797
807
|
removeChildId: (id: string) => void;
|
|
798
808
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
@@ -810,7 +820,9 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
810
820
|
} & {
|
|
811
821
|
onChildStoreDispose(child: any): void;
|
|
812
822
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
813
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
823
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
824
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
825
|
+
*/
|
|
814
826
|
addChildId: (id: string) => void;
|
|
815
827
|
removeChildId: (id: string) => void;
|
|
816
828
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
@@ -829,7 +841,9 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
829
841
|
} & {
|
|
830
842
|
onChildStoreDispose(child: any): void;
|
|
831
843
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
832
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
844
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
845
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
846
|
+
*/
|
|
833
847
|
addChildId: (id: string) => void;
|
|
834
848
|
removeChildId: (id: string) => void;
|
|
835
849
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
@@ -847,16 +861,16 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
847
861
|
} & {
|
|
848
862
|
onChildStoreDispose(child: any): void;
|
|
849
863
|
syncProps(props: any, prevProps: any, list?: string[]): void;
|
|
850
|
-
dispose: (callback?: (() => void) | undefined) => void;
|
|
864
|
+
dispose: (callback?: (() => void) | undefined) => void; /**
|
|
865
|
+
* 当配置为水平布局的时候,用来配置具体的左右分配。
|
|
866
|
+
*/
|
|
851
867
|
addChildId: (id: string) => void;
|
|
852
868
|
removeChildId: (id: string) => void;
|
|
853
869
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>): void;
|
|
854
870
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>>;
|
|
855
871
|
ComposedComponent: React.ComponentType<any>;
|
|
856
872
|
} & hoistNonReactStatic.NonReactStatics<any, {}> & {
|
|
857
|
-
ComposedComponent: any;
|
|
858
|
-
* 配置 label className
|
|
859
|
-
*/
|
|
873
|
+
ComposedComponent: any;
|
|
860
874
|
} & {
|
|
861
875
|
ComposedComponent: any;
|
|
862
876
|
};
|
package/esm/renderers/Item.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -42,13 +42,13 @@ import 'react-overlays/useRootClose';
|
|
|
42
42
|
import '../utils/SimpleMap.js';
|
|
43
43
|
import 'lodash/mapValues';
|
|
44
44
|
import 'lodash/camelCase';
|
|
45
|
-
import { insertCustomStyle } from '../utils/style-helper.js';
|
|
46
45
|
import 'uncontrollable';
|
|
47
46
|
import '../utils/validations.js';
|
|
48
47
|
import '../utils/resolveCondition.js';
|
|
49
48
|
import '../utils/Animation.js';
|
|
50
49
|
import Overlay from '../components/Overlay.js';
|
|
51
50
|
import PopOver from '../components/PopOver.js';
|
|
51
|
+
import CustomStyle from '../components/CustomStyle.js';
|
|
52
52
|
|
|
53
53
|
var getItemLabelClassName = function (props) {
|
|
54
54
|
var staticLabelClassName = props.staticLabelClassName, labelClassName = props.labelClassName;
|
|
@@ -334,7 +334,8 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
334
334
|
var controlSize = size || defaultSize;
|
|
335
335
|
return renderControl(__assign(__assign({}, rest), { onOpenDialog: this.handleOpenDialog, type: type, classnames: cx, formItem: model, className: cx("Form-control", (_a = {
|
|
336
336
|
'is-inline': !!rest.inline && !mobileUI,
|
|
337
|
-
'is-error': model && !model.valid
|
|
337
|
+
'is-error': model && !model.valid,
|
|
338
|
+
'is-full': size === 'full'
|
|
338
339
|
},
|
|
339
340
|
_a["Form-control--withSize Form-control--size".concat(ucFirst(controlSize))] = sizeMutable !== false &&
|
|
340
341
|
typeof controlSize === 'string' &&
|
|
@@ -345,20 +346,8 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
345
346
|
return null;
|
|
346
347
|
};
|
|
347
348
|
FormItemWrap.prototype.render = function () {
|
|
348
|
-
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, env = _a.env;
|
|
349
350
|
var mode = this.props.mode || formMode;
|
|
350
|
-
insertCustomStyle(css, [
|
|
351
|
-
{
|
|
352
|
-
key: 'labelClassName',
|
|
353
|
-
value: labelClassName
|
|
354
|
-
}
|
|
355
|
-
], id + '-label');
|
|
356
|
-
insertCustomStyle(css, [
|
|
357
|
-
{
|
|
358
|
-
key: 'descriptionClassName',
|
|
359
|
-
value: descriptionClassName
|
|
360
|
-
}
|
|
361
|
-
], id + '-description');
|
|
362
351
|
if (wrap === false || inputOnly) {
|
|
363
352
|
return this.renderControl();
|
|
364
353
|
}
|
|
@@ -374,7 +363,27 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
374
363
|
data: model.dialogData,
|
|
375
364
|
formStore: undefined
|
|
376
365
|
})
|
|
377
|
-
: null
|
|
366
|
+
: null,
|
|
367
|
+
React.createElement(CustomStyle, { config: {
|
|
368
|
+
themeCss: themeCss || css,
|
|
369
|
+
classNames: [
|
|
370
|
+
{
|
|
371
|
+
key: 'labelClassName',
|
|
372
|
+
value: labelClassName
|
|
373
|
+
}
|
|
374
|
+
],
|
|
375
|
+
id: id + '-label'
|
|
376
|
+
}, env: env }),
|
|
377
|
+
React.createElement(CustomStyle, { config: {
|
|
378
|
+
themeCss: themeCss || css,
|
|
379
|
+
classNames: [
|
|
380
|
+
{
|
|
381
|
+
key: 'descriptionClassName',
|
|
382
|
+
value: descriptionClassName
|
|
383
|
+
}
|
|
384
|
+
],
|
|
385
|
+
id: id + '-description'
|
|
386
|
+
}, env: env })));
|
|
378
387
|
};
|
|
379
388
|
/**
|
|
380
389
|
* 布局扩充点,可以自己扩充表单项的布局方式
|
|
@@ -767,7 +776,8 @@ var detectProps = [
|
|
|
767
776
|
'embed',
|
|
768
777
|
'displayMode',
|
|
769
778
|
'revealPassword',
|
|
770
|
-
'loading'
|
|
779
|
+
'loading',
|
|
780
|
+
'themeCss'
|
|
771
781
|
];
|
|
772
782
|
function asFormItem(config) {
|
|
773
783
|
return function (Control) {
|
|
@@ -838,7 +848,8 @@ function asFormItem(config) {
|
|
|
838
848
|
return (React.createElement(React.Fragment, null,
|
|
839
849
|
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 = {
|
|
840
850
|
'is-inline': !!rest.inline && !mobileUI,
|
|
841
|
-
'is-error': model && !model.valid
|
|
851
|
+
'is-error': model && !model.valid,
|
|
852
|
+
'is-full': size === 'full'
|
|
842
853
|
},
|
|
843
854
|
_a["Form-control--withSize Form-control--size".concat(ucFirst(controlSize))] = config.sizeMutable !== false &&
|
|
844
855
|
typeof controlSize === 'string' &&
|
package/esm/renderers/Options.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -88,6 +88,11 @@ function registerOptionsControl(config) {
|
|
|
88
88
|
return _this.mounted &&
|
|
89
89
|
_this.syncAutoFill(formItem.getSelectedOptions(formItem.tmpValue));
|
|
90
90
|
}));
|
|
91
|
+
if (options &&
|
|
92
|
+
formItem.tmpValue &&
|
|
93
|
+
formItem.getSelectedOptions(formItem.tmpValue).length) {
|
|
94
|
+
_this.syncAutoFill(formItem.getSelectedOptions(formItem.tmpValue));
|
|
95
|
+
}
|
|
91
96
|
// 默认全选。这里会和默认值\回填值逻辑冲突,所以如果有配置source则不执行默认全选
|
|
92
97
|
if (multiple &&
|
|
93
98
|
defaultCheckAll &&
|
|
@@ -183,8 +188,8 @@ function registerOptionsControl(config) {
|
|
|
183
188
|
switch (_b.label) {
|
|
184
189
|
case 0:
|
|
185
190
|
_a = this.props, dispatchEvent = _a.dispatchEvent, options = _a.options;
|
|
186
|
-
return [4 /*yield*/, dispatchEvent(eventName, resolveEventData(this.props, { value: eventData, options: options, items: options }
|
|
187
|
-
|
|
191
|
+
return [4 /*yield*/, dispatchEvent(eventName, resolveEventData(this.props, { value: eventData, options: options, items: options } // 为了保持名字统一
|
|
192
|
+
))];
|
|
188
193
|
case 1:
|
|
189
194
|
rendererEvent = _b.sent();
|
|
190
195
|
// 返回阻塞标识
|
|
@@ -411,7 +416,9 @@ function registerOptionsControl(config) {
|
|
|
411
416
|
else if (!formItem || !isEffectiveApi(source, data)) {
|
|
412
417
|
return;
|
|
413
418
|
}
|
|
414
|
-
return formItem
|
|
419
|
+
return isAlive(formItem)
|
|
420
|
+
? formItem.loadOptions(source, data, undefined, false, isInit ? setPrinstineValue : onChange, setError)
|
|
421
|
+
: undefined;
|
|
415
422
|
};
|
|
416
423
|
FormOptionsItem.prototype.deferLoad = function (option) {
|
|
417
424
|
return __awaiter(this, void 0, void 0, function () {
|
package/esm/renderers/builtin.js
CHANGED
|
@@ -50,7 +50,7 @@ export interface ControlProps {
|
|
|
50
50
|
}
|
|
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
|
-
render(): JSX.Element;
|
|
53
|
+
render(): React.JSX.Element;
|
|
54
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;
|
|
@@ -73,7 +73,7 @@ export declare function wrapControl<T extends React.ComponentType<React.Componen
|
|
|
73
73
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<any, "rootStore">>, nextState: Readonly<{}>, nextContext: any): void;
|
|
74
74
|
};
|
|
75
75
|
new (props: Omit<any, "rootStore">, context: any): {
|
|
76
|
-
render(): JSX.Element;
|
|
76
|
+
render(): React.JSX.Element;
|
|
77
77
|
context: unknown;
|
|
78
78
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<any, "rootStore">>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
79
79
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ 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,
|
|
12
|
+
import { isExpression, FormulaExec, replaceExpression, isNeedFormula, isNowFormula } 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';
|
|
@@ -82,14 +82,14 @@ function wrapControl(ComposedComponent) {
|
|
|
82
82
|
: (_b = store === null || store === void 0 ? void 0 : store.getValueByName(model.name)) !== null && _b !== void 0 ? _b : replaceExpression(value); // 优先使用公式表达式
|
|
83
83
|
// 同步 value
|
|
84
84
|
model.changeTmpValue(curTmpValue);
|
|
85
|
-
if (onChange &&
|
|
86
|
-
value !== undefined &&
|
|
87
|
-
curTmpValue !== undefined) {
|
|
88
|
-
// 组件默认值支持表达式需要: 避免初始化时上下文中丢失组件默认值
|
|
89
|
-
onChange(model.tmpValue, model.name, false, true);
|
|
90
|
-
}
|
|
91
85
|
}
|
|
92
86
|
if (onChange &&
|
|
87
|
+
value !== undefined &&
|
|
88
|
+
model.tmpValue !== undefined) {
|
|
89
|
+
// 组件默认值支持表达式需要: 避免初始化时上下文中丢失组件默认值
|
|
90
|
+
onChange(model.tmpValue, model.name, false, true);
|
|
91
|
+
}
|
|
92
|
+
else if (onChange &&
|
|
93
93
|
typeof propValue === 'undefined' &&
|
|
94
94
|
typeof (store === null || store === void 0 ? void 0 : store.getValueByName(model.name, false)) === 'undefined' &&
|
|
95
95
|
// todo 后续再优化这个判断,
|
|
@@ -124,6 +124,7 @@ function wrapControl(ComposedComponent) {
|
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
class_1.prototype.componentDidUpdate = function (prevProps) {
|
|
127
|
+
var _a, _b;
|
|
127
128
|
var props = this.props;
|
|
128
129
|
props.formStore;
|
|
129
130
|
var model = this.model;
|
|
@@ -186,29 +187,25 @@ function wrapControl(ComposedComponent) {
|
|
|
186
187
|
else if (model &&
|
|
187
188
|
typeof props.defaultValue !== 'undefined' &&
|
|
188
189
|
isExpression(props.defaultValue)) {
|
|
189
|
-
var nowFormulaChecked =
|
|
190
|
+
var nowFormulaChecked = false;
|
|
190
191
|
// 渲染器中的 defaultValue 优先(备注: SchemaRenderer中会将 value 改成 defaultValue)
|
|
191
192
|
if (!isEqual(props.defaultValue, prevProps.defaultValue) ||
|
|
192
193
|
(props.data !== prevProps.data &&
|
|
193
194
|
(isNeedFormula(props.defaultValue, props.data, prevProps.data) ||
|
|
194
|
-
nowFormulaChecked))) {
|
|
195
|
+
(nowFormulaChecked = isNowFormula(props.defaultValue))))) {
|
|
195
196
|
var curResult = FormulaExec['formula'](props.defaultValue, props.data);
|
|
196
197
|
var prevResult = FormulaExec['formula'](prevProps.defaultValue, prevProps.data);
|
|
197
198
|
if (!isEqual(curResult, prevResult) &&
|
|
198
199
|
!isEqual(curResult, model.tmpValue)) {
|
|
199
200
|
// 识别上下文变动、自身数值变动、公式运算结果变动
|
|
200
201
|
model.changeTmpValue(curResult);
|
|
201
|
-
|
|
202
|
-
props.onChange(curResult, model.name, false);
|
|
203
|
-
}
|
|
202
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, curResult, model.name, false);
|
|
204
203
|
}
|
|
205
204
|
else if (nowFormulaChecked) {
|
|
206
205
|
var nowData = props.data[model.name];
|
|
207
206
|
// now 表达式,计算后的值永远相同
|
|
208
207
|
model.changeTmpValue(nowData);
|
|
209
|
-
|
|
210
|
-
props.onChange(nowData, model.name, false);
|
|
211
|
-
}
|
|
208
|
+
(_b = props.onChange) === null || _b === void 0 ? void 0 : _b.call(props, nowData, model.name, false);
|
|
212
209
|
}
|
|
213
210
|
}
|
|
214
211
|
}
|
package/esm/store/app.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export declare const AppStore: import("mobx-state-tree").IModelType<{
|
|
|
49
49
|
getValueByName(name: string, canAccessSuper?: boolean): any;
|
|
50
50
|
getPristineValueByName(name: string): any;
|
|
51
51
|
} & {
|
|
52
|
+
setTopStore(value: any): void;
|
|
52
53
|
initData(data?: object, skipSetPristine?: boolean): void;
|
|
53
54
|
reset(): void;
|
|
54
55
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
package/esm/store/app.js
CHANGED
package/esm/store/combo.d.ts
CHANGED
|
@@ -1770,6 +1770,7 @@ export declare const ComboStore: import("mobx-state-tree").IModelType<{
|
|
|
1770
1770
|
getValueByName(name: string, canAccessSuper?: boolean): any;
|
|
1771
1771
|
getPristineValueByName(name: string): any;
|
|
1772
1772
|
} & {
|
|
1773
|
+
setTopStore(value: any): void;
|
|
1773
1774
|
initData(data?: object, skipSetPristine?: boolean): void;
|
|
1774
1775
|
reset(): void;
|
|
1775
1776
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
@@ -1831,6 +1832,7 @@ export declare const ComboStore: import("mobx-state-tree").IModelType<{
|
|
|
1831
1832
|
getValueByName(name: string, canAccessSuper?: boolean): any;
|
|
1832
1833
|
getPristineValueByName(name: string): any;
|
|
1833
1834
|
} & {
|
|
1835
|
+
setTopStore(value: any): void;
|
|
1834
1836
|
initData(data?: object, skipSetPristine?: boolean): void;
|
|
1835
1837
|
reset(): void;
|
|
1836
1838
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
@@ -7090,6 +7092,7 @@ export declare const ComboStore: import("mobx-state-tree").IModelType<{
|
|
|
7090
7092
|
getValueByName(name: string, canAccessSuper?: boolean): any;
|
|
7091
7093
|
getPristineValueByName(name: string): any;
|
|
7092
7094
|
} & {
|
|
7095
|
+
setTopStore(value: any): void;
|
|
7093
7096
|
initData(data?: object, skipSetPristine?: boolean): void;
|
|
7094
7097
|
reset(): void;
|
|
7095
7098
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
package/esm/store/combo.js
CHANGED
package/esm/store/crud.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ export declare const CRUDStore: import("mobx-state-tree").IModelType<{
|
|
|
60
60
|
getValueByName(name: string, canAccessSuper?: boolean): any;
|
|
61
61
|
getPristineValueByName(name: string): any;
|
|
62
62
|
} & {
|
|
63
|
+
setTopStore(value: any): void;
|
|
63
64
|
initData(data?: object, skipSetPristine?: boolean): void;
|
|
64
65
|
reset(): void;
|
|
65
66
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
@@ -127,5 +128,6 @@ export declare const CRUDStore: import("mobx-state-tree").IModelType<{
|
|
|
127
128
|
data?: any;
|
|
128
129
|
}) => Promise<void>;
|
|
129
130
|
updateColumns: (columns: Array<any>) => void;
|
|
131
|
+
updateTotal: (total: number) => void;
|
|
130
132
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
131
133
|
export type ICRUDStore = Instance<typeof CRUDStore>;
|