centui 3.0.0 → 3.1.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/dist/ActionBar-Bs5fkyFH.cjs +1 -0
- package/dist/ActionBar-CF1zMUMC.js +56 -0
- package/dist/ActivityIndicator-BOZRJBDn.cjs +1 -0
- package/dist/{RollerSuccess-CVEmS9gU.js → ActivityIndicator-Cp20c1E0.js} +30 -92
- package/dist/{Agree-DT46e5q5.cjs → Agree-ZswFiFNy.cjs} +1 -1
- package/dist/{Agree-yTGTi4e6.js → Agree-lAcOo38C.js} +2 -3
- package/dist/Amount-B2StZGGW.js +56 -0
- package/dist/Amount-CU7Oc4vv.cjs +1 -0
- package/dist/Bill-DDVs3Lu3.cjs +1 -0
- package/dist/Bill-qQ4LdkmR.js +58 -0
- package/dist/{Button-Blpwwbnw.cjs → Button-Bu8liJQE.cjs} +1 -1
- package/dist/{Button-BIi6CrwM.js → Button-D7e-cuA1.js} +5 -6
- package/dist/Captcha-BEF-de8-.cjs +1 -0
- package/dist/Captcha-CgpynYTc.js +283 -0
- package/dist/Cashier-CJLfQOXm.js +363 -0
- package/dist/Cashier-CLJngM0n.cjs +1 -0
- package/dist/{CellItem-YZD-BxKt.js → CellItem-BHEh4Cp-.js} +2 -3
- package/dist/{CellItem-T78DHako.cjs → CellItem-J0LkwZNL.cjs} +1 -1
- package/dist/Chart-BINJAx7V.js +135 -0
- package/dist/Chart-DJ0Q1g1P.cjs +1 -0
- package/dist/CheckBox-D5bCJUXD.js +55 -0
- package/dist/CheckBox-DDeCshDK.cjs +1 -0
- package/dist/CheckBoxBase-BIPGJ-TD.js +43 -0
- package/dist/CheckBoxBase-CobK6-tL.cjs +1 -0
- package/dist/CheckList-BsKo_Fl3.cjs +1 -0
- package/dist/{CheckList-Bfy3B-eN.js → CheckList-ViiCo4yi.js} +47 -91
- package/dist/{Codebox-D0UtCj11.js → Codebox-BLPrFnIv.js} +4 -5
- package/dist/Codebox-yLkdTU7w.cjs +1 -0
- package/dist/{DatePicker-B1AVbKhK.cjs → DatePicker-CCU6gqG3.cjs} +1 -1
- package/dist/{DatePicker-TAHuve5t.js → DatePicker-CYvPJatt.js} +2 -4
- package/dist/DetailItem-D6-zbZmd.js +21 -0
- package/dist/DetailItem-DDJXXao0.cjs +1 -0
- package/dist/Dialog-208_XUAL.cjs +1 -0
- package/dist/Dialog-Bb7Gth3j.js +148 -0
- package/dist/DropMenu-5TA_6bas.js +95 -0
- package/dist/DropMenu-D_ZMGOOi.cjs +1 -0
- package/dist/{Field-CseJzTZz.js → Field-0hdNWFNm.js} +1 -2
- package/dist/{FieldItem-Cc7bw5vU.js → FieldItem-D79w330m.js} +2 -3
- package/dist/{FieldItem-Dkpx5Kxk.cjs → FieldItem-UFKrl_5J.cjs} +1 -1
- package/dist/{Icon-jaEPn7d7.cjs → Icon-83WWqE5z.cjs} +1 -1
- package/dist/{Icon-dWGSK6Ou.js → Icon-BgCtu0ZV.js} +3 -5
- package/dist/ImageReader-DjshA_hh.cjs +1 -0
- package/dist/ImageReader-hUb5CEbV.js +122 -0
- package/dist/ImageViewer-BCEK4DOF.cjs +1 -0
- package/dist/ImageViewer-_dTRCIsV.js +68 -0
- package/dist/InputItem-DO5Yo_IH.cjs +1 -0
- package/dist/InputItem-yHsLFvKt.js +327 -0
- package/dist/Landscape-BsHyoM4N.cjs +1 -0
- package/dist/Landscape-Dd0abEy1.js +73 -0
- package/dist/LicensePlate-CTcAIbcb.js +201 -0
- package/dist/LicensePlate-CfwpVw0G.cjs +1 -0
- package/dist/NoticeBar-CV355FeO.cjs +1 -0
- package/dist/NoticeBar-G5aKL6VO.js +92 -0
- package/dist/NumberKeyboard-BWpxsbYt.cjs +1 -0
- package/dist/{NumberKeyboard-C7TRF5iC.js → NumberKeyboard-B_TJXxki.js} +77 -62
- package/dist/Picker-BOEGTBaN.cjs +1 -0
- package/dist/{Picker-Dam0LEcc.js → Picker-CA-JQ_OC.js} +168 -151
- package/dist/Popup-Ca1jPi0t.cjs +1 -0
- package/dist/Popup-qLk-BsRS.js +116 -0
- package/dist/{PopupTitleBar-nVurLaOe.js → PopupTitleBar-9P4RUMC1.js} +2 -3
- package/dist/{PopupTitleBar-B4vwxKC7.cjs → PopupTitleBar-Bfl49eYJ.cjs} +1 -1
- package/dist/Progress-CT-LHaQ0.cjs +1 -0
- package/dist/{Progress-CwIC6scr.js → Progress-Clet0W_n.js} +20 -22
- package/dist/Radio-B_MxJ65X.cjs +1 -0
- package/dist/{Radio-fsc7_N5K.js → Radio-DY-ZX0BP.js} +16 -14
- package/dist/{RadioGroup-CMPmk8X_.js → RadioGroup-B00aqM9e.js} +8 -6
- package/dist/RadioGroup-B6ukqnm5.cjs +1 -0
- package/dist/{RadioList-upQgua8Z.cjs → RadioList-D-9PITpr.cjs} +1 -1
- package/dist/{RadioList-CkerkQEY.js → RadioList-DNGsEzgf.js} +6 -8
- package/dist/ResultPage-DUs8ok5R.js +64 -0
- package/dist/ResultPage-YQWDaFmz.cjs +1 -0
- package/dist/{Roller-DFJ7jMV0.js → Roller-BznN57fL.js} +1 -2
- package/dist/RollerSuccess-BbMzNlkv.cjs +1 -0
- package/dist/RollerSuccess-CTh43Rh0.js +65 -0
- package/dist/Ruler-Bhf5J7hU.js +136 -0
- package/dist/Ruler-CEzB0oqG.cjs +1 -0
- package/dist/ScrollView-BNY62f7B.js +228 -0
- package/dist/ScrollView-BnadVBJC.cjs +1 -0
- package/dist/ScrollViewMore-BL1vpyMj.cjs +1 -0
- package/dist/ScrollViewMore-DBhoiI1X.js +54 -0
- package/dist/Selector-DOU8Af55.js +209 -0
- package/dist/Selector-DnFvOGbv.cjs +1 -0
- package/dist/{Skeleton-BG_j23KI.js → Skeleton-DqA5IxL5.js} +1 -2
- package/dist/Slider-BB2Nhpys.js +100 -0
- package/dist/Slider-vV7_nULf.cjs +1 -0
- package/dist/Stepper-BnDhL8IO.js +137 -0
- package/dist/Stepper-n_mc16V2.cjs +1 -0
- package/dist/Steps-BPQwab3T.js +157 -0
- package/dist/Steps-Dfpmgl8B.cjs +1 -0
- package/dist/SwiperItem-BY5cUoGn.cjs +1 -0
- package/dist/SwiperItem-BydyBdYU.js +323 -0
- package/dist/Switch-B1rsBY-M.js +31 -0
- package/dist/Switch-CghubImq.cjs +1 -0
- package/dist/TabPane-BCVsdptu.cjs +1 -0
- package/dist/TabPane-Q7oUFzmP.js +237 -0
- package/dist/TabPicker-BcL9assY.cjs +1 -0
- package/dist/TabPicker-BicPrto7.js +173 -0
- package/dist/Tag-C7ygxOwU.js +78 -0
- package/dist/Tag-CIA2npnD.cjs +1 -0
- package/dist/TextareaItem-Dl-PCLl-.js +168 -0
- package/dist/TextareaItem-Du5nl7tv.cjs +1 -0
- package/dist/{Tip-BFZSiRc1.js → Tip-DHPmevlv.js} +2 -3
- package/dist/{Tip-C3brAF9N.cjs → Tip-De_3tKtb.cjs} +1 -1
- package/dist/Transition-B-baX512.js +14 -0
- package/dist/Transition-Bwbqr4Xr.cjs +1 -0
- package/dist/WaterMark-CgkuQjv3.js +103 -0
- package/dist/WaterMark-M81jg6T5.cjs +1 -0
- package/dist/action-bar.cjs +1 -0
- package/dist/action-bar.d.ts +1 -0
- package/dist/action-bar.js +1 -0
- package/dist/{action-sheet-LJilF3EQ.cjs → action-sheet-BjaReHkr.cjs} +1 -1
- package/dist/{action-sheet-DKpi2GLQ.js → action-sheet-Da8dHevy.js} +15 -12
- package/dist/action-sheet.cjs +1 -1
- package/dist/action-sheet.js +1 -2
- package/dist/activity-indicator.cjs +1 -1
- package/dist/activity-indicator.js +4 -3
- package/dist/agree.cjs +1 -1
- package/dist/agree.js +1 -2
- package/dist/amount.cjs +1 -1
- package/dist/amount.js +1 -2
- package/dist/bill.cjs +1 -0
- package/dist/bill.d.ts +1 -0
- package/dist/bill.js +1 -0
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -2
- package/dist/captcha.cjs +1 -0
- package/dist/captcha.d.ts +1 -0
- package/dist/captcha.js +1 -0
- package/dist/cashier.cjs +1 -0
- package/dist/cashier.d.ts +1 -0
- package/dist/cashier.js +1 -0
- package/dist/cell-item.cjs +1 -1
- package/dist/cell-item.js +1 -2
- package/dist/chart.cjs +1 -0
- package/dist/chart.d.ts +1 -0
- package/dist/chart.js +1 -0
- package/dist/check-base.cjs +1 -1
- package/dist/check-base.js +1 -2
- package/dist/check.cjs +1 -1
- package/dist/check.js +3 -2
- package/dist/codebox.cjs +1 -1
- package/dist/codebox.js +1 -2
- package/dist/components/action-sheet/ActionSheet.vue.d.ts +5 -0
- package/dist/components/cashier/CashierChannel.vue.d.ts +4 -0
- package/dist/components/dialog/Dialog.vue.d.ts +10 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/components/number-keyboard/KeyboardKey.vue.d.ts +3 -0
- package/dist/components/popup/PopupTitleBar.vue.d.ts +4 -0
- package/dist/components/swiper/Swiper.vue.d.ts +2 -2
- package/dist/cursor-BIPoNm8V.js +11 -0
- package/dist/cursor-tQE3LcbU.cjs +1 -0
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.js +1 -2
- package/dist/detail-item.cjs +1 -0
- package/dist/detail-item.d.ts +1 -0
- package/dist/detail-item.js +1 -0
- package/dist/dialog-C38EDWGJ.cjs +1 -0
- package/dist/dialog-DdNA6YSe.js +91 -0
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +2 -1
- package/dist/drop-menu.cjs +1 -0
- package/dist/drop-menu.d.ts +1 -0
- package/dist/drop-menu.js +1 -0
- package/dist/field-item.cjs +1 -1
- package/dist/field-item.js +1 -2
- package/dist/field.js +1 -2
- package/dist/icon.cjs +1 -1
- package/dist/icon.js +1 -2
- package/dist/image-reader.cjs +1 -0
- package/dist/image-reader.d.ts +1 -0
- package/dist/image-reader.js +1 -0
- package/dist/image-viewer.cjs +1 -0
- package/dist/image-viewer.d.ts +1 -0
- package/dist/image-viewer.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +61 -2669
- package/dist/input-item.cjs +1 -1
- package/dist/input-item.js +1 -2
- package/dist/landscape.cjs +1 -0
- package/dist/landscape.d.ts +1 -0
- package/dist/landscape.js +1 -0
- package/dist/license-plate.cjs +1 -0
- package/dist/license-plate.d.ts +1 -0
- package/dist/license-plate.js +1 -0
- package/dist/notice-bar.cjs +1 -1
- package/dist/notice-bar.js +1 -2
- package/dist/number-keyboard.cjs +1 -1
- package/dist/number-keyboard.js +1 -2
- package/dist/picker.cjs +1 -1
- package/dist/picker.js +1 -2
- package/dist/popup.cjs +1 -1
- package/dist/popup.js +2 -2
- package/dist/progress.cjs +1 -1
- package/dist/progress.js +1 -2
- package/dist/radio-list.cjs +1 -1
- package/dist/radio-list.js +1 -2
- package/dist/radio.cjs +1 -1
- package/dist/radio.js +2 -2
- package/dist/result-page.cjs +1 -0
- package/dist/result-page.d.ts +1 -0
- package/dist/result-page.js +1 -0
- package/dist/ruler.cjs +1 -0
- package/dist/ruler.d.ts +1 -0
- package/dist/ruler.js +1 -0
- package/dist/scroll-view.cjs +1 -1
- package/dist/scroll-view.js +3 -2
- package/dist/selector.cjs +1 -0
- package/dist/selector.d.ts +1 -0
- package/dist/selector.js +1 -0
- package/dist/{shared-BtSkmaWC.js → shared-C9XlLe7F.js} +1 -2
- package/dist/skeleton.js +1 -2
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +1 -2
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.js +1 -2
- package/dist/steps.cjs +1 -0
- package/dist/steps.d.ts +1 -0
- package/dist/steps.js +1 -0
- package/dist/swiper.cjs +1 -1
- package/dist/swiper.js +1 -2
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +1 -2
- package/dist/tab-picker.cjs +1 -0
- package/dist/tab-picker.d.ts +1 -0
- package/dist/tab-picker.js +1 -0
- package/dist/tabs.cjs +1 -0
- package/dist/tabs.d.ts +1 -0
- package/dist/tabs.js +1 -0
- package/dist/tag.cjs +1 -1
- package/dist/tag.js +1 -2
- package/dist/textarea-item.cjs +1 -0
- package/dist/textarea-item.d.ts +1 -0
- package/dist/textarea-item.js +1 -0
- package/dist/tip.cjs +1 -1
- package/dist/tip.js +1 -2
- package/dist/{toast-DX-RoB7Q.js → toast-ByIFvpMs.js} +6 -6
- package/dist/toast-C1K2_cOo.cjs +1 -0
- package/dist/toast.cjs +1 -1
- package/dist/toast.js +1 -2
- package/dist/transition.cjs +1 -0
- package/dist/transition.d.ts +1 -0
- package/dist/transition.js +1 -0
- package/dist/water-mark.cjs +1 -0
- package/dist/water-mark.d.ts +1 -0
- package/dist/water-mark.js +1 -0
- package/package.json +105 -4
- package/dist/Amount-De-oObat.cjs +0 -1
- package/dist/Amount-wOtRYOdx.js +0 -62
- package/dist/CheckBoxBase-BDsytL_r.cjs +0 -1
- package/dist/CheckBoxBase-BjyVzGqj.js +0 -40
- package/dist/CheckList-DEmLmccw.cjs +0 -1
- package/dist/Codebox-Cgj7wyzd.cjs +0 -1
- package/dist/InputItem-EJ4Y3tpU.cjs +0 -1
- package/dist/InputItem-bhFtp97z.js +0 -322
- package/dist/NoticeBar-DSf_EjTL.cjs +0 -1
- package/dist/NoticeBar-PEYcjXwD.js +0 -84
- package/dist/NumberKeyboard-BX0c0l2r.cjs +0 -1
- package/dist/Picker-D-TPtSxf.cjs +0 -1
- package/dist/Popup-Cm4BuaOo.cjs +0 -1
- package/dist/Popup-DPYBBL95.js +0 -116
- package/dist/Progress-DukssNvl.cjs +0 -1
- package/dist/Radio-ZHivLdvi.cjs +0 -1
- package/dist/RadioGroup-BR_jSDR4.cjs +0 -1
- package/dist/RollerSuccess--JecJ7bz.cjs +0 -1
- package/dist/ScrollViewMore-BWph-i1-.cjs +0 -1
- package/dist/ScrollViewMore-BgYJx-TP.js +0 -278
- package/dist/Slider-D3wrE8hn.cjs +0 -1
- package/dist/Slider-DteN8p-L.js +0 -95
- package/dist/Stepper-1EOk4pCY.js +0 -127
- package/dist/Stepper-BJr4I6_8.cjs +0 -1
- package/dist/SwiperItem-B6TgjCsM.cjs +0 -1
- package/dist/SwiperItem-CKd-XKT7.js +0 -337
- package/dist/Switch-B6DvVj2p.js +0 -30
- package/dist/Switch-BVPjF8CM.cjs +0 -1
- package/dist/Tag-CPv77lC8.cjs +0 -1
- package/dist/Tag-bs5j40pF.js +0 -66
- package/dist/dialog-0-E4Vyc-.cjs +0 -1
- package/dist/dialog-DHIZ2SMK.js +0 -227
- package/dist/toast-CAeyMc5r.cjs +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createElementBlock as e, defineComponent as t, normalizeClass as n, openBlock as r } from "vue";
|
|
2
|
+
// src/components/switch/Switch.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var i = ["aria-checked", "aria-disabled"], a = /* @__PURE__ */ t({
|
|
4
|
+
name: "cu-switch",
|
|
5
|
+
__name: "Switch",
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
default: !1
|
|
10
|
+
},
|
|
11
|
+
disabled: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: !1
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
emits: ["update:modelValue", "change"],
|
|
17
|
+
setup(t, { emit: a }) {
|
|
18
|
+
let o = t, s = a;
|
|
19
|
+
function c(e) {
|
|
20
|
+
o.disabled || (s("update:modelValue", !o.modelValue), s("change", e));
|
|
21
|
+
}
|
|
22
|
+
return (a, o) => (r(), e("div", {
|
|
23
|
+
class: n(["cu-switch", [t.disabled ? "disabled" : "", t.modelValue ? "active" : ""]]),
|
|
24
|
+
role: "switch",
|
|
25
|
+
"aria-checked": t.modelValue,
|
|
26
|
+
"aria-disabled": t.disabled,
|
|
27
|
+
onClick: o[0] ||= (e) => c(e)
|
|
28
|
+
}, null, 10, i));
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
export { a as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("vue");var t=[`aria-checked`,`aria-disabled`],n=(0,e.defineComponent)({name:`cu-switch`,__name:`Switch`,props:{modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`,`change`],setup(n,{emit:r}){let i=n,a=r;function o(e){i.disabled||(a(`update:modelValue`,!i.modelValue),a(`change`,e))}return(r,i)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`cu-switch`,[n.disabled?`disabled`:``,n.modelValue?`active`:``]]),role:`switch`,"aria-checked":n.modelValue,"aria-disabled":n.disabled,onClick:i[0]||=e=>o(e)},null,10,t))}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./ScrollView-BnadVBJC.cjs");let t=require("vue");var n={class:`cu-tab-bar`},r={class:`cu-tab-bar-start`},i={class:`cu-tab-bar-end`},a=[`onClick`],o=(0,t.defineComponent)({name:`cu-tab-bar`,__name:`TabBar`,props:{modelValue:{default:``},value:{default:``},items:{default:()=>[]},hasInk:{type:Boolean,default:!0},inkLength:{default:`25`},immediate:{type:Boolean,default:!1}},emits:[`change`,`update:modelValue`,`input`],setup(o,{expose:s,emit:c}){let l=o,u=c,d=(0,t.ref)(``),f=(0,t.ref)(0),p=(0,t.ref)(0),m=(0,t.ref)(0),h=(0,t.ref)(0),g=(0,t.ref)(Date.now()),_=(0,t.ref)(!1),v=(0,t.ref)(!0),y=(0,t.ref)(),b=(0,t.ref)(null),x=[];function S(e,t){e&&(x[t]=e)}let C=(0,t.computed)(()=>p.value>f.value),w=(0,t.computed)(()=>{for(let e=0,t=l.items.length;e<t;e++)if(l.items[e].name===d.value)return e;return-1}),T=(0,t.computed)(()=>{if(w.value)return l.items[w.value]});(0,t.watch)(()=>l.modelValue===``?l.value:l.modelValue,e=>{e!==d.value&&(d.value=e)},{immediate:!0}),(0,t.watch)(m,()=>{(0,t.nextTick)(()=>A())}),(0,t.watch)(()=>l.items,()=>{(0,t.nextTick)(()=>A())}),(0,t.watch)(w,()=>{(0,t.nextTick)(()=>A())}),(0,t.watch)(C,()=>{g.value=Date.now()}),d.value===``&&l.items.length&&(d.value=l.items[0].name,u(`change`,l.items[0],0,0)),(0,t.onMounted)(()=>{O()}),(0,t.onActivated)(()=>{O()}),(0,t.onDeactivated)(()=>{k()}),(0,t.onBeforeUnmount)(()=>{k()});function E({scrollLeft:e}){e>0?_.value=!0:_.value=!1,v.value=!(p.value>0&&e>=p.value-f.value)}function D(e,t){e.disabled||(u(`change`,e,t,w.value),d.value=e.name,u(`update:modelValue`,e.name))}function O(){window.addEventListener(`resize`,A),A(),l.immediate&&(0,t.nextTick)(()=>{let e=l.items[w.value];e&&u(`change`,e,w.value,w.value)})}function k(){window.removeEventListener(`resize`,A)}function A(){if(!x.length)return;let e=y.value?.getBoundingClientRect();f.value=e?.width??0;let n=0;for(let e=0,t=l.items.length;e<t;e++){let t=x[e]?.getBoundingClientRect();n+=t?.width??0}p.value=n,b.value?.reflowScroller(),(0,t.nextTick)(()=>{let e=x[w.value];if(!e)return;m.value=typeof l.inkLength==`string`?Number(l.inkLength):e.offsetWidth*l.inkLength/100,h.value=e.offsetLeft+(e.offsetWidth-m.value)/2;let t=x[w.value-1],n=x[w.value+1];if(!t){b.value?.scrollTo(0,0,!0);return}if(!n){b.value?.scrollTo(p.value,0,!0);return}let r=y.value?.getBoundingClientRect(),i=t.getBoundingClientRect(),a=n.getBoundingClientRect();r&&i.left<r.left?b.value?.scrollTo(t.offsetLeft,0,!0):r&&a.right>r.right&&b.value?.scrollTo(n.offsetLeft+n.offsetWidth-f.value,0,!0)})}return s({reflow:A}),(s,c)=>((0,t.openBlock)(),(0,t.createElementBlock)(`nav`,n,[(0,t.createElementVNode)(`div`,{ref_key:`wrapper`,ref:y,class:`cu-tab-bar-inner`},[C.value?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.withDirectives)((0,t.createElementVNode)(`div`,r,null,512),[[t.vShow,_.value]]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,i,null,512),[[t.vShow,v.value]])],64)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(),(0,t.createBlock)(e.t,{ref_key:`scroller`,ref:b,"scrolling-x":C.value,"scrolling-y":!1,key:g.value,onScroll:E},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`cu-tab-bar-list`,style:(0,t.normalizeStyle)({width:p.value+`px`})},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o.items,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`a`,{key:e.name,ref_for:!0,ref:e=>S(e,n),class:(0,t.normalizeClass)([`cu-tab-bar-item`,{"is-active":d.value===e.name,"is-disabled":!!e.disabled,"more-than-five":o.items.length>5&&n===0}]),onClick:t=>D(e,n)},[(0,t.renderSlot)(s.$slots,`item`,{item:e,items:o.items,index:n,currentName:d.value},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.label),1)])],10,a))),128))],4),o.hasInk?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`cu-tab-bar-ink`,{"is-disabled":T.value&&T.value.disabled}]),style:(0,t.normalizeStyle)({width:m.value+`px`,transform:`translateX(`+h.value+`px)`})},null,6)):(0,t.createCommentVNode)(``,!0)]),_:3},8,[`scrolling-x`]))],512)]))}}),s={class:`cu-tabs`},c={class:`cu-tabs-content`},l=(0,t.defineComponent)({name:`cu-tabs`,__name:`Tabs`,props:{modelValue:{default:void 0},hasInk:{type:Boolean,default:!0},inkLength:{default:25},immediate:{type:Boolean,default:!1}},emits:[`update:modelValue`,`change`],setup(e,{expose:n,emit:r}){let i=e,a=r,l=(0,t.ref)(null),u=(0,t.ref)(i.modelValue),d=(0,t.ref)(0),f=(0,t.ref)([]),p=(0,t.computed)(()=>f.value.map(e=>({name:e.name,label:e.label,disabled:e.disabled}))),m=(0,t.computed)(()=>{for(let e=0,t=p.value.length;e<t;e++)if(p.value[e].name===u.value)return e;return 0});(0,t.provide)(`rootTabs`,{get currentName(){return u.value},get prevIndex(){return d.value},get currentIndex(){return m.value},addPane(e){f.value.indexOf(e)===-1&&f.value.push(e)},removePane(e){let t=f.value.indexOf(e);t>=0&&f.value.splice(t,1)},forceUpdate(){f.value=[...f.value]}}),(0,t.watch)(()=>i.modelValue,e=>{e!==u.value&&(u.value=e)}),(0,t.onMounted)(()=>{!u.value&&p.value.length&&(u.value=p.value[0].name)});function h(e,t,n){u.value=e.name,d.value=n,a(`update:modelValue`,e.name),a(`change`,e)}function g(){l.value?.reflow()}return n({reflowTabBar:g}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,s,[(0,t.createVNode)(o,{ref_key:`tabBar`,ref:l,items:p.value,value:u.value,"has-ink":e.hasInk,"ink-length":e.inkLength,immediate:e.immediate,onChange:h,onInput:r[0]||=e=>u.value=e},null,8,[`items`,`value`,`has-ink`,`ink-length`,`immediate`]),(0,t.createElementVNode)(`div`,c,[(0,t.renderSlot)(n.$slots,`default`)])]))}}),u=[`tab`],d=(0,t.defineComponent)({name:`cu-tab-pane`,__name:`TabPane`,props:{label:{default:void 0},name:{default:void 0},disabled:{type:Boolean,default:!1}},setup(e){let n=e,r=(0,t.getCurrentInstance)()?.proxy,i=(0,t.inject)(`rootTabs`,null),a=(0,t.computed)(()=>i?.currentName===n.name),o=(0,t.computed)(()=>i&&i.prevIndex>i.currentIndex?`cu-tab-slide-right`:`cu-tab-slide-left`);return(0,t.watch)(()=>n.label,()=>i?.forceUpdate?.()),(0,t.watch)(()=>n.disabled,()=>i?.forceUpdate?.()),i&&r&&i.addPane(r),(0,t.onBeforeUnmount)(()=>{i&&r&&i.removePane(r)}),(n,r)=>((0,t.openBlock)(),(0,t.createBlock)(t.Transition,{name:o.value},{default:(0,t.withCtx)(()=>[(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:`cu-tab-pane`,role:`tabpanel`,tab:e.name},[(0,t.renderSlot)(n.$slots,`default`)],8,u),[[t.vShow,a.value]])]),_:3},8,[`name`]))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return d}});
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { t as e } from "./ScrollView-BNY62f7B.js";
|
|
2
|
+
import { Fragment as t, Transition as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, getCurrentInstance as d, inject as f, nextTick as p, normalizeClass as m, normalizeStyle as h, onActivated as g, onBeforeUnmount as _, onDeactivated as v, onMounted as y, openBlock as b, provide as x, ref as S, renderList as C, renderSlot as w, toDisplayString as T, vShow as E, watch as D, withCtx as O, withDirectives as k } from "vue";
|
|
3
|
+
// src/components/tabs/TabBar.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var A = { class: "cu-tab-bar" }, j = { class: "cu-tab-bar-start" }, M = { class: "cu-tab-bar-end" }, N = ["onClick"], P = /* @__PURE__ */ u({
|
|
5
|
+
name: "cu-tab-bar",
|
|
6
|
+
__name: "TabBar",
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: { default: "" },
|
|
9
|
+
value: { default: "" },
|
|
10
|
+
items: { default: () => [] },
|
|
11
|
+
hasInk: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: !0
|
|
14
|
+
},
|
|
15
|
+
inkLength: { default: "25" },
|
|
16
|
+
immediate: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: !1
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
emits: [
|
|
22
|
+
"change",
|
|
23
|
+
"update:modelValue",
|
|
24
|
+
"input"
|
|
25
|
+
],
|
|
26
|
+
setup(n, { expose: l, emit: u }) {
|
|
27
|
+
let d = n, f = u, x = S(""), P = S(0), F = S(0), I = S(0), L = S(0), R = S(Date.now()), z = S(!1), B = S(!0), V = S(), H = S(null), U = [];
|
|
28
|
+
function W(e, t) {
|
|
29
|
+
e && (U[t] = e);
|
|
30
|
+
}
|
|
31
|
+
let G = r(() => F.value > P.value), K = r(() => {
|
|
32
|
+
for (let e = 0, t = d.items.length; e < t; e++) if (d.items[e].name === x.value) return e;
|
|
33
|
+
return -1;
|
|
34
|
+
}), q = r(() => {
|
|
35
|
+
if (K.value) return d.items[K.value];
|
|
36
|
+
});
|
|
37
|
+
D(() => d.modelValue === "" ? d.value : d.modelValue, (e) => {
|
|
38
|
+
e !== x.value && (x.value = e);
|
|
39
|
+
}, { immediate: !0 }), D(I, () => {
|
|
40
|
+
p(() => Q());
|
|
41
|
+
}), D(() => d.items, () => {
|
|
42
|
+
p(() => Q());
|
|
43
|
+
}), D(K, () => {
|
|
44
|
+
p(() => Q());
|
|
45
|
+
}), D(G, () => {
|
|
46
|
+
R.value = Date.now();
|
|
47
|
+
}), x.value === "" && d.items.length && (x.value = d.items[0].name, f("change", d.items[0], 0, 0)), y(() => {
|
|
48
|
+
X();
|
|
49
|
+
}), g(() => {
|
|
50
|
+
X();
|
|
51
|
+
}), v(() => {
|
|
52
|
+
Z();
|
|
53
|
+
}), _(() => {
|
|
54
|
+
Z();
|
|
55
|
+
});
|
|
56
|
+
function J({ scrollLeft: e }) {
|
|
57
|
+
e > 0 ? z.value = !0 : z.value = !1, B.value = !(F.value > 0 && e >= F.value - P.value);
|
|
58
|
+
}
|
|
59
|
+
function Y(e, t) {
|
|
60
|
+
e.disabled || (f("change", e, t, K.value), x.value = e.name, f("update:modelValue", e.name));
|
|
61
|
+
}
|
|
62
|
+
function X() {
|
|
63
|
+
window.addEventListener("resize", Q), Q(), d.immediate && p(() => {
|
|
64
|
+
let e = d.items[K.value];
|
|
65
|
+
e && f("change", e, K.value, K.value);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function Z() {
|
|
69
|
+
window.removeEventListener("resize", Q);
|
|
70
|
+
}
|
|
71
|
+
function Q() {
|
|
72
|
+
if (!U.length) return;
|
|
73
|
+
let e = V.value?.getBoundingClientRect();
|
|
74
|
+
P.value = e?.width ?? 0;
|
|
75
|
+
let t = 0;
|
|
76
|
+
for (let e = 0, n = d.items.length; e < n; e++) {
|
|
77
|
+
let n = U[e]?.getBoundingClientRect();
|
|
78
|
+
t += n?.width ?? 0;
|
|
79
|
+
}
|
|
80
|
+
F.value = t, H.value?.reflowScroller(), p(() => {
|
|
81
|
+
let e = U[K.value];
|
|
82
|
+
if (!e) return;
|
|
83
|
+
I.value = typeof d.inkLength == "string" ? Number(d.inkLength) : e.offsetWidth * d.inkLength / 100, L.value = e.offsetLeft + (e.offsetWidth - I.value) / 2;
|
|
84
|
+
let t = U[K.value - 1], n = U[K.value + 1];
|
|
85
|
+
if (!t) {
|
|
86
|
+
H.value?.scrollTo(0, 0, !0);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (!n) {
|
|
90
|
+
H.value?.scrollTo(F.value, 0, !0);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
let r = V.value?.getBoundingClientRect(), i = t.getBoundingClientRect(), a = n.getBoundingClientRect();
|
|
94
|
+
r && i.left < r.left ? H.value?.scrollTo(t.offsetLeft, 0, !0) : r && a.right > r.right && H.value?.scrollTo(n.offsetLeft + n.offsetWidth - P.value, 0, !0);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return l({ reflow: Q }), (r, l) => (b(), o("nav", A, [s("div", {
|
|
98
|
+
ref_key: "wrapper",
|
|
99
|
+
ref: V,
|
|
100
|
+
class: "cu-tab-bar-inner"
|
|
101
|
+
}, [G.value ? (b(), o(t, { key: 0 }, [k(s("div", j, null, 512), [[E, z.value]]), k(s("div", M, null, 512), [[E, B.value]])], 64)) : a("", !0), (b(), i(e, {
|
|
102
|
+
ref_key: "scroller",
|
|
103
|
+
ref: H,
|
|
104
|
+
"scrolling-x": G.value,
|
|
105
|
+
"scrolling-y": !1,
|
|
106
|
+
key: R.value,
|
|
107
|
+
onScroll: J
|
|
108
|
+
}, {
|
|
109
|
+
default: O(() => [s("div", {
|
|
110
|
+
class: "cu-tab-bar-list",
|
|
111
|
+
style: h({ width: F.value + "px" })
|
|
112
|
+
}, [(b(!0), o(t, null, C(n.items, (e, t) => (b(), o("a", {
|
|
113
|
+
key: e.name,
|
|
114
|
+
ref_for: !0,
|
|
115
|
+
ref: (e) => W(e, t),
|
|
116
|
+
class: m(["cu-tab-bar-item", {
|
|
117
|
+
"is-active": x.value === e.name,
|
|
118
|
+
"is-disabled": !!e.disabled,
|
|
119
|
+
"more-than-five": n.items.length > 5 && t === 0
|
|
120
|
+
}]),
|
|
121
|
+
onClick: (n) => Y(e, t)
|
|
122
|
+
}, [w(r.$slots, "item", {
|
|
123
|
+
item: e,
|
|
124
|
+
items: n.items,
|
|
125
|
+
index: t,
|
|
126
|
+
currentName: x.value
|
|
127
|
+
}, () => [c(T(e.label), 1)])], 10, N))), 128))], 4), n.hasInk ? (b(), o("span", {
|
|
128
|
+
key: 0,
|
|
129
|
+
class: m(["cu-tab-bar-ink", { "is-disabled": q.value && q.value.disabled }]),
|
|
130
|
+
style: h({
|
|
131
|
+
width: I.value + "px",
|
|
132
|
+
transform: "translateX(" + L.value + "px)"
|
|
133
|
+
})
|
|
134
|
+
}, null, 6)) : a("", !0)]),
|
|
135
|
+
_: 3
|
|
136
|
+
}, 8, ["scrolling-x"]))], 512)]));
|
|
137
|
+
}
|
|
138
|
+
}), F = { class: "cu-tabs" }, I = { class: "cu-tabs-content" }, L = /* @__PURE__ */ u({
|
|
139
|
+
name: "cu-tabs",
|
|
140
|
+
__name: "Tabs",
|
|
141
|
+
props: {
|
|
142
|
+
modelValue: { default: void 0 },
|
|
143
|
+
hasInk: {
|
|
144
|
+
type: Boolean,
|
|
145
|
+
default: !0
|
|
146
|
+
},
|
|
147
|
+
inkLength: { default: 25 },
|
|
148
|
+
immediate: {
|
|
149
|
+
type: Boolean,
|
|
150
|
+
default: !1
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
emits: ["update:modelValue", "change"],
|
|
154
|
+
setup(e, { expose: t, emit: n }) {
|
|
155
|
+
let i = e, a = n, c = S(null), u = S(i.modelValue), d = S(0), f = S([]), p = r(() => f.value.map((e) => ({
|
|
156
|
+
name: e.name,
|
|
157
|
+
label: e.label,
|
|
158
|
+
disabled: e.disabled
|
|
159
|
+
}))), m = r(() => {
|
|
160
|
+
for (let e = 0, t = p.value.length; e < t; e++) if (p.value[e].name === u.value) return e;
|
|
161
|
+
return 0;
|
|
162
|
+
});
|
|
163
|
+
x("rootTabs", {
|
|
164
|
+
get currentName() {
|
|
165
|
+
return u.value;
|
|
166
|
+
},
|
|
167
|
+
get prevIndex() {
|
|
168
|
+
return d.value;
|
|
169
|
+
},
|
|
170
|
+
get currentIndex() {
|
|
171
|
+
return m.value;
|
|
172
|
+
},
|
|
173
|
+
addPane(e) {
|
|
174
|
+
f.value.indexOf(e) === -1 && f.value.push(e);
|
|
175
|
+
},
|
|
176
|
+
removePane(e) {
|
|
177
|
+
let t = f.value.indexOf(e);
|
|
178
|
+
t >= 0 && f.value.splice(t, 1);
|
|
179
|
+
},
|
|
180
|
+
forceUpdate() {
|
|
181
|
+
f.value = [...f.value];
|
|
182
|
+
}
|
|
183
|
+
}), D(() => i.modelValue, (e) => {
|
|
184
|
+
e !== u.value && (u.value = e);
|
|
185
|
+
}), y(() => {
|
|
186
|
+
!u.value && p.value.length && (u.value = p.value[0].name);
|
|
187
|
+
});
|
|
188
|
+
function h(e, t, n) {
|
|
189
|
+
u.value = e.name, d.value = n, a("update:modelValue", e.name), a("change", e);
|
|
190
|
+
}
|
|
191
|
+
function g() {
|
|
192
|
+
c.value?.reflow();
|
|
193
|
+
}
|
|
194
|
+
return t({ reflowTabBar: g }), (t, n) => (b(), o("div", F, [l(P, {
|
|
195
|
+
ref_key: "tabBar",
|
|
196
|
+
ref: c,
|
|
197
|
+
items: p.value,
|
|
198
|
+
value: u.value,
|
|
199
|
+
"has-ink": e.hasInk,
|
|
200
|
+
"ink-length": e.inkLength,
|
|
201
|
+
immediate: e.immediate,
|
|
202
|
+
onChange: h,
|
|
203
|
+
onInput: n[0] ||= (e) => u.value = e
|
|
204
|
+
}, null, 8, [
|
|
205
|
+
"items",
|
|
206
|
+
"value",
|
|
207
|
+
"has-ink",
|
|
208
|
+
"ink-length",
|
|
209
|
+
"immediate"
|
|
210
|
+
]), s("div", I, [w(t.$slots, "default")])]));
|
|
211
|
+
}
|
|
212
|
+
}), R = ["tab"], z = /* @__PURE__ */ u({
|
|
213
|
+
name: "cu-tab-pane",
|
|
214
|
+
__name: "TabPane",
|
|
215
|
+
props: {
|
|
216
|
+
label: { default: void 0 },
|
|
217
|
+
name: { default: void 0 },
|
|
218
|
+
disabled: {
|
|
219
|
+
type: Boolean,
|
|
220
|
+
default: !1
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
setup(e) {
|
|
224
|
+
let t = e, a = d()?.proxy, o = f("rootTabs", null), c = r(() => o?.currentName === t.name), l = r(() => o && o.prevIndex > o.currentIndex ? "cu-tab-slide-right" : "cu-tab-slide-left");
|
|
225
|
+
return D(() => t.label, () => o?.forceUpdate?.()), D(() => t.disabled, () => o?.forceUpdate?.()), o && a && o.addPane(a), _(() => {
|
|
226
|
+
o && a && o.removePane(a);
|
|
227
|
+
}), (t, r) => (b(), i(n, { name: l.value }, {
|
|
228
|
+
default: O(() => [k(s("div", {
|
|
229
|
+
class: "cu-tab-pane",
|
|
230
|
+
role: "tabpanel",
|
|
231
|
+
tab: e.name
|
|
232
|
+
}, [w(t.$slots, "default")], 8, R), [[E, c.value]])]),
|
|
233
|
+
_: 3
|
|
234
|
+
}, 8, ["name"]));
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
export { L as n, P as r, z as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./Popup-Ca1jPi0t.cjs"),t=require("./PopupTitleBar-Bfl49eYJ.cjs"),n=require("./Icon-83WWqE5z.cjs"),r=require("./TabPane-BCVsdptu.cjs"),i=require("./ScrollView-BnadVBJC.cjs"),a=require("./RadioList-D-9PITpr.cjs");let o=require("vue"),s=require("@centui/core");var c={class:`cu-tab-picker`},l={class:`cu-tab-picker-content`},u=(0,o.defineComponent)({name:`cu-tab-picker`,__name:`TabPicker`,props:{modelValue:{type:Boolean,default:!1},data:{default:()=>({})},defaultValue:{default:()=>[]},placeholder:{default:()=>String((0,s.t)(`md.tab_picker.choose`))},title:{default:``},describe:{default:``},maskClosable:{type:Boolean,default:!0},largeRadius:{type:Boolean,default:!1}},emits:[`update:modelValue`,`select`,`change`,`show`,`hide`],setup(s,{expose:u,emit:d}){let f=s,p=d,m=(0,o.useSlots)(),h=(0,o.ref)(null),g=(0,o.ref)(null),_=(0,o.ref)(f.defaultValue.slice()),v=(0,o.ref)([]),y=(0,o.ref)(f.data.name??``),b=(0,o.ref)(``),x=(0,o.ref)(Date.now()),S=(0,o.computed)(()=>{let e=m.default;return e?e({option:{}}).some(e=>e.type!==Comment):!1}),C=(0,o.computed)(()=>{let e=[],t=f.data,n=0;for(;t&&t.name;){let r={name:t.name,label:t.label||f.placeholder,value:_.value[n],selected:null,options:t.options??[]},i=!1,a=t.options??[];for(let e=0,o=a.length;e<o;e++)if(a[e].value===_.value[n]){r.label=a[e].label,r.selected=a[e],t=a[e].children,i=!0,n++;break}i||(t=void 0),e.push(r)}return e});(0,o.watch)(C,e=>{let t=e[e.length-1];t&&t.name&&(y.value=t.name)},{immediate:!0});function w(e){p(`update:modelValue`,e)}function T(){h.value?.reflowTabBar(),p(`show`),setTimeout(()=>{v.value=_.value.slice(),b.value=y.value},100)}function E(){p(`update:modelValue`,!1),setTimeout(()=>{_.value=v.value.slice(),y.value=b.value,x.value=Date.now()},100)}function D(e,t){_.value.splice(t,_.value.length-t,e),Promise.resolve().then(()=>{let n=C.value[t+1];p(`select`,{index:t,value:e,option:C.value[t]}),n?(y.value=n.name,g.value?.scrollTo(0,0)):e!==``&&setTimeout(()=>{p(`change`,{values:O(),options:k()}),p(`update:modelValue`,!1)},300)})}function O(){return _.value.slice()}function k(){return C.value.filter(e=>e.value).map(e=>e.selected)}return u({getSelectedValues:O,getSelectedOptions:k}),(u,d)=>((0,o.openBlock)(),(0,o.createElementBlock)(`div`,c,[(0,o.createVNode)(e.t,{"model-value":s.modelValue,position:`bottom`,"mask-closable":s.maskClosable,"onUpdate:modelValue":w,onShow:T,onHide:d[0]||=e=>u.$emit(`hide`),onMaskClick:E},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(t.t,{title:s.title,describe:s.describe,"large-radius":s.largeRadius,"only-close":``,onCancel:E},{cancel:(0,o.withCtx)(()=>[(0,o.createVNode)(n.t,{name:`close`,size:`lg`})]),_:1},8,[`title`,`describe`,`large-radius`]),(0,o.createElementVNode)(`div`,l,[((0,o.openBlock)(),(0,o.createBlock)(r.n,{ref_key:`tabs`,ref:h,"model-value":y.value,key:x.value,"ink-length":100},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(i.t,{ref_key:`scrollView`,ref:g,"scrolling-x":!1,"auto-reflow":``},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(C.value,(e,t)=>((0,o.openBlock)(),(0,o.createBlock)(r.t,{key:e.name,name:e.name,label:e.label},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(a.t,{"model-value":e.value,options:e.options,"is-slot-scope":S.value,icon:``,"icon-inverse":``,"icon-position":`right`,"onUpdate:modelValue":e=>D(e,t)},(0,o.createSlots)({_:2},[S.value?{name:`default`,fn:(0,o.withCtx)(({option:e})=>[(0,o.renderSlot)(u.$slots,`default`,{option:e})]),key:`0`}:void 0]),1032,[`model-value`,`options`,`is-slot-scope`,`onUpdate:modelValue`])]),_:2},1032,[`name`,`label`]))),128))]),_:3},512)]),_:3},8,[`model-value`]))])]),_:3},8,[`model-value`,`mask-closable`])]))}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { t as e } from "./Popup-qLk-BsRS.js";
|
|
2
|
+
import { t } from "./PopupTitleBar-9P4RUMC1.js";
|
|
3
|
+
import { t as n } from "./Icon-BgCtu0ZV.js";
|
|
4
|
+
import { n as r, t as i } from "./TabPane-Q7oUFzmP.js";
|
|
5
|
+
import { t as a } from "./ScrollView-BNY62f7B.js";
|
|
6
|
+
import { t as o } from "./RadioList-DNGsEzgf.js";
|
|
7
|
+
import { Fragment as s, computed as c, createBlock as l, createElementBlock as u, createElementVNode as d, createSlots as f, createVNode as p, defineComponent as m, openBlock as h, ref as g, renderList as _, renderSlot as v, useSlots as y, watch as b, withCtx as x } from "vue";
|
|
8
|
+
import { t as S } from "@centui/core";
|
|
9
|
+
// src/components/tab-picker/TabPicker.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
+
var C = { class: "cu-tab-picker" }, w = { class: "cu-tab-picker-content" }, T = /* @__PURE__ */ m({
|
|
11
|
+
name: "cu-tab-picker",
|
|
12
|
+
__name: "TabPicker",
|
|
13
|
+
props: {
|
|
14
|
+
modelValue: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: !1
|
|
17
|
+
},
|
|
18
|
+
data: { default: () => ({}) },
|
|
19
|
+
defaultValue: { default: () => [] },
|
|
20
|
+
placeholder: { default: () => String(S("md.tab_picker.choose")) },
|
|
21
|
+
title: { default: "" },
|
|
22
|
+
describe: { default: "" },
|
|
23
|
+
maskClosable: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: !0
|
|
26
|
+
},
|
|
27
|
+
largeRadius: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: !1
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
emits: [
|
|
33
|
+
"update:modelValue",
|
|
34
|
+
"select",
|
|
35
|
+
"change",
|
|
36
|
+
"show",
|
|
37
|
+
"hide"
|
|
38
|
+
],
|
|
39
|
+
setup(m, { expose: S, emit: T }) {
|
|
40
|
+
let E = m, D = T, O = y(), k = g(null), A = g(null), j = g(E.defaultValue.slice()), M = g([]), N = g(E.data.name ?? ""), P = g(""), F = g(Date.now()), I = c(() => {
|
|
41
|
+
let e = O.default;
|
|
42
|
+
return e ? e({ option: {} }).some((e) => e.type !== Comment) : !1;
|
|
43
|
+
}), L = c(() => {
|
|
44
|
+
let e = [], t = E.data, n = 0;
|
|
45
|
+
for (; t && t.name;) {
|
|
46
|
+
let r = {
|
|
47
|
+
name: t.name,
|
|
48
|
+
label: t.label || E.placeholder,
|
|
49
|
+
value: j.value[n],
|
|
50
|
+
selected: null,
|
|
51
|
+
options: t.options ?? []
|
|
52
|
+
}, i = !1, a = t.options ?? [];
|
|
53
|
+
for (let e = 0, o = a.length; e < o; e++) if (a[e].value === j.value[n]) {
|
|
54
|
+
r.label = a[e].label, r.selected = a[e], t = a[e].children, i = !0, n++;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
i || (t = void 0), e.push(r);
|
|
58
|
+
}
|
|
59
|
+
return e;
|
|
60
|
+
});
|
|
61
|
+
b(L, (e) => {
|
|
62
|
+
let t = e[e.length - 1];
|
|
63
|
+
t && t.name && (N.value = t.name);
|
|
64
|
+
}, { immediate: !0 });
|
|
65
|
+
function R(e) {
|
|
66
|
+
D("update:modelValue", e);
|
|
67
|
+
}
|
|
68
|
+
function z() {
|
|
69
|
+
k.value?.reflowTabBar(), D("show"), setTimeout(() => {
|
|
70
|
+
M.value = j.value.slice(), P.value = N.value;
|
|
71
|
+
}, 100);
|
|
72
|
+
}
|
|
73
|
+
function B() {
|
|
74
|
+
D("update:modelValue", !1), setTimeout(() => {
|
|
75
|
+
j.value = M.value.slice(), N.value = P.value, F.value = Date.now();
|
|
76
|
+
}, 100);
|
|
77
|
+
}
|
|
78
|
+
function V(e, t) {
|
|
79
|
+
j.value.splice(t, j.value.length - t, e), Promise.resolve().then(() => {
|
|
80
|
+
let n = L.value[t + 1];
|
|
81
|
+
D("select", {
|
|
82
|
+
index: t,
|
|
83
|
+
value: e,
|
|
84
|
+
option: L.value[t]
|
|
85
|
+
}), n ? (N.value = n.name, A.value?.scrollTo(0, 0)) : e !== "" && setTimeout(() => {
|
|
86
|
+
D("change", {
|
|
87
|
+
values: H(),
|
|
88
|
+
options: U()
|
|
89
|
+
}), D("update:modelValue", !1);
|
|
90
|
+
}, 300);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function H() {
|
|
94
|
+
return j.value.slice();
|
|
95
|
+
}
|
|
96
|
+
function U() {
|
|
97
|
+
return L.value.filter((e) => e.value).map((e) => e.selected);
|
|
98
|
+
}
|
|
99
|
+
return S({
|
|
100
|
+
getSelectedValues: H,
|
|
101
|
+
getSelectedOptions: U
|
|
102
|
+
}), (c, g) => (h(), u("div", C, [p(e, {
|
|
103
|
+
"model-value": m.modelValue,
|
|
104
|
+
position: "bottom",
|
|
105
|
+
"mask-closable": m.maskClosable,
|
|
106
|
+
"onUpdate:modelValue": R,
|
|
107
|
+
onShow: z,
|
|
108
|
+
onHide: g[0] ||= (e) => c.$emit("hide"),
|
|
109
|
+
onMaskClick: B
|
|
110
|
+
}, {
|
|
111
|
+
default: x(() => [p(t, {
|
|
112
|
+
title: m.title,
|
|
113
|
+
describe: m.describe,
|
|
114
|
+
"large-radius": m.largeRadius,
|
|
115
|
+
"only-close": "",
|
|
116
|
+
onCancel: B
|
|
117
|
+
}, {
|
|
118
|
+
cancel: x(() => [p(n, {
|
|
119
|
+
name: "close",
|
|
120
|
+
size: "lg"
|
|
121
|
+
})]),
|
|
122
|
+
_: 1
|
|
123
|
+
}, 8, [
|
|
124
|
+
"title",
|
|
125
|
+
"describe",
|
|
126
|
+
"large-radius"
|
|
127
|
+
]), d("div", w, [(h(), l(r, {
|
|
128
|
+
ref_key: "tabs",
|
|
129
|
+
ref: k,
|
|
130
|
+
"model-value": N.value,
|
|
131
|
+
key: F.value,
|
|
132
|
+
"ink-length": 100
|
|
133
|
+
}, {
|
|
134
|
+
default: x(() => [p(a, {
|
|
135
|
+
ref_key: "scrollView",
|
|
136
|
+
ref: A,
|
|
137
|
+
"scrolling-x": !1,
|
|
138
|
+
"auto-reflow": ""
|
|
139
|
+
}, {
|
|
140
|
+
default: x(() => [(h(!0), u(s, null, _(L.value, (e, t) => (h(), l(i, {
|
|
141
|
+
key: e.name,
|
|
142
|
+
name: e.name,
|
|
143
|
+
label: e.label
|
|
144
|
+
}, {
|
|
145
|
+
default: x(() => [p(o, {
|
|
146
|
+
"model-value": e.value,
|
|
147
|
+
options: e.options,
|
|
148
|
+
"is-slot-scope": I.value,
|
|
149
|
+
icon: "",
|
|
150
|
+
"icon-inverse": "",
|
|
151
|
+
"icon-position": "right",
|
|
152
|
+
"onUpdate:modelValue": (e) => V(e, t)
|
|
153
|
+
}, f({ _: 2 }, [I.value ? {
|
|
154
|
+
name: "default",
|
|
155
|
+
fn: x(({ option: e }) => [v(c.$slots, "default", { option: e })]),
|
|
156
|
+
key: "0"
|
|
157
|
+
} : void 0]), 1032, [
|
|
158
|
+
"model-value",
|
|
159
|
+
"options",
|
|
160
|
+
"is-slot-scope",
|
|
161
|
+
"onUpdate:modelValue"
|
|
162
|
+
])]),
|
|
163
|
+
_: 2
|
|
164
|
+
}, 1032, ["name", "label"]))), 128))]),
|
|
165
|
+
_: 3
|
|
166
|
+
}, 512)]),
|
|
167
|
+
_: 3
|
|
168
|
+
}, 8, ["model-value"]))])]),
|
|
169
|
+
_: 3
|
|
170
|
+
}, 8, ["model-value", "mask-closable"])]));
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
export { T as t };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { computed as e, createCommentVNode as t, createElementBlock as n, createElementVNode as r, defineComponent as i, nextTick as a, normalizeClass as o, normalizeStyle as s, onMounted as c, onUpdated as l, openBlock as u, reactive as d, ref as f, renderSlot as p, watch as m } from "vue";
|
|
2
|
+
import { transformCamelCase as h } from "@centui/core";
|
|
3
|
+
// src/components/tag/Tag.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var g = { class: "cu-tag" }, _ = { class: "quarter-content" }, v = /* @__PURE__ */ i({
|
|
5
|
+
name: "cu-tag",
|
|
6
|
+
__name: "Tag",
|
|
7
|
+
props: {
|
|
8
|
+
size: { default: "large" },
|
|
9
|
+
shape: { default: "square" },
|
|
10
|
+
sharp: { default: "" },
|
|
11
|
+
type: { default: "ghost" },
|
|
12
|
+
fillColor: { default: "" },
|
|
13
|
+
fontWeight: { default: "normal" },
|
|
14
|
+
fontColor: { default: "" }
|
|
15
|
+
},
|
|
16
|
+
setup(i) {
|
|
17
|
+
let v = i, y = f(), b = d({}), x = e(() => [
|
|
18
|
+
"default",
|
|
19
|
+
`size-${v.size}`,
|
|
20
|
+
`shape-${v.shape}`,
|
|
21
|
+
`type-${v.type}`,
|
|
22
|
+
`font-weight-${v.fontWeight}`
|
|
23
|
+
]), S = e(() => {
|
|
24
|
+
let e = {};
|
|
25
|
+
return v.type === "fill" && v.fillColor && (e.background = v.fillColor), v.fontColor && (v.type === "ghost" && (e.borderColor = v.fontColor), e.color = v.fontColor), e;
|
|
26
|
+
}), C = -1;
|
|
27
|
+
async function w() {
|
|
28
|
+
if (await a(), v.shape !== "circle" || !y.value) return;
|
|
29
|
+
let e = y.value.offsetHeight;
|
|
30
|
+
if (e === C) return;
|
|
31
|
+
C = e;
|
|
32
|
+
let t = e / 2;
|
|
33
|
+
b.paddingLeft = t + "px", b.paddingRight = t + "px", b.borderRadius = t + "px", v.sharp && (b[h(`border-${v.sharp}-radius`)] = "0");
|
|
34
|
+
}
|
|
35
|
+
return c(() => {
|
|
36
|
+
w();
|
|
37
|
+
}), m(() => [
|
|
38
|
+
v.shape,
|
|
39
|
+
v.sharp,
|
|
40
|
+
v.size
|
|
41
|
+
], () => {
|
|
42
|
+
C = -1, w();
|
|
43
|
+
}), l(() => {
|
|
44
|
+
w();
|
|
45
|
+
}), (e, a) => (u(), n("div", g, [i.shape === "quarter" ? (u(), n("div", {
|
|
46
|
+
key: 0,
|
|
47
|
+
class: o(x.value)
|
|
48
|
+
}, [r("div", _, [p(e.$slots, "default")]), r("div", {
|
|
49
|
+
class: "quarter-bg",
|
|
50
|
+
style: s(S.value)
|
|
51
|
+
}, null, 4)], 2)) : i.shape === "coupon" ? (u(), n("div", {
|
|
52
|
+
key: 1,
|
|
53
|
+
class: o(x.value)
|
|
54
|
+
}, [r("div", {
|
|
55
|
+
class: "coupon-container",
|
|
56
|
+
style: s(S.value)
|
|
57
|
+
}, [
|
|
58
|
+
i.shape === "coupon" ? (u(), n("div", {
|
|
59
|
+
key: 0,
|
|
60
|
+
class: "left-coupon",
|
|
61
|
+
style: s({ background: i.fillColor ? "radial-gradient(circle at left, transparent 33%, " + i.fillColor + " 33%)" : "" })
|
|
62
|
+
}, null, 4)) : t("", !0),
|
|
63
|
+
p(e.$slots, "default"),
|
|
64
|
+
i.shape === "coupon" ? (u(), n("div", {
|
|
65
|
+
key: 1,
|
|
66
|
+
class: "right-coupon",
|
|
67
|
+
style: s({ background: i.fillColor ? "radial-gradient(circle at right, transparent 33%, " + i.fillColor + " 33%)" : "" })
|
|
68
|
+
}, null, 4)) : t("", !0)
|
|
69
|
+
], 4)], 2)) : (u(), n("div", {
|
|
70
|
+
key: 2,
|
|
71
|
+
ref_key: "el",
|
|
72
|
+
ref: y,
|
|
73
|
+
class: o(x.value),
|
|
74
|
+
style: s([S.value, b])
|
|
75
|
+
}, [p(e.$slots, "default")], 6))]));
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
export { v as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("vue"),t=require("@centui/core");var n={class:`cu-tag`},r={class:`quarter-content`},i=(0,e.defineComponent)({name:`cu-tag`,__name:`Tag`,props:{size:{default:`large`},shape:{default:`square`},sharp:{default:``},type:{default:`ghost`},fillColor:{default:``},fontWeight:{default:`normal`},fontColor:{default:``}},setup(i){let a=i,o=(0,e.ref)(),s=(0,e.reactive)({}),c=(0,e.computed)(()=>[`default`,`size-${a.size}`,`shape-${a.shape}`,`type-${a.type}`,`font-weight-${a.fontWeight}`]),l=(0,e.computed)(()=>{let e={};return a.type===`fill`&&a.fillColor&&(e.background=a.fillColor),a.fontColor&&(a.type===`ghost`&&(e.borderColor=a.fontColor),e.color=a.fontColor),e}),u=-1;async function d(){if(await(0,e.nextTick)(),a.shape!==`circle`||!o.value)return;let n=o.value.offsetHeight;if(n===u)return;u=n;let r=n/2;s.paddingLeft=r+`px`,s.paddingRight=r+`px`,s.borderRadius=r+`px`,a.sharp&&(s[(0,t.transformCamelCase)(`border-${a.sharp}-radius`)]=`0`)}return(0,e.onMounted)(()=>{d()}),(0,e.watch)(()=>[a.shape,a.sharp,a.size],()=>{u=-1,d()}),(0,e.onUpdated)(()=>{d()}),(t,a)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,n,[i.shape===`quarter`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)(c.value)},[(0,e.createElementVNode)(`div`,r,[(0,e.renderSlot)(t.$slots,`default`)]),(0,e.createElementVNode)(`div`,{class:`quarter-bg`,style:(0,e.normalizeStyle)(l.value)},null,4)],2)):i.shape===`coupon`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:(0,e.normalizeClass)(c.value)},[(0,e.createElementVNode)(`div`,{class:`coupon-container`,style:(0,e.normalizeStyle)(l.value)},[i.shape===`coupon`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`left-coupon`,style:(0,e.normalizeStyle)({background:i.fillColor?`radial-gradient(circle at left, transparent 33%, `+i.fillColor+` 33%)`:``})},null,4)):(0,e.createCommentVNode)(``,!0),(0,e.renderSlot)(t.$slots,`default`),i.shape===`coupon`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`right-coupon`,style:(0,e.normalizeStyle)({background:i.fillColor?`radial-gradient(circle at right, transparent 33%, `+i.fillColor+` 33%)`:``})},null,4)):(0,e.createCommentVNode)(``,!0)],4)],2)):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:2,ref_key:`el`,ref:o,class:(0,e.normalizeClass)(c.value),style:(0,e.normalizeStyle)([l.value,s])},[(0,e.renderSlot)(t.$slots,`default`)],6))]))}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
|