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.
Files changed (280) hide show
  1. package/dist/ActionBar-Bs5fkyFH.cjs +1 -0
  2. package/dist/ActionBar-CF1zMUMC.js +56 -0
  3. package/dist/ActivityIndicator-BOZRJBDn.cjs +1 -0
  4. package/dist/{RollerSuccess-CVEmS9gU.js → ActivityIndicator-Cp20c1E0.js} +30 -92
  5. package/dist/{Agree-DT46e5q5.cjs → Agree-ZswFiFNy.cjs} +1 -1
  6. package/dist/{Agree-yTGTi4e6.js → Agree-lAcOo38C.js} +2 -3
  7. package/dist/Amount-B2StZGGW.js +56 -0
  8. package/dist/Amount-CU7Oc4vv.cjs +1 -0
  9. package/dist/Bill-DDVs3Lu3.cjs +1 -0
  10. package/dist/Bill-qQ4LdkmR.js +58 -0
  11. package/dist/{Button-Blpwwbnw.cjs → Button-Bu8liJQE.cjs} +1 -1
  12. package/dist/{Button-BIi6CrwM.js → Button-D7e-cuA1.js} +5 -6
  13. package/dist/Captcha-BEF-de8-.cjs +1 -0
  14. package/dist/Captcha-CgpynYTc.js +283 -0
  15. package/dist/Cashier-CJLfQOXm.js +363 -0
  16. package/dist/Cashier-CLJngM0n.cjs +1 -0
  17. package/dist/{CellItem-YZD-BxKt.js → CellItem-BHEh4Cp-.js} +2 -3
  18. package/dist/{CellItem-T78DHako.cjs → CellItem-J0LkwZNL.cjs} +1 -1
  19. package/dist/Chart-BINJAx7V.js +135 -0
  20. package/dist/Chart-DJ0Q1g1P.cjs +1 -0
  21. package/dist/CheckBox-D5bCJUXD.js +55 -0
  22. package/dist/CheckBox-DDeCshDK.cjs +1 -0
  23. package/dist/CheckBoxBase-BIPGJ-TD.js +43 -0
  24. package/dist/CheckBoxBase-CobK6-tL.cjs +1 -0
  25. package/dist/CheckList-BsKo_Fl3.cjs +1 -0
  26. package/dist/{CheckList-Bfy3B-eN.js → CheckList-ViiCo4yi.js} +47 -91
  27. package/dist/{Codebox-D0UtCj11.js → Codebox-BLPrFnIv.js} +4 -5
  28. package/dist/Codebox-yLkdTU7w.cjs +1 -0
  29. package/dist/{DatePicker-B1AVbKhK.cjs → DatePicker-CCU6gqG3.cjs} +1 -1
  30. package/dist/{DatePicker-TAHuve5t.js → DatePicker-CYvPJatt.js} +2 -4
  31. package/dist/DetailItem-D6-zbZmd.js +21 -0
  32. package/dist/DetailItem-DDJXXao0.cjs +1 -0
  33. package/dist/Dialog-208_XUAL.cjs +1 -0
  34. package/dist/Dialog-Bb7Gth3j.js +148 -0
  35. package/dist/DropMenu-5TA_6bas.js +95 -0
  36. package/dist/DropMenu-D_ZMGOOi.cjs +1 -0
  37. package/dist/{Field-CseJzTZz.js → Field-0hdNWFNm.js} +1 -2
  38. package/dist/{FieldItem-Cc7bw5vU.js → FieldItem-D79w330m.js} +2 -3
  39. package/dist/{FieldItem-Dkpx5Kxk.cjs → FieldItem-UFKrl_5J.cjs} +1 -1
  40. package/dist/{Icon-jaEPn7d7.cjs → Icon-83WWqE5z.cjs} +1 -1
  41. package/dist/{Icon-dWGSK6Ou.js → Icon-BgCtu0ZV.js} +3 -5
  42. package/dist/ImageReader-DjshA_hh.cjs +1 -0
  43. package/dist/ImageReader-hUb5CEbV.js +122 -0
  44. package/dist/ImageViewer-BCEK4DOF.cjs +1 -0
  45. package/dist/ImageViewer-_dTRCIsV.js +68 -0
  46. package/dist/InputItem-DO5Yo_IH.cjs +1 -0
  47. package/dist/InputItem-yHsLFvKt.js +327 -0
  48. package/dist/Landscape-BsHyoM4N.cjs +1 -0
  49. package/dist/Landscape-Dd0abEy1.js +73 -0
  50. package/dist/LicensePlate-CTcAIbcb.js +201 -0
  51. package/dist/LicensePlate-CfwpVw0G.cjs +1 -0
  52. package/dist/NoticeBar-CV355FeO.cjs +1 -0
  53. package/dist/NoticeBar-G5aKL6VO.js +92 -0
  54. package/dist/NumberKeyboard-BWpxsbYt.cjs +1 -0
  55. package/dist/{NumberKeyboard-C7TRF5iC.js → NumberKeyboard-B_TJXxki.js} +77 -62
  56. package/dist/Picker-BOEGTBaN.cjs +1 -0
  57. package/dist/{Picker-Dam0LEcc.js → Picker-CA-JQ_OC.js} +168 -151
  58. package/dist/Popup-Ca1jPi0t.cjs +1 -0
  59. package/dist/Popup-qLk-BsRS.js +116 -0
  60. package/dist/{PopupTitleBar-nVurLaOe.js → PopupTitleBar-9P4RUMC1.js} +2 -3
  61. package/dist/{PopupTitleBar-B4vwxKC7.cjs → PopupTitleBar-Bfl49eYJ.cjs} +1 -1
  62. package/dist/Progress-CT-LHaQ0.cjs +1 -0
  63. package/dist/{Progress-CwIC6scr.js → Progress-Clet0W_n.js} +20 -22
  64. package/dist/Radio-B_MxJ65X.cjs +1 -0
  65. package/dist/{Radio-fsc7_N5K.js → Radio-DY-ZX0BP.js} +16 -14
  66. package/dist/{RadioGroup-CMPmk8X_.js → RadioGroup-B00aqM9e.js} +8 -6
  67. package/dist/RadioGroup-B6ukqnm5.cjs +1 -0
  68. package/dist/{RadioList-upQgua8Z.cjs → RadioList-D-9PITpr.cjs} +1 -1
  69. package/dist/{RadioList-CkerkQEY.js → RadioList-DNGsEzgf.js} +6 -8
  70. package/dist/ResultPage-DUs8ok5R.js +64 -0
  71. package/dist/ResultPage-YQWDaFmz.cjs +1 -0
  72. package/dist/{Roller-DFJ7jMV0.js → Roller-BznN57fL.js} +1 -2
  73. package/dist/RollerSuccess-BbMzNlkv.cjs +1 -0
  74. package/dist/RollerSuccess-CTh43Rh0.js +65 -0
  75. package/dist/Ruler-Bhf5J7hU.js +136 -0
  76. package/dist/Ruler-CEzB0oqG.cjs +1 -0
  77. package/dist/ScrollView-BNY62f7B.js +228 -0
  78. package/dist/ScrollView-BnadVBJC.cjs +1 -0
  79. package/dist/ScrollViewMore-BL1vpyMj.cjs +1 -0
  80. package/dist/ScrollViewMore-DBhoiI1X.js +54 -0
  81. package/dist/Selector-DOU8Af55.js +209 -0
  82. package/dist/Selector-DnFvOGbv.cjs +1 -0
  83. package/dist/{Skeleton-BG_j23KI.js → Skeleton-DqA5IxL5.js} +1 -2
  84. package/dist/Slider-BB2Nhpys.js +100 -0
  85. package/dist/Slider-vV7_nULf.cjs +1 -0
  86. package/dist/Stepper-BnDhL8IO.js +137 -0
  87. package/dist/Stepper-n_mc16V2.cjs +1 -0
  88. package/dist/Steps-BPQwab3T.js +157 -0
  89. package/dist/Steps-Dfpmgl8B.cjs +1 -0
  90. package/dist/SwiperItem-BY5cUoGn.cjs +1 -0
  91. package/dist/SwiperItem-BydyBdYU.js +323 -0
  92. package/dist/Switch-B1rsBY-M.js +31 -0
  93. package/dist/Switch-CghubImq.cjs +1 -0
  94. package/dist/TabPane-BCVsdptu.cjs +1 -0
  95. package/dist/TabPane-Q7oUFzmP.js +237 -0
  96. package/dist/TabPicker-BcL9assY.cjs +1 -0
  97. package/dist/TabPicker-BicPrto7.js +173 -0
  98. package/dist/Tag-C7ygxOwU.js +78 -0
  99. package/dist/Tag-CIA2npnD.cjs +1 -0
  100. package/dist/TextareaItem-Dl-PCLl-.js +168 -0
  101. package/dist/TextareaItem-Du5nl7tv.cjs +1 -0
  102. package/dist/{Tip-BFZSiRc1.js → Tip-DHPmevlv.js} +2 -3
  103. package/dist/{Tip-C3brAF9N.cjs → Tip-De_3tKtb.cjs} +1 -1
  104. package/dist/Transition-B-baX512.js +14 -0
  105. package/dist/Transition-Bwbqr4Xr.cjs +1 -0
  106. package/dist/WaterMark-CgkuQjv3.js +103 -0
  107. package/dist/WaterMark-M81jg6T5.cjs +1 -0
  108. package/dist/action-bar.cjs +1 -0
  109. package/dist/action-bar.d.ts +1 -0
  110. package/dist/action-bar.js +1 -0
  111. package/dist/{action-sheet-LJilF3EQ.cjs → action-sheet-BjaReHkr.cjs} +1 -1
  112. package/dist/{action-sheet-DKpi2GLQ.js → action-sheet-Da8dHevy.js} +15 -12
  113. package/dist/action-sheet.cjs +1 -1
  114. package/dist/action-sheet.js +1 -2
  115. package/dist/activity-indicator.cjs +1 -1
  116. package/dist/activity-indicator.js +4 -3
  117. package/dist/agree.cjs +1 -1
  118. package/dist/agree.js +1 -2
  119. package/dist/amount.cjs +1 -1
  120. package/dist/amount.js +1 -2
  121. package/dist/bill.cjs +1 -0
  122. package/dist/bill.d.ts +1 -0
  123. package/dist/bill.js +1 -0
  124. package/dist/button.cjs +1 -1
  125. package/dist/button.js +1 -2
  126. package/dist/captcha.cjs +1 -0
  127. package/dist/captcha.d.ts +1 -0
  128. package/dist/captcha.js +1 -0
  129. package/dist/cashier.cjs +1 -0
  130. package/dist/cashier.d.ts +1 -0
  131. package/dist/cashier.js +1 -0
  132. package/dist/cell-item.cjs +1 -1
  133. package/dist/cell-item.js +1 -2
  134. package/dist/chart.cjs +1 -0
  135. package/dist/chart.d.ts +1 -0
  136. package/dist/chart.js +1 -0
  137. package/dist/check-base.cjs +1 -1
  138. package/dist/check-base.js +1 -2
  139. package/dist/check.cjs +1 -1
  140. package/dist/check.js +3 -2
  141. package/dist/codebox.cjs +1 -1
  142. package/dist/codebox.js +1 -2
  143. package/dist/components/action-sheet/ActionSheet.vue.d.ts +5 -0
  144. package/dist/components/cashier/CashierChannel.vue.d.ts +4 -0
  145. package/dist/components/dialog/Dialog.vue.d.ts +10 -0
  146. package/dist/components/index.d.ts +2 -2
  147. package/dist/components/number-keyboard/KeyboardKey.vue.d.ts +3 -0
  148. package/dist/components/popup/PopupTitleBar.vue.d.ts +4 -0
  149. package/dist/components/swiper/Swiper.vue.d.ts +2 -2
  150. package/dist/cursor-BIPoNm8V.js +11 -0
  151. package/dist/cursor-tQE3LcbU.cjs +1 -0
  152. package/dist/date-picker.cjs +1 -1
  153. package/dist/date-picker.js +1 -2
  154. package/dist/detail-item.cjs +1 -0
  155. package/dist/detail-item.d.ts +1 -0
  156. package/dist/detail-item.js +1 -0
  157. package/dist/dialog-C38EDWGJ.cjs +1 -0
  158. package/dist/dialog-DdNA6YSe.js +91 -0
  159. package/dist/dialog.cjs +1 -1
  160. package/dist/dialog.js +2 -1
  161. package/dist/drop-menu.cjs +1 -0
  162. package/dist/drop-menu.d.ts +1 -0
  163. package/dist/drop-menu.js +1 -0
  164. package/dist/field-item.cjs +1 -1
  165. package/dist/field-item.js +1 -2
  166. package/dist/field.js +1 -2
  167. package/dist/icon.cjs +1 -1
  168. package/dist/icon.js +1 -2
  169. package/dist/image-reader.cjs +1 -0
  170. package/dist/image-reader.d.ts +1 -0
  171. package/dist/image-reader.js +1 -0
  172. package/dist/image-viewer.cjs +1 -0
  173. package/dist/image-viewer.d.ts +1 -0
  174. package/dist/image-viewer.js +1 -0
  175. package/dist/index.cjs +1 -1
  176. package/dist/index.d.ts +2 -1
  177. package/dist/index.js +61 -2669
  178. package/dist/input-item.cjs +1 -1
  179. package/dist/input-item.js +1 -2
  180. package/dist/landscape.cjs +1 -0
  181. package/dist/landscape.d.ts +1 -0
  182. package/dist/landscape.js +1 -0
  183. package/dist/license-plate.cjs +1 -0
  184. package/dist/license-plate.d.ts +1 -0
  185. package/dist/license-plate.js +1 -0
  186. package/dist/notice-bar.cjs +1 -1
  187. package/dist/notice-bar.js +1 -2
  188. package/dist/number-keyboard.cjs +1 -1
  189. package/dist/number-keyboard.js +1 -2
  190. package/dist/picker.cjs +1 -1
  191. package/dist/picker.js +1 -2
  192. package/dist/popup.cjs +1 -1
  193. package/dist/popup.js +2 -2
  194. package/dist/progress.cjs +1 -1
  195. package/dist/progress.js +1 -2
  196. package/dist/radio-list.cjs +1 -1
  197. package/dist/radio-list.js +1 -2
  198. package/dist/radio.cjs +1 -1
  199. package/dist/radio.js +2 -2
  200. package/dist/result-page.cjs +1 -0
  201. package/dist/result-page.d.ts +1 -0
  202. package/dist/result-page.js +1 -0
  203. package/dist/ruler.cjs +1 -0
  204. package/dist/ruler.d.ts +1 -0
  205. package/dist/ruler.js +1 -0
  206. package/dist/scroll-view.cjs +1 -1
  207. package/dist/scroll-view.js +3 -2
  208. package/dist/selector.cjs +1 -0
  209. package/dist/selector.d.ts +1 -0
  210. package/dist/selector.js +1 -0
  211. package/dist/{shared-BtSkmaWC.js → shared-C9XlLe7F.js} +1 -2
  212. package/dist/skeleton.js +1 -2
  213. package/dist/slider.cjs +1 -1
  214. package/dist/slider.js +1 -2
  215. package/dist/stepper.cjs +1 -1
  216. package/dist/stepper.js +1 -2
  217. package/dist/steps.cjs +1 -0
  218. package/dist/steps.d.ts +1 -0
  219. package/dist/steps.js +1 -0
  220. package/dist/swiper.cjs +1 -1
  221. package/dist/swiper.js +1 -2
  222. package/dist/switch.cjs +1 -1
  223. package/dist/switch.js +1 -2
  224. package/dist/tab-picker.cjs +1 -0
  225. package/dist/tab-picker.d.ts +1 -0
  226. package/dist/tab-picker.js +1 -0
  227. package/dist/tabs.cjs +1 -0
  228. package/dist/tabs.d.ts +1 -0
  229. package/dist/tabs.js +1 -0
  230. package/dist/tag.cjs +1 -1
  231. package/dist/tag.js +1 -2
  232. package/dist/textarea-item.cjs +1 -0
  233. package/dist/textarea-item.d.ts +1 -0
  234. package/dist/textarea-item.js +1 -0
  235. package/dist/tip.cjs +1 -1
  236. package/dist/tip.js +1 -2
  237. package/dist/{toast-DX-RoB7Q.js → toast-ByIFvpMs.js} +6 -6
  238. package/dist/toast-C1K2_cOo.cjs +1 -0
  239. package/dist/toast.cjs +1 -1
  240. package/dist/toast.js +1 -2
  241. package/dist/transition.cjs +1 -0
  242. package/dist/transition.d.ts +1 -0
  243. package/dist/transition.js +1 -0
  244. package/dist/water-mark.cjs +1 -0
  245. package/dist/water-mark.d.ts +1 -0
  246. package/dist/water-mark.js +1 -0
  247. package/package.json +105 -4
  248. package/dist/Amount-De-oObat.cjs +0 -1
  249. package/dist/Amount-wOtRYOdx.js +0 -62
  250. package/dist/CheckBoxBase-BDsytL_r.cjs +0 -1
  251. package/dist/CheckBoxBase-BjyVzGqj.js +0 -40
  252. package/dist/CheckList-DEmLmccw.cjs +0 -1
  253. package/dist/Codebox-Cgj7wyzd.cjs +0 -1
  254. package/dist/InputItem-EJ4Y3tpU.cjs +0 -1
  255. package/dist/InputItem-bhFtp97z.js +0 -322
  256. package/dist/NoticeBar-DSf_EjTL.cjs +0 -1
  257. package/dist/NoticeBar-PEYcjXwD.js +0 -84
  258. package/dist/NumberKeyboard-BX0c0l2r.cjs +0 -1
  259. package/dist/Picker-D-TPtSxf.cjs +0 -1
  260. package/dist/Popup-Cm4BuaOo.cjs +0 -1
  261. package/dist/Popup-DPYBBL95.js +0 -116
  262. package/dist/Progress-DukssNvl.cjs +0 -1
  263. package/dist/Radio-ZHivLdvi.cjs +0 -1
  264. package/dist/RadioGroup-BR_jSDR4.cjs +0 -1
  265. package/dist/RollerSuccess--JecJ7bz.cjs +0 -1
  266. package/dist/ScrollViewMore-BWph-i1-.cjs +0 -1
  267. package/dist/ScrollViewMore-BgYJx-TP.js +0 -278
  268. package/dist/Slider-D3wrE8hn.cjs +0 -1
  269. package/dist/Slider-DteN8p-L.js +0 -95
  270. package/dist/Stepper-1EOk4pCY.js +0 -127
  271. package/dist/Stepper-BJr4I6_8.cjs +0 -1
  272. package/dist/SwiperItem-B6TgjCsM.cjs +0 -1
  273. package/dist/SwiperItem-CKd-XKT7.js +0 -337
  274. package/dist/Switch-B6DvVj2p.js +0 -30
  275. package/dist/Switch-BVPjF8CM.cjs +0 -1
  276. package/dist/Tag-CPv77lC8.cjs +0 -1
  277. package/dist/Tag-bs5j40pF.js +0 -66
  278. package/dist/dialog-0-E4Vyc-.cjs +0 -1
  279. package/dist/dialog-DHIZ2SMK.js +0 -227
  280. package/dist/toast-CAeyMc5r.cjs +0 -1
