focusin-mini-ui 1.0.0

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.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ 1
@@ -0,0 +1,490 @@
1
+ import { defineComponent as _, openBlock as m, createElementBlock as v, normalizeClass as $, toDisplayString as G, Fragment as Y, renderList as Z, unref as I, createBlock as T, ref as k, watch as O, resolveComponent as E, createElementVNode as p, renderSlot as A, withDirectives as M, createVNode as x, vShow as F, normalizeStyle as z, pushScopeId as ee, popScopeId as te, computed as oe, createCommentVNode as ne } from "vue";
2
+ const D = "common-button", se = /* @__PURE__ */ _({
3
+ __name: "sButton",
4
+ props: {
5
+ option: {}
6
+ },
7
+ setup(t) {
8
+ const { mode: i, onClick: o } = inject(D), { option: s } = t, n = () => {
9
+ console.log("onClick"), o(i, s);
10
+ };
11
+ return (c, l) => (m(), v("view", {
12
+ class: $(["button-item w-full", { active: c.option.isActive }]),
13
+ onTap: n
14
+ }, G(c.option.label), 35));
15
+ }
16
+ });
17
+ const y = (t, i) => {
18
+ const o = t.__vccOpts || t;
19
+ for (const [s, n] of i)
20
+ o[s] = n;
21
+ return o;
22
+ }, ae = /* @__PURE__ */ y(se, [["__scopeId", "data-v-3e8a5cc8"]]), ie = { class: "common-button grid grid-cols-3" }, le = /* @__PURE__ */ _({
23
+ __name: "index",
24
+ props: {
25
+ mode: { default: "single" },
26
+ options: { default: () => [] },
27
+ modelValue: {}
28
+ },
29
+ emits: ["update:modelValue"],
30
+ setup(t, { emit: i }) {
31
+ const o = t, s = i, n = ref(
32
+ o.options.map((l) => ({ ...l, isActive: !1 }))
33
+ ), c = (l, d) => {
34
+ if (console.log("onClick"), l === "single") {
35
+ n.value.forEach((r) => {
36
+ r.value === d.value ? r.isActive = !r.isActive : r.isActive = !1;
37
+ });
38
+ const a = n.value.find((r) => r.isActive);
39
+ a ? s("update:modelValue", a.value) : s("update:modelValue", null);
40
+ } else {
41
+ n.value.forEach((r) => {
42
+ r.value === d.value && (r.isActive = !r.isActive);
43
+ });
44
+ const a = n.value.filter((r) => r.isActive);
45
+ s(
46
+ "update:modelValue",
47
+ a.map((r) => r.value)
48
+ );
49
+ }
50
+ };
51
+ return provide(D, {
52
+ mode: o.mode,
53
+ onClick: c
54
+ }), watch(
55
+ () => o.options,
56
+ () => {
57
+ n.value = o.options.map((l) => ({ ...l, isActive: !1 })), console.log(o.modelValue);
58
+ },
59
+ {
60
+ deep: !0
61
+ }
62
+ ), watch(
63
+ () => o.modelValue,
64
+ (l, d) => {
65
+ console.log("props.modelValue", l, d, n.value), o.mode === "single" ? n.value.forEach((a) => {
66
+ a.value === l ? a.isActive = !0 : a.isActive = !1;
67
+ }) : Array.isArray(l) && n.value.forEach((a) => {
68
+ l.includes(a.value) ? a.isActive = !0 : a.isActive = !1;
69
+ });
70
+ },
71
+ {
72
+ immediate: !0
73
+ }
74
+ ), (l, d) => (m(), v("view", ie, [
75
+ (m(!0), v(Y, null, Z(I(n), (a) => (m(), T(ae, {
76
+ key: a.value,
77
+ option: a
78
+ }, null, 8, ["option"]))), 128))
79
+ ]));
80
+ }
81
+ });
82
+ const j = /* @__PURE__ */ y(le, [["__scopeId", "data-v-ee7334b9"]]), re = (t) => (ee("data-v-60a05d39"), t = t(), te(), t), ce = /* @__PURE__ */ re(() => /* @__PURE__ */ p("div", { class: "hr" }, null, -1)), de = { class: "titleCenter" }, ue = { class: "icon" }, pe = /* @__PURE__ */ _({
83
+ __name: "index",
84
+ props: {
85
+ title: {
86
+ type: String,
87
+ default: ""
88
+ },
89
+ fold: {
90
+ type: Boolean,
91
+ default: !0
92
+ },
93
+ isFold: {
94
+ type: Boolean,
95
+ default: !0
96
+ },
97
+ hasPadding: {
98
+ type: Boolean,
99
+ default: !1
100
+ },
101
+ contentStyle: {
102
+ type: Object,
103
+ default: () => ({})
104
+ }
105
+ },
106
+ setup(t) {
107
+ const i = t, o = k(!0);
108
+ O(
109
+ () => i.isFold,
110
+ (n) => {
111
+ o.value = n;
112
+ },
113
+ {
114
+ immediate: !0,
115
+ deep: !0
116
+ }
117
+ );
118
+ const s = () => {
119
+ o.value = !o.value;
120
+ };
121
+ return (n, c) => {
122
+ const l = E("wd-icon");
123
+ return m(), v("div", {
124
+ class: $(["zCard", { isOpen: o.value, "has-padding": t.hasPadding }])
125
+ }, [
126
+ p("div", {
127
+ class: $(["title", { "has-padding": !t.hasPadding }]),
128
+ onClick: s
129
+ }, [
130
+ ce,
131
+ p("p", null, G(t.title), 1),
132
+ p("div", de, [
133
+ A(n.$slots, "titleCenter", {}, void 0, !0)
134
+ ]),
135
+ A(n.$slots, "right", {}, void 0, !0),
136
+ M(p("div", ue, [
137
+ x(l, {
138
+ name: "arrow-up",
139
+ color: "rgba(145, 152, 170, 1)",
140
+ size: "18px"
141
+ })
142
+ ], 512), [
143
+ [F, t.fold]
144
+ ])
145
+ ], 2),
146
+ M(p("div", {
147
+ class: "content",
148
+ style: z(t.contentStyle)
149
+ }, [
150
+ A(n.$slots, "default", {}, void 0, !0)
151
+ ], 4), [
152
+ [F, o.value]
153
+ ])
154
+ ], 2);
155
+ };
156
+ }
157
+ });
158
+ const L = /* @__PURE__ */ y(pe, [["__scopeId", "data-v-60a05d39"]]), me = /* @__PURE__ */ _({
159
+ __name: "index",
160
+ props: {
161
+ tip: {
162
+ type: String,
163
+ default: "暂无内容"
164
+ }
165
+ },
166
+ setup(t) {
167
+ const i = {}.VITE_BASE_OSS + "login/empty.svg", o = t, s = computed(() => o.tip);
168
+ return (n, c) => {
169
+ const l = E("wd-status-tip");
170
+ return m(), T(l, {
171
+ class: "common-empty",
172
+ "image-size": {
173
+ height: "320rpx",
174
+ width: "320rpx"
175
+ },
176
+ image: i,
177
+ tip: I(s)
178
+ }, null, 8, ["tip"]);
179
+ };
180
+ }
181
+ });
182
+ const N = /* @__PURE__ */ y(me, [["__scopeId", "data-v-cf5f4d86"]]), V = (t) => t != null;
183
+ function fe(t, i, o = {}) {
184
+ let s = null, n, c, l;
185
+ const d = V(o.leading) ? o.leading : !1, a = V(o.trailing) ? o.trailing : !0;
186
+ function r() {
187
+ n !== void 0 && (l = t.apply(c, n), n = void 0);
188
+ }
189
+ function b() {
190
+ s = setTimeout(() => {
191
+ s = null, a && r();
192
+ }, i);
193
+ }
194
+ function w() {
195
+ s !== null && (clearTimeout(s), s = null);
196
+ }
197
+ function P(...S) {
198
+ return n = S, c = this, s === null ? (d && r(), b()) : a && (w(), b()), l;
199
+ }
200
+ return P;
201
+ }
202
+ const C = [..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"], U = (t) => t.replace(/[+/]/g, (i) => i === "+" ? "-" : "_").replace(/=+\$/m, ""), ge = (t, i = !1) => {
203
+ let o = "";
204
+ for (let s = 0, n = t.length; s < n; s += 3) {
205
+ const [c, l, d] = [t[s], t[s + 1], t[s + 2]], a = c << 16 | l << 8 | d;
206
+ o += C[a >>> 18], o += C[a >>> 12 & 63], o += typeof l < "u" ? C[a >>> 6 & 63] : "=", o += typeof d < "u" ? C[a & 63] : "=";
207
+ }
208
+ return i ? U(o) : o;
209
+ }, ve = typeof btoa == "function" ? (t) => btoa(t) : (t) => {
210
+ if (t.charCodeAt(0) > 255)
211
+ throw new RangeError("The string contains invalid characters.");
212
+ return ge(Uint8Array.from(t, (i) => i.charCodeAt(0)));
213
+ }, he = (t) => unescape(encodeURIComponent(t));
214
+ function _e(t, i = !1) {
215
+ const o = ve(he(t));
216
+ return i ? U(o) : o;
217
+ }
218
+ const g = (t) => ({
219
+ type: Boolean,
220
+ default: t
221
+ }), h = (t) => ({
222
+ type: String,
223
+ default: t
224
+ }), ye = {
225
+ /**
226
+ * 自定义根节点样式
227
+ */
228
+ customStyle: h(""),
229
+ /**
230
+ * 自定义根节点样式类
231
+ */
232
+ customClass: h("")
233
+ }, be = {
234
+ ...ye,
235
+ /**
236
+ * 幽灵按钮
237
+ */
238
+ plain: g(!1),
239
+ /**
240
+ * 圆角按钮
241
+ */
242
+ round: g(!0),
243
+ /**
244
+ * 禁用按钮
245
+ */
246
+ disabled: g(!1),
247
+ /**
248
+ * 是否细边框
249
+ */
250
+ hairline: g(!1),
251
+ /**
252
+ * 块状按钮
253
+ */
254
+ block: g(!1),
255
+ /**
256
+ * 按钮类型,可选值:primary / success / info / warning / error / text / icon
257
+ */
258
+ type: h("primary"),
259
+ /**
260
+ * 按钮尺寸,可选值:small / medium / large
261
+ */
262
+ size: h("medium"),
263
+ /**
264
+ * 图标类名
265
+ */
266
+ icon: String,
267
+ /**
268
+ * 类名前缀,用于使用自定义图标,用法参考Icon组件
269
+ */
270
+ classPrefix: h("wd-icon"),
271
+ /**
272
+ * 加载中按钮
273
+ */
274
+ loading: g(!1),
275
+ /**
276
+ * 加载图标颜色
277
+ */
278
+ loadingColor: String,
279
+ /**
280
+ * 开放能力
281
+ */
282
+ openType: String,
283
+ /**
284
+ * 指定是否阻止本节点的祖先节点出现点击态
285
+ */
286
+ hoverStopPropagation: Boolean,
287
+ /**
288
+ * 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文
289
+ */
290
+ lang: String,
291
+ /**
292
+ * 会话来源,open-type="contact"时有效
293
+ */
294
+ sessionFrom: String,
295
+ /**
296
+ * 会话内消息卡片标题,open-type="contact"时有效
297
+ */
298
+ sendMessageTitle: String,
299
+ /**
300
+ * 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效
301
+ */
302
+ sendMessagePath: String,
303
+ /**
304
+ * 会话内消息卡片图片,open-type="contact"时有效
305
+ */
306
+ sendMessageImg: String,
307
+ /**
308
+ * 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效
309
+ */
310
+ appParameter: String,
311
+ /**
312
+ * 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,open-type="contact"时有效
313
+ */
314
+ showMessageCard: Boolean,
315
+ /**
316
+ * 按钮的唯一标识,可用于设置隐私同意授权按钮的id
317
+ */
318
+ buttonId: String,
319
+ /**
320
+ * 支付宝小程序,当 open-type 为 getAuthorize 时有效。
321
+ * 可选值:'phoneNumber' | 'userInfo'
322
+ */
323
+ scope: String
324
+ }, we = ["id", "hover-class", "hover-start-time", "hover-stay-time", "open-type", "send-message-title", "send-message-path", "send-message-img", "app-parameter", "show-message-card", "session-from", "lang", "hover-stop-propagation", "scope"], Se = { class: "wd-button__content" }, Ce = {
325
+ key: 0,
326
+ class: "wd-button__loading"
327
+ }, ke = { class: "wd-button__text" }, Ae = /* @__PURE__ */ _({
328
+ __name: "index",
329
+ props: be,
330
+ emits: [
331
+ "click",
332
+ "getuserinfo",
333
+ "contact",
334
+ "getphonenumber",
335
+ "error",
336
+ "launchapp",
337
+ "opensetting",
338
+ "chooseavatar",
339
+ "agreeprivacyauthorization"
340
+ ],
341
+ setup(t, { emit: i }) {
342
+ const o = (e = "#4D80F0", f = !0) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 42 42"><defs><linearGradient x1="100%" y1="0%" x2="0%" y2="0%" id="a"><stop stop-color="${f ? e : "#fff"}" offset="0%" stop-opacity="0"/><stop stop-color="${f ? e : "#fff"}" offset="100%"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><path d="M21 1c11.046 0 20 8.954 20 20s-8.954 20-20 20S1 32.046 1 21 9.954 1 21 1zm0 7C13.82 8 8 13.82 8 21s5.82 13 13 13 13-5.82 13-13S28.18 8 21 8z" fill="${f ? "#fff" : e}"/><path d="M4.599 21c0 9.044 7.332 16.376 16.376 16.376 9.045 0 16.376-7.332 16.376-16.376" stroke="url(#a)" stroke-width="3.5" stroke-linecap="round"/></g></svg>`, s = t, n = i;
343
+ console.log("customClass value:", s.customClass);
344
+ const c = k(20), l = k(70), d = k(""), a = oe(() => `background-image: url(${d.value});`);
345
+ O(
346
+ () => s.loading,
347
+ () => {
348
+ Q();
349
+ },
350
+ { deep: !0, immediate: !0 }
351
+ );
352
+ const r = fe((e) => {
353
+ !s.disabled && !s.loading && n("click", e);
354
+ }, 1e3, { leading: !0, trailing: !1 });
355
+ function b(e) {
356
+ s.scope === "phoneNumber" ? S(e) : s.scope === "userInfo" && w(e);
357
+ }
358
+ function w(e) {
359
+ n("getuserinfo", e.detail);
360
+ }
361
+ function P(e) {
362
+ n("contact", e.detail);
363
+ }
364
+ function S(e) {
365
+ n("getphonenumber", e.detail);
366
+ }
367
+ function R(e) {
368
+ n("error", e.detail);
369
+ }
370
+ function W(e) {
371
+ n("launchapp", e.detail);
372
+ }
373
+ function q(e) {
374
+ n("opensetting", e.detail);
375
+ }
376
+ function H(e) {
377
+ n("chooseavatar", e.detail);
378
+ }
379
+ function J(e) {
380
+ n("agreeprivacyauthorization", e.detail);
381
+ }
382
+ function Q() {
383
+ const { loadingColor: e, type: f, plain: B } = s;
384
+ let u = e;
385
+ if (!u)
386
+ switch (f) {
387
+ case "primary":
388
+ u = "#4D80F0";
389
+ break;
390
+ case "success":
391
+ u = "#34d19d";
392
+ break;
393
+ case "info":
394
+ u = "#333";
395
+ break;
396
+ case "warning":
397
+ u = "#f0883a";
398
+ break;
399
+ case "error":
400
+ u = "#fa4350";
401
+ break;
402
+ case "default":
403
+ u = "#333";
404
+ break;
405
+ }
406
+ const X = o(u, !B);
407
+ d.value = `"data:image/svg+xml;base64,${_e(X)}"`;
408
+ }
409
+ return (e, f) => {
410
+ const B = E("wd-icon");
411
+ return m(), v("button", {
412
+ id: e.buttonId,
413
+ "hover-class": `${e.disabled || e.loading ? "" : "wd-button--active"}`,
414
+ style: z(e.customStyle),
415
+ class: $([
416
+ "wd-button",
417
+ `is-${e.type}`,
418
+ `is-${e.size}`,
419
+ {
420
+ "is-round": e.round,
421
+ "is-hairline": e.hairline,
422
+ "is-plain": e.plain,
423
+ "is-disabled": e.disabled,
424
+ "is-block": e.block,
425
+ "is-loading": e.loading
426
+ },
427
+ e.customClass
428
+ ]),
429
+ "hover-start-time": c.value,
430
+ "hover-stay-time": l.value,
431
+ "open-type": e.disabled || e.loading ? void 0 : e.openType,
432
+ "send-message-title": e.sendMessageTitle,
433
+ "send-message-path": e.sendMessagePath,
434
+ "send-message-img": e.sendMessageImg,
435
+ "app-parameter": e.appParameter,
436
+ "show-message-card": e.showMessageCard,
437
+ "session-from": e.sessionFrom,
438
+ lang: e.lang,
439
+ "hover-stop-propagation": e.hoverStopPropagation,
440
+ scope: e.scope,
441
+ onClick: f[0] || (f[0] = //@ts-ignore
442
+ (...u) => I(r) && I(r)(...u)),
443
+ "on:getAuthorize": b,
444
+ onGetuserinfo: w,
445
+ onContact: P,
446
+ onGetphonenumber: S,
447
+ onError: R,
448
+ onLaunchapp: W,
449
+ onOpensetting: q,
450
+ onChooseavatar: H,
451
+ onAgreeprivacyauthorization: J
452
+ }, [
453
+ p("view", Se, [
454
+ e.loading ? (m(), v("view", Ce, [
455
+ p("view", {
456
+ class: "wd-button__loading-svg",
457
+ style: z(a.value)
458
+ }, null, 4)
459
+ ])) : e.icon ? (m(), T(B, {
460
+ key: 1,
461
+ "custom-class": "wd-button__icon",
462
+ name: e.icon,
463
+ classPrefix: e.classPrefix
464
+ }, null, 8, ["name", "classPrefix"])) : ne("", !0),
465
+ p("view", ke, [
466
+ A(e.$slots, "default", {}, void 0, !0)
467
+ ])
468
+ ])
469
+ ], 46, we);
470
+ };
471
+ }
472
+ });
473
+ const K = /* @__PURE__ */ y(Ae, [["__scopeId", "data-v-bec91f45"]]), $e = [j, L, N, K], Ie = (t) => {
474
+ $e.forEach((i) => {
475
+ t.component(i.name, i);
476
+ });
477
+ }, Be = {
478
+ install: Ie,
479
+ CommonButton: j,
480
+ CommonCollapse: L,
481
+ CommonEmpty: N,
482
+ CommonWdButton: K
483
+ };
484
+ export {
485
+ j as CommonButton,
486
+ L as CommonCollapse,
487
+ N as CommonEmpty,
488
+ K as CommonWdButton,
489
+ Be as default
490
+ };
@@ -0,0 +1 @@
1
+ (function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u.FocusinMiniUi={},u.Vue))})(this,function(u,e){"use strict";function ie(o){return o}const I="common-button",$=e.defineComponent({__name:"sButton",props:{option:{}},setup(o){const{mode:l,onClick:n}=inject(I),{option:a}=o,s=()=>{console.log("onClick"),n(l,a)};return(d,r)=>(e.openBlock(),e.createElementBlock("view",{class:e.normalizeClass(["button-item w-full",{active:d.option.isActive}]),onTap:s},e.toDisplayString(d.option.label),35))}}),le="",h=(o,l)=>{const n=o.__vccOpts||o;for(const[a,s]of l)n[a]=s;return n},V=h($,[["__scopeId","data-v-3e8a5cc8"]]),T={class:"common-button grid grid-cols-3"},M=e.defineComponent({__name:"index",props:{mode:{default:"single"},options:{default:()=>[]},modelValue:{}},emits:["update:modelValue"],setup(o,{emit:l}){const n=o,a=l,s=ref(n.options.map(r=>({...r,isActive:!1}))),d=(r,p)=>{if(console.log("onClick"),r==="single"){s.value.forEach(c=>{c.value===p.value?c.isActive=!c.isActive:c.isActive=!1});const i=s.value.find(c=>c.isActive);i?a("update:modelValue",i.value):a("update:modelValue",null)}else{s.value.forEach(c=>{c.value===p.value&&(c.isActive=!c.isActive)});const i=s.value.filter(c=>c.isActive);a("update:modelValue",i.map(c=>c.value))}};return provide(I,{mode:n.mode,onClick:d}),watch(()=>n.options,()=>{s.value=n.options.map(r=>({...r,isActive:!1})),console.log(n.modelValue)},{deep:!0}),watch(()=>n.modelValue,(r,p)=>{console.log("props.modelValue",r,p,s.value),n.mode==="single"?s.value.forEach(i=>{i.value===r?i.isActive=!0:i.isActive=!1}):Array.isArray(r)&&s.value.forEach(i=>{r.includes(i.value)?i.isActive=!0:i.isActive=!1})},{immediate:!0}),(r,p)=>(e.openBlock(),e.createElementBlock("view",T,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),i=>(e.openBlock(),e.createBlock(V,{key:i.value,option:i},null,8,["option"]))),128))]))}}),re="",k=h(M,[["__scopeId","data-v-ee7334b9"]]),N=(o=>(e.pushScopeId("data-v-60a05d39"),o=o(),e.popScopeId(),o))(()=>e.createElementVNode("div",{class:"hr"},null,-1)),F={class:"titleCenter"},O={class:"icon"},D=e.defineComponent({__name:"index",props:{title:{type:String,default:""},fold:{type:Boolean,default:!0},isFold:{type:Boolean,default:!0},hasPadding:{type:Boolean,default:!1},contentStyle:{type:Object,default:()=>({})}},setup(o){const l=o,n=e.ref(!0);e.watch(()=>l.isFold,s=>{n.value=s},{immediate:!0,deep:!0});const a=()=>{n.value=!n.value};return(s,d)=>{const r=e.resolveComponent("wd-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["zCard",{isOpen:n.value,"has-padding":o.hasPadding}])},[e.createElementVNode("div",{class:e.normalizeClass(["title",{"has-padding":!o.hasPadding}]),onClick:a},[N,e.createElementVNode("p",null,e.toDisplayString(o.title),1),e.createElementVNode("div",F,[e.renderSlot(s.$slots,"titleCenter",{},void 0,!0)]),e.renderSlot(s.$slots,"right",{},void 0,!0),e.withDirectives(e.createElementVNode("div",O,[e.createVNode(r,{name:"arrow-up",color:"rgba(145, 152, 170, 1)",size:"18px"})],512),[[e.vShow,o.fold]])],2),e.withDirectives(e.createElementVNode("div",{class:"content",style:e.normalizeStyle(o.contentStyle)},[e.renderSlot(s.$slots,"default",{},void 0,!0)],4),[[e.vShow,n.value]])],2)}}}),de="",S=h(D,[["__scopeId","data-v-60a05d39"]]),G=e.defineComponent({__name:"index",props:{tip:{type:String,default:"暂无内容"}},setup(o){const l={}.VITE_BASE_OSS+"login/empty.svg",n=o,a=computed(()=>n.tip);return(s,d)=>{const r=e.resolveComponent("wd-status-tip");return e.openBlock(),e.createBlock(r,{class:"common-empty","image-size":{height:"320rpx",width:"320rpx"},image:l,tip:e.unref(a)},null,8,["tip"])}}}),pe="",w=h(G,[["__scopeId","data-v-cf5f4d86"]]),z=o=>o!=null;function j(o,l,n={}){let a=null,s,d,r;const p=z(n.leading)?n.leading:!1,i=z(n.trailing)?n.trailing:!0;function c(){s!==void 0&&(r=o.apply(d,s),s=void 0)}function b(){a=setTimeout(()=>{a=null,i&&c()},l)}function v(){a!==null&&(clearTimeout(a),a=null)}function A(...C){return s=C,d=this,a===null?(p&&c(),b()):i&&(v(),b()),r}return A}const y=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],P=o=>o.replace(/[+/]/g,l=>l==="+"?"-":"_").replace(/=+\$/m,""),U=(o,l=!1)=>{let n="";for(let a=0,s=o.length;a<s;a+=3){const[d,r,p]=[o[a],o[a+1],o[a+2]],i=d<<16|r<<8|p;n+=y[i>>>18],n+=y[i>>>12&63],n+=typeof r<"u"?y[i>>>6&63]:"=",n+=typeof p<"u"?y[i&63]:"="}return l?P(n):n},L=typeof btoa=="function"?o=>btoa(o):o=>{if(o.charCodeAt(0)>255)throw new RangeError("The string contains invalid characters.");return U(Uint8Array.from(o,l=>l.charCodeAt(0)))},K=o=>unescape(encodeURIComponent(o));function R(o,l=!1){const n=L(K(o));return l?P(n):n}const g=o=>({type:Boolean,default:o}),_=o=>({type:String,default:o}),W={...{customStyle:_(""),customClass:_("")},plain:g(!1),round:g(!0),disabled:g(!1),hairline:g(!1),block:g(!1),type:_("primary"),size:_("medium"),icon:String,classPrefix:_("wd-icon"),loading:g(!1),loadingColor:String,openType:String,hoverStopPropagation:Boolean,lang:String,sessionFrom:String,sendMessageTitle:String,sendMessagePath:String,sendMessageImg:String,appParameter:String,showMessageCard:Boolean,buttonId:String,scope:String},q=["id","hover-class","hover-start-time","hover-stay-time","open-type","send-message-title","send-message-path","send-message-img","app-parameter","show-message-card","session-from","lang","hover-stop-propagation","scope"],H={class:"wd-button__content"},J={key:0,class:"wd-button__loading"},Q={class:"wd-button__text"},X=e.defineComponent({__name:"index",props:W,emits:["click","getuserinfo","contact","getphonenumber","error","launchapp","opensetting","chooseavatar","agreeprivacyauthorization"],setup(o,{emit:l}){const n=(t="#4D80F0",f=!0)=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 42 42"><defs><linearGradient x1="100%" y1="0%" x2="0%" y2="0%" id="a"><stop stop-color="${f?t:"#fff"}" offset="0%" stop-opacity="0"/><stop stop-color="${f?t:"#fff"}" offset="100%"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><path d="M21 1c11.046 0 20 8.954 20 20s-8.954 20-20 20S1 32.046 1 21 9.954 1 21 1zm0 7C13.82 8 8 13.82 8 21s5.82 13 13 13 13-5.82 13-13S28.18 8 21 8z" fill="${f?"#fff":t}"/><path d="M4.599 21c0 9.044 7.332 16.376 16.376 16.376 9.045 0 16.376-7.332 16.376-16.376" stroke="url(#a)" stroke-width="3.5" stroke-linecap="round"/></g></svg>`,a=o,s=l;console.log("customClass value:",a.customClass);const d=e.ref(20),r=e.ref(70),p=e.ref(""),i=e.computed(()=>`background-image: url(${p.value});`);e.watch(()=>a.loading,()=>{se()},{deep:!0,immediate:!0});const c=j(t=>{!a.disabled&&!a.loading&&s("click",t)},1e3,{leading:!0,trailing:!1});function b(t){a.scope==="phoneNumber"?C(t):a.scope==="userInfo"&&v(t)}function v(t){s("getuserinfo",t.detail)}function A(t){s("contact",t.detail)}function C(t){s("getphonenumber",t.detail)}function x(t){s("error",t.detail)}function ee(t){s("launchapp",t.detail)}function te(t){s("opensetting",t.detail)}function oe(t){s("chooseavatar",t.detail)}function ne(t){s("agreeprivacyauthorization",t.detail)}function se(){const{loadingColor:t,type:f,plain:E}=a;let m=t;if(!m)switch(f){case"primary":m="#4D80F0";break;case"success":m="#34d19d";break;case"info":m="#333";break;case"warning":m="#f0883a";break;case"error":m="#fa4350";break;case"default":m="#333";break}const ae=n(m,!E);p.value=`"data:image/svg+xml;base64,${R(ae)}"`}return(t,f)=>{const E=e.resolveComponent("wd-icon");return e.openBlock(),e.createElementBlock("button",{id:t.buttonId,"hover-class":`${t.disabled||t.loading?"":"wd-button--active"}`,style:e.normalizeStyle(t.customStyle),class:e.normalizeClass(["wd-button",`is-${t.type}`,`is-${t.size}`,{"is-round":t.round,"is-hairline":t.hairline,"is-plain":t.plain,"is-disabled":t.disabled,"is-block":t.block,"is-loading":t.loading},t.customClass]),"hover-start-time":d.value,"hover-stay-time":r.value,"open-type":t.disabled||t.loading?void 0:t.openType,"send-message-title":t.sendMessageTitle,"send-message-path":t.sendMessagePath,"send-message-img":t.sendMessageImg,"app-parameter":t.appParameter,"show-message-card":t.showMessageCard,"session-from":t.sessionFrom,lang:t.lang,"hover-stop-propagation":t.hoverStopPropagation,scope:t.scope,onClick:f[0]||(f[0]=(...m)=>e.unref(c)&&e.unref(c)(...m)),"on:getAuthorize":b,onGetuserinfo:v,onContact:A,onGetphonenumber:C,onError:x,onLaunchapp:ee,onOpensetting:te,onChooseavatar:oe,onAgreeprivacyauthorization:ne},[e.createElementVNode("view",H,[t.loading?(e.openBlock(),e.createElementBlock("view",J,[e.createElementVNode("view",{class:"wd-button__loading-svg",style:e.normalizeStyle(i.value)},null,4)])):t.icon?(e.openBlock(),e.createBlock(E,{key:1,"custom-class":"wd-button__icon",name:t.icon,classPrefix:t.classPrefix},null,8,["name","classPrefix"])):e.createCommentVNode("",!0),e.createElementVNode("view",Q,[e.renderSlot(t.$slots,"default",{},void 0,!0)])])],46,q)}}}),me="",B=h(X,[["__scopeId","data-v-bec91f45"]]),Y=[k,S,w,B],Z={install:o=>{Y.forEach(l=>{o.component(l.name,l)})},CommonButton:k,CommonCollapse:S,CommonEmpty:w,CommonWdButton:B};u.CommonButton=k,u.CommonCollapse=S,u.CommonEmpty=w,u.CommonWdButton=B,u.default=Z,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ @charset "UTF-8";.button-item[data-v-3e8a5cc8]{height:72rpx;line-height:72rpx;text-align:center;background:#f3f5f7;border-radius:8rpx;font-family:PingFangSC-Regular;font-weight:400;font-size:28rpx;color:#5c6278}.button-item.active[data-v-3e8a5cc8]{background:#e8f1ff;color:#5778e7}.common-button[data-v-ee7334b9]{gap:16rpx}.has-padding[data-v-60a05d39]{padding:0 32rpx}.zCard[data-v-60a05d39]{width:100%;margin:0 auto;background:white;z-index:2}.zCard.isOpen .title .icon[data-v-60a05d39]{transform:rotate(0)}.zCard .title[data-v-60a05d39]{color:#2b2d3f;font-size:36rpx;border-bottom:none;font-weight:700;height:104rpx;display:flex;justify-content:space-between;align-items:center}.zCard .title .hr[data-v-60a05d39]{width:8rpx;height:36rpx;background:#5778e7;margin-right:16rpx}.zCard .title .titleCenter[data-v-60a05d39]{text-align:left;flex-grow:1;margin:0 20rpx}.zCard .title .icon[data-v-60a05d39]{transform:rotate(180deg);transition:all .5s}.zCard .content[data-v-60a05d39]{overflow:hidden}.common-empty[data-v-cf5f4d86]{--wot-statustip-fs: 28rpx;--wot-statustip-color: #9198aa;--wot-statustip-padding: 0}.wot-theme-dark .wd-button.is-info[data-v-bec91f45]{background:var(--wot-dark-background4, #323233);color:var(--wot-dark-color3, rgba(232, 230, 227, .8))}.wot-theme-dark .wd-button.is-plain[data-v-bec91f45]{background:transparent}.wot-theme-dark .wd-button.is-plain.is-info[data-v-bec91f45]{color:var(--wot-dark-color, var(--wot-color-white, rgb(255, 255, 255)))}.wot-theme-dark .wd-button.is-plain.is-info[data-v-bec91f45]:after{border-color:var(--wot-dark-background5, #646566)}.wot-theme-dark .wd-button.is-text.is-disabled[data-v-bec91f45]{color:var(--wot-dark-color-gray, var(--wot-color-secondary, #595959));background:transparent}.wot-theme-dark .wd-button.is-icon[data-v-bec91f45]{color:var(--wot-dark-color, var(--wot-color-white, rgb(255, 255, 255)))}.wot-theme-dark .wd-button.is-icon.is-disabled[data-v-bec91f45]{color:var(--wot-dark-color-gray, var(--wot-color-secondary, #595959));background:transparent}.wd-button[data-v-bec91f45]{margin-left:initial;margin-right:initial;position:relative;display:inline-block;-webkit-appearance:none;outline:none;background:transparent;box-sizing:border-box;border:none;border-radius:0;color:var(--wot-button-normal-color, var(--wot-color-title, var(--wot-color-black, rgb(0, 0, 0))));transition:opacity .2s;-webkit-user-select:none;user-select:none;font-weight:400}.wd-button[data-v-bec91f45]:before{position:absolute;top:50%;left:50%;width:100%;height:100%;background:var(--wot-color-black, rgb(0, 0, 0));border:inherit;border-color:var(--wot-color-black, rgb(0, 0, 0));border-radius:inherit;transform:translate(-50%,-50%);opacity:0;content:" "}.wd-button[data-v-bec91f45]:after{border:none;border-radius:0}.wd-button__content[data-v-bec91f45]{display:flex;justify-content:center;align-items:center;height:100%}.wd-button--active[data-v-bec91f45]:active:before{opacity:.15}.wd-button.is-disabled[data-v-bec91f45]{opacity:var(--wot-button-disabled-opacity, .6)}.wd-button__loading[data-v-bec91f45]{margin-right:5px;animation:wd-rotate-bec91f45 .8s linear infinite;animation-duration:2s}.wd-button__loading-svg[data-v-bec91f45]{width:100%;height:100%;background-size:cover;background-repeat:no-repeat}.wd-button.is-primary[data-v-bec91f45]{background:var(--wot-button-primary-bg-color, var(--wot-color-theme, #4d80f0));color:var(--wot-button-primary-color, var(--wot-color-white, rgb(255, 255, 255)))}.wd-button.is-success[data-v-bec91f45]{background:var(--wot-button-success-bg-color, var(--wot-color-success, #34d19d));color:var(--wot-button-success-color, var(--wot-color-white, rgb(255, 255, 255)))}.wd-button.is-info[data-v-bec91f45]{background:var(--wot-button-info-bg-color, #f0f0f0);color:var(--wot-button-info-color, var(--wot-color-title, var(--wot-color-black, rgb(0, 0, 0))))}.wd-button.is-warning[data-v-bec91f45]{background:var(--wot-button-warning-bg-color, var(--wot-color-warning, #f0883a));color:var(--wot-button-warning-color, var(--wot-color-white, rgb(255, 255, 255)))}.wd-button.is-error[data-v-bec91f45]{background:var(--wot-button-error-bg-color, var(--wot-color-danger, #fa4350));color:var(--wot-button-error-color, var(--wot-color-white, rgb(255, 255, 255)))}.wd-button.is-small[data-v-bec91f45]{height:var(--wot-button-small-height, 28px);padding:var(--wot-button-small-padding, 0 12px);border-radius:var(--wot-button-small-radius, 2px);font-size:var(--wot-button-small-fs, var(--wot-fs-secondary, 12px));font-weight:400}.wd-button.is-small .wd-button__loading[data-v-bec91f45]{width:var(--wot-button-small-loading, 14px);height:var(--wot-button-small-loading, 14px)}.wd-button.is-medium[data-v-bec91f45]{height:var(--wot-button-medium-height, 36px);padding:var(--wot-button-medium-padding, 0 16px);border-radius:var(--wot-button-medium-radius, 4px);font-size:var(--wot-button-medium-fs, var(--wot-fs-content, 14px));min-width:120px}.wd-button.is-medium.is-round.is-icon[data-v-bec91f45]{min-width:0;border-radius:50%}.wd-button.is-medium.is-round.is-text[data-v-bec91f45]{border-radius:0;min-width:0}.wd-button.is-medium .wd-button__loading[data-v-bec91f45]{width:var(--wot-button-medium-loading, 18px);height:var(--wot-button-medium-loading, 18px)}.wd-button.is-large[data-v-bec91f45]{height:var(--wot-button-large-height, 44px);padding:var(--wot-button-large-padding, 0 36px);border-radius:var(--wot-button-large-radius, 8px);font-size:var(--wot-button-large-fs, var(--wot-fs-title, 16px))}.wd-button.is-large[data-v-bec91f45]:after{border-radius:var(--wot-button-large-radius, 8px)}.wd-button.is-large .wd-button__loading[data-v-bec91f45]{width:var(--wot-button-large-loading, 24px);height:var(--wot-button-large-loading, 24px)}.wd-button.is-round[data-v-bec91f45]{border-radius:999px}.wd-button.is-text[data-v-bec91f45]{color:var(--wot-button-primary-bg-color, var(--wot-color-theme, #4d80f0));min-width:0;padding:4px 0}.wd-button.is-text[data-v-bec91f45]:after{display:none}.wd-button.is-text.wd-button--active[data-v-bec91f45]{opacity:var(--wot-button-text-hover-opacity, .7)}.wd-button.is-text.wd-button--active[data-v-bec91f45]:active:before{display:none}.wd-button.is-text.is-disabled[data-v-bec91f45]{color:var(--wot-button-normal-disabled-color, rgba(0, 0, 0, .25));background:transparent}.wd-button.is-plain[data-v-bec91f45]{background:var(--wot-button-plain-bg-color, var(--wot-color-white, rgb(255, 255, 255)));border:1px solid currentColor}.wd-button.is-plain.is-primary[data-v-bec91f45]{color:var(--wot-button-primary-bg-color, var(--wot-color-theme, #4d80f0))}.wd-button.is-plain.is-success[data-v-bec91f45]{color:var(--wot-button-success-bg-color, var(--wot-color-success, #34d19d))}.wd-button.is-plain.is-info[data-v-bec91f45]{color:var(--wot-button-info-plain-normal-color, rgba(0, 0, 0, .85));border-color:var(--wot-button-info-plain-border-color, rgba(0, 0, 0, .45))}.wd-button.is-plain.is-warning[data-v-bec91f45]{color:var(--wot-button-warning-bg-color, var(--wot-color-warning, #f0883a))}.wd-button.is-plain.is-error[data-v-bec91f45]{color:var(--wot-button-error-bg-color, var(--wot-color-danger, #fa4350))}.wd-button.is-hairline[data-v-bec91f45]{border-width:0}.wd-button.is-hairline.is-plain[data-v-bec91f45]{position:relative}.wd-button.is-hairline.is-plain[data-v-bec91f45]:after{position:absolute;display:block;content:" ";pointer-events:none;width:200%;height:200%;left:0;top:0;border:1px solid var(--wot-color-border-light, #e8e8e8);transform:scale(.5);box-sizing:border-box;transform-origin:left top}.wd-button.is-hairline.is-plain[data-v-bec91f45]:before{border-radius:inherit}.wd-button.is-hairline.is-plain[data-v-bec91f45]:after{border-color:inherit}.wd-button.is-hairline.is-plain.is-round[data-v-bec91f45]:after{border-radius:inherit!important}.wd-button.is-hairline.is-plain.is-large[data-v-bec91f45]:after{border-radius:calc(2 * var(--wot-button-large-radius, 8px))}.wd-button.is-hairline.is-plain.is-medium[data-v-bec91f45]:after{border-radius:calc(2 * var(--wot-button-medium-radius, 4px))}.wd-button.is-hairline.is-plain.is-small[data-v-bec91f45]:after{border-radius:calc(2 * var(--wot-button-small-radius, 2px))}.wd-button.is-block[data-v-bec91f45]{display:block}.wd-button.is-icon[data-v-bec91f45]{width:var(--wot-button-icon-size, 40px);height:var(--wot-button-icon-size, 40px);padding:0;border-radius:50%;color:var(--wot-button-icon-color, rgba(0, 0, 0, .65))}.wd-button.is-icon[data-v-bec91f45]:after{display:none}.wd-button.is-icon[data-v-bec91f45] .wd-button__icon{margin-right:0}.wd-button.is-icon.is-disabled[data-v-bec91f45]{color:var(--wot-button-icon-disabled-color, var(--wot-color-icon-disabled, #a7a7a7));background:transparent}[data-v-bec91f45] .wd-button__icon{display:block;margin-right:6px;font-size:var(--wot-button-icon-fs, 1.18em);vertical-align:middle}.wd-button__text[data-v-bec91f45]{-webkit-user-select:none;user-select:none;white-space:nowrap}@keyframes wd-rotate-bec91f45{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "focusin-mini-ui",
3
+ "version": "1.0.0",
4
+ "description": "A collection of UniApp components built with Vue3",
5
+ "main": "dist/focusin-mini-ui.umd.js",
6
+ "module": "dist/focusin-mini-ui.es.js",
7
+ "files": [
8
+ "dist",
9
+ "packages"
10
+ ],
11
+ "scripts": {
12
+ "dev": "vite",
13
+ "build": "vite build",
14
+ "prepublishOnly": "npm run build"
15
+ },
16
+ "peerDependencies": {
17
+ "@dcloudio/uni-app": "3.0.0-4020920240930001",
18
+ "unocss": "^0.58.9",
19
+ "unocss-applet": "^0.7.8",
20
+ "wot-design-uni": "^1.7.1",
21
+ "vue": "3.4.21",
22
+ "vue-demi": "^0.14.10",
23
+ "xe-utils": "3.7.4"
24
+ },
25
+ "devDependencies": {
26
+ "vite": "^4.0.0",
27
+ "@vitejs/plugin-vue": "^4.0.0",
28
+ "tailwindcss": "^3.0.0",
29
+ "wot-design-uni": "^1.7.1",
30
+ "postcss": "^8.4.49",
31
+ "postcss-html": "^1.7.0",
32
+ "postcss-scss": "^4.0.9",
33
+ "sass": "1.77.8"
34
+ }
35
+ }
@@ -0,0 +1,20 @@
1
+ import type { InjectionKey } from 'vue'
2
+
3
+ export type IMode = 'single' | 'multiple'
4
+
5
+ export type IOption = {
6
+ value: string | number
7
+ label: string
8
+ }
9
+ export type IOptionItem = IOption & { isActive: boolean }
10
+
11
+ export interface CommonButtonInjection {
12
+ mode: IMode // 单选还是多选
13
+ onClick: (mode: IMode, option: IOptionItem) => void
14
+ }
15
+
16
+ function createInjectionKey<T>(key: string): InjectionKey<T> {
17
+ return key as any
18
+ }
19
+
20
+ export const injectionKey = createInjectionKey<CommonButtonInjection>('common-button')