y-design-ssr 0.1.2 → 0.2.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 (195) hide show
  1. package/README.md +12 -1
  2. package/libs/button/index.css +1 -0
  3. package/libs/button/index.mjs +152 -0
  4. package/libs/button/index.umd.js +2 -0
  5. package/libs/cell/index.css +1 -0
  6. package/libs/cell/index.mjs +231 -0
  7. package/libs/cell/index.umd.js +2 -0
  8. package/libs/checkbox/index.css +1 -0
  9. package/libs/checkbox/index.mjs +248 -0
  10. package/libs/checkbox/index.umd.js +2 -0
  11. package/libs/checkboxGroup/index.css +1 -0
  12. package/libs/checkboxGroup/index.mjs +173 -0
  13. package/libs/checkboxGroup/index.umd.js +2 -0
  14. package/libs/col/index.css +1 -0
  15. package/libs/col/index.mjs +134 -0
  16. package/libs/col/index.umd.js +2 -0
  17. package/libs/countdown/index.css +1 -0
  18. package/libs/countdown/index.mjs +117 -0
  19. package/libs/countdown/index.umd.js +2 -0
  20. package/libs/dialog/index.css +1 -0
  21. package/libs/dialog/index.mjs +952 -0
  22. package/libs/dialog/index.umd.js +2 -0
  23. package/libs/empty/index.css +1 -0
  24. package/libs/empty/index.mjs +86 -0
  25. package/libs/empty/index.umd.js +2 -0
  26. package/libs/form/index.css +1 -0
  27. package/libs/form/index.mjs +213 -0
  28. package/libs/form/index.umd.js +2 -0
  29. package/libs/formItem/index.css +1 -0
  30. package/libs/formItem/index.mjs +216 -0
  31. package/libs/formItem/index.umd.js +2 -0
  32. package/libs/icon/index.css +1 -0
  33. package/libs/icon/index.mjs +131 -0
  34. package/libs/icon/index.umd.js +2 -0
  35. package/libs/index.css +1 -154
  36. package/libs/index.mjs +41 -41
  37. package/libs/index.umd.js +2 -1
  38. package/libs/input/index.css +1 -0
  39. package/libs/input/index.mjs +177 -0
  40. package/libs/input/index.umd.js +2 -0
  41. package/libs/layout/index.css +1 -0
  42. package/libs/layout/index.mjs +212 -0
  43. package/libs/layout/index.umd.js +2 -0
  44. package/libs/list/index.css +1 -0
  45. package/libs/list/index.mjs +384 -0
  46. package/libs/list/index.umd.js +2 -0
  47. package/libs/loading/index.css +1 -0
  48. package/libs/loading/index.mjs +237 -0
  49. package/libs/loading/index.umd.js +2 -0
  50. package/libs/mask/index.css +1 -0
  51. package/libs/mask/index.mjs +134 -0
  52. package/libs/mask/index.umd.js +2 -0
  53. package/libs/popup/index.css +1 -0
  54. package/libs/popup/index.mjs +276 -0
  55. package/libs/popup/index.umd.js +2 -0
  56. package/libs/progress/index.css +1 -0
  57. package/libs/progress/index.mjs +244 -0
  58. package/libs/progress/index.umd.js +2 -0
  59. package/libs/pullrefresh/index.css +1 -0
  60. package/libs/pullrefresh/index.mjs +166 -0
  61. package/libs/pullrefresh/index.umd.js +2 -0
  62. package/libs/row/index.css +1 -0
  63. package/libs/row/index.mjs +139 -0
  64. package/libs/row/index.umd.js +2 -0
  65. package/libs/slider/index.css +1 -0
  66. package/libs/slider/index.mjs +251 -0
  67. package/libs/slider/index.umd.js +2 -0
  68. package/libs/stepper/index.css +1 -0
  69. package/libs/stepper/index.mjs +183 -0
  70. package/libs/stepper/index.umd.js +2 -0
  71. package/libs/swipe/index.css +1 -0
  72. package/libs/swipe/index.mjs +414 -0
  73. package/libs/swipe/index.umd.js +2 -0
  74. package/libs/swipeItem/index.css +1 -0
  75. package/libs/swipeItem/index.mjs +89 -0
  76. package/libs/swipeItem/index.umd.js +2 -0
  77. package/libs/switch/index.css +1 -0
  78. package/libs/switch/index.mjs +135 -0
  79. package/libs/switch/index.umd.js +2 -0
  80. package/libs/tab/index.mjs +124 -0
  81. package/libs/tab/index.umd.js +1 -0
  82. package/libs/tabs/index.css +1 -0
  83. package/libs/tabs/index.mjs +673 -0
  84. package/libs/tabs/index.umd.js +2 -0
  85. package/libs/toast/index.css +1 -0
  86. package/libs/toast/index.mjs +231 -0
  87. package/libs/toast/index.umd.js +2 -0
  88. package/libs/tooltip/index.css +1 -0
  89. package/libs/tooltip/index.mjs +272 -0
  90. package/libs/tooltip/index.umd.js +2 -0
  91. package/libs/types/{button → components/button}/index.d.ts +1 -0
  92. package/libs/types/{button → components/button}/src/button.d.ts +1 -1
  93. package/libs/types/{cell → components/cell}/src/cell.d.ts +1 -1
  94. package/libs/types/{dialog → components/dialog}/src/dialog.d.ts +1 -1
  95. package/libs/types/{loading → components/loading}/src/loading.d.ts +1 -1
  96. package/libs/types/{popup → components/popup}/src/popup.d.ts +1 -1
  97. package/libs/types/{row → components/row}/src/row.d.ts +1 -1
  98. package/libs/types/{switch → components/switch}/src/switch.d.ts +1 -1
  99. package/libs/types/{toast → components/toast}/src/toast.d.ts +1 -1
  100. package/libs/types/index.d.ts +27 -27
  101. package/package.json +7 -6
  102. package/libs/component-props.json +0 -1
  103. package/libs/demo/button.json +0 -1
  104. package/libs/demo/cell.json +0 -1
  105. package/libs/demo/checkbox.json +0 -1
  106. package/libs/demo/countdown.json +0 -1
  107. package/libs/demo/dialog.json +0 -1
  108. package/libs/demo/empty.json +0 -1
  109. package/libs/demo/form.json +0 -1
  110. package/libs/demo/icon.json +0 -1
  111. package/libs/demo/input.json +0 -1
  112. package/libs/demo/layout.json +0 -1
  113. package/libs/demo/list.json +0 -1
  114. package/libs/demo/loading.json +0 -1
  115. package/libs/demo/mask.json +0 -1
  116. package/libs/demo/popup.json +0 -1
  117. package/libs/demo/progress.json +0 -1
  118. package/libs/demo/pullrefresh.json +0 -1
  119. package/libs/demo/slider.json +0 -1
  120. package/libs/demo/stepper.json +0 -1
  121. package/libs/demo/style.json +0 -1
  122. package/libs/demo/swipe.json +0 -1
  123. package/libs/demo/switch.json +0 -1
  124. package/libs/demo/tabs.json +0 -1
  125. package/libs/demo/toast.json +0 -1
  126. package/libs/demo/tooltip.json +0 -1
  127. package/libs/index.fa0c1ff.js +0 -2
  128. package/libs/index.fa0c1ff.js.LICENSE.txt +0 -19
  129. package/libs/index.html +0 -1
  130. package/libs/runtime.bfd6297.js +0 -1
  131. package/libs/style.css +0 -1
  132. package/libs/vendor.025080b.js +0 -2
  133. package/libs/vendor.025080b.js.LICENSE.txt +0 -5
  134. /package/libs/types/{cell → components/cell}/index.d.ts +0 -0
  135. /package/libs/types/{checkbox → components/checkbox}/index.d.ts +0 -0
  136. /package/libs/types/{checkbox → components/checkbox}/src/checkbox.d.ts +0 -0
  137. /package/libs/types/{checkboxGroup → components/checkboxGroup}/index.d.ts +0 -0
  138. /package/libs/types/{checkboxGroup → components/checkboxGroup}/src/checkboxGroup.d.ts +0 -0
  139. /package/libs/types/{checkboxGroup → components/checkboxGroup}/src/constants.d.ts +0 -0
  140. /package/libs/types/{col → components/col}/index.d.ts +0 -0
  141. /package/libs/types/{col → components/col}/src/col.d.ts +0 -0
  142. /package/libs/types/{countdown → components/countdown}/index.d.ts +0 -0
  143. /package/libs/types/{countdown → components/countdown}/src/count-down.d.ts +0 -0
  144. /package/libs/types/{dialog → components/dialog}/index.d.ts +0 -0
  145. /package/libs/types/{dialog → components/dialog}/src/create.d.ts +0 -0
  146. /package/libs/types/{empty → components/empty}/index.d.ts +0 -0
  147. /package/libs/types/{empty → components/empty}/src/empty.d.ts +0 -0
  148. /package/libs/types/{empty → components/empty}/src/utils.d.ts +0 -0
  149. /package/libs/types/{form → components/form}/index.d.ts +0 -0
  150. /package/libs/types/{form → components/form}/src/constants.d.ts +0 -0
  151. /package/libs/types/{form → components/form}/src/form.d.ts +0 -0
  152. /package/libs/types/{formItem → components/formItem}/index.d.ts +0 -0
  153. /package/libs/types/{formItem → components/formItem}/src/formItem.d.ts +0 -0
  154. /package/libs/types/{icon → components/icon}/index.d.ts +0 -0
  155. /package/libs/types/{icon → components/icon}/src/icon.d.ts +0 -0
  156. /package/libs/types/{input → components/input}/index.d.ts +0 -0
  157. /package/libs/types/{input → components/input}/src/input.d.ts +0 -0
  158. /package/libs/types/{list → components/list}/index.d.ts +0 -0
  159. /package/libs/types/{list → components/list}/src/list.d.ts +0 -0
  160. /package/libs/types/{loading → components/loading}/index.d.ts +0 -0
  161. /package/libs/types/{loading → components/loading}/src/create.d.ts +0 -0
  162. /package/libs/types/{loading → components/loading}/src/directive.d.ts +0 -0
  163. /package/libs/types/{mask → components/mask}/index.d.ts +0 -0
  164. /package/libs/types/{mask → components/mask}/src/mask.d.ts +0 -0
  165. /package/libs/types/{popup → components/popup}/index.d.ts +0 -0
  166. /package/libs/types/{progress → components/progress}/index.d.ts +0 -0
  167. /package/libs/types/{progress → components/progress}/src/progress.d.ts +0 -0
  168. /package/libs/types/{pullrefresh → components/pullrefresh}/index.d.ts +0 -0
  169. /package/libs/types/{pullrefresh → components/pullrefresh}/src/pullrefresh.d.ts +0 -0
  170. /package/libs/types/{pullrefresh → components/pullrefresh}/src/utils.d.ts +0 -0
  171. /package/libs/types/{row → components/row}/index.d.ts +0 -0
  172. /package/libs/types/{row → components/row}/src/constants.d.ts +0 -0
  173. /package/libs/types/{slider → components/slider}/index.d.ts +0 -0
  174. /package/libs/types/{slider → components/slider}/src/slider.d.ts +0 -0
  175. /package/libs/types/{stepper → components/stepper}/index.d.ts +0 -0
  176. /package/libs/types/{stepper → components/stepper}/src/stepper.d.ts +0 -0
  177. /package/libs/types/{swipe → components/swipe}/index.d.ts +0 -0
  178. /package/libs/types/{swipe → components/swipe}/src/constants.d.ts +0 -0
  179. /package/libs/types/{swipe → components/swipe}/src/swipe.d.ts +0 -0
  180. /package/libs/types/{swipeItem → components/swipeItem}/index.d.ts +0 -0
  181. /package/libs/types/{swipeItem → components/swipeItem}/src/swipeItem.d.ts +0 -0
  182. /package/libs/types/{switch → components/switch}/index.d.ts +0 -0
  183. /package/libs/types/{tab → components/tab}/index.d.ts +0 -0
  184. /package/libs/types/{tab → components/tab}/src/tab.d.ts +0 -0
  185. /package/libs/types/{tabs → components/tabs}/index.d.ts +0 -0
  186. /package/libs/types/{tabs → components/tabs}/src/constants.d.ts +0 -0
  187. /package/libs/types/{tabs → components/tabs}/src/tabs.d.ts +0 -0
  188. /package/libs/types/{tabs → components/tabs}/src/title.d.ts +0 -0
  189. /package/libs/types/{toast → components/toast}/index.d.ts +0 -0
  190. /package/libs/types/{toast → components/toast}/src/create.d.ts +0 -0
  191. /package/libs/types/{tooltip → components/tooltip}/index.d.ts +0 -0
  192. /package/libs/types/{tooltip → components/tooltip}/src/constants.d.ts +0 -0
  193. /package/libs/types/{tooltip → components/tooltip}/src/direactive.d.ts +0 -0
  194. /package/libs/types/{tooltip → components/tooltip}/src/popper.d.ts +0 -0
  195. /package/libs/types/{tooltip → components/tooltip}/src/tooltip.d.ts +0 -0
