@zl-ui-kit/components 0.9.0 → 0.10.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.
Files changed (44) hide show
  1. package/README.md +355 -190
  2. package/dist/components/ZlAddSub/index.css +1 -1
  3. package/dist/components/ZlAddSub/index.vue.mjs +2 -2
  4. package/dist/components/ZlAppMenu/AppMenu.vue.d.ts +1 -1
  5. package/dist/components/ZlCardPage/index.vue.d.ts +94 -36
  6. package/dist/components/ZlCardPage/index.vue.mjs +2 -0
  7. package/dist/components/ZlChart/index.vue.d.ts +1 -0
  8. package/dist/components/ZlChart/index.vue.mjs +1 -0
  9. package/dist/components/ZlCheckAll/index.css +1 -1
  10. package/dist/components/ZlCheckAll/index.vue.mjs +1 -1
  11. package/dist/components/ZlDictTag/index.vue.d.ts +11 -3
  12. package/dist/components/ZlDictTag/index.vue.mjs +32 -23
  13. package/dist/components/ZlDynamicComponent/index.vue.d.ts +8 -3
  14. package/dist/components/ZlDynamicComponent/index.vue.mjs +24 -19
  15. package/dist/components/ZlEditor/ZlSqlEditor.vue.d.ts +28 -2
  16. package/dist/components/ZlEditor/ZlSqlEditor.vue.mjs +27 -18
  17. package/dist/components/ZlEditor/index.vue.d.ts +22 -1
  18. package/dist/components/ZlEditor/index.vue.mjs +47 -24
  19. package/dist/components/ZlForm/index.vue.d.ts +28 -2
  20. package/dist/components/ZlForm/index.vue.mjs +96 -90
  21. package/dist/components/ZlGrid/index.vue.d.ts +1 -1
  22. package/dist/components/ZlIcon/index.css +1 -1
  23. package/dist/components/ZlIcon/index.vue.d.ts +6 -2
  24. package/dist/components/ZlIcon/index.vue.mjs +2 -2
  25. package/dist/components/ZlIcon/index2.vue.mjs +30 -23
  26. package/dist/components/ZlPagination/index.css +1 -1
  27. package/dist/components/ZlPagination/index.vue.mjs +1 -1
  28. package/dist/components/ZlSearch/index.vue.d.ts +82 -23
  29. package/dist/components/ZlSearch/index.vue.mjs +8 -1
  30. package/dist/components/ZlSearchTable/index.vue.d.ts +180 -40
  31. package/dist/components/ZlSearchTable/index.vue.mjs +4 -0
  32. package/dist/components/ZlSorter/ZlSorterList.css +1 -1
  33. package/dist/components/ZlSorter/ZlSorterList.vue.d.ts +1 -1
  34. package/dist/components/ZlSorter/ZlSorterList.vue.mjs +2 -2
  35. package/dist/components/ZlSorter/index.css +1 -1
  36. package/dist/components/ZlSorter/index.vue.mjs +2 -2
  37. package/dist/components/ZlSwitch/index.vue.d.ts +6 -2
  38. package/dist/components/ZlSwitch/index.vue.mjs +26 -24
  39. package/dist/components/ZlTable/index.vue.d.ts +36 -1
  40. package/dist/components/ZlTable/index.vue.mjs +98 -75
  41. package/dist/components/ZlTabs/index.vue.d.ts +20 -3
  42. package/dist/components/ZlTabs/index.vue.mjs +30 -20
  43. package/dist/components/ZlTag/index.vue.d.ts +2 -2
  44. package/package.json +6 -6
@@ -1,4 +1,5 @@
1
1
  import { SqlTableSchema } from './useSqlCompletion';
2
+ import * as monaco from 'monaco-editor';
2
3
  type __VLS_Props = {
3
4
  /** 表结构(补全提示) */
4
5
  tableSchemas?: SqlTableSchema[];
@@ -13,8 +14,11 @@ type __VLS_PublicProps = {
13
14
  modelValue?: string;
14
15
  } & __VLS_Props;
15
16
  declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
17
+ /** 用 dt-sql-parser 校验当前 SQL:无错时清空 marker;有错时打红色 marker + `ElMessage` 提示,并 **`throw diagnostics`**(调用方需 catch) */
16
18
  validate: typeof validate;
19
+ /** 先跑 `validate()`(不通过会抛),通过则用 sql-formatter 格式化并写回 `v-model` */
17
20
  format: typeof format;
21
+ zlEditor: monaco.editor.IStandaloneCodeEditor | undefined;
18
22
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
19
23
  "update:modelValue": (value: string) => any;
20
24
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
@@ -31,7 +35,18 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
31
35
  options?: Record<string, any>;
32
36
  }> & Readonly<{
33
37
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
34
- }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
38
+ }>, {
39
+ monacoEditor: monaco.editor.IStandaloneCodeEditor | undefined;
40
+ getValue: () => string;
41
+ setValue: (value: string) => void | undefined;
42
+ getModel: () => monaco.editor.ITextModel | null | undefined;
43
+ getSelection: () => monaco.Selection | null | undefined;
44
+ revealLine: (lineNumber: number) => void | undefined;
45
+ focus: () => void | undefined;
46
+ layout: () => void | undefined;
47
+ updateOptions: (options: Record<string, any>) => void | undefined;
48
+ dispose: () => void | undefined;
49
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
35
50
  "update:modelValue": (value: string) => any;
36
51
  }, import('vue').PublicProps, {
37
52
  options: Record<string, any>;
@@ -52,7 +67,18 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
52
67
  options?: Record<string, any>;
53
68
  }> & Readonly<{
54
69
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
55
- }>, {}, {}, {}, {}, {
70
+ }>, {
71
+ monacoEditor: monaco.editor.IStandaloneCodeEditor | undefined;
72
+ getValue: () => string;
73
+ setValue: (value: string) => void | undefined;
74
+ getModel: () => monaco.editor.ITextModel | null | undefined;
75
+ getSelection: () => monaco.Selection | null | undefined;
76
+ revealLine: (lineNumber: number) => void | undefined;
77
+ focus: () => void | undefined;
78
+ layout: () => void | undefined;
79
+ updateOptions: (options: Record<string, any>) => void | undefined;
80
+ dispose: () => void | undefined;
81
+ }, {}, {}, {}, {
56
82
  options: Record<string, any>;
57
83
  language: string;
58
84
  }> | null;
@@ -1,13 +1,13 @@
1
- import { defineComponent as p, useModel as v, shallowRef as M, toRefs as g, openBlock as q, createBlock as h, mergeProps as C, mergeModels as L } from "vue";
1
+ import { defineComponent as p, useModel as v, shallowRef as g, toRefs as M, openBlock as q, createBlock as h, mergeProps as C, mergeModels as L } from "vue";
2
2
  import { useZlT as R } from "@zl-ui-kit/composables";
3
3
  import { ElMessage as S } from "element-plus";
4
4
  import { MySQL as V } from "dt-sql-parser/dist/parser/mysql";
5
5
  import * as n from "monaco-editor";
6
6
  import { format as w } from "sql-formatter";
7
- import k from "./index.vue.mjs";
7
+ import E from "./index.vue.mjs";
8
8
  import './index.css';/* empty css */
9
- import { useSqlCompletion as y } from "./useSqlCompletion.mjs";
10
- const N = /* @__PURE__ */ p({
9
+ import { useSqlCompletion as k } from "./useSqlCompletion.mjs";
10
+ const B = /* @__PURE__ */ p({
11
11
  name: "ZlSqlEditor",
12
12
  inheritAttrs: !1,
13
13
  __name: "ZlSqlEditor",
@@ -21,8 +21,8 @@ const N = /* @__PURE__ */ p({
21
21
  }),
22
22
  emits: ["update:modelValue"],
23
23
  setup(s, { expose: m }) {
24
- const { t: u } = R(), i = s, t = v(s, "modelValue"), d = new V(), r = M();
25
- y(g(i));
24
+ const { t: u } = R(), i = s, r = v(s, "modelValue"), d = new V(), t = g();
25
+ k(M(i));
26
26
  function f(e) {
27
27
  return {
28
28
  severity: 8,
@@ -36,37 +36,46 @@ const N = /* @__PURE__ */ p({
36
36
  };
37
37
  }
38
38
  function a() {
39
- n.editor.setModelMarkers(r.value.getModel(), "sql", []);
40
- const e = d.validate(t.value ?? "");
39
+ n.editor.setModelMarkers(t.value.getModel(), "sql", []);
40
+ const e = d.validate(r.value ?? "");
41
41
  if (e.length) {
42
42
  const o = e.map((l) => f(l));
43
- throw n.editor.setModelMarkers(r.value.getModel(), "sql", o), S.error(u("zl.sqlEditor.invalid", "请检查SQL语法")), e;
43
+ throw n.editor.setModelMarkers(t.value.getModel(), "sql", o), S.error(u("zl.sqlEditor.invalid", "请检查SQL语法")), e;
44
44
  }
45
45
  }
46
46
  async function c() {
47
- a(), t.value = w(t.value ?? "");
47
+ a(), r.value = w(r.value ?? "");
48
48
  }
49
49
  return m(
50
50
  new Proxy(
51
- { validate: a, format: c },
51
+ {
52
+ /** 用 dt-sql-parser 校验当前 SQL:无错时清空 marker;有错时打红色 marker + `ElMessage` 提示,并 **`throw diagnostics`**(调用方需 catch) */
53
+ validate: a,
54
+ /** 先跑 `validate()`(不通过会抛),通过则用 sql-formatter 格式化并写回 `v-model` */
55
+ format: c,
56
+ /** 内部 `ZlEditor` 实例(其暴露对象代理 monaco),需要原生编辑器 API 时从这里取 */
57
+ get zlEditor() {
58
+ return t.value;
59
+ }
60
+ },
52
61
  {
53
62
  get(e, o, l) {
54
- return Reflect.get(e, o, l) ?? r.value?.[o];
63
+ return Reflect.get(e, o, l) ?? t.value?.[o];
55
64
  },
56
65
  has(e, o) {
57
- return Reflect.has(e, o) || o in (r.value ?? {});
66
+ return Reflect.has(e, o) || o in (t.value ?? {});
58
67
  }
59
68
  }
60
69
  )
61
- ), (e, o) => (q(), h(k, C({
70
+ ), (e, o) => (q(), h(E, C({
62
71
  ref_key: "editorRef",
63
- ref: r,
64
- modelValue: t.value,
65
- "onUpdate:modelValue": o[0] || (o[0] = (l) => t.value = l)
72
+ ref: t,
73
+ modelValue: r.value,
74
+ "onUpdate:modelValue": o[0] || (o[0] = (l) => r.value = l)
66
75
  }, { ...e.$attrs, language: "sql" }), null, 16, ["modelValue"]));
67
76
  }
68
77
  });
69
78
  export {
70
- N as default
79
+ B as default
71
80
  };
72
81
  //# sourceMappingURL=ZlSqlEditor.vue.mjs.map
@@ -1,3 +1,4 @@
1
+ import * as monaco from 'monaco-editor';
1
2
  type __VLS_Props = {
2
3
  /** 语法高亮所用语言 id,默认 javascript */
3
4
  language?: string;
@@ -7,7 +8,27 @@ type __VLS_Props = {
7
8
  type __VLS_PublicProps = {
8
9
  modelValue?: string;
9
10
  } & __VLS_Props;
10
- declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
11
+ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
12
+ monacoEditor: monaco.editor.IStandaloneCodeEditor | undefined;
13
+ /** 读取当前文本(`v-model` 已自动同步,一般无需主动调用) */
14
+ getValue: () => string;
15
+ /** 设置整本文本,会同步触发 `v-model` 更新 */
16
+ setValue: (value: string) => void | undefined;
17
+ /** 当前文本模型(monaco `ITextModel`),打 marker / 取行内容时需要 */
18
+ getModel: () => monaco.editor.ITextModel | null | undefined;
19
+ /** 当前选区(未选中时为空) */
20
+ getSelection: () => monaco.Selection | null | undefined;
21
+ /** 滚动到指定行使其进入可视区 */
22
+ revealLine: (lineNumber: number) => void | undefined;
23
+ /** 让编辑器获得焦点 */
24
+ focus: () => void | undefined;
25
+ /** 重算布局(容器尺寸变化已由组件内部 `useResizeObserver` 自动处理,无需手动调) */
26
+ layout: () => void | undefined;
27
+ /** 运行时更新 monaco 创建选项 */
28
+ updateOptions: (options: Record<string, any>) => void | undefined;
29
+ /** 销毁编辑器实例(组件卸载时自动调用,重复调用 monaco 会抛错) */
30
+ dispose: () => void | undefined;
31
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
11
32
  "update:modelValue": (value: string) => any;
12
33
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
13
34
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
@@ -1,11 +1,11 @@
1
- import { defineComponent as i, useModel as m, shallowRef as u, watch as d, onScopeDispose as c, openBlock as p, createElementBlock as v, mergeModels as f } from "vue";
2
- import { useResizeObserver as g, whenever as h } from "@vueuse/core";
3
- import * as _ from "monaco-editor";
4
- import { setupMonacoEnvironment as E } from "./setupMonacoEnvironment.mjs";
5
- const w = /* @__PURE__ */ i({
1
+ import { defineComponent as d, useModel as v, shallowRef as r, watch as m, onScopeDispose as c, openBlock as p, createElementBlock as f, mergeModels as g } from "vue";
2
+ import { useResizeObserver as V, whenever as h } from "@vueuse/core";
3
+ import * as E from "monaco-editor";
4
+ import { setupMonacoEnvironment as M } from "./setupMonacoEnvironment.mjs";
5
+ const R = /* @__PURE__ */ d({
6
6
  name: "ZlEditor",
7
7
  __name: "index",
8
- props: /* @__PURE__ */ f({
8
+ props: /* @__PURE__ */ g({
9
9
  language: { default: "javascript" },
10
10
  options: { default: () => ({}) }
11
11
  }, {
@@ -13,52 +13,75 @@ const w = /* @__PURE__ */ i({
13
13
  modelModifiers: {}
14
14
  }),
15
15
  emits: ["update:modelValue"],
16
- setup(n, { expose: s }) {
17
- const r = n;
18
- E();
19
- const o = m(n, "modelValue"), l = u(), e = u();
20
- return g(l, () => {
16
+ setup(u, { expose: s }) {
17
+ const n = u;
18
+ M();
19
+ const o = v(u, "modelValue"), t = r(), e = r();
20
+ return V(t, () => {
21
21
  requestAnimationFrame(() => {
22
22
  e.value?.layout();
23
23
  });
24
24
  }), h(
25
- l,
25
+ t,
26
26
  (a) => {
27
- e.value = _.editor.create(a, {
27
+ e.value = E.editor.create(a, {
28
28
  value: o.value,
29
- language: r.language,
29
+ language: n.language,
30
30
  minimap: { enabled: !1 },
31
31
  theme: "zl-editor-theme",
32
- ...r.options
32
+ ...n.options
33
33
  }), e.value.onDidChangeModelContent(() => {
34
34
  o.value = e.value?.getValue() ?? "";
35
35
  });
36
36
  },
37
37
  { once: !0 }
38
- ), d(o, () => {
38
+ ), m(o, () => {
39
39
  e.value?.getValue() !== o.value && e.value?.setValue(o.value ?? "");
40
40
  }), c(() => {
41
41
  e.value?.dispose();
42
42
  }), s(
43
43
  new Proxy(
44
- {},
45
44
  {
46
- get(a, t) {
47
- return e.value?.[t];
45
+ /** 底层 monaco 编辑器实例(`IStandaloneCodeEditor`),需要未列出的原生 API 时仍这里取 */
46
+ get monacoEditor() {
47
+ return e.value;
48
48
  },
49
- has(a, t) {
50
- return t in (e.value ?? {});
49
+ /** 读取当前文本(`v-model` 已自动同步,一般无需主动调用) */
50
+ getValue: () => e.value?.getValue() ?? "",
51
+ /** 设置整本文本,会同步触发 `v-model` 更新 */
52
+ setValue: (a) => e.value?.setValue(a),
53
+ /** 当前文本模型(monaco `ITextModel`),打 marker / 取行内容时需要 */
54
+ getModel: () => e.value?.getModel(),
55
+ /** 当前选区(未选中时为空) */
56
+ getSelection: () => e.value?.getSelection(),
57
+ /** 滚动到指定行使其进入可视区 */
58
+ revealLine: (a) => e.value?.revealLine(a),
59
+ /** 让编辑器获得焦点 */
60
+ focus: () => e.value?.focus(),
61
+ /** 重算布局(容器尺寸变化已由组件内部 `useResizeObserver` 自动处理,无需手动调) */
62
+ layout: () => e.value?.layout(),
63
+ /** 运行时更新 monaco 创建选项 */
64
+ updateOptions: (a) => e.value?.updateOptions(a),
65
+ /** 销毁编辑器实例(组件卸载时自动调用,重复调用 monaco 会抛错) */
66
+ dispose: () => e.value?.dispose()
67
+ },
68
+ {
69
+ get(a, l, i) {
70
+ return Reflect.get(a, l, i) ?? e.value?.[l];
71
+ },
72
+ has(a, l) {
73
+ return Reflect.has(a, l) || l in (e.value ?? {});
51
74
  }
52
75
  }
53
76
  )
54
- ), (a, t) => (p(), v("div", {
77
+ ), (a, l) => (p(), f("div", {
55
78
  ref_key: "editorEl",
56
- ref: l,
79
+ ref: t,
57
80
  class: "zl-editor"
58
81
  }, null, 512));
59
82
  }
60
83
  });
61
84
  export {
62
- w as default
85
+ R as default
63
86
  };
64
87
  //# sourceMappingURL=index.vue.mjs.map
@@ -5,8 +5,20 @@ type __VLS_Props = {
5
5
  /** 表单值对象,不传时由组件内部自建 */
6
6
  model?: Record<string, any>;
7
7
  };
8
- declare function validate(): Promise<void>;
9
- declare function validateField(name: string): Promise<void>;
8
+ /** el-form 的校验回调:第一个参数为是否通过,失败时第二个参数为错误字段集合 */
9
+ type ValidateCallback = (isValid: boolean, invalidFields?: Record<string, any>) => void;
10
+ /** 字段名,可传单个或数组;不传即全表单 */
11
+ type FieldNames = string | string[];
12
+ /**
13
+ * 校验整个表单,语义与 `el-form.validate()` 完全一致:
14
+ * 不传 callback 时返回 Promise(通过 `resolve(true)`,失败 `reject(错误字段集合)`);
15
+ * 传 callback 时改为回调式(`callback(true)` / `callback(false, fields)`),不会抛错。
16
+ * 版本分界:**0.10.0 起**成功时返回 `true`;0.9.0 及更早的签名为 `Promise<void>`,
17
+ * 成功时 `resolve(undefined)`,`await validate()` 直接当布尔用会被误判为失败。
18
+ */
19
+ declare function validate(callback?: ValidateCallback): Promise<boolean>;
20
+ /** 校验指定字段,语义同 `validate()` */
21
+ declare function validateField(props?: FieldNames, callback?: ValidateCallback): Promise<boolean>;
10
22
  declare function __VLS_template(): {
11
23
  attrs: Partial<{}>;
12
24
  slots: Partial<Record<string, (_: {
@@ -44,8 +56,22 @@ declare function __VLS_template(): {
44
56
  };
45
57
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
46
58
  declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
59
+ /** 校验整个表单;同 `el-form.validate()`(无回调时失败会 reject 错误字段集合;0.9.0 及更早成功时返回 `undefined`) */
47
60
  validate: typeof validate;
61
+ /** 校验指定字段(字段名或数组),语义同 `validate()` */
48
62
  validateField: typeof validateField;
63
+ /** 重置字段并清除校验结果;不传参重置全部 */
64
+ resetFields: (props?: FieldNames) => any;
65
+ /** 清除校验提示;不传参清除全部 */
66
+ clearValidate: (props?: FieldNames) => any;
67
+ /** 滚动到指定字段 */
68
+ scrollToField: (prop: string) => any;
69
+ /** 取单个表单项上下文(含 `resetField`/`clearValidate`/`validateMessage` 等) */
70
+ getField: (prop: string) => any;
71
+ fields: any;
72
+ /** 写入字段初始值(`resetFields` 会回到这些值) */
73
+ setInitialValues: (values: Record<string, any>, clearValidate?: boolean) => any;
74
+ elForm: any;
49
75
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
50
76
  items: FormItem[];
51
77
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
@@ -1,129 +1,135 @@
1
- import { defineComponent as L, toRefs as M, ref as b, computed as h, resolveComponent as c, openBlock as s, createBlock as u, mergeProps as i, withCtx as f, createElementBlock as S, Fragment as T, renderList as U, renderSlot as p, createElementVNode as E, toDisplayString as q, createCommentVNode as V, createVNode as x } from "vue";
2
- import W from "./ZlFormChild.vue.mjs";
3
- import j from "../ZlIcon/index.vue.mjs";
4
- const G = { class: "zl-form-item-label" }, w = "onUpdate:modelValue", Q = /* @__PURE__ */ L({
1
+ import { defineComponent as D, toRefs as L, ref as b, computed as V, resolveComponent as m, openBlock as n, createBlock as u, mergeProps as c, withCtx as d, createElementBlock as M, Fragment as S, renderList as U, renderSlot as p, createElementVNode as F, toDisplayString as q, createCommentVNode as E, createVNode as W } from "vue";
2
+ import j from "./ZlFormChild.vue.mjs";
3
+ import x from "../ZlIcon/index.vue.mjs";
4
+ const G = { class: "zl-form-item-label" }, g = "onUpdate:modelValue", Q = /* @__PURE__ */ D({
5
5
  name: "ZlForm",
6
6
  __name: "index",
7
7
  props: {
8
8
  items: { default: () => [] },
9
9
  model: {}
10
10
  },
11
- setup(y, { expose: P }) {
12
- const d = y, { items: v } = M(d), g = b(d.model ?? {}), t = h(() => d.model ?? g.value), I = h(() => {
13
- const o = [];
14
- return v.value.forEach((e) => {
15
- if (!e.model)
11
+ setup(h, { expose: y }) {
12
+ const i = h, { items: v } = L(i), I = b(i.model ?? {}), r = V(() => i.model ?? I.value), P = V(() => {
13
+ const e = [];
14
+ return v.value.forEach((l) => {
15
+ if (!l.model)
16
16
  throw new Error("[ZlForm]: form item's model is required!");
17
- e.defaultValue !== void 0 && t.value[e.model] === void 0 && (t.value[e.model] = e.defaultValue);
18
- }), v.value.forEach((e) => {
19
- if (!$(e)) return;
17
+ l.defaultValue !== void 0 && r.value[l.model] === void 0 && (r.value[l.model] = l.defaultValue);
18
+ }), v.value.forEach((l) => {
19
+ if (!k(l)) return;
20
20
  const {
21
- visible: r,
21
+ visible: s,
22
22
  props: a,
23
- tooltip: m,
24
- formItemProps: l = {},
25
- component: R,
26
- label: z,
27
- model: C,
23
+ tooltip: f,
24
+ formItemProps: o = {},
25
+ component: z,
26
+ label: C,
27
+ model: T,
28
28
  defaultValue: H,
29
29
  slot: B,
30
- slots: Z,
31
- ...A
32
- } = e, _ = { ...l };
30
+ slots: R,
31
+ ...Z
32
+ } = l, _ = { ...o };
33
33
  delete _.tooltip;
34
- const D = { ...A, ...a ?? {} };
35
- o.push({
34
+ const A = { ...Z, ...a ?? {} };
35
+ e.push({
36
36
  formItemProps: _,
37
- tooltip: m,
38
- component: R,
39
- label: z,
40
- model: C,
37
+ tooltip: f,
38
+ component: z,
39
+ label: C,
40
+ model: T,
41
41
  slot: B,
42
- slots: Z,
43
- props: k(D, e.model)
42
+ slots: R,
43
+ props: w(A, l.model)
44
44
  });
45
- }), o;
46
- }), n = b(null);
47
- function $(o) {
48
- const e = o.visible;
49
- return e === void 0 ? !0 : e === !1 || typeof e == "function" && !e(t.value, o) ? !1 : !!e;
45
+ }), e;
46
+ }), t = b(null);
47
+ function k(e) {
48
+ const l = e.visible;
49
+ return l === void 0 ? !0 : l === !1 || typeof l == "function" && !l(r.value, e) ? !1 : !!l;
50
50
  }
51
- function k(o = {}, e) {
52
- const r = o[w];
53
- return o[w] = (a) => {
54
- t.value[e] = a, r?.(a);
55
- }, o;
51
+ function w(e = {}, l) {
52
+ const s = e[g];
53
+ return e[g] = (a) => {
54
+ r.value[l] = a, s?.(a);
55
+ }, e;
56
56
  }
57
- async function F() {
58
- const o = await n.value?.validate().catch((e) => e);
59
- if (o !== !0) throw o;
57
+ async function $(e) {
58
+ return await t.value?.validate(e) ?? !0;
60
59
  }
61
- async function N(o) {
62
- try {
63
- await n.value?.validateField(o);
64
- } catch (e) {
65
- throw e;
66
- }
60
+ async function N(e, l) {
61
+ return await t.value?.validateField(e, l) ?? !0;
67
62
  }
68
- return P(
69
- new Proxy(
70
- { validate: F, validateField: N },
71
- {
72
- get(o, e, r) {
73
- return Reflect.get(o, e, r) || n.value?.[e];
74
- },
75
- has(o, e) {
76
- return Reflect.has(o, e) || e in (n.value ?? {});
77
- }
78
- }
79
- )
80
- ), (o, e) => {
81
- const r = c("el-tooltip"), a = c("el-form-item"), m = c("el-form");
82
- return s(), u(m, i({
63
+ return y({
64
+ /** 校验整个表单;同 `el-form.validate()`(无回调时失败会 reject 错误字段集合;0.9.0 及更早成功时返回 `undefined`) */
65
+ validate: $,
66
+ /** 校验指定字段(字段名或数组),语义同 `validate()` */
67
+ validateField: N,
68
+ /** 重置字段并清除校验结果;不传参重置全部 */
69
+ resetFields: (e) => t.value?.resetFields(e),
70
+ /** 清除校验提示;不传参清除全部 */
71
+ clearValidate: (e) => t.value?.clearValidate(e),
72
+ /** 滚动到指定字段 */
73
+ scrollToField: (e) => t.value?.scrollToField(e),
74
+ /** 取单个表单项上下文(含 `resetField`/`clearValidate`/`validateMessage` 等) */
75
+ getField: (e) => t.value?.getField(e),
76
+ /** 全部表单项上下文(含 `prop`/`value`/`validateState` 等) */
77
+ get fields() {
78
+ return t.value?.fields ?? [];
79
+ },
80
+ /** 写入字段初始值(`resetFields` 会回到这些值) */
81
+ setInitialValues: (e, l) => t.value?.setInitialValues(e, l),
82
+ /** 内部 ElForm 实例,未列出的能力兜底用 */
83
+ get elForm() {
84
+ return t.value;
85
+ }
86
+ }), (e, l) => {
87
+ const s = m("el-tooltip"), a = m("el-form-item"), f = m("el-form");
88
+ return n(), u(f, c({
83
89
  ref_key: "formRef",
84
- ref: n,
90
+ ref: t,
85
91
  class: "zl-form",
86
- model: t.value
87
- }, { labelWidth: "auto", ...o.$attrs }), {
88
- default: f(() => [
89
- (s(!0), S(T, null, U(I.value, (l) => (s(), u(a, i({
90
- key: l.model,
91
- label: l.label,
92
- prop: l.model
93
- }, { ref_for: !0 }, l.formItemProps), {
94
- label: f(() => [
95
- E("span", G, [
96
- o.$slots.label ? p(o.$slots, "label", i({ ref_for: !0 }, { label: l.label, item: l }), () => [
97
- E("span", null, q(l.label), 1)
98
- ], void 0, 0) : V("", !0),
99
- l.tooltip ? (s(), u(r, {
92
+ model: r.value
93
+ }, { labelWidth: "auto", ...e.$attrs }), {
94
+ default: d(() => [
95
+ (n(!0), M(S, null, U(P.value, (o) => (n(), u(a, c({
96
+ key: o.model,
97
+ label: o.label,
98
+ prop: o.model
99
+ }, { ref_for: !0 }, o.formItemProps), {
100
+ label: d(() => [
101
+ F("span", G, [
102
+ e.$slots.label ? p(e.$slots, "label", c({ ref_for: !0 }, { label: o.label, item: o }), () => [
103
+ F("span", null, q(o.label), 1)
104
+ ], void 0, 0) : E("", !0),
105
+ o.tooltip ? (n(), u(s, {
100
106
  key: 1,
101
- content: l.tooltip,
107
+ content: o.tooltip,
102
108
  placement: "top"
103
109
  }, {
104
- default: f(() => [
105
- x(j, {
110
+ default: d(() => [
111
+ W(x, {
106
112
  class: "zl-form-item-label__tooltip",
107
113
  icon: "zl:help-color"
108
114
  })
109
115
  ]),
110
116
  _: 1
111
- }, 8, ["content"])) : V("", !0)
117
+ }, 8, ["content"])) : E("", !0)
112
118
  ])
113
119
  ]),
114
- default: f(() => [
115
- l.slot ? p(o.$slots, l.model, {
116
- model: t.value,
117
- field: l
118
- }, void 0, void 0, 0) : (s(), u(W, {
120
+ default: d(() => [
121
+ o.slot ? p(e.$slots, o.model, {
122
+ model: r.value,
123
+ field: o
124
+ }, void 0, void 0, 0) : (n(), u(j, {
119
125
  key: 1,
120
- item: l,
121
- "model-value": t.value[l.model]
126
+ item: o,
127
+ "model-value": r.value[o.model]
122
128
  }, null, 8, ["item", "model-value"]))
123
129
  ]),
124
130
  _: 2
125
131
  }, 1040, ["label", "prop"]))), 128)),
126
- p(o.$slots, "default")
132
+ p(e.$slots, "default")
127
133
  ]),
128
134
  _: 3
129
135
  }, 16, ["model"]);
@@ -32,8 +32,8 @@ declare function __VLS_template(): {
32
32
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
33
33
  declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
34
34
  data: Record<string, any>;
35
- labelWidth: string | number;
36
35
  grid: IGridItem[];
36
+ labelWidth: string | number;
37
37
  cols: number;
38
38
  labelPosition: "left" | "top" | "right";
39
39
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
@@ -1 +1 @@
1
- .zl-icon[data-v-c7f05c04]{display:inline-flex;align-items:center;justify-content:center;font-size:14px;line-height:1}.zl-icon--external[data-v-c7f05c04]{width:1em;height:1em;background-color:currentColor;mask-size:100% 100%}.zl-icon--local[data-v-c7f05c04]{width:1em;height:1em;fill:currentColor}
1
+ .zl-icon[data-v-2dd0b437]{display:inline-flex;align-items:center;justify-content:center;font-size:14px;line-height:1}.zl-icon--external[data-v-2dd0b437]{width:1em;height:1em;background-color:currentColor;mask-size:100% 100%}.zl-icon--local[data-v-2dd0b437]{width:1em;height:1em;fill:currentColor}
@@ -1,6 +1,10 @@
1
1
  type __VLS_Props = {
2
2
  /** 图标:zl:xxx(本地图标集)/ http(s) 地址 / 本地 svg sprite 名称 */
3
3
  icon: string;
4
+ /** 尺寸,作用在 `font-size` 上(数字按 px 处理),图标本体按 `1em` 缩放;默认 `14px` */
5
+ size?: string | number;
6
+ /** 颜色,默认继承当前文字色(`currentColor`) */
7
+ color?: string;
4
8
  };
5
9
  declare function __VLS_template(): {
6
10
  attrs: Partial<{}>;
@@ -8,10 +12,10 @@ declare function __VLS_template(): {
8
12
  default?(_: {}): any;
9
13
  };
10
14
  refs: {};
11
- rootEl: HTMLDivElement;
15
+ rootEl: any;
12
16
  };
13
17
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
14
- declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
18
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
15
19
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
16
20
  export default _default;
17
21
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -1,8 +1,8 @@
1
1
  import o from "./index2.vue.mjs";
2
2
  import './index.css';/* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c7f05c04"]]);
4
+ const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-2dd0b437"]]);
5
5
  export {
6
- m as default
6
+ _ as default
7
7
  };
8
8
  //# sourceMappingURL=index.vue.mjs.map