@silver-formily/element-plus 0.0.1-beta.0 → 1.0.1
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/__builtins__/configs/index.d.ts +1 -0
- package/esm/__builtins__/configs/index.mjs +5 -0
- package/esm/__builtins__/configs/index.mjs.map +1 -0
- package/esm/__builtins__/index.d.ts +2 -0
- package/esm/__builtins__/index.mjs +27 -0
- package/esm/__builtins__/index.mjs.map +1 -0
- package/esm/__builtins__/shared/hooks.d.ts +7 -0
- package/esm/__builtins__/shared/hooks.mjs +59 -0
- package/esm/__builtins__/shared/hooks.mjs.map +1 -0
- package/esm/__builtins__/shared/index.d.ts +7 -0
- package/esm/__builtins__/shared/index.mjs +25 -0
- package/esm/__builtins__/shared/index.mjs.map +1 -0
- package/esm/__builtins__/shared/load-config-provider.d.ts +2 -0
- package/esm/__builtins__/shared/load-config-provider.mjs +12 -0
- package/esm/__builtins__/shared/load-config-provider.mjs.map +1 -0
- package/esm/__builtins__/shared/loading.d.ts +12 -0
- package/esm/__builtins__/shared/loading.mjs +49 -0
- package/esm/__builtins__/shared/loading.mjs.map +1 -0
- package/esm/__builtins__/shared/simple-version-compare.d.ts +2 -0
- package/esm/__builtins__/shared/simple-version-compare.mjs +18 -0
- package/esm/__builtins__/shared/simple-version-compare.mjs.map +1 -0
- package/esm/__builtins__/shared/transform-component.d.ts +8 -0
- package/esm/__builtins__/shared/transform-component.mjs +49 -0
- package/esm/__builtins__/shared/transform-component.mjs.map +1 -0
- package/esm/__builtins__/shared/types.d.ts +2 -0
- package/esm/__builtins__/shared/types.mjs +2 -0
- package/esm/__builtins__/shared/types.mjs.map +1 -0
- package/esm/__builtins__/shared/utils.d.ts +8 -0
- package/esm/__builtins__/shared/utils.mjs +34 -0
- package/esm/__builtins__/shared/utils.mjs.map +1 -0
- package/esm/array-base/array-base-addition.d.ts +5 -0
- package/esm/array-base/array-base-index.d.ts +19 -0
- package/esm/array-base/array-base-inner.d.ts +18 -0
- package/esm/array-base/array-base-item.d.ts +18 -0
- package/esm/array-base/array-base-move-down.d.ts +18 -0
- package/esm/array-base/array-base-move-up.d.ts +18 -0
- package/esm/array-base/array-base-remove.d.ts +18 -0
- package/esm/array-base/array-base-sort-handle.d.ts +2 -0
- package/esm/array-base/index.d.ts +114 -0
- package/esm/array-base/index.mjs +209 -0
- package/esm/array-base/index.mjs.map +1 -0
- package/esm/array-base/symbols.d.ts +4 -0
- package/esm/array-base/symbols.mjs +6 -0
- package/esm/array-base/symbols.mjs.map +1 -0
- package/esm/array-base/types.d.ts +28 -0
- package/esm/array-base/types.mjs +2 -0
- package/esm/array-base/types.mjs.map +1 -0
- package/esm/array-base/utils.d.ts +18 -0
- package/esm/array-base/utils.mjs +79 -0
- package/esm/array-base/utils.mjs.map +1 -0
- package/esm/array-cards/array-cards.d.ts +13 -0
- package/esm/array-cards/index.d.ts +122 -0
- package/esm/array-cards/index.mjs +119 -0
- package/esm/array-cards/index.mjs.map +1 -0
- package/esm/array-collapse/array-collapse-item.d.ts +18 -0
- package/esm/array-collapse/array-collapse.d.ts +16 -0
- package/esm/array-collapse/index.d.ts +134 -0
- package/esm/array-collapse/index.mjs +177 -0
- package/esm/array-collapse/index.mjs.map +1 -0
- package/esm/array-collapse/utils.d.ts +1 -0
- package/esm/array-collapse/utils.mjs +12 -0
- package/esm/array-collapse/utils.mjs.map +1 -0
- package/esm/array-items/array-items-item.d.ts +30 -0
- package/esm/array-items/array-items.d.ts +2 -0
- package/esm/array-items/index.d.ts +130 -0
- package/esm/array-items/index.mjs +105 -0
- package/esm/array-items/index.mjs.map +1 -0
- package/esm/array-list-tabs/array-list-tabs.d.ts +31 -0
- package/esm/array-list-tabs/index.d.ts +83 -0
- package/esm/array-list-tabs/index.mjs +183 -0
- package/esm/array-list-tabs/index.mjs.map +1 -0
- package/esm/array-list-tabs/utils.d.ts +3 -0
- package/esm/array-list-tabs/utils.mjs +16 -0
- package/esm/array-list-tabs/utils.mjs.map +1 -0
- package/esm/array-table/array-table.d.ts +1477 -0
- package/esm/array-table/index.d.ts +1573 -0
- package/esm/array-table/index.mjs +225 -0
- package/esm/array-table/index.mjs.map +1 -0
- package/esm/array-table/types.d.ts +6 -0
- package/esm/array-table/types.mjs +2 -0
- package/esm/array-table/types.mjs.map +1 -0
- package/esm/array-table/utils.d.ts +5 -0
- package/esm/array-table/utils.mjs +25 -0
- package/esm/array-table/utils.mjs.map +1 -0
- package/esm/array-tabs/array-tabs.d.ts +2 -0
- package/esm/array-tabs/index.d.ts +2 -0
- package/esm/array-tabs/index.mjs +87 -0
- package/esm/array-tabs/index.mjs.map +1 -0
- package/esm/cascader/cascader.d.ts +30 -0
- package/esm/cascader/index.d.ts +41 -0
- package/esm/cascader/index.mjs +54 -0
- package/esm/cascader/index.mjs.map +1 -0
- package/esm/checkbox/checkbox-group.d.ts +58 -0
- package/esm/checkbox/index.d.ts +779 -0
- package/esm/checkbox/index.mjs +83 -0
- package/esm/checkbox/index.mjs.map +1 -0
- package/esm/date-picker/index.d.ts +2 -0
- package/esm/date-picker/index.mjs +57 -0
- package/esm/date-picker/index.mjs.map +1 -0
- package/esm/editable/editable-popover.d.ts +25 -0
- package/esm/editable/editable.d.ts +187 -0
- package/esm/editable/index.d.ts +147 -0
- package/esm/editable/index.mjs +225 -0
- package/esm/editable/index.mjs.map +1 -0
- package/esm/form/form.d.ts +46 -0
- package/esm/form/form.mjs +71 -0
- package/esm/form/form.mjs.map +1 -0
- package/esm/form/index.d.ts +1 -0
- package/esm/form/index.mjs +6 -0
- package/esm/form/index.mjs.map +1 -0
- package/esm/form-button-group/form-button-group-sticky.d.ts +17 -0
- package/esm/form-button-group/form-button-group.d.ts +48 -0
- package/esm/form-button-group/index.d.ts +87 -0
- package/esm/form-button-group/index.mjs +87 -0
- package/esm/form-button-group/index.mjs.map +1 -0
- package/esm/form-button-group/utils.d.ts +1 -0
- package/esm/form-button-group/utils.mjs +12 -0
- package/esm/form-button-group/utils.mjs.map +1 -0
- package/esm/form-collapse/form-collapse.d.ts +18 -0
- package/esm/form-collapse/index.d.ts +45 -0
- package/esm/form-collapse/index.mjs +87 -0
- package/esm/form-collapse/index.mjs.map +1 -0
- package/esm/form-collapse/utils.d.ts +31 -0
- package/esm/form-collapse/utils.mjs +50 -0
- package/esm/form-collapse/utils.mjs.map +1 -0
- package/esm/form-dialog/dialog-content.d.ts +60 -0
- package/esm/form-dialog/index.d.ts +4 -0
- package/esm/form-dialog/index.mjs +208 -0
- package/esm/form-dialog/index.mjs.map +1 -0
- package/esm/form-dialog/types.d.ts +32 -0
- package/esm/form-dialog/types.mjs +2 -0
- package/esm/form-dialog/types.mjs.map +1 -0
- package/esm/form-drawer/drawer-content.d.ts +60 -0
- package/esm/form-drawer/index.d.ts +4 -0
- package/esm/form-drawer/index.mjs +202 -0
- package/esm/form-drawer/index.mjs.map +1 -0
- package/esm/form-drawer/types.d.ts +32 -0
- package/esm/form-drawer/types.mjs +2 -0
- package/esm/form-drawer/types.mjs.map +1 -0
- package/esm/form-grid/form-grid-column.d.ts +29 -0
- package/esm/form-grid/form-grid.d.ts +101 -0
- package/esm/form-grid/hooks.d.ts +5 -0
- package/esm/form-grid/hooks.mjs +14 -0
- package/esm/form-grid/hooks.mjs.map +1 -0
- package/esm/form-grid/index.d.ts +184 -0
- package/esm/form-grid/index.mjs +107 -0
- package/esm/form-grid/index.mjs.map +1 -0
- package/esm/form-item/form-item.d.ts +18 -0
- package/esm/form-item/index.d.ts +70 -0
- package/esm/form-item/index.mjs +331 -0
- package/esm/form-item/index.mjs.map +1 -0
- package/esm/form-item/types.d.ts +25 -0
- package/esm/form-item/types.mjs +2 -0
- package/esm/form-item/types.mjs.map +1 -0
- package/esm/form-item/utils.d.ts +3 -0
- package/esm/form-item/utils.mjs +17 -0
- package/esm/form-item/utils.mjs.map +1 -0
- package/esm/form-layout/form-layout.d.ts +32 -0
- package/esm/form-layout/form-layout.mjs +83 -0
- package/esm/form-layout/form-layout.mjs.map +1 -0
- package/esm/form-layout/index.d.ts +1 -0
- package/esm/form-layout/index.mjs +6 -0
- package/esm/form-layout/index.mjs.map +1 -0
- package/esm/form-layout/types.d.ts +43 -0
- package/esm/form-layout/types.mjs +2 -0
- package/esm/form-layout/types.mjs.map +1 -0
- package/esm/form-layout/utils.d.ts +57 -0
- package/esm/form-layout/utils.mjs +109 -0
- package/esm/form-layout/utils.mjs.map +1 -0
- package/esm/form-step/form-step-pane.d.ts +2 -0
- package/esm/form-step/form-step.d.ts +5 -0
- package/esm/form-step/index.d.ts +24 -0
- package/esm/form-step/index.mjs +92 -0
- package/esm/form-step/index.mjs.map +1 -0
- package/esm/form-step/types.d.ts +21 -0
- package/esm/form-step/types.mjs +2 -0
- package/esm/form-step/types.mjs.map +1 -0
- package/esm/form-step/utils.d.ts +11 -0
- package/esm/form-step/utils.mjs +64 -0
- package/esm/form-step/utils.mjs.map +1 -0
- package/esm/form-tab/form-tab.d.ts +7 -0
- package/esm/form-tab/hooks.d.ts +7 -0
- package/esm/form-tab/hooks.mjs +24 -0
- package/esm/form-tab/hooks.mjs.map +1 -0
- package/esm/form-tab/index.d.ts +28 -0
- package/esm/form-tab/index.mjs +77 -0
- package/esm/form-tab/index.mjs.map +1 -0
- package/esm/form-tab/types.d.ts +12 -0
- package/esm/form-tab/types.mjs +2 -0
- package/esm/form-tab/types.mjs.map +1 -0
- package/esm/form-tab/utils.d.ts +4 -0
- package/esm/form-tab/utils.mjs +14 -0
- package/esm/form-tab/utils.mjs.map +1 -0
- package/esm/index.d.ts +37 -0
- package/esm/index.mjs +81 -0
- package/esm/index.mjs.map +1 -0
- package/esm/input/index.d.ts +84 -0
- package/esm/input/index.mjs +77 -0
- package/esm/input/index.mjs.map +1 -0
- package/esm/input/input.d.ts +32 -0
- package/esm/input-number/index.d.ts +4 -0
- package/esm/input-number/index.mjs +30 -0
- package/esm/input-number/index.mjs.map +1 -0
- package/esm/pagination/components/jumper.d.ts +16 -0
- package/esm/pagination/components/jumper.mjs +12 -0
- package/esm/pagination/components/jumper.mjs.map +1 -0
- package/esm/pagination/components/next.d.ts +42 -0
- package/esm/pagination/components/next.mjs +23 -0
- package/esm/pagination/components/next.mjs.map +1 -0
- package/esm/pagination/components/pager.d.ts +42 -0
- package/esm/pagination/components/pager.mjs +23 -0
- package/esm/pagination/components/pager.mjs.map +1 -0
- package/esm/pagination/components/prev.d.ts +39 -0
- package/esm/pagination/components/prev.mjs +22 -0
- package/esm/pagination/components/prev.mjs.map +1 -0
- package/esm/pagination/components/sizes.d.ts +56 -0
- package/esm/pagination/components/sizes.mjs +7 -0
- package/esm/pagination/components/sizes.mjs.map +1 -0
- package/esm/pagination/components/total.d.ts +8 -0
- package/esm/pagination/components/total.mjs +11 -0
- package/esm/pagination/components/total.mjs.map +1 -0
- package/esm/pagination/pagination.d.ts +128 -0
- package/esm/pagination/pagination.mjs +629 -0
- package/esm/pagination/pagination.mjs.map +1 -0
- package/esm/password/index.d.ts +86 -0
- package/esm/password/index.mjs +14 -0
- package/esm/password/index.mjs.map +1 -0
- package/esm/preview-text/cascader.d.ts +5 -0
- package/esm/preview-text/date-picker.d.ts +5 -0
- package/esm/preview-text/index.d.ts +102 -0
- package/esm/preview-text/index.mjs +314 -0
- package/esm/preview-text/index.mjs.map +1 -0
- package/esm/preview-text/input.d.ts +28 -0
- package/esm/preview-text/preview.d.ts +18 -0
- package/esm/preview-text/select.d.ts +5 -0
- package/esm/preview-text/time-picker.d.ts +5 -0
- package/esm/preview-text/tree.d.ts +22 -0
- package/esm/preview-text/utils.d.ts +14 -0
- package/esm/preview-text/utils.mjs +16 -0
- package/esm/preview-text/utils.mjs.map +1 -0
- package/esm/radio/index.d.ts +370 -0
- package/esm/radio/index.mjs +80 -0
- package/esm/radio/index.mjs.map +1 -0
- package/esm/radio/radio-group.d.ts +44 -0
- package/esm/reset/index.d.ts +63 -0
- package/esm/reset/index.mjs +44 -0
- package/esm/reset/index.mjs.map +1 -0
- package/esm/reset/reset.d.ts +45 -0
- package/esm/select/index.d.ts +142 -0
- package/esm/select/index.mjs +132 -0
- package/esm/select/index.mjs.map +1 -0
- package/esm/select/select.d.ts +50 -0
- package/esm/select-table/index.d.ts +1530 -0
- package/esm/select-table/index.mjs +205 -0
- package/esm/select-table/index.mjs.map +1 -0
- package/esm/select-table/select-table.d.ts +2974 -0
- package/esm/select-table/types.d.ts +17 -0
- package/esm/select-table/types.mjs +2 -0
- package/esm/select-table/types.mjs.map +1 -0
- package/esm/space/index.d.ts +1 -0
- package/esm/space/index.mjs +6 -0
- package/esm/space/index.mjs.map +1 -0
- package/esm/styles/array-base/index.css +1 -0
- package/esm/styles/array-cards/index.css +1 -0
- package/esm/styles/array-collapse/index.css +1 -0
- package/esm/styles/array-items/index.css +1 -0
- package/esm/styles/array-list-tabs/index.css +1 -0
- package/esm/styles/array-table/index.css +1 -0
- package/esm/styles/array-tabs/index.css +1 -0
- package/esm/styles/editable/index.css +1 -0
- package/esm/styles/form-button-group/index.css +1 -0
- package/esm/styles/form-collapse/index.css +1 -0
- package/esm/styles/form-grid/index.css +1 -0
- package/esm/styles/form-item/index.css +1 -0
- package/esm/styles/form-tab/index.css +1 -0
- package/esm/styles/preview-text/index.css +1 -0
- package/esm/styles/radio/index.css +1 -0
- package/esm/styles/select-table/index.css +1 -0
- package/esm/submit/index.d.ts +48 -0
- package/esm/submit/index.mjs +40 -0
- package/esm/submit/index.mjs.map +1 -0
- package/esm/submit/submit.d.ts +36 -0
- package/esm/switch/index.d.ts +4 -0
- package/esm/switch/index.mjs +19 -0
- package/esm/switch/index.mjs.map +1 -0
- package/esm/time-picker/index.d.ts +4 -0
- package/esm/time-picker/index.mjs +21 -0
- package/esm/time-picker/index.mjs.map +1 -0
- package/esm/time-select/index.d.ts +2 -0
- package/esm/time-select/index.mjs +21 -0
- package/esm/time-select/index.mjs.map +1 -0
- package/esm/transfer/index.d.ts +186 -0
- package/esm/transfer/index.mjs +11 -0
- package/esm/transfer/index.mjs.map +1 -0
- package/esm/tree/index.d.ts +42 -0
- package/esm/tree/index.mjs +104 -0
- package/esm/tree/index.mjs.map +1 -0
- package/esm/tree/tree.d.ts +20 -0
- package/esm/tree/types.d.ts +13 -0
- package/esm/tree/types.mjs +2 -0
- package/esm/tree/types.mjs.map +1 -0
- package/esm/tree/utils.d.ts +45 -0
- package/esm/tree/utils.mjs +161 -0
- package/esm/tree/utils.mjs.map +1 -0
- package/esm/tree-select/index.d.ts +32 -0
- package/esm/tree-select/index.mjs +47 -0
- package/esm/tree-select/index.mjs.map +1 -0
- package/esm/tree-select/tree-select.d.ts +17 -0
- package/esm/upload/index.d.ts +707 -0
- package/esm/upload/index.mjs +175 -0
- package/esm/upload/index.mjs.map +1 -0
- package/esm/upload/upload.d.ts +1249 -0
- package/esm/vendor/icon.mjs +11 -0
- package/esm/vendor/icon.mjs.map +1 -0
- package/esm/vendor/lodash.mjs +1400 -0
- package/esm/vendor/lodash.mjs.map +1 -0
- package/esm/vendor/runtime.mjs +35 -0
- package/esm/vendor/runtime.mjs.map +1 -0
- package/esm/vendor/shared.esm-bundler.mjs +14 -0
- package/esm/vendor/shared.esm-bundler.mjs.map +1 -0
- package/esm/vendor/sizes.mjs +27 -0
- package/esm/vendor/sizes.mjs.map +1 -0
- package/esm/vendor/types.mjs +19 -0
- package/esm/vendor/types.mjs.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { InjectionKey, Ref } from 'vue';
|
|
2
|
+
import { IFormLayoutProps } from './types';
|
|
3
|
+
export declare function calcBreakpointIndex(breakpoints: number[], width: number): number;
|
|
4
|
+
export declare function calcFactor<T>(value: T | readonly T[], breakpointIndex: number): T;
|
|
5
|
+
export declare function factor<T>(value: T | T[], breakpointIndex: number): T;
|
|
6
|
+
export declare function calculateProps(target: Element, props: IFormLayoutProps): IFormLayoutProps;
|
|
7
|
+
export declare function useResponsiveFormLayout(props: IFormLayoutProps, root: Ref<HTMLElement | null>): {
|
|
8
|
+
props: Ref<{
|
|
9
|
+
tag?: string;
|
|
10
|
+
colon?: boolean;
|
|
11
|
+
labelAlign?: "right" | "left" | ("right" | "left")[];
|
|
12
|
+
wrapperAlign?: "right" | "left" | ("right" | "left")[];
|
|
13
|
+
labelWrap?: boolean;
|
|
14
|
+
labelWidth?: number;
|
|
15
|
+
wrapperWidth?: number;
|
|
16
|
+
wrapperWrap?: boolean;
|
|
17
|
+
labelCol?: number | number[];
|
|
18
|
+
wrapperCol?: number | number[];
|
|
19
|
+
fullness?: boolean;
|
|
20
|
+
size?: "small" | "default" | "large";
|
|
21
|
+
layout?: "vertical" | "horizontal" | "inline" | ("vertical" | "horizontal" | "inline")[];
|
|
22
|
+
feedbackLayout?: "loose" | "terse" | "popover";
|
|
23
|
+
tooltipLayout?: "icon" | "text";
|
|
24
|
+
breakpoints?: number[];
|
|
25
|
+
shallow?: boolean;
|
|
26
|
+
hideRequiredAsterisk?: boolean;
|
|
27
|
+
statusIcon?: boolean;
|
|
28
|
+
requireAsteriskPosition?: "left" | "right";
|
|
29
|
+
}, IFormLayoutProps | {
|
|
30
|
+
tag?: string;
|
|
31
|
+
colon?: boolean;
|
|
32
|
+
labelAlign?: "right" | "left" | ("right" | "left")[];
|
|
33
|
+
wrapperAlign?: "right" | "left" | ("right" | "left")[];
|
|
34
|
+
labelWrap?: boolean;
|
|
35
|
+
labelWidth?: number;
|
|
36
|
+
wrapperWidth?: number;
|
|
37
|
+
wrapperWrap?: boolean;
|
|
38
|
+
labelCol?: number | number[];
|
|
39
|
+
wrapperCol?: number | number[];
|
|
40
|
+
fullness?: boolean;
|
|
41
|
+
size?: "small" | "default" | "large";
|
|
42
|
+
layout?: "vertical" | "horizontal" | "inline" | ("vertical" | "horizontal" | "inline")[];
|
|
43
|
+
feedbackLayout?: "loose" | "terse" | "popover";
|
|
44
|
+
tooltipLayout?: "icon" | "text";
|
|
45
|
+
breakpoints?: number[];
|
|
46
|
+
shallow?: boolean;
|
|
47
|
+
hideRequiredAsterisk?: boolean;
|
|
48
|
+
statusIcon?: boolean;
|
|
49
|
+
requireAsteriskPosition?: "left" | "right";
|
|
50
|
+
}>;
|
|
51
|
+
};
|
|
52
|
+
export declare const formLayoutDeepContext: InjectionKey<Ref<IFormLayoutProps>>;
|
|
53
|
+
export declare const formLayoutShallowContext: InjectionKey<Ref<IFormLayoutProps>>;
|
|
54
|
+
export declare function useFormDeepLayout(): Ref<IFormLayoutProps>;
|
|
55
|
+
export declare function useFormLayout(): Ref<IFormLayoutProps>;
|
|
56
|
+
export declare const FORM_LAYOUT_PROPS_KEYS: ReadonlyArray<keyof IFormLayoutProps>;
|
|
57
|
+
export declare function filterValidFormLayoutProps(props: IFormLayoutProps): IFormLayoutProps;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { isArr as L, isValid as u } from "@formily/shared";
|
|
2
|
+
import { inject as l, ref as i, computed as d } from "vue";
|
|
3
|
+
import { useResizeObserver as h } from "../__builtins__/shared/hooks.mjs";
|
|
4
|
+
import "element-plus";
|
|
5
|
+
import "@formily/reactive";
|
|
6
|
+
import "@formily/core";
|
|
7
|
+
import "@formily/reactive-vue";
|
|
8
|
+
import "@formily/vue";
|
|
9
|
+
function w(t, o) {
|
|
10
|
+
for (const [r, e] of t.entries())
|
|
11
|
+
if (o <= e)
|
|
12
|
+
return r;
|
|
13
|
+
return -1;
|
|
14
|
+
}
|
|
15
|
+
function A(t, o) {
|
|
16
|
+
if (!Array.isArray(t) || t.length === 0)
|
|
17
|
+
return t;
|
|
18
|
+
const r = Math.max(-1, Math.min(o, t.length - 1));
|
|
19
|
+
return t.at(r);
|
|
20
|
+
}
|
|
21
|
+
function a(t, o) {
|
|
22
|
+
return u(t) ? A(t, o) : t;
|
|
23
|
+
}
|
|
24
|
+
function C(t, o) {
|
|
25
|
+
const { clientWidth: r } = t, {
|
|
26
|
+
breakpoints: e,
|
|
27
|
+
layout: s,
|
|
28
|
+
labelAlign: c,
|
|
29
|
+
wrapperAlign: f,
|
|
30
|
+
labelCol: m,
|
|
31
|
+
wrapperCol: y,
|
|
32
|
+
...b
|
|
33
|
+
} = o, n = w(
|
|
34
|
+
e,
|
|
35
|
+
r
|
|
36
|
+
);
|
|
37
|
+
return {
|
|
38
|
+
layout: a(s, n),
|
|
39
|
+
labelAlign: a(c, n),
|
|
40
|
+
wrapperAlign: a(f, n),
|
|
41
|
+
labelCol: a(m, n),
|
|
42
|
+
wrapperCol: a(y, n),
|
|
43
|
+
...b
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function I(t, o) {
|
|
47
|
+
const { breakpoints: r } = t;
|
|
48
|
+
if (!L(r))
|
|
49
|
+
return {
|
|
50
|
+
props: i(t)
|
|
51
|
+
};
|
|
52
|
+
const e = i({});
|
|
53
|
+
return h(o, () => {
|
|
54
|
+
e.value = C(o.value, t);
|
|
55
|
+
}), {
|
|
56
|
+
props: e
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const p = Symbol(
|
|
60
|
+
"formLayoutDeepContext"
|
|
61
|
+
), x = Symbol("formLayoutShallowContext");
|
|
62
|
+
function _() {
|
|
63
|
+
return l(p, i({}));
|
|
64
|
+
}
|
|
65
|
+
function j() {
|
|
66
|
+
const t = l(x, i({})), o = l(p, i({}));
|
|
67
|
+
return d(() => ({
|
|
68
|
+
...o.value,
|
|
69
|
+
...t.value
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
const D = [
|
|
73
|
+
"colon",
|
|
74
|
+
"labelAlign",
|
|
75
|
+
"wrapperAlign",
|
|
76
|
+
"labelWrap",
|
|
77
|
+
"labelWidth",
|
|
78
|
+
"wrapperWidth",
|
|
79
|
+
"wrapperWrap",
|
|
80
|
+
"labelCol",
|
|
81
|
+
"wrapperCol",
|
|
82
|
+
"fullness",
|
|
83
|
+
"size",
|
|
84
|
+
"layout",
|
|
85
|
+
"feedbackLayout",
|
|
86
|
+
"tooltipLayout",
|
|
87
|
+
"breakpoints",
|
|
88
|
+
"hideRequiredAsterisk",
|
|
89
|
+
"statusIcon"
|
|
90
|
+
];
|
|
91
|
+
function M(t) {
|
|
92
|
+
return Object.fromEntries(
|
|
93
|
+
Object.entries(t).filter(([o, r]) => u(r))
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
D as FORM_LAYOUT_PROPS_KEYS,
|
|
98
|
+
w as calcBreakpointIndex,
|
|
99
|
+
A as calcFactor,
|
|
100
|
+
C as calculateProps,
|
|
101
|
+
a as factor,
|
|
102
|
+
M as filterValidFormLayoutProps,
|
|
103
|
+
p as formLayoutDeepContext,
|
|
104
|
+
x as formLayoutShallowContext,
|
|
105
|
+
_ as useFormDeepLayout,
|
|
106
|
+
j as useFormLayout,
|
|
107
|
+
I as useResponsiveFormLayout
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/form-layout/utils.ts"],"sourcesContent":["import type { InjectionKey, Ref } from 'vue'\nimport type { IFormLayoutProps } from './types'\nimport { isArr, isValid } from '@formily/shared'\nimport { computed, inject, ref } from 'vue'\nimport { useResizeObserver } from '../__builtins__'\n\nexport function calcBreakpointIndex(breakpoints: number[], width: number): number {\n for (const [i, breakpoint] of breakpoints.entries()) {\n if (width <= breakpoint) {\n return i\n }\n }\n return -1\n}\n\nexport function calcFactor<T>(value: T | readonly T[], breakpointIndex: number): T {\n if (!Array.isArray(value) || value.length === 0) {\n return value as T\n }\n const safeIndex = Math.max(-1, Math.min(breakpointIndex, value.length - 1))\n return value.at(safeIndex)\n}\n\nexport function factor<T>(value: T | T[], breakpointIndex: number): T {\n return isValid(value) ? calcFactor<T>(value, breakpointIndex) : value as T\n}\n\nexport function calculateProps(target: Element, props: IFormLayoutProps): IFormLayoutProps {\n const { clientWidth } = target\n const {\n breakpoints,\n layout,\n labelAlign,\n wrapperAlign,\n labelCol,\n wrapperCol,\n ...otherProps\n } = props\n const breakpointIndex = calcBreakpointIndex(\n breakpoints as number[],\n clientWidth,\n )\n\n return {\n layout: factor(layout, breakpointIndex),\n labelAlign: factor(labelAlign, breakpointIndex),\n wrapperAlign: factor(wrapperAlign, breakpointIndex),\n labelCol: factor(labelCol, breakpointIndex),\n wrapperCol: factor(wrapperCol, breakpointIndex),\n ...otherProps,\n }\n}\n\nexport function useResponsiveFormLayout(props: IFormLayoutProps, root: Ref<HTMLElement | null>) {\n const { breakpoints } = props\n if (!isArr(breakpoints)) {\n return {\n props: ref(props),\n }\n }\n\n const layoutProps = ref<IFormLayoutProps>({})\n\n useResizeObserver(root, () => {\n layoutProps.value = calculateProps(root.value, props)\n })\n\n return {\n props: layoutProps,\n }\n}\n\nexport const formLayoutDeepContext: InjectionKey<Ref<IFormLayoutProps>> = Symbol(\n 'formLayoutDeepContext',\n)\n\nexport const formLayoutShallowContext: InjectionKey<Ref<IFormLayoutProps>>\n = Symbol('formLayoutShallowContext')\n\nexport function useFormDeepLayout(): Ref<IFormLayoutProps> {\n return inject(formLayoutDeepContext, ref({}))\n}\n\nexport function useFormLayout(): Ref<IFormLayoutProps> {\n const shallowLayout = inject(formLayoutShallowContext, ref({}))\n const deepLayout = inject(formLayoutDeepContext, ref({}))\n\n const formLayout = computed(() => {\n return {\n ...deepLayout.value,\n ...shallowLayout.value,\n }\n })\n\n return formLayout\n}\n\nexport const FORM_LAYOUT_PROPS_KEYS: ReadonlyArray<keyof IFormLayoutProps> = [\n 'colon',\n 'labelAlign',\n 'wrapperAlign',\n 'labelWrap',\n 'labelWidth',\n 'wrapperWidth',\n 'wrapperWrap',\n 'labelCol',\n 'wrapperCol',\n 'fullness',\n 'size',\n 'layout',\n 'feedbackLayout',\n 'tooltipLayout',\n 'breakpoints',\n 'hideRequiredAsterisk',\n 'statusIcon',\n] as const\n\nexport function filterValidFormLayoutProps(props: IFormLayoutProps): IFormLayoutProps {\n return Object.fromEntries(\n Object.entries(props)\n .filter(([_, value]) => isValid(value)),\n )\n}\n"],"names":["calcBreakpointIndex","breakpoints","width","i","breakpoint","calcFactor","value","breakpointIndex","safeIndex","factor","isValid","calculateProps","target","props","clientWidth","layout","labelAlign","wrapperAlign","labelCol","wrapperCol","otherProps","useResponsiveFormLayout","root","isArr","ref","layoutProps","useResizeObserver","formLayoutDeepContext","formLayoutShallowContext","useFormDeepLayout","inject","useFormLayout","shallowLayout","deepLayout","computed","FORM_LAYOUT_PROPS_KEYS","filterValidFormLayoutProps","_"],"mappings":";;;;;;;;AAMO,SAASA,EAAoBC,GAAuBC,GAAuB;AAChF,aAAW,CAACC,GAAGC,CAAU,KAAKH,EAAY;AACxC,QAAIC,KAASE;AACX,aAAOD;AAGX,SAAO;AACT;AAEO,SAASE,EAAcC,GAAyBC,GAA4B;AACjF,MAAI,CAAC,MAAM,QAAQD,CAAK,KAAKA,EAAM,WAAW;AAC5C,WAAOA;AAET,QAAME,IAAY,KAAK,IAAI,IAAI,KAAK,IAAID,GAAiBD,EAAM,SAAS,CAAC,CAAC;AAC1E,SAAOA,EAAM,GAAGE,CAAS;AAC3B;AAEO,SAASC,EAAUH,GAAgBC,GAA4B;AACpE,SAAOG,EAAQJ,CAAK,IAAID,EAAcC,GAAOC,CAAe,IAAID;AAClE;AAEO,SAASK,EAAeC,GAAiBC,GAA2C;AACzF,QAAM,EAAE,aAAAC,MAAgBF,GAClB;AAAA,IACJ,aAAAX;AAAA,IACA,QAAAc;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDP,GACEN,IAAkBP;AAAA,IACtBC;AAAA,IACAa;AAAA,EAAA;AAGF,SAAO;AAAA,IACL,QAAQL,EAAOM,GAAQR,CAAe;AAAA,IACtC,YAAYE,EAAOO,GAAYT,CAAe;AAAA,IAC9C,cAAcE,EAAOQ,GAAcV,CAAe;AAAA,IAClD,UAAUE,EAAOS,GAAUX,CAAe;AAAA,IAC1C,YAAYE,EAAOU,GAAYZ,CAAe;AAAA,IAC9C,GAAGa;AAAA,EAAA;AAEP;AAEO,SAASC,EAAwBR,GAAyBS,GAA+B;AAC9F,QAAM,EAAE,aAAArB,MAAgBY;AACxB,MAAI,CAACU,EAAMtB,CAAW;AACpB,WAAO;AAAA,MACL,OAAOuB,EAAIX,CAAK;AAAA,IAAA;AAIpB,QAAMY,IAAcD,EAAsB,EAAE;AAE5C,SAAAE,EAAkBJ,GAAM,MAAM;AAC5B,IAAAG,EAAY,QAAQd,EAAeW,EAAK,OAAOT,CAAK;AAAA,EACtD,CAAC,GAEM;AAAA,IACL,OAAOY;AAAA,EAAA;AAEX;AAEO,MAAME,IAA6D;AAAA,EACxE;AACF,GAEaC,IACT,OAAO,0BAA0B;AAE9B,SAASC,IAA2C;AACzD,SAAOC,EAAOH,GAAuBH,EAAI,CAAA,CAAE,CAAC;AAC9C;AAEO,SAASO,IAAuC;AACrD,QAAMC,IAAgBF,EAAOF,GAA0BJ,EAAI,CAAA,CAAE,CAAC,GACxDS,IAAaH,EAAOH,GAAuBH,EAAI,CAAA,CAAE,CAAC;AASxD,SAPmBU,EAAS,OACnB;AAAA,IACL,GAAGD,EAAW;AAAA,IACd,GAAGD,EAAc;AAAA,EAAA,EAEpB;AAGH;AAEO,MAAMG,IAAgE;AAAA,EAC3E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAASC,EAA2BvB,GAA2C;AACpF,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQA,CAAK,EACjB,OAAO,CAAC,CAACwB,GAAG/B,CAAK,MAAMI,EAAQJ,CAAK,CAAC;AAAA,EAAA;AAE5C;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IFormStepProps } from './types';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<IFormStepProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<IFormStepProps> & Readonly<{}>, {
|
|
3
|
+
formStep: import('./types').IFormStep;
|
|
4
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createFormStep } from './utils';
|
|
2
|
+
export declare const FormStep: {
|
|
3
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./types').IFormStepProps> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
|
|
4
|
+
formStep: import('./types').IFormStep;
|
|
5
|
+
}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
6
|
+
P: {};
|
|
7
|
+
B: {};
|
|
8
|
+
D: {};
|
|
9
|
+
C: {};
|
|
10
|
+
M: {};
|
|
11
|
+
Defaults: {};
|
|
12
|
+
}, Readonly<import('./types').IFormStepProps> & Readonly<{}>, {}, {}, {}, {}, {
|
|
13
|
+
formStep: import('./types').IFormStep;
|
|
14
|
+
}>;
|
|
15
|
+
__isFragment?: never;
|
|
16
|
+
__isTeleport?: never;
|
|
17
|
+
__isSuspense?: never;
|
|
18
|
+
} & import('vue').ComponentOptionsBase<Readonly<import('./types').IFormStepProps> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
|
|
19
|
+
formStep: import('./types').IFormStep;
|
|
20
|
+
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & {
|
|
21
|
+
StepPane: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
22
|
+
createFormStep: typeof createFormStep;
|
|
23
|
+
};
|
|
24
|
+
export default FormStep;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { observer as g } from "@formily/reactive-vue";
|
|
2
|
+
import { defineComponent as $, renderSlot as P, computed as B, createElementBlock as o, openBlock as r, normalizeClass as E, createVNode as N, unref as t, mergeProps as h, withCtx as u, Fragment as c, renderList as x, createBlock as a, createSlots as V, resolveDynamicComponent as _, createTextVNode as v, toDisplayString as y, createCommentVNode as b } from "vue";
|
|
3
|
+
import { ElSteps as A, ElStep as D } from "element-plus";
|
|
4
|
+
import "@formily/reactive";
|
|
5
|
+
import "@formily/core";
|
|
6
|
+
import { useField as O, useFieldSchema as R, RecursionField as j } from "@formily/vue";
|
|
7
|
+
import { composeExport as w } from "../__builtins__/shared/utils.mjs";
|
|
8
|
+
import { isObj as k } from "@formily/shared";
|
|
9
|
+
import { stylePrefix as z } from "../__builtins__/configs/index.mjs";
|
|
10
|
+
import { createFormStep as S, parseSteps as I } from "./utils.mjs";
|
|
11
|
+
const L = $({
|
|
12
|
+
name: "FFormStepPane",
|
|
13
|
+
inheritAttrs: !1
|
|
14
|
+
}), T = (n, i) => {
|
|
15
|
+
const m = n.__vccOpts || n;
|
|
16
|
+
for (const [p, s] of i)
|
|
17
|
+
m[p] = s;
|
|
18
|
+
return m;
|
|
19
|
+
};
|
|
20
|
+
function q(n, i, m, p, s, f) {
|
|
21
|
+
return P(n.$slots, "default");
|
|
22
|
+
}
|
|
23
|
+
const G = /* @__PURE__ */ T(L, [["render", q]]), H = /* @__PURE__ */ $({
|
|
24
|
+
name: "FFormStep",
|
|
25
|
+
inheritAttrs: !1,
|
|
26
|
+
__name: "form-step",
|
|
27
|
+
props: {
|
|
28
|
+
formStep: { default: () => S() },
|
|
29
|
+
active: null
|
|
30
|
+
},
|
|
31
|
+
setup(n) {
|
|
32
|
+
const i = n, m = O().value, p = `${z}-form-step`, s = R(), f = I(s.value);
|
|
33
|
+
i.formStep.connect?.(f, m);
|
|
34
|
+
const F = B(() => i.active ?? i.formStep?.current ?? 0);
|
|
35
|
+
return (C, K) => (r(), o("div", {
|
|
36
|
+
class: E(p)
|
|
37
|
+
}, [
|
|
38
|
+
N(t(A), h(C.$attrs, {
|
|
39
|
+
active: F.value,
|
|
40
|
+
style: [{ marginBottom: "10px" }]
|
|
41
|
+
}), {
|
|
42
|
+
default: u(() => [
|
|
43
|
+
(r(!0), o(c, null, x(t(f), ({ props: l, slots: e }, d) => (r(), a(t(D), h({ key: d }, { ref_for: !0 }, l), V({ _: 2 }, [
|
|
44
|
+
e?.title ? {
|
|
45
|
+
name: "title",
|
|
46
|
+
fn: u(() => [
|
|
47
|
+
t(k)(e.title) ? (r(), a(_(e.title), { key: 0 })) : (r(), o(c, { key: 1 }, [
|
|
48
|
+
v(y(e.title), 1)
|
|
49
|
+
], 64))
|
|
50
|
+
]),
|
|
51
|
+
key: "0"
|
|
52
|
+
} : void 0,
|
|
53
|
+
e?.icon ? {
|
|
54
|
+
name: "icon",
|
|
55
|
+
fn: u(() => [
|
|
56
|
+
t(k)(e.icon) ? (r(), a(_(e.icon), { key: 0 })) : (r(), o(c, { key: 1 }, [
|
|
57
|
+
v(y(e.icon), 1)
|
|
58
|
+
], 64))
|
|
59
|
+
]),
|
|
60
|
+
key: "1"
|
|
61
|
+
} : void 0,
|
|
62
|
+
e?.description ? {
|
|
63
|
+
name: "description",
|
|
64
|
+
fn: u(() => [
|
|
65
|
+
t(k)(e.description) ? (r(), a(_(e.description), { key: 0 })) : (r(), o(c, { key: 1 }, [
|
|
66
|
+
v(y(e.description), 1)
|
|
67
|
+
], 64))
|
|
68
|
+
]),
|
|
69
|
+
key: "2"
|
|
70
|
+
} : void 0
|
|
71
|
+
]), 1040))), 128))
|
|
72
|
+
]),
|
|
73
|
+
_: 1
|
|
74
|
+
}, 16, ["active"]),
|
|
75
|
+
(r(!0), o(c, null, x(t(f), ({ name: l, schema: e }, d) => (r(), o(c, { key: l }, [
|
|
76
|
+
d === F.value ? (r(), a(t(j), {
|
|
77
|
+
key: 0,
|
|
78
|
+
name: l,
|
|
79
|
+
schema: e
|
|
80
|
+
}, null, 8, ["name", "schema"])) : b("", !0)
|
|
81
|
+
], 64))), 128))
|
|
82
|
+
]));
|
|
83
|
+
}
|
|
84
|
+
}), J = g(H), oe = w(J, {
|
|
85
|
+
StepPane: G,
|
|
86
|
+
createFormStep: S
|
|
87
|
+
});
|
|
88
|
+
export {
|
|
89
|
+
oe as FormStep,
|
|
90
|
+
oe as default
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/form-step/form-step-pane.vue","../../src/form-step/form-step.vue","../../src/form-step/index.ts"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent } from 'vue'\n\nexport default defineComponent({\n name: 'FFormStepPane',\n inheritAttrs: false,\n})\n</script>\n\n<template>\n <slot />\n</template>\n","<script setup lang=\"ts\">\nimport type { VoidField } from '@formily/core'\nimport type { IFormStepProps } from './types'\nimport { isObj } from '@formily/shared'\nimport { RecursionField, useField, useFieldSchema } from '@formily/vue'\nimport { ElStep, ElSteps } from 'element-plus'\nimport { computed } from 'vue'\nimport { stylePrefix } from '../__builtins__'\nimport { createFormStep, parseSteps } from './utils'\n\ndefineOptions({\n name: 'FFormStep',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n formStep: { default: () => createFormStep() },\n active: null\n})\n\nconst field = useField<VoidField>().value\nconst prefixCls = `${stylePrefix}-form-step`\nconst fieldSchemaRef = useFieldSchema()\n\nconst steps = parseSteps(fieldSchemaRef.value)\n\nprops.formStep.connect?.(steps, field)\n\nconst current = computed(() => props.active ?? props.formStep?.current ?? 0)\n</script>\n\n<template>\n <div :class=\"prefixCls\">\n <ElSteps\n v-bind=\"$attrs\"\n :active=\"current\"\n :style=\"[{ marginBottom: '10px' }]\"\n >\n <ElStep\n v-for=\"({ props: stepProps, slots: stepSlots }, key) of steps\"\n :key=\"key\"\n v-bind=\"stepProps\"\n >\n <template v-if=\"stepSlots?.title\" #title>\n <template v-if=\"isObj(stepSlots.title)\">\n <component :is=\"stepSlots.title\" />\n </template>\n <template v-else>\n {{ stepSlots.title }}\n </template>\n </template>\n <template v-if=\"stepSlots?.icon\" #icon>\n <template v-if=\"isObj(stepSlots.icon)\">\n <component :is=\"stepSlots.icon\" />\n </template>\n <template v-else>\n {{ stepSlots.icon }}\n </template>\n </template>\n <template v-if=\"stepSlots?.description\" #description>\n <template v-if=\"isObj(stepSlots.description)\">\n <component :is=\"stepSlots.description\" />\n </template>\n <template v-else>\n {{ stepSlots.description }}\n </template>\n </template>\n </ElStep>\n </ElSteps>\n\n <template v-for=\"({ name, schema }, key) of steps\" :key=\"name\">\n <RecursionField\n v-if=\"key === current\"\n :name=\"name\"\n :schema=\"schema\"\n />\n </template>\n </div>\n</template>\n","import { observer } from '@formily/reactive-vue'\nimport { composeExport } from '../__builtins__'\nimport FFormStepPane from './form-step-pane.vue'\nimport FFormStep from './form-step.vue'\nimport { createFormStep } from './utils'\n\nconst FormStepInner = observer(FFormStep)\n\nexport const FormStep = composeExport(FormStepInner, {\n StepPane: FFormStepPane,\n createFormStep,\n})\n\nexport default FormStep\n"],"names":["_sfc_main$1","defineComponent","_renderSlot","_ctx","props","__props","field","useField","prefixCls","stylePrefix","fieldSchemaRef","useFieldSchema","steps","parseSteps","current","computed","_createElementBlock","_createVNode","_unref","ElSteps","_mergeProps","_openBlock","_Fragment","stepProps","stepSlots","key","_createBlock","_createSlots","isObj","_resolveDynamicComponent","_createTextVNode","_toDisplayString","name","schema","RecursionField","FormStepInner","observer","FFormStep","FormStep","composeExport","FFormStepPane","createFormStep"],"mappings":";;;;;;;;;;AAGA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;;;;;;;SAICC,EAAQC,EAAA,QAAA,SAAA;;;;;;;;;;;ACKV,UAAMC,IAAQC,GAKRC,IAAQC,IAAsB,OAC9BC,IAAY,GAAGC,CAAW,cAC1BC,IAAiBC,EAAA,GAEjBC,IAAQC,EAAWH,EAAe,KAAK;AAE7C,IAAAN,EAAM,SAAS,UAAUQ,GAAON,CAAK;AAErC,UAAMQ,IAAUC,EAAS,MAAMX,EAAM,UAAUA,EAAM,UAAU,WAAW,CAAC;2BAIzEY,EA6CM,OAAA;AAAA,MA7CA,SAAOR,CAAS;AAAA,IAAA;MACpBS,EAmCUC,EAAAC,CAAA,GAnCVC,EAmCUjB,EAAA,QAlCM;AAAA,QACb,QAAQW,EAAA;AAAA,QACR,OAAO,CAAA,EAAA,cAAA,QAAA;AAAA,MAAA;mBAGN,MAA8D;AAAA,WADhEO,EAAA,EAAA,GAAAL,EA6BSM,WA5BiDJ,EAAAN,CAAA,GAAK,CAAA,EAAA,OAA5CW,GAAS,OAASC,EAAA,GAAaC,OADlDJ,EAAA,GAAAK,EA6BSR,MA7BTE,EA6BS,EA3BN,KAAAK,EAAA,oBACOF,CAAS,GAAAI,EAAA,EAAA,GAAA,KAAA;AAAA,YAEDH,GAAW;oBAAQ;AAAA,oBAArC,MAEW;AAAA,gBADSN,EAAAU,CAAA,EAAMJ,EAAU,KAAK,UACnCE,EAAmCG,EAAnBL,EAAU,KAAK,GAAA,EAAA,KAAA,EAAA,CAAA,WAEjCR,EAEWM,GAAA,EAAA,KAAA,KAAA;AAAA,kBADNQ,EAAAC,EAAAP,EAAU,KAAK,GAAA,CAAA;AAAA,gBAAA;;;;YAGNA,GAAW;oBAAO;AAAA,oBAApC,MAEW;AAAA,gBADSN,EAAAU,CAAA,EAAMJ,EAAU,IAAI,UAClCE,EAAkCG,EAAlBL,EAAU,IAAI,GAAA,EAAA,KAAA,EAAA,CAAA,WAEhCR,EAEWM,GAAA,EAAA,KAAA,KAAA;AAAA,kBADNQ,EAAAC,EAAAP,EAAU,IAAI,GAAA,CAAA;AAAA,gBAAA;;;;YAGLA,GAAW;oBAAc;AAAA,oBAA3C,MAEW;AAAA,gBADSN,EAAAU,CAAA,EAAMJ,EAAU,WAAW,UACzCE,EAAyCG,EAAzBL,EAAU,WAAW,GAAA,EAAA,KAAA,EAAA,CAAA,WAEvCR,EAEWM,GAAA,EAAA,KAAA,KAAA;AAAA,kBADNQ,EAAAC,EAAAP,EAAU,WAAW,GAAA,CAAA;AAAA,gBAAA;;;;;;;;OAMhCH,EAAA,EAAA,GAAAL,EAMWM,WANiCJ,EAAAN,CAAA,GAAK,CAAA,EAA7B,MAAAoB,GAAM,QAAAC,EAAA,GAAUR,wBAAqBO,KAAI;AAAA,QAEnDP,MAAQX,EAAA,cADhBY,EAIER,EAAAgB,CAAA,GAAA;AAAA;UAFC,MAAAF;AAAA,UACA,QAAAC;AAAA,QAAA;;;;ICpEHE,IAAgBC,EAASC,CAAS,GAE3BC,KAAWC,EAAcJ,GAAe;AAAA,EACnD,UAAUK;AAAA,EACV,gBAAAC;AACF,CAAC;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Form, VoidField } from '@formily/core';
|
|
2
|
+
import { SchemaStep } from './utils';
|
|
3
|
+
export interface IFormStep {
|
|
4
|
+
connect: (steps: SchemaStep[], field: VoidField) => void;
|
|
5
|
+
current: number;
|
|
6
|
+
allowNext: boolean;
|
|
7
|
+
allowBack: boolean;
|
|
8
|
+
setCurrent: (key: number) => void;
|
|
9
|
+
submit: Form['submit'];
|
|
10
|
+
next: () => void;
|
|
11
|
+
back: () => void;
|
|
12
|
+
}
|
|
13
|
+
export interface IFormStepProps {
|
|
14
|
+
formStep?: IFormStep;
|
|
15
|
+
active?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface FormStepEnv {
|
|
18
|
+
form: Form;
|
|
19
|
+
field: VoidField;
|
|
20
|
+
steps: SchemaStep[];
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Schema, SchemaKey } from '@formily/json-schema';
|
|
2
|
+
import { Slots } from 'vue';
|
|
3
|
+
import { IFormStep } from './types';
|
|
4
|
+
export interface SchemaStep {
|
|
5
|
+
name: SchemaKey;
|
|
6
|
+
props: any;
|
|
7
|
+
schema: Schema;
|
|
8
|
+
slots: Slots;
|
|
9
|
+
}
|
|
10
|
+
export declare function createFormStep(defaultCurrent?: number): IFormStep;
|
|
11
|
+
export declare function parseSteps(schema: Schema): SchemaStep[];
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { observable as i, action as c, model as f } from "@formily/reactive";
|
|
2
|
+
function d(o = 0) {
|
|
3
|
+
const e = i({
|
|
4
|
+
form: null,
|
|
5
|
+
field: null,
|
|
6
|
+
steps: []
|
|
7
|
+
}), r = c.bound((n) => {
|
|
8
|
+
const s = e.steps[n];
|
|
9
|
+
for (const { name: u } of e.steps)
|
|
10
|
+
e.form.query(`${e.field.address}.${u}`).take((a) => {
|
|
11
|
+
u === s.name ? a.setDisplay("visible") : a.setDisplay("hidden");
|
|
12
|
+
});
|
|
13
|
+
}), t = f({
|
|
14
|
+
connect(n, s) {
|
|
15
|
+
e.steps = n, e.form = s?.form, e.field = s;
|
|
16
|
+
},
|
|
17
|
+
current: o,
|
|
18
|
+
setCurrent(n) {
|
|
19
|
+
t.current = n;
|
|
20
|
+
},
|
|
21
|
+
get allowNext() {
|
|
22
|
+
return t.current < e.steps.length - 1;
|
|
23
|
+
},
|
|
24
|
+
get allowBack() {
|
|
25
|
+
return t.current > 0;
|
|
26
|
+
},
|
|
27
|
+
async next() {
|
|
28
|
+
try {
|
|
29
|
+
await e.form.validate(), p();
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
async back() {
|
|
34
|
+
l();
|
|
35
|
+
},
|
|
36
|
+
async submit(n) {
|
|
37
|
+
return e.form?.submit?.(n);
|
|
38
|
+
}
|
|
39
|
+
}), p = c.bound(() => {
|
|
40
|
+
/* istanbul ignore else -- @preserve */
|
|
41
|
+
t.allowNext && (r(t.current + 1), t.setCurrent(t.current + 1));
|
|
42
|
+
}), l = c.bound(() => {
|
|
43
|
+
/* istanbul ignore else -- @preserve */
|
|
44
|
+
t.allowBack && (r(t.current - 1), t.setCurrent(t.current - 1));
|
|
45
|
+
});
|
|
46
|
+
return t;
|
|
47
|
+
}
|
|
48
|
+
function b(o) {
|
|
49
|
+
const e = [];
|
|
50
|
+
return o.mapProperties((r, t) => {
|
|
51
|
+
/* istanbul ignore else -- @preserve */
|
|
52
|
+
r["x-component"]?.indexOf("StepPane") > -1 && e.push({
|
|
53
|
+
name: t,
|
|
54
|
+
props: r["x-component-props"],
|
|
55
|
+
schema: r,
|
|
56
|
+
slots: r["x-content"]
|
|
57
|
+
});
|
|
58
|
+
}), e;
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
d as createFormStep,
|
|
62
|
+
b as parseSteps
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/form-step/utils.ts"],"sourcesContent":["import type { Schema, SchemaKey } from '@formily/json-schema'\nimport type { Slots } from 'vue'\nimport type { FormStepEnv, IFormStep } from './types'\nimport { action, model, observable } from '@formily/reactive'\n\nexport interface SchemaStep {\n name: SchemaKey\n props: any\n schema: Schema\n slots: Slots\n}\n\nexport function createFormStep(defaultCurrent = 0): IFormStep {\n const env: FormStepEnv = observable({\n form: null,\n field: null,\n steps: [],\n })\n\n const setDisplay = action.bound((target: number) => {\n const currentStep = env.steps[target]\n for (const { name } of env.steps) {\n env.form.query(`${env.field.address}.${name}`).take((field) => {\n if (name === currentStep.name) {\n field.setDisplay('visible')\n }\n else {\n field.setDisplay('hidden')\n }\n })\n }\n })\n\n const formStep: IFormStep = model({\n connect(steps, field) {\n env.steps = steps\n env.form = field?.form\n env.field = field\n },\n current: defaultCurrent,\n setCurrent(key: number) {\n formStep.current = key\n },\n get allowNext() {\n return formStep.current < env.steps.length - 1\n },\n get allowBack() {\n return formStep.current > 0\n },\n async next() {\n try {\n await env.form.validate()\n // eslint-disable-next-line ts/no-use-before-define\n next()\n }\n catch {}\n },\n async back() {\n // eslint-disable-next-line ts/no-use-before-define\n back()\n },\n async submit(onSubmit) {\n return env.form?.submit?.(onSubmit)\n },\n })\n\n const next = action.bound(() => {\n /* istanbul ignore else -- @preserve */\n if (formStep.allowNext) {\n setDisplay(formStep.current + 1)\n formStep.setCurrent(formStep.current + 1)\n }\n })\n\n const back = action.bound(() => {\n /* istanbul ignore else -- @preserve */\n if (formStep.allowBack) {\n setDisplay(formStep.current - 1)\n formStep.setCurrent(formStep.current - 1)\n }\n })\n return formStep\n}\n\nexport function parseSteps(schema: Schema) {\n const steps: SchemaStep[] = []\n schema.mapProperties((schema, name) => {\n /* istanbul ignore else -- @preserve */\n if (schema['x-component']?.indexOf('StepPane') > -1) {\n steps.push({\n name,\n props: schema['x-component-props'],\n schema,\n slots: schema['x-content'],\n })\n }\n })\n return steps\n}\n"],"names":["createFormStep","defaultCurrent","env","observable","setDisplay","action","target","currentStep","name","field","formStep","model","steps","key","next","back","onSubmit","parseSteps","schema"],"mappings":";AAYO,SAASA,EAAeC,IAAiB,GAAc;AAC5D,QAAMC,IAAmBC,EAAW;AAAA,IAClC,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,CAAA;AAAA,EAAC,CACT,GAEKC,IAAaC,EAAO,MAAM,CAACC,MAAmB;AAClD,UAAMC,IAAcL,EAAI,MAAMI,CAAM;AACpC,eAAW,EAAE,MAAAE,OAAUN,EAAI;AACzB,MAAAA,EAAI,KAAK,MAAM,GAAGA,EAAI,MAAM,OAAO,IAAIM,CAAI,EAAE,EAAE,KAAK,CAACC,MAAU;AAC7D,QAAID,MAASD,EAAY,OACvBE,EAAM,WAAW,SAAS,IAG1BA,EAAM,WAAW,QAAQ;AAAA,MAE7B,CAAC;AAAA,EAEL,CAAC,GAEKC,IAAsBC,EAAM;AAAA,IAChC,QAAQC,GAAOH,GAAO;AACpB,MAAAP,EAAI,QAAQU,GACZV,EAAI,OAAOO,GAAO,MAClBP,EAAI,QAAQO;AAAA,IACd;AAAA,IACA,SAASR;AAAA,IACT,WAAWY,GAAa;AACtB,MAAAH,EAAS,UAAUG;AAAA,IACrB;AAAA,IACA,IAAI,YAAY;AACd,aAAOH,EAAS,UAAUR,EAAI,MAAM,SAAS;AAAA,IAC/C;AAAA,IACA,IAAI,YAAY;AACd,aAAOQ,EAAS,UAAU;AAAA,IAC5B;AAAA,IACA,MAAM,OAAO;AACX,UAAI;AACF,cAAMR,EAAI,KAAK,SAAA,GAEfY,EAAA;AAAA,MACF,QACM;AAAA,MAAC;AAAA,IACT;AAAA,IACA,MAAM,OAAO;AAEX,MAAAC,EAAA;AAAA,IACF;AAAA,IACA,MAAM,OAAOC,GAAU;AACrB,aAAOd,EAAI,MAAM,SAASc,CAAQ;AAAA,IACpC;AAAA,EAAA,CACD,GAEKF,IAAOT,EAAO,MAAM,MAAM;AAAA,IAAA;AAE9B,IAAIK,EAAS,cACXN,EAAWM,EAAS,UAAU,CAAC,GAC/BA,EAAS,WAAWA,EAAS,UAAU,CAAC;AAAA,EAE5C,CAAC,GAEKK,IAAOV,EAAO,MAAM,MAAM;AAAA,IAAA;AAE9B,IAAIK,EAAS,cACXN,EAAWM,EAAS,UAAU,CAAC,GAC/BA,EAAS,WAAWA,EAAS,UAAU,CAAC;AAAA,EAE5C,CAAC;AACD,SAAOA;AACT;AAEO,SAASO,EAAWC,GAAgB;AACzC,QAAMN,IAAsB,CAAA;AAC5B,SAAAM,EAAO,cAAc,CAACA,GAAQV,MAAS;AAAA,IAAA;AAErC,IAAIU,EAAO,aAAa,GAAG,QAAQ,UAAU,IAAI,MAC/CN,EAAM,KAAK;AAAA,MACT,MAAAJ;AAAA,MACA,OAAOU,EAAO,mBAAmB;AAAA,MACjC,QAAAA;AAAAA,MACA,OAAOA,EAAO,WAAW;AAAA,IAAA,CAC1B;AAAA,EAEL,CAAC,GACMN;AACT;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IFormTabProps } from './types.ts';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<IFormTabProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
3
|
+
input: (...args: any[]) => void;
|
|
4
|
+
}, string, import('vue').PublicProps, Readonly<IFormTabProps> & Readonly<{
|
|
5
|
+
onInput?: (...args: any[]) => any;
|
|
6
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { observable as n, reaction as i } from "@formily/reactive";
|
|
2
|
+
import { useField as p, useFieldSchema as l } from "@formily/vue";
|
|
3
|
+
function m() {
|
|
4
|
+
const t = p(), r = l(), o = n([]);
|
|
5
|
+
return i(() => r.value?.mapProperties((a, s) => t.value.query(t.value.address.concat(s)).take()?.display), () => {
|
|
6
|
+
o.length = 0, r.value?.mapProperties((e, a) => {
|
|
7
|
+
const s = t.value.query(t.value.address.concat(a)).take();
|
|
8
|
+
s?.display === "none" || s?.display === "hidden" || e["x-component"]?.indexOf("TabPane") > -1 && o.push({
|
|
9
|
+
name: a,
|
|
10
|
+
props: {
|
|
11
|
+
name: e?.["x-component-props"]?.name || a,
|
|
12
|
+
...e?.["x-component-props"]
|
|
13
|
+
},
|
|
14
|
+
schema: e
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
}, {
|
|
18
|
+
fireImmediately: !0
|
|
19
|
+
}), o;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
m as useTabs
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=hooks.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.mjs","sources":["../../src/form-tab/hooks.ts"],"sourcesContent":["import type { Schema, SchemaKey } from '@formily/json-schema'\nimport { observable, reaction } from '@formily/reactive'\nimport { useField, useFieldSchema } from '@formily/vue'\n\nexport type Tabs = { name: SchemaKey, props: any, schema: Schema }[]\n\nexport function useTabs() {\n const tabsField = useField()\n const schema = useFieldSchema()\n const tabs: Tabs = observable([])\n reaction(() => {\n const tabDisplayStatus = schema.value?.mapProperties((schema, name) => {\n const field = tabsField.value\n .query(tabsField.value.address.concat(name))\n .take()\n return field?.display\n })\n return tabDisplayStatus\n }, () => {\n tabs.length = 0\n schema.value?.mapProperties((schema, name) => {\n const field = tabsField.value\n .query(tabsField.value.address.concat(name))\n .take()\n if (field?.display === 'none' || field?.display === 'hidden')\n return\n\n if (schema['x-component']?.indexOf('TabPane') > -1) {\n tabs.push({\n name,\n props: {\n name: schema?.['x-component-props']?.name || name,\n ...schema?.['x-component-props'],\n },\n schema,\n })\n }\n })\n }, {\n fireImmediately: true,\n })\n\n return tabs\n}\n"],"names":["useTabs","tabsField","useField","schema","useFieldSchema","tabs","observable","reaction","name","field"],"mappings":";;AAMO,SAASA,IAAU;AACxB,QAAMC,IAAYC,EAAA,GACZC,IAASC,EAAA,GACTC,IAAaC,EAAW,EAAE;AAChC,SAAAC,EAAS,MACkBJ,EAAO,OAAO,cAAc,CAACA,GAAQK,MAC9CP,EAAU,MACrB,MAAMA,EAAU,MAAM,QAAQ,OAAOO,CAAI,CAAC,EAC1C,KAAA,GACW,OACf,GAEA,MAAM;AACP,IAAAH,EAAK,SAAS,GACdF,EAAO,OAAO,cAAc,CAACA,GAAQK,MAAS;AAC5C,YAAMC,IAAQR,EAAU,MACrB,MAAMA,EAAU,MAAM,QAAQ,OAAOO,CAAI,CAAC,EAC1C,KAAA;AACH,MAAIC,GAAO,YAAY,UAAUA,GAAO,YAAY,YAGhDN,EAAO,aAAa,GAAG,QAAQ,SAAS,IAAI,MAC9CE,EAAK,KAAK;AAAA,QACR,MAAAG;AAAA,QACA,OAAO;AAAA,UACL,MAAML,IAAS,mBAAmB,GAAG,QAAQK;AAAA,UAC7C,GAAGL,IAAS,mBAAmB;AAAA,QAAA;AAAA,QAEjC,QAAAA;AAAAA,MAAA,CACD;AAAA,IAEL,CAAC;AAAA,EACH,GAAG;AAAA,IACD,iBAAiB;AAAA,EAAA,CAClB,GAEME;AACT;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createFormTab } from './utils';
|
|
2
|
+
export declare const composeFormTab: {
|
|
3
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./types').IFormTabProps> & Readonly<{
|
|
4
|
+
onInput?: (...args: any[]) => any;
|
|
5
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
6
|
+
input: (...args: any[]) => void;
|
|
7
|
+
}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
8
|
+
P: {};
|
|
9
|
+
B: {};
|
|
10
|
+
D: {};
|
|
11
|
+
C: {};
|
|
12
|
+
M: {};
|
|
13
|
+
Defaults: {};
|
|
14
|
+
}, Readonly<import('./types').IFormTabProps> & Readonly<{
|
|
15
|
+
onInput?: (...args: any[]) => any;
|
|
16
|
+
}>, {}, {}, {}, {}, {}>;
|
|
17
|
+
__isFragment?: never;
|
|
18
|
+
__isTeleport?: never;
|
|
19
|
+
__isSuspense?: never;
|
|
20
|
+
} & import('vue').ComponentOptionsBase<Readonly<import('./types').IFormTabProps> & Readonly<{
|
|
21
|
+
onInput?: (...args: any[]) => any;
|
|
22
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
23
|
+
input: (...args: any[]) => void;
|
|
24
|
+
}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & {
|
|
25
|
+
createFormTab: typeof createFormTab;
|
|
26
|
+
};
|
|
27
|
+
export { composeFormTab as FormTab };
|
|
28
|
+
export default composeFormTab;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { observer as E } from "@formily/reactive-vue";
|
|
2
|
+
import { defineComponent as k, computed as B, ref as K, watch as w, createBlock as s, openBlock as a, unref as r, withCtx as l, createElementBlock as d, Fragment as v, renderList as $, mergeProps as L, normalizeClass as N, createTextVNode as b, toDisplayString as T, createVNode as R } from "vue";
|
|
3
|
+
import { ElTabs as V, ElTabPane as q, ElBadge as z } from "element-plus";
|
|
4
|
+
import { reaction as A, observable as D } from "@formily/reactive";
|
|
5
|
+
import "@formily/core";
|
|
6
|
+
import { useField as I, RecursionField as P } from "@formily/vue";
|
|
7
|
+
import { composeExport as S } from "../__builtins__/shared/utils.mjs";
|
|
8
|
+
import { stylePrefix as j } from "../__builtins__/configs/index.mjs";
|
|
9
|
+
import { useTabs as G } from "./hooks.mjs";
|
|
10
|
+
import { createFormTab as y } from "./utils.mjs";
|
|
11
|
+
import '../styles/form-tab/index.css';const H = /* @__PURE__ */ k({
|
|
12
|
+
name: "FFormTab",
|
|
13
|
+
__name: "form-tab",
|
|
14
|
+
props: {
|
|
15
|
+
formTab: null,
|
|
16
|
+
value: null
|
|
17
|
+
},
|
|
18
|
+
emits: ["input"],
|
|
19
|
+
setup(_, { emit: h }) {
|
|
20
|
+
const u = _, F = h, i = I(), g = `${j}-form-tab`, m = B(() => u.formTab ?? y()), t = G(), o = K(u?.value ?? m.value.activeKey ?? t?.[0]?.name);
|
|
21
|
+
A(() => t.length, () => {
|
|
22
|
+
!t.some((e) => e.name === o.value) && (o.value = t?.[0]?.name);
|
|
23
|
+
}, {
|
|
24
|
+
fireImmediately: !0
|
|
25
|
+
}), w(() => m.value.activeKey, (e) => {
|
|
26
|
+
o.value = e;
|
|
27
|
+
});
|
|
28
|
+
const c = D.computed(() => t.map((e) => i.value.form.queryFeedbacks({
|
|
29
|
+
type: "error",
|
|
30
|
+
address: `${i.value.address}.${e.name}.*`
|
|
31
|
+
}).length));
|
|
32
|
+
function x(e) {
|
|
33
|
+
/* istanbul ignore if -- @preserve */
|
|
34
|
+
typeof e == "string" && (F("input", e), m.value.setActiveKey?.(e));
|
|
35
|
+
}
|
|
36
|
+
return (e, M) => (a(), s(r(V), {
|
|
37
|
+
"model-value": o.value,
|
|
38
|
+
style: { width: "100%" },
|
|
39
|
+
onTabChange: x
|
|
40
|
+
}, {
|
|
41
|
+
default: l(() => [
|
|
42
|
+
(a(!0), d(v, null, $(r(t), ({ props: n, schema: C, name: f }, p) => (a(), s(r(q), L({ key: f }, { ref_for: !0 }, n), {
|
|
43
|
+
default: l(() => [
|
|
44
|
+
R(r(P), {
|
|
45
|
+
schema: C,
|
|
46
|
+
name: f
|
|
47
|
+
}, null, 8, ["schema", "name"])
|
|
48
|
+
]),
|
|
49
|
+
label: l(() => [
|
|
50
|
+
r(c).value[p] !== 0 ? (a(), s(r(z), {
|
|
51
|
+
key: 0,
|
|
52
|
+
class: N(g),
|
|
53
|
+
value: r(c).value[p]
|
|
54
|
+
}, {
|
|
55
|
+
default: l(() => [
|
|
56
|
+
b(T(n.label), 1)
|
|
57
|
+
]),
|
|
58
|
+
_: 2
|
|
59
|
+
}, 1032, ["value"])) : (a(), d(v, { key: 1 }, [
|
|
60
|
+
b(T(n.label), 1)
|
|
61
|
+
], 64))
|
|
62
|
+
]),
|
|
63
|
+
_: 2
|
|
64
|
+
}, 1040))), 128))
|
|
65
|
+
]),
|
|
66
|
+
_: 1
|
|
67
|
+
}, 8, ["model-value"]));
|
|
68
|
+
}
|
|
69
|
+
}), J = E(H), ae = S(J, {
|
|
70
|
+
createFormTab: y
|
|
71
|
+
});
|
|
72
|
+
export {
|
|
73
|
+
ae as FormTab,
|
|
74
|
+
ae as composeFormTab,
|
|
75
|
+
ae as default
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/form-tab/form-tab.vue","../../src/form-tab/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { IFormTabProps } from './types.ts'\nimport { observable, reaction } from '@formily/reactive'\nimport { RecursionField, useField } from '@formily/vue'\nimport { ElBadge, ElTabPane, ElTabs } from 'element-plus'\nimport { computed, ref, watch } from 'vue'\nimport { stylePrefix } from '../__builtins__'\nimport { useTabs } from './hooks'\nimport { createFormTab } from './utils'\n\ndefineOptions({\n name: 'FFormTab',\n})\n\nconst props = defineProps({\n formTab: null,\n value: null\n})\nconst emit = defineEmits(['input'])\n\nconst field = useField()\nconst prefixCls = `${stylePrefix}-form-tab`\nconst formTabRef = computed(() => props.formTab ?? createFormTab())\nconst tabs = useTabs()\nconst _activeKey = ref(props?.value ?? formTabRef.value.activeKey ?? tabs?.[0]?.name)\n\nreaction(() => {\n return tabs.length\n}, () => {\n !tabs.some(tab => tab.name === _activeKey.value) && (_activeKey.value = tabs?.[0]?.name)\n}, {\n fireImmediately: true,\n})\nwatch(() => formTabRef.value.activeKey, (val) => {\n _activeKey.value = val\n})\n\nconst errorList = observable.computed(() => {\n return tabs.map((tab) => {\n return field.value.form.queryFeedbacks({\n type: 'error',\n address: `${field.value.address}.${tab.name}.*`,\n }).length\n })\n})\n\nfunction handleTabChange(key: string) {\n /* istanbul ignore if -- @preserve */\n if (typeof key !== 'string')\n return\n emit('input', key)\n formTabRef.value.setActiveKey?.(key)\n}\n</script>\n\n<template>\n <ElTabs\n :model-value=\"_activeKey\"\n style=\"width: 100%;\"\n @tab-change=\"handleTabChange\"\n >\n <ElTabPane\n v-for=\"({ props: tabProps, schema, name }, key) in tabs\"\n :key=\"name\"\n v-bind=\"tabProps\"\n >\n <template #default>\n <RecursionField :schema=\"schema\" :name=\"name\" />\n </template>\n <template #label>\n <ElBadge\n v-if=\"errorList.value[key] !== 0\"\n :class=\"prefixCls\"\n :value=\"errorList.value[key]\"\n >\n {{ tabProps.label }}\n </ElBadge>\n <template v-else>\n {{ tabProps.label }}\n </template>\n </template>\n </ElTabPane>\n </ElTabs>\n</template>\n","import { observer } from '@formily/reactive-vue'\nimport { composeExport } from '../__builtins__'\nimport FFormTab from './form-tab.vue'\nimport { createFormTab } from './utils'\nimport './style.scss'\n\nconst FormTab = observer(FFormTab)\n\nexport const composeFormTab = composeExport(FormTab, {\n createFormTab,\n})\n\nexport { composeFormTab as FormTab }\nexport default composeFormTab\n"],"names":["props","__props","emit","__emit","field","useField","prefixCls","stylePrefix","formTabRef","computed","createFormTab","tabs","useTabs","_activeKey","ref","reaction","tab","watch","val","errorList","observable","handleTabChange","key","_createBlock","_unref","ElTabs","_createElementBlock","_Fragment","_renderList","tabProps","schema","name","_openBlock","_mergeProps","_createVNode","RecursionField","ElBadge","_createTextVNode","_toDisplayString","FormTab","observer","FFormTab","composeFormTab","composeExport"],"mappings":";;;;;;;;;;;;;;;;;;;AAcA,UAAMA,IAAQC,GAIRC,IAAOC,GAEPC,IAAQC,EAAA,GACRC,IAAY,GAAGC,CAAW,aAC1BC,IAAaC,EAAS,MAAMT,EAAM,WAAWU,GAAe,GAC5DC,IAAOC,EAAA,GACPC,IAAaC,EAAId,GAAO,SAASQ,EAAW,MAAM,aAAaG,IAAO,CAAC,GAAG,IAAI;AAEpF,IAAAI,EAAS,MACAJ,EAAK,QACX,MAAM;AACP,OAACA,EAAK,KAAK,CAAAK,MAAOA,EAAI,SAASH,EAAW,KAAK,MAAMA,EAAW,QAAQF,IAAO,CAAC,GAAG;AAAA,IACrF,GAAG;AAAA,MACD,iBAAiB;AAAA,IAAA,CAClB,GACDM,EAAM,MAAMT,EAAW,MAAM,WAAW,CAACU,MAAQ;AAC/C,MAAAL,EAAW,QAAQK;AAAA,IACrB,CAAC;AAED,UAAMC,IAAYC,EAAW,SAAS,MAC7BT,EAAK,IAAI,CAACK,MACRZ,EAAM,MAAM,KAAK,eAAe;AAAA,MACrC,MAAM;AAAA,MACN,SAAS,GAAGA,EAAM,MAAM,OAAO,IAAIY,EAAI,IAAI;AAAA,IAAA,CAC5C,EAAE,MACJ,CACF;AAED,aAASK,EAAgBC,GAAa;AAAA,MAAA;AAEpC,MAAI,OAAOA,KAAQ,aAEnBpB,EAAK,SAASoB,CAAG,GACjBd,EAAW,MAAM,eAAec,CAAG;AAAA,IACrC;2BAIEC,EA0BSC,EAAAC,CAAA,GAAA;AAAA,MAzBN,eAAaZ,EAAA;AAAA,MACd,OAAA,EAAA,OAAA,OAAA;AAAA,MACC,aAAYQ;AAAA,IAAA;iBAGX,MAAwD;AAAA,gBAD1DK,EAoBYC,GAAA,MAAAC,EAnByCJ,MAAI,CAAA,EAAA,OAAtCK,GAAU,QAAAC,GAAQ,MAAAC,EAAA,GAAQT,OAD7CU,KAAAT,EAoBYC,MApBZS,EAoBY,EAlBT,KAAKF,EAAA,oBACEF,CAAQ,GAAA;AAAA,UAEL,WACT,MAAgD;AAAA,YAAhDK,EAAgDV,EAAAW,CAAA,GAAA;AAAA,cAA/B,QAAAL;AAAA,cAAiB,MAAAC;AAAA,YAAA;;UAEzB,SADP,MAMQ;AAAA,YAHFP,EAAAL,CAAA,EAAU,MAAMG,CAAG,MAAA,UAD3BC,EAMUC,EAAAY,CAAA,GAAA;AAAA;cAJP,SAAO9B,CAAS;AAAA,cAChB,OAAOkB,EAAAL,CAAA,EAAU,MAAMG,CAAG;AAAA,YAAA;yBAE3B,MAAoB;AAAA,gBAAjBe,EAAAC,EAAAT,EAAS,KAAK,GAAA,CAAA;AAAA,cAAA;;yCAEnBH,EAEWC,GAAA,EAAA,KAAA,KAAA;AAAA,cADNU,EAAAC,EAAAT,EAAS,KAAK,GAAA,CAAA;AAAA,YAAA;;;;;;;;ICxErBU,IAAUC,EAASC,CAAQ,GAEpBC,KAAiBC,EAAcJ,GAAS;AAAA,EACnD,eAAA7B;AACF,CAAC;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface IFormTab {
|
|
2
|
+
name: string;
|
|
3
|
+
activeKey: string;
|
|
4
|
+
setActiveKey: (key: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export interface IFormTabProps {
|
|
7
|
+
formTab?: IFormTab;
|
|
8
|
+
value?: string | number;
|
|
9
|
+
}
|
|
10
|
+
export interface IFormTabPaneProps {
|
|
11
|
+
key: string | number;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|