@web-utils/form-ui 1.0.0-beta82 → 1.0.0-beta83

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.
@@ -9,7 +9,7 @@ import { t as s } from "./CI0pkCeM.mjs";
9
9
  import { t as c } from "./BXnK2ccC.mjs";
10
10
  import { t as l } from "./CrFP0Lhs.mjs";
11
11
  import { t as u } from "./CDZvVLNL.mjs";
12
- import { t as d } from "./CgAtZ1l2.mjs";
12
+ import { t as d } from "./Bsu6--Di.mjs";
13
13
  import { t as f } from "./BQ7zKN-6.mjs";
14
14
  import { t as p } from "./fh36J3y1.mjs";
15
15
  import { t as m } from "./BiY3yiiP2.mjs";
@@ -0,0 +1,63 @@
1
+ import { allProps as e, predicate as t } from "../props/date.mjs";
2
+ import { n, o as r } from "./DzCIClcZ.mjs";
3
+ import { ElDatePicker as i, useLocale as a } from "element-plus/es";
4
+ import "element-plus/es/components/base/style/css";
5
+ import { computed as o, createVNode as s, mergeProps as c } from "vue";
6
+ import "element-plus/es/components/date-picker/style/css";
7
+ import { toDate as l } from "@web-utils/integrations/dayjs";
8
+ //#endregion
9
+ //#region src/components/form/FormDatePicker.vue
10
+ var u = {
11
+ name: "FormDatePicker",
12
+ inheritAttrs: !1,
13
+ props: { ...e },
14
+ emits: {
15
+ ...n,
16
+ "update:startDate": null,
17
+ "update:endDate": null
18
+ },
19
+ setup(e, { emit: n, slots: u, attrs: d }) {
20
+ let { emitInput: f, render: p, placeholder: m, disabled: h, listeners: g, inputProps: _ } = r(e, {
21
+ emit: n,
22
+ slots: u,
23
+ attrs: d,
24
+ predicate: t,
25
+ messagePrefix: "请选择"
26
+ }), v = a();
27
+ console.log(v.locale.value.el);
28
+ let y = o(() => e.dateTimeRange || e.dateRange || e.monthRange), b = o(() => e.year ? "YYYY" : e.month || e.monthRange ? "YYYY-MM" : e.week ? "YYYY 第 WW 周" : e.dateTime || e.dateTimeRange ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD"), x = o(() => e.year ? "year" : e.month ? "month" : e.dates ? "dates" : e.week ? "week" : e.dateTime ? "datetime" : e.dateTimeRange ? "datetimerange" : e.dateRange ? "daterange" : e.monthRange ? "monthrange" : "date"), S = o(() => {
29
+ if (e.miniDate) {
30
+ let t = l(e.miniDate);
31
+ return t.setDate(t.getDate() - 1), t;
32
+ } else return null;
33
+ }), C = o(() => e.maxDate ? l(e.maxDate) : null), w = (e) => {
34
+ if (!S.value && !C.value) return !1;
35
+ let t = e.getTime();
36
+ return S.value && !C.value ? t <= S.value.getTime() : !S.value && C.value ? t >= C.value.getTime() : S.value && C.value ? !(t > S.value.getTime() && t <= C.value.getTime()) : !1;
37
+ }, T = (e, t) => {
38
+ n("update:startDate", e), n("update:endDate", t);
39
+ }, E = (t) => {
40
+ y.value && e.split ? t ? T(t[0], t[1]) : T(null, null) : f(t);
41
+ }, D = o(() => y.value && e.split ? [e.startDate, e.endDate] : e.modelValue), O = o(() => e.week ? "YYYY-MM-DD" : e.valueFormat || b.value), k = o(() => e.format || b.value);
42
+ return () => p({ vNodes: s(i, c(g.value, _.value, {
43
+ style: "width: 100%",
44
+ type: x.value,
45
+ modelValue: D.value,
46
+ disabled: h.value,
47
+ placeholder: m.value,
48
+ format: k.value,
49
+ disabledDate: w,
50
+ "value-format": O.value,
51
+ "onUpdate:modelValue": E
52
+ }), {
53
+ default: u.default,
54
+ "range-separator": u["range-separator"],
55
+ "pre-month": u["pre-month"],
56
+ "next-month": u["next-month"],
57
+ "pre-year": u["pre-year"],
58
+ "next-year": u["next-year"]
59
+ }) });
60
+ }
61
+ };
62
+ //#endregion
63
+ export { u as t };
@@ -2,7 +2,7 @@ import { i as e } from "./ClVh1Lek.mjs";
2
2
  import { commonAutoBindProps as t, commonManualBindProps as n } from "../props/common.mjs";
3
3
  import { n as r, o as i } from "./DzCIClcZ.mjs";
4
4
  import { n as a } from "./CrFP0Lhs.mjs";
5
- import { n as o, t as s } from "./BizQp-6k2.mjs";
5
+ import { n as o, t as s } from "./BOHHK03q2.mjs";
6
6
  import { computed as c, createVNode as l, getCurrentInstance as u, mergeProps as d, useModel as f, useTemplateRef as p } from "vue";
7
7
  import { isArray as m, isString as h, trace as g, warning as _ } from "@web-utils/core";
8
8
  import { useEventBus as v } from "@web-utils/vue/hooks/useEventBus";
@@ -0,0 +1,111 @@
1
+ import { m as e } from "./ClVh1Lek.mjs";
2
+ import { formHolderContextKey as t, formViewContextKey as n } from "../constants/index.mjs";
3
+ import { allProps as r, predicate as i } from "../props/form.mjs";
4
+ import a from "../form-advice/index.mjs";
5
+ import o from "../form-red-table/index.mjs";
6
+ import { ElForm as s, ElRow as c, useLocale as l } from "element-plus/es";
7
+ import "element-plus/es/components/base/style/css";
8
+ import { computed as u, createVNode as d, inject as f, mergeProps as p, nextTick as m, provide as h, reactive as g, toRef as _, useTemplateRef as v } from "vue";
9
+ import { animate as y } from "@web-utils/core";
10
+ import "element-plus/es/components/row/style/css";
11
+ import "element-plus/es/components/form/style/css";
12
+ //#endregion
13
+ //#region src/components/form/FormHolder.vue
14
+ var b = {
15
+ name: "FormHolder",
16
+ inheritAttrs: !1,
17
+ props: { ...r },
18
+ emits: {},
19
+ setup(r, { slots: b, expose: x, attrs: S }) {
20
+ let { autoBindProps: C, listeners: w } = e(r, { predicate: i }), T = l();
21
+ console.log(T.locale.value.el);
22
+ let E = f(n, null), D = v("form"), O = u(() => r.notTableForm === void 0 ? (E == null ? void 0 : E.tableForm) === void 0 ? !1 : E == null ? void 0 : E.tableForm : !r.notTableForm), k = u(() => O.value ? !1 : r.showMessage), A = u(() => {
23
+ let e = {};
24
+ return r.disabledFields && r.disabledFields.forEach((t) => {
25
+ e[t] = !0;
26
+ }), e;
27
+ }), j = u(() => {
28
+ let e = {};
29
+ return r.enabledFields && r.enabledFields.length && r.enabledFields.forEach((t) => {
30
+ e[t] = !0;
31
+ }), e;
32
+ }), M = u(() => {
33
+ let e = {};
34
+ return r.requiredFields && r.requiredFields.length && r.requiredFields.forEach((t) => {
35
+ e[t] = !0;
36
+ }), e;
37
+ }), N = u(() => r.disabled === !0 ? !0 : r.disabled), P = _(() => r.enabledFields), F = _(() => r.requiredFields), I = _(() => r.disabledFields), L = async () => {
38
+ await m();
39
+ let e = D.value.$el.querySelector(".el-form-item.is-error");
40
+ e && e.scrollIntoView({
41
+ block: "center",
42
+ inline: "center",
43
+ behavior: "smooth"
44
+ });
45
+ }, R = g({
46
+ tableForm: O,
47
+ disabled: N,
48
+ enabledFields: P,
49
+ requiredFields: F,
50
+ enabledFieldsMap: j,
51
+ disabledFieldsMap: A,
52
+ requiredFieldsMap: M,
53
+ disabledFields: I,
54
+ scrollIntoRequiredField: L,
55
+ formRef: D,
56
+ validate: async () => {
57
+ try {
58
+ return await D.value.validate();
59
+ } catch {
60
+ throw await L(), D.value.$el.querySelectorAll(".el-form-item.is-error .el-form-item__content > :first-child").forEach((e) => {
61
+ y(e, "breathe-animation");
62
+ }), Error("表单验证不通过!");
63
+ }
64
+ },
65
+ validateField: (e) => D.value.validateField(e),
66
+ resetFields: (e) => D.value.resetFields(e),
67
+ scrollToField: (e) => D.value.scrollToField(e),
68
+ clearValidate: (e) => D.value.clearValidate(e),
69
+ getField: () => D.value.getField(),
70
+ setInitialValues: (e) => D.value.setInitialValues(e),
71
+ getFields: () => D.value.fields
72
+ });
73
+ return h(t, R), x(R), () => d(s, p(w.value, C.value, S, {
74
+ ref: "form",
75
+ class: [
76
+ "form-holder",
77
+ "clear-fix",
78
+ { "red-form": O }
79
+ ],
80
+ "show-message": k.value
81
+ }), { default: () => {
82
+ if (O.value) {
83
+ var e, t, n;
84
+ return [
85
+ (e = b.top) == null ? void 0 : e.call(b),
86
+ d(o, {
87
+ class: { "hide-error-message": O.value },
88
+ columns: r.columns,
89
+ "col-count": r.colCount
90
+ }, { default: () => {
91
+ var e;
92
+ return [(e = b.default) == null ? void 0 : e.call(b), r.showAdvice ? d(a, {
93
+ "label-colspan": r.commentLabelColspan,
94
+ "value-colspan": r.commentValueColspan
95
+ }, null) : null];
96
+ } }),
97
+ (t = b.bottom) == null ? void 0 : t.call(b),
98
+ d("div", { class: "red-form-footer" }, [(n = b.footer) == null ? void 0 : n.call(b)])
99
+ ];
100
+ } else {
101
+ var i;
102
+ return r.wrapRow ? d(c, null, { default: () => {
103
+ var e;
104
+ return [(e = b.default) == null ? void 0 : e.call(b)];
105
+ } }) : (i = b.default) == null ? void 0 : i.call(b);
106
+ }
107
+ } });
108
+ }
109
+ };
110
+ //#endregion
111
+ export { b as t };
@@ -6,7 +6,7 @@ import { n as i } from "./DzCIClcZ.mjs";
6
6
  import { t as a } from "./CI0pkCeM.mjs";
7
7
  import { t as o } from "./CrFP0Lhs.mjs";
8
8
  import { t as s } from "./CDZvVLNL.mjs";
9
- import { t as c } from "./CgAtZ1l2.mjs";
9
+ import { t as c } from "./Bsu6--Di.mjs";
10
10
  import { t as l } from "./BQ7zKN-6.mjs";
11
11
  import { t as u } from "./fh36J3y1.mjs";
12
12
  import { t as d } from "./BiY3yiiP2.mjs";
@@ -1,6 +1,6 @@
1
1
  import { commonAutoBindProps as e, commonManualBindProps as t } from "../props/common.mjs";
2
2
  import { n, o as r } from "./DzCIClcZ.mjs";
3
- import { n as i, t as a } from "./Brbt5iil2.mjs";
3
+ import { n as i, t as a } from "./DpspbJVm2.mjs";
4
4
  import { createVNode as o, mergeProps as s, ref as c, useModel as l } from "vue";
5
5
  //#region src/components/table/form-table.ts
6
6
  var u = {
@@ -1,2 +1,2 @@
1
- import { t as e } from "../chunks/CgAtZ1l2.mjs";
1
+ import { t as e } from "../chunks/Bsu6--Di.mjs";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../chunks/BhHMGhJ8.mjs";
1
+ import { t as e } from "../chunks/CumZF9e-.mjs";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../chunks/DQFvmw1w2.mjs";
1
+ import { t as e } from "../chunks/ZCIAKVNm2.mjs";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../chunks/P7ZAhYlk2.mjs";
1
+ import { t as e } from "../chunks/BtNMd8g52.mjs";
2
2
  export { e as default };
package/index.mjs CHANGED
@@ -54,9 +54,9 @@ import Y from "./form-cell/index.mjs";
54
54
  import { t as X } from "./chunks/BXnK2ccC.mjs";
55
55
  import { t as Z } from "./chunks/CrFP0Lhs.mjs";
56
56
  import { t as re } from "./chunks/CDZvVLNL.mjs";
57
- import { t as ie } from "./chunks/CgAtZ1l2.mjs";
57
+ import { t as ie } from "./chunks/Bsu6--Di.mjs";
58
58
  import ae from "./form-red-table/index.mjs";
59
- import { t as oe } from "./chunks/BhHMGhJ8.mjs";
59
+ import { t as oe } from "./chunks/CumZF9e-.mjs";
60
60
  import { t as se } from "./chunks/CaY7oZQ3.mjs";
61
61
  import { t as ce } from "./chunks/tVHVSu5h.mjs";
62
62
  import { t as le } from "./chunks/LivIWUWt.mjs";
@@ -77,10 +77,10 @@ import { t as Se } from "./chunks/DK4GzYEk2.mjs";
77
77
  import { t as Ce } from "./chunks/mm9J6HEd2.mjs";
78
78
  import we from "./table-column-def/index.mjs";
79
79
  import { t as Te } from "./chunks/DNaB9zOb2.mjs";
80
- import { t as Ee } from "./chunks/Brbt5iil2.mjs";
81
- import { t as De } from "./chunks/DQFvmw1w2.mjs";
82
- import { t as Oe } from "./chunks/BizQp-6k2.mjs";
83
- import { t as ke } from "./chunks/P7ZAhYlk2.mjs";
80
+ import { t as Ee } from "./chunks/DpspbJVm2.mjs";
81
+ import { t as De } from "./chunks/ZCIAKVNm2.mjs";
82
+ import { t as Oe } from "./chunks/BOHHK03q2.mjs";
83
+ import { t as ke } from "./chunks/BtNMd8g52.mjs";
84
84
  import { t as Ae } from "./chunks/DIMxdcyy2.mjs";
85
85
  import { t as je } from "./chunks/B7vR8-_Y2.mjs";
86
86
  import { t as Me } from "./chunks/FZqu01np2.mjs";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@web-utils/form-ui",
3
3
  "description": "form-ui",
4
- "version": "1.0.0-beta82",
4
+ "version": "1.0.0-beta83",
5
5
  "author": "Simple",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -1,2 +1,2 @@
1
- import { t as e } from "../chunks/Brbt5iil2.mjs";
1
+ import { t as e } from "../chunks/DpspbJVm2.mjs";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../chunks/BizQp-6k2.mjs";
1
+ import { t as e } from "../chunks/BOHHK03q2.mjs";
2
2
  export { e as default };