@@ -1 +0,0 @@
1
- let e=require("vue"),t=require("@centui/core");var n={class:`cu-stepper-number`},r=[`type`,`size`,`value`,`readonly`],i=(0,e.defineComponent)({name:`cu-stepper`,__name:`Stepper`,props:{defaultValue:{default:0},modelValue:{default:0},step:{default:1},min:{default:-Number.MAX_VALUE},max:{default:Number.MAX_VALUE},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},isInteger:{type:Boolean,default:!1}},emits:[`update:modelValue`,`change`,`increase`,`decrease`],setup(i,{emit:a}){let o=i,s=a;function c(e){try{return e.toString().split(`.`)[1].length}catch{return 0}}function l(e,t){let n=Number(e),r=Number(t),i=c(e),a=c(t),o=10**Math.max(i,a);return+((n*o+r*o)/o)}function u(e,t){let n=Number(e),r=Number(t),i=c(e),a=c(t),o=10**Math.max(i,a),s=i>=a?i:a;return+((n*o-r*o)/o).toFixed(s)}let d=(0,e.ref)(!1),f=(0,e.ref)(!1),p=(0,e.ref)(!1),m=(0,e.ref)(0),h=(0,e.computed)(()=>{if(!o.modelValue)return 2;let e=o.modelValue.toString().length;return e>2?e:2});(0,e.watch)(()=>o.defaultValue,e=>{m.value=y(e)}),(0,e.watch)(()=>o.modelValue,e=>{p.value||(m.value=y(e))}),(0,e.watch)(()=>o.min,e=>{let t=Number(e);m.value<t&&(m.value=t),b()}),(0,e.watch)(()=>o.max,e=>{let t=Number(e);m.value>t&&(m.value=t),b()}),(0,e.watch)(m,(e,t)=>{b(),e!==o.modelValue&&(s(`update:modelValue`,e),s(`change`,e));let n=e-t;n>0?s(`increase`,n):n<0&&s(`decrease`,Math.abs(n))}),(0,e.onMounted)(()=>{x(),m.value=y(o.modelValue||o.defaultValue),b()});function g(){o.disabled||d.value||(m.value=u(m.value,o.step),w())}function _(){o.disabled||f.value||(m.value=l(m.value,o.step),w())}function v(e){let t=String(e).replace(/[^0-9.-]|^-|^\./g,``);return t===``?0:o.isInteger?Math.floor(Number(t)):+t}function y(e){return Math.max(Math.min(Number(o.max),v(e)),Number(o.min))}function b(){d.value=m.value<=Number(o.min),f.value=m.value>=Number(o.max)}function x(){return Number(o.min)>Number(o.max)&&(0,t.warn)(`[cu-vue-stepper] minNum is larger than maxNum`),Number(o.max)>Number(o.min)}function S(e){let t=e.target,{value:n}=t,r=v(n);+n!==r&&(t.value=String(r)),m.value=r}function C(){p.value=!0}function w(){p.value=!1,m.value=y(m.value)}return(t,a)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`cu-stepper`,{disabled:i.disabled}])},[(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)([`cu-stepper-button cu-stepper-button-reduce`,{disabled:d.value}]),onClick:g},null,2),(0,e.createElementVNode)(`div`,n,[(0,e.createElementVNode)(`input`,{type:i.isInteger?`tel`:`number`,size:h.value,value:m.value,readonly:i.readOnly,onInput:S,onFocus:C,onBlur:w},null,40,r)]),(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)([`cu-stepper-button cu-stepper-button-add`,{disabled:f.value}]),onClick:_},null,2)],2))}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
@@ -1 +0,0 @@
1
- let e=require("vue"),t=require("@centui/core"),n=require("@centui/core/web");var r=.5,i=300,a=(0,e.defineComponent)({name:`cu-swiper`,__name:`Swiper`,props:{autoplay:{default:3e3},transition:{default:`slide`},transitionDuration:{default:250},defaultIndex:{default:0},hasDots:{type:Boolean,default:!0},isPrevent:{type:Boolean,default:!0},isLoop:{type:Boolean,default:!0},dragable:{type:Boolean,default:!0},useNativeDriver:{type:Boolean,default:!0}},emits:[`beforeChange`,`after-change`],setup(a,{expose:o,emit:s}){let c=typeof process<`u`&&process.env.MAND_ENV===`test`,l=a,u=s,d=(0,e.useSlots)(),f=(0,e.ref)(),p=(0,e.ref)(),m=(0,e.ref)(),h=(0,e.ref)(!1),g=(0,e.ref)(!1),_=(0,e.ref)(!1),v=(0,e.ref)(0),y=(0,e.ref)(0),b=(0,e.ref)(0),x=(0,e.ref)(0),S=(0,e.ref)(0),C=(0,e.ref)(0),w=(0,e.ref)(0),T=(0,e.ref)(0),E=(0,e.ref)(0),D=(0,e.ref)(!1),O=(0,e.ref)(!0),k=(0,e.ref)(null),A=(0,e.ref)(!1),j={},M=null,N=null,P=null,F=null,I=[];function ee(e){I.push(e),h.value&&L()}function te(e){let t=I.indexOf(e);t>=0&&I.splice(t,1),h.value&&L()}let L=(0,t.debounce)(()=>{(0,e.nextTick)(()=>{Y(),J(),O.value||$(v.value)})},50);(0,e.provide)(`mdSwiper`,{dimension:()=>E.value,isVertical:()=>z.value,register:ee,unregister:te}),(0,e.watch)(()=>l.autoplay,e=>{v.value=e},{immediate:!0});let ne=(0,e.computed)(()=>y.value===T.value-1),re=(0,e.computed)(()=>y.value===0),ie=(0,e.computed)(()=>Se()),R=(0,e.computed)(()=>l.transition.toLowerCase().includes(`slide`)),z=(0,e.computed)(()=>l.transition===`slideY`),ae=(0,e.computed)(()=>{let t=(d.default?.()??[]).filter(e=>e.type!==Symbol.for(`v-cmt`));return!B.value||t.length<2?null:(0,e.cloneVNode)(t[0],{class:`cu-swiper-item-first-copy`,style:H.value,isCopy:!0})}),oe=(0,e.computed)(()=>{let t=(d.default?.()??[]).filter(e=>e.type!==Symbol.for(`v-cmt`));return!B.value||t.length<2?null:(0,e.cloneVNode)(t[t.length-1],{class:`cu-swiper-item-last-copy`,style:H.value,isCopy:!0})}),B=(0,e.computed)(()=>R.value&&_.value),V=e=>e.vnode;V.props=[`vnode`];let H=(0,e.computed)(()=>z.value?{height:`${E.value}px`}:{width:`${E.value}px`});(0,e.onMounted)(()=>{W()}),(0,e.onActivated)(()=>{W()}),(0,e.onDeactivated)(()=>{G()}),(0,e.onBeforeUnmount)(()=>{G()});function U(){F&&clearTimeout(F);let e=y.value;F=setTimeout(()=>{J(e)},300)}function W(){h.value=!0,(0,e.nextTick)(()=>{J(),$(v.value),window.addEventListener(`resize`,U)})}function G(){h.value=!1,Y(),window.removeEventListener(`resize`,U),F&&clearTimeout(F)}function se(){E.value=z.value?f.value?.clientHeight??0:f.value?.clientWidth??0}function ce(){let e=new n.Scroller((e,t)=>{(0,n.render)(m.value,e,t,1,l.useNativeDriver)},{scrollingY:z.value,scrollingX:!z.value,snapping:!1,bouncing:!1,animationDuration:l.transitionDuration,scrollingComplete:()=>{P&&P()}}),t=p.value;if(!t)return;let r=z.value?t.clientWidth:t.clientWidth*T.value,i=z.value?t.clientHeight*T.value:t.clientHeight;e.setPosition(t.clientLeft,t.clientTop),e.setDimensions(t.clientWidth,t.clientHeight,r,i),k.value=e}function le(){I.length>1&&l.isLoop&&(S.value++,C.value++,y.value++,A.value=!0)}function K(e,n,r=!0){if(!e){(0,t.warn)(`[cu-swiper] no element for translate`);return}let i=z.value?0:-n,a=z.value?-n:0;k.value?.scrollTo(i,a,r)}function q(e=!0,t){let n=I;if(!n||!n.length)return;if(t!==void 0){let r=0,i=x.value,a=T.value;t>0?i>0?r=i-1:i===0&&(r=a-1):i<a-1?r=i+1:i===a-1&&(r=0);let o=n[i]?.$el,s=n[r]?.$el;if(!o||!s)return;o.style.opacity=String(1-Math.abs(t)),o.style.transition=e?`opacity 300ms ease`:``,s.style.opacity=String(Math.abs(t));return}let r=n[b.value]?.$el,i=n[x.value]?.$el;r&&i&&(r.style.opacity=`0`,r.style.transition=e?`opacity 500ms ease`:``,i.style.opacity=`1`,e&&setTimeout(()=>{u(`after-change`,b.value,x.value)},500))}function ue(e,t){w.value=e,T.value=e+(l.isLoop&&R.value&&e>1?2:0),A.value=!1,D.value=e===1||!l.dragable,y.value=t===void 0?l.defaultIndex>=0&&l.defaultIndex<e?parseInt(String(l.defaultIndex)):0:X(t),S.value=0,C.value=e-1,b.value=y.value===S.value?C.value:y.value===C.value?S.value:y.value+1,x.value=y.value}function J(e){let t=I.length;t&&(se(),ue(t,e),R.value?(le(),ce(),K(m.value,-E.value*y.value,!1)):q(!1),_.value=!0)}function de(){v.value>0&&w.value>1&&(Y(),N=setInterval(()=>{if(!l.isLoop&&y.value>=T.value-1)return Y();g.value||ye()},v.value))}function Y(){N&&=(clearInterval(N),null)}function fe(e,t){let n=z.value,{currentLeft:r,currentTop:i,startLeft:a,startTop:o}=j;if(M===null){if(!n&&i===o||n&&r===a)return!1;if(e*e+t*t>=25){let r=Math.atan2(Math.abs(t),Math.abs(e))*180/Math.PI;return n?90-r>45:r>45}return!1}return M}function X(e){return l.isLoop&&R.value&&w.value>0?e-1<0?w.value-1:e-1>w.value-1?0:e-1:e}function pe(e){return e<0?e=0:w.value>0&&e>w.value-1&&(e=w.value-1),l.isLoop&&R.value?e+1:e}function Z(e,t){if(w.value===0||!t&&w.value<2)return;let n=y.value,r=T.value,i=y.value;if(e){if(t&&t.index!==void 0?y.value=t.index:e===`prev`?n>0?y.value=n-1:(!R.value&&n===0||l.isLoop&&n===0)&&(y.value=r-1):e===`next`&&(n<r-1?y.value=n+1:!R.value&&n===r-1?y.value=0:l.isLoop&&n===r-1&&(y.value=1)),l.isLoop&&R.value?(b.value=X(i),x.value=X(y.value)):(b.value=x.value,x.value=y.value),u(`beforeChange`,b.value,x.value),!R.value){q();return}setTimeout(()=>{let e=re.value&&l.isLoop,t=ne.value&&l.isLoop;P=()=>{if(t){let e=z.value?0:S.value*E.value,t=z.value?S.value*E.value:0;k.value?.scrollTo(e,t,!1)}if(e){let e=z.value?0:C.value*E.value,t=z.value?C.value*E.value:0;k.value?.scrollTo(e,t,!1)}u(`after-change`,b.value,x.value),P=null},K(m.value,-E.value*y.value),e?y.value=C.value:t&&(y.value=S.value)},10)}}function me(e){if(D.value)return;Ce();let t=e,n=t.changedTouches?.[0]??t.touches?.[0]??t.targetTouches?.[0]??t;j={},j.startTime=new Date,j.startLeft=n.pageX,j.startTop=n.pageY,j.itemWidth=c?100:f.value?.offsetWidth??0,j.itemHeight=c?100:f.value?.offsetHeight??0}function he(e){if(D.value)return;let t=e,n=t.changedTouches?.[0]??t.touches?.[0]??t.targetTouches?.[0]??t;j.currentLeft=n.pageX,j.currentTop=n.pageY;let r=Number(j.currentLeft)-Number(j.startLeft),i=Number(j.currentTop)-Number(j.startTop);if(M=fe(Math.abs(r),Math.abs(i)),M)return;e.preventDefault();let a=Number(j.itemWidth),o=Number(j.itemHeight),s=Math.min(Math.max(-a+1,r),a-1),c=Math.min(Math.max(-o+1,i),o-1),l=z.value?c-o*y.value:s-a*y.value;R.value?K(m.value,l,!1):q(!1,r/a)}function ge(){if(D.value)return;let e=Number(new Date)-Number(j.startTime),t=Number(j.currentLeft)-Number(j.startLeft),n=Number(j.currentTop)-Number(j.startTop),a=Number(j.itemWidth),o=Number(j.itemHeight),s=y.value,c=T.value,u=e<i,d=null;if(u&&j.currentLeft===void 0){$(v.value);return}z.value?Math.abs(n)>o*r||u?d=n<0?`next`:`prev`:K(m.value,-E.value*s,!0):Math.abs(t)>a*r||u?d=t<0?`next`:`prev`:R.value?K(m.value,-E.value*s,!0):q(!0,0),l.isLoop||(s===0&&d===`prev`||s===c-1&&d===`next`)&&(d=null),Z(d),j={},$(v.value)}function _e(e){P&&P(),l.isPrevent&&e.preventDefault(),g.value=!0,M=null,me(e)}function ve(e){l.isPrevent&&e.preventDefault(),g.value&&he(e)}function Q(e){if(l.isPrevent&&e.preventDefault(),M){$(v.value),g.value=!1,j={};return}g.value&&=(ge(),!1)}function ye(){Z(`next`)}function be(){Z(`prev`)}function xe(e){if(isNaN(e))return;e=parseInt(String(e));let t=pe(e);Z(t>y.value?`next`:`prev`,{index:t}),$(v.value)}function Se(){return X(y.value)}function $(e=3e3){Y(),!(e<500)&&(v.value=e||l.autoplay,de(),O.value=!1)}function Ce(){Y(),O.value=!0}return o({next:ye,prev:be,goto:xe,getIndex:Se,play:$,stop:Ce,index:y,rItemCount:T,oItemCount:w}),(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{ref_key:`root`,ref:f,class:(0,e.normalizeClass)([`cu-swiper`,{"cu-swiper-vertical":z.value,"cu-swiper-fade":!R.value,disabled:!_.value}]),onMousedown:_e,onMousemove:ve,onMouseup:Q,onMouseleave:Q,onTouchstart:_e,onTouchmove:ve,onTouchend:Q,onTouchcancel:Q},[(0,e.createElementVNode)(`div`,{ref_key:`swiperBox`,ref:p,class:`cu-swiper-box`},[(0,e.createElementVNode)(`div`,{ref_key:`swiper`,ref:m,class:`cu-swiper-container`},[B.value&&t.$slots.default?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[oe.value?((0,e.openBlock)(),(0,e.createBlock)(V,{key:0,vnode:oe.value},null,8,[`vnode`])):(0,e.createCommentVNode)(``,!0)],64)):(0,e.createCommentVNode)(``,!0),(0,e.renderSlot)(t.$slots,`default`),B.value&&t.$slots.default?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:1},[ae.value?((0,e.openBlock)(),(0,e.createBlock)(V,{key:0,vnode:ae.value},null,8,[`vnode`])):(0,e.createCommentVNode)(``,!0)],64)):(0,e.createCommentVNode)(``,!0)],512)],512),w.value>1&&a.hasDots?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`cu-swiper-indicators`,{disabled:!a.hasDots}])},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(w.value,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:t,class:(0,e.normalizeClass)([`cu-swiper-indicator`,{"cu-swiper-indicator-active":t-1===ie.value}])},null,2))),128))],2)):(0,e.createCommentVNode)(``,!0)],34))}}),o=(0,e.defineComponent)({name:`cu-swiper-item`,__name:`SwiperItem`,props:{isCopy:{type:Boolean,default:!1}},setup(t){let n=t,r=(0,e.inject)(`mdSwiper`,null),i=(0,e.computed)(()=>!r||r.isVertical()?`auto`:`${r.dimension()}px`),a=(0,e.computed)(()=>!r||!r.isVertical()?`auto`:`${r.dimension()}px`),o=(0,e.getCurrentInstance)()?.proxy;return(0,e.onMounted)(()=>{n.isCopy||r&&o&&r.register(o)}),(0,e.onBeforeUnmount)(()=>{n.isCopy||r&&o&&r.unregister(o)}),(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`cu-swiper-item`,style:(0,e.normalizeStyle)({width:i.value,height:a.value})},[(0,e.renderSlot)(t.$slots,`default`)],4))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
@@ -1,337 +0,0 @@
1
- import { Fragment as e, cloneVNode as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, defineComponent as s, getCurrentInstance as c, inject as l, nextTick as ee, normalizeClass as u, normalizeStyle as d, onActivated as te, onBeforeUnmount as f, onDeactivated as ne, onMounted as p, openBlock as m, provide as re, ref as h, renderList as ie, renderSlot as ae, useSlots as oe, watch as se } from "vue";
2
- import { debounce as ce, warn as le } from "@centui/core";
3
- import { Scroller as ue, render as de } from "@centui/core/web";
4
- //#region src/components/swiper/Swiper.vue?vue&type=script&setup=true&lang.ts
5
- var fe = .5, pe = 300, g = /* @__PURE__ */ s({
6
- name: "cu-swiper",
7
- __name: "Swiper",
8
- props: {
9
- autoplay: { default: 3e3 },
10
- transition: { default: "slide" },
11
- transitionDuration: { default: 250 },
12
- defaultIndex: { default: 0 },
13
- hasDots: {
14
- type: Boolean,
15
- default: !0
16
- },
17
- isPrevent: {
18
- type: Boolean,
19
- default: !0
20
- },
21
- isLoop: {
22
- type: Boolean,
23
- default: !0
24
- },
25
- dragable: {
26
- type: Boolean,
27
- default: !0
28
- },
29
- useNativeDriver: {
30
- type: Boolean,
31
- default: !0
32
- }
33
- },
34
- emits: ["beforeChange", "after-change"],
35
- setup(s, { expose: c, emit: l }) {
36
- let d = typeof process < "u" && process.env.MAND_ENV === "test", g = s, _ = l, me = oe(), v = h(), y = h(), b = h(), x = h(!1), S = h(!1), C = h(!1), w = h(0), T = h(0), E = h(0), D = h(0), O = h(0), k = h(0), A = h(0), j = h(0), M = h(0), N = h(!1), P = h(!0), F = h(null), he = h(!1), I = {}, L = null, R = null, z = null, B = null, V = [];
37
- function ge(e) {
38
- V.push(e), x.value && ve();
39
- }
40
- function _e(e) {
41
- let t = V.indexOf(e);
42
- t >= 0 && V.splice(t, 1), x.value && ve();
43
- }
44
- let ve = ce(() => {
45
- ee(() => {
46
- Y(), J(), P.value || $(w.value);
47
- });
48
- }, 50);
49
- re("mdSwiper", {
50
- dimension: () => M.value,
51
- isVertical: () => U.value,
52
- register: ge,
53
- unregister: _e
54
- }), se(() => g.autoplay, (e) => {
55
- w.value = e;
56
- }, { immediate: !0 });
57
- let ye = n(() => T.value === j.value - 1), be = n(() => T.value === 0), xe = n(() => Ue()), H = n(() => g.transition.toLowerCase().includes("slide")), U = n(() => g.transition === "slideY"), Se = n(() => {
58
- let e = (me.default?.() ?? []).filter((e) => e.type !== Symbol.for("v-cmt"));
59
- return !W.value || e.length < 2 ? null : t(e[0], {
60
- class: "cu-swiper-item-first-copy",
61
- style: we.value,
62
- isCopy: !0
63
- });
64
- }), Ce = n(() => {
65
- let e = (me.default?.() ?? []).filter((e) => e.type !== Symbol.for("v-cmt"));
66
- return !W.value || e.length < 2 ? null : t(e[e.length - 1], {
67
- class: "cu-swiper-item-last-copy",
68
- style: we.value,
69
- isCopy: !0
70
- });
71
- }), W = n(() => H.value && C.value), G = (e) => e.vnode;
72
- G.props = ["vnode"];
73
- let we = n(() => U.value ? { height: `${M.value}px` } : { width: `${M.value}px` });
74
- p(() => {
75
- Ee();
76
- }), te(() => {
77
- Ee();
78
- }), ne(() => {
79
- De();
80
- }), f(() => {
81
- De();
82
- });
83
- function Te() {
84
- B && clearTimeout(B);
85
- let e = T.value;
86
- B = setTimeout(() => {
87
- J(e);
88
- }, 300);
89
- }
90
- function Ee() {
91
- x.value = !0, ee(() => {
92
- J(), $(w.value), window.addEventListener("resize", Te);
93
- });
94
- }
95
- function De() {
96
- x.value = !1, Y(), window.removeEventListener("resize", Te), B && clearTimeout(B);
97
- }
98
- function Oe() {
99
- M.value = U.value ? v.value?.clientHeight ?? 0 : v.value?.clientWidth ?? 0;
100
- }
101
- function ke() {
102
- let e = new ue((e, t) => {
103
- de(b.value, e, t, 1, g.useNativeDriver);
104
- }, {
105
- scrollingY: U.value,
106
- scrollingX: !U.value,
107
- snapping: !1,
108
- bouncing: !1,
109
- animationDuration: g.transitionDuration,
110
- scrollingComplete: () => {
111
- z && z();
112
- }
113
- }), t = y.value;
114
- if (!t) return;
115
- let n = U.value ? t.clientWidth : t.clientWidth * j.value, r = U.value ? t.clientHeight * j.value : t.clientHeight;
116
- e.setPosition(t.clientLeft, t.clientTop), e.setDimensions(t.clientWidth, t.clientHeight, n, r), F.value = e;
117
- }
118
- function Ae() {
119
- V.length > 1 && g.isLoop && (O.value++, k.value++, T.value++, he.value = !0);
120
- }
121
- function K(e, t, n = !0) {
122
- if (!e) {
123
- le("[cu-swiper] no element for translate");
124
- return;
125
- }
126
- let r = U.value ? 0 : -t, i = U.value ? -t : 0;
127
- F.value?.scrollTo(r, i, n);
128
- }
129
- function q(e = !0, t) {
130
- let n = V;
131
- if (!n || !n.length) return;
132
- if (t !== void 0) {
133
- let r = 0, i = D.value, a = j.value;
134
- t > 0 ? i > 0 ? r = i - 1 : i === 0 && (r = a - 1) : i < a - 1 ? r = i + 1 : i === a - 1 && (r = 0);
135
- let o = n[i]?.$el, s = n[r]?.$el;
136
- if (!o || !s) return;
137
- o.style.opacity = String(1 - Math.abs(t)), o.style.transition = e ? "opacity 300ms ease" : "", s.style.opacity = String(Math.abs(t));
138
- return;
139
- }
140
- let r = n[E.value]?.$el, i = n[D.value]?.$el;
141
- r && i && (r.style.opacity = "0", r.style.transition = e ? "opacity 500ms ease" : "", i.style.opacity = "1", e && setTimeout(() => {
142
- _("after-change", E.value, D.value);
143
- }, 500));
144
- }
145
- function je(e, t) {
146
- A.value = e, j.value = e + (g.isLoop && H.value && e > 1 ? 2 : 0), he.value = !1, N.value = e === 1 || !g.dragable, T.value = t === void 0 ? g.defaultIndex >= 0 && g.defaultIndex < e ? parseInt(String(g.defaultIndex)) : 0 : X(t), O.value = 0, k.value = e - 1, E.value = T.value === O.value ? k.value : T.value === k.value ? O.value : T.value + 1, D.value = T.value;
147
- }
148
- function J(e) {
149
- let t = V.length;
150
- t && (Oe(), je(t, e), H.value ? (Ae(), ke(), K(b.value, -M.value * T.value, !1)) : q(!1), C.value = !0);
151
- }
152
- function Me() {
153
- w.value > 0 && A.value > 1 && (Y(), R = setInterval(() => {
154
- if (!g.isLoop && T.value >= j.value - 1) return Y();
155
- S.value || Be();
156
- }, w.value));
157
- }
158
- function Y() {
159
- R &&= (clearInterval(R), null);
160
- }
161
- function Ne(e, t) {
162
- let n = U.value, { currentLeft: r, currentTop: i, startLeft: a, startTop: o } = I;
163
- if (L === null) {
164
- if (!n && i === o || n && r === a) return !1;
165
- if (e * e + t * t >= 25) {
166
- let r = Math.atan2(Math.abs(t), Math.abs(e)) * 180 / Math.PI;
167
- return n ? 90 - r > 45 : r > 45;
168
- }
169
- return !1;
170
- }
171
- return L;
172
- }
173
- function X(e) {
174
- return g.isLoop && H.value && A.value > 0 ? e - 1 < 0 ? A.value - 1 : e - 1 > A.value - 1 ? 0 : e - 1 : e;
175
- }
176
- function Pe(e) {
177
- return e < 0 ? e = 0 : A.value > 0 && e > A.value - 1 && (e = A.value - 1), g.isLoop && H.value ? e + 1 : e;
178
- }
179
- function Z(e, t) {
180
- if (A.value === 0 || !t && A.value < 2) return;
181
- let n = T.value, r = j.value, i = T.value;
182
- if (e) {
183
- if (t && t.index !== void 0 ? T.value = t.index : e === "prev" ? n > 0 ? T.value = n - 1 : (!H.value && n === 0 || g.isLoop && n === 0) && (T.value = r - 1) : e === "next" && (n < r - 1 ? T.value = n + 1 : !H.value && n === r - 1 ? T.value = 0 : g.isLoop && n === r - 1 && (T.value = 1)), g.isLoop && H.value ? (E.value = X(i), D.value = X(T.value)) : (E.value = D.value, D.value = T.value), _("beforeChange", E.value, D.value), !H.value) {
184
- q();
185
- return;
186
- }
187
- setTimeout(() => {
188
- let e = be.value && g.isLoop, t = ye.value && g.isLoop;
189
- z = () => {
190
- if (t) {
191
- let e = U.value ? 0 : O.value * M.value, t = U.value ? O.value * M.value : 0;
192
- F.value?.scrollTo(e, t, !1);
193
- }
194
- if (e) {
195
- let e = U.value ? 0 : k.value * M.value, t = U.value ? k.value * M.value : 0;
196
- F.value?.scrollTo(e, t, !1);
197
- }
198
- _("after-change", E.value, D.value), z = null;
199
- }, K(b.value, -M.value * T.value), e ? T.value = k.value : t && (T.value = O.value);
200
- }, 10);
201
- }
202
- }
203
- function Fe(e) {
204
- if (N.value) return;
205
- We();
206
- let t = e, n = t.changedTouches?.[0] ?? t.touches?.[0] ?? t.targetTouches?.[0] ?? t;
207
- I = {}, I.startTime = /* @__PURE__ */ new Date(), I.startLeft = n.pageX, I.startTop = n.pageY, I.itemWidth = d ? 100 : v.value?.offsetWidth ?? 0, I.itemHeight = d ? 100 : v.value?.offsetHeight ?? 0;
208
- }
209
- function Ie(e) {
210
- if (N.value) return;
211
- let t = e, n = t.changedTouches?.[0] ?? t.touches?.[0] ?? t.targetTouches?.[0] ?? t;
212
- I.currentLeft = n.pageX, I.currentTop = n.pageY;
213
- let r = Number(I.currentLeft) - Number(I.startLeft), i = Number(I.currentTop) - Number(I.startTop);
214
- if (L = Ne(Math.abs(r), Math.abs(i)), L) return;
215
- e.preventDefault();
216
- let a = Number(I.itemWidth), o = Number(I.itemHeight), s = Math.min(Math.max(-a + 1, r), a - 1), c = Math.min(Math.max(-o + 1, i), o - 1), l = U.value ? c - o * T.value : s - a * T.value;
217
- H.value ? K(b.value, l, !1) : q(!1, r / a);
218
- }
219
- function Le() {
220
- if (N.value) return;
221
- let e = Number(/* @__PURE__ */ new Date()) - Number(I.startTime), t = Number(I.currentLeft) - Number(I.startLeft), n = Number(I.currentTop) - Number(I.startTop), r = Number(I.itemWidth), i = Number(I.itemHeight), a = T.value, o = j.value, s = e < pe, c = null;
222
- if (s && I.currentLeft === void 0) {
223
- $(w.value);
224
- return;
225
- }
226
- U.value ? Math.abs(n) > i * fe || s ? c = n < 0 ? "next" : "prev" : K(b.value, -M.value * a, !0) : Math.abs(t) > r * fe || s ? c = t < 0 ? "next" : "prev" : H.value ? K(b.value, -M.value * a, !0) : q(!0, 0), g.isLoop || (a === 0 && c === "prev" || a === o - 1 && c === "next") && (c = null), Z(c), I = {}, $(w.value);
227
- }
228
- function Re(e) {
229
- z && z(), g.isPrevent && e.preventDefault(), S.value = !0, L = null, Fe(e);
230
- }
231
- function ze(e) {
232
- g.isPrevent && e.preventDefault(), S.value && Ie(e);
233
- }
234
- function Q(e) {
235
- if (g.isPrevent && e.preventDefault(), L) {
236
- $(w.value), S.value = !1, I = {};
237
- return;
238
- }
239
- S.value &&= (Le(), !1);
240
- }
241
- function Be() {
242
- Z("next");
243
- }
244
- function Ve() {
245
- Z("prev");
246
- }
247
- function He(e) {
248
- if (isNaN(e)) return;
249
- e = parseInt(String(e));
250
- let t = Pe(e);
251
- Z(t > T.value ? "next" : "prev", { index: t }), $(w.value);
252
- }
253
- function Ue() {
254
- return X(T.value);
255
- }
256
- function $(e = 3e3) {
257
- Y(), !(e < 500) && (w.value = e || g.autoplay, Me(), P.value = !1);
258
- }
259
- function We() {
260
- Y(), P.value = !0;
261
- }
262
- return c({
263
- next: Be,
264
- prev: Ve,
265
- goto: He,
266
- getIndex: Ue,
267
- play: $,
268
- stop: We,
269
- index: T,
270
- rItemCount: j,
271
- oItemCount: A
272
- }), (t, n) => (m(), a("div", {
273
- ref_key: "root",
274
- ref: v,
275
- class: u(["cu-swiper", {
276
- "cu-swiper-vertical": U.value,
277
- "cu-swiper-fade": !H.value,
278
- disabled: !C.value
279
- }]),
280
- onMousedown: Re,
281
- onMousemove: ze,
282
- onMouseup: Q,
283
- onMouseleave: Q,
284
- onTouchstart: Re,
285
- onTouchmove: ze,
286
- onTouchend: Q,
287
- onTouchcancel: Q
288
- }, [o("div", {
289
- ref_key: "swiperBox",
290
- ref: y,
291
- class: "cu-swiper-box"
292
- }, [o("div", {
293
- ref_key: "swiper",
294
- ref: b,
295
- class: "cu-swiper-container"
296
- }, [
297
- W.value && t.$slots.default ? (m(), a(e, { key: 0 }, [Ce.value ? (m(), r(G, {
298
- key: 0,
299
- vnode: Ce.value
300
- }, null, 8, ["vnode"])) : i("", !0)], 64)) : i("", !0),
301
- ae(t.$slots, "default"),
302
- W.value && t.$slots.default ? (m(), a(e, { key: 1 }, [Se.value ? (m(), r(G, {
303
- key: 0,
304
- vnode: Se.value
305
- }, null, 8, ["vnode"])) : i("", !0)], 64)) : i("", !0)
306
- ], 512)], 512), A.value > 1 && s.hasDots ? (m(), a("div", {
307
- key: 0,
308
- class: u(["cu-swiper-indicators", { disabled: !s.hasDots }])
309
- }, [(m(!0), a(e, null, ie(A.value, (e) => (m(), a("div", {
310
- key: e,
311
- class: u(["cu-swiper-indicator", { "cu-swiper-indicator-active": e - 1 === xe.value }])
312
- }, null, 2))), 128))], 2)) : i("", !0)], 34));
313
- }
314
- }), _ = /* @__PURE__ */ s({
315
- name: "cu-swiper-item",
316
- __name: "SwiperItem",
317
- props: { isCopy: {
318
- type: Boolean,
319
- default: !1
320
- } },
321
- setup(e) {
322
- let t = e, r = l("mdSwiper", null), i = n(() => !r || r.isVertical() ? "auto" : `${r.dimension()}px`), o = n(() => !r || !r.isVertical() ? "auto" : `${r.dimension()}px`), s = c()?.proxy;
323
- return p(() => {
324
- t.isCopy || r && s && r.register(s);
325
- }), f(() => {
326
- t.isCopy || r && s && r.unregister(s);
327
- }), (e, t) => (m(), a("div", {
328
- class: "cu-swiper-item",
329
- style: d({
330
- width: i.value,
331
- height: o.value
332
- })
333
- }, [ae(e.$slots, "default")], 4));
334
- }
335
- });
336
- //#endregion
337
- export { g as n, _ as t };
@@ -1,30 +0,0 @@
1
- import { createElementBlock as e, defineComponent as t, normalizeClass as n, openBlock as r } from "vue";
2
- //#endregion
3
- //#region src/components/switch/Switch.vue
4
- var i = /* @__PURE__ */ t({
5
- name: "cu-switch",
6
- __name: "Switch",
7
- props: {
8
- modelValue: {
9
- type: Boolean,
10
- default: !1
11
- },
12
- disabled: {
13
- type: Boolean,
14
- default: !1
15
- }
16
- },
17
- emits: ["update:modelValue", "change"],
18
- setup(t, { emit: i }) {
19
- let a = t, o = i;
20
- function s(e) {
21
- a.disabled || (o("update:modelValue", !a.modelValue), o("change", e));
22
- }
23
- return (i, a) => (r(), e("div", {
24
- class: n(["cu-switch", [t.disabled ? "disabled" : "", t.modelValue ? "active" : ""]]),
25
- onClick: a[0] ||= (e) => s(e)
26
- }, null, 2));
27
- }
28
- });
29
- //#endregion
30
- export { i as t };
@@ -1 +0,0 @@
1
- let e=require("vue");var t=(0,e.defineComponent)({name:`cu-switch`,__name:`Switch`,props:{modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`,`change`],setup(t,{emit:n}){let r=t,i=n;function a(e){r.disabled||(i(`update:modelValue`,!r.modelValue),i(`change`,e))}return(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`cu-switch`,[t.disabled?`disabled`:``,t.modelValue?`active`:``]]),onClick:r[0]||=e=>a(e)},null,2))}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
@@ -1 +0,0 @@
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});return(0,e.onMounted)(async()=>{if(await(0,e.nextTick)(),a.shape===`circle`&&o.value){let e=o.value.offsetHeight/2;s.paddingLeft=e+`px`,s.paddingRight=e+`px`,s.borderRadius=e+`px`,a.sharp&&(s[(0,t.transformCamelCase)(`border-${a.sharp}-radius`)]=`0`)}}),(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}});
@@ -1,66 +0,0 @@
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, openBlock as l, reactive as u, ref as d, renderSlot as f } from "vue";
2
- import { transformCamelCase as p } from "@centui/core";
3
- //#region src/components/tag/Tag.vue?vue&type=script&setup=true&lang.ts
4
- var m = { class: "cu-tag" }, h = { class: "quarter-content" }, g = /* @__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 g = i, _ = d(), v = u({}), y = e(() => [
18
- "default",
19
- `size-${g.size}`,
20
- `shape-${g.shape}`,
21
- `type-${g.type}`,
22
- `font-weight-${g.fontWeight}`
23
- ]), b = e(() => {
24
- let e = {};
25
- return g.type === "fill" && g.fillColor && (e.background = g.fillColor), g.fontColor && (g.type === "ghost" && (e.borderColor = g.fontColor), e.color = g.fontColor), e;
26
- });
27
- return c(async () => {
28
- if (await a(), g.shape === "circle" && _.value) {
29
- let e = _.value.offsetHeight / 2;
30
- v.paddingLeft = e + "px", v.paddingRight = e + "px", v.borderRadius = e + "px", g.sharp && (v[p(`border-${g.sharp}-radius`)] = "0");
31
- }
32
- }), (e, a) => (l(), n("div", m, [i.shape === "quarter" ? (l(), n("div", {
33
- key: 0,
34
- class: o(y.value)
35
- }, [r("div", h, [f(e.$slots, "default")]), r("div", {
36
- class: "quarter-bg",
37
- style: s(b.value)
38
- }, null, 4)], 2)) : i.shape === "coupon" ? (l(), n("div", {
39
- key: 1,
40
- class: o(y.value)
41
- }, [r("div", {
42
- class: "coupon-container",
43
- style: s(b.value)
44
- }, [
45
- i.shape === "coupon" ? (l(), n("div", {
46
- key: 0,
47
- class: "left-coupon",
48
- style: s({ background: i.fillColor ? "radial-gradient(circle at left, transparent 33%, " + i.fillColor + " 33%)" : "" })
49
- }, null, 4)) : t("", !0),
50
- f(e.$slots, "default"),
51
- i.shape === "coupon" ? (l(), n("div", {
52
- key: 1,
53
- class: "right-coupon",
54
- style: s({ background: i.fillColor ? "radial-gradient(circle at right, transparent 33%, " + i.fillColor + " 33%)" : "" })
55
- }, null, 4)) : t("", !0)
56
- ], 4)], 2)) : (l(), n("div", {
57
- key: 2,
58
- ref_key: "el",
59
- ref: _,
60
- class: o(y.value),
61
- style: s([b.value, v])
62
- }, [f(e.$slots, "default")], 6))]));
63
- }
64
- });
65
- //#endregion
66
- export { g as t };
@@ -1 +0,0 @@
1
- const e=require("./Icon-jaEPn7d7.cjs"),t=require("./Roller-DALhjhfg.cjs"),n=require("./Popup-Cm4BuaOo.cjs");let r=require("vue"),i=require("@centui/core");var a={class:`cu-dialog-content`},o={class:`cu-dialog-body`},s={key:1,class:`cu-dialog-icon`},c=[`textContent`],l=[`innerHTML`],u=[`onClick`],d=(0,r.defineComponent)({name:`cu-dialog`,__name:`Dialog`,props:{modelValue:{type:Boolean,default:!1},title:{default:``},icon:{default:``},iconSvg:{type:Boolean,default:!1},closable:{type:Boolean,default:!0},content:{default:``},btns:{default:()=>[]},layout:{default:`row`},appendTo:{type:[null,Boolean],default:void 0},hasMask:{type:Boolean,default:!0},maskClosable:{type:Boolean,default:!1},transition:{default:`cu-fade`},preventScroll:{type:Boolean,default:!1},preventScrollExclude:{default:``}},emits:[`update:modelValue`,`show`,`hide`],setup(i,{expose:d,emit:f}){let p=i,m=f,h=(0,r.ref)(),g=p.appendTo===!1?null:p.appendTo??(typeof document<`u`?document.body:null);(0,r.onMounted)(()=>{g&&g.appendChild(h.value)}),(0,r.onBeforeUnmount)(()=>{g&&h.value&&h.value.parentNode===g&&g.removeChild(h.value)});function _(e){m(`update:modelValue`,e)}function v(){m(`show`)}function y(){m(`hide`)}function b(e){e.disabled||e.loading||(typeof e.handler==`function`?e.handler.call(null,e):x())}function x(){m(`update:modelValue`,!1)}return d({close:x}),(d,f)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{ref_key:`root`,ref:h,class:`cu-dialog`},[(0,r.createVNode)(n.t,{"model-value":i.modelValue,"has-mask":i.hasMask,"mask-closable":i.maskClosable,position:`center`,transition:i.transition,"prevent-scroll":i.preventScroll,"prevent-scroll-exclude":i.preventScrollExclude,"onUpdate:modelValue":_,onShow:v,onHide:y},{default:(0,r.withCtx)(()=>[(0,r.createElementVNode)(`div`,a,[(0,r.renderSlot)(d.$slots,`header`),(0,r.createElementVNode)(`div`,o,[i.closable?((0,r.openBlock)(),(0,r.createElementBlock)(`a`,{key:0,role:`button`,class:`cu-dialog-close`,onClick:x},[(0,r.createVNode)(e.t,{name:`close`})])):(0,r.createCommentVNode)(``,!0),i.icon?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,s,[(0,r.createVNode)(e.t,{name:i.icon,svg:i.iconSvg},null,8,[`name`,`svg`])])):(0,r.createCommentVNode)(``,!0),i.title?((0,r.openBlock)(),(0,r.createElementBlock)(`h2`,{key:2,class:`cu-dialog-title`,textContent:(0,r.toDisplayString)(i.title)},null,8,c)):(0,r.createCommentVNode)(``,!0),(0,r.renderSlot)(d.$slots,`default`,{},()=>[(0,r.createElementVNode)(`div`,{class:`cu-dialog-text`,innerHTML:i.content},null,8,l)])]),(0,r.createElementVNode)(`footer`,{class:(0,r.normalizeClass)([`cu-dialog-actions`,{"is-column":i.layout===`column`}])},[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(i.btns,(n,i)=>((0,r.openBlock)(),(0,r.createElementBlock)(`a`,{key:i,role:`button`,class:(0,r.normalizeClass)([`cu-dialog-btn`,{disabled:!!n.disabled,warning:!n.disabled&&!!n.warning}]),onClick:e=>b(n),onTouchmove:f[0]||=(0,r.withModifiers)(()=>{},[`prevent`])},[n.loading?((0,r.openBlock)(),(0,r.createBlock)(t.t,{key:0,class:`cu-dialog-btn-loading`})):n.icon?((0,r.openBlock)(),(0,r.createBlock)(e.t,{key:1,class:`cu-dialog-btn-icon`,name:n.icon,svg:n.iconSvg,size:`md`},null,8,[`name`,`svg`])):(0,r.createCommentVNode)(``,!0),(0,r.createTextVNode)(` `+(0,r.toDisplayString)(n.text),1)],42,u))),128))],2)])]),_:3},8,[`model-value`,`has-mask`,`mask-closable`,`transition`,`prevent-scroll`,`prevent-scroll-exclude`])],512))}}),f=()=>{},p=[];function m({title:e=``,icon:t=``,iconSvg:n=!0,content:i=``,closable:a=!1,transition:o=`cu-bounce`,btns:s=[],onShow:c=f,onHide:l=f}){let u=document.createElement(`div`);document.body.appendChild(u);let m=!0,h=()=>{let f=(0,r.createVNode)(d,{modelValue:m,title:e,icon:t,iconSvg:n,content:i,closable:a,btns:s,transition:o,preventScroll:!0,"onUpdate:modelValue":e=>{e||g.close()},onShow:c,onHide:()=>{let e=p.indexOf(g);e>=0&&p.splice(e,1),(0,r.render)(null,u),u.remove(),l()}});(0,r.render)(f,u)},g={close:()=>{m&&(m=!1,h())}};return p.push(g),h(),g}var h=d;h.confirm=({title:e=``,icon:t=``,iconSvg:n=!0,content:r=``,cancelText:a=(0,i.t)(`md.dialog.cancel`),cancelWarning:o=!1,confirmText:s=(0,i.t)(`md.dialog.confirm`),confirmWarning:c=!1,closable:l=!1,transition:u,onConfirm:d=f,onCancel:p=f,onShow:h=f,onHide:g=f})=>{let _=m({title:e,icon:t,iconSvg:n,content:r,closable:l,transition:u,onShow:h,onHide:g,btns:[{text:a,warning:o,handler:()=>{p()!==!1&&_.close()}},{text:s,warning:c,handler:()=>{d()!==!1&&_.close()}}]});return _},h.alert=({title:e=``,icon:t=``,iconSvg:n=!0,content:r=``,confirmText:a=(0,i.t)(`md.dialog.confirm`),closable:o=!1,warning:s=!1,transition:c,onConfirm:l=f,onShow:u=f,onHide:d=f})=>{let p=m({title:e,icon:t,iconSvg:n,content:r,closable:o,transition:c,onShow:u,onHide:d,btns:[{text:a,warning:s,handler:()=>{l()!==!1&&p.close()}}]});return p},h.succeed=e=>(e.icon=`success-color`,h.confirm(e)),h.failed=e=>(e.icon=`warn-color`,h.confirm(e)),h.closeAll=()=>{p.forEach(e=>{e.close()})},Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});