@vrojs/element-plus 0.0.3 → 0.0.4

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.
Files changed (41) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +85 -78
  3. package/dist/vro-el-image/index.d.ts +207 -0
  4. package/dist/vro-el-image/index.js +12 -0
  5. package/dist/vro-el-image/style/css.d.ts +0 -0
  6. package/dist/vro-el-image/style/css.js +3 -0
  7. package/dist/vro-el-image/style/deps.d.ts +0 -0
  8. package/dist/vro-el-image/style/deps.js +1 -0
  9. package/dist/vro-el-image/style/index.d.ts +0 -0
  10. package/dist/vro-el-image/style/index.js +4 -0
  11. package/dist/vro-el-image/types.d.ts +54 -0
  12. package/dist/vro-el-image/types.js +15 -0
  13. package/dist/vro-el-image/utils.d.ts +2 -0
  14. package/dist/vro-el-image/utils.js +6 -0
  15. package/dist/vro-el-image/vro-el-image.vue.d.ts +122 -0
  16. package/dist/vro-el-image/vro-el-image.vue.js +32 -0
  17. package/dist/vro-el-image/vro-el-image.vue2.js +4 -0
  18. package/dist/vro-el-image-upload/index.d.ts +7 -7
  19. package/dist/vro-el-image-upload/style/css.js +1 -0
  20. package/dist/vro-el-image-upload/style/deps.js +1 -1
  21. package/dist/vro-el-image-upload/style/index.js +2 -1
  22. package/dist/vro-el-image-upload/types.d.ts +9 -7
  23. package/dist/vro-el-image-upload/types.js +2 -2
  24. package/dist/vro-el-image-upload/vro-el-image-upload.vue.d.ts +10 -9
  25. package/dist/vro-el-image-upload/vro-el-image-upload.vue.js +81 -75
  26. package/dist/vro-el-schema-filter/index.d.ts +1 -3
  27. package/dist/vro-el-schema-filter/style/css.js +1 -0
  28. package/dist/vro-el-schema-filter/style/index.js +1 -0
  29. package/dist/vro-el-schema-filter/vro-el-schema-filter.vue.d.ts +2 -6
  30. package/dist/vro-el-schema-form/index.d.ts +1 -3
  31. package/dist/vro-el-schema-form/style/css.js +1 -0
  32. package/dist/vro-el-schema-form/style/index.js +1 -0
  33. package/dist/vro-el-schema-form/types.d.ts +8 -0
  34. package/dist/vro-el-schema-form/useVroElSchemaForm.d.ts +2 -6
  35. package/dist/vro-el-schema-form/vro-el-schema-form.vue.d.ts +1 -3
  36. package/dist/vro-el-schema-form/vro-el-schema-form.vue.js +82 -75
  37. package/dist/vro-el-schema-form-dialog/index.d.ts +4 -12
  38. package/dist/vro-el-schema-form-dialog/style/css.js +1 -0
  39. package/dist/vro-el-schema-form-dialog/style/index.js +1 -0
  40. package/dist/vro-el-schema-form-dialog/vro-el-schema-form-dialog.vue.d.ts +3 -9
  41. package/package.json +3 -3
