y-design-ssr 1.0.0 → 1.1.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 (54) hide show
  1. package/libs/cell/index.css +1 -1
  2. package/libs/cell/index.umd.js +1 -1
  3. package/libs/checkbox/index.mjs +1 -1
  4. package/libs/checkbox/index.umd.js +1 -1
  5. package/libs/checkboxGroup/index.mjs +2 -2
  6. package/libs/checkboxGroup/index.umd.js +1 -1
  7. package/libs/col/index.mjs +3 -3
  8. package/libs/col/index.umd.js +1 -1
  9. package/libs/context/relation/inject.d.ts +1 -1
  10. package/libs/context/relation/provide.d.ts +3 -3
  11. package/libs/dialog/index.css +1 -1
  12. package/libs/dialog/index.mjs +321 -287
  13. package/libs/dialog/index.umd.js +2 -2
  14. package/libs/dropdown/index.css +1 -0
  15. package/libs/dropdown/index.d.ts +68 -0
  16. package/libs/dropdown/index.mjs +215 -0
  17. package/libs/dropdown/index.umd.js +2 -0
  18. package/libs/dropdown/package.json +6 -0
  19. package/libs/dropdown/src/dropdown.d.ts +108 -0
  20. package/libs/dropdownItem/index.css +1 -0
  21. package/libs/dropdownItem/index.d.ts +50 -0
  22. package/libs/dropdownItem/index.mjs +645 -0
  23. package/libs/dropdownItem/index.umd.js +2 -0
  24. package/libs/dropdownItem/package.json +6 -0
  25. package/libs/dropdownItem/src/dropdown-item.d.ts +89 -0
  26. package/libs/form/index.mjs +3 -3
  27. package/libs/form/index.umd.js +1 -1
  28. package/libs/formItem/index.mjs +1 -1
  29. package/libs/formItem/index.umd.js +1 -1
  30. package/libs/index.css +1 -1
  31. package/libs/index.d.ts +3 -1
  32. package/libs/index.mjs +1919 -1608
  33. package/libs/index.umd.js +2 -2
  34. package/libs/layout/index.mjs +4 -4
  35. package/libs/layout/index.umd.js +1 -1
  36. package/libs/popup/index.css +1 -1
  37. package/libs/popup/index.d.ts +18 -0
  38. package/libs/popup/index.mjs +135 -101
  39. package/libs/popup/index.umd.js +2 -2
  40. package/libs/popup/src/popup.d.ts +18 -0
  41. package/libs/row/index.mjs +3 -3
  42. package/libs/row/index.umd.js +1 -1
  43. package/libs/swipe/index.mjs +3 -3
  44. package/libs/swipe/index.umd.js +1 -1
  45. package/libs/swipeItem/index.mjs +1 -1
  46. package/libs/swipeItem/index.umd.js +1 -1
  47. package/libs/tab/index.mjs +1 -1
  48. package/libs/tab/index.umd.js +1 -1
  49. package/libs/tabs/index.mjs +3 -3
  50. package/libs/tabs/index.umd.js +1 -1
  51. package/libs/utils/index.mjs +35 -34
  52. package/libs/utils/index.umd.js +1 -1
  53. package/libs/utils/types.d.ts +4 -0
  54. package/package.json +1 -1