@@ -0,0 +1,952 @@
1
+ import { ref as E, reactive as U, defineComponent as x, onMounted as de, onUnmounted as fe, watch as pe, createVNode as r, Transition as te, withDirectives as P, vShow as ne, computed as F, Teleport as me, Fragment as ge, createApp as q, h as le, mergeProps as ye, resolveDirective as X, isVNode as be } from "vue";
2
+ const oe = (e) => (t) => Object.prototype.toString.call(t) === `[object ${e}]`, Se = oe("Function"), ve = oe("Promise"), D = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t) ? t.reduce((l, a) => l + D(e, a), "") : Object.keys(t).reduce(
3
+ (l, a) => l + (t[a] ? D(e, a) : ""),
4
+ ""
5
+ ) : "", $e = (e) => (t, l) => {
6
+ let a = t, s = l;
7
+ return a && typeof a != "string" && (s = a, a = ""), a = a ? `${e}__${a}` : e, `${a}${D(a, s)}`;
8
+ }, he = () => (e, t) => t ? `${D(`y-${e}`, t)}` : `y-${e}`, ke = {
9
+ "pull-refresh": {
10
+ pulling: "下拉刷新...",
11
+ loosing: "释放刷新...",
12
+ loading: "数据加载中...",
13
+ success: "数据已更新",
14
+ failed: "数据跟新失败,请稍后再试"
15
+ },
16
+ "form-item": {
17
+ validateMessage: "请输入正确内容"
18
+ }
19
+ };
20
+ E("zh-CN");
21
+ U({
22
+ "zh-CN": ke
23
+ });
24
+ const w = (e) => {
25
+ const t = `y-${e}`;
26
+ return [t, $e(t), he()];
27
+ }, m = (e) => isNaN(Number(e)) && typeof e == "string" ? e : `${e}px`, Ce = (e) => {
28
+ switch (e) {
29
+ case "top":
30
+ return "column-reverse";
31
+ case "bottom":
32
+ return "column";
33
+ case "left":
34
+ return "row-reverse";
35
+ case "right":
36
+ return "row";
37
+ default:
38
+ return "column";
39
+ }
40
+ }, [xe, we, Be] = w("mask"), Ne = {
41
+ // 控制显示
42
+ modelValue: {
43
+ type: Boolean,
44
+ default: !1
45
+ },
46
+ // 层级
47
+ zIndex: {
48
+ type: [Number, String],
49
+ default: null
50
+ },
51
+ // 动画时长
52
+ duration: {
53
+ type: Number,
54
+ default: 300
55
+ },
56
+ // 自定义类名
57
+ customClass: {
58
+ type: String,
59
+ default: ""
60
+ },
61
+ // 自定义样式
62
+ customStyle: {
63
+ type: Object,
64
+ default: () => ({})
65
+ },
66
+ // 触摸滚动开关
67
+ lockScroll: {
68
+ type: Boolean,
69
+ default: !0
70
+ },
71
+ onAfterLeave: {
72
+ type: Function,
73
+ default: null
74
+ }
75
+ }, S = U([]);
76
+ let Y = 0;
77
+ const I = /* @__PURE__ */ x({
78
+ name: xe,
79
+ props: Ne,
80
+ emits: ["update:modelValue"],
81
+ setup(e, {
82
+ slots: t
83
+ }) {
84
+ const l = E("");
85
+ de(() => {
86
+ l.value = `mask${Y}`, Y += 1, a(e.modelValue, !0);
87
+ }), fe(() => {
88
+ const n = S.findIndex((i) => i._id === l.value);
89
+ n >= 0 && S.splice(n, 1);
90
+ }), pe(() => e.modelValue, (n) => {
91
+ a(n);
92
+ });
93
+ const a = (n, i) => {
94
+ n ? (S.unshift({
95
+ _id: l.value,
96
+ _state: n
97
+ }), S.length > 1 && (S[1]._state = !1)) : i || (S.splice(0, 1), S.length > 0 && (S[0]._state = !0));
98
+ }, s = () => {
99
+ let n = !1;
100
+ for (let i = 0; i < S.length; i++)
101
+ S[i]._id === l.value && (n = S[i]._state);
102
+ return {
103
+ _state: n
104
+ };
105
+ }, f = (n) => {
106
+ const {
107
+ lockScroll: i
108
+ } = e;
109
+ i && (n.preventDefault(), n.stopPropagation());
110
+ };
111
+ return () => {
112
+ const {
113
+ customClass: n,
114
+ duration: i,
115
+ zIndex: p,
116
+ customStyle: g,
117
+ onAfterLeave: c
118
+ } = e, {
119
+ _state: d
120
+ } = s();
121
+ return r(te, {
122
+ name: Be("animation", "fade"),
123
+ onAfterLeave: c
124
+ }, {
125
+ default: () => {
126
+ var o;
127
+ return [P(r("div", {
128
+ style: {
129
+ animationDuration: `${i}ms`,
130
+ zIndex: p,
131
+ ...g
132
+ },
133
+ class: [we(), n],
134
+ onTouchmove: f
135
+ }, [(o = t.default) == null ? void 0 : o.call(t)]), [[ne, d]])];
136
+ }
137
+ });
138
+ };
139
+ }
140
+ });
141
+ I.install = (e) => {
142
+ const { name: t } = I;
143
+ e.component(t, I);
144
+ };
145
+ const [_e, Z, Ve] = w("popup"), Ae = {
146
+ // 控制显示
147
+ modelValue: {
148
+ type: Boolean,
149
+ default: !1
150
+ },
151
+ // 位置
152
+ position: {
153
+ type: String,
154
+ default: "center"
155
+ },
156
+ // 圆角
157
+ borderRadius: {
158
+ type: [Number, String],
159
+ default: ""
160
+ },
161
+ // 自定义类名
162
+ customClass: {
163
+ type: String,
164
+ default: ""
165
+ },
166
+ // 自定义属性
167
+ customStyle: {
168
+ type: Object,
169
+ default: () => ({})
170
+ },
171
+ // 插入对象
172
+ teleport: {
173
+ type: String,
174
+ default: "body"
175
+ },
176
+ // 动画时长
177
+ duration: {
178
+ type: Number,
179
+ default: 300
180
+ },
181
+ // 点击遮罩是否关闭
182
+ isCloseOnClickMask: {
183
+ type: Boolean,
184
+ default: !0
185
+ },
186
+ onAfterLeave: {
187
+ type: Function,
188
+ default: null
189
+ },
190
+ lockScroll: {
191
+ type: Boolean,
192
+ default: !0
193
+ },
194
+ zIndex: {
195
+ type: Number,
196
+ default: 101
197
+ }
198
+ }, L = /* @__PURE__ */ x({
199
+ name: _e,
200
+ props: Ae,
201
+ emits: ["clickMask", "update:modelValue"],
202
+ setup(e, {
203
+ slots: t,
204
+ emit: l
205
+ }) {
206
+ const a = F(() => {
207
+ const {
208
+ position: n,
209
+ borderRadius: i,
210
+ customStyle: p,
211
+ duration: g
212
+ } = e, c = m(i);
213
+ let d = "0";
214
+ switch (n) {
215
+ case "top":
216
+ d = ` 0 0 ${c} ${c}`;
217
+ break;
218
+ case "bottom":
219
+ d = `${c} ${c} 0 0`;
220
+ break;
221
+ case "left":
222
+ d = `0 ${c} ${c} 0`;
223
+ break;
224
+ case "right":
225
+ d = `${c} 0 0 ${c}`;
226
+ break;
227
+ default:
228
+ d = `${c}`;
229
+ }
230
+ return {
231
+ borderRadius: d,
232
+ animationDuration: `${g}ms`,
233
+ ...p
234
+ };
235
+ }), s = (n) => {
236
+ l("clickMask", n), e.isCloseOnClickMask && (f.value = !1);
237
+ }, f = F({
238
+ get: () => e.modelValue,
239
+ set: (n) => l("update:modelValue", n)
240
+ });
241
+ return () => {
242
+ const {
243
+ teleport: n,
244
+ position: i,
245
+ customClass: p,
246
+ duration: g,
247
+ onAfterLeave: c,
248
+ lockScroll: d,
249
+ zIndex: o
250
+ } = e;
251
+ return r(me, {
252
+ to: n
253
+ }, {
254
+ default: () => [r("div", {
255
+ class: Z(),
256
+ style: {
257
+ zIndex: o
258
+ }
259
+ }, [r(I, {
260
+ modelValue: f.value,
261
+ "onUpdate:modelValue": (u) => f.value = u,
262
+ duration: g,
263
+ lockScroll: d,
264
+ onClick: s,
265
+ onAfterLeave: c
266
+ }, null), r(te, {
267
+ name: Ve("animation", `slide-${i}`)
268
+ }, {
269
+ default: () => {
270
+ var u;
271
+ return [P(r("div", {
272
+ style: a.value,
273
+ class: [Z("content", {
274
+ [i]: i
275
+ }), p]
276
+ }, [((u = t.default) == null ? void 0 : u.call(t)) || null]), [[ne, f.value]])];
277
+ }
278
+ })])]
279
+ });
280
+ };
281
+ }
282
+ });
283
+ L.install = (e) => {
284
+ const { name: t } = L;
285
+ e.component(t, L);
286
+ };
287
+ const [ze, z] = w("icon"), Ie = (e) => new RegExp(/\.(https|png|jpg|gif|jpeg|webp|apng)$/).test(e.toLowerCase()), M = /* @__PURE__ */ x({
288
+ name: ze,
289
+ props: {
290
+ dot: {
291
+ type: Boolean,
292
+ default: !1
293
+ },
294
+ name: {
295
+ type: String,
296
+ default: ""
297
+ },
298
+ size: {
299
+ type: [Number, String],
300
+ default: ""
301
+ },
302
+ info: {
303
+ type: [Number, String],
304
+ default: ""
305
+ },
306
+ badge: {
307
+ type: [Number, String],
308
+ default: ""
309
+ },
310
+ color: {
311
+ type: String,
312
+ default: ""
313
+ },
314
+ subColor: {
315
+ type: String,
316
+ default: ""
317
+ },
318
+ subBg: {
319
+ type: String,
320
+ default: ""
321
+ },
322
+ classPrefix: {
323
+ type: String,
324
+ default: "y-icon"
325
+ },
326
+ /**
327
+ * @ignore
328
+ */
329
+ tag: {
330
+ type: String,
331
+ default: "i"
332
+ }
333
+ },
334
+ emits: ["click"],
335
+ setup(e, {
336
+ slots: t,
337
+ emit: l
338
+ }) {
339
+ const a = Ie(e.name), s = () => ({
340
+ fontSize: m(e.size),
341
+ color: e.color
342
+ }), f = (n) => {
343
+ l("click", n);
344
+ };
345
+ return () => {
346
+ const {
347
+ name: n,
348
+ classPrefix: i,
349
+ badge: p,
350
+ dot: g,
351
+ subColor: c,
352
+ subBg: d,
353
+ tag: o
354
+ } = e;
355
+ return r(o, {
356
+ class: `${i}${a ? "" : ` y-icon--${n}`}`,
357
+ style: s(),
358
+ onClick: f
359
+ }, {
360
+ default: () => {
361
+ var u;
362
+ return [a ? r("em", {
363
+ class: z("node")
364
+ }, [r("img", {
365
+ class: z("image"),
366
+ src: n,
367
+ alt: "icon"
368
+ }, null)]) : null, g ? r("em", {
369
+ class: z("dot"),
370
+ style: {
371
+ backgroundColor: d
372
+ }
373
+ }, null) : null, p ? r("em", {
374
+ class: z("badge"),
375
+ style: {
376
+ color: c,
377
+ backgroundColor: d
378
+ }
379
+ }, [p]) : null, ((u = t.default) == null ? void 0 : u.call(t)) || null];
380
+ }
381
+ });
382
+ };
383
+ }
384
+ });
385
+ M.install = (e) => {
386
+ const { name: t } = M;
387
+ e.component(t, M);
388
+ };
389
+ const [Le, B, Me] = w("button"), _ = /* @__PURE__ */ x({
390
+ name: Le,
391
+ props: {
392
+ // 标签
393
+ tag: {
394
+ type: String,
395
+ default: "button"
396
+ },
397
+ // 文案
398
+ text: {
399
+ type: String,
400
+ default: ""
401
+ },
402
+ // 类型
403
+ type: {
404
+ type: String,
405
+ default: "primary"
406
+ },
407
+ // 尺寸
408
+ size: {
409
+ type: String,
410
+ default: "middle"
411
+ },
412
+ // 不可以状态
413
+ disabled: {
414
+ type: Boolean,
415
+ default: !1
416
+ },
417
+ // 阴影
418
+ shadow: {
419
+ type: String,
420
+ default: ""
421
+ },
422
+ // 方形
423
+ square: {
424
+ type: Boolean,
425
+ default: !1
426
+ },
427
+ // 半圆弧
428
+ semicircle: {
429
+ type: Boolean,
430
+ default: !1
431
+ },
432
+ // 自定义圆角
433
+ radius: {
434
+ type: [Number, String],
435
+ default: ""
436
+ },
437
+ // 补充文案,双行显示
438
+ supplementText: {
439
+ type: String,
440
+ default: ""
441
+ },
442
+ // block 自动填满父布局
443
+ block: {
444
+ type: Boolean,
445
+ default: !1
446
+ },
447
+ // 危险按钮状态
448
+ danger: {
449
+ type: Boolean,
450
+ default: !1
451
+ }
452
+ },
453
+ emits: ["click"],
454
+ setup(e, {
455
+ slots: t,
456
+ emit: l
457
+ }) {
458
+ const a = (s) => {
459
+ l("click", s);
460
+ };
461
+ return () => {
462
+ let {
463
+ tag: s
464
+ } = e;
465
+ const {
466
+ radius: f,
467
+ type: n,
468
+ size: i,
469
+ disabled: p,
470
+ shadow: g,
471
+ block: c,
472
+ square: d,
473
+ semicircle: o,
474
+ danger: u,
475
+ text: b,
476
+ supplementText: y
477
+ } = e, $ = t.default ? t.default() : b;
478
+ return s = n === "link" ? "a" : s, r(s, {
479
+ class: [B([n, i, {
480
+ block: c,
481
+ square: d,
482
+ semicircle: o,
483
+ disabled: p && s === "a"
484
+ }, (n === "primary" || n === "secondary") && g ? `shadow_${g}` : "", u ? `${n}_danger` : "", p ? `${n}_disabled` : ""]), Me("el", "clickable")],
485
+ style: {
486
+ borderRadius: m(f)
487
+ },
488
+ disabled: p,
489
+ onClick: a
490
+ }, {
491
+ default: () => {
492
+ var h, V;
493
+ return [r("div", {
494
+ class: B("content")
495
+ }, [((h = t.leftIcon) == null ? void 0 : h.call(t)) || null, $ && r(ge, null, [y ? r("div", {
496
+ class: B("text")
497
+ }, [r("p", null, [$]), r("p", {
498
+ class: B("subtext")
499
+ }, [y])]) : r("span", {
500
+ class: B("text")
501
+ }, [$])]), ((V = t.rightIcon) == null ? void 0 : V.call(t)) || null])];
502
+ }
503
+ });
504
+ };
505
+ }
506
+ });
507
+ _.install = (e) => {
508
+ const { name: t } = _;
509
+ e.component(t, _);
510
+ };
511
+ const [Re, C] = w("loading"), Oe = {
512
+ // Loading icon 的颜色
513
+ color: {
514
+ type: String,
515
+ default: ""
516
+ },
517
+ // 背景色
518
+ bgColor: {
519
+ type: String,
520
+ default: ""
521
+ },
522
+ bgBorderRadius: {
523
+ type: [Number, String],
524
+ default: "16px"
525
+ },
526
+ // 粗细
527
+ thick: {
528
+ type: [Number, String],
529
+ default: 8
530
+ },
531
+ // 方向
532
+ direction: {
533
+ type: String,
534
+ default: "forward"
535
+ },
536
+ // 大小
537
+ size: {
538
+ type: [Number, String],
539
+ default: "24px"
540
+ },
541
+ padding: {
542
+ type: [Number, String],
543
+ default: ""
544
+ },
545
+ // 文案
546
+ text: {
547
+ type: String,
548
+ default: ""
549
+ },
550
+ // 文案位置
551
+ textLocation: {
552
+ type: String,
553
+ default: "bottom"
554
+ },
555
+ // 文案大小
556
+ textSize: {
557
+ type: [Number, String],
558
+ default: ""
559
+ },
560
+ // 文案颜色
561
+ textColor: {
562
+ type: String,
563
+ default: ""
564
+ },
565
+ // 布局位置
566
+ position: {
567
+ type: String,
568
+ default: "relative"
569
+ }
570
+ }, R = /* @__PURE__ */ x({
571
+ name: Re,
572
+ props: Oe,
573
+ setup(e, {
574
+ slots: t
575
+ }) {
576
+ return () => {
577
+ var y, $;
578
+ const {
579
+ position: l,
580
+ textLocation: a,
581
+ bgColor: s,
582
+ bgBorderRadius: f,
583
+ size: n,
584
+ padding: i,
585
+ color: p,
586
+ thick: g,
587
+ direction: c,
588
+ text: d,
589
+ textColor: o,
590
+ textSize: u
591
+ } = e, b = ((y = t.default) == null ? void 0 : y.call(t)) || d;
592
+ return r("div", {
593
+ class: C({
594
+ [l]: l !== "relative"
595
+ })
596
+ }, [r("div", {
597
+ class: C("bg", {
598
+ [l]: l !== "relative"
599
+ }),
600
+ style: {
601
+ flexDirection: Ce(a),
602
+ backgroundColor: s,
603
+ borderRadius: m(f),
604
+ padding: m(i)
605
+ }
606
+ }, [r("span", {
607
+ class: C("icon-wrapper"),
608
+ style: {
609
+ width: m(n),
610
+ height: m(n)
611
+ }
612
+ }, [(($ = t.icon) == null ? void 0 : $.call(t)) || r("svg", {
613
+ class: C("icon", {
614
+ [c]: c
615
+ }),
616
+ viewBox: "25 25 50 50"
617
+ }, [r("circle", {
618
+ class: C("icon-circle"),
619
+ style: {
620
+ stroke: p,
621
+ strokeWidth: m(g)
622
+ },
623
+ cx: "50",
624
+ cy: "50",
625
+ r: "20",
626
+ fill: "none"
627
+ }, null)])]), b && r("span", {
628
+ class: C("text", {
629
+ [a]: a
630
+ }),
631
+ style: {
632
+ color: o,
633
+ fontSize: m(u)
634
+ }
635
+ }, [b])])]);
636
+ };
637
+ }
638
+ }), Pe = {
639
+ position: "fixed"
640
+ };
641
+ let N = null;
642
+ const ae = (e, t) => {
643
+ const a = q({
644
+ render: () => le(R, { ...e }, { ...t })
645
+ }), s = document.createElement("div");
646
+ return a.mount(s);
647
+ }, De = {
648
+ /**
649
+ * @description: show
650
+ * @param {LoadingPropsType} options
651
+ * @return {*}
652
+ */
653
+ show: (e, t) => {
654
+ N || (N = ae(
655
+ {
656
+ ...Pe,
657
+ ...e
658
+ },
659
+ t
660
+ )), document.body.appendChild(N.$el);
661
+ },
662
+ /**
663
+ * @description: hide
664
+ * @param {*}
665
+ * @return {*}
666
+ */
667
+ hide: () => {
668
+ N && N.$el.remove();
669
+ }
670
+ }, ee = (e, t) => {
671
+ t.value ? (e.classList.add("y-loading__wrap"), e.appendChild(e.instance.$el)) : (e.classList.remove("y-loading__wrap"), e.removeChild(e.instance.$el));
672
+ }, Te = {
673
+ install: (e) => {
674
+ e.directive("loading", re), e.directive("loading-props", je), e.directive("loading-slots", Fe);
675
+ }
676
+ }, re = {
677
+ getSSRProps: (e) => ({ ...e }),
678
+ mounted: (e, t) => {
679
+ e.instance = ae({ ...e.customProps }, { ...e.customSlots }), t.value && ee(e, t);
680
+ },
681
+ updated: (e, t) => {
682
+ t.oldValue !== t.value && ee(e, t);
683
+ },
684
+ unmounted: (e) => {
685
+ e.instance && e.instance.$el.remove();
686
+ }
687
+ }, je = {
688
+ getSSRProps: (e) => ({ ...e }),
689
+ beforeMount: (e, t) => {
690
+ e.customProps = { ...t.value };
691
+ }
692
+ }, Fe = {
693
+ getSSRProps: (e) => ({ ...e }),
694
+ beforeMount: (e, t) => {
695
+ e.customSlots = { ...t.value };
696
+ }
697
+ };
698
+ R.install = (e) => {
699
+ e.component(R.name, R), e.provide("loading", De), e.use(Te);
700
+ };
701
+ function Ee(e) {
702
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !be(e);
703
+ }
704
+ const [Ue, v] = w("dialog"), qe = {
705
+ // 控制显示
706
+ modelValue: {
707
+ type: Boolean,
708
+ default: !1
709
+ },
710
+ width: {
711
+ type: [Number, String],
712
+ default: 288
713
+ },
714
+ title: {
715
+ type: String,
716
+ default: ""
717
+ },
718
+ titleAlign: {
719
+ type: String,
720
+ default: "center"
721
+ },
722
+ message: {
723
+ type: String,
724
+ default: ""
725
+ },
726
+ messageAlign: {
727
+ type: String,
728
+ default: "center"
729
+ },
730
+ isCloseOnClickMask: {
731
+ type: Boolean,
732
+ default: !0
733
+ },
734
+ showCloseIcon: {
735
+ type: Boolean,
736
+ default: !1
737
+ },
738
+ showCancelBtn: {
739
+ type: Boolean,
740
+ default: !1
741
+ },
742
+ cancelButtonText: {
743
+ type: String,
744
+ default: "取消"
745
+ },
746
+ showConfirmBtn: {
747
+ type: Boolean,
748
+ default: !1
749
+ },
750
+ confirmButtonText: {
751
+ type: String,
752
+ default: "确认"
753
+ },
754
+ beforeClose: {
755
+ type: Function,
756
+ default: null
757
+ },
758
+ callback: {
759
+ type: Function,
760
+ default: null
761
+ },
762
+ imgSrc: {
763
+ type: String,
764
+ default: null
765
+ },
766
+ circleImg: {
767
+ type: Boolean,
768
+ default: !1
769
+ },
770
+ // 插入对象
771
+ teleport: {
772
+ type: String,
773
+ default: "body"
774
+ }
775
+ }, O = /* @__PURE__ */ x({
776
+ name: Ue,
777
+ directives: {
778
+ loading: re
779
+ },
780
+ props: qe,
781
+ emits: ["update:modelValue", "cancel", "confirm"],
782
+ setup(e, {
783
+ emit: t,
784
+ slots: l
785
+ }) {
786
+ const a = U({
787
+ cancel: !1,
788
+ confirm: !1
789
+ }), s = (o) => {
790
+ d.value = o;
791
+ }, f = (o) => {
792
+ var u;
793
+ s(!1), (u = e.callback) == null || u.call(e, o);
794
+ }, n = (o) => {
795
+ t("cancel", o, p("cancel"));
796
+ }, i = (o) => {
797
+ t("confirm", o, p("confirm"));
798
+ }, p = (o) => {
799
+ const {
800
+ modelValue: u,
801
+ beforeClose: b
802
+ } = e;
803
+ if (u)
804
+ if (Se(b)) {
805
+ a[o] = !0;
806
+ const y = b(o);
807
+ ve(y) ? y.then((h) => {
808
+ g(h, o);
809
+ }).catch((h) => {
810
+ throw new Error(h);
811
+ }) : g(y, o);
812
+ } else
813
+ f(o);
814
+ }, g = (o, u) => {
815
+ o && f(u), a[u] = !1;
816
+ }, c = (o, u, b) => {
817
+ let y = Number(o.substring(0, o.length - 2));
818
+ return y /= u || 2, b ? `${b(y)}px` : `${y}px`;
819
+ }, d = F({
820
+ get: () => e.modelValue,
821
+ set: (o) => t("update:modelValue", o)
822
+ });
823
+ return () => {
824
+ const {
825
+ width: o,
826
+ title: u,
827
+ titleAlign: b,
828
+ message: y,
829
+ messageAlign: $,
830
+ isCloseOnClickMask: h,
831
+ showCloseIcon: V,
832
+ showCancelBtn: W,
833
+ cancelButtonText: T,
834
+ showConfirmBtn: G,
835
+ confirmButtonText: ce,
836
+ imgSrc: H,
837
+ circleImg: k,
838
+ teleport: se
839
+ } = e;
840
+ return r(L, ye({
841
+ modelValue: d.value,
842
+ "onUpdate:modelValue": (A) => d.value = A,
843
+ customClass: v(),
844
+ customStyle: {
845
+ width: m(o)
846
+ }
847
+ }, {
848
+ "onUpdate:modelValue": s
849
+ }, {
850
+ isCloseOnClickMask: h,
851
+ teleport: se
852
+ }), {
853
+ default: () => {
854
+ var A, J, K, Q;
855
+ return [((A = l.img) == null ? void 0 : A.call(l)) || H && r("div", {
856
+ class: v("img", {
857
+ circle: k
858
+ }),
859
+ style: {
860
+ top: k ? `-${c(m(o), 4)}` : "auto",
861
+ left: k ? `calc(50% - ${c(m(o), 4)})` : "auto"
862
+ }
863
+ }, [r("div", {
864
+ style: {
865
+ width: k ? c(m(o)) : m(o),
866
+ height: c(m(o)),
867
+ background: `url(${H}) center`,
868
+ borderRadius: k ? "50%" : "20px 20px 0 0"
869
+ }
870
+ }, null)]), r("div", {
871
+ class: v("container")
872
+ }, [r("div", {
873
+ style: {
874
+ height: k ? c(m(o), 4, (ue) => ue + 20) : "24px"
875
+ }
876
+ }, null), ((J = l.title) == null ? void 0 : J.call(l)) || r("div", {
877
+ class: v("title"),
878
+ style: {
879
+ textAlign: b
880
+ }
881
+ }, [u]), r("div", {
882
+ class: v("content")
883
+ }, [r("div", {
884
+ class: v("message"),
885
+ style: {
886
+ textAlign: $
887
+ }
888
+ }, [((K = l.default) == null ? void 0 : K.call(l)) || y]), ((Q = l.footer) == null ? void 0 : Q.call(l)) || r("div", {
889
+ class: v("footer"),
890
+ style: {
891
+ paddingTop: W || G ? "20px" : "0px"
892
+ }
893
+ }, [W && P(r(_, {
894
+ type: "secondary",
895
+ class: v("footer-btn"),
896
+ onClick: n
897
+ }, Ee(T) ? T : {
898
+ default: () => [T]
899
+ }), [[X("loading"), a.cancel]]), G && P(r(_, {
900
+ type: "primary",
901
+ class: v("footer-btn"),
902
+ onClick: i
903
+ }, {
904
+ default: () => [a.confirm ? "" : ce]
905
+ }), [[X("loading"), a.confirm]])])]), V && r("div", {
906
+ class: v("close"),
907
+ onClick: () => f("close")
908
+ }, [r(M, {
909
+ name: "cross"
910
+ }, null)])])];
911
+ }
912
+ });
913
+ };
914
+ }
915
+ });
916
+ let j = q({}), We = 0;
917
+ const ie = [], Ge = (e, t) => {
918
+ const l = `dialog${We += 1}`;
919
+ j = q({
920
+ setup() {
921
+ const f = E(!0), n = (i) => {
922
+ f.value = i;
923
+ };
924
+ return () => le(
925
+ O,
926
+ {
927
+ modelValue: f.value,
928
+ "onUpdate:modelValue": n,
929
+ ...e,
930
+ onAfterLeave: () => {
931
+ He(l);
932
+ }
933
+ },
934
+ { ...t }
935
+ );
936
+ }
937
+ });
938
+ const s = document.createElement("div");
939
+ ie.push({ id: l, app: j, el: s }), j.mount(s);
940
+ }, He = (e) => {
941
+ ie.forEach((t) => {
942
+ e === t.id && t.app.unmount();
943
+ });
944
+ };
945
+ O.install = (e) => {
946
+ const { name: t } = O;
947
+ e.component(t, O), e.provide("dialog", Ge);
948
+ };
949
+ export {
950
+ Ge as createDialog,
951
+ O as default
952
+ };