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/lib/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/lib/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
|
|
|
@@ -46,13 +46,13 @@ require('react-overlays/useRootClose');
|
|
|
46
46
|
require('../utils/SimpleMap.js');
|
|
47
47
|
require('lodash/mapValues');
|
|
48
48
|
require('lodash/camelCase');
|
|
49
|
-
var styleHelper = require('../utils/style-helper.js');
|
|
50
49
|
require('uncontrollable');
|
|
51
50
|
require('../utils/validations.js');
|
|
52
51
|
require('../utils/resolveCondition.js');
|
|
53
52
|
require('../utils/Animation.js');
|
|
54
53
|
var Overlay = require('../components/Overlay.js');
|
|
55
54
|
var PopOver = require('../components/PopOver.js');
|
|
55
|
+
var CustomStyle = require('../components/CustomStyle.js');
|
|
56
56
|
|
|
57
57
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
58
58
|
|
|
@@ -344,7 +344,8 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
344
344
|
var controlSize = size || defaultSize;
|
|
345
345
|
return renderControl(tslib.__assign(tslib.__assign({}, rest), { onOpenDialog: this.handleOpenDialog, type: type, classnames: cx, formItem: model, className: cx("Form-control", (_a = {
|
|
346
346
|
'is-inline': !!rest.inline && !mobileUI,
|
|
347
|
-
'is-error': model && !model.valid
|
|
347
|
+
'is-error': model && !model.valid,
|
|
348
|
+
'is-full': size === 'full'
|
|
348
349
|
},
|
|
349
350
|
_a["Form-control--withSize Form-control--size".concat(helper.ucFirst(controlSize))] = sizeMutable !== false &&
|
|
350
351
|
typeof controlSize === 'string' &&
|
|
@@ -355,20 +356,8 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
355
356
|
return null;
|
|
356
357
|
};
|
|
357
358
|
FormItemWrap.prototype.render = function () {
|
|
358
|
-
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;
|
|
359
|
+
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;
|
|
359
360
|
var mode = this.props.mode || formMode;
|
|
360
|
-
styleHelper.insertCustomStyle(css, [
|
|
361
|
-
{
|
|
362
|
-
key: 'labelClassName',
|
|
363
|
-
value: labelClassName
|
|
364
|
-
}
|
|
365
|
-
], id + '-label');
|
|
366
|
-
styleHelper.insertCustomStyle(css, [
|
|
367
|
-
{
|
|
368
|
-
key: 'descriptionClassName',
|
|
369
|
-
value: descriptionClassName
|
|
370
|
-
}
|
|
371
|
-
], id + '-description');
|
|
372
361
|
if (wrap === false || inputOnly) {
|
|
373
362
|
return this.renderControl();
|
|
374
363
|
}
|
|
@@ -384,7 +373,27 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
384
373
|
data: model.dialogData,
|
|
385
374
|
formStore: undefined
|
|
386
375
|
})
|
|
387
|
-
: null
|
|
376
|
+
: null,
|
|
377
|
+
React__default["default"].createElement(CustomStyle["default"], { config: {
|
|
378
|
+
themeCss: themeCss || css,
|
|
379
|
+
classNames: [
|
|
380
|
+
{
|
|
381
|
+
key: 'labelClassName',
|
|
382
|
+
value: labelClassName
|
|
383
|
+
}
|
|
384
|
+
],
|
|
385
|
+
id: id + '-label'
|
|
386
|
+
}, env: env }),
|
|
387
|
+
React__default["default"].createElement(CustomStyle["default"], { config: {
|
|
388
|
+
themeCss: themeCss || css,
|
|
389
|
+
classNames: [
|
|
390
|
+
{
|
|
391
|
+
key: 'descriptionClassName',
|
|
392
|
+
value: descriptionClassName
|
|
393
|
+
}
|
|
394
|
+
],
|
|
395
|
+
id: id + '-description'
|
|
396
|
+
}, env: env })));
|
|
388
397
|
};
|
|
389
398
|
/**
|
|
390
399
|
* 布局扩充点,可以自己扩充表单项的布局方式
|
|
@@ -777,7 +786,8 @@ var detectProps = [
|
|
|
777
786
|
'embed',
|
|
778
787
|
'displayMode',
|
|
779
788
|
'revealPassword',
|
|
780
|
-
'loading'
|
|
789
|
+
'loading',
|
|
790
|
+
'themeCss'
|
|
781
791
|
];
|
|
782
792
|
function asFormItem(config) {
|
|
783
793
|
return function (Control) {
|
|
@@ -848,7 +858,8 @@ function asFormItem(config) {
|
|
|
848
858
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
849
859
|
React__default["default"].createElement(Control, tslib.__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 = {
|
|
850
860
|
'is-inline': !!rest.inline && !mobileUI,
|
|
851
|
-
'is-error': model && !model.valid
|
|
861
|
+
'is-error': model && !model.valid,
|
|
862
|
+
'is-full': size === 'full'
|
|
852
863
|
},
|
|
853
864
|
_a["Form-control--withSize Form-control--size".concat(helper.ucFirst(controlSize))] = config.sizeMutable !== false &&
|
|
854
865
|
typeof controlSize === 'string' &&
|
package/lib/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
|
|
|
@@ -98,6 +98,11 @@ function registerOptionsControl(config) {
|
|
|
98
98
|
return _this.mounted &&
|
|
99
99
|
_this.syncAutoFill(formItem.getSelectedOptions(formItem.tmpValue));
|
|
100
100
|
}));
|
|
101
|
+
if (options &&
|
|
102
|
+
formItem.tmpValue &&
|
|
103
|
+
formItem.getSelectedOptions(formItem.tmpValue).length) {
|
|
104
|
+
_this.syncAutoFill(formItem.getSelectedOptions(formItem.tmpValue));
|
|
105
|
+
}
|
|
101
106
|
// 默认全选。这里会和默认值\回填值逻辑冲突,所以如果有配置source则不执行默认全选
|
|
102
107
|
if (multiple &&
|
|
103
108
|
defaultCheckAll &&
|
|
@@ -193,8 +198,8 @@ function registerOptionsControl(config) {
|
|
|
193
198
|
switch (_b.label) {
|
|
194
199
|
case 0:
|
|
195
200
|
_a = this.props, dispatchEvent = _a.dispatchEvent, options = _a.options;
|
|
196
|
-
return [4 /*yield*/, dispatchEvent(eventName, rendererEvent.resolveEventData(this.props, { value: eventData, options: options, items: options }
|
|
197
|
-
|
|
201
|
+
return [4 /*yield*/, dispatchEvent(eventName, rendererEvent.resolveEventData(this.props, { value: eventData, options: options, items: options } // 为了保持名字统一
|
|
202
|
+
))];
|
|
198
203
|
case 1:
|
|
199
204
|
rendererEvent$1 = _b.sent();
|
|
200
205
|
// 返回阻塞标识
|
|
@@ -421,7 +426,9 @@ function registerOptionsControl(config) {
|
|
|
421
426
|
else if (!formItem || !api.isEffectiveApi(source, data)) {
|
|
422
427
|
return;
|
|
423
428
|
}
|
|
424
|
-
return
|
|
429
|
+
return mobxStateTree.isAlive(formItem)
|
|
430
|
+
? formItem.loadOptions(source, data, undefined, false, isInit ? setPrinstineValue : onChange, setError)
|
|
431
|
+
: undefined;
|
|
425
432
|
};
|
|
426
433
|
FormOptionsItem.prototype.deferLoad = function (option) {
|
|
427
434
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
package/lib/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
|
|
|
@@ -94,14 +94,14 @@ function wrapControl(ComposedComponent) {
|
|
|
94
94
|
: (_b = store === null || store === void 0 ? void 0 : store.getValueByName(model.name)) !== null && _b !== void 0 ? _b : formula.replaceExpression(value); // 优先使用公式表达式
|
|
95
95
|
// 同步 value
|
|
96
96
|
model.changeTmpValue(curTmpValue);
|
|
97
|
-
if (onChange &&
|
|
98
|
-
value !== undefined &&
|
|
99
|
-
curTmpValue !== undefined) {
|
|
100
|
-
// 组件默认值支持表达式需要: 避免初始化时上下文中丢失组件默认值
|
|
101
|
-
onChange(model.tmpValue, model.name, false, true);
|
|
102
|
-
}
|
|
103
97
|
}
|
|
104
98
|
if (onChange &&
|
|
99
|
+
value !== undefined &&
|
|
100
|
+
model.tmpValue !== undefined) {
|
|
101
|
+
// 组件默认值支持表达式需要: 避免初始化时上下文中丢失组件默认值
|
|
102
|
+
onChange(model.tmpValue, model.name, false, true);
|
|
103
|
+
}
|
|
104
|
+
else if (onChange &&
|
|
105
105
|
typeof propValue === 'undefined' &&
|
|
106
106
|
typeof (store === null || store === void 0 ? void 0 : store.getValueByName(model.name, false)) === 'undefined' &&
|
|
107
107
|
// todo 后续再优化这个判断,
|
|
@@ -136,6 +136,7 @@ function wrapControl(ComposedComponent) {
|
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
138
|
class_1.prototype.componentDidUpdate = function (prevProps) {
|
|
139
|
+
var _a, _b;
|
|
139
140
|
var props = this.props;
|
|
140
141
|
props.formStore;
|
|
141
142
|
var model = this.model;
|
|
@@ -198,29 +199,25 @@ function wrapControl(ComposedComponent) {
|
|
|
198
199
|
else if (model &&
|
|
199
200
|
typeof props.defaultValue !== 'undefined' &&
|
|
200
201
|
formula.isExpression(props.defaultValue)) {
|
|
201
|
-
var nowFormulaChecked =
|
|
202
|
+
var nowFormulaChecked = false;
|
|
202
203
|
// 渲染器中的 defaultValue 优先(备注: SchemaRenderer中会将 value 改成 defaultValue)
|
|
203
204
|
if (!isEqual__default["default"](props.defaultValue, prevProps.defaultValue) ||
|
|
204
205
|
(props.data !== prevProps.data &&
|
|
205
206
|
(formula.isNeedFormula(props.defaultValue, props.data, prevProps.data) ||
|
|
206
|
-
nowFormulaChecked))) {
|
|
207
|
+
(nowFormulaChecked = formula.isNowFormula(props.defaultValue))))) {
|
|
207
208
|
var curResult = formula.FormulaExec['formula'](props.defaultValue, props.data);
|
|
208
209
|
var prevResult = formula.FormulaExec['formula'](prevProps.defaultValue, prevProps.data);
|
|
209
210
|
if (!isEqual__default["default"](curResult, prevResult) &&
|
|
210
211
|
!isEqual__default["default"](curResult, model.tmpValue)) {
|
|
211
212
|
// 识别上下文变动、自身数值变动、公式运算结果变动
|
|
212
213
|
model.changeTmpValue(curResult);
|
|
213
|
-
|
|
214
|
-
props.onChange(curResult, model.name, false);
|
|
215
|
-
}
|
|
214
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, curResult, model.name, false);
|
|
216
215
|
}
|
|
217
216
|
else if (nowFormulaChecked) {
|
|
218
217
|
var nowData = props.data[model.name];
|
|
219
218
|
// now 表达式,计算后的值永远相同
|
|
220
219
|
model.changeTmpValue(nowData);
|
|
221
|
-
|
|
222
|
-
props.onChange(nowData, model.name, false);
|
|
223
|
-
}
|
|
220
|
+
(_b = props.onChange) === null || _b === void 0 ? void 0 : _b.call(props, nowData, model.name, false);
|
|
224
221
|
}
|
|
225
222
|
}
|
|
226
223
|
}
|
package/lib/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/lib/store/app.js
CHANGED
package/lib/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/lib/store/combo.js
CHANGED
package/lib/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>;
|