vft 0.0.387 → 0.0.389
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/es/components/alert/alert.vue.d.ts +11 -1
- package/es/components/alert/alert.vue2.js +65 -13
- package/es/components/alert/index.d.ts +76 -28
- package/es/components/autocomplete/autocomplete.vue.d.ts +2 -2
- package/es/components/autocomplete/index.d.ts +6 -6
- package/es/components/carousel/index.d.ts +3 -3
- package/es/components/carousel/types.d.ts +1 -1
- package/es/components/carousel/use-carousel.d.ts +2 -2
- package/es/components/carousel/use-carousel.js +37 -37
- package/es/components/index.js +137 -138
- package/es/components/input-tag/input-tag.vue.d.ts +1 -1
- package/es/components/select/index.d.ts +5 -5
- package/es/components/select/select.vue.d.ts +5 -5
- package/es/components/select/select.vue2.js +1 -1
- package/es/components/select/useSelect.d.ts +4 -4
- package/es/components/super-form/component-map.d.ts +1 -34
- package/es/components/super-form/component-map.js +39 -43
- package/es/components/super-form/index.js +8 -9
- package/es/components/super-form/super-form-item.vue2.js +4 -3
- package/es/components/super-form/types.d.ts +1 -1
- package/es/components/super-form/use/helper.d.ts +1 -1
- package/es/components/super-form/use/helper.js +32 -31
- package/es/components/super-form/use/use-auto-focus.js +1 -1
- package/es/components/super-form/use/use-form-events.js +41 -40
- package/es/components/table/table.vue2.js +22 -22
- package/es/constants/index.js +10 -9
- package/es/constants/key.d.ts +34 -0
- package/es/constants/key.js +4 -2
- package/es/index.js +2 -2
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/lib/components/alert/alert.vue.d.ts +11 -1
- package/lib/components/alert/alert.vue2.cjs +1 -1
- package/lib/components/alert/index.d.ts +76 -28
- package/lib/components/autocomplete/autocomplete.vue.d.ts +2 -2
- package/lib/components/autocomplete/index.d.ts +6 -6
- package/lib/components/carousel/index.d.ts +3 -3
- package/lib/components/carousel/types.d.ts +1 -1
- package/lib/components/carousel/use-carousel.cjs +1 -1
- package/lib/components/carousel/use-carousel.d.ts +2 -2
- package/lib/components/index.cjs +1 -1
- package/lib/components/input-tag/input-tag.vue.d.ts +1 -1
- package/lib/components/select/index.d.ts +5 -5
- package/lib/components/select/select.vue.d.ts +5 -5
- package/lib/components/select/select.vue2.cjs +1 -1
- package/lib/components/select/useSelect.d.ts +4 -4
- package/lib/components/super-form/component-map.cjs +1 -1
- package/lib/components/super-form/component-map.d.ts +1 -34
- package/lib/components/super-form/index.cjs +1 -1
- package/lib/components/super-form/super-form-item.vue2.cjs +1 -1
- package/lib/components/super-form/types.d.ts +1 -1
- package/lib/components/super-form/use/helper.cjs +1 -1
- package/lib/components/super-form/use/helper.d.ts +1 -1
- package/lib/components/super-form/use/use-auto-focus.cjs +1 -1
- package/lib/components/super-form/use/use-form-events.cjs +1 -1
- package/lib/components/table/table.vue2.cjs +1 -1
- package/lib/constants/index.cjs +1 -1
- package/lib/constants/key.cjs +1 -1
- package/lib/constants/key.d.ts +34 -0
- package/lib/index.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/package.json +5 -5
- package/web-types.json +1 -1
- package/es/utils/click-out-side.d.ts +0 -3
- package/es/utils/click-out-side.js +0 -43
- package/lib/utils/click-out-side.cjs +0 -1
- package/lib/utils/click-out-side.d.ts +0 -3
|
@@ -104,9 +104,9 @@ declare const useSelect: (props: SelectV2Props, emit: any) => {
|
|
|
104
104
|
readonly strategy?: "fixed" | "absolute" | undefined;
|
|
105
105
|
readonly effect?: "light" | "dark" | undefined;
|
|
106
106
|
readonly trigger?: import("vft/es/components/tooltip").TooltipTriggerType | undefined;
|
|
107
|
+
readonly visible?: boolean | undefined;
|
|
107
108
|
readonly teleported?: boolean | undefined;
|
|
108
109
|
readonly open?: boolean | undefined;
|
|
109
|
-
readonly visible?: boolean | undefined;
|
|
110
110
|
readonly arrowOffset?: number | undefined;
|
|
111
111
|
readonly gpuAcceleration?: boolean | undefined;
|
|
112
112
|
readonly fallbackPlacements?: import("@popperjs/core").Placement[] | undefined;
|
|
@@ -522,9 +522,9 @@ declare const useSelect: (props: SelectV2Props, emit: any) => {
|
|
|
522
522
|
readonly strategy?: "fixed" | "absolute" | undefined;
|
|
523
523
|
readonly effect?: "light" | "dark" | undefined;
|
|
524
524
|
readonly trigger?: import("vft/es/components/tooltip").TooltipTriggerType | undefined;
|
|
525
|
+
readonly visible?: boolean | undefined;
|
|
525
526
|
readonly teleported?: boolean | undefined;
|
|
526
527
|
readonly open?: boolean | undefined;
|
|
527
|
-
readonly visible?: boolean | undefined;
|
|
528
528
|
readonly arrowOffset?: number | undefined;
|
|
529
529
|
readonly gpuAcceleration?: boolean | undefined;
|
|
530
530
|
readonly fallbackPlacements?: import("@popperjs/core").Placement[] | undefined;
|
|
@@ -941,9 +941,9 @@ declare const useSelect: (props: SelectV2Props, emit: any) => {
|
|
|
941
941
|
readonly strategy?: "fixed" | "absolute" | undefined;
|
|
942
942
|
readonly effect?: "light" | "dark" | undefined;
|
|
943
943
|
readonly trigger?: import("vft/es/components/tooltip").TooltipTriggerType | undefined;
|
|
944
|
+
readonly visible?: boolean | undefined;
|
|
944
945
|
readonly teleported?: boolean | undefined;
|
|
945
946
|
readonly open?: boolean | undefined;
|
|
946
|
-
readonly visible?: boolean | undefined;
|
|
947
947
|
readonly arrowOffset?: number | undefined;
|
|
948
948
|
readonly gpuAcceleration?: boolean | undefined;
|
|
949
949
|
readonly fallbackPlacements?: import("@popperjs/core").Placement[] | undefined;
|
|
@@ -1359,9 +1359,9 @@ declare const useSelect: (props: SelectV2Props, emit: any) => {
|
|
|
1359
1359
|
readonly strategy?: "fixed" | "absolute" | undefined;
|
|
1360
1360
|
readonly effect?: "light" | "dark" | undefined;
|
|
1361
1361
|
readonly trigger?: import("vft/es/components/tooltip").TooltipTriggerType | undefined;
|
|
1362
|
+
readonly visible?: boolean | undefined;
|
|
1362
1363
|
readonly teleported?: boolean | undefined;
|
|
1363
1364
|
readonly open?: boolean | undefined;
|
|
1364
|
-
readonly visible?: boolean | undefined;
|
|
1365
1365
|
readonly arrowOffset?: number | undefined;
|
|
1366
1366
|
readonly gpuAcceleration?: boolean | undefined;
|
|
1367
1367
|
readonly fallbackPlacements?: import("@popperjs/core").Placement[] | undefined;
|
|
@@ -1,38 +1,5 @@
|
|
|
1
1
|
import type { Component } from 'vue';
|
|
2
|
-
|
|
3
|
-
AUTOCOMPLETE = "autocomplete",
|
|
4
|
-
Cascader = "cascader",
|
|
5
|
-
ColorPicker = "colorPicker",
|
|
6
|
-
INPUT = "input",
|
|
7
|
-
INPUT_NUMBER = "input-number",
|
|
8
|
-
INPUT_NUMBER_STEP = "input-number-step",
|
|
9
|
-
INPUT_TAG = "input-tag",
|
|
10
|
-
PASSWORD = "password",
|
|
11
|
-
TEXTAREA = "textarea",
|
|
12
|
-
Slider = "slider",
|
|
13
|
-
DIVIDER = "divider",
|
|
14
|
-
SELECT = "select",
|
|
15
|
-
SEARCH = "search",
|
|
16
|
-
RADIO = "radio",
|
|
17
|
-
RADIO_SINGLE = "radio_single",
|
|
18
|
-
RADIO_BUTTON = "radio-button",
|
|
19
|
-
CHECKBOX = "checkbox",
|
|
20
|
-
CHECKBOX_SINGLE = "checkbox_single",
|
|
21
|
-
CHECKBOX_BUTTON = "checkbox-button",
|
|
22
|
-
SWITCH = "switch",
|
|
23
|
-
Upload = "upload",
|
|
24
|
-
TIME_PICKER = "time-picker",
|
|
25
|
-
TIMERANGE_PICKER = "time-picker",
|
|
26
|
-
YEAR_PICKER = "year",
|
|
27
|
-
MONTH_PICKER = "month",
|
|
28
|
-
DATE_PICKER = "date",
|
|
29
|
-
DATES_PICKER = "dates",
|
|
30
|
-
DATETIME_PICKER = "datetime",
|
|
31
|
-
WEEK_PICKER = "week",
|
|
32
|
-
DATETIMERANGE_PICKER = "datetimerange",
|
|
33
|
-
DATERANGE_PICKER = "daterange",
|
|
34
|
-
MONTHRANGE_PICKER = "monthrange"
|
|
35
|
-
}
|
|
2
|
+
import { FormCompEnum } from 'vft/es/constants';
|
|
36
3
|
export declare function registerComponent(compName: FormCompEnum | string, component: Component): void;
|
|
37
4
|
export declare function registerComponents(components: Record<string, Component>): void;
|
|
38
5
|
export declare function getComponent(compName: FormCompEnum): Component | undefined;
|
|
@@ -1,62 +1,58 @@
|
|
|
1
|
-
|
|
1
|
+
import { FormCompEnum as n } from "../../constants/key.js";
|
|
2
2
|
const t = /* @__PURE__ */ new Map();
|
|
3
|
-
function
|
|
4
|
-
t.set(e,
|
|
3
|
+
function R(e, E) {
|
|
4
|
+
t.set(e, E);
|
|
5
5
|
}
|
|
6
6
|
function s(e) {
|
|
7
|
-
Object.entries(e).forEach(([
|
|
8
|
-
t.set(
|
|
7
|
+
Object.entries(e).forEach(([E, o]) => {
|
|
8
|
+
t.set(E, o);
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function c(e) {
|
|
12
12
|
return t.get(e);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function C(e) {
|
|
15
15
|
t.delete(e);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function i(e) {
|
|
18
18
|
return t.has(e);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function A() {
|
|
21
21
|
return Array.from(t.keys());
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function u() {
|
|
24
24
|
t.clear();
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"daterange",
|
|
47
|
-
"monthrange"
|
|
48
|
-
/* MONTHRANGE_PICKER */
|
|
26
|
+
const I = (e) => [
|
|
27
|
+
n.DATETIMERANGE_PICKER,
|
|
28
|
+
n.DATERANGE_PICKER,
|
|
29
|
+
n.MONTHRANGE_PICKER
|
|
30
|
+
].includes(e), P = (e) => [
|
|
31
|
+
n.INPUT,
|
|
32
|
+
n.INPUT_NUMBER,
|
|
33
|
+
n.PASSWORD,
|
|
34
|
+
n.TEXTAREA,
|
|
35
|
+
n.SEARCH
|
|
36
|
+
].includes(e), T = (e) => [
|
|
37
|
+
n.YEAR_PICKER,
|
|
38
|
+
n.MONTH_PICKER,
|
|
39
|
+
n.DATE_PICKER,
|
|
40
|
+
n.DATES_PICKER,
|
|
41
|
+
n.DATETIME_PICKER,
|
|
42
|
+
n.WEEK_PICKER,
|
|
43
|
+
n.DATETIMERANGE_PICKER,
|
|
44
|
+
n.DATERANGE_PICKER,
|
|
45
|
+
n.MONTHRANGE_PICKER
|
|
49
46
|
].includes(e);
|
|
50
47
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
c as registerComponent,
|
|
48
|
+
u as clearComponents,
|
|
49
|
+
c as getComponent,
|
|
50
|
+
A as getRegisteredComponents,
|
|
51
|
+
i as hasComponent,
|
|
52
|
+
T as isDatePicker,
|
|
53
|
+
P as isInput,
|
|
54
|
+
I as isRangePicker,
|
|
55
|
+
R as registerComponent,
|
|
60
56
|
s as registerComponents,
|
|
61
|
-
|
|
57
|
+
C as removeComponent
|
|
62
58
|
};
|
|
@@ -5,23 +5,22 @@ import "vue";
|
|
|
5
5
|
import { withInstall as o } from "../../utils/vue/install.js";
|
|
6
6
|
import "lodash-es";
|
|
7
7
|
import e from "./super-form.vue2.js";
|
|
8
|
-
import {
|
|
9
|
-
import { getDynamicProps as
|
|
8
|
+
import { clearComponents as C, getComponent as c, getRegisteredComponents as l, hasComponent as u, isDatePicker as x, isInput as P, isRangePicker as d, registerComponent as h, registerComponents as k, removeComponent as D } from "./component-map.js";
|
|
9
|
+
import { getDynamicProps as I, useForm as R } from "./use/use-form.js";
|
|
10
10
|
const a = o(e);
|
|
11
11
|
export {
|
|
12
|
-
g as FormCompEnum,
|
|
13
12
|
a as VftSuperForm,
|
|
14
|
-
|
|
13
|
+
C as clearComponents,
|
|
15
14
|
a as default,
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
c as getComponent,
|
|
16
|
+
I as getDynamicProps,
|
|
18
17
|
l as getRegisteredComponents,
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
u as hasComponent,
|
|
19
|
+
x as isDatePicker,
|
|
21
20
|
P as isInput,
|
|
22
21
|
d as isRangePicker,
|
|
23
22
|
h as registerComponent,
|
|
24
23
|
k as registerComponents,
|
|
25
24
|
D as removeComponent,
|
|
26
|
-
|
|
25
|
+
R as useForm
|
|
27
26
|
};
|
|
@@ -100,6 +100,7 @@ import "../md-vue-playground/index.js";
|
|
|
100
100
|
import "../infinite-scroll/index.js";
|
|
101
101
|
import "@vueuse/core";
|
|
102
102
|
import "../config-provider/hooks/use-global-config.js";
|
|
103
|
+
import { FormCompEnum as e } from "../../constants/key.js";
|
|
103
104
|
import "lodash-es";
|
|
104
105
|
import { useNamespace as de } from "../../hooks/use-namespace/index.js";
|
|
105
106
|
import "../../hooks/use-model-toggle/index.js";
|
|
@@ -108,14 +109,14 @@ import "../../hooks/use-z-index/index.js";
|
|
|
108
109
|
import "../message/index.js";
|
|
109
110
|
import "../progress-i/index.js";
|
|
110
111
|
import "./index.js";
|
|
111
|
-
import {
|
|
112
|
+
import { getComponent as $, isInput as he, isDatePicker as Ee, isRangePicker as Pe } from "./component-map.js";
|
|
112
113
|
import { createPlaceholderMessage as Y } from "./use/helper.js";
|
|
113
114
|
function q(o) {
|
|
114
115
|
return typeof o == "function" || Object.prototype.toString.call(o) === "[object Object]" && !le(o);
|
|
115
116
|
}
|
|
116
117
|
const Ce = Q({
|
|
117
118
|
inheritAttrs: !1
|
|
118
|
-
}),
|
|
119
|
+
}), yr = /* @__PURE__ */ Q({
|
|
119
120
|
...Ce,
|
|
120
121
|
__name: "super-form-item",
|
|
121
122
|
props: {
|
|
@@ -492,5 +493,5 @@ const Ce = Q({
|
|
|
492
493
|
}
|
|
493
494
|
});
|
|
494
495
|
export {
|
|
495
|
-
|
|
496
|
+
yr as default
|
|
496
497
|
};
|
|
@@ -9,7 +9,7 @@ import type { InternalRuleItem, RuleItem } from 'async-validator';
|
|
|
9
9
|
import type { ComponentPublicInstance, Ref, StyleValue, VNode } from 'vue';
|
|
10
10
|
import type { Arrayable } from 'vft/es/utils';
|
|
11
11
|
import type { Recordable } from '../types';
|
|
12
|
-
import { FormCompEnum } from '
|
|
12
|
+
import { FormCompEnum } from 'vft/es/constants';
|
|
13
13
|
/** 按钮配置选项 */
|
|
14
14
|
export type ButtonOptions = Partial<ButtonProps> & {
|
|
15
15
|
btnText?: string;
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
import { isNumber as n } from "@vft/utils";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { isInput as u } from "../component-map.js";
|
|
3
|
+
import { FormCompEnum as r } from "../../../constants/key.js";
|
|
4
|
+
function s(e, E = "") {
|
|
4
5
|
return E = (E || "").replace(":", "") || "", [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
].includes(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
].includes(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
].includes(
|
|
6
|
+
r.INPUT,
|
|
7
|
+
r.INPUT_NUMBER,
|
|
8
|
+
r.TEXTAREA,
|
|
9
|
+
r.AUTOCOMPLETE
|
|
10
|
+
].includes(e) ? "请输入" + E : [r.PASSWORD].includes(e) ? "请输入密码" : [
|
|
11
|
+
r.SELECT,
|
|
12
|
+
r.RADIO,
|
|
13
|
+
r.RADIO_SINGLE,
|
|
14
|
+
r.RADIO_BUTTON,
|
|
15
|
+
r.Cascader,
|
|
16
|
+
r.ColorPicker,
|
|
17
|
+
r.CHECKBOX,
|
|
18
|
+
r.CHECKBOX_BUTTON
|
|
19
|
+
].includes(e) ? "请选择" + E : [r.CHECKBOX_SINGLE].includes(e) ? "请勾选" + E : [r.SEARCH].includes(e) ? "请输入要搜索的内容" : [r.INPUT_TAG].includes(e) ? "请输入标签内容" : [r.Upload].includes(e) ? "请选择上传文件" : [r.Slider].includes(e) ? "请拖动滑块" : [
|
|
20
|
+
r.TIME_PICKER,
|
|
21
|
+
r.YEAR_PICKER,
|
|
22
|
+
r.MONTH_PICKER,
|
|
23
|
+
r.DATE_PICKER,
|
|
24
|
+
r.DATES_PICKER,
|
|
25
|
+
r.DATETIME_PICKER,
|
|
26
|
+
r.WEEK_PICKER,
|
|
27
|
+
r.DATETIMERANGE_PICKER,
|
|
28
|
+
r.DATERANGE_PICKER,
|
|
29
|
+
r.MONTHRANGE_PICKER
|
|
30
|
+
].includes(e) ? "请选择时间" : "";
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
32
|
+
function C(e, E) {
|
|
33
|
+
return e && u(e) && E && n(E) ? `${E}` : E;
|
|
33
34
|
}
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
s as createPlaceholderMessage,
|
|
37
|
+
C as handleInputNumberValue
|
|
37
38
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { isDef as H, isFunction as j, isString as A, isObject as V, isArray as I, deepMerge as nt, findDifferentValuesForObj as rt, isNullOrUndefined as J, isEmpty as st, isEmptyObject as lt } from "@vft/utils";
|
|
2
2
|
import { formatToDate as Q } from "@vft/utils/date";
|
|
3
|
-
import { get as ot, cloneDeep as m, uniqBy as at, isEqual as
|
|
3
|
+
import { get as ot, cloneDeep as m, uniqBy as at, isEqual as ft, set as X } from "lodash-es";
|
|
4
4
|
import { unref as n, toRaw as x, nextTick as W } from "vue";
|
|
5
|
-
import {
|
|
5
|
+
import { FormCompEnum as S } from "../../../constants/key.js";
|
|
6
|
+
import { isInput as ct, isDatePicker as ut } from "../component-map.js";
|
|
6
7
|
import { handleInputNumberValue as dt } from "./helper.js";
|
|
7
8
|
function _(h, y) {
|
|
8
|
-
const { show: o, ifShow:
|
|
9
|
-
let p = !0,
|
|
9
|
+
const { show: o, ifShow: f } = h;
|
|
10
|
+
let p = !0, c = !0;
|
|
10
11
|
return typeof o == "boolean" ? p = o : typeof o == "function" && (p = o({
|
|
11
12
|
field: h.field,
|
|
12
13
|
model: y,
|
|
@@ -14,52 +15,52 @@ function _(h, y) {
|
|
|
14
15
|
...y
|
|
15
16
|
},
|
|
16
17
|
schema: h
|
|
17
|
-
})), typeof
|
|
18
|
+
})), typeof f == "boolean" ? c = f : typeof f == "function" && (c = f({
|
|
18
19
|
field: h.field,
|
|
19
20
|
model: y,
|
|
20
21
|
values: {
|
|
21
22
|
...y
|
|
22
23
|
},
|
|
23
24
|
schema: h
|
|
24
|
-
})), p &&
|
|
25
|
+
})), p && c;
|
|
25
26
|
}
|
|
26
27
|
function ht(h, y = {}) {
|
|
27
28
|
const o = /^\[(.+)\]$/;
|
|
28
29
|
if (o.test(h)) {
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
const p =
|
|
30
|
+
const f = h.match(o);
|
|
31
|
+
if (f && f[1]) {
|
|
32
|
+
const p = f[1].split(",");
|
|
32
33
|
if (!p.length)
|
|
33
34
|
return;
|
|
34
|
-
const
|
|
35
|
+
const c = [];
|
|
35
36
|
return p.forEach((F, B) => {
|
|
36
|
-
X(
|
|
37
|
-
}),
|
|
37
|
+
X(c, B, y[F.trim()]);
|
|
38
|
+
}), c.filter(Boolean).length ? c : void 0;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
function pt(h, y = {}) {
|
|
42
43
|
const o = /^\{(.+)\}$/;
|
|
43
44
|
if (o.test(h)) {
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
const p =
|
|
45
|
+
const f = h.match(o);
|
|
46
|
+
if (f && f[1]) {
|
|
47
|
+
const p = f[1].split(",");
|
|
47
48
|
if (!p.length)
|
|
48
49
|
return;
|
|
49
|
-
const
|
|
50
|
+
const c = {};
|
|
50
51
|
return p.forEach((F) => {
|
|
51
|
-
X(
|
|
52
|
-
}), Object.values(
|
|
52
|
+
X(c, F.trim(), y[F.trim()]);
|
|
53
|
+
}), Object.values(c).filter(Boolean).length ? c : void 0;
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
function
|
|
57
|
+
function Vt({
|
|
57
58
|
emit: h,
|
|
58
59
|
getProps: y,
|
|
59
60
|
formModel: o,
|
|
60
|
-
getSchema:
|
|
61
|
+
getSchema: f,
|
|
61
62
|
defaultValueRef: p,
|
|
62
|
-
formElRef:
|
|
63
|
+
formElRef: c,
|
|
63
64
|
schemaRef: F,
|
|
64
65
|
handleFormValues: B,
|
|
65
66
|
initValues: T
|
|
@@ -67,22 +68,22 @@ function Et({
|
|
|
67
68
|
async function Y(t) {
|
|
68
69
|
const { resetFunc: e, submitOnReset: s } = n(y);
|
|
69
70
|
e && j(e) && await e();
|
|
70
|
-
const r = n(
|
|
71
|
+
const r = n(c);
|
|
71
72
|
if (r) {
|
|
72
73
|
if (t?.length)
|
|
73
74
|
return r.resetFields(t);
|
|
74
75
|
Object.keys(o).forEach((a) => {
|
|
75
|
-
const l = n(
|
|
76
|
-
o[a] =
|
|
76
|
+
const l = n(f).find((u) => u.field === a), i = m(p.value[a]);
|
|
77
|
+
o[a] = ct(l?.type) ? i || "" : i;
|
|
77
78
|
}), W(() => D()), h("reset", x(o)), s && await U();
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
async function q(t, e = !0) {
|
|
81
|
-
const s = n(
|
|
82
|
+
const s = n(f).map((i) => i.field).filter(Boolean), r = ".", a = s.filter(
|
|
82
83
|
(i) => String(i).indexOf(r) >= 0
|
|
83
84
|
), l = [];
|
|
84
85
|
s.forEach((i) => {
|
|
85
|
-
const u = n(
|
|
86
|
+
const u = n(f).find((d) => d.field === i);
|
|
86
87
|
let b = ot(t, i);
|
|
87
88
|
const C = Reflect.has(t, i);
|
|
88
89
|
b = dt(u?.type, b);
|
|
@@ -120,7 +121,7 @@ function Et({
|
|
|
120
121
|
});
|
|
121
122
|
}
|
|
122
123
|
async function Z(t) {
|
|
123
|
-
const e = m(n(
|
|
124
|
+
const e = m(n(f));
|
|
124
125
|
if (!t)
|
|
125
126
|
return;
|
|
126
127
|
let s = A(t) ? [t] : t;
|
|
@@ -136,7 +137,7 @@ function Et({
|
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
async function K(t, e, s = !1) {
|
|
139
|
-
const r = m(n(
|
|
140
|
+
const r = m(n(f)), a = r.findIndex((i) => i.field === e), l = V(t) ? [t] : t;
|
|
140
141
|
if (!e || a === -1 || s) {
|
|
141
142
|
s ? r.unshift(...l) : r.push(...l), F.value = r, O(t);
|
|
142
143
|
return;
|
|
@@ -166,7 +167,7 @@ function Et({
|
|
|
166
167
|
return;
|
|
167
168
|
}
|
|
168
169
|
const r = [], a = [];
|
|
169
|
-
n(
|
|
170
|
+
n(f).forEach((l) => {
|
|
170
171
|
let i;
|
|
171
172
|
if (e.forEach((u) => {
|
|
172
173
|
l.field === u.field && (i = u), u.defaultValue && u.field && r.push(u.field);
|
|
@@ -188,36 +189,36 @@ function Et({
|
|
|
188
189
|
}), lt(a) || q(a, s);
|
|
189
190
|
}
|
|
190
191
|
function g(t = !1) {
|
|
191
|
-
if (!n(
|
|
192
|
+
if (!n(c)) return {};
|
|
192
193
|
const s = B(x(n(o)));
|
|
193
194
|
if (t)
|
|
194
195
|
return s;
|
|
195
|
-
const r = n(
|
|
196
|
+
const r = n(f).filter((l) => _(l, n(o))).map((l) => l.field).filter(Boolean), a = {};
|
|
196
197
|
return r.forEach((l) => {
|
|
197
198
|
l in s && (a[l] = s[l]);
|
|
198
199
|
}), a;
|
|
199
200
|
}
|
|
200
201
|
function k(t) {
|
|
201
|
-
return n(
|
|
202
|
+
return n(c) ? x(n(o))[t] : {};
|
|
202
203
|
}
|
|
203
204
|
function M(t) {
|
|
204
|
-
return n(
|
|
205
|
+
return n(f).some((e) => e.field === t ? ut(e.type) : !1);
|
|
205
206
|
}
|
|
206
207
|
async function $(t) {
|
|
207
|
-
return t || (t = n(
|
|
208
|
+
return t || (t = n(f).filter((s) => _(s, n(o))).map((s) => s.field).filter(Boolean)), n(c)?.validateField(t);
|
|
208
209
|
}
|
|
209
210
|
async function P(t) {
|
|
210
|
-
return t || (t = n(
|
|
211
|
+
return t || (t = n(f).filter((s) => _(s, n(o))).map((s) => s.field).filter(Boolean)), await n(c)?.validate(t, () => {
|
|
211
212
|
});
|
|
212
213
|
}
|
|
213
214
|
async function D(t) {
|
|
214
|
-
await n(
|
|
215
|
+
await n(c)?.clearValidate(t);
|
|
215
216
|
}
|
|
216
217
|
async function tt(t, e) {
|
|
217
218
|
await D(t), await N([{ field: t, itemProps: { error: e } }]);
|
|
218
219
|
}
|
|
219
220
|
async function et(t, e) {
|
|
220
|
-
await n(
|
|
221
|
+
await n(c)?.scrollToField(t, e);
|
|
221
222
|
}
|
|
222
223
|
async function U(t) {
|
|
223
224
|
const { autoCleanErrorMessage: e, watchDataIsChange: s } = n(y);
|
|
@@ -227,13 +228,13 @@ function Et({
|
|
|
227
228
|
await r();
|
|
228
229
|
return;
|
|
229
230
|
}
|
|
230
|
-
if (n(
|
|
231
|
+
if (n(c))
|
|
231
232
|
try {
|
|
232
233
|
if (!await P())
|
|
233
234
|
return;
|
|
234
235
|
const u = g();
|
|
235
236
|
if (s) {
|
|
236
|
-
const b =
|
|
237
|
+
const b = ft(T.value, u), C = rt(T.value, u);
|
|
237
238
|
h("submit", u, !b, C);
|
|
238
239
|
} else
|
|
239
240
|
h("submit", u);
|
|
@@ -261,5 +262,5 @@ function Et({
|
|
|
261
262
|
};
|
|
262
263
|
}
|
|
263
264
|
export {
|
|
264
|
-
|
|
265
|
+
Vt as useFormEvents
|
|
265
266
|
};
|