@element-plus/nightly 0.0.20221211 → 0.0.20221213
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/attributes.json +1 -1
- package/dist/index.css +1 -1
- package/dist/index.full.js +306 -347
- package/dist/index.full.min.js +15 -15
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +12 -12
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +306 -345
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/ckb.js +168 -0
- package/dist/locale/ckb.min.js +2 -0
- package/dist/locale/ckb.min.js.map +1 -0
- package/dist/locale/ckb.min.mjs +2 -0
- package/dist/locale/ckb.min.mjs.map +1 -0
- package/dist/locale/ckb.mjs +160 -0
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mg.js +1 -1
- package/dist/locale/mg.min.js +1 -1
- package/dist/locale/mg.min.mjs +1 -1
- package/dist/locale/mg.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/component.mjs +4 -3
- package/es/component.mjs.map +1 -1
- package/es/components/breadcrumb/index.d.ts +1 -0
- package/es/components/breadcrumb/index.mjs.map +1 -1
- package/es/components/breadcrumb/src/breadcrumb-item.d.ts +0 -2
- package/es/components/breadcrumb/src/breadcrumb-item.mjs.map +1 -1
- package/es/components/breadcrumb/src/breadcrumb.d.ts +0 -2
- package/es/components/breadcrumb/src/breadcrumb.mjs.map +1 -1
- package/es/components/breadcrumb/src/instances.d.ts +4 -0
- package/es/components/breadcrumb/src/instances.mjs +2 -0
- package/es/components/breadcrumb/src/instances.mjs.map +1 -0
- package/es/components/config-provider/src/config-provider.mjs.map +1 -1
- package/es/components/countdown/index.d.ts +134 -0
- package/es/components/countdown/index.mjs +9 -0
- package/es/components/countdown/index.mjs.map +1 -0
- package/es/components/{statistic → countdown}/src/countdown.d.ts +3 -2
- package/es/components/countdown/src/countdown.mjs +29 -0
- package/es/components/countdown/src/countdown.mjs.map +1 -0
- package/es/components/countdown/src/countdown.vue.d.ts +133 -0
- package/es/components/countdown/src/countdown2.mjs +80 -0
- package/es/components/countdown/src/countdown2.mjs.map +1 -0
- package/es/components/countdown/src/utils.d.ts +3 -0
- package/es/components/countdown/src/utils.mjs +32 -0
- package/es/components/countdown/src/utils.mjs.map +1 -0
- package/es/components/countdown/style/css.d.ts +2 -0
- package/es/components/countdown/style/css.mjs +3 -0
- package/es/components/countdown/style/css.mjs.map +1 -0
- package/es/components/countdown/style/index.d.ts +2 -0
- package/es/components/countdown/style/index.mjs +3 -0
- package/es/components/countdown/style/index.mjs.map +1 -0
- package/es/components/date-picker/src/composables/use-range-picker.d.ts +1 -1
- package/es/components/date-picker/src/date-picker-com/basic-date-table.vue.d.ts +4 -4
- package/es/components/date-picker/src/date-picker-com/panel-date-pick.vue.d.ts +7 -7
- package/es/components/date-picker/src/date-picker-com/panel-date-range.vue.d.ts +9 -9
- package/es/components/date-picker/src/date-picker-com/panel-month-range.vue.d.ts +3 -3
- package/es/components/date-picker/src/panel-utils.d.ts +19 -19
- package/es/components/image/index.d.ts +8 -0
- package/es/components/image/src/image.d.ts +1 -0
- package/es/components/image/src/image.mjs +4 -0
- package/es/components/image/src/image.mjs.map +1 -1
- package/es/components/image/src/image.vue.d.ts +8 -0
- package/es/components/image/src/image2.mjs +2 -1
- package/es/components/image/src/image2.mjs.map +1 -1
- package/es/components/image-viewer/index.d.ts +4 -0
- package/es/components/image-viewer/src/image-viewer.d.ts +1 -0
- package/es/components/image-viewer/src/image-viewer.mjs +4 -0
- package/es/components/image-viewer/src/image-viewer.mjs.map +1 -1
- package/es/components/image-viewer/src/image-viewer.vue.d.ts +4 -0
- package/es/components/image-viewer/src/image-viewer2.mjs +3 -3
- package/es/components/image-viewer/src/image-viewer2.mjs.map +1 -1
- package/es/components/index.d.ts +2 -1
- package/es/components/index.mjs +4 -3
- package/es/components/index.mjs.map +1 -1
- package/es/components/statistic/index.d.ts +10 -103
- package/es/components/statistic/index.mjs +2 -5
- package/es/components/statistic/index.mjs.map +1 -1
- package/es/components/statistic/src/statistic.d.ts +5 -9
- package/es/components/statistic/src/statistic.mjs +3 -9
- package/es/components/statistic/src/statistic.mjs.map +1 -1
- package/es/components/statistic/src/statistic.vue.d.ts +9 -25
- package/es/components/statistic/src/statistic2.mjs +11 -17
- package/es/components/statistic/src/statistic2.mjs.map +1 -1
- package/es/components/time-picker/src/composables/use-time-picker.d.ts +2 -2
- package/es/components/time-picker/src/time-picker-com/panel-time-pick.vue.d.ts +2 -2
- package/es/components/time-picker/src/time-picker-com/panel-time-range.vue.d.ts +2 -2
- package/es/components/time-select/index.d.ts +2 -2
- package/es/components/time-select/src/time-select.vue.d.ts +1 -1
- package/es/components/transfer/index.d.ts +0 -10
- package/es/components/transfer/src/transfer-panel.d.ts +0 -1
- package/es/components/transfer/src/transfer-panel.mjs.map +1 -1
- package/es/components/transfer/src/transfer-panel.vue.d.ts +0 -2
- package/es/components/transfer/src/transfer-panel2.mjs +3 -6
- package/es/components/transfer/src/transfer-panel2.mjs.map +1 -1
- package/es/components/transfer/src/transfer.vue.d.ts +0 -10
- package/es/index.mjs +4 -3
- package/es/index.mjs.map +1 -1
- package/es/locale/lang/ckb.d.ts +157 -0
- package/es/locale/lang/ckb.mjs +159 -0
- package/es/locale/lang/ckb.mjs.map +1 -0
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/component.js +166 -165
- package/lib/component.js.map +1 -1
- package/lib/components/breadcrumb/index.d.ts +1 -0
- package/lib/components/breadcrumb/index.js.map +1 -1
- package/lib/components/breadcrumb/src/breadcrumb-item.d.ts +0 -2
- package/lib/components/breadcrumb/src/breadcrumb-item.js.map +1 -1
- package/lib/components/breadcrumb/src/breadcrumb.d.ts +0 -2
- package/lib/components/breadcrumb/src/breadcrumb.js.map +1 -1
- package/lib/components/breadcrumb/src/instances.d.ts +4 -0
- package/lib/components/breadcrumb/src/instances.js +3 -0
- package/lib/components/breadcrumb/src/instances.js.map +1 -0
- package/lib/components/config-provider/src/config-provider.js.map +1 -1
- package/lib/components/countdown/index.d.ts +134 -0
- package/lib/components/countdown/index.js +16 -0
- package/lib/components/countdown/index.js.map +1 -0
- package/lib/components/{statistic → countdown}/src/countdown.d.ts +3 -2
- package/lib/components/countdown/src/countdown.js +34 -0
- package/lib/components/countdown/src/countdown.js.map +1 -0
- package/lib/components/countdown/src/countdown.vue.d.ts +133 -0
- package/lib/components/countdown/src/countdown2.js +84 -0
- package/lib/components/countdown/src/countdown2.js.map +1 -0
- package/lib/components/countdown/src/utils.d.ts +3 -0
- package/lib/components/countdown/src/utils.js +37 -0
- package/lib/components/countdown/src/utils.js.map +1 -0
- package/lib/components/countdown/style/css.d.ts +2 -0
- package/lib/components/countdown/style/css.js +6 -0
- package/lib/components/countdown/style/css.js.map +1 -0
- package/lib/components/countdown/style/index.d.ts +2 -0
- package/lib/components/countdown/style/index.js +6 -0
- package/lib/components/countdown/style/index.js.map +1 -0
- package/lib/components/date-picker/src/composables/use-range-picker.d.ts +1 -1
- package/lib/components/date-picker/src/date-picker-com/basic-date-table.vue.d.ts +4 -4
- package/lib/components/date-picker/src/date-picker-com/panel-date-pick.vue.d.ts +7 -7
- package/lib/components/date-picker/src/date-picker-com/panel-date-range.vue.d.ts +9 -9
- package/lib/components/date-picker/src/date-picker-com/panel-month-range.vue.d.ts +3 -3
- package/lib/components/date-picker/src/panel-utils.d.ts +19 -19
- package/lib/components/image/index.d.ts +8 -0
- package/lib/components/image/src/image.d.ts +1 -0
- package/lib/components/image/src/image.js +4 -0
- package/lib/components/image/src/image.js.map +1 -1
- package/lib/components/image/src/image.vue.d.ts +8 -0
- package/lib/components/image/src/image2.js +2 -1
- package/lib/components/image/src/image2.js.map +1 -1
- package/lib/components/image-viewer/index.d.ts +4 -0
- package/lib/components/image-viewer/src/image-viewer.d.ts +1 -0
- package/lib/components/image-viewer/src/image-viewer.js +4 -0
- package/lib/components/image-viewer/src/image-viewer.js.map +1 -1
- package/lib/components/image-viewer/src/image-viewer.vue.d.ts +4 -0
- package/lib/components/image-viewer/src/image-viewer2.js +3 -3
- package/lib/components/image-viewer/src/image-viewer2.js.map +1 -1
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.js +131 -132
- package/lib/components/index.js.map +1 -1
- package/lib/components/statistic/index.d.ts +10 -103
- package/lib/components/statistic/index.js +0 -8
- package/lib/components/statistic/index.js.map +1 -1
- package/lib/components/statistic/src/statistic.d.ts +5 -9
- package/lib/components/statistic/src/statistic.js +2 -9
- package/lib/components/statistic/src/statistic.js.map +1 -1
- package/lib/components/statistic/src/statistic.vue.d.ts +9 -25
- package/lib/components/statistic/src/statistic2.js +10 -16
- package/lib/components/statistic/src/statistic2.js.map +1 -1
- package/lib/components/time-picker/src/composables/use-time-picker.d.ts +2 -2
- package/lib/components/time-picker/src/time-picker-com/panel-time-pick.vue.d.ts +2 -2
- package/lib/components/time-picker/src/time-picker-com/panel-time-range.vue.d.ts +2 -2
- package/lib/components/time-select/index.d.ts +2 -2
- package/lib/components/time-select/src/time-select.vue.d.ts +1 -1
- package/lib/components/transfer/index.d.ts +0 -10
- package/lib/components/transfer/src/transfer-panel.d.ts +0 -1
- package/lib/components/transfer/src/transfer-panel.js.map +1 -1
- package/lib/components/transfer/src/transfer-panel.vue.d.ts +0 -2
- package/lib/components/transfer/src/transfer-panel2.js +3 -6
- package/lib/components/transfer/src/transfer-panel2.js.map +1 -1
- package/lib/components/transfer/src/transfer.vue.d.ts +0 -10
- package/lib/index.js +220 -221
- package/lib/index.js.map +1 -1
- package/lib/locale/lang/ckb.d.ts +157 -0
- package/lib/locale/lang/ckb.js +163 -0
- package/lib/locale/lang/ckb.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/tags.json +1 -1
- package/theme-chalk/el-menu.css +1 -1
- package/theme-chalk/el-statistic.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/common/var.scss +6 -6
- package/theme-chalk/src/menu.scss +6 -35
- package/theme-chalk/src/statistic.scss +21 -32
- package/web-types.json +1 -1
- package/es/components/statistic/src/countdown.mjs +0 -65
- package/es/components/statistic/src/countdown.mjs.map +0 -1
- package/es/components/statistic/src/countdown.vue.d.ts +0 -77
- package/es/components/statistic/src/countdown2.mjs +0 -106
- package/es/components/statistic/src/countdown2.mjs.map +0 -1
- package/lib/components/statistic/src/countdown.js +0 -71
- package/lib/components/statistic/src/countdown.js.map +0 -1
- package/lib/components/statistic/src/countdown.vue.d.ts +0 -77
- package/lib/components/statistic/src/countdown2.js +0 -110
- package/lib/components/statistic/src/countdown2.js.map +0 -1
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { padStart } from 'lodash-unified';
|
|
2
|
-
import '../../../utils/index.mjs';
|
|
3
|
-
import '../../../constants/index.mjs';
|
|
4
|
-
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
|
5
|
-
import { CHANGE_EVENT } from '../../../constants/event.mjs';
|
|
6
|
-
import { isNumber } from '@vueuse/core';
|
|
7
|
-
|
|
8
|
-
const countdownProps = buildProps({
|
|
9
|
-
format: {
|
|
10
|
-
type: String,
|
|
11
|
-
default: "HH:mm:ss"
|
|
12
|
-
},
|
|
13
|
-
prefix: String,
|
|
14
|
-
suffix: String,
|
|
15
|
-
title: String,
|
|
16
|
-
value: {
|
|
17
|
-
type: definePropType([Number, Object]),
|
|
18
|
-
default: 0
|
|
19
|
-
},
|
|
20
|
-
valueStyle: {
|
|
21
|
-
type: definePropType([String, Object, Array])
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
const countdownEmits = {
|
|
25
|
-
finish: () => true,
|
|
26
|
-
[CHANGE_EVENT]: (value) => isNumber(value)
|
|
27
|
-
};
|
|
28
|
-
const formatTimeStr = (format, time) => {
|
|
29
|
-
const timeUnits = [
|
|
30
|
-
["Y", 1e3 * 60 * 60 * 24 * 365],
|
|
31
|
-
["M", 1e3 * 60 * 60 * 24 * 30],
|
|
32
|
-
["D", 1e3 * 60 * 60 * 24],
|
|
33
|
-
["H", 1e3 * 60 * 60],
|
|
34
|
-
["m", 1e3 * 60],
|
|
35
|
-
["s", 1e3],
|
|
36
|
-
["S", 1]
|
|
37
|
-
];
|
|
38
|
-
let pre = 0;
|
|
39
|
-
let preTick = 0;
|
|
40
|
-
let timeLeft = time;
|
|
41
|
-
return timeUnits.reduce((con, item) => {
|
|
42
|
-
const name = item[0];
|
|
43
|
-
return con.replace(new RegExp(`${name}+`, "g"), (match) => {
|
|
44
|
-
let sum = 0;
|
|
45
|
-
if (!format.includes(name)) {
|
|
46
|
-
pre = Math.floor(timeLeft / item[1]);
|
|
47
|
-
timeLeft = timeLeft - pre * item[1];
|
|
48
|
-
preTick = item[1];
|
|
49
|
-
} else {
|
|
50
|
-
pre = 0;
|
|
51
|
-
preTick = 0;
|
|
52
|
-
sum = Math.floor(timeLeft / item[1]);
|
|
53
|
-
timeLeft = timeLeft - sum * item[1];
|
|
54
|
-
if (pre > 0) {
|
|
55
|
-
sum = sum + pre * (preTick / item[1]);
|
|
56
|
-
pre = 0;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return padStart(String(sum), match.length, "0");
|
|
60
|
-
});
|
|
61
|
-
}, format);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export { countdownEmits, countdownProps, formatTimeStr };
|
|
65
|
-
//# sourceMappingURL=countdown.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"countdown.mjs","sources":["../../../../../../packages/components/statistic/src/countdown.ts"],"sourcesContent":["import { padStart } from 'lodash-unified'\nimport { buildProps, definePropType, isNumber } from '@element-plus/utils'\nimport { CHANGE_EVENT } from '@element-plus/constants'\nimport type { StyleValue } from 'vue'\nimport type { Dayjs } from 'dayjs'\nimport type Countdown from './countdown.vue'\nexport const countdownProps = buildProps({\n /**\n * @description Formatting the countdown display\n */\n format: {\n type: String,\n default: 'HH:mm:ss',\n },\n /**\n * @description Sets the prefix of a countdown\n */\n prefix: String,\n /**\n * @description Sets the suffix of a countdown\n */\n suffix: String,\n /**\n * @description countdown titles\n */\n title: String,\n /**\n * @description target time\n */\n value: {\n type: definePropType<number | Dayjs>([Number, Object]),\n default: 0,\n },\n /**\n * @description Styles countdown values\n */\n valueStyle: {\n type: definePropType<StyleValue>([String, Object, Array]),\n },\n} as const)\n\nexport const countdownEmits = {\n finish: () => true,\n [CHANGE_EVENT]: (value: number) => isNumber(value),\n}\n\nexport const formatTimeStr = (format: string, time: number) => {\n const timeUnits: [string, number][] = [\n ['Y', 1000 * 60 * 60 * 24 * 365], // years\n ['M', 1000 * 60 * 60 * 24 * 30], // months\n ['D', 1000 * 60 * 60 * 24], // days\n ['H', 1000 * 60 * 60], // hours\n ['m', 1000 * 60], // minutes\n ['s', 1000], // seconds\n ['S', 1], // million seconds\n ]\n // The unformatted value of the previous tick\n let pre = 0\n // previous tick\n let preTick = 0\n // time left\n let timeLeft = time\n return timeUnits.reduce((con: string, item: [string, number]) => {\n const name = item[0]\n return con.replace(new RegExp(`${name}+`, 'g'), (match) => {\n let sum = 0\n if (!format.includes(name)) {\n pre = Math.floor(timeLeft / item[1])\n timeLeft = timeLeft - pre * item[1]\n preTick = item[1]\n } else {\n pre = 0\n preTick = 0\n sum = Math.floor(timeLeft / item[1])\n timeLeft = timeLeft - sum * item[1]\n if (pre > 0) {\n sum = sum + pre * (preTick / item[1])\n pre = 0\n }\n }\n return padStart(String(sum), match.length, '0') // autoCompletion\n })\n }, format)\n}\n\nexport type CountdownInstance = InstanceType<typeof Countdown>\n"],"names":[],"mappings":";;;;;;;AAGY,MAAC,cAAc,GAAG,UAAU,CAAC;AACzC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,UAAU;AACvB,GAAG;AACH,EAAE,MAAM,EAAE,MAAM;AAChB,EAAE,MAAM,EAAE,MAAM;AAChB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1C,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACjD,GAAG;AACH,CAAC,EAAE;AACS,MAAC,cAAc,GAAG;AAC9B,EAAE,MAAM,EAAE,MAAM,IAAI;AACpB,EAAE,CAAC,YAAY,GAAG,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AAC5C,EAAE;AACU,MAAC,aAAa,GAAG,CAAC,MAAM,EAAE,IAAI,KAAK;AAC/C,EAAE,MAAM,SAAS,GAAG;AACpB,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;AACnC,IAAI,CAAC,GAAG,EAAE,GAAG,GA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K,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7C,QAAQ,QAAQ,GAAG,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAC5C,QAAQ,IAAI,GAAG,GAAG,CAAC,EAAE;AACrB,UAAU,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,UAAU,GAAG,GAAG,CAAC,CAAC;AAClB,SAAS;AACT,OAAO;AACP,MAAM,OAAO,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACtD,KAAK,CAAC,CAAC;AACP,GAAG,EAAE,MAAM,CAAC,CAAC;AACb;;;;"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{
|
|
2
|
-
readonly format: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "HH:mm:ss", boolean>;
|
|
3
|
-
readonly prefix: StringConstructor;
|
|
4
|
-
readonly suffix: StringConstructor;
|
|
5
|
-
readonly title: StringConstructor;
|
|
6
|
-
readonly value: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs) | ((new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs))[], unknown, unknown, 0, boolean>;
|
|
7
|
-
readonly valueStyle: {
|
|
8
|
-
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => import("vue").StyleValue & {}) | (() => import("vue").StyleValue) | ((new (...args: any[]) => import("vue").StyleValue & {}) | (() => import("vue").StyleValue))[], unknown, unknown>>;
|
|
9
|
-
readonly required: false;
|
|
10
|
-
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
11
|
-
__epPropKey: true;
|
|
12
|
-
};
|
|
13
|
-
}, {
|
|
14
|
-
REFRESH_INTERVAL: number;
|
|
15
|
-
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
16
|
-
readonly format: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "HH:mm:ss", boolean>;
|
|
17
|
-
readonly prefix: StringConstructor;
|
|
18
|
-
readonly suffix: StringConstructor;
|
|
19
|
-
readonly title: StringConstructor;
|
|
20
|
-
readonly value: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs) | ((new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs))[], unknown, unknown, 0, boolean>;
|
|
21
|
-
readonly valueStyle: {
|
|
22
|
-
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => import("vue").StyleValue & {}) | (() => import("vue").StyleValue) | ((new (...args: any[]) => import("vue").StyleValue & {}) | (() => import("vue").StyleValue))[], unknown, unknown>>;
|
|
23
|
-
readonly required: false;
|
|
24
|
-
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
25
|
-
__epPropKey: true;
|
|
26
|
-
};
|
|
27
|
-
}>> & {
|
|
28
|
-
onChange?: ((value: number) => any) | undefined;
|
|
29
|
-
onFinish?: (() => any) | undefined;
|
|
30
|
-
}>>;
|
|
31
|
-
emit: ((event: "change", value: number) => void) & ((event: "finish") => void);
|
|
32
|
-
ns: {
|
|
33
|
-
namespace: import("vue").Ref<string>;
|
|
34
|
-
b: (blockSuffix?: string) => string;
|
|
35
|
-
e: (element?: string | undefined) => string;
|
|
36
|
-
m: (modifier?: string | undefined) => string;
|
|
37
|
-
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
38
|
-
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
39
|
-
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
40
|
-
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
41
|
-
is: {
|
|
42
|
-
(name: string, state: boolean | undefined): string;
|
|
43
|
-
(name: string): string;
|
|
44
|
-
};
|
|
45
|
-
cssVar: (object: Record<string, string>) => Record<string, string>;
|
|
46
|
-
cssVarName: (name: string) => string;
|
|
47
|
-
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
48
|
-
cssVarBlockName: (name: string) => string;
|
|
49
|
-
};
|
|
50
|
-
displayValue: import("vue").Ref<string>;
|
|
51
|
-
timer: number | undefined;
|
|
52
|
-
getTime: (val: number) => number;
|
|
53
|
-
stopTimer: () => void;
|
|
54
|
-
startTimer: () => void;
|
|
55
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
56
|
-
finish: () => boolean;
|
|
57
|
-
change: (value: number) => boolean;
|
|
58
|
-
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
59
|
-
readonly format: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "HH:mm:ss", boolean>;
|
|
60
|
-
readonly prefix: StringConstructor;
|
|
61
|
-
readonly suffix: StringConstructor;
|
|
62
|
-
readonly title: StringConstructor;
|
|
63
|
-
readonly value: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs) | ((new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs))[], unknown, unknown, 0, boolean>;
|
|
64
|
-
readonly valueStyle: {
|
|
65
|
-
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => import("vue").StyleValue & {}) | (() => import("vue").StyleValue) | ((new (...args: any[]) => import("vue").StyleValue & {}) | (() => import("vue").StyleValue))[], unknown, unknown>>;
|
|
66
|
-
readonly required: false;
|
|
67
|
-
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
68
|
-
__epPropKey: true;
|
|
69
|
-
};
|
|
70
|
-
}>> & {
|
|
71
|
-
onChange?: ((value: number) => any) | undefined;
|
|
72
|
-
onFinish?: (() => any) | undefined;
|
|
73
|
-
}, {
|
|
74
|
-
readonly value: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs) | ((new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs))[], unknown, unknown>;
|
|
75
|
-
readonly format: string;
|
|
76
|
-
}>;
|
|
77
|
-
export default _default;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, renderSlot, createTextVNode, toDisplayString, createCommentVNode, normalizeStyle } from 'vue';
|
|
2
|
-
import '../../../hooks/index.mjs';
|
|
3
|
-
import '../../../utils/index.mjs';
|
|
4
|
-
import { countdownProps, countdownEmits, formatTimeStr } from './countdown.mjs';
|
|
5
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
6
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
7
|
-
import { isNumber } from '@vueuse/core';
|
|
8
|
-
|
|
9
|
-
const REFRESH_INTERVAL = 1e3 / 30;
|
|
10
|
-
const __default__ = defineComponent({
|
|
11
|
-
name: "ElCountdown"
|
|
12
|
-
});
|
|
13
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
14
|
-
...__default__,
|
|
15
|
-
props: countdownProps,
|
|
16
|
-
emits: countdownEmits,
|
|
17
|
-
setup(__props, { expose, emit }) {
|
|
18
|
-
const props = __props;
|
|
19
|
-
const ns = useNamespace("statistic");
|
|
20
|
-
const displayValue = ref("");
|
|
21
|
-
let timer;
|
|
22
|
-
const getTime = (val) => {
|
|
23
|
-
return new Date(val).getTime();
|
|
24
|
-
};
|
|
25
|
-
const stopTimer = () => {
|
|
26
|
-
if (timer) {
|
|
27
|
-
clearInterval(timer);
|
|
28
|
-
timer = void 0;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const startTimer = () => {
|
|
32
|
-
const { value, format } = props;
|
|
33
|
-
const timestamp = getTime(isNumber(value) ? value : value.valueOf());
|
|
34
|
-
displayValue.value = formatTimeStr(format, timestamp - Date.now());
|
|
35
|
-
timer = setInterval(() => {
|
|
36
|
-
let diff = timestamp - Date.now();
|
|
37
|
-
emit("change", diff);
|
|
38
|
-
if (diff <= 0) {
|
|
39
|
-
diff = 0;
|
|
40
|
-
stopTimer();
|
|
41
|
-
emit("finish");
|
|
42
|
-
}
|
|
43
|
-
displayValue.value = formatTimeStr(format, diff);
|
|
44
|
-
}, REFRESH_INTERVAL);
|
|
45
|
-
};
|
|
46
|
-
watch(() => [props.value, props.format], () => {
|
|
47
|
-
stopTimer();
|
|
48
|
-
startTimer();
|
|
49
|
-
}, {
|
|
50
|
-
immediate: true
|
|
51
|
-
});
|
|
52
|
-
onBeforeUnmount(() => {
|
|
53
|
-
stopTimer();
|
|
54
|
-
});
|
|
55
|
-
expose({
|
|
56
|
-
displayValue
|
|
57
|
-
});
|
|
58
|
-
return (_ctx, _cache) => {
|
|
59
|
-
return openBlock(), createElementBlock("div", {
|
|
60
|
-
class: normalizeClass(unref(ns).b())
|
|
61
|
-
}, [
|
|
62
|
-
!!_ctx.$slots.title || _ctx.title ? (openBlock(), createElementBlock("div", {
|
|
63
|
-
key: 0,
|
|
64
|
-
ref: "title",
|
|
65
|
-
class: normalizeClass(unref(ns).e("head"))
|
|
66
|
-
}, [
|
|
67
|
-
createElementVNode("span", {
|
|
68
|
-
class: normalizeClass(unref(ns).e("title"))
|
|
69
|
-
}, [
|
|
70
|
-
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
71
|
-
createTextVNode(toDisplayString(_ctx.title), 1)
|
|
72
|
-
])
|
|
73
|
-
], 2)
|
|
74
|
-
], 2)) : createCommentVNode("v-if", true),
|
|
75
|
-
createElementVNode("div", {
|
|
76
|
-
class: normalizeClass(unref(ns).e("content"))
|
|
77
|
-
}, [
|
|
78
|
-
!!_ctx.$slots.title || _ctx.prefix ? (openBlock(), createElementBlock("span", {
|
|
79
|
-
key: 0,
|
|
80
|
-
class: normalizeClass(unref(ns).e("prefix"))
|
|
81
|
-
}, [
|
|
82
|
-
renderSlot(_ctx.$slots, "prefix", {}, () => [
|
|
83
|
-
createTextVNode(toDisplayString(_ctx.prefix), 1)
|
|
84
|
-
])
|
|
85
|
-
], 2)) : createCommentVNode("v-if", true),
|
|
86
|
-
createElementVNode("span", {
|
|
87
|
-
class: normalizeClass(unref(ns).e("number")),
|
|
88
|
-
style: normalizeStyle(_ctx.valueStyle)
|
|
89
|
-
}, toDisplayString(displayValue.value), 7),
|
|
90
|
-
!!_ctx.$slots.title || _ctx.suffix ? (openBlock(), createElementBlock("span", {
|
|
91
|
-
key: 1,
|
|
92
|
-
class: normalizeClass(unref(ns).e("suffix"))
|
|
93
|
-
}, [
|
|
94
|
-
renderSlot(_ctx.$slots, "suffix", {}, () => [
|
|
95
|
-
createTextVNode(toDisplayString(_ctx.suffix), 1)
|
|
96
|
-
])
|
|
97
|
-
], 2)) : createCommentVNode("v-if", true)
|
|
98
|
-
], 2)
|
|
99
|
-
], 2);
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
var Countdown = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/statistic/src/countdown.vue"]]);
|
|
104
|
-
|
|
105
|
-
export { Countdown as default };
|
|
106
|
-
//# sourceMappingURL=countdown2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"countdown2.mjs","sources":["../../../../../../packages/components/statistic/src/countdown.vue"],"sourcesContent":["<template>\n <div :class=\"ns.b()\">\n <div v-if=\"!!$slots.title || title\" ref=\"title\" :class=\"ns.e('head')\">\n <span :class=\"ns.e('title')\">\n <slot name=\"title\">\n {{ title }}\n </slot>\n </span>\n </div>\n <div :class=\"ns.e('content')\">\n <span v-if=\"!!$slots.title || prefix\" :class=\"ns.e('prefix')\">\n <slot name=\"prefix\">\n {{ prefix }}\n </slot>\n </span>\n <span :class=\"ns.e('number')\" :style=\"valueStyle\">\n {{ displayValue }}\n </span>\n <span v-if=\"!!$slots.title || suffix\" :class=\"ns.e('suffix')\">\n <slot name=\"suffix\">\n {{ suffix }}\n </slot>\n </span>\n </div>\n </div>\n</template>\n<script lang=\"ts\" setup>\nimport { onBeforeUnmount, ref, watch } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { isNumber } from '@element-plus/utils'\nimport { countdownEmits, countdownProps, formatTimeStr } from './countdown'\n\nconst REFRESH_INTERVAL = 1000 / 30\n\ndefineOptions({\n name: 'ElCountdown',\n})\n\nconst props = defineProps(countdownProps)\nconst emit = defineEmits(countdownEmits)\nconst ns = useNamespace('statistic')\nconst displayValue = ref('')\nlet timer: ReturnType<typeof setInterval> | undefined\n\nconst getTime = (val: number) => {\n return new Date(val).getTime()\n}\n\nconst stopTimer = () => {\n if (timer) {\n clearInterval(timer)\n timer = undefined\n }\n}\n\nconst startTimer = () => {\n const { value, format } = props\n const timestamp = getTime(isNumber(value) ? value : value.valueOf())\n displayValue.value = formatTimeStr(format, timestamp - Date.now())\n timer = setInterval(() => {\n let diff = timestamp - Date.now()\n emit('change', diff)\n if (diff <= 0) {\n diff = 0\n stopTimer()\n emit('finish')\n }\n displayValue.value = formatTimeStr(format, diff)\n }, REFRESH_INTERVAL)\n}\n\nwatch(\n () => [props.value, props.format],\n () => {\n stopTimer()\n startTimer()\n },\n {\n immediate: true,\n }\n)\n\nonBeforeUnmount(() => {\n stopTimer()\n})\n\ndefineExpose({\n /**\n * @description Current display value\n */\n displayValue,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;mCAkCc,CAAA;AAAA,EACZ,IAAM,EAA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CACE,MAAM,CAAC,KAAA,CAAM,OAAO,KAAM,CAAA,MAAM,GAChC,MAAM;AACJ,MAAU,SAAA,EAAA,CAAA;AACV,MAAW,UAAA,EAAA,CAAA;AAAA,KAEb,EAAA;AAAA,MACE,SAAW,EAAA,IAAA;AAAA,KAEf,CAAA,CAAA;AAEA,IAAA,eAAA,CAAgB,MAAM;AACpB,MAAU,SAAA,EAAA,CAAA;AAAA,KACX,CAAA,CAAA;AAED,IAAa,MAAA,CAAA;AAAA,MAIX,YAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var lodashUnified = require('lodash-unified');
|
|
6
|
-
require('../../../utils/index.js');
|
|
7
|
-
require('../../../constants/index.js');
|
|
8
|
-
var runtime = require('../../../utils/vue/props/runtime.js');
|
|
9
|
-
var event = require('../../../constants/event.js');
|
|
10
|
-
var core = require('@vueuse/core');
|
|
11
|
-
|
|
12
|
-
const countdownProps = runtime.buildProps({
|
|
13
|
-
format: {
|
|
14
|
-
type: String,
|
|
15
|
-
default: "HH:mm:ss"
|
|
16
|
-
},
|
|
17
|
-
prefix: String,
|
|
18
|
-
suffix: String,
|
|
19
|
-
title: String,
|
|
20
|
-
value: {
|
|
21
|
-
type: runtime.definePropType([Number, Object]),
|
|
22
|
-
default: 0
|
|
23
|
-
},
|
|
24
|
-
valueStyle: {
|
|
25
|
-
type: runtime.definePropType([String, Object, Array])
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const countdownEmits = {
|
|
29
|
-
finish: () => true,
|
|
30
|
-
[event.CHANGE_EVENT]: (value) => core.isNumber(value)
|
|
31
|
-
};
|
|
32
|
-
const formatTimeStr = (format, time) => {
|
|
33
|
-
const timeUnits = [
|
|
34
|
-
["Y", 1e3 * 60 * 60 * 24 * 365],
|
|
35
|
-
["M", 1e3 * 60 * 60 * 24 * 30],
|
|
36
|
-
["D", 1e3 * 60 * 60 * 24],
|
|
37
|
-
["H", 1e3 * 60 * 60],
|
|
38
|
-
["m", 1e3 * 60],
|
|
39
|
-
["s", 1e3],
|
|
40
|
-
["S", 1]
|
|
41
|
-
];
|
|
42
|
-
let pre = 0;
|
|
43
|
-
let preTick = 0;
|
|
44
|
-
let timeLeft = time;
|
|
45
|
-
return timeUnits.reduce((con, item) => {
|
|
46
|
-
const name = item[0];
|
|
47
|
-
return con.replace(new RegExp(`${name}+`, "g"), (match) => {
|
|
48
|
-
let sum = 0;
|
|
49
|
-
if (!format.includes(name)) {
|
|
50
|
-
pre = Math.floor(timeLeft / item[1]);
|
|
51
|
-
timeLeft = timeLeft - pre * item[1];
|
|
52
|
-
preTick = item[1];
|
|
53
|
-
} else {
|
|
54
|
-
pre = 0;
|
|
55
|
-
preTick = 0;
|
|
56
|
-
sum = Math.floor(timeLeft / item[1]);
|
|
57
|
-
timeLeft = timeLeft - sum * item[1];
|
|
58
|
-
if (pre > 0) {
|
|
59
|
-
sum = sum + pre * (preTick / item[1]);
|
|
60
|
-
pre = 0;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return lodashUnified.padStart(String(sum), match.length, "0");
|
|
64
|
-
});
|
|
65
|
-
}, format);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
exports.countdownEmits = countdownEmits;
|
|
69
|
-
exports.countdownProps = countdownProps;
|
|
70
|
-
exports.formatTimeStr = formatTimeStr;
|
|
71
|
-
//# sourceMappingURL=countdown.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"countdown.js","sources":["../../../../../../packages/components/statistic/src/countdown.ts"],"sourcesContent":["import { padStart } from 'lodash-unified'\nimport { buildProps, definePropType, isNumber } from '@element-plus/utils'\nimport { CHANGE_EVENT } from '@element-plus/constants'\nimport type { StyleValue } from 'vue'\nimport type { Dayjs } from 'dayjs'\nimport type Countdown from './countdown.vue'\nexport const countdownProps = buildProps({\n /**\n * @description Formatting the countdown display\n */\n format: {\n type: String,\n default: 'HH:mm:ss',\n },\n /**\n * @description Sets the prefix of a countdown\n */\n prefix: String,\n /**\n * @description Sets the suffix of a countdown\n */\n suffix: String,\n /**\n * @description countdown titles\n */\n title: String,\n /**\n * @description target time\n */\n value: {\n type: definePropType<number | Dayjs>([Number, Object]),\n default: 0,\n },\n /**\n * @description Styles countdown values\n */\n valueStyle: {\n type: definePropType<StyleValue>([String, Object, Array]),\n },\n} as const)\n\nexport const countdownEmits = {\n finish: () => true,\n [CHANGE_EVENT]: (value: number) => isNumber(value),\n}\n\nexport const formatTimeStr = (format: string, time: number) => {\n const timeUnits: [string, number][] = [\n ['Y', 1000 * 60 * 60 * 24 * 365], // years\n ['M', 1000 * 60 * 60 * 24 * 30], // months\n ['D', 1000 * 60 * 60 * 24], // days\n ['H', 1000 * 60 * 60], // hours\n ['m', 1000 * 60], // minutes\n ['s', 1000], // seconds\n ['S', 1], // million seconds\n ]\n // The unformatted value of the previous tick\n let pre = 0\n // previous tick\n let preTick = 0\n // time left\n let timeLeft = time\n return timeUnits.reduce((con: string, item: [string, number]) => {\n const name = item[0]\n return con.replace(new RegExp(`${name}+`, 'g'), (match) => {\n let sum = 0\n if (!format.includes(name)) {\n pre = Math.floor(timeLeft / item[1])\n timeLeft = timeLeft - pre * item[1]\n preTick = item[1]\n } else {\n pre = 0\n preTick = 0\n sum = Math.floor(timeLeft / item[1])\n timeLeft = timeLeft - sum * item[1]\n if (pre > 0) {\n sum = sum + pre * (preTick / item[1])\n pre = 0\n }\n }\n return padStart(String(sum), match.length, '0') // autoCompletion\n })\n }, format)\n}\n\nexport type CountdownInstance = InstanceType<typeof Countdown>\n"],"names":["buildProps","definePropType","CHANGE_EVENT","isNumber","padStart"],"mappings":";;;;;;;;;;;AAGY,MAAC,cAAc,GAAGA,kBAAU,CAAC;AACzC,EAA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,EAAE,GAAG,CAAC,CAAC;AACtD,KAAK,CAAC,CAAC;AACP,GAAG,EAAE,MAAM,CAAC,CAAC;AACb;;;;;;"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{
|
|
2
|
-
readonly format: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "HH:mm:ss", boolean>;
|
|
3
|
-
readonly prefix: StringConstructor;
|
|
4
|
-
readonly suffix: StringConstructor;
|
|
5
|
-
readonly title: StringConstructor;
|
|
6
|
-
readonly value: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs) | ((new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs))[], unknown, unknown, 0, boolean>;
|
|
7
|
-
readonly valueStyle: {
|
|
8
|
-
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => import("vue").StyleValue & {}) | (() => import("vue").StyleValue) | ((new (...args: any[]) => import("vue").StyleValue & {}) | (() => import("vue").StyleValue))[], unknown, unknown>>;
|
|
9
|
-
readonly required: false;
|
|
10
|
-
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
11
|
-
__epPropKey: true;
|
|
12
|
-
};
|
|
13
|
-
}, {
|
|
14
|
-
REFRESH_INTERVAL: number;
|
|
15
|
-
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
16
|
-
readonly format: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "HH:mm:ss", boolean>;
|
|
17
|
-
readonly prefix: StringConstructor;
|
|
18
|
-
readonly suffix: StringConstructor;
|
|
19
|
-
readonly title: StringConstructor;
|
|
20
|
-
readonly value: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs) | ((new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs))[], unknown, unknown, 0, boolean>;
|
|
21
|
-
readonly valueStyle: {
|
|
22
|
-
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => import("vue").StyleValue & {}) | (() => import("vue").StyleValue) | ((new (...args: any[]) => import("vue").StyleValue & {}) | (() => import("vue").StyleValue))[], unknown, unknown>>;
|
|
23
|
-
readonly required: false;
|
|
24
|
-
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
25
|
-
__epPropKey: true;
|
|
26
|
-
};
|
|
27
|
-
}>> & {
|
|
28
|
-
onChange?: ((value: number) => any) | undefined;
|
|
29
|
-
onFinish?: (() => any) | undefined;
|
|
30
|
-
}>>;
|
|
31
|
-
emit: ((event: "change", value: number) => void) & ((event: "finish") => void);
|
|
32
|
-
ns: {
|
|
33
|
-
namespace: import("vue").Ref<string>;
|
|
34
|
-
b: (blockSuffix?: string) => string;
|
|
35
|
-
e: (element?: string | undefined) => string;
|
|
36
|
-
m: (modifier?: string | undefined) => string;
|
|
37
|
-
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
38
|
-
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
39
|
-
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
40
|
-
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
41
|
-
is: {
|
|
42
|
-
(name: string, state: boolean | undefined): string;
|
|
43
|
-
(name: string): string;
|
|
44
|
-
};
|
|
45
|
-
cssVar: (object: Record<string, string>) => Record<string, string>;
|
|
46
|
-
cssVarName: (name: string) => string;
|
|
47
|
-
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
48
|
-
cssVarBlockName: (name: string) => string;
|
|
49
|
-
};
|
|
50
|
-
displayValue: import("vue").Ref<string>;
|
|
51
|
-
timer: number | undefined;
|
|
52
|
-
getTime: (val: number) => number;
|
|
53
|
-
stopTimer: () => void;
|
|
54
|
-
startTimer: () => void;
|
|
55
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
56
|
-
finish: () => boolean;
|
|
57
|
-
change: (value: number) => boolean;
|
|
58
|
-
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
59
|
-
readonly format: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "HH:mm:ss", boolean>;
|
|
60
|
-
readonly prefix: StringConstructor;
|
|
61
|
-
readonly suffix: StringConstructor;
|
|
62
|
-
readonly title: StringConstructor;
|
|
63
|
-
readonly value: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs) | ((new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs))[], unknown, unknown, 0, boolean>;
|
|
64
|
-
readonly valueStyle: {
|
|
65
|
-
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => import("vue").StyleValue & {}) | (() => import("vue").StyleValue) | ((new (...args: any[]) => import("vue").StyleValue & {}) | (() => import("vue").StyleValue))[], unknown, unknown>>;
|
|
66
|
-
readonly required: false;
|
|
67
|
-
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
68
|
-
__epPropKey: true;
|
|
69
|
-
};
|
|
70
|
-
}>> & {
|
|
71
|
-
onChange?: ((value: number) => any) | undefined;
|
|
72
|
-
onFinish?: (() => any) | undefined;
|
|
73
|
-
}, {
|
|
74
|
-
readonly value: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs) | ((new (...args: any[]) => (number | import("dayjs").Dayjs) & {}) | (() => number | import("dayjs").Dayjs))[], unknown, unknown>;
|
|
75
|
-
readonly format: string;
|
|
76
|
-
}>;
|
|
77
|
-
export default _default;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var vue = require('vue');
|
|
6
|
-
require('../../../hooks/index.js');
|
|
7
|
-
require('../../../utils/index.js');
|
|
8
|
-
var countdown = require('./countdown.js');
|
|
9
|
-
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
10
|
-
var index = require('../../../hooks/use-namespace/index.js');
|
|
11
|
-
var core = require('@vueuse/core');
|
|
12
|
-
|
|
13
|
-
const REFRESH_INTERVAL = 1e3 / 30;
|
|
14
|
-
const __default__ = vue.defineComponent({
|
|
15
|
-
name: "ElCountdown"
|
|
16
|
-
});
|
|
17
|
-
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
18
|
-
...__default__,
|
|
19
|
-
props: countdown.countdownProps,
|
|
20
|
-
emits: countdown.countdownEmits,
|
|
21
|
-
setup(__props, { expose, emit }) {
|
|
22
|
-
const props = __props;
|
|
23
|
-
const ns = index.useNamespace("statistic");
|
|
24
|
-
const displayValue = vue.ref("");
|
|
25
|
-
let timer;
|
|
26
|
-
const getTime = (val) => {
|
|
27
|
-
return new Date(val).getTime();
|
|
28
|
-
};
|
|
29
|
-
const stopTimer = () => {
|
|
30
|
-
if (timer) {
|
|
31
|
-
clearInterval(timer);
|
|
32
|
-
timer = void 0;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const startTimer = () => {
|
|
36
|
-
const { value, format } = props;
|
|
37
|
-
const timestamp = getTime(core.isNumber(value) ? value : value.valueOf());
|
|
38
|
-
displayValue.value = countdown.formatTimeStr(format, timestamp - Date.now());
|
|
39
|
-
timer = setInterval(() => {
|
|
40
|
-
let diff = timestamp - Date.now();
|
|
41
|
-
emit("change", diff);
|
|
42
|
-
if (diff <= 0) {
|
|
43
|
-
diff = 0;
|
|
44
|
-
stopTimer();
|
|
45
|
-
emit("finish");
|
|
46
|
-
}
|
|
47
|
-
displayValue.value = countdown.formatTimeStr(format, diff);
|
|
48
|
-
}, REFRESH_INTERVAL);
|
|
49
|
-
};
|
|
50
|
-
vue.watch(() => [props.value, props.format], () => {
|
|
51
|
-
stopTimer();
|
|
52
|
-
startTimer();
|
|
53
|
-
}, {
|
|
54
|
-
immediate: true
|
|
55
|
-
});
|
|
56
|
-
vue.onBeforeUnmount(() => {
|
|
57
|
-
stopTimer();
|
|
58
|
-
});
|
|
59
|
-
expose({
|
|
60
|
-
displayValue
|
|
61
|
-
});
|
|
62
|
-
return (_ctx, _cache) => {
|
|
63
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
64
|
-
class: vue.normalizeClass(vue.unref(ns).b())
|
|
65
|
-
}, [
|
|
66
|
-
!!_ctx.$slots.title || _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
67
|
-
key: 0,
|
|
68
|
-
ref: "title",
|
|
69
|
-
class: vue.normalizeClass(vue.unref(ns).e("head"))
|
|
70
|
-
}, [
|
|
71
|
-
vue.createElementVNode("span", {
|
|
72
|
-
class: vue.normalizeClass(vue.unref(ns).e("title"))
|
|
73
|
-
}, [
|
|
74
|
-
vue.renderSlot(_ctx.$slots, "title", {}, () => [
|
|
75
|
-
vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
|
|
76
|
-
])
|
|
77
|
-
], 2)
|
|
78
|
-
], 2)) : vue.createCommentVNode("v-if", true),
|
|
79
|
-
vue.createElementVNode("div", {
|
|
80
|
-
class: vue.normalizeClass(vue.unref(ns).e("content"))
|
|
81
|
-
}, [
|
|
82
|
-
!!_ctx.$slots.title || _ctx.prefix ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
83
|
-
key: 0,
|
|
84
|
-
class: vue.normalizeClass(vue.unref(ns).e("prefix"))
|
|
85
|
-
}, [
|
|
86
|
-
vue.renderSlot(_ctx.$slots, "prefix", {}, () => [
|
|
87
|
-
vue.createTextVNode(vue.toDisplayString(_ctx.prefix), 1)
|
|
88
|
-
])
|
|
89
|
-
], 2)) : vue.createCommentVNode("v-if", true),
|
|
90
|
-
vue.createElementVNode("span", {
|
|
91
|
-
class: vue.normalizeClass(vue.unref(ns).e("number")),
|
|
92
|
-
style: vue.normalizeStyle(_ctx.valueStyle)
|
|
93
|
-
}, vue.toDisplayString(displayValue.value), 7),
|
|
94
|
-
!!_ctx.$slots.title || _ctx.suffix ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
95
|
-
key: 1,
|
|
96
|
-
class: vue.normalizeClass(vue.unref(ns).e("suffix"))
|
|
97
|
-
}, [
|
|
98
|
-
vue.renderSlot(_ctx.$slots, "suffix", {}, () => [
|
|
99
|
-
vue.createTextVNode(vue.toDisplayString(_ctx.suffix), 1)
|
|
100
|
-
])
|
|
101
|
-
], 2)) : vue.createCommentVNode("v-if", true)
|
|
102
|
-
], 2)
|
|
103
|
-
], 2);
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
var Countdown = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/statistic/src/countdown.vue"]]);
|
|
108
|
-
|
|
109
|
-
exports["default"] = Countdown;
|
|
110
|
-
//# sourceMappingURL=countdown2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"countdown2.js","sources":["../../../../../../packages/components/statistic/src/countdown.vue"],"sourcesContent":["<template>\n <div :class=\"ns.b()\">\n <div v-if=\"!!$slots.title || title\" ref=\"title\" :class=\"ns.e('head')\">\n <span :class=\"ns.e('title')\">\n <slot name=\"title\">\n {{ title }}\n </slot>\n </span>\n </div>\n <div :class=\"ns.e('content')\">\n <span v-if=\"!!$slots.title || prefix\" :class=\"ns.e('prefix')\">\n <slot name=\"prefix\">\n {{ prefix }}\n </slot>\n </span>\n <span :class=\"ns.e('number')\" :style=\"valueStyle\">\n {{ displayValue }}\n </span>\n <span v-if=\"!!$slots.title || suffix\" :class=\"ns.e('suffix')\">\n <slot name=\"suffix\">\n {{ suffix }}\n </slot>\n </span>\n </div>\n </div>\n</template>\n<script lang=\"ts\" setup>\nimport { onBeforeUnmount, ref, watch } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { isNumber } from '@element-plus/utils'\nimport { countdownEmits, countdownProps, formatTimeStr } from './countdown'\n\nconst REFRESH_INTERVAL = 1000 / 30\n\ndefineOptions({\n name: 'ElCountdown',\n})\n\nconst props = defineProps(countdownProps)\nconst emit = defineEmits(countdownEmits)\nconst ns = useNamespace('statistic')\nconst displayValue = ref('')\nlet timer: ReturnType<typeof setInterval> | undefined\n\nconst getTime = (val: number) => {\n return new Date(val).getTime()\n}\n\nconst stopTimer = () => {\n if (timer) {\n clearInterval(timer)\n timer = undefined\n }\n}\n\nconst startTimer = () => {\n const { value, format } = props\n const timestamp = getTime(isNumber(value) ? value : value.valueOf())\n displayValue.value = formatTimeStr(format, timestamp - Date.now())\n timer = setInterval(() => {\n let diff = timestamp - Date.now()\n emit('change', diff)\n if (diff <= 0) {\n diff = 0\n stopTimer()\n emit('finish')\n }\n displayValue.value = formatTimeStr(format, diff)\n }, REFRESH_INTERVAL)\n}\n\nwatch(\n () => [props.value, props.format],\n () => {\n stopTimer()\n startTimer()\n },\n {\n immediate: true,\n }\n)\n\nonBeforeUnmount(() => {\n stopTimer()\n})\n\ndefineExpose({\n /**\n * @description Current display value\n */\n displayValue,\n})\n</script>\n"],"names":["useNamespace","ref","isNumber","formatTimeStr","watch","onBeforeUnmount"],"mappings":";;;;;;;;;;;;;uCAkCc,CAAA;AAAA,EACZ,IAAM,EAAA,aAAA;AACR;;;;;;;AAIA,IAAM,MAAA,EAAA,GAAKA,mBAAa,WAAW,CAAA,CAAA;AACnC,IAAM,MAAA,YAAA,GAAeC,QAAI,EAAE,CAAA,CAAA;AAC3B,IAAI,IAAA,KAAA,CAAA;AAEJ,IAAM,MAAA,OAAA,GAAU,CAAC,GAAgB,KAAA;AAC/B,MAAA,OAAO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