@ccn-ui-kit/form 0.1.2

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 (80) hide show
  1. package/dist/index.cjs +1 -0
  2. package/dist/index.js +315 -0
  3. package/dist/packages/components/__tests__/loading.spec.d.ts +1 -0
  4. package/dist/packages/components/badge/index.d.ts +10 -0
  5. package/dist/packages/components/badge/src/badge.d.ts +25 -0
  6. package/dist/packages/components/breadcrumb/index.d.ts +12 -0
  7. package/dist/packages/components/breadcrumb/src/breadcrumb-item.d.ts +13 -0
  8. package/dist/packages/components/breadcrumb/src/breadcrumb.d.ts +10 -0
  9. package/dist/packages/components/button/index.d.ts +10 -0
  10. package/dist/packages/components/button/src/button.d.ts +25 -0
  11. package/dist/packages/components/date-picker/index.d.ts +10 -0
  12. package/dist/packages/components/date-picker/src/date-picker.d.ts +20 -0
  13. package/dist/packages/components/descriptions/index.d.ts +12 -0
  14. package/dist/packages/components/descriptions/src/descriptions-item.d.ts +13 -0
  15. package/dist/packages/components/descriptions/src/descriptions.d.ts +17 -0
  16. package/dist/packages/components/divider/index.d.ts +10 -0
  17. package/dist/packages/components/divider/src/divider.d.ts +20 -0
  18. package/dist/packages/components/dropdown/index.d.ts +12 -0
  19. package/dist/packages/components/dropdown/src/dropdown-item.d.ts +20 -0
  20. package/dist/packages/components/dropdown/src/dropdown.d.ts +46 -0
  21. package/dist/packages/components/form/index.d.ts +12 -0
  22. package/dist/packages/components/form/src/form-item.d.ts +45 -0
  23. package/dist/packages/components/form/src/form-item.vue.d.ts +83 -0
  24. package/dist/packages/components/form/src/form.d.ts +96 -0
  25. package/dist/packages/components/form/src/form.vue.d.ts +84 -0
  26. package/dist/packages/components/icon/index.d.ts +11 -0
  27. package/dist/packages/components/icon/src/icon.d.ts +18 -0
  28. package/dist/packages/components/icon/src/icons.d.ts +50 -0
  29. package/dist/packages/components/input/index.d.ts +10 -0
  30. package/dist/packages/components/input/src/input.d.ts +25 -0
  31. package/dist/packages/components/link/index.d.ts +10 -0
  32. package/dist/packages/components/link/src/link.d.ts +25 -0
  33. package/dist/packages/components/loading/index.d.ts +10 -0
  34. package/dist/packages/components/loading/src/loading.d.ts +15 -0
  35. package/dist/packages/components/menu/index.d.ts +14 -0
  36. package/dist/packages/components/menu/src/menu-item.d.ts +12 -0
  37. package/dist/packages/components/menu/src/menu.d.ts +40 -0
  38. package/dist/packages/components/menu/src/sub-menu.d.ts +12 -0
  39. package/dist/packages/components/message/index.d.ts +12 -0
  40. package/dist/packages/components/message/src/manager.d.ts +14 -0
  41. package/dist/packages/components/message/src/message.d.ts +28 -0
  42. package/dist/packages/components/modal/index.d.ts +10 -0
  43. package/dist/packages/components/modal/src/modal.d.ts +46 -0
  44. package/dist/packages/components/notification/index.d.ts +12 -0
  45. package/dist/packages/components/notification/src/manager.d.ts +14 -0
  46. package/dist/packages/components/notification/src/notification.d.ts +44 -0
  47. package/dist/packages/components/pagination/index.d.ts +10 -0
  48. package/dist/packages/components/pagination/src/pagination.d.ts +30 -0
  49. package/dist/packages/components/popconfirm/index.d.ts +10 -0
  50. package/dist/packages/components/popconfirm/src/popconfirm.d.ts +56 -0
  51. package/dist/packages/components/rich-editor/index.d.ts +10 -0
  52. package/dist/packages/components/rich-editor/src/rich-editor.d.ts +36 -0
  53. package/dist/packages/components/select/index.d.ts +10 -0
  54. package/dist/packages/components/select/src/select.d.ts +45 -0
  55. package/dist/packages/components/space/index.d.ts +10 -0
  56. package/dist/packages/components/space/src/space.d.ts +33 -0
  57. package/dist/packages/components/steps/index.d.ts +12 -0
  58. package/dist/packages/components/steps/src/step.d.ts +28 -0
  59. package/dist/packages/components/steps/src/steps.d.ts +46 -0
  60. package/dist/packages/components/table/index.d.ts +10 -0
  61. package/dist/packages/components/table/src/table.d.ts +56 -0
  62. package/dist/packages/components/tabs/index.d.ts +12 -0
  63. package/dist/packages/components/tabs/src/tab-pane.d.ts +22 -0
  64. package/dist/packages/components/tabs/src/tabs.d.ts +43 -0
  65. package/dist/packages/components/tree/index.d.ts +10 -0
  66. package/dist/packages/components/tree/src/tree.d.ts +134 -0
  67. package/dist/packages/components/upload/index.d.ts +10 -0
  68. package/dist/packages/components/upload/src/upload.d.ts +103 -0
  69. package/dist/packages/directives/index.d.ts +2 -0
  70. package/dist/packages/directives/loading/index.d.ts +11 -0
  71. package/dist/packages/directives/permission/index.d.ts +3 -0
  72. package/dist/packages/ui-kit/index.d.ts +34 -0
  73. package/dist/packages/utils/dom.d.ts +5 -0
  74. package/dist/packages/utils/index.d.ts +3 -0
  75. package/dist/packages/utils/types.d.ts +7 -0
  76. package/dist/packages/utils/vue-helper.d.ts +9 -0
  77. package/dist/play/main.d.ts +1 -0
  78. package/dist/play/vite.config.d.ts +2 -0
  79. package/package.json +27 -0
  80. package/style/index.scss +89 -0
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),V=Symbol("ui-form"),T={model:{type:Object,default:void 0},rules:{type:Object,default:()=>({})},labelWidth:{type:[Number,String],default:90},labelPosition:{type:String,default:"right"},inline:Boolean,disabled:Boolean,validateOnChange:{type:Boolean,default:!0}},D={submit:(v,o)=>typeof v=="boolean"},I=t.defineComponent({name:"UiForm",__name:"form",props:T,emits:D,setup(v,{expose:o,emit:n}){const s=v,b=n,$=t.reactive({}),g=t.computed(()=>s.model?t.reactive(s.model):$),h={};let _=!1;function E(){if(_||!s.model)return;const i=Object.keys(s.model);if(i.length){for(const r of i)h[r]=s.model[r];_=!0}}t.watch(()=>s.model,E,{immediate:!0});const p=new Set;function q(i){p.add(i)}function M(i){p.delete(i)}function w(i,r){const l=i.getProp();l&&(r[l]=i.getErrors())}async function B(i){let r=!0;const l={};return await Promise.all([...p].map(async c=>{await c.validate("submit")||(r=!1,w(c,l))})),i==null||i(r,l),r}async function A(i,r){let l=!0;const c={},f=i!=null&&i.length?[...p].filter(y=>y.getProp()&&i.includes(y.getProp())):[...p];return await Promise.all(f.map(async y=>{await y.validate("submit")||(l=!1,w(y,c))})),r==null||r(l,c),l}function k(i){i in g.value&&(g.value[i]=i in h?h[i]:void 0)}function O(){for(const i of p)i.resetField()}function N(i){for(const r of p)(!(i!=null&&i.length)||r.getProp()&&i.includes(r.getProp()))&&r.clearValidate()}async function P(){const i=await B();b("submit",i,g.value)}const S=t.ref();function F(i){var l,c;const r=(l=S.value)==null?void 0:l.querySelector(`[data-prop="${i}"]`);if(r){r.scrollIntoView({block:"center"});const f=r.querySelector("input, textarea, select, [tabindex]");(c=f==null?void 0:f.focus)==null||c.call(f)}}const R={model:g,rules:t.computed(()=>s.rules),labelWidth:t.computed(()=>s.labelWidth),labelPosition:t.computed(()=>s.labelPosition),inline:t.computed(()=>s.inline),disabled:t.computed(()=>s.disabled),validateOnChange:t.computed(()=>s.validateOnChange),addField:q,removeField:M,resetField:k,clearValidate:N,validateField:A};return t.provide(V,R),o({validate:B,validateField:A,resetFields:O,clearValidate:N,scrollToField:F}),(i,r)=>(t.openBlock(),t.createElementBlock("form",{ref_key:"formRef",ref:S,class:t.normalizeClass(["ui-form",{"is-inline":i.inline}]),novalidate:"",onSubmit:t.withModifiers(P,["prevent"])},[t.renderSlot(i.$slots,"default",{model:g.value})],34))}}),C={prop:{type:String,default:""},label:{type:String,default:""},labelWidth:{type:[Number,String],default:void 0},labelPosition:{type:String,default:void 0},required:Boolean,rules:{type:[Object,Array],default:void 0},error:{type:String,default:""},showMessage:{type:Boolean,default:!0},disabled:Boolean},z=["data-prop"],K={key:0,class:"ui-form-item__error"},L=t.defineComponent({name:"UiFormItem",__name:"form-item",props:C,setup(v){const o=v,n=t.inject(V,void 0),s=t.computed(()=>o.labelPosition??(n==null?void 0:n.labelPosition.value)??"right"),b=t.computed(()=>o.labelWidth??(n==null?void 0:n.labelWidth.value)),$=t.computed(()=>o.disabled??(n==null?void 0:n.disabled.value)),g=t.computed(()=>{if(s.value!=="top"&&b.value!==void 0)return{width:typeof b.value=="number"?`${b.value}px`:b.value}}),h=t.computed(()=>n==null?void 0:n.model.value);function _(){var e;return o.prop?(e=h.value)==null?void 0:e[o.prop]:void 0}function E(){var d;const e=[],a=o.prop?(d=n==null?void 0:n.rules.value)==null?void 0:d[o.prop]:void 0;return a&&e.push(...Array.isArray(a)?a:[a]),o.rules&&e.push(...Array.isArray(o.rules)?o.rules:[o.rules]),o.required&&!e.some(m=>m.required)&&e.push({required:!0}),e}function p(e,a){return e.filter(d=>d.trigger?(Array.isArray(d.trigger)?d.trigger:[d.trigger]).includes(a):a==="change")}const q=t.computed(()=>o.required||E().some(e=>e.required)),M=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,w=/^(https?:\/\/|ftp:\/\/)?[\w-]+(\.[\w-]+)+([/?].*)?$/i,B={string:e=>typeof e=="string",number:e=>typeof e=="number"||typeof e=="string"&&e.trim()!==""&&!Number.isNaN(Number(e)),boolean:e=>typeof e=="boolean",array:e=>Array.isArray(e),date:e=>e instanceof Date||typeof e=="string"&&!Number.isNaN(Date.parse(e)),email:e=>M.test(String(e??"")),url:e=>w.test(String(e??""))},A={number:"需为数字",array:"需为数组",date:"需为日期",email:"邮箱格式不正确",url:"URL 格式不正确"};function k(e){return e==null||e===""}function O(e){return typeof e=="number"?e:typeof e=="string"||Array.isArray(e)?e.length:0}async function N(e,a,d,m){if(e.required&&k(a))return e.message||`${m||d}不能为空`;if(!k(a)){if(e.type){const u=B[e.type];if(u&&!u(a))return e.message||A[e.type]||"格式不正确"}if(e.min!==void 0||e.max!==void 0){const u=O(a);if(e.min!==void 0&&u<e.min)return e.message||`${m||d}不能小于 ${e.min}`;if(e.max!==void 0&&u>e.max)return e.message||`${m||d}不能大于 ${e.max}`}if(e.pattern&&!e.pattern.test(String(a)))return e.message||"格式不正确";if(e.validator){let u;try{u=e.validator(a,h.value??{}),u instanceof Promise&&(u=await u)}catch{return e.message||"校验不通过"}if(typeof u=="string")return u;if(u===!1)return e.message||"校验不通过"}}}const P=t.ref([]),S=t.ref(""),F=t.computed(()=>o.error||S.value),R=t.computed(()=>F.value!==""),i=t.computed(()=>[`is-label-${s.value}`,{"is-required":q.value,"is-error":R.value,"is-disabled":$.value}]);function r(e){P.value=e,S.value=e[0]??""}function l(){P.value=[],S.value=""}async function c(e="submit"){if(!o.prop)return!0;const a=E(),d=e==="submit"?a:p(a,e);if(d.length===0)return!0;const m=[];for(const u of d){const j=await N(u,_(),o.prop,o.label);j&&m.push(j)}return m.length?r(m):l(),m.length===0}function f(){(n==null?void 0:n.validateOnChange.value)!==!1&&c("change")}function y(){(n==null?void 0:n.validateOnChange.value)!==!1&&c("blur")}function U(){o.prop&&(n==null||n.resetField(o.prop)),l()}const W={getProp:()=>o.prop,validate:c,resetField:U,clearValidate:l,getErrors:()=>[...P.value]};return t.onMounted(()=>n==null?void 0:n.addField(W)),t.onBeforeUnmount(()=>n==null?void 0:n.removeField(W)),(e,a)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["ui-form-item",i.value]),"data-prop":e.prop||void 0},[e.label?(t.openBlock(),t.createElementBlock("label",{key:0,class:"ui-form-item__label",style:t.normalizeStyle(g.value)},t.toDisplayString(e.label),5)):t.createCommentVNode("v-if",!0),t.createElementVNode("div",{class:"ui-form-item__content",onChangeCapture:f,onBlurCapture:y},[t.renderSlot(e.$slots,"default"),t.createVNode(t.Transition,{name:"ui-form-fade"},{default:t.withCtx(()=>[e.showMessage&&F.value?(t.openBlock(),t.createElementBlock("p",K,t.toDisplayString(F.value),1)):t.createCommentVNode("v-if",!0)]),_:1})],32)],10,z))}}),Y={name:"UiForm",install(v){v.component("UiForm",I),v.component("UiFormItem",L)}};exports.Form=I;exports.FormItem=L;exports.FormPlugin=Y;exports.default=I;exports.formContextKey=V;exports.formEmits=D;exports.formItemProps=C;exports.formProps=T;
package/dist/index.js ADDED
@@ -0,0 +1,315 @@
1
+ import { defineComponent as K, reactive as D, computed as s, watch as C, ref as k, provide as J, openBlock as q, createElementBlock as R, withModifiers as Q, normalizeClass as Y, renderSlot as G, inject as X, onMounted as Z, onBeforeUnmount as x, normalizeStyle as ee, toDisplayString as L, createCommentVNode as z, createElementVNode as te, createVNode as ie, Transition as ne, withCtx as re } from "vue";
2
+ const H = Symbol("ui-form"), ae = {
3
+ /** 表单数据(字段值都挂在这个对象上) */
4
+ model: { type: Object, default: void 0 },
5
+ /** 校验规则:{ prop: rule | rule[] } */
6
+ rules: { type: Object, default: () => ({}) },
7
+ /** 标签宽度,number(px) 或 string */
8
+ labelWidth: { type: [Number, String], default: 90 },
9
+ /** 标签位置 */
10
+ labelPosition: { type: String, default: "right" },
11
+ /** 行内布局(表单项水平排列) */
12
+ inline: Boolean,
13
+ /** 整表禁用(提供到上下文,样式级生效,子控件可自行消费) */
14
+ disabled: Boolean,
15
+ /** 字段 change / blur 时是否立即校验对应 trigger 的规则 */
16
+ validateOnChange: { type: Boolean, default: !0 }
17
+ }, oe = {
18
+ /** 原生提交(先做整表校验),参数为是否校验通过 */
19
+ submit: (v, n) => typeof v == "boolean"
20
+ }, se = /* @__PURE__ */ K({
21
+ name: "UiForm",
22
+ __name: "form",
23
+ props: ae,
24
+ emits: oe,
25
+ setup(v, { expose: n, emit: i }) {
26
+ const l = v, b = i, M = D({}), g = s(
27
+ () => l.model ? D(l.model) : M
28
+ ), h = {};
29
+ let _ = !1;
30
+ function w() {
31
+ if (_ || !l.model) return;
32
+ const t = Object.keys(l.model);
33
+ if (t.length) {
34
+ for (const r of t) h[r] = l.model[r];
35
+ _ = !0;
36
+ }
37
+ }
38
+ C(() => l.model, w, { immediate: !0 });
39
+ const p = /* @__PURE__ */ new Set();
40
+ function O(t) {
41
+ p.add(t);
42
+ }
43
+ function V(t) {
44
+ p.delete(t);
45
+ }
46
+ function E(t, r) {
47
+ const o = t.getProp();
48
+ o && (r[o] = t.getErrors());
49
+ }
50
+ async function A(t) {
51
+ let r = !0;
52
+ const o = {};
53
+ return await Promise.all(
54
+ [...p].map(async (c) => {
55
+ await c.validate("submit") || (r = !1, E(c, o));
56
+ })
57
+ ), t == null || t(r, o), r;
58
+ }
59
+ async function $(t, r) {
60
+ let o = !0;
61
+ const c = {}, m = t != null && t.length ? [...p].filter((y) => y.getProp() && t.includes(y.getProp())) : [...p];
62
+ return await Promise.all(
63
+ m.map(async (y) => {
64
+ await y.validate("submit") || (o = !1, E(y, c));
65
+ })
66
+ ), r == null || r(o, c), o;
67
+ }
68
+ function B(t) {
69
+ t in g.value && (g.value[t] = t in h ? h[t] : void 0);
70
+ }
71
+ function I() {
72
+ for (const t of p) t.resetField();
73
+ }
74
+ function N(t) {
75
+ for (const r of p)
76
+ (!(t != null && t.length) || r.getProp() && t.includes(r.getProp())) && r.clearValidate();
77
+ }
78
+ async function F() {
79
+ const t = await A();
80
+ b("submit", t, g.value);
81
+ }
82
+ const S = k();
83
+ function P(t) {
84
+ var o, c;
85
+ const r = (o = S.value) == null ? void 0 : o.querySelector(`[data-prop="${t}"]`);
86
+ if (r) {
87
+ r.scrollIntoView({ block: "center" });
88
+ const m = r.querySelector("input, textarea, select, [tabindex]");
89
+ (c = m == null ? void 0 : m.focus) == null || c.call(m);
90
+ }
91
+ }
92
+ const U = {
93
+ model: g,
94
+ rules: s(() => l.rules),
95
+ labelWidth: s(() => l.labelWidth),
96
+ labelPosition: s(() => l.labelPosition),
97
+ inline: s(() => l.inline),
98
+ disabled: s(() => l.disabled),
99
+ validateOnChange: s(() => l.validateOnChange),
100
+ addField: O,
101
+ removeField: V,
102
+ resetField: B,
103
+ clearValidate: N,
104
+ validateField: $
105
+ };
106
+ return J(H, U), n({ validate: A, validateField: $, resetFields: I, clearValidate: N, scrollToField: P }), (t, r) => (q(), R(
107
+ "form",
108
+ {
109
+ ref_key: "formRef",
110
+ ref: S,
111
+ class: Y(["ui-form", { "is-inline": t.inline }]),
112
+ novalidate: "",
113
+ onSubmit: Q(F, ["prevent"])
114
+ },
115
+ [
116
+ G(t.$slots, "default", { model: g.value })
117
+ ],
118
+ 34
119
+ /* CLASS, NEED_HYDRATION */
120
+ ));
121
+ }
122
+ }), le = {
123
+ /** 字段名(对应 form 的 model 上的 key);留空则仅做布局分组,不参与校验 */
124
+ prop: { type: String, default: "" },
125
+ /** 标签文案 */
126
+ label: { type: String, default: "" },
127
+ /** 标签宽度(覆盖 form 级 labelWidth) */
128
+ labelWidth: { type: [Number, String], default: void 0 },
129
+ /** 标签位置(覆盖 form 级 labelPosition) */
130
+ labelPosition: { type: String, default: void 0 },
131
+ /** 便捷必填标记,等价于 rules: [{ required: true }] */
132
+ required: Boolean,
133
+ /** 校验规则(与 form 级同 prop 规则合并,item 级优先) */
134
+ rules: { type: [Object, Array], default: void 0 },
135
+ /** 外部受控错误信息,设置后直接展示 */
136
+ error: { type: String, default: "" },
137
+ /** 是否显示校验错误提示 */
138
+ showMessage: { type: Boolean, default: !0 },
139
+ /** 单独禁用 */
140
+ disabled: Boolean
141
+ }, ue = ["data-prop"], de = {
142
+ key: 0,
143
+ class: "ui-form-item__error"
144
+ }, ce = /* @__PURE__ */ K({
145
+ name: "UiFormItem",
146
+ __name: "form-item",
147
+ props: le,
148
+ setup(v) {
149
+ const n = v, i = X(H, void 0), l = s(() => n.labelPosition ?? (i == null ? void 0 : i.labelPosition.value) ?? "right"), b = s(() => n.labelWidth ?? (i == null ? void 0 : i.labelWidth.value)), M = s(() => n.disabled ?? (i == null ? void 0 : i.disabled.value)), g = s(() => {
150
+ if (l.value !== "top" && b.value !== void 0)
151
+ return { width: typeof b.value == "number" ? `${b.value}px` : b.value };
152
+ }), h = s(() => i == null ? void 0 : i.model.value);
153
+ function _() {
154
+ var e;
155
+ return n.prop ? (e = h.value) == null ? void 0 : e[n.prop] : void 0;
156
+ }
157
+ function w() {
158
+ var d;
159
+ const e = [], a = n.prop ? (d = i == null ? void 0 : i.rules.value) == null ? void 0 : d[n.prop] : void 0;
160
+ return a && e.push(...Array.isArray(a) ? a : [a]), n.rules && e.push(...Array.isArray(n.rules) ? n.rules : [n.rules]), n.required && !e.some((f) => f.required) && e.push({ required: !0 }), e;
161
+ }
162
+ function p(e, a) {
163
+ return e.filter((d) => d.trigger ? (Array.isArray(d.trigger) ? d.trigger : [d.trigger]).includes(a) : a === "change");
164
+ }
165
+ const O = s(() => n.required || w().some((e) => e.required)), V = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, E = /^(https?:\/\/|ftp:\/\/)?[\w-]+(\.[\w-]+)+([/?].*)?$/i, A = {
166
+ string: (e) => typeof e == "string",
167
+ number: (e) => typeof e == "number" || typeof e == "string" && e.trim() !== "" && !Number.isNaN(Number(e)),
168
+ boolean: (e) => typeof e == "boolean",
169
+ array: (e) => Array.isArray(e),
170
+ date: (e) => e instanceof Date || typeof e == "string" && !Number.isNaN(Date.parse(e)),
171
+ email: (e) => V.test(String(e ?? "")),
172
+ url: (e) => E.test(String(e ?? ""))
173
+ }, $ = {
174
+ number: "需为数字",
175
+ array: "需为数组",
176
+ date: "需为日期",
177
+ email: "邮箱格式不正确",
178
+ url: "URL 格式不正确"
179
+ };
180
+ function B(e) {
181
+ return e == null || e === "";
182
+ }
183
+ function I(e) {
184
+ return typeof e == "number" ? e : typeof e == "string" || Array.isArray(e) ? e.length : 0;
185
+ }
186
+ async function N(e, a, d, f) {
187
+ if (e.required && B(a))
188
+ return e.message || `${f || d}不能为空`;
189
+ if (!B(a)) {
190
+ if (e.type) {
191
+ const u = A[e.type];
192
+ if (u && !u(a))
193
+ return e.message || $[e.type] || "格式不正确";
194
+ }
195
+ if (e.min !== void 0 || e.max !== void 0) {
196
+ const u = I(a);
197
+ if (e.min !== void 0 && u < e.min)
198
+ return e.message || `${f || d}不能小于 ${e.min}`;
199
+ if (e.max !== void 0 && u > e.max)
200
+ return e.message || `${f || d}不能大于 ${e.max}`;
201
+ }
202
+ if (e.pattern && !e.pattern.test(String(a)))
203
+ return e.message || "格式不正确";
204
+ if (e.validator) {
205
+ let u;
206
+ try {
207
+ u = e.validator(a, h.value ?? {}), u instanceof Promise && (u = await u);
208
+ } catch {
209
+ return e.message || "校验不通过";
210
+ }
211
+ if (typeof u == "string") return u;
212
+ if (u === !1) return e.message || "校验不通过";
213
+ }
214
+ }
215
+ }
216
+ const F = k([]), S = k(""), P = s(() => n.error || S.value), U = s(() => P.value !== ""), t = s(() => [
217
+ `is-label-${l.value}`,
218
+ {
219
+ "is-required": O.value,
220
+ "is-error": U.value,
221
+ "is-disabled": M.value
222
+ }
223
+ ]);
224
+ function r(e) {
225
+ F.value = e, S.value = e[0] ?? "";
226
+ }
227
+ function o() {
228
+ F.value = [], S.value = "";
229
+ }
230
+ async function c(e = "submit") {
231
+ if (!n.prop) return !0;
232
+ const a = w(), d = e === "submit" ? a : p(a, e);
233
+ if (d.length === 0) return !0;
234
+ const f = [];
235
+ for (const u of d) {
236
+ const T = await N(u, _(), n.prop, n.label);
237
+ T && f.push(T);
238
+ }
239
+ return f.length ? r(f) : o(), f.length === 0;
240
+ }
241
+ function m() {
242
+ (i == null ? void 0 : i.validateOnChange.value) !== !1 && c("change");
243
+ }
244
+ function y() {
245
+ (i == null ? void 0 : i.validateOnChange.value) !== !1 && c("blur");
246
+ }
247
+ function W() {
248
+ n.prop && (i == null || i.resetField(n.prop)), o();
249
+ }
250
+ const j = {
251
+ getProp: () => n.prop,
252
+ validate: c,
253
+ resetField: W,
254
+ clearValidate: o,
255
+ getErrors: () => [...F.value]
256
+ };
257
+ return Z(() => i == null ? void 0 : i.addField(j)), x(() => i == null ? void 0 : i.removeField(j)), (e, a) => (q(), R("div", {
258
+ class: Y(["ui-form-item", t.value]),
259
+ "data-prop": e.prop || void 0
260
+ }, [
261
+ e.label ? (q(), R(
262
+ "label",
263
+ {
264
+ key: 0,
265
+ class: "ui-form-item__label",
266
+ style: ee(g.value)
267
+ },
268
+ L(e.label),
269
+ 5
270
+ /* TEXT, STYLE */
271
+ )) : z("v-if", !0),
272
+ te(
273
+ "div",
274
+ {
275
+ class: "ui-form-item__content",
276
+ onChangeCapture: m,
277
+ onBlurCapture: y
278
+ },
279
+ [
280
+ G(e.$slots, "default"),
281
+ ie(ne, { name: "ui-form-fade" }, {
282
+ default: re(() => [
283
+ e.showMessage && P.value ? (q(), R(
284
+ "p",
285
+ de,
286
+ L(P.value),
287
+ 1
288
+ /* TEXT */
289
+ )) : z("v-if", !0)
290
+ ]),
291
+ _: 1
292
+ /* STABLE */
293
+ })
294
+ ],
295
+ 32
296
+ /* NEED_HYDRATION */
297
+ )
298
+ ], 10, ue));
299
+ }
300
+ }), me = {
301
+ name: "UiForm",
302
+ install(v) {
303
+ v.component("UiForm", se), v.component("UiFormItem", ce);
304
+ }
305
+ };
306
+ export {
307
+ se as Form,
308
+ ce as FormItem,
309
+ me as FormPlugin,
310
+ se as default,
311
+ H as formContextKey,
312
+ oe as formEmits,
313
+ le as formItemProps,
314
+ ae as formProps
315
+ };
@@ -0,0 +1,10 @@
1
+ import { App } from 'vue';
2
+ import { default as Badge } from './src/badge.vue';
3
+
4
+ export declare const BadgePlugin: {
5
+ name: string;
6
+ install(app: App): void;
7
+ };
8
+ export { Badge };
9
+ export default Badge;
10
+ export * from './src/badge';
@@ -0,0 +1,25 @@
1
+ import { ExtractPropTypes } from 'vue';
2
+
3
+ export declare const badgeProps: {
4
+ readonly value: {
5
+ readonly type: [NumberConstructor, StringConstructor];
6
+ readonly default: 0;
7
+ };
8
+ readonly max: {
9
+ readonly type: NumberConstructor;
10
+ readonly default: undefined;
11
+ };
12
+ readonly isDot: {
13
+ readonly type: BooleanConstructor;
14
+ readonly default: false;
15
+ };
16
+ readonly hidden: {
17
+ readonly type: BooleanConstructor;
18
+ readonly default: false;
19
+ };
20
+ readonly type: {
21
+ readonly type: StringConstructor;
22
+ readonly default: "danger";
23
+ };
24
+ };
25
+ export type BadgeProps = ExtractPropTypes<typeof badgeProps>;
@@ -0,0 +1,12 @@
1
+ import { App } from 'vue';
2
+ import { default as Breadcrumb } from './src/breadcrumb.vue';
3
+ import { default as BreadcrumbItem } from './src/breadcrumb-item.vue';
4
+
5
+ export declare const BreadcrumbPlugin: {
6
+ name: string;
7
+ install(app: App): void;
8
+ };
9
+ export { Breadcrumb, BreadcrumbItem };
10
+ export default Breadcrumb;
11
+ export * from './src/breadcrumb';
12
+ export * from './src/breadcrumb-item';
@@ -0,0 +1,13 @@
1
+ import { ExtractPropTypes } from 'vue';
2
+
3
+ export declare const breadcrumbItemProps: {
4
+ readonly to: {
5
+ readonly type: StringConstructor;
6
+ readonly default: "";
7
+ };
8
+ readonly replace: {
9
+ readonly type: BooleanConstructor;
10
+ readonly default: false;
11
+ };
12
+ };
13
+ export type BreadcrumbItemProps = ExtractPropTypes<typeof breadcrumbItemProps>;
@@ -0,0 +1,10 @@
1
+ import { ExtractPropTypes, InjectionKey } from 'vue';
2
+
3
+ export declare const breadcrumbProps: {
4
+ readonly separator: {
5
+ readonly type: StringConstructor;
6
+ readonly default: "/";
7
+ };
8
+ };
9
+ export type BreadcrumbProps = ExtractPropTypes<typeof breadcrumbProps>;
10
+ export declare const breadcrumbSeparatorKey: InjectionKey<string>;
@@ -0,0 +1,10 @@
1
+ import { App } from 'vue';
2
+ import { default as Button } from './src/button.vue';
3
+
4
+ export declare const ButtonPlugin: {
5
+ name: string;
6
+ install(app: App): void;
7
+ };
8
+ export { Button };
9
+ export default Button;
10
+ export * from './src/button';
@@ -0,0 +1,25 @@
1
+ import { ExtractPropTypes } from 'vue';
2
+
3
+ export declare const buttonProps: {
4
+ readonly type: {
5
+ readonly type: StringConstructor;
6
+ readonly default: "default";
7
+ };
8
+ readonly size: {
9
+ readonly type: StringConstructor;
10
+ readonly default: "medium";
11
+ };
12
+ readonly plain: BooleanConstructor;
13
+ readonly round: BooleanConstructor;
14
+ readonly disabled: BooleanConstructor;
15
+ readonly loading: BooleanConstructor;
16
+ /** 原生 button 的 type,默认 button(避免误触发表单提交) */
17
+ readonly 'native-type': {
18
+ readonly type: StringConstructor;
19
+ readonly default: "button";
20
+ };
21
+ };
22
+ export declare const buttonEmits: {
23
+ click: (e: MouseEvent) => boolean;
24
+ };
25
+ export type ButtonProps = ExtractPropTypes<typeof buttonProps>;
@@ -0,0 +1,10 @@
1
+ import { App } from 'vue';
2
+ import { default as DatePicker } from './src/date-picker.vue';
3
+
4
+ export declare const DatePickerPlugin: {
5
+ name: string;
6
+ install(app: App): void;
7
+ };
8
+ export { DatePicker };
9
+ export default DatePicker;
10
+ export * from './src/date-picker';
@@ -0,0 +1,20 @@
1
+ import { ExtractPropTypes } from 'vue';
2
+
3
+ export declare const datePickerProps: {
4
+ readonly modelValue: {
5
+ readonly type: StringConstructor;
6
+ readonly default: undefined;
7
+ };
8
+ readonly placeholder: {
9
+ readonly type: StringConstructor;
10
+ readonly default: "请选择日期";
11
+ };
12
+ readonly disabled: BooleanConstructor;
13
+ readonly clearable: BooleanConstructor;
14
+ };
15
+ export declare const datePickerEmits: {
16
+ 'update:modelValue': (val: string) => boolean;
17
+ change: (val: string) => boolean;
18
+ clear: () => boolean;
19
+ };
20
+ export type DatePickerProps = ExtractPropTypes<typeof datePickerProps>;
@@ -0,0 +1,12 @@
1
+ import { App } from 'vue';
2
+ import { default as Descriptions } from './src/descriptions.vue';
3
+ import { default as DescriptionsItem } from './src/descriptions-item.vue';
4
+
5
+ export declare const DescriptionsPlugin: {
6
+ name: string;
7
+ install(app: App): void;
8
+ };
9
+ export { Descriptions, DescriptionsItem };
10
+ export default Descriptions;
11
+ export * from './src/descriptions';
12
+ export * from './src/descriptions-item';
@@ -0,0 +1,13 @@
1
+ import { ExtractPropTypes } from 'vue';
2
+
3
+ export declare const descriptionsItemProps: {
4
+ readonly label: {
5
+ readonly type: StringConstructor;
6
+ readonly default: "";
7
+ };
8
+ readonly span: {
9
+ readonly type: NumberConstructor;
10
+ readonly default: 1;
11
+ };
12
+ };
13
+ export type DescriptionsItemProps = ExtractPropTypes<typeof descriptionsItemProps>;
@@ -0,0 +1,17 @@
1
+ import { ExtractPropTypes } from 'vue';
2
+
3
+ export declare const descriptionsProps: {
4
+ readonly title: {
5
+ readonly type: StringConstructor;
6
+ readonly default: "";
7
+ };
8
+ readonly column: {
9
+ readonly type: NumberConstructor;
10
+ readonly default: 3;
11
+ };
12
+ readonly border: {
13
+ readonly type: BooleanConstructor;
14
+ readonly default: false;
15
+ };
16
+ };
17
+ export type DescriptionsProps = ExtractPropTypes<typeof descriptionsProps>;
@@ -0,0 +1,10 @@
1
+ import { App } from 'vue';
2
+ import { default as Divider } from './src/divider.vue';
3
+
4
+ export declare const DividerPlugin: {
5
+ name: string;
6
+ install(app: App): void;
7
+ };
8
+ export { Divider };
9
+ export default Divider;
10
+ export * from './src/divider';
@@ -0,0 +1,20 @@
1
+ import { ExtractPropTypes } from 'vue';
2
+
3
+ export declare const dividerProps: {
4
+ /** 分割线方向 */
5
+ readonly direction: {
6
+ readonly type: StringConstructor;
7
+ readonly default: "horizontal";
8
+ };
9
+ /** 文案在分割线上的位置 */
10
+ readonly contentPosition: {
11
+ readonly type: StringConstructor;
12
+ readonly default: "center";
13
+ };
14
+ /** 是否使用虚线 */
15
+ readonly dashed: {
16
+ readonly type: BooleanConstructor;
17
+ readonly default: false;
18
+ };
19
+ };
20
+ export type DividerProps = ExtractPropTypes<typeof dividerProps>;
@@ -0,0 +1,12 @@
1
+ import { App } from 'vue';
2
+ import { default as Dropdown } from './src/dropdown.vue';
3
+ import { default as DropdownItem } from './src/dropdown-item.vue';
4
+
5
+ export declare const DropdownPlugin: {
6
+ name: string;
7
+ install(app: App): void;
8
+ };
9
+ export { Dropdown, DropdownItem };
10
+ export default Dropdown;
11
+ export * from './src/dropdown';
12
+ export * from './src/dropdown-item';
@@ -0,0 +1,20 @@
1
+ import { ExtractPropTypes } from 'vue';
2
+
3
+ export declare const dropdownItemProps: {
4
+ /** 点击时通过 command 事件回传的标识 */
5
+ readonly command: {
6
+ readonly type: [StringConstructor, NumberConstructor, ObjectConstructor, BooleanConstructor];
7
+ readonly default: undefined;
8
+ };
9
+ /** 是否禁用 */
10
+ readonly disabled: {
11
+ readonly type: BooleanConstructor;
12
+ readonly default: false;
13
+ };
14
+ /** 是否显示上方分隔线 */
15
+ readonly divided: {
16
+ readonly type: BooleanConstructor;
17
+ readonly default: false;
18
+ };
19
+ };
20
+ export type DropdownItemProps = ExtractPropTypes<typeof dropdownItemProps>;
@@ -0,0 +1,46 @@
1
+ import { ExtractPropTypes, InjectionKey } from 'vue';
2
+
3
+ export declare const dropdownProps: {
4
+ /** 触发方式:hover | click | contextmenu */
5
+ readonly trigger: {
6
+ readonly type: StringConstructor;
7
+ readonly default: "hover";
8
+ };
9
+ /** 面板弹出位置 */
10
+ readonly placement: {
11
+ readonly type: StringConstructor;
12
+ readonly default: "bottom-start";
13
+ };
14
+ /** 点击菜单项后是否自动关闭 */
15
+ readonly hideOnClick: {
16
+ readonly type: BooleanConstructor;
17
+ readonly default: true;
18
+ };
19
+ /** hover 打开延迟(ms) */
20
+ readonly showTimeout: {
21
+ readonly type: NumberConstructor;
22
+ readonly default: 150;
23
+ };
24
+ /** hover 关闭延迟(ms) */
25
+ readonly hideTimeout: {
26
+ readonly type: NumberConstructor;
27
+ readonly default: 150;
28
+ };
29
+ /** 是否禁用 */
30
+ readonly disabled: {
31
+ readonly type: BooleanConstructor;
32
+ readonly default: false;
33
+ };
34
+ };
35
+ export declare const dropdownEmits: {
36
+ /** 点击菜单项触发,参数为该项的 command */
37
+ command: (_command: unknown) => boolean;
38
+ /** 面板显隐变化 */
39
+ 'visible-change': (_visible: boolean) => boolean;
40
+ };
41
+ export type DropdownProps = ExtractPropTypes<typeof dropdownProps>;
42
+ /** 提供给 DropdownItem 的上下文 */
43
+ export interface DropdownContext {
44
+ handleItemClick: (command: unknown) => void;
45
+ }
46
+ export declare const dropdownContextKey: InjectionKey<DropdownContext>;
@@ -0,0 +1,12 @@
1
+ import { App } from 'vue';
2
+ import { default as Form } from './src/form.vue';
3
+ import { default as FormItem } from './src/form-item.vue';
4
+
5
+ export declare const FormPlugin: {
6
+ name: string;
7
+ install(app: App): void;
8
+ };
9
+ export { Form, FormItem };
10
+ export default Form;
11
+ export * from './src/form';
12
+ export * from './src/form-item';