@@ -46,6 +46,14 @@ export interface VroElSchemaFormSchemaField {
46
46
  * 当前字段表单项配置,会与组件级 formItemProps 合并。
47
47
  */
48
48
  formItemProps?: Partial<FormItemProps>;
49
+ /**
50
+ * 转发给 ElFormItem 的插槽映射,key 为外部插槽名,value 为 ElFormItem 插槽名。
51
+ */
52
+ itemSlots?: Record<string, string>;
53
+ /**
54
+ * 转发给字段组件的插槽映射,key 为外部插槽名,value 为字段组件插槽名。
55
+ */
56
+ slots?: Record<string, string>;
49
57
  /**
50
58
  * 从字段值转换提交值。
51
59
  */
@@ -451,9 +451,7 @@ export declare function useVroElSchemaForm<T extends Record<string, any> = Recor
451
451
  extractValues: () => Promise<Record<string, any>>;
452
452
  validateField: (key: string) => Promise<boolean | undefined>;
453
453
  }> & {} & import('vue').ComponentCustomProperties & {} & {
454
- $slots: Partial<Record<number, (_: {
455
- item: import('./types').VroElSchemaFormSchemaField;
456
- }) => any>> & {
454
+ $slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
457
455
  default?(_: {}): any;
458
456
  };
459
457
  }) | undefined, ({
@@ -897,9 +895,7 @@ export declare function useVroElSchemaForm<T extends Record<string, any> = Recor
897
895
  extractValues: () => Promise<Record<string, any>>;
898
896
  validateField: (key: string) => Promise<boolean | undefined>;
899
897
  }> & {} & import('vue').ComponentCustomProperties & {} & {
900
- $slots: Partial<Record<number, (_: {
901
- item: import('./types').VroElSchemaFormSchemaField;
902
- }) => any>> & {
898
+ $slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
903
899
  default?(_: {}): any;
904
900
  };
905
901
  }) | undefined>;
@@ -1,9 +1,7 @@
1
1
  import { VroElSchemaFormSchema } from './types';