@@ -0,0 +1,645 @@
1
+ import { ref as P, reactive as z, inject as Y, getCurrentInstance as G, onUnmounted as R, computed as M, defineComponent as v, createVNode as i, onMounted as K, watch as q, Transition as B, withDirectives as I, vShow as _, Teleport as L, Fragment as H, isVNode as J } from "vue";
2
+ const O = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t) ? t.reduce((u, a) => u + O(e, a), "") : Object.keys(t).reduce(
3
+ (u, a) => u + (t[a] ? O(e, a) : ""),
4
+ ""
5
+ ) : "", Q = (e) => (t, u) => {
6
+ let a = t, o = u;
7
+ return a && typeof a != "string" && (o = a, a = ""), a = a ? `${e}__${a}` : e, `${a}${O(a, o)}`;
8
+ }, X = () => (e, t) => t ? `${O(`y-${e}`, t)}` : `y-${e}`, Z = {
9
+ "pull-refresh": {
10
+ pulling: "下拉刷新...",
11
+ loosing: "释放刷新...",
12
+ loading: "数据加载中...",
13
+ success: "数据已更新",
14
+ failed: "数据跟新失败,请稍后再试"
15
+ },
16
+ "form-item": {
17
+ validateMessage: "请输入正确内容"
18
+ }
19
+ };
20
+ P("zh-CN");
21
+ z({
22
+ "zh-CN": Z
23
+ });
24
+ const C = (e) => {
25
+ const t = `y-${e}`;
26
+ return [t, Q(t), X()];
27
+ };
28
+ var U = /* @__PURE__ */ ((e) => (e.Mini = "mini", e.Small = "small", e.Middle = "middle", e.Large = "large", e))(U || {}), W = /* @__PURE__ */ ((e) => (e.Top = "top", e.Middle = "middle", e.Bottom = "bottom", e))(W || {}), V = /* @__PURE__ */ ((e) => (e.Top = "top", e.Right = "right", e.Bottom = "bottom", e.Left = "left", e.Center = "center", e))(V || {}), w = /* @__PURE__ */ ((e) => (e.UP = "up", e.DOWN = "down", e))(w || {});
29
+ const E = (e) => isNaN(Number(e)) && typeof e == "string" ? e : `${e}px`, ee = (e) => {
30
+ const t = Y(e, null), u = G();
31
+ if (t && u) {
32
+ const { children: a, addChild: o, removeChild: s } = t;
33
+ return o(u), R(() => s(u)), {
34
+ index: M(() => a.indexOf(u)),
35
+ parent: t
36
+ };
37
+ }
38
+ return {
39
+ parent: null,
40
+ index: P(-1)
41
+ };
42
+ }, [te, Ne] = C("dropdown"), ne = te;
43
+ w.DOWN;
44
+ const [le, N] = C("icon"), ae = (e) => new RegExp(/\.(https|png|jpg|gif|jpeg|webp|apng)$/).test(e.toLowerCase()), oe = /* @__PURE__ */ v({
45
+ name: le,
46
+ props: {
47
+ dot: {
48
+ type: Boolean,
49
+ default: !1
50
+ },
51
+ name: {
52
+ type: String,
53
+ default: ""
54
+ },
55
+ size: {
56
+ type: [Number, String],
57
+ default: ""
58
+ },
59
+ info: {
60
+ type: [Number, String],
61
+ default: ""
62
+ },
63
+ badge: {
64
+ type: [Number, String],
65
+ default: ""
66
+ },
67
+ color: {
68
+ type: String,
69
+ default: ""
70
+ },
71
+ subColor: {
72
+ type: String,
73
+ default: ""
74
+ },
75
+ subBg: {
76
+ type: String,
77
+ default: ""
78
+ },
79
+ classPrefix: {
80
+ type: String,
81
+ default: "y-icon"
82
+ },
83
+ /**
84
+ * @ignore
85
+ */
86
+ tag: {
87
+ type: String,
88
+ default: "i"
89
+ }
90
+ },
91
+ emits: ["click"],
92
+ setup(e, {
93
+ slots: t,
94
+ emit: u
95
+ }) {
96
+ const a = ae(e.name), o = () => ({
97
+ fontSize: E(e.size),
98
+ color: e.color
99
+ }), s = (l) => {
100
+ u("click", l);
101
+ };
102
+ return () => {
103
+ const {
104
+ name: l,
105
+ classPrefix: r,
106
+ badge: f,
107
+ dot: m,
108
+ subColor: p,
109
+ subBg: n,
110
+ tag: c
111
+ } = e;
112
+ return i(c, {
113
+ class: `${r}${a ? "" : ` y-icon--${l}`}`,
114
+ style: o(),
115
+ onClick: s
116
+ }, {
117
+ default: () => {
118
+ var y;
119
+ return [a ? i("em", {
120
+ class: N("node")
121
+ }, [i("img", {
122
+ class: N("image"),
123
+ src: l,
124
+ alt: "icon"
125
+ }, null)]) : null, m ? i("em", {
126
+ class: N("dot"),
127
+ style: {
128
+ backgroundColor: n
129
+ }
130
+ }, null) : null, f ? i("em", {
131
+ class: N("badge"),
132
+ style: {
133
+ color: p,
134
+ backgroundColor: n
135
+ }
136
+ }, [f]) : null, ((y = t.default) == null ? void 0 : y.call(t)) || null];
137
+ }
138
+ });
139
+ };
140
+ }
141
+ });
142
+ function S(e) {
143
+ const t = e;
144
+ return t.install = (u) => {
145
+ const { name: a } = e;
146
+ a && u.component(a, e);
147
+ }, t;
148
+ }
149
+ const F = S(oe), [re, k, ue] = C("cell"), ie = /* @__PURE__ */ v({
150
+ name: re,
151
+ props: {
152
+ tag: {
153
+ type: String,
154
+ default: "div"
155
+ },
156
+ title: {
157
+ type: [Number, String],
158
+ default: ""
159
+ },
160
+ label: {
161
+ type: [Number, String],
162
+ default: ""
163
+ },
164
+ value: {
165
+ type: [Number, String],
166
+ default: ""
167
+ },
168
+ size: {
169
+ type: String,
170
+ default: U.Middle
171
+ },
172
+ // 垂直对齐方式
173
+ vertical: {
174
+ type: String,
175
+ default: W.Middle
176
+ },
177
+ // 是否有 border
178
+ border: {
179
+ type: Boolean,
180
+ default: !0
181
+ },
182
+ icon: {
183
+ type: String,
184
+ default: ""
185
+ },
186
+ // 点击态
187
+ clickable: {
188
+ type: Boolean,
189
+ default: !1
190
+ }
191
+ },
192
+ emits: ["click"],
193
+ setup(e, {
194
+ slots: t,
195
+ emit: u
196
+ }) {
197
+ const a = (o) => {
198
+ u("click", o);
199
+ };
200
+ return () => {
201
+ const {
202
+ tag: o,
203
+ vertical: s,
204
+ border: l,
205
+ size: r,
206
+ title: f,
207
+ icon: m,
208
+ label: p,
209
+ value: n,
210
+ clickable: c
211
+ } = e, y = o === "a" ? !0 : c;
212
+ return i(o, {
213
+ class: [k({
214
+ [`is-${s}`]: s,
215
+ [r]: r,
216
+ hairline: l
217
+ }), ue("el", {
218
+ clickable: y
219
+ })],
220
+ onClick: a
221
+ }, {
222
+ default: () => {
223
+ var g, d;
224
+ return [(g = t.left) == null ? void 0 : g.call(t), i("div", {
225
+ class: k("center", {
226
+ "has-left": t.left
227
+ })
228
+ }, [t.center ? t.center() : [i("h4", {
229
+ class: k("title")
230
+ }, [f]), i("p", {
231
+ class: k("label")
232
+ }, [p])]]), t.default ? t.default() : i("div", {
233
+ class: k("value")
234
+ }, [n]), ((d = t.right) == null ? void 0 : d.call(t)) || m && i(F, {
235
+ name: m,
236
+ class: k("icon")
237
+ }, null)];
238
+ }
239
+ });
240
+ };
241
+ }
242
+ });
243
+ const ce = S(ie), [se, de, fe] = C("mask"), me = {
244
+ // 控制显示
245
+ modelValue: {
246
+ type: Boolean,
247
+ default: !1
248
+ },
249
+ // 层级
250
+ zIndex: {
251
+ type: [Number, String],
252
+ default: null
253
+ },
254
+ // 动画时长
255
+ duration: {
256
+ type: Number,
257
+ default: 300
258
+ },
259
+ // 自定义类名
260
+ customClass: {
261
+ type: String,
262
+ default: ""
263
+ },
264
+ // 自定义样式
265
+ customStyle: {
266
+ type: Object,
267
+ default: () => ({})
268
+ },
269
+ // 触摸滚动开关
270
+ lockScroll: {
271
+ type: Boolean,
272
+ default: !0
273
+ },
274
+ onAfterLeave: {
275
+ type: Function,
276
+ default: null
277
+ }
278
+ }, b = z([]);
279
+ let D = 0;
280
+ const pe = /* @__PURE__ */ v({
281
+ name: se,
282
+ props: me,
283
+ emits: ["update:modelValue"],
284
+ setup(e, {
285
+ slots: t
286
+ }) {
287
+ const u = P("");
288
+ K(() => {
289
+ u.value = `mask${D}`, D += 1, a(e.modelValue, !0);
290
+ }), R(() => {
291
+ const l = b.findIndex((r) => r._id === u.value);
292
+ l >= 0 && b.splice(l, 1);
293
+ }), q(() => e.modelValue, (l) => {
294
+ a(l);
295
+ });
296
+ const a = (l, r) => {
297
+ l ? (b.unshift({
298
+ _id: u.value,
299
+ _state: l
300
+ }), b.length > 1 && (b[1]._state = !1)) : r || (b.splice(0, 1), b.length > 0 && (b[0]._state = !0));
301
+ }, o = () => {
302
+ let l = !1;
303
+ for (let r = 0; r < b.length; r++)
304
+ b[r]._id === u.value && (l = b[r]._state);
305
+ return {
306
+ _state: l
307
+ };
308
+ }, s = (l) => {
309
+ const {
310
+ lockScroll: r
311
+ } = e;
312
+ r && (l.preventDefault(), l.stopPropagation());
313
+ };
314
+ return () => {
315
+ const {
316
+ customClass: l,
317
+ duration: r,
318
+ zIndex: f,
319
+ customStyle: m,
320
+ onAfterLeave: p
321
+ } = e, {
322
+ _state: n
323
+ } = o();
324
+ return i(B, {
325
+ name: fe("animation", "fade"),
326
+ onAfterLeave: p
327
+ }, {
328
+ default: () => {
329
+ var c;
330
+ return [I(i("div", {
331
+ style: {
332
+ animationDuration: `${r}ms`,
333
+ zIndex: f,
334
+ ...m
335
+ },
336
+ class: [de(), l],
337
+ onTouchmove: s
338
+ }, [(c = t.default) == null ? void 0 : c.call(t)]), [[_, n]])];
339
+ }
340
+ });
341
+ };
342
+ }
343
+ });
344
+ const j = S(pe), [ye, T, A] = C("popup"), ge = {
345
+ // 控制显示
346
+ modelValue: {
347
+ type: Boolean,
348
+ default: !1
349
+ },
350
+ // 位置
351
+ position: {
352
+ type: String,
353
+ default: "center"
354
+ },
355
+ // 圆角
356
+ borderRadius: {
357
+ type: [Number, String],
358
+ default: ""
359
+ },
360
+ // 自定义类名
361
+ customClass: {
362
+ type: String,
363
+ default: ""
364
+ },
365
+ // 自定义属性
366
+ customStyle: {
367
+ type: Object,
368
+ default: () => ({})
369
+ },
370
+ // 自定义类名
371
+ maskCustomClass: {
372
+ type: String,
373
+ default: ""
374
+ },
375
+ // 自定义属性
376
+ maskCustomStyle: {
377
+ type: Object,
378
+ default: () => ({})
379
+ },
380
+ // 插入对象
381
+ teleport: {
382
+ type: String,
383
+ default: "body"
384
+ },
385
+ // 动画时长
386
+ duration: {
387
+ type: Number,
388
+ default: 300
389
+ },
390
+ // 点击遮罩是否关闭
391
+ isCloseOnClickMask: {
392
+ type: Boolean,
393
+ default: !0
394
+ },
395
+ onAfterLeave: {
396
+ type: Function,
397
+ default: null
398
+ },
399
+ lockScroll: {
400
+ type: Boolean,
401
+ default: !0
402
+ },
403
+ zIndex: {
404
+ type: Number,
405
+ default: 100
406
+ }
407
+ }, be = /* @__PURE__ */ v({
408
+ name: ye,
409
+ props: ge,
410
+ emits: ["clickMask", "update:modelValue"],
411
+ setup(e, {
412
+ slots: t,
413
+ emit: u
414
+ }) {
415
+ const a = M(() => {
416
+ const {
417
+ position: l,
418
+ borderRadius: r,
419
+ customStyle: f,
420
+ duration: m,
421
+ zIndex: p
422
+ } = e, n = E(r);
423
+ let c = "0";
424
+ switch (l) {
425
+ case "top":
426
+ c = ` 0 0 ${n} ${n}`;
427
+ break;
428
+ case "bottom":
429
+ c = `${n} ${n} 0 0`;
430
+ break;
431
+ case "left":
432
+ c = `0 ${n} ${n} 0`;
433
+ break;
434
+ case "right":
435
+ c = `${n} 0 0 ${n}`;
436
+ break;
437
+ default:
438
+ c = `${n}`;
439
+ }
440
+ return {
441
+ borderRadius: c,
442
+ animationDuration: `${m}ms`,
443
+ ...f,
444
+ zIndex: p + 1
445
+ };
446
+ }), o = (l) => {
447
+ u("clickMask", l), e.isCloseOnClickMask && (s.value = !1);
448
+ }, s = M({
449
+ get: () => e.modelValue,
450
+ set: (l) => u("update:modelValue", l)
451
+ });
452
+ return () => {
453
+ const {
454
+ teleport: l,
455
+ position: r,
456
+ customClass: f,
457
+ duration: m,
458
+ onAfterLeave: p,
459
+ lockScroll: n,
460
+ zIndex: c,
461
+ maskCustomClass: y,
462
+ maskCustomStyle: g
463
+ } = e;
464
+ return l ? i(L, {
465
+ to: l
466
+ }, {
467
+ default: () => [i(j, {
468
+ modelValue: s.value,
469
+ "onUpdate:modelValue": (d) => s.value = d,
470
+ duration: m,
471
+ lockScroll: n,
472
+ onClick: o,
473
+ onAfterLeave: p,
474
+ zIndex: c,
475
+ customClass: y,
476
+ customStyle: g
477
+ }, null), i(B, {
478
+ name: A("animation", `slide-${r}`)
479
+ }, {
480
+ default: () => {
481
+ var d;
482
+ return [I(i("div", {
483
+ style: a.value,
484
+ class: [T("content", {
485
+ [r]: r
486
+ }), f]
487
+ }, [((d = t.default) == null ? void 0 : d.call(t)) || null]), [[_, s.value]])];
488
+ }
489
+ })]
490
+ }) : i(H, null, [i(j, {
491
+ modelValue: s.value,
492
+ "onUpdate:modelValue": (d) => s.value = d,
493
+ duration: m,
494
+ lockScroll: n,
495
+ onClick: o,
496
+ onAfterLeave: p,
497
+ zIndex: c,
498
+ customClass: y,
499
+ customStyle: g
500
+ }, null), i(B, {
501
+ name: A("animation", `slide-${r}`)
502
+ }, {
503
+ default: () => {
504
+ var d;
505
+ return [I(i("div", {
506
+ style: a.value,
507
+ class: [T("content", {
508
+ [r]: r
509
+ }), f]
510
+ }, [((d = t.default) == null ? void 0 : d.call(t)) || null]), [[_, s.value]])];
511
+ }
512
+ })]);
513
+ };
514
+ }
515
+ });
516
+ const ke = S(be);
517
+ function Ce(e) {
518
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !J(e);
519
+ }
520
+ const [ve, x] = C("dropdown-item"), Se = {
521
+ modelValue: {
522
+ type: [Number, String],
523
+ default: ""
524
+ },
525
+ title: {
526
+ type: String,
527
+ default: ""
528
+ },
529
+ options: {
530
+ type: Object,
531
+ default: () => ({})
532
+ },
533
+ disabled: {
534
+ type: Boolean,
535
+ default: !1
536
+ },
537
+ teleport: {
538
+ type: String,
539
+ default: ""
540
+ }
541
+ }, $e = /* @__PURE__ */ v({
542
+ name: ve,
543
+ props: Se,
544
+ emits: ["change", "update:modelValue"],
545
+ setup(e, {
546
+ slots: t,
547
+ emit: u,
548
+ expose: a
549
+ }) {
550
+ const o = z({
551
+ showPopup: !1,
552
+ transition: !0,
553
+ id: Math.random().toString(36).slice(2)
554
+ }), {
555
+ parent: s
556
+ } = ee(ne);
557
+ if (!s) {
558
+ console.error("<YDropdownItem> must be a child component of <YDropdown>.");
559
+ return;
560
+ }
561
+ const l = (n) => {
562
+ e.teleport && n.stopPropagation();
563
+ }, r = (n = !o.showPopup, c = {}) => {
564
+ n !== o.showPopup && (o.showPopup = n, o.transition = !c.immediate, n && s.updateOffset());
565
+ }, f = () => {
566
+ if (t.title)
567
+ return t.title();
568
+ if (e.title)
569
+ return e.title;
570
+ const n = e.options.find((c) => c.value === e.modelValue);
571
+ return n ? n.text : "";
572
+ }, m = (n) => {
573
+ const {
574
+ activeColor: c
575
+ } = s.props, y = n.value === e.modelValue, g = () => {
576
+ o.showPopup = !1, n.value !== e.modelValue && (u("update:modelValue", n.value), u("change", n.value));
577
+ }, d = () => y ? i(F, {
578
+ class: x("icon"),
579
+ color: c,
580
+ name: n.icon || "done"
581
+ }, null) : null;
582
+ return i(ce, {
583
+ key: String(n.value),
584
+ title: n.text,
585
+ class: x("option", {
586
+ active: y
587
+ }),
588
+ style: {
589
+ color: y ? c : ""
590
+ },
591
+ clickable: !0,
592
+ onClick: g
593
+ }, {
594
+ right: d
595
+ });
596
+ }, p = () => {
597
+ const {
598
+ offset: n
599
+ } = s, {
600
+ zIndex: c,
601
+ duration: y,
602
+ direction: g,
603
+ isCloseOnClickMask: d
604
+ } = s.props, $ = {};
605
+ return $.zIndex = c, g === w.DOWN ? $.top = `${n.value}px` : $.bottom = `${n.value}px`, I(i("div", {
606
+ style: $,
607
+ class: x([g]),
608
+ onClick: l,
609
+ id: o.id
610
+ }, [i(ke, {
611
+ modelValue: o.showPopup,
612
+ "onUpdate:modelValue": (h) => o.showPopup = h,
613
+ customClass: x("content"),
614
+ maskCustomStyle: {
615
+ position: "absolute"
616
+ },
617
+ position: g === w.DOWN ? V.Top : V.Bottom,
618
+ duration: o.transition ? y : 0,
619
+ isCloseOnClickMask: d,
620
+ teleport: e.teleport
621
+ }, {
622
+ default: () => {
623
+ var h;
624
+ return [e.options.map(m), (h = t.default) == null ? void 0 : h.call(t)];
625
+ }
626
+ })]), [[_, o.showPopup]]);
627
+ };
628
+ return a({
629
+ state: o,
630
+ toggle: r,
631
+ renderItemTitle: f
632
+ }), () => {
633
+ let n;
634
+ return e.teleport ? i(L, {
635
+ to: e.teleport
636
+ }, Ce(n = p()) ? n : {
637
+ default: () => [n]
638
+ }) : p();
639
+ };
640
+ }
641
+ });
642
+ const xe = S($e);
643
+ export {
644
+ xe as default
645
+ };