@kengic/uni 0.3.2-beta.3

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 (108) hide show
  1. package/README.md +1 -0
  2. package/dist/index.css +1 -0
  3. package/dist/kengic-uni.js +1374 -0
  4. package/dist/src/components/index.d.ts +5 -0
  5. package/dist/src/components/uni-ui/uni-badge/uni-badge.vue.d.ts +108 -0
  6. package/dist/src/components/uni-ui/uni-breadcrumb/uni-breadcrumb.vue.d.ts +23 -0
  7. package/dist/src/components/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue.d.ts +30 -0
  8. package/dist/src/components/uni-ui/uni-calendar/calendar.d.ts +67 -0
  9. package/dist/src/components/uni-ui/uni-calendar/i18n/index.d.ts +39 -0
  10. package/dist/src/components/uni-ui/uni-calendar/uni-calendar-item.vue.d.ts +47 -0
  11. package/dist/src/components/uni-ui/uni-calendar/uni-calendar.vue.d.ts +166 -0
  12. package/dist/src/components/uni-ui/uni-calendar/util.d.ts +211 -0
  13. package/dist/src/components/uni-ui/uni-card/uni-card.vue.d.ts +117 -0
  14. package/dist/src/components/uni-ui/uni-col/uni-col.vue.d.ts +70 -0
  15. package/dist/src/components/uni-ui/uni-collapse/uni-collapse.vue.d.ts +45 -0
  16. package/dist/src/components/uni-ui/uni-collapse-item/uni-collapse-item.vue.d.ts +102 -0
  17. package/dist/src/components/uni-ui/uni-combox/uni-combox.vue.d.ts +95 -0
  18. package/dist/src/components/uni-ui/uni-countdown/i18n/index.d.ts +21 -0
  19. package/dist/src/components/uni-ui/uni-countdown/uni-countdown.vue.d.ts +158 -0
  20. package/dist/src/components/uni-ui/uni-data-checkbox/uni-data-checkbox.vue.d.ts +192 -0
  21. package/dist/src/components/uni-ui/uni-data-picker/uni-data-picker.vue.d.ts +267 -0
  22. package/dist/src/components/uni-ui/uni-data-pickerview/uni-data-picker.d.ts +221 -0
  23. package/dist/src/components/uni-ui/uni-data-pickerview/uni-data-pickerview.vue.d.ts +169 -0
  24. package/dist/src/components/uni-ui/uni-data-select/uni-data-select.vue.d.ts +125 -0
  25. package/dist/src/components/uni-ui/uni-dateformat/date-format.d.ts +6 -0
  26. package/dist/src/components/uni-ui/uni-dateformat/uni-dateformat.vue.d.ts +57 -0
  27. package/dist/src/components/uni-ui/uni-datetime-picker/calendar-item.vue.d.ts +44 -0
  28. package/dist/src/components/uni-ui/uni-datetime-picker/calendar.vue.d.ts +253 -0
  29. package/dist/src/components/uni-ui/uni-datetime-picker/i18n/index.d.ts +69 -0
  30. package/dist/src/components/uni-ui/uni-datetime-picker/time-picker.vue.d.ts +225 -0
  31. package/dist/src/components/uni-ui/uni-datetime-picker/uni-datetime-picker.vue.d.ts +236 -0
  32. package/dist/src/components/uni-ui/uni-datetime-picker/util.d.ts +171 -0
  33. package/dist/src/components/uni-ui/uni-drawer/keypress.d.ts +14 -0
  34. package/dist/src/components/uni-ui/uni-drawer/uni-drawer.vue.d.ts +78 -0
  35. package/dist/src/components/uni-ui/uni-easyinput/uni-easyinput.vue.d.ts +269 -0
  36. package/dist/src/components/uni-ui/uni-fab/uni-fab.vue.d.ts +109 -0
  37. package/dist/src/components/uni-ui/uni-fav/i18n/index.d.ts +15 -0
  38. package/dist/src/components/uni-ui/uni-fav/uni-fav.vue.d.ts +99 -0
  39. package/dist/src/components/uni-ui/uni-file-picker/choose-and-upload-file.d.ts +4 -0
  40. package/dist/src/components/uni-ui/uni-file-picker/uni-file-picker.vue.d.ts +254 -0
  41. package/dist/src/components/uni-ui/uni-file-picker/upload-file.vue.d.ts +81 -0
  42. package/dist/src/components/uni-ui/uni-file-picker/upload-image.vue.d.ts +90 -0
  43. package/dist/src/components/uni-ui/uni-file-picker/utils.d.ts +22 -0
  44. package/dist/src/components/uni-ui/uni-forms/uni-forms.vue.d.ts +160 -0
  45. package/dist/src/components/uni-ui/uni-forms/utils.d.ts +20 -0
  46. package/dist/src/components/uni-ui/uni-forms/validate.d.ts +42 -0
  47. package/dist/src/components/uni-ui/uni-forms-item/uni-forms-item.vue.d.ts +127 -0
  48. package/dist/src/components/uni-ui/uni-goods-nav/i18n/index.d.ts +21 -0
  49. package/dist/src/components/uni-ui/uni-goods-nav/uni-goods-nav.vue.d.ts +61 -0
  50. package/dist/src/components/uni-ui/uni-grid/uni-grid.vue.d.ts +59 -0
  51. package/dist/src/components/uni-ui/uni-grid-item/uni-grid-item.vue.d.ts +26 -0
  52. package/dist/src/components/uni-ui/uni-group/uni-group.vue.d.ts +52 -0
  53. package/dist/src/components/uni-ui/uni-icons/icons.d.ts +15 -0
  54. package/dist/src/components/uni-ui/uni-icons/uni-icons.vue.d.ts +56 -0
  55. package/dist/src/components/uni-ui/uni-indexed-list/uni-indexed-list-item.vue.d.ts +45 -0
  56. package/dist/src/components/uni-ui/uni-indexed-list/uni-indexed-list.vue.d.ts +49 -0
  57. package/dist/src/components/uni-ui/uni-link/uni-link.vue.d.ts +75 -0
  58. package/dist/src/components/uni-ui/uni-list/uni-list.vue.d.ts +53 -0
  59. package/dist/src/components/uni-ui/uni-list/uni-refresh.vue.d.ts +22 -0
  60. package/dist/src/components/uni-ui/uni-list-ad/uni-list-ad.vue.d.ts +25 -0
  61. package/dist/src/components/uni-ui/uni-list-chat/uni-list-chat.vue.d.ts +123 -0
  62. package/dist/src/components/uni-ui/uni-list-item/uni-list-item.vue.d.ts +248 -0
  63. package/dist/src/components/uni-ui/uni-load-more/i18n/index.d.ts +18 -0
  64. package/dist/src/components/uni-ui/uni-load-more/uni-load-more.vue.d.ts +89 -0
  65. package/dist/src/components/uni-ui/uni-nav-bar/uni-nav-bar.vue.d.ts +163 -0
  66. package/dist/src/components/uni-ui/uni-nav-bar/uni-status-bar.vue.d.ts +4 -0
  67. package/dist/src/components/uni-ui/uni-notice-bar/uni-notice-bar.vue.d.ts +138 -0
  68. package/dist/src/components/uni-ui/uni-number-box/uni-number-box.vue.d.ts +90 -0
  69. package/dist/src/components/uni-ui/uni-pagination/i18n/index.d.ts +28 -0
  70. package/dist/src/components/uni-ui/uni-pagination/uni-pagination.vue.d.ts +127 -0
  71. package/dist/src/components/uni-ui/uni-popup/i18n/index.d.ts +24 -0
  72. package/dist/src/components/uni-ui/uni-popup/keypress.d.ts +14 -0
  73. package/dist/src/components/uni-ui/uni-popup/popup.d.ts +17 -0
  74. package/dist/src/components/uni-ui/uni-popup/uni-popup.vue.d.ts +136 -0
  75. package/dist/src/components/uni-ui/uni-popup-dialog/uni-popup-dialog.vue.d.ts +123 -0
  76. package/dist/src/components/uni-ui/uni-popup-message/uni-popup-message.vue.d.ts +67 -0
  77. package/dist/src/components/uni-ui/uni-popup-share/uni-popup-share.vue.d.ts +49 -0
  78. package/dist/src/components/uni-ui/uni-rate/uni-rate.vue.d.ts +154 -0
  79. package/dist/src/components/uni-ui/uni-row/uni-row.vue.d.ts +41 -0
  80. package/dist/src/components/uni-ui/uni-search-bar/i18n/index.d.ts +15 -0
  81. package/dist/src/components/uni-ui/uni-search-bar/uni-search-bar.vue.d.ts +126 -0
  82. package/dist/src/components/uni-ui/uni-section/uni-section.vue.d.ts +85 -0
  83. package/dist/src/components/uni-ui/uni-segmented-control/uni-segmented-control.vue.d.ts +47 -0
  84. package/dist/src/components/uni-ui/uni-steps/uni-steps.vue.d.ts +59 -0
  85. package/dist/src/components/uni-ui/uni-swipe-action/uni-swipe-action.vue.d.ts +6 -0
  86. package/dist/src/components/uni-ui/uni-swiper-dot/uni-swiper-dot.vue.d.ts +65 -0
  87. package/dist/src/components/uni-ui/uni-table/uni-table.vue.d.ts +99 -0
  88. package/dist/src/components/uni-ui/uni-tag/uni-tag.vue.d.ts +84 -0
  89. package/dist/src/components/uni-ui/uni-tbody/uni-tbody.vue.d.ts +2 -0
  90. package/dist/src/components/uni-ui/uni-td/uni-td.vue.d.ts +48 -0
  91. package/dist/src/components/uni-ui/uni-th/filter-dropdown.vue.d.ts +99 -0
  92. package/dist/src/components/uni-ui/uni-th/uni-th.vue.d.ts +97 -0
  93. package/dist/src/components/uni-ui/uni-thead/uni-thead.vue.d.ts +15 -0
  94. package/dist/src/components/uni-ui/uni-title/uni-title.vue.d.ts +54 -0
  95. package/dist/src/components/uni-ui/uni-tooltip/uni-tooltip.vue.d.ts +23 -0
  96. package/dist/src/components/uni-ui/uni-tr/table-checkbox.vue.d.ts +58 -0
  97. package/dist/src/components/uni-ui/uni-tr/uni-tr.vue.d.ts +39 -0
  98. package/dist/src/components/uni-ui/uni-transition/createAnimation.d.ts +16 -0
  99. package/dist/src/components/uni-ui/uni-transition/uni-transition.vue.d.ts +240 -0
  100. package/dist/src/consts/i18n/en.d.ts +45 -0
  101. package/dist/src/consts/i18n/index.d.ts +90 -0
  102. package/dist/src/consts/i18n/zh_CN.d.ts +45 -0
  103. package/dist/src/consts/index.d.ts +1 -0
  104. package/dist/src/helpers/tsx.helper.d.ts +13 -0
  105. package/dist/src/index.d.ts +3 -0
  106. package/dist/src/utils/index.d.ts +1 -0
  107. package/dist/src/utils/kg.util.d.ts +5 -0
  108. package/package.json +79 -0
@@ -0,0 +1,1374 @@
1
+ import O, { openBlock as d, createElementBlock as p, renderSlot as b, normalizeClass as v, normalizeStyle as w, toDisplayString as $, createCommentVNode as S, defineComponent as M, createElementVNode as h, resolveComponent as L, createBlock as _, Fragment as V } from "vue";
2
+ const F = (e, t) => {
3
+ const r = e.__vccOpts || e;
4
+ for (const [i, s] of t)
5
+ r[i] = s;
6
+ return r;
7
+ }, P = {
8
+ name: "UniBadge",
9
+ emits: ["click"],
10
+ props: {
11
+ type: {
12
+ type: String,
13
+ default: "error"
14
+ },
15
+ inverted: {
16
+ type: Boolean,
17
+ default: !1
18
+ },
19
+ isDot: {
20
+ type: Boolean,
21
+ default: !1
22
+ },
23
+ maxNum: {
24
+ type: Number,
25
+ default: 99
26
+ },
27
+ absolute: {
28
+ type: String,
29
+ default: ""
30
+ },
31
+ offset: {
32
+ type: Array,
33
+ default() {
34
+ return [0, 0];
35
+ }
36
+ },
37
+ text: {
38
+ type: [String, Number],
39
+ default: ""
40
+ },
41
+ size: {
42
+ type: String,
43
+ default: "small"
44
+ },
45
+ customStyle: {
46
+ type: Object,
47
+ default() {
48
+ return {};
49
+ }
50
+ }
51
+ },
52
+ data() {
53
+ return {};
54
+ },
55
+ computed: {
56
+ width() {
57
+ return String(this.text).length * 8 + 12;
58
+ },
59
+ classNames() {
60
+ const { inverted: e, type: t, size: r, absolute: i } = this;
61
+ return [e ? "uni-badge--" + t + "-inverted" : "", "uni-badge--" + t, "uni-badge--" + r, i ? "uni-badge--absolute" : ""].join(
62
+ " "
63
+ );
64
+ },
65
+ positionStyle() {
66
+ if (!this.absolute)
67
+ return {};
68
+ let e = this.width / 2, t = 10;
69
+ this.isDot && (e = 5, t = 5);
70
+ const r = `${-e + this.offset[0]}px`, i = `${-t + this.offset[1]}px`, s = {
71
+ rightTop: {
72
+ right: r,
73
+ top: i
74
+ },
75
+ rightBottom: {
76
+ right: r,
77
+ bottom: i
78
+ },
79
+ leftBottom: {
80
+ left: r,
81
+ bottom: i
82
+ },
83
+ leftTop: {
84
+ left: r,
85
+ top: i
86
+ }
87
+ }, n = s[this.absolute];
88
+ return n || s.rightTop;
89
+ },
90
+ dotStyle() {
91
+ return this.isDot ? {
92
+ width: "10px",
93
+ minWidth: "0",
94
+ height: "10px",
95
+ padding: "0",
96
+ borderRadius: "10px"
97
+ } : {};
98
+ },
99
+ displayValue() {
100
+ const { isDot: e, text: t, maxNum: r } = this;
101
+ return e ? "" : Number(t) > r ? `${r}+` : t;
102
+ }
103
+ },
104
+ methods: {
105
+ onClick() {
106
+ this.$emit("click");
107
+ }
108
+ }
109
+ }, q = { class: "uni-badge--x" };
110
+ function x(e, t, r, i, s, n) {
111
+ return d(), p("view", q, [
112
+ b(e.$slots, "default"),
113
+ r.text ? (d(), p("text", {
114
+ key: 0,
115
+ class: v([n.classNames, "uni-badge"]),
116
+ style: w([n.positionStyle, r.customStyle, n.dotStyle]),
117
+ onClick: t[0] || (t[0] = (a) => n.onClick())
118
+ }, $(n.displayValue), 7)) : S("", !0)
119
+ ]);
120
+ }
121
+ const Ie = /* @__PURE__ */ F(P, [["render", x]]);
122
+ const U = M({
123
+ name: "UniCard",
124
+ emits: ["click"],
125
+ props: {
126
+ title: {
127
+ type: String,
128
+ default: ""
129
+ },
130
+ subTitle: {
131
+ type: String,
132
+ default: ""
133
+ },
134
+ padding: {
135
+ type: String,
136
+ default: "10px"
137
+ },
138
+ margin: {
139
+ type: String,
140
+ default: "15px"
141
+ },
142
+ spacing: {
143
+ type: String,
144
+ default: "0 10px"
145
+ },
146
+ extra: {
147
+ type: String,
148
+ default: ""
149
+ },
150
+ cover: {
151
+ type: String,
152
+ default: ""
153
+ },
154
+ thumbnail: {
155
+ type: String,
156
+ default: ""
157
+ },
158
+ isFull: {
159
+ type: Boolean,
160
+ default: !1
161
+ },
162
+ isShadow: {
163
+ type: Boolean,
164
+ default: !0
165
+ },
166
+ shadow: {
167
+ type: String,
168
+ default: "0px 0px 3px 1px rgba(0, 0, 0, 0.08)"
169
+ },
170
+ border: {
171
+ type: Boolean,
172
+ default: !0
173
+ }
174
+ },
175
+ methods: {
176
+ onClick(e) {
177
+ this.$emit("click", e);
178
+ }
179
+ }
180
+ }), z = {
181
+ key: 0,
182
+ class: "uni-card__cover"
183
+ }, W = ["src"], H = {
184
+ key: 0,
185
+ class: "uni-card__header"
186
+ }, J = {
187
+ key: 0,
188
+ class: "uni-card__header-avatar"
189
+ }, G = ["src"], K = { class: "uni-card__header-content" }, X = { class: "uni-card__header-content-title uni-ellipsis" }, Q = {
190
+ key: 0,
191
+ class: "uni-card__header-content-subtitle uni-ellipsis"
192
+ }, Y = { class: "uni-card__header-extra-text" };
193
+ function Z(e, t, r, i, s, n) {
194
+ return d(), p("view", {
195
+ class: v(["uni-card", { "uni-card--full": e.isFull, "uni-card--shadow": e.isShadow, "uni-card--border": e.border }]),
196
+ style: w({ margin: e.isFull ? 0 : e.margin, padding: e.spacing, "box-shadow": e.isShadow ? e.shadow : "" })
197
+ }, [
198
+ b(e.$slots, "cover", {}, () => [
199
+ e.cover ? (d(), p("view", z, [
200
+ h("image", {
201
+ class: "uni-card__cover-image",
202
+ mode: "widthFix",
203
+ onClick: t[0] || (t[0] = (a) => e.onClick("cover")),
204
+ src: e.cover
205
+ }, null, 8, W)
206
+ ])) : S("", !0)
207
+ ]),
208
+ b(e.$slots, "title", {}, () => [
209
+ e.title || e.extra ? (d(), p("view", H, [
210
+ h("view", {
211
+ class: "uni-card__header-box",
212
+ onClick: t[1] || (t[1] = (a) => e.onClick("title"))
213
+ }, [
214
+ e.thumbnail ? (d(), p("view", J, [
215
+ h("image", {
216
+ class: "uni-card__header-avatar-image",
217
+ src: e.thumbnail,
218
+ mode: "aspectFit"
219
+ }, null, 8, G)
220
+ ])) : S("", !0),
221
+ h("view", K, [
222
+ h("text", X, $(e.title), 1),
223
+ e.title && e.subTitle ? (d(), p("text", Q, $(e.subTitle), 1)) : S("", !0)
224
+ ])
225
+ ]),
226
+ h("view", {
227
+ class: "uni-card__header-extra",
228
+ onClick: t[2] || (t[2] = (a) => e.onClick("extra"))
229
+ }, [
230
+ b(e.$slots, "extra", {}, () => [
231
+ h("text", Y, $(e.extra), 1)
232
+ ])
233
+ ])
234
+ ])) : S("", !0)
235
+ ]),
236
+ h("view", {
237
+ class: "uni-card__content",
238
+ style: w({ padding: e.padding }),
239
+ onClick: t[3] || (t[3] = (a) => e.onClick("content"))
240
+ }, [
241
+ b(e.$slots, "default")
242
+ ], 4),
243
+ h("view", {
244
+ class: "uni-card__actions",
245
+ onClick: t[4] || (t[4] = (a) => e.onClick("actions"))
246
+ }, [
247
+ b(e.$slots, "actions")
248
+ ])
249
+ ], 6);
250
+ }
251
+ const Re = /* @__PURE__ */ F(U, [["render", Z]]);
252
+ function ee(e) {
253
+ let t = "";
254
+ for (let r in e)
255
+ e[r] && (t += `${r} `);
256
+ return t;
257
+ }
258
+ function I(e) {
259
+ let t = "";
260
+ for (let r in e) {
261
+ const i = e[r];
262
+ t += `${r}:${i};`;
263
+ }
264
+ return t;
265
+ }
266
+ const te = M({
267
+ name: "UniEasyinput",
268
+ emits: ["click", "iconClick", "update:modelValue", "input", "focus", "blur", "confirm", "clear", "eyes", "change", "keyboardheightchange"],
269
+ model: {
270
+ prop: "modelValue",
271
+ event: "update:modelValue"
272
+ },
273
+ options: {
274
+ virtualHost: !0
275
+ },
276
+ inject: {
277
+ form: {
278
+ from: "uniForm",
279
+ default: null
280
+ },
281
+ formItem: {
282
+ from: "uniFormItem",
283
+ default: null
284
+ }
285
+ },
286
+ props: {
287
+ name: String,
288
+ value: [Number, String],
289
+ modelValue: [Number, String],
290
+ type: {
291
+ type: String,
292
+ default: "text"
293
+ },
294
+ clearable: {
295
+ type: Boolean,
296
+ default: !0
297
+ },
298
+ autoHeight: {
299
+ type: Boolean,
300
+ default: !1
301
+ },
302
+ placeholder: {
303
+ type: String,
304
+ default: " "
305
+ },
306
+ placeholderStyle: String,
307
+ focus: {
308
+ type: Boolean,
309
+ default: !1
310
+ },
311
+ disabled: {
312
+ type: Boolean,
313
+ default: !1
314
+ },
315
+ maxlength: {
316
+ type: [Number, String],
317
+ default: 140
318
+ },
319
+ confirmType: {
320
+ type: String,
321
+ default: "done"
322
+ },
323
+ clearSize: {
324
+ type: [Number, String],
325
+ default: 24
326
+ },
327
+ inputBorder: {
328
+ type: Boolean,
329
+ default: !0
330
+ },
331
+ prefixIcon: {
332
+ type: String,
333
+ default: ""
334
+ },
335
+ suffixIcon: {
336
+ type: String,
337
+ default: ""
338
+ },
339
+ trim: {
340
+ type: [Boolean, String],
341
+ default: !1
342
+ },
343
+ cursorSpacing: {
344
+ type: Number,
345
+ default: 0
346
+ },
347
+ passwordIcon: {
348
+ type: Boolean,
349
+ default: !0
350
+ },
351
+ primaryColor: {
352
+ type: String,
353
+ default: "#2979ff"
354
+ },
355
+ styles: {
356
+ type: Object,
357
+ default() {
358
+ return {
359
+ color: "#333",
360
+ backgroundColor: "#fff",
361
+ disableColor: "#F7F6F6",
362
+ borderColor: "#e5e5e5"
363
+ };
364
+ }
365
+ },
366
+ errorMessage: {
367
+ type: [String, Boolean],
368
+ default: ""
369
+ }
370
+ },
371
+ data() {
372
+ return {
373
+ focused: !1,
374
+ val: "",
375
+ showMsg: "",
376
+ border: !1,
377
+ isFirstBorder: !1,
378
+ showClearIcon: !1,
379
+ showPassword: !1,
380
+ focusShow: !1,
381
+ localMsg: "",
382
+ isEnter: !1
383
+ };
384
+ },
385
+ computed: {
386
+ isVal() {
387
+ const e = this.val;
388
+ return !!(e || e === 0);
389
+ },
390
+ msg() {
391
+ return this.localMsg || this.errorMessage;
392
+ },
393
+ inputMaxlength() {
394
+ return Number(this.maxlength);
395
+ },
396
+ boxStyle() {
397
+ return `color:${this.inputBorder && this.msg ? "#e43d33" : this.styles.color};`;
398
+ },
399
+ inputContentClass() {
400
+ return ee({
401
+ "is-input-border": this.inputBorder,
402
+ "is-input-error-border": this.inputBorder && this.msg,
403
+ "is-textarea": this.type === "textarea",
404
+ "is-disabled": this.disabled,
405
+ "is-focused": this.focusShow
406
+ });
407
+ },
408
+ inputContentStyle() {
409
+ const e = this.focusShow ? this.primaryColor : this.styles.borderColor, t = this.inputBorder && this.msg ? "#dd524d" : e;
410
+ return I({
411
+ "border-color": t || "#e5e5e5",
412
+ "background-color": this.disabled ? this.styles.disableColor : this.styles.backgroundColor
413
+ });
414
+ },
415
+ inputStyle() {
416
+ const e = this.type === "password" || this.clearable || this.prefixIcon ? "" : "10px";
417
+ return I({
418
+ "padding-right": e,
419
+ "padding-left": this.prefixIcon ? "" : "10px"
420
+ });
421
+ }
422
+ },
423
+ watch: {
424
+ value(e) {
425
+ this.val = e;
426
+ },
427
+ modelValue(e) {
428
+ this.val = e;
429
+ },
430
+ focus(e) {
431
+ this.$nextTick(() => {
432
+ this.focused = this.focus, this.focusShow = this.focus;
433
+ });
434
+ }
435
+ },
436
+ created() {
437
+ this.init(), this.form && this.formItem && this.$watch("formItem.errMsg", (e) => {
438
+ this.localMsg = e;
439
+ });
440
+ },
441
+ mounted() {
442
+ this.$nextTick(() => {
443
+ this.focused = this.focus, this.focusShow = this.focus;
444
+ });
445
+ },
446
+ methods: {
447
+ init() {
448
+ this.value || this.value === 0 ? this.val = this.value : this.modelValue || this.modelValue === 0 || this.modelValue === "" ? this.val = this.modelValue : this.val = null;
449
+ },
450
+ onClickIcon(e) {
451
+ this.$emit("iconClick", e);
452
+ },
453
+ onEyes() {
454
+ this.showPassword = !this.showPassword, this.$emit("eyes", this.showPassword);
455
+ },
456
+ onInput(e) {
457
+ let t = e.detail.value;
458
+ this.trim && (typeof this.trim == "boolean" && this.trim && (t = this.trimStr(t)), typeof this.trim == "string" && (t = this.trimStr(t, this.trim))), this.errMsg && (this.errMsg = ""), this.val = t, this.$emit("input", t), this.$emit("update:modelValue", t);
459
+ },
460
+ onFocus() {
461
+ this.$nextTick(() => {
462
+ this.focused = !0;
463
+ }), this.$emit("focus", null);
464
+ },
465
+ _Focus(e) {
466
+ this.focusShow = !0, this.$emit("focus", e);
467
+ },
468
+ onBlur() {
469
+ this.focused = !1, this.$emit("focus", null);
470
+ },
471
+ _Blur(e) {
472
+ if (e.detail.value, this.focusShow = !1, this.$emit("blur", e), this.isEnter === !1 && this.$emit("change", this.val), this.form && this.formItem) {
473
+ const { validateTrigger: t } = this.form;
474
+ t === "blur" && this.formItem.onFieldChange();
475
+ }
476
+ },
477
+ onConfirm(e) {
478
+ this.$emit("confirm", this.val), this.isEnter = !0, this.$emit("change", this.val), this.$nextTick(() => {
479
+ this.isEnter = !1;
480
+ });
481
+ },
482
+ onClear(e) {
483
+ this.val = "", this.$emit("input", ""), this.$emit("update:modelValue", ""), this.$emit("clear");
484
+ },
485
+ onkeyboardheightchange(e) {
486
+ this.$emit("keyboardheightchange", e);
487
+ },
488
+ trimStr(e, t = "both") {
489
+ return t === "both" ? e.trim() : t === "left" ? e.trimLeft() : t === "right" ? e.trimRight() : t === "start" ? e.trimStart() : t === "end" ? e.trimEnd() : t === "all" ? e.replace(/\s+/g, "") : e;
490
+ }
491
+ }
492
+ }), re = ["name", "value", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "autoHeight", "cursor-spacing"], ie = ["type", "name", "value", "password", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "confirmType", "cursor-spacing"];
493
+ function se(e, t, r, i, s, n) {
494
+ const a = L("uni-icons");
495
+ return d(), p("view", {
496
+ class: v(["uni-easyinput", { "uni-easyinput-error": e.msg }]),
497
+ style: w(e.boxStyle)
498
+ }, [
499
+ h("view", {
500
+ class: v(["uni-easyinput__content", e.inputContentClass]),
501
+ style: w(e.inputContentStyle)
502
+ }, [
503
+ e.prefixIcon ? (d(), _(a, {
504
+ key: 0,
505
+ class: "content-clear-icon",
506
+ type: e.prefixIcon,
507
+ color: "#c0c4cc",
508
+ onClick: t[0] || (t[0] = (l) => e.onClickIcon("prefix")),
509
+ size: "22"
510
+ }, null, 8, ["type"])) : S("", !0),
511
+ e.type === "textarea" ? (d(), p("textarea", {
512
+ key: 1,
513
+ class: v(["uni-easyinput__content-textarea", { "input-padding": e.inputBorder }]),
514
+ name: e.name,
515
+ value: e.val,
516
+ placeholder: e.placeholder,
517
+ placeholderStyle: e.placeholderStyle,
518
+ disabled: e.disabled,
519
+ "placeholder-class": "uni-easyinput__placeholder-class",
520
+ maxlength: e.inputMaxlength,
521
+ focus: e.focused,
522
+ autoHeight: e.autoHeight,
523
+ "cursor-spacing": e.cursorSpacing,
524
+ onInput: t[1] || (t[1] = (...l) => e.onInput && e.onInput(...l)),
525
+ onBlur: t[2] || (t[2] = (...l) => e._Blur && e._Blur(...l)),
526
+ onFocus: t[3] || (t[3] = (...l) => e._Focus && e._Focus(...l)),
527
+ onConfirm: t[4] || (t[4] = (...l) => e.onConfirm && e.onConfirm(...l)),
528
+ onKeyboardheightchange: t[5] || (t[5] = (...l) => e.onkeyboardheightchange && e.onkeyboardheightchange(...l))
529
+ }, null, 42, re)) : (d(), p("input", {
530
+ key: 2,
531
+ type: e.type === "password" ? "text" : e.type,
532
+ class: "uni-easyinput__content-input",
533
+ style: w(e.inputStyle),
534
+ name: e.name,
535
+ value: e.val,
536
+ password: !e.showPassword && e.type === "password",
537
+ placeholder: e.placeholder,
538
+ placeholderStyle: e.placeholderStyle,
539
+ "placeholder-class": "uni-easyinput__placeholder-class",
540
+ disabled: e.disabled,
541
+ maxlength: e.inputMaxlength,
542
+ focus: e.focused,
543
+ confirmType: e.confirmType,
544
+ "cursor-spacing": e.cursorSpacing,
545
+ onFocus: t[6] || (t[6] = (...l) => e._Focus && e._Focus(...l)),
546
+ onBlur: t[7] || (t[7] = (...l) => e._Blur && e._Blur(...l)),
547
+ onInput: t[8] || (t[8] = (...l) => e.onInput && e.onInput(...l)),
548
+ onConfirm: t[9] || (t[9] = (...l) => e.onConfirm && e.onConfirm(...l)),
549
+ onKeyboardheightchange: t[10] || (t[10] = (...l) => e.onkeyboardheightchange && e.onkeyboardheightchange(...l))
550
+ }, null, 44, ie)),
551
+ e.type === "password" && e.passwordIcon ? (d(), p(V, { key: 3 }, [
552
+ e.isVal ? (d(), _(a, {
553
+ key: 0,
554
+ class: v(["content-clear-icon", { "is-textarea-icon": e.type === "textarea" }]),
555
+ type: e.showPassword ? "eye-slash-filled" : "eye-filled",
556
+ size: 22,
557
+ color: e.focusShow ? e.primaryColor : "#c0c4cc",
558
+ onClick: e.onEyes
559
+ }, null, 8, ["class", "type", "color", "onClick"])) : S("", !0)
560
+ ], 64)) : e.suffixIcon ? (d(), p(V, { key: 4 }, [
561
+ e.suffixIcon ? (d(), _(a, {
562
+ key: 0,
563
+ class: "content-clear-icon",
564
+ type: e.suffixIcon,
565
+ color: "#c0c4cc",
566
+ onClick: t[11] || (t[11] = (l) => e.onClickIcon("suffix")),
567
+ size: "22"
568
+ }, null, 8, ["type"])) : S("", !0)
569
+ ], 64)) : (d(), p(V, { key: 5 }, [
570
+ e.clearable && e.isVal && !e.disabled && e.type !== "textarea" ? (d(), _(a, {
571
+ key: 0,
572
+ class: v(["content-clear-icon", { "is-textarea-icon": e.type === "textarea" }]),
573
+ type: "clear",
574
+ size: e.clearSize,
575
+ color: e.msg ? "#dd524d" : e.focusShow ? e.primaryColor : "#c0c4cc",
576
+ onClick: e.onClear
577
+ }, null, 8, ["class", "size", "color", "onClick"])) : S("", !0)
578
+ ], 64)),
579
+ b(e.$slots, "right")
580
+ ], 6)
581
+ ], 6);
582
+ }
583
+ const Ae = /* @__PURE__ */ F(te, [["render", se]]);
584
+ var B = {
585
+ email: /^\S+?@\S+?\.\S+?$/,
586
+ idcard: /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
587
+ url: new RegExp(
588
+ "^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$",
589
+ "i"
590
+ )
591
+ };
592
+ const R = {
593
+ int: "integer",
594
+ bool: "boolean",
595
+ double: "number",
596
+ long: "number",
597
+ password: "string"
598
+ };
599
+ function g(e, t = "") {
600
+ var r = ["label"];
601
+ r.forEach((s) => {
602
+ e[s] === void 0 && (e[s] = "");
603
+ });
604
+ let i = t;
605
+ for (let s in e) {
606
+ let n = new RegExp("{" + s + "}");
607
+ i = i.replace(n, e[s]);
608
+ }
609
+ return i;
610
+ }
611
+ function ne(e, t) {
612
+ return !!(e == null || typeof e == "string" && !e || Array.isArray(e) && !e.length || t === "object" && !Object.keys(e).length);
613
+ }
614
+ const y = {
615
+ integer(e) {
616
+ return y.number(e) && parseInt(e, 10) === e;
617
+ },
618
+ string(e) {
619
+ return typeof e == "string";
620
+ },
621
+ number(e) {
622
+ return isNaN(e) ? !1 : typeof e == "number";
623
+ },
624
+ boolean: function(e) {
625
+ return typeof e == "boolean";
626
+ },
627
+ float: function(e) {
628
+ return y.number(e) && !y.integer(e);
629
+ },
630
+ array(e) {
631
+ return Array.isArray(e);
632
+ },
633
+ object(e) {
634
+ return typeof e == "object" && !y.array(e);
635
+ },
636
+ date(e) {
637
+ return e instanceof Date;
638
+ },
639
+ timestamp(e) {
640
+ return !(!this.integer(e) || Math.abs(e).toString().length > 16);
641
+ },
642
+ file(e) {
643
+ return typeof e.url == "string";
644
+ },
645
+ email(e) {
646
+ return typeof e == "string" && !!e.match(B.email) && e.length < 255;
647
+ },
648
+ url(e) {
649
+ return typeof e == "string" && !!e.match(B.url);
650
+ },
651
+ pattern(e, t) {
652
+ try {
653
+ return new RegExp(e).test(t);
654
+ } catch {
655
+ return !1;
656
+ }
657
+ },
658
+ method(e) {
659
+ return typeof e == "function";
660
+ },
661
+ idcard(e) {
662
+ return typeof e == "string" && !!e.match(B.idcard);
663
+ },
664
+ "url-https"(e) {
665
+ return this.url(e) && e.startsWith("https://");
666
+ },
667
+ "url-scheme"(e) {
668
+ return e.startsWith("://");
669
+ },
670
+ "url-web"(e) {
671
+ return !1;
672
+ }
673
+ };
674
+ class ae {
675
+ constructor(t) {
676
+ this._message = t;
677
+ }
678
+ async validateRule(t, r, i, s, n) {
679
+ var a = null;
680
+ let l = r.rules;
681
+ if (l.findIndex((o) => o.required) < 0 && (i == null || typeof i == "string" && !i.length))
682
+ return a;
683
+ var c = this._message;
684
+ if (l === void 0)
685
+ return c.default;
686
+ for (var m = 0; m < l.length; m++) {
687
+ let o = l[m], f = this._getValidateType(o);
688
+ if (Object.assign(o, {
689
+ label: r.label || `["${t}"]`
690
+ }), A[f] && (a = A[f](o, i, c), a != null))
691
+ break;
692
+ if (o.validateExpr) {
693
+ let j = Date.now();
694
+ if (o.validateExpr(i, n, j) === !1) {
695
+ a = this._getMessage(o, o.errorMessage || this._message.default);
696
+ break;
697
+ }
698
+ }
699
+ if (o.validateFunction && (a = await this.validateFunction(o, i, s, n, f), a !== null))
700
+ break;
701
+ }
702
+ return a !== null && (a = c.TAG + a), a;
703
+ }
704
+ async validateFunction(t, r, i, s, n) {
705
+ let a = null;
706
+ try {
707
+ let l = null;
708
+ const u = await t.validateFunction(t, r, s || i, (c) => {
709
+ l = c;
710
+ });
711
+ (l || typeof u == "string" && u || u === !1) && (a = this._getMessage(t, l || u, n));
712
+ } catch (l) {
713
+ a = this._getMessage(t, l.message, n);
714
+ }
715
+ return a;
716
+ }
717
+ _getMessage(t, r, i) {
718
+ return g(t, r || t.errorMessage || this._message[i] || r.default);
719
+ }
720
+ _getValidateType(t) {
721
+ var r = "";
722
+ return t.required ? r = "required" : t.format ? r = "format" : t.arrayType ? r = "arrayTypeFormat" : t.range ? r = "range" : t.maximum !== void 0 || t.minimum !== void 0 ? r = "rangeNumber" : t.maxLength !== void 0 || t.minLength !== void 0 ? r = "rangeLength" : t.pattern ? r = "pattern" : t.validateFunction && (r = "validateFunction"), r;
723
+ }
724
+ }
725
+ const A = {
726
+ required(e, t, r) {
727
+ return e.required && ne(t, e.format || typeof t) ? g(e, e.errorMessage || r.required) : null;
728
+ },
729
+ range(e, t, r) {
730
+ const {
731
+ range: i,
732
+ errorMessage: s
733
+ } = e;
734
+ let n = new Array(i.length);
735
+ for (let l = 0; l < i.length; l++) {
736
+ const u = i[l];
737
+ y.object(u) && u.value !== void 0 ? n[l] = u.value : n[l] = u;
738
+ }
739
+ let a = !1;
740
+ return Array.isArray(t) ? a = new Set(t.concat(n)).size === n.length : n.indexOf(t) > -1 && (a = !0), a ? null : g(e, s || r.enum);
741
+ },
742
+ rangeNumber(e, t, r) {
743
+ if (!y.number(t))
744
+ return g(e, e.errorMessage || r.pattern.mismatch);
745
+ let {
746
+ minimum: i,
747
+ maximum: s,
748
+ exclusiveMinimum: n,
749
+ exclusiveMaximum: a
750
+ } = e, l = n ? t <= i : t < i, u = a ? t >= s : t > s;
751
+ return i !== void 0 && l ? g(e, e.errorMessage || r.number[n ? "exclusiveMinimum" : "minimum"]) : s !== void 0 && u ? g(e, e.errorMessage || r.number[a ? "exclusiveMaximum" : "maximum"]) : i !== void 0 && s !== void 0 && (l || u) ? g(e, e.errorMessage || r.number.range) : null;
752
+ },
753
+ rangeLength(e, t, r) {
754
+ if (!y.string(t) && !y.array(t))
755
+ return g(e, e.errorMessage || r.pattern.mismatch);
756
+ let i = e.minLength, s = e.maxLength, n = t.length;
757
+ return i !== void 0 && n < i ? g(e, e.errorMessage || r.length.minLength) : s !== void 0 && n > s ? g(e, e.errorMessage || r.length.maxLength) : i !== void 0 && s !== void 0 && (n < i || n > s) ? g(e, e.errorMessage || r.length.range) : null;
758
+ },
759
+ pattern(e, t, r) {
760
+ return y.pattern(e.pattern, t) ? null : g(e, e.errorMessage || r.pattern.mismatch);
761
+ },
762
+ format(e, t, r) {
763
+ var i = Object.keys(y), s = R[e.format] ? R[e.format] : e.format || e.arrayType;
764
+ return i.indexOf(s) > -1 && !y[s](t) ? g(e, e.errorMessage || r.typeError) : null;
765
+ },
766
+ arrayTypeFormat(e, t, r) {
767
+ if (!Array.isArray(t))
768
+ return g(e, e.errorMessage || r.typeError);
769
+ for (let i = 0; i < t.length; i++) {
770
+ const s = t[i];
771
+ let n = this.format(e, s, r);
772
+ if (n !== null)
773
+ return n;
774
+ }
775
+ return null;
776
+ }
777
+ };
778
+ class C extends ae {
779
+ constructor(t, r) {
780
+ super(C.message), this._schema = t, this._options = r || null;
781
+ }
782
+ updateSchema(t) {
783
+ this._schema = t;
784
+ }
785
+ async validate(t, r) {
786
+ let i = this._checkFieldInSchema(t);
787
+ return i || (i = await this.invokeValidate(t, !1, r)), i.length ? i[0] : null;
788
+ }
789
+ async validateAll(t, r) {
790
+ let i = this._checkFieldInSchema(t);
791
+ return i || (i = await this.invokeValidate(t, !0, r)), i;
792
+ }
793
+ async validateUpdate(t, r) {
794
+ let i = this._checkFieldInSchema(t);
795
+ return i || (i = await this.invokeValidateUpdate(t, !1, r)), i.length ? i[0] : null;
796
+ }
797
+ async invokeValidate(t, r, i) {
798
+ let s = [], n = this._schema;
799
+ for (let a in n) {
800
+ let l = n[a], u = await this.validateRule(a, l, t[a], t, i);
801
+ if (u != null && (s.push({
802
+ key: a,
803
+ errorMessage: u
804
+ }), !r))
805
+ break;
806
+ }
807
+ return s;
808
+ }
809
+ async invokeValidateUpdate(t, r, i) {
810
+ let s = [];
811
+ for (let n in t) {
812
+ let a = await this.validateRule(n, this._schema[n], t[n], t, i);
813
+ if (a != null && (s.push({
814
+ key: n,
815
+ errorMessage: a
816
+ }), !r))
817
+ break;
818
+ }
819
+ return s;
820
+ }
821
+ _checkFieldInSchema(t) {
822
+ var r = Object.keys(t), i = Object.keys(this._schema);
823
+ if (new Set(r.concat(i)).size === i.length)
824
+ return "";
825
+ var s = r.filter((a) => i.indexOf(a) < 0), n = g({
826
+ field: JSON.stringify(s)
827
+ }, C.message.TAG + C.message.defaultInvalid);
828
+ return [{
829
+ key: "invalid",
830
+ errorMessage: n
831
+ }];
832
+ }
833
+ }
834
+ function le() {
835
+ return {
836
+ TAG: "",
837
+ default: "\u9A8C\u8BC1\u9519\u8BEF",
838
+ defaultInvalid: "\u63D0\u4EA4\u7684\u5B57\u6BB5{field}\u5728\u6570\u636E\u5E93\u4E2D\u5E76\u4E0D\u5B58\u5728",
839
+ validateFunction: "\u9A8C\u8BC1\u65E0\u6548",
840
+ required: "{label}\u5FC5\u586B",
841
+ enum: "{label}\u8D85\u51FA\u8303\u56F4",
842
+ timestamp: "{label}\u683C\u5F0F\u65E0\u6548",
843
+ whitespace: "{label}\u4E0D\u80FD\u4E3A\u7A7A",
844
+ typeError: "{label}\u7C7B\u578B\u65E0\u6548",
845
+ date: {
846
+ format: "{label}\u65E5\u671F{value}\u683C\u5F0F\u65E0\u6548",
847
+ parse: "{label}\u65E5\u671F\u65E0\u6CD5\u89E3\u6790,{value}\u65E0\u6548",
848
+ invalid: "{label}\u65E5\u671F{value}\u65E0\u6548"
849
+ },
850
+ length: {
851
+ minLength: "{label}\u957F\u5EA6\u4E0D\u80FD\u5C11\u4E8E{minLength}",
852
+ maxLength: "{label}\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7{maxLength}",
853
+ range: "{label}\u5FC5\u987B\u4ECB\u4E8E{minLength}\u548C{maxLength}\u4E4B\u95F4"
854
+ },
855
+ number: {
856
+ minimum: "{label}\u4E0D\u80FD\u5C0F\u4E8E{minimum}",
857
+ maximum: "{label}\u4E0D\u80FD\u5927\u4E8E{maximum}",
858
+ exclusiveMinimum: "{label}\u4E0D\u80FD\u5C0F\u4E8E\u7B49\u4E8E{minimum}",
859
+ exclusiveMaximum: "{label}\u4E0D\u80FD\u5927\u4E8E\u7B49\u4E8E{maximum}",
860
+ range: "{label}\u5FC5\u987B\u4ECB\u4E8E{minimum}and{maximum}\u4E4B\u95F4"
861
+ },
862
+ pattern: {
863
+ mismatch: "{label}\u683C\u5F0F\u4E0D\u5339\u914D"
864
+ }
865
+ };
866
+ }
867
+ C.message = new le();
868
+ const oe = (e) => JSON.parse(JSON.stringify(e)), ue = (e) => e === "int" || e === "double" || e === "number" || e === "timestamp", D = (e, t, r) => {
869
+ const i = r.find((n) => n.format && ue(n.format)), s = r.find((n) => n.format && n.format === "boolean" || n.format === "bool");
870
+ return i && (!t && t !== 0 ? t = null : t = T(Number(t)) ? Number(t) : t), s && (t = ge(t) ? t : !1), t;
871
+ }, fe = (e, t, r) => (t[e] = r, r || ""), E = (e, t) => pe(t, e), k = (e, t = {}) => {
872
+ const r = N(e);
873
+ return typeof r == "object" && Array.isArray(r) && r.length > 1 ? r.reduce((s, n) => s += `#${n}`, "_formdata_") : r[0] || e;
874
+ }, de = (e) => /^_formdata_#*/.test(e), he = (e = {}, t) => {
875
+ let r = JSON.parse(JSON.stringify(e)), i = {};
876
+ for (let s in r) {
877
+ let n = me(s);
878
+ ce(i, n, r[s]);
879
+ }
880
+ return i;
881
+ }, me = (e) => {
882
+ let t = e.replace("_formdata_#", "");
883
+ return t = t.split("#").map((r) => T(r) ? Number(r) : r), t;
884
+ }, ce = (e, t, r) => (typeof e != "object" || N(t).reduce((i, s, n, a) => n === a.length - 1 ? (i[s] = r, null) : (s in i || (i[s] = /^[0-9]{1,}$/.test(a[n + 1]) ? [] : {}), i[s]), e), e);
885
+ function N(e) {
886
+ return Array.isArray(e) ? e : e.replace(/\[/g, ".").replace(/\]/g, "").split(".");
887
+ }
888
+ const pe = (e, t, r = "undefined") => {
889
+ let s = N(t).reduce((n, a) => (n || {})[a], e);
890
+ return !s || s !== void 0 ? s : r;
891
+ }, T = (e) => !isNaN(Number(e)), ge = (e) => typeof e == "boolean", ye = (e) => {
892
+ let t = !1;
893
+ for (let r = 0; r < e.length; r++)
894
+ if (e[r].required) {
895
+ t = !0;
896
+ break;
897
+ }
898
+ return t;
899
+ }, be = (e, t) => {
900
+ if (e === t)
901
+ return e !== 0 || 1 / e === 1 / t;
902
+ if (e == null || t == null)
903
+ return e === t;
904
+ var r = toString.call(e), i = toString.call(t);
905
+ if (r !== i)
906
+ return !1;
907
+ switch (r) {
908
+ case "[object RegExp]":
909
+ case "[object String]":
910
+ return "" + e == "" + t;
911
+ case "[object Number]":
912
+ return +e != +e ? +t != +t : +e == 0 ? 1 / +e === 1 / t : +e == +t;
913
+ case "[object Date]":
914
+ case "[object Boolean]":
915
+ return +e == +t;
916
+ }
917
+ if (r == "[object Object]") {
918
+ var s = Object.getOwnPropertyNames(e), n = Object.getOwnPropertyNames(t);
919
+ if (s.length != n.length)
920
+ return !1;
921
+ for (var a = 0; a < s.length; a++) {
922
+ var l = s[a];
923
+ if (e[l] !== t[l])
924
+ return !1;
925
+ }
926
+ return !0;
927
+ }
928
+ if (r == "[object Array]")
929
+ return e.toString() == t.toString();
930
+ };
931
+ O.prototype.binddata = function(e, t, r) {
932
+ if (r)
933
+ this.$refs[r].setValue(e, t);
934
+ else {
935
+ let i;
936
+ for (let s in this.$refs) {
937
+ const n = this.$refs[s];
938
+ if (n && n.$options && n.$options.name === "uniForms") {
939
+ i = n;
940
+ break;
941
+ }
942
+ }
943
+ if (!i)
944
+ return console.error("\u5F53\u524D uni-froms \u7EC4\u4EF6\u7F3A\u5C11 ref \u5C5E\u6027");
945
+ i.setValue(e, t);
946
+ }
947
+ };
948
+ const ve = M({
949
+ name: "UniForms",
950
+ emits: ["validate", "submit"],
951
+ options: {
952
+ virtualHost: !0
953
+ },
954
+ props: {
955
+ value: {
956
+ type: Object,
957
+ default() {
958
+ return null;
959
+ }
960
+ },
961
+ modelValue: {
962
+ type: Object,
963
+ default() {
964
+ return null;
965
+ }
966
+ },
967
+ model: {
968
+ type: Object,
969
+ default() {
970
+ return null;
971
+ }
972
+ },
973
+ rules: {
974
+ type: Object,
975
+ default() {
976
+ return {};
977
+ }
978
+ },
979
+ errShowType: {
980
+ type: String,
981
+ default: "undertext"
982
+ },
983
+ validateTrigger: {
984
+ type: String,
985
+ default: "submit"
986
+ },
987
+ labelPosition: {
988
+ type: String,
989
+ default: "left"
990
+ },
991
+ labelWidth: {
992
+ type: [String, Number],
993
+ default: ""
994
+ },
995
+ labelAlign: {
996
+ type: String,
997
+ default: "left"
998
+ },
999
+ border: {
1000
+ type: Boolean,
1001
+ default: !1
1002
+ }
1003
+ },
1004
+ provide() {
1005
+ return {
1006
+ uniForm: this
1007
+ };
1008
+ },
1009
+ data() {
1010
+ return {
1011
+ formData: {},
1012
+ formRules: {}
1013
+ };
1014
+ },
1015
+ computed: {
1016
+ localData() {
1017
+ const e = this.model || this.modelValue || this.value;
1018
+ return e ? oe(e) : {};
1019
+ }
1020
+ },
1021
+ watch: {
1022
+ rules: {
1023
+ handler: function(e, t) {
1024
+ this.setRules(e);
1025
+ },
1026
+ deep: !0,
1027
+ immediate: !0
1028
+ }
1029
+ },
1030
+ created() {
1031
+ getApp().$vm.$.appContext.config.globalProperties.binddata || (getApp().$vm.$.appContext.config.globalProperties.binddata = function(t, r, i) {
1032
+ if (i)
1033
+ this.$refs[i].setValue(t, r);
1034
+ else {
1035
+ let s;
1036
+ for (let n in this.$refs) {
1037
+ const a = this.$refs[n];
1038
+ if (a && a.$options && a.$options.name === "uniForms") {
1039
+ s = a;
1040
+ break;
1041
+ }
1042
+ }
1043
+ if (!s)
1044
+ return console.error("\u5F53\u524D uni-froms \u7EC4\u4EF6\u7F3A\u5C11 ref \u5C5E\u6027");
1045
+ s.setValue(t, r);
1046
+ }
1047
+ }), this.childrens = [], this.inputChildrens = [], this.setRules(this.rules);
1048
+ },
1049
+ methods: {
1050
+ setRules(e) {
1051
+ this.formRules = Object.assign({}, this.formRules, e), this.validator = new C(e);
1052
+ },
1053
+ setValue(e, t) {
1054
+ let r = this.childrens.find((i) => i.name === e);
1055
+ return r ? (this.formData[e] = D(e, t, this.formRules[e] && this.formRules[e].rules || []), r.onFieldChange(this.formData[e])) : null;
1056
+ },
1057
+ validate(e, t) {
1058
+ return this.checkAll(this.formData, e, t);
1059
+ },
1060
+ validateField(e = [], t) {
1061
+ e = [].concat(e);
1062
+ let r = {};
1063
+ return this.childrens.forEach((i) => {
1064
+ const s = k(i.name);
1065
+ e.indexOf(s) !== -1 && (r = Object.assign({}, r, {
1066
+ [s]: this.formData[s]
1067
+ }));
1068
+ }), this.checkAll(r, [], t);
1069
+ },
1070
+ clearValidate(e = []) {
1071
+ e = [].concat(e), this.childrens.forEach((t) => {
1072
+ if (e.length === 0)
1073
+ t.errMsg = "";
1074
+ else {
1075
+ const r = k(t.name);
1076
+ e.indexOf(r) !== -1 && (t.errMsg = "");
1077
+ }
1078
+ });
1079
+ },
1080
+ submit(e, t, r) {
1081
+ for (let i in this.dataValue)
1082
+ this.childrens.find((n) => n.name === i) && this.formData[i] === void 0 && (this.formData[i] = this._getValue(i, this.dataValue[i]));
1083
+ return r || console.warn("submit \u65B9\u6CD5\u5373\u5C06\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528validate\u65B9\u6CD5\u4EE3\u66FF\uFF01"), this.checkAll(this.formData, e, t, "submit");
1084
+ },
1085
+ async checkAll(e, t, r, i) {
1086
+ if (!this.validator)
1087
+ return;
1088
+ let s = [];
1089
+ for (let c in e) {
1090
+ const m = this.childrens.find((o) => k(o.name) === c);
1091
+ m && s.push(m);
1092
+ }
1093
+ !r && typeof t == "function" && (r = t);
1094
+ let n;
1095
+ !r && typeof r != "function" && Promise && (n = new Promise((c, m) => {
1096
+ r = function(o, f) {
1097
+ o ? m(o) : c(f);
1098
+ };
1099
+ }));
1100
+ let a = [], l = JSON.parse(JSON.stringify(e));
1101
+ for (let c in s) {
1102
+ const m = s[c];
1103
+ let o = k(m.name);
1104
+ const f = await m.onFieldChange(l[o]);
1105
+ if (f && (a.push(f), this.errShowType === "toast" || this.errShowType === "modal"))
1106
+ break;
1107
+ }
1108
+ Array.isArray(a) && a.length === 0 && (a = null), Array.isArray(t) && t.forEach((c) => {
1109
+ let m = k(c), o = E(c, this.localData);
1110
+ o !== void 0 && (l[m] = o);
1111
+ }), i === "submit" ? this.$emit("submit", {
1112
+ detail: {
1113
+ value: l,
1114
+ errors: a
1115
+ }
1116
+ }) : this.$emit("validate", a);
1117
+ let u = {};
1118
+ return u = he(l, this.name), r && typeof r == "function" && r(a, u), n && r ? n : null;
1119
+ },
1120
+ validateCheck(e) {
1121
+ this.$emit("validate", e);
1122
+ },
1123
+ _getValue: D,
1124
+ _isRequiredField: ye,
1125
+ _setDataValue: fe,
1126
+ _getDataValue: E,
1127
+ _realName: k,
1128
+ _isRealName: de,
1129
+ _isEqual: be
1130
+ }
1131
+ }), Se = { class: "uni-forms" };
1132
+ function we(e, t, r, i, s, n) {
1133
+ return d(), p("view", Se, [
1134
+ h("form", null, [
1135
+ b(e.$slots, "default")
1136
+ ])
1137
+ ]);
1138
+ }
1139
+ const De = /* @__PURE__ */ F(ve, [["render", we]]);
1140
+ const $e = M({
1141
+ name: "UniFormsItem",
1142
+ options: {
1143
+ virtualHost: !0
1144
+ },
1145
+ provide() {
1146
+ return {
1147
+ uniFormItem: this
1148
+ };
1149
+ },
1150
+ inject: {
1151
+ form: {
1152
+ from: "uniForm",
1153
+ default: null
1154
+ }
1155
+ },
1156
+ props: {
1157
+ rules: {
1158
+ type: Array,
1159
+ default() {
1160
+ return null;
1161
+ }
1162
+ },
1163
+ name: {
1164
+ type: [String, Array],
1165
+ default: ""
1166
+ },
1167
+ required: {
1168
+ type: Boolean,
1169
+ default: !1
1170
+ },
1171
+ label: {
1172
+ type: String,
1173
+ default: ""
1174
+ },
1175
+ labelWidth: {
1176
+ type: [String, Number],
1177
+ default: ""
1178
+ },
1179
+ labelAlign: {
1180
+ type: String,
1181
+ default: ""
1182
+ },
1183
+ errorMessage: {
1184
+ type: [String, Boolean],
1185
+ default: ""
1186
+ },
1187
+ leftIcon: String,
1188
+ iconColor: {
1189
+ type: String,
1190
+ default: "#606266"
1191
+ }
1192
+ },
1193
+ data() {
1194
+ return {
1195
+ errMsg: "",
1196
+ userRules: null,
1197
+ localLabelAlign: "left",
1198
+ localLabelWidth: "65px",
1199
+ localLabelPos: "left",
1200
+ border: !1,
1201
+ isFirstBorder: !1
1202
+ };
1203
+ },
1204
+ computed: {
1205
+ msg() {
1206
+ return this.errorMessage || this.errMsg;
1207
+ }
1208
+ },
1209
+ watch: {
1210
+ "form.formRules"(e) {
1211
+ this.init();
1212
+ },
1213
+ "form.labelWidth"(e) {
1214
+ this.localLabelWidth = this._labelWidthUnit(e);
1215
+ },
1216
+ "form.labelPosition"(e) {
1217
+ this.localLabelPos = this._labelPosition();
1218
+ },
1219
+ "form.labelAlign"(e) {
1220
+ }
1221
+ },
1222
+ created() {
1223
+ this.init(!0), this.name && this.form && (this.$watch("form.formRules", () => {
1224
+ this.init();
1225
+ }), this.$watch(
1226
+ () => this.form._getDataValue(this.name, this.form.localData),
1227
+ (e, t) => {
1228
+ if (!this.form._isEqual(e, t)) {
1229
+ const i = this.itemSetValue(e);
1230
+ this.onFieldChange(i, !1);
1231
+ }
1232
+ },
1233
+ {
1234
+ immediate: !1
1235
+ }
1236
+ ));
1237
+ },
1238
+ destroyed() {
1239
+ this.__isUnmounted || this.unInit();
1240
+ },
1241
+ unmounted() {
1242
+ this.__isUnmounted = !0, this.unInit();
1243
+ },
1244
+ methods: {
1245
+ setRules(e = null) {
1246
+ this.userRules = e, this.init(!1);
1247
+ },
1248
+ setValue() {
1249
+ },
1250
+ async onFieldChange(e, t = !0) {
1251
+ const { formData: r, localData: i, errShowType: s, validateCheck: n, validateTrigger: a, _isRequiredField: l, _realName: u } = this.form, c = u(this.name);
1252
+ e || (e = this.form.formData[c]);
1253
+ const m = this.itemRules.rules && this.itemRules.rules.length;
1254
+ if (!this.validator || !m || m === 0)
1255
+ return;
1256
+ const o = l(this.itemRules.rules || []);
1257
+ let f = null;
1258
+ return a === "bind" || t ? (f = await this.validator.validateUpdate(
1259
+ {
1260
+ [c]: e
1261
+ },
1262
+ r
1263
+ ), !o && (e === void 0 || e === "") && (f = null), f && f.errorMessage ? (s === "undertext" && (this.errMsg = f ? f.errorMessage : ""), s === "toast" && uni.showToast({
1264
+ title: f.errorMessage || "\u6821\u9A8C\u9519\u8BEF",
1265
+ icon: "none"
1266
+ }), s === "modal" && uni.showModal({
1267
+ title: "\u63D0\u793A",
1268
+ content: f.errorMessage || "\u6821\u9A8C\u9519\u8BEF"
1269
+ })) : this.errMsg = "", n(f || null)) : this.errMsg = "", f || null;
1270
+ },
1271
+ init(e = !1) {
1272
+ const { validator: t, formRules: r, childrens: i, formData: s, localData: n, _realName: a, labelWidth: l, _getDataValue: u, _setDataValue: c } = this.form || {};
1273
+ if (this.localLabelAlign = this._justifyContent(), this.localLabelWidth = this._labelWidthUnit(l), this.localLabelPos = this._labelPosition(), this.form && e && i.push(this), !t || !r)
1274
+ return;
1275
+ this.form.isFirstBorder || (this.form.isFirstBorder = !0, this.isFirstBorder = !0), this.group && (this.group.isFirstBorder || (this.group.isFirstBorder = !0, this.isFirstBorder = !0)), this.border = this.form.border;
1276
+ const m = a(this.name), o = this.userRules || this.rules;
1277
+ typeof r == "object" && o && (r[m] = {
1278
+ rules: o
1279
+ }, t.updateSchema(r));
1280
+ const f = r[m] || {};
1281
+ this.itemRules = f, this.validator = t, this.itemSetValue(u(this.name, n));
1282
+ },
1283
+ unInit() {
1284
+ if (this.form) {
1285
+ const { childrens: e, formData: t, _realName: r } = this.form;
1286
+ e.forEach((i, s) => {
1287
+ i === this && (this.form.childrens.splice(s, 1), delete t[r(i.name)]);
1288
+ });
1289
+ }
1290
+ },
1291
+ itemSetValue(e) {
1292
+ const t = this.form._realName(this.name), r = this.itemRules.rules || [], i = this.form._getValue(t, e, r);
1293
+ return this.form._setDataValue(t, this.form.formData, i), i;
1294
+ },
1295
+ clearValidate() {
1296
+ this.errMsg = "";
1297
+ },
1298
+ _isRequired() {
1299
+ return this.required;
1300
+ },
1301
+ _justifyContent() {
1302
+ if (this.form) {
1303
+ const { labelAlign: e } = this.form;
1304
+ let t = this.labelAlign ? this.labelAlign : e;
1305
+ if (t === "left")
1306
+ return "flex-start";
1307
+ if (t === "center")
1308
+ return "center";
1309
+ if (t === "right")
1310
+ return "flex-end";
1311
+ }
1312
+ return "flex-start";
1313
+ },
1314
+ _labelWidthUnit(e) {
1315
+ return this.num2px(this.labelWidth ? this.labelWidth : e || (this.label ? 65 : "auto"));
1316
+ },
1317
+ _labelPosition() {
1318
+ return this.form && this.form.labelPosition || "left";
1319
+ },
1320
+ isTrigger(e, t, r) {
1321
+ return e === "submit" || !e ? e === void 0 ? t !== "bind" ? t ? "submit" : r === "" ? "bind" : "submit" : "bind" : "submit" : "bind";
1322
+ },
1323
+ num2px(e) {
1324
+ return typeof e == "number" ? `${e}px` : e;
1325
+ }
1326
+ }
1327
+ }), ke = {
1328
+ key: 0,
1329
+ class: "is-required"
1330
+ }, Ce = { class: "uni-forms-item__content" }, Fe = { class: "uni-forms-item__nuve-content" }, _e = { class: "uni-forms-item__content" }, Me = { class: "error-text" };
1331
+ function Ve(e, t, r, i, s, n) {
1332
+ return d(), p("view", {
1333
+ class: v(["uni-forms-item", ["is-direction-" + e.localLabelPos, e.border ? "uni-forms-item--border" : "", e.border && e.isFirstBorder ? "is-first-border" : ""]])
1334
+ }, [
1335
+ b(e.$slots, "label", {}, () => [
1336
+ h("view", {
1337
+ class: v(["uni-forms-item__label", { "no-label": !e.label && !e.required }]),
1338
+ style: w({ width: e.localLabelWidth, justifyContent: e.localLabelAlign })
1339
+ }, [
1340
+ e.required ? (d(), p("text", ke, "*")) : S("", !0),
1341
+ h("text", null, $(e.label), 1)
1342
+ ], 6)
1343
+ ]),
1344
+ h("view", Ce, [
1345
+ b(e.$slots, "default"),
1346
+ h("view", {
1347
+ class: v(["uni-forms-item__error", { "msg--active": e.msg }])
1348
+ }, [
1349
+ h("text", null, $(e.msg), 1)
1350
+ ], 2)
1351
+ ]),
1352
+ h("view", Fe, [
1353
+ h("view", _e, [
1354
+ b(e.$slots, "default")
1355
+ ]),
1356
+ h("view", {
1357
+ class: v(["uni-forms-item__error", { "msg--active": e.msg }])
1358
+ }, [
1359
+ h("text", Me, $(e.msg), 1)
1360
+ ], 2)
1361
+ ])
1362
+ ], 2);
1363
+ }
1364
+ const Ee = /* @__PURE__ */ F($e, [["render", Ve]]);
1365
+ class Te {
1366
+ }
1367
+ export {
1368
+ Te as KgUtil,
1369
+ Ie as UniBadge,
1370
+ Re as UniCard,
1371
+ Ae as UniEasyinput,
1372
+ De as UniForms,
1373
+ Ee as UniFormsItem
1374
+ };