2
2
  declare function __VLS_template(): {
3
3
  attrs: Partial<{}>;
4
- slots: Partial<Record<number, (_: {
5
- item: import('./types').VroElSchemaFormSchemaField;
6
- }) => any>> & {
4
+ slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
7
5
  default?(_: {}): any;
8
6
  };
9
7
  refs: {
@@ -1,112 +1,119 @@
1
- import { defineComponent as N, computed as b, ref as F, watchEffect as q, useTemplateRef as w, createBlock as P, openBlock as d, unref as v, mergeProps as c, withCtx as u, createVNode as I, createElementBlock as z, renderSlot as S, Fragment as A, renderList as B, resolveDynamicComponent as G, createSlots as H } from "vue";
2
- import J from "@daysnap/banana";
3
- import { isFunction as i, isString as O, filterEmptyValue as Q } from "@daysnap/utils";
4
- import { ElForm as W, ElRow as X, ElCol as Y, ElFormItem as Z } from "element-plus";
5
- import { useLocale as k } from "../locale/useLocale.js";
6
- import { datePickerValueFormat as ee } from "../utils/datePickerValueFormat.js";
7
- import "@vrojs/base";
8
- import { defineVroElSchemaFormFieldTrigger as re } from "./defineVroElSchemaFormFieldTrigger.js";
9
- import { vroElSchemaFormProps as ae } from "./types.js";
10
- import { vroElSchemaFormFieldManager as oe } from "./vroElSchemaFormFieldManager.js";
11
- const de = /* @__PURE__ */ N({
1
+ import { defineComponent as z, computed as S, ref as F, watchEffect as A, useTemplateRef as I, createBlock as P, openBlock as h, unref as u, mergeProps as m, withCtx as c, createVNode as B, createElementBlock as G, renderSlot as E, Fragment as H, renderList as _, createSlots as O, resolveDynamicComponent as J } from "vue";
2
+ import Q from "@daysnap/banana";
3
+ import { isFunction as p, isString as R, filterEmptyValue as W } from "@daysnap/utils";
4
+ import { getSlotEntries as j } from "@vrojs/base";
5
+ import { ElForm as X, ElRow as Y, ElCol as Z, ElFormItem as k } from "element-plus";
6
+ import { useLocale as ee } from "../locale/useLocale.js";
7
+ import { datePickerValueFormat as re } from "../utils/datePickerValueFormat.js";
8
+ import { defineVroElSchemaFormFieldTrigger as ae } from "./defineVroElSchemaFormFieldTrigger.js";
9
+ import { vroElSchemaFormProps as oe } from "./types.js";
10
+ import { vroElSchemaFormFieldManager as te } from "./vroElSchemaFormFieldManager.js";
11
+ const ve = /* @__PURE__ */ z({
12
12
  name: "VroElSchemaForm",
13
13
  __name: "vro-el-schema-form",
14
- props: ae,
14
+ props: oe,
15
15
  emits: ["change-field", "input-field"],
16
- setup(R, { expose: j, emit: x }) {
17
- const E = x, l = R, D = b(() => ({
16
+ setup(D, { expose: $, emit: x }) {
17
+ const C = x, l = D, y = S(() => ({
18
18
  validateOnRuleChange: !1,
19
19
  ...l.formProps
20
- })), { locale: y } = k(), s = F({}), C = F({}), f = F({});
21
- q(() => {
20
+ })), { locale: K } = ee(), i = F({}), V = F({}), d = F({});
21
+ A(() => {
22
22
  const { schema: e } = l;
23
- f.value = {}, Object.entries(e).forEach(([o, r]) => {
24
- let { hidden: a, value: t, rules: m, is: h } = r;
25
- i(a) && (a = a(t, r, e)), h || (a = !0), a || (C.value[o] = t, f.value[o] = r), i(s) && (s.value = s(t, r, e)), s.value[o] = m;
23
+ d.value = {}, Object.entries(e).forEach(([t, r]) => {
24
+ let { hidden: a, value: o, rules: s, is: n } = r;
25
+ p(a) && (a = a(o, r, e)), n || (a = !0), a || (V.value[t] = o, d.value[t] = r), p(i) && (i.value = i(o, r, e)), i.value[t] = s;
26
26
  });
27
27
  });
28
- const V = b(() => Object.entries(f.value).reduce((e, [o, r]) => {
29
- let { props: a = {}, is: t, options: m, labelKey: h, valueKey: M } = r;
30
- if (O(t)) {
31
- const g = oe.get(t);
28
+ const b = S(() => Object.entries(d.value).reduce((e, [t, r]) => {
29
+ let { props: a = {}, is: o, options: s, labelKey: n, valueKey: q } = r;
30
+ if (R(o)) {
31
+ const g = te.get(o);
32
32
  if (g) {
33
- let _ = {};
34
- O(t) && (_ = y.value.el.schemaForm[t]), t === "ElDatePicker" && (a.valueFormat = ee[a?.type ?? "date"]), t = g.is, a = Object.assign(
33
+ let w = {};
34
+ R(o) && (w = K.value.el.schemaForm[o]), o === "ElDatePicker" && (a.valueFormat = re[a?.type ?? "date"]), o = g.is, a = Object.assign(
35
35
  {},
36
36
  g.props,
37
- _,
38
- Q({ options: m, labelKey: h, valueKey: M }),
37
+ w,
38
+ W({ options: s, labelKey: n, valueKey: q }),
39
39
  a
40
- ), a.disabled && (a.placeholder = "-", t === "ElDatePicker" && (a.startPlaceholder = "-", a.endPlaceholder = "-"));
40
+ ), a.disabled && (a.placeholder = "-", o === "ElDatePicker" && (a.startPlaceholder = "-", a.endPlaceholder = "-"));
41
41
  }
42
42
  }
43
- return e[o] = { is: t, props: a }, e;
44
- }, {})), K = async (e, o) => {
45
- E("change-field", { key: e, value: o }), await l.schema[e]?.onChange?.(o, l.schema[e], l.schema);
46
- }, L = async (e, o) => {
47
- E("input-field", { key: e, value: o }), await l.schema[e]?.onInput?.(o, l.schema[e], l.schema);
48
- }, p = w("refComponents"), n = w("refForm"), T = async () => {
49
- const e = p.value?.filter((o) => i(o.validate)) ?? [];
50
- await Promise.all([n.value, ...e].map((o) => o?.validate()));
51
- }, U = async () => {
52
- const e = p.value?.filter((r) => i(r.extractValues)) ?? [], o = await Promise.all(
43
+ return e[t] = { is: o, props: a }, e;
44
+ }, {})), L = async (e, t) => {
45
+ C("change-field", { key: e, value: t }), await l.schema[e]?.onChange?.(t, l.schema[e], l.schema);
46
+ }, T = async (e, t) => {
47
+ C("input-field", { key: e, value: t }), await l.schema[e]?.onInput?.(t, l.schema[e], l.schema);
48
+ }, v = I("refComponents"), f = I("refForm"), U = async () => {
49
+ const e = v.value?.filter((t) => p(t.validate)) ?? [];
50
+ await Promise.all([f.value, ...e].map((t) => t?.validate()));
51
+ }, M = async () => {
52
+ const e = v.value?.filter((r) => p(r.extractValues)) ?? [], t = await Promise.all(
53
53
  e.map((r) => r.extractValues())
54
54
  );
55
- return o.push(J.extract(l.schema)), o.filter(Boolean).reduce((r, a) => ({ ...r, ...a }), {});
56
- }, $ = re(async (e) => {
57
- const o = p.value?.filter((r) => i(r.trigger)) ?? [];
58
- await Promise.all(o.map((r) => r.trigger(e)));
55
+ return t.push(Q.extract(l.schema)), t.filter(Boolean).reduce((r, a) => ({ ...r, ...a }), {});
56
+ }, N = ae(async (e) => {
57
+ const t = v.value?.filter((r) => p(r.trigger)) ?? [];
58
+ await Promise.all(t.map((r) => r.trigger(e)));
59
59
  });
60
- return j({
60
+ return $({
61
61
  get form() {
62
- return n.value;
62
+ return f.value;
63
63
  },
64
- validate: T,
65
- resetFields: () => n.value?.resetFields(),
66
- trigger: $,
67
- extractValues: U,
68
- validateField: async (e) => n.value?.validateField(e)
69
- }), (e, o) => (d(), P(v(W), c(D.value, {
64
+ validate: U,
65
+ resetFields: () => f.value?.resetFields(),
66
+ trigger: N,
67
+ extractValues: M,
68
+ validateField: async (e) => f.value?.validateField(e)
69
+ }), (e, t) => (h(), P(u(X), m(y.value, {
70
70
  ref_key: "refForm",
71
- ref: n,
71
+ ref: f,
72
72
  class: "vro-el-schema-form",
73
- model: C.value,
74
- rules: s.value
73
+ model: V.value,
74
+ rules: i.value
75
75
  }), {
76
- default: u(() => [
77
- I(v(X), c({ gutter: 16 }, e.rowProps), {
78
- default: u(() => [
79
- (d(!0), z(A, null, B(f.value, (r, a) => (d(), P(v(Y), c({ key: a }, { ref_for: !0 }, { ...e.colProps, ...r.colProps }), {
80
- default: u(() => [
81
- I(v(Z), c({
76
+ default: c(() => [
77
+ B(u(Y), m({ gutter: 16 }, e.rowProps), {
78
+ default: c(() => [
79
+ (h(!0), G(H, null, _(d.value, (r, a) => (h(), P(u(Z), m({ key: a }, { ref_for: !0 }, { ...e.colProps, ...r.colProps }), {
80
+ default: c(() => [
81
+ B(u(k), m({
82
82
  label: r.label,
83
83
  prop: a
84
- }, { ref_for: !0 }, { ...e.formItemProps, ...r.formItemProps }), {
85
- default: u(() => [
86
- (d(), P(G(V.value?.[a]?.is), c({
84
+ }, { ref_for: !0 }, { ...e.formItemProps, ...r.formItemProps }), O({
85
+ default: c(() => [
86
+ (h(), P(J(b.value?.[a]?.is), m({
87
87
  modelValue: r.value,
88
- "onUpdate:modelValue": (t) => r.value = t
89
- }, { ref_for: !0 }, V.value?.[a]?.props, {
88
+ "onUpdate:modelValue": (o) => r.value = o
89
+ }, { ref_for: !0 }, b.value?.[a]?.props, {
90
90
  ref_for: !0,
91
91
  ref_key: "refComponents",
92
- ref: p,
93
- onChange: (t) => K(a, t),
94
- onInput: (t) => L(a, t)
95
- }), H({ _: 2 }, [
96
- B(r.slots, (t, m) => ({
97
- name: t,
98
- fn: u(() => [
99
- S(e.$slots, m, { item: r })
92
+ ref: v,
93
+ onChange: (o) => L(a, o),
94
+ onInput: (o) => T(a, o)
95
+ }), O({ _: 2 }, [
96
+ _(u(j)(r.slots), ({ source: o, target: s }) => ({
97
+ name: s,
98
+ fn: c((n) => [
99
+ E(e.$slots, o, m({ ref_for: !0 }, n ?? {}, { item: r }))
100
100
  ])
101
101
  }))
102
102
  ]), 1040, ["modelValue", "onUpdate:modelValue", "onChange", "onInput"]))
103
103
  ]),
104
104
  _: 2
105
- }, 1040, ["label", "prop"])
105
+ }, [
106
+ _(u(j)(r.itemSlots), ({ source: o, target: s }) => ({
107
+ name: s,
108
+ fn: c((n) => [
109
+ E(e.$slots, o, m({ ref_for: !0 }, n ?? {}, { item: r }))
110
+ ])
111
+ }))
112
+ ]), 1040, ["label", "prop"])
106
113
  ]),
107
114
  _: 2
108
115
  }, 1040))), 128)),
109
- S(e.$slots, "default")
116
+ E(e.$slots, "default")
110
117
  ]),
111
118
  _: 3
112
119
  }, 16)
@@ -116,5 +123,5 @@ const de = /* @__PURE__ */ N({
116
123
  }
117
124
  });
118
125
  export {
119
- de as default
126
+ ve as default
120
127
  };
@@ -496,9 +496,7 @@ export declare const VroElSchemaFormDialog: import('@vrojs/base').WithInstall<{
496
496
  extractValues: () => Promise<Record<string, any>>;
497
497
  validateField: (key: string) => Promise<boolean | undefined>;
498
498
  }> & {} & import('vue').ComponentCustomProperties & {} & {
499
- $slots: Partial<Record<number, (_: {
500
- item: import('..').VroElSchemaFormSchemaField;
501
- }) => any>> & {
499
+ $slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
502
500
  default?(_: {}): any;
503
501
  };
504
502
  };
@@ -1121,9 +1119,7 @@ export declare const VroElSchemaFormDialog: import('@vrojs/base').WithInstall<{
1121
1119
  extractValues: () => Promise<Record<string, any>>;
1122
1120
  validateField: (key: string) => Promise<boolean | undefined>;
1123
1121
  }> & {} & import('vue').ComponentCustomProperties & {} & {
1124
- $slots: Partial<Record<number, (_: {
1125
- item: import('..').VroElSchemaFormSchemaField;
1126
- }) => any>> & {
1122
+ $slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
1127
1123
  default?(_: {}): any;
1128
1124
  };
1129
1125
  }) | null;
@@ -1627,9 +1623,7 @@ export declare const VroElSchemaFormDialog: import('@vrojs/base').WithInstall<{
1627
1623
  extractValues: () => Promise<Record<string, any>>;
1628
1624
  validateField: (key: string) => Promise<boolean | undefined>;
1629
1625
  }> & {} & import('vue').ComponentCustomProperties & {} & {
1630
- $slots: Partial<Record<number, (_: {
1631
- item: import('..').VroElSchemaFormSchemaField;
1632
- }) => any>> & {
1626
+ $slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
1633
1627
  default?(_: {}): any;
1634
1628
  };
1635
1629
  };
@@ -2143,9 +2137,7 @@ export declare const VroElSchemaFormDialog: import('@vrojs/base').WithInstall<{
2143
2137
  extractValues: () => Promise<Record<string, any>>;
2144
2138
  validateField: (key: string) => Promise<boolean | undefined>;
2145
2139
  }> & {} & import('vue').ComponentCustomProperties & {} & {
2146
- $slots: Partial<Record<number, (_: {
2147
- item: import('..').VroElSchemaFormSchemaField;
2148
- }) => any>> & {
2140
+ $slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
2149
2141
  default?(_: {}): any;
2150
2142
  };
2151
2143
  };
@@ -7,6 +7,7 @@ import '../../vro-el-tree/style/index.css';
7
7
  /* empty css */
8
8
  /* empty css */
9
9
  /* empty css */
10
+ /* empty css */
10
11
  /* empty css */
11
12
  /* empty css */
12
13
  /* empty css */
@@ -31,6 +31,7 @@ import "element-plus/es/components/dialog/style/css";
31
31
  /* empty css */
32
32
  /* empty css */
33
33
  /* empty css */
34
+ /* empty css */
34
35
  /* empty css */
35
36
  /* empty css */
36
37
  /* empty css */
@@ -605,9 +605,7 @@ declare function __VLS_template(): {
605
605
  extractValues: () => Promise<Record<string, any>>;
606
606
  validateField: (key: string) => Promise<boolean | undefined>;
607
607
  }> & {} & import('vue').ComponentCustomProperties & {} & {
608
- $slots: Partial<Record<number, (_: {
609
- item: import('..').VroElSchemaFormSchemaField;
610
- }) => any>> & {
608
+ $slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
611
609
  default?(_: {}): any;
612
610
  };
613
611
  }) | null;
@@ -1102,9 +1100,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
1102
1100
  extractValues: () => Promise<Record<string, any>>;
1103
1101
  validateField: (key: string) => Promise<boolean | undefined>;
1104
1102
  }> & {} & import('vue').ComponentCustomProperties & {} & {
1105
- $slots: Partial<Record<number, (_: {
1106
- item: import('..').VroElSchemaFormSchemaField;
1107
- }) => any>> & {
1103
+ $slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
1108
1104
  default?(_: {}): any;
1109
1105
  };
1110
1106
  };
@@ -1778,9 +1774,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
1778
1774
  extractValues: () => Promise<Record<string, any>>;
1779
1775
  validateField: (key: string) => Promise<boolean | undefined>;
1780
1776
  }> & {} & import('vue').ComponentCustomProperties & {} & {
1781
- $slots: Partial<Record<number, (_: {
1782
- item: import('..').VroElSchemaFormSchemaField;
1783
- }) => any>> & {
1777
+ $slots: Partial<Record<string, (_: any) => any>> & Partial<Record<string, (_: any) => any>> & {
1784
1778
  default?(_: {}): any;
1785
1779
  };
1786
1780
  }) | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vrojs/element-plus",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "vrojs ui",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "@element-plus/icons-vue": ">=2.3.2",
37
37
  "element-plus": ">=2.11.9",
38
38
  "vue": ">=3.0.0",
39
- "@vrojs/base": "0.0.2",
39
+ "@vrojs/base": "0.0.3",
40
40
  "@vrojs/use": "0.0.2"
41
41
  },
42
42
  "devDependencies": {
@@ -50,7 +50,7 @@
50
50
  "vite": "^7.1.12",
51
51
  "vite-plugin-dts": "^4.5.4",
52
52
  "vue": "^3.5.22",
53
- "@vrojs/base": "0.0.2",
53
+ "@vrojs/base": "0.0.3",
54
54
  "@vrojs/use": "0.0.2"
55
55
  },
56
56
  "scripts": {