@element-plus/nightly 0.0.20220303 → 0.0.20220306
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/attributes.json +1 -1
- package/dist/index.css +1 -1
- package/dist/index.full.js +1980 -2030
- package/dist/index.full.min.js +11 -11
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +11 -11
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +1965 -2029
- 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/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/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/components/autocomplete/index.d.ts +4 -4
- package/es/components/autocomplete/src/autocomplete.vue.d.ts +4 -4
- package/es/components/button/index.d.ts +1 -1
- package/es/components/button/src/button.vue.d.ts +1 -1
- package/es/components/cascader/index.d.ts +18 -18
- package/es/components/cascader/src/index.mjs +5 -4
- package/es/components/cascader/src/index.mjs.map +1 -1
- package/es/components/cascader/src/index.vue.d.ts +9 -9
- package/es/components/checkbox/src/checkbox-group.mjs +2 -1
- package/es/components/checkbox/src/checkbox-group.mjs.map +1 -1
- package/es/components/checkbox/src/useCheckbox.d.ts +4 -4
- package/es/components/checkbox/src/useCheckbox.mjs +6 -4
- package/es/components/checkbox/src/useCheckbox.mjs.map +1 -1
- package/es/components/color-picker/src/index.mjs +6 -5
- package/es/components/color-picker/src/index.mjs.map +1 -1
- package/es/components/dropdown/index.d.ts +3 -0
- package/es/components/dropdown/src/dropdown.d.ts +1 -0
- package/es/components/dropdown/src/dropdown.mjs +4 -0
- package/es/components/dropdown/src/dropdown.mjs.map +1 -1
- package/es/components/dropdown/src/dropdown.vue.d.ts +3 -0
- package/es/components/dropdown/src/dropdown2.mjs +8 -5
- package/es/components/dropdown/src/dropdown2.mjs.map +1 -1
- package/es/components/form/index.d.ts +285 -210
- package/es/components/form/index.mjs +8 -5
- package/es/components/form/index.mjs.map +1 -1
- package/es/components/form/src/form-item.d.ts +21 -0
- package/es/components/form/src/form-item.mjs +41 -301
- package/es/components/form/src/form-item.mjs.map +1 -1
- package/es/components/form/src/form-item.vue.d.ts +104 -73
- package/es/components/form/src/form-item2.mjs +249 -0
- package/es/components/form/src/form-item2.mjs.map +1 -0
- package/es/components/form/src/form-label-wrap.d.ts +11 -0
- package/es/components/form/src/form-label-wrap.mjs +96 -0
- package/es/components/form/src/form-label-wrap.mjs.map +1 -0
- package/es/components/form/src/form.d.ts +25 -0
- package/es/components/form/src/form.mjs +43 -208
- package/es/components/form/src/form.mjs.map +1 -1
- package/es/components/form/src/form.vue.d.ts +86 -76
- package/es/components/form/src/form2.mjs +130 -0
- package/es/components/form/src/form2.mjs.map +1 -0
- package/es/components/form/src/types.d.ts +9 -0
- package/es/components/form/src/types.mjs +2 -0
- package/es/components/form/src/types.mjs.map +1 -0
- package/es/components/form/src/utils.d.ts +9 -0
- package/es/components/form/src/utils.mjs +48 -0
- package/es/components/form/src/utils.mjs.map +1 -0
- package/es/components/index.mjs +6 -0
- package/es/components/index.mjs.map +1 -1
- package/es/components/input/index.d.ts +1 -1
- package/es/components/input/src/input.vue.d.ts +1 -1
- package/es/components/input/src/input2.mjs +3 -2
- package/es/components/input/src/input2.mjs.map +1 -1
- package/es/components/input-number/index.d.ts +2 -2
- package/es/components/input-number/src/input-number.vue.d.ts +2 -2
- package/es/components/input-number/src/input-number2.mjs +2 -2
- package/es/components/input-number/src/input-number2.mjs.map +1 -1
- package/es/components/message-box/index.mjs +1 -0
- package/es/components/message-box/index.mjs.map +1 -1
- package/es/components/message-box/src/index.vue.d.ts +2 -2
- package/es/components/message-box/src/message-box.type.d.ts +4 -3
- package/es/components/message-box/src/messageBox.mjs +39 -56
- package/es/components/message-box/src/messageBox.mjs.map +1 -1
- package/es/components/popover/index.d.ts +2 -0
- package/es/components/popover/src/index.mjs +6 -1
- package/es/components/popover/src/index.mjs.map +1 -1
- package/es/components/popover/src/index.vue.d.ts +1 -0
- package/es/components/radio/index.d.ts +1 -1
- package/es/components/radio/src/radio-group.vue.d.ts +10 -10
- package/es/components/radio/src/radio-group2.mjs +3 -1
- package/es/components/radio/src/radio-group2.mjs.map +1 -1
- package/es/components/radio/src/radio.vue.d.ts +1 -1
- package/es/components/rate/index.d.ts +1 -1
- package/es/components/rate/src/rate.vue.d.ts +1 -1
- package/es/components/rate/src/rate2.mjs +2 -2
- package/es/components/rate/src/rate2.mjs.map +1 -1
- package/es/components/scrollbar/index.d.ts +3 -3
- package/es/components/scrollbar/src/scrollbar.d.ts +1 -1
- package/es/components/scrollbar/src/scrollbar.mjs +1 -1
- package/es/components/scrollbar/src/scrollbar.mjs.map +1 -1
- package/es/components/scrollbar/src/scrollbar.vue.d.ts +3 -3
- package/es/components/select/index.d.ts +9 -0
- package/es/components/select/src/select.mjs +6 -2
- package/es/components/select/src/select.mjs.map +1 -1
- package/es/components/select/src/select.vue.d.ts +9 -0
- package/es/components/select/src/useSelect.mjs +7 -6
- package/es/components/select/src/useSelect.mjs.map +1 -1
- package/es/components/select-v2/index.d.ts +24 -6
- package/es/components/select-v2/src/defaults.d.ts +5 -1
- package/es/components/select-v2/src/defaults.mjs +4 -0
- package/es/components/select-v2/src/defaults.mjs.map +1 -1
- package/es/components/select-v2/src/select.mjs +3 -3
- package/es/components/select-v2/src/select.mjs.map +1 -1
- package/es/components/select-v2/src/select.vue.d.ts +12 -3
- package/es/components/select-v2/src/useSelect.mjs +2 -1
- package/es/components/select-v2/src/useSelect.mjs.map +1 -1
- package/es/components/slider/index.d.ts +2 -2
- package/es/components/slider/src/index.mjs +3 -3
- package/es/components/slider/src/index.mjs.map +1 -1
- package/es/components/slider/src/index.vue.d.ts +1 -1
- package/es/components/slider/src/useSlide.d.ts +2 -2
- package/es/components/slider/src/useSlide.mjs +3 -3
- package/es/components/slider/src/useSlide.mjs.map +1 -1
- package/es/components/switch/src/switch2.mjs +2 -2
- package/es/components/switch/src/switch2.mjs.map +1 -1
- package/es/components/table/index.d.ts +4 -0
- package/es/components/table/src/config.mjs +2 -2
- package/es/components/table/src/config.mjs.map +1 -1
- package/es/components/table/src/table/style-helper.d.ts +4 -0
- package/es/components/table/src/table/style-helper.mjs +6 -1
- package/es/components/table/src/table/style-helper.mjs.map +1 -1
- package/es/components/table/src/table-column/index.mjs +11 -4
- package/es/components/table/src/table-column/index.mjs.map +1 -1
- package/es/components/table/src/table.mjs +7 -4
- package/es/components/table/src/table.mjs.map +1 -1
- package/es/components/table/src/table.vue.d.ts +4 -0
- package/es/components/time-picker/src/common/picker.mjs +6 -5
- package/es/components/time-picker/src/common/picker.mjs.map +1 -1
- package/es/components/time-picker/src/common/picker.vue.d.ts +1 -1
- package/es/components/transfer/src/index.mjs +6 -4
- package/es/components/transfer/src/index.mjs.map +1 -1
- package/es/components/upload/index.d.ts +807 -727
- package/es/components/upload/index.mjs +9 -7
- package/es/components/upload/index.mjs.map +1 -1
- package/es/components/upload/src/ajax.d.ts +8 -2
- package/es/components/upload/src/ajax.mjs +39 -34
- package/es/components/upload/src/ajax.mjs.map +1 -1
- package/es/components/upload/src/upload-content.d.ts +32 -0
- package/es/components/upload/src/upload-content.mjs +39 -0
- package/es/components/upload/src/upload-content.mjs.map +1 -0
- package/es/components/upload/src/upload-content.vue.d.ts +165 -0
- package/es/components/upload/src/upload-content2.mjs +172 -0
- package/es/components/upload/src/upload-content2.mjs.map +1 -0
- package/es/components/upload/src/upload-dragger.d.ts +11 -0
- package/es/components/upload/src/upload-dragger.mjs +11 -67
- package/es/components/upload/src/upload-dragger.mjs.map +1 -1
- package/es/components/upload/src/upload-dragger.vue.d.ts +15 -11
- package/es/components/upload/src/upload-dragger2.mjs +73 -0
- package/es/components/upload/src/upload-dragger2.mjs.map +1 -0
- package/es/components/upload/src/upload-list.d.ts +15 -0
- package/es/components/upload/src/upload-list.mjs +23 -207
- package/es/components/upload/src/upload-list.mjs.map +1 -1
- package/es/components/upload/src/upload-list.vue.d.ts +148 -44
- package/es/components/upload/src/upload-list2.mjs +173 -0
- package/es/components/upload/src/upload-list2.mjs.map +1 -0
- package/es/components/upload/src/upload.d.ts +97 -0
- package/es/components/upload/src/upload.mjs +103 -266
- package/es/components/upload/src/upload.mjs.map +1 -1
- package/es/components/upload/src/upload.vue.d.ts +830 -292
- package/es/components/upload/src/upload2.mjs +122 -0
- package/es/components/upload/src/upload2.mjs.map +1 -0
- package/es/components/upload/src/{useHandlers.d.ts → use-handlers.d.ts} +10 -13
- package/es/components/upload/src/use-handlers.mjs +142 -0
- package/es/components/upload/src/use-handlers.mjs.map +1 -0
- package/es/hooks/use-common-props/index.mjs +4 -4
- package/es/hooks/use-common-props/index.mjs.map +1 -1
- package/es/hooks/use-form-item/index.d.ts +2 -2
- package/es/hooks/use-form-item/index.mjs +3 -3
- package/es/hooks/use-form-item/index.mjs.map +1 -1
- package/es/index.mjs +8 -1
- package/es/index.mjs.map +1 -1
- package/es/tokens/form.d.ts +17 -37
- package/es/tokens/form.mjs +3 -3
- package/es/tokens/form.mjs.map +1 -1
- package/es/tokens/index.d.ts +1 -0
- package/es/tokens/index.mjs +2 -1
- package/es/tokens/index.mjs.map +1 -1
- package/es/tokens/upload.d.ts +5 -0
- package/es/tokens/upload.mjs +4 -0
- package/es/tokens/upload.mjs.map +1 -0
- package/es/utils/error.d.ts +1 -0
- package/es/utils/error.mjs +5 -1
- package/es/utils/error.mjs.map +1 -1
- package/es/utils/index.mjs +1 -1
- package/es/utils/objects.d.ts +3 -5
- package/es/utils/objects.mjs +10 -35
- package/es/utils/objects.mjs.map +1 -1
- package/es/utils/typescript.d.ts +1 -0
- package/es/utils/typescript.mjs.map +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/autocomplete/index.d.ts +4 -4
- package/lib/components/autocomplete/src/autocomplete.vue.d.ts +4 -4
- package/lib/components/button/index.d.ts +1 -1
- package/lib/components/button/src/button.vue.d.ts +1 -1
- package/lib/components/cascader/index.d.ts +18 -18
- package/lib/components/cascader/src/index.js +4 -3
- package/lib/components/cascader/src/index.js.map +1 -1
- package/lib/components/cascader/src/index.vue.d.ts +9 -9
- package/lib/components/checkbox/src/checkbox-group.js +2 -1
- package/lib/components/checkbox/src/checkbox-group.js.map +1 -1
- package/lib/components/checkbox/src/useCheckbox.d.ts +4 -4
- package/lib/components/checkbox/src/useCheckbox.js +5 -3
- package/lib/components/checkbox/src/useCheckbox.js.map +1 -1
- package/lib/components/color-picker/src/index.js +5 -4
- package/lib/components/color-picker/src/index.js.map +1 -1
- package/lib/components/dropdown/index.d.ts +3 -0
- package/lib/components/dropdown/src/dropdown.d.ts +1 -0
- package/lib/components/dropdown/src/dropdown.js +4 -0
- package/lib/components/dropdown/src/dropdown.js.map +1 -1
- package/lib/components/dropdown/src/dropdown.vue.d.ts +3 -0
- package/lib/components/dropdown/src/dropdown2.js +8 -5
- package/lib/components/dropdown/src/dropdown2.js.map +1 -1
- package/lib/components/form/index.d.ts +285 -210
- package/lib/components/form/index.js +10 -3
- package/lib/components/form/index.js.map +1 -1
- package/lib/components/form/src/form-item.d.ts +21 -0
- package/lib/components/form/src/form-item.js +42 -305
- package/lib/components/form/src/form-item.js.map +1 -1
- package/lib/components/form/src/form-item.vue.d.ts +104 -73
- package/lib/components/form/src/form-item2.js +257 -0
- package/lib/components/form/src/form-item2.js.map +1 -0
- package/lib/components/form/src/form-label-wrap.d.ts +11 -0
- package/lib/components/form/src/form-label-wrap.js +100 -0
- package/lib/components/form/src/form-label-wrap.js.map +1 -0
- package/lib/components/form/src/form.d.ts +25 -0
- package/lib/components/form/src/form.js +44 -208
- package/lib/components/form/src/form.js.map +1 -1
- package/lib/components/form/src/form.vue.d.ts +86 -76
- package/lib/components/form/src/form2.js +134 -0
- package/lib/components/form/src/form2.js.map +1 -0
- package/lib/components/form/src/types.d.ts +9 -0
- package/lib/components/form/src/types.js +3 -0
- package/lib/components/form/src/types.js.map +1 -0
- package/lib/components/form/src/utils.d.ts +9 -0
- package/lib/components/form/src/utils.js +53 -0
- package/lib/components/form/src/utils.js.map +1 -0
- package/lib/components/index.js +19 -0
- package/lib/components/index.js.map +1 -1
- package/lib/components/input/index.d.ts +1 -1
- package/lib/components/input/src/input.vue.d.ts +1 -1
- package/lib/components/input/src/input2.js +3 -2
- package/lib/components/input/src/input2.js.map +1 -1
- package/lib/components/input-number/index.d.ts +2 -2
- package/lib/components/input-number/src/input-number.vue.d.ts +2 -2
- package/lib/components/input-number/src/input-number2.js +2 -2
- package/lib/components/input-number/src/input-number2.js.map +1 -1
- package/lib/components/message-box/index.js +1 -0
- package/lib/components/message-box/index.js.map +1 -1
- package/lib/components/message-box/src/index.vue.d.ts +2 -2
- package/lib/components/message-box/src/message-box.type.d.ts +4 -3
- package/lib/components/message-box/src/messageBox.js +38 -55
- package/lib/components/message-box/src/messageBox.js.map +1 -1
- package/lib/components/popover/index.d.ts +2 -0
- package/lib/components/popover/src/index.js +6 -1
- package/lib/components/popover/src/index.js.map +1 -1
- package/lib/components/popover/src/index.vue.d.ts +1 -0
- package/lib/components/radio/index.d.ts +1 -1
- package/lib/components/radio/src/radio-group.vue.d.ts +10 -10
- package/lib/components/radio/src/radio-group2.js +3 -1
- package/lib/components/radio/src/radio-group2.js.map +1 -1
- package/lib/components/radio/src/radio.vue.d.ts +1 -1
- package/lib/components/rate/index.d.ts +1 -1
- package/lib/components/rate/src/rate.vue.d.ts +1 -1
- package/lib/components/rate/src/rate2.js +1 -1
- package/lib/components/rate/src/rate2.js.map +1 -1
- package/lib/components/scrollbar/index.d.ts +3 -3
- package/lib/components/scrollbar/src/scrollbar.d.ts +1 -1
- package/lib/components/scrollbar/src/scrollbar.js +1 -1
- package/lib/components/scrollbar/src/scrollbar.js.map +1 -1
- package/lib/components/scrollbar/src/scrollbar.vue.d.ts +3 -3
- package/lib/components/select/index.d.ts +9 -0
- package/lib/components/select/src/select.js +6 -2
- package/lib/components/select/src/select.js.map +1 -1
- package/lib/components/select/src/select.vue.d.ts +9 -0
- package/lib/components/select/src/useSelect.js +6 -5
- package/lib/components/select/src/useSelect.js.map +1 -1
- package/lib/components/select-v2/index.d.ts +24 -6
- package/lib/components/select-v2/src/defaults.d.ts +5 -1
- package/lib/components/select-v2/src/defaults.js +4 -0
- package/lib/components/select-v2/src/defaults.js.map +1 -1
- package/lib/components/select-v2/src/select.js +3 -3
- package/lib/components/select-v2/src/select.js.map +1 -1
- package/lib/components/select-v2/src/select.vue.d.ts +12 -3
- package/lib/components/select-v2/src/useSelect.js +2 -1
- package/lib/components/select-v2/src/useSelect.js.map +1 -1
- package/lib/components/slider/index.d.ts +2 -2
- package/lib/components/slider/src/index.js +2 -2
- package/lib/components/slider/src/index.js.map +1 -1
- package/lib/components/slider/src/index.vue.d.ts +1 -1
- package/lib/components/slider/src/useSlide.d.ts +2 -2
- package/lib/components/slider/src/useSlide.js +2 -2
- package/lib/components/slider/src/useSlide.js.map +1 -1
- package/lib/components/switch/src/switch2.js +2 -2
- package/lib/components/switch/src/switch2.js.map +1 -1
- package/lib/components/table/index.d.ts +4 -0
- package/lib/components/table/src/config.js +1 -1
- package/lib/components/table/src/config.js.map +1 -1
- package/lib/components/table/src/table/style-helper.d.ts +4 -0
- package/lib/components/table/src/table/style-helper.js +6 -1
- package/lib/components/table/src/table/style-helper.js.map +1 -1
- package/lib/components/table/src/table-column/index.js +11 -4
- package/lib/components/table/src/table-column/index.js.map +1 -1
- package/lib/components/table/src/table.js +7 -4
- package/lib/components/table/src/table.js.map +1 -1
- package/lib/components/table/src/table.vue.d.ts +4 -0
- package/lib/components/time-picker/src/common/picker.js +5 -4
- package/lib/components/time-picker/src/common/picker.js.map +1 -1
- package/lib/components/time-picker/src/common/picker.vue.d.ts +1 -1
- package/lib/components/transfer/src/index.js +5 -3
- package/lib/components/transfer/src/index.js.map +1 -1
- package/lib/components/upload/index.d.ts +807 -727
- package/lib/components/upload/index.js +18 -7
- package/lib/components/upload/index.js.map +1 -1
- package/lib/components/upload/src/ajax.d.ts +8 -2
- package/lib/components/upload/src/ajax.js +40 -34
- package/lib/components/upload/src/ajax.js.map +1 -1
- package/lib/components/upload/src/upload-content.d.ts +32 -0
- package/lib/components/upload/src/upload-content.js +43 -0
- package/lib/components/upload/src/upload-content.js.map +1 -0
- package/lib/components/upload/src/upload-content.vue.d.ts +165 -0
- package/lib/components/upload/src/upload-content2.js +176 -0
- package/lib/components/upload/src/upload-content2.js.map +1 -0
- package/lib/components/upload/src/upload-dragger.d.ts +11 -0
- package/lib/components/upload/src/upload-dragger.js +12 -67
- package/lib/components/upload/src/upload-dragger.js.map +1 -1
- package/lib/components/upload/src/upload-dragger.vue.d.ts +15 -11
- package/lib/components/upload/src/upload-dragger2.js +77 -0
- package/lib/components/upload/src/upload-dragger2.js.map +1 -0
- package/lib/components/upload/src/upload-list.d.ts +15 -0
- package/lib/components/upload/src/upload-list.js +24 -207
- package/lib/components/upload/src/upload-list.js.map +1 -1
- package/lib/components/upload/src/upload-list.vue.d.ts +148 -44
- package/lib/components/upload/src/upload-list2.js +177 -0
- package/lib/components/upload/src/upload-list2.js.map +1 -0
- package/lib/components/upload/src/upload.d.ts +97 -0
- package/lib/components/upload/src/upload.js +104 -264
- package/lib/components/upload/src/upload.js.map +1 -1
- package/lib/components/upload/src/upload.vue.d.ts +830 -292
- package/lib/components/upload/src/upload2.js +126 -0
- package/lib/components/upload/src/upload2.js.map +1 -0
- package/lib/components/upload/src/{useHandlers.d.ts → use-handlers.d.ts} +10 -13
- package/lib/components/upload/src/use-handlers.js +146 -0
- package/lib/components/upload/src/use-handlers.js.map +1 -0
- package/lib/hooks/use-common-props/index.js +3 -3
- package/lib/hooks/use-common-props/index.js.map +1 -1
- package/lib/hooks/use-form-item/index.d.ts +2 -2
- package/lib/hooks/use-form-item/index.js +2 -2
- package/lib/hooks/use-form-item/index.js.map +1 -1
- package/lib/index.js +24 -3
- package/lib/index.js.map +1 -1
- package/lib/tokens/form.d.ts +17 -37
- package/lib/tokens/form.js +4 -4
- package/lib/tokens/form.js.map +1 -1
- package/lib/tokens/index.d.ts +1 -0
- package/lib/tokens/index.js +4 -2
- package/lib/tokens/index.js.map +1 -1
- package/lib/tokens/upload.d.ts +5 -0
- package/lib/tokens/upload.js +8 -0
- package/lib/tokens/upload.js.map +1 -0
- package/lib/utils/error.d.ts +1 -0
- package/lib/utils/error.js +5 -1
- package/lib/utils/error.js.map +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/objects.d.ts +3 -5
- package/lib/utils/objects.js +10 -34
- package/lib/utils/objects.js.map +1 -1
- package/lib/utils/typescript.d.ts +1 -0
- package/lib/utils/typescript.js.map +1 -1
- 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-cascader.css +1 -1
- package/theme-chalk/el-dialog.css +1 -1
- package/theme-chalk/el-dropdown.css +1 -1
- package/theme-chalk/el-input.css +1 -1
- package/theme-chalk/el-select-v2.css +1 -1
- package/theme-chalk/el-select.css +1 -1
- package/theme-chalk/el-table.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/cascader-panel.scss +1 -1
- package/theme-chalk/src/cascader.scss +1 -1
- package/theme-chalk/src/common/transition.scss +2 -2
- package/theme-chalk/src/common/var.scss +1 -0
- package/theme-chalk/src/date-picker/date-table.scss +4 -4
- package/theme-chalk/src/dialog.scss +1 -1
- package/theme-chalk/src/dropdown.scss +5 -0
- package/theme-chalk/src/input.scss +12 -4
- package/theme-chalk/src/menu.scss +1 -1
- package/theme-chalk/src/option-item.scss +2 -2
- package/theme-chalk/src/page-header.scss +1 -1
- package/theme-chalk/src/pagination.scss +2 -2
- package/theme-chalk/src/select-v2.scss +8 -0
- package/theme-chalk/src/select.scss +0 -4
- package/theme-chalk/src/table.scss +2 -1
- package/web-types.json +1 -1
- package/es/components/form/src/form.type.d.ts +0 -5
- package/es/components/form/src/form.type.mjs +0 -2
- package/es/components/form/src/form.type.mjs.map +0 -1
- package/es/components/form/src/label-wrap.d.ts +0 -13
- package/es/components/form/src/label-wrap.mjs +0 -83
- package/es/components/form/src/label-wrap.mjs.map +0 -1
- package/es/components/upload/src/index.mjs +0 -220
- package/es/components/upload/src/index.mjs.map +0 -1
- package/es/components/upload/src/index.vue.d.ts +0 -282
- package/es/components/upload/src/upload.type.d.ts +0 -72
- package/es/components/upload/src/upload.type.mjs +0 -2
- package/es/components/upload/src/upload.type.mjs.map +0 -1
- package/es/components/upload/src/useHandlers.mjs +0 -143
- package/es/components/upload/src/useHandlers.mjs.map +0 -1
- package/lib/components/form/src/form.type.d.ts +0 -5
- package/lib/components/form/src/form.type.js +0 -3
- package/lib/components/form/src/form.type.js.map +0 -1
- package/lib/components/form/src/label-wrap.d.ts +0 -13
- package/lib/components/form/src/label-wrap.js +0 -87
- package/lib/components/form/src/label-wrap.js.map +0 -1
- package/lib/components/upload/src/index.js +0 -224
- package/lib/components/upload/src/index.js.map +0 -1
- package/lib/components/upload/src/index.vue.d.ts +0 -282
- package/lib/components/upload/src/upload.type.d.ts +0 -72
- package/lib/components/upload/src/upload.type.js +0 -3
- package/lib/components/upload/src/upload.type.js.map +0 -1
- package/lib/components/upload/src/useHandlers.js +0 -147
- package/lib/components/upload/src/useHandlers.js.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Arrayable } from 'element-plus/es/utils';
|
|
2
|
+
import type { FormItemContext } from 'element-plus/es/tokens';
|
|
3
|
+
import type { FormItemProps } from './form-item';
|
|
4
|
+
export declare function useFormLabelWidth(): {
|
|
5
|
+
autoLabelWidth: import("vue").ComputedRef<string>;
|
|
6
|
+
registerLabelWidth: (val: number, oldVal: number) => void;
|
|
7
|
+
deregisterLabelWidth: (val: number) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const filterFields: (fields: FormItemContext[], props: Arrayable<FormItemProps['prop']>) => FormItemContext[];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
require('../../../utils/index.js');
|
|
7
|
+
var error = require('../../../utils/error.js');
|
|
8
|
+
var lodashUnified = require('lodash-unified');
|
|
9
|
+
|
|
10
|
+
const SCOPE = "ElForm";
|
|
11
|
+
function useFormLabelWidth() {
|
|
12
|
+
const potentialLabelWidthArr = vue.ref([]);
|
|
13
|
+
const autoLabelWidth = vue.computed(() => {
|
|
14
|
+
if (!potentialLabelWidthArr.value.length)
|
|
15
|
+
return "0";
|
|
16
|
+
const max = Math.max(...potentialLabelWidthArr.value);
|
|
17
|
+
return max ? `${max}px` : "";
|
|
18
|
+
});
|
|
19
|
+
function getLabelWidthIndex(width) {
|
|
20
|
+
const index = potentialLabelWidthArr.value.indexOf(width);
|
|
21
|
+
if (index === -1) {
|
|
22
|
+
error.debugWarn(SCOPE, `unexpected width ${width}`);
|
|
23
|
+
}
|
|
24
|
+
return index;
|
|
25
|
+
}
|
|
26
|
+
function registerLabelWidth(val, oldVal) {
|
|
27
|
+
if (val && oldVal) {
|
|
28
|
+
const index = getLabelWidthIndex(oldVal);
|
|
29
|
+
potentialLabelWidthArr.value.splice(index, 1, val);
|
|
30
|
+
} else if (val) {
|
|
31
|
+
potentialLabelWidthArr.value.push(val);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function deregisterLabelWidth(val) {
|
|
35
|
+
const index = getLabelWidthIndex(val);
|
|
36
|
+
if (index > -1) {
|
|
37
|
+
potentialLabelWidthArr.value.splice(index, 1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
autoLabelWidth,
|
|
42
|
+
registerLabelWidth,
|
|
43
|
+
deregisterLabelWidth
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const filterFields = (fields, props) => {
|
|
47
|
+
const normalized = lodashUnified.castArray(props);
|
|
48
|
+
return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.filterFields = filterFields;
|
|
52
|
+
exports.useFormLabelWidth = useFormLabelWidth;
|
|
53
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../packages/components/form/src/utils.ts"],"sourcesContent":["import { computed, ref } from 'vue'\nimport { debugWarn, ensureArray } from '@element-plus/utils'\nimport type { Arrayable } from '@element-plus/utils'\nimport type { FormItemContext } from '@element-plus/tokens'\nimport type { FormItemProps } from './form-item'\n\nconst SCOPE = 'ElForm'\n\nexport function useFormLabelWidth() {\n const potentialLabelWidthArr = ref<number[]>([])\n\n const autoLabelWidth = computed(() => {\n if (!potentialLabelWidthArr.value.length) return '0'\n const max = Math.max(...potentialLabelWidthArr.value)\n return max ? `${max}px` : ''\n })\n\n function getLabelWidthIndex(width: number) {\n const index = potentialLabelWidthArr.value.indexOf(width)\n if (index === -1) {\n debugWarn(SCOPE, `unexpected width ${width}`)\n }\n return index\n }\n\n function registerLabelWidth(val: number, oldVal: number) {\n if (val && oldVal) {\n const index = getLabelWidthIndex(oldVal)\n potentialLabelWidthArr.value.splice(index, 1, val)\n } else if (val) {\n potentialLabelWidthArr.value.push(val)\n }\n }\n\n function deregisterLabelWidth(val: number) {\n const index = getLabelWidthIndex(val)\n if (index > -1) {\n potentialLabelWidthArr.value.splice(index, 1)\n }\n }\n\n return {\n autoLabelWidth,\n registerLabelWidth,\n deregisterLabelWidth,\n }\n}\n\nexport const filterFields = (\n fields: FormItemContext[],\n props: Arrayable<FormItemProps['prop']>\n) => {\n const normalized = ensureArray(props)\n return normalized.length > 0\n ? fields.filter((field) => field.prop && normalized.includes(field.prop))\n : fields\n}\n"],"names":["ref","computed","debugWarn","ensureArray"],"mappings":";;;;;;;;;AAEA,MAAM,KAAK,GAAG,QAAQ,CAAC;AAChB,SAAS,iBAAiB,GAAG;AACpC,EAAE,MAAM,sBAAsB,GAAGA,OAAG,CAAC,EAAE,CAAC,CAAC;AACzC,EAAE,MAAM,cAAc,GAAGC,YAAQ,CAAC,MAAM;AACxC,IAAI,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,MAAM;AAC5C,MAAM,OAAO,GAAG,CAAC;AACjB,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;AAC1D,IAAI,OAAO,GAAG,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC;AACjC,GAAG,CAAC,CAAC;AACL,EAAE,SAAS,kBAAkB,CAAC,KAAK,EAAE;AACrC,IAAI,MAAM,KAAK,GAAG,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9D,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;AACtB,MAAMC,eAAS,CAAC,KAAK,EAAE,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AACpD,KAAK;AACL,IAAI,OAAO,KAAK,CAAC;AACjB,GAAG;AACH,EAAE,SAAS,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE;AAC3C,IAAI,IAAI,GAAG,IAAI,MAAM,EAAE;AACvB,MAAM,MAAM,KAAK,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC/C,MAAM,sBAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;AACzD,KAAK,MAAM,IAAI,GAAG,EAAE;AACpB,MAAM,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7C,KAAK;AACL,GAAG;AACH,EAAE,SAAS,oBAAoB,CAAC,GAAG,EAAE;AACrC,IAAI,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;AAC1C,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE;AACpB,MAAM,sBAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACpD,KAAK;AACL,GAAG;AACH,EAAE,OAAO;AACT,IAAI,cAAc;AAClB,IAAI,kBAAkB;AACtB,IAAI,oBAAoB;AACxB,GAAG,CAAC;AACJ,CAAC;AACW,MAAC,YAAY,GAAG,CAAC,MAAM,EAAE,KAAK,KAAK;AAC/C,EAAE,MAAM,UAAU,GAAGC,uBAAW,CAAC,KAAK,CAAC,CAAC;AACxC,EAAE,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC;AAClH;;;;;"}
|
package/lib/components/index.js
CHANGED
|
@@ -99,6 +99,8 @@ var drawer = require('./drawer/src/drawer.js');
|
|
|
99
99
|
var dropdown = require('./dropdown/src/dropdown.js');
|
|
100
100
|
var tokens = require('./dropdown/src/tokens.js');
|
|
101
101
|
var empty = require('./empty/src/empty.js');
|
|
102
|
+
var form = require('./form/src/form.js');
|
|
103
|
+
var formItem = require('./form/src/form-item.js');
|
|
102
104
|
var icon = require('./icon/src/icon.js');
|
|
103
105
|
var image = require('./image/src/image.js');
|
|
104
106
|
var imageViewer = require('./image-viewer/src/image-viewer.js');
|
|
@@ -150,6 +152,10 @@ var timelineItem = require('./timeline/src/timeline-item.js');
|
|
|
150
152
|
var tooltip = require('./tooltip/src/tooltip.js');
|
|
151
153
|
var tokens$2 = require('./tooltip/src/tokens.js');
|
|
152
154
|
var event = require('../constants/event.js');
|
|
155
|
+
var upload = require('./upload/src/upload.js');
|
|
156
|
+
var uploadContent = require('./upload/src/upload-content.js');
|
|
157
|
+
var uploadList = require('./upload/src/upload-list.js');
|
|
158
|
+
var uploadDragger = require('./upload/src/upload-dragger.js');
|
|
153
159
|
var fixedSizeList = require('./virtual-list/src/components/fixed-size-list.js');
|
|
154
160
|
var dynamicSizeList = require('./virtual-list/src/components/dynamic-size-list.js');
|
|
155
161
|
var fixedSizeGrid = require('./virtual-list/src/components/fixed-size-grid.js');
|
|
@@ -313,6 +319,10 @@ exports.dropdownMenuProps = dropdown.dropdownMenuProps;
|
|
|
313
319
|
exports.dropdownProps = dropdown.dropdownProps;
|
|
314
320
|
exports.DROPDOWN_INJECTION_KEY = tokens.DROPDOWN_INJECTION_KEY;
|
|
315
321
|
exports.emptyProps = empty.emptyProps;
|
|
322
|
+
exports.formEmits = form.formEmits;
|
|
323
|
+
exports.formProps = form.formProps;
|
|
324
|
+
exports.formItemProps = formItem.formItemProps;
|
|
325
|
+
exports.formItemValidateStates = formItem.formItemValidateStates;
|
|
316
326
|
exports.iconProps = icon.iconProps;
|
|
317
327
|
exports.imageEmits = image.imageEmits;
|
|
318
328
|
exports.imageProps = image.imageProps;
|
|
@@ -399,6 +409,15 @@ exports.useTooltipProps = tooltip.useTooltipProps;
|
|
|
399
409
|
exports.useTooltipTriggerProps = tooltip.useTooltipTriggerProps;
|
|
400
410
|
exports.TOOLTIP_INJECTION_KEY = tokens$2.TOOLTIP_INJECTION_KEY;
|
|
401
411
|
exports.CHANGE_EVENT = event.CHANGE_EVENT;
|
|
412
|
+
exports.genFileId = upload.genFileId;
|
|
413
|
+
exports.uploadBaseProps = upload.uploadBaseProps;
|
|
414
|
+
exports.uploadListTypes = upload.uploadListTypes;
|
|
415
|
+
exports.uploadProps = upload.uploadProps;
|
|
416
|
+
exports.uploadContentProps = uploadContent.uploadContentProps;
|
|
417
|
+
exports.uploadListEmits = uploadList.uploadListEmits;
|
|
418
|
+
exports.uploadListProps = uploadList.uploadListProps;
|
|
419
|
+
exports.uploadDraggerEmits = uploadDragger.uploadDraggerEmits;
|
|
420
|
+
exports.uploadDraggerProps = uploadDragger.uploadDraggerProps;
|
|
402
421
|
exports.FixedSizeList = fixedSizeList["default"];
|
|
403
422
|
exports.DynamicSizeList = dynamicSizeList["default"];
|
|
404
423
|
exports.FixedSizeGrid = fixedSizeGrid["default"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -138,8 +138,8 @@ export declare const ElInput: import("element-plus/es/utils").SFCWithInstall<imp
|
|
|
138
138
|
type: string;
|
|
139
139
|
size: import("element-plus/es/utils").BuildPropType<StringConstructor, "default" | "small" | "large", never>;
|
|
140
140
|
disabled: boolean;
|
|
141
|
-
modelValue: import("element-plus/es/utils").BuildPropType<import("element-plus/es/utils").PropWrapper<string | number | null | undefined>, unknown, unknown>;
|
|
142
141
|
label: string;
|
|
142
|
+
modelValue: import("element-plus/es/utils").BuildPropType<import("element-plus/es/utils").PropWrapper<string | number | null | undefined>, unknown, unknown>;
|
|
143
143
|
resize: import("element-plus/es/utils").BuildPropType<StringConstructor, "none" | "both" | "horizontal" | "vertical", unknown>;
|
|
144
144
|
autosize: boolean | {
|
|
145
145
|
minRows?: number | undefined;
|
|
@@ -139,8 +139,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
139
139
|
type: string;
|
|
140
140
|
size: import("element-plus/es/utils").BuildPropType<StringConstructor, "default" | "small" | "large", never>;
|
|
141
141
|
disabled: boolean;
|
|
142
|
-
modelValue: import("element-plus/es/utils").BuildPropType<import("element-plus/es/utils").PropWrapper<string | number | null | undefined>, unknown, unknown>;
|
|
143
142
|
label: string;
|
|
143
|
+
modelValue: import("element-plus/es/utils").BuildPropType<import("element-plus/es/utils").PropWrapper<string | number | null | undefined>, unknown, unknown>;
|
|
144
144
|
resize: import("element-plus/es/utils").BuildPropType<StringConstructor, "none" | "both" | "horizontal" | "vertical", unknown>;
|
|
145
145
|
autosize: boolean | {
|
|
146
146
|
minRows?: number | undefined;
|
|
@@ -19,6 +19,7 @@ var index$4 = require('../../../hooks/use-namespace/index.js');
|
|
|
19
19
|
var icon = require('../../../utils/vue/icon.js');
|
|
20
20
|
var shared = require('@vue/shared');
|
|
21
21
|
var event = require('../../../constants/event.js');
|
|
22
|
+
var error = require('../../../utils/error.js');
|
|
22
23
|
var i18n = require('../../../utils/i18n.js');
|
|
23
24
|
|
|
24
25
|
const PENDANT_MAP = {
|
|
@@ -138,7 +139,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
138
139
|
focused.value = false;
|
|
139
140
|
emit("blur", event);
|
|
140
141
|
if (props.validateEvent) {
|
|
141
|
-
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur");
|
|
142
|
+
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => error.debugWarn(err));
|
|
142
143
|
}
|
|
143
144
|
};
|
|
144
145
|
const select = () => {
|
|
@@ -178,7 +179,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
178
179
|
var _a;
|
|
179
180
|
vue.nextTick(resizeTextarea);
|
|
180
181
|
if (props.validateEvent) {
|
|
181
|
-
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change");
|
|
182
|
+
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => error.debugWarn(err));
|
|
182
183
|
}
|
|
183
184
|
});
|
|
184
185
|
vue.watch(nativeInputValue, () => setNativeInputValue());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input2.js","sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <div\n v-show=\"type !== 'hidden'\"\n :class=\"[\n type === 'textarea' ? nsTextarea.b() : nsInput.b(),\n nsInput.m(inputSize),\n nsInput.is('disabled', inputDisabled),\n nsInput.is('exceed', inputExceed),\n {\n [nsInput.b('group')]: $slots.prepend || $slots.append,\n [nsInput.bm('group', 'append')]: $slots.append,\n [nsInput.bm('group', 'prepend')]: $slots.prepend,\n [nsInput.m('prefix')]: $slots.prefix || prefixIcon,\n [nsInput.m('suffix')]:\n $slots.suffix || suffixIcon || clearable || showPassword,\n [nsInput.m('suffix--password-clear')]: showClear && showPwdVisible,\n },\n $attrs.class,\n ]\"\n :style=\"containerStyle\"\n @mouseenter=\"onMouseEnter\"\n @mouseleave=\"onMouseLeave\"\n >\n <!-- input -->\n <template v-if=\"type !== 'textarea'\">\n <!-- prepend slot -->\n <div v-if=\"$slots.prepend\" :class=\"nsInput.be('group', 'prepend')\">\n <slot name=\"prepend\" />\n </div>\n\n <input\n ref=\"input\"\n :class=\"nsInput.e('inner')\"\n v-bind=\"attrs\"\n :type=\"showPassword ? (passwordVisible ? 'text' : 'password') : type\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :tabindex=\"tabindex\"\n :aria-label=\"label\"\n :placeholder=\"placeholder\"\n :style=\"inputStyle\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n\n <!-- prefix slot -->\n <span v-if=\"$slots.prefix || prefixIcon\" :class=\"nsInput.e('prefix')\">\n <span :class=\"nsInput.e('prefix-inner')\">\n <slot name=\"prefix\"></slot>\n <el-icon v-if=\"prefixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"prefixIcon\" />\n </el-icon>\n </span>\n </span>\n\n <!-- suffix slot -->\n <span v-if=\"suffixVisible\" :class=\"nsInput.e('suffix')\">\n <span :class=\"nsInput.e('suffix-inner')\">\n <template v-if=\"!showClear || !showPwdVisible || !isWordLimitVisible\">\n <slot name=\"suffix\"></slot>\n <el-icon v-if=\"suffixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"suffixIcon\" />\n </el-icon>\n </template>\n <el-icon\n v-if=\"showClear\"\n :class=\"[nsInput.e('icon'), nsInput.e('clear')]\"\n @mousedown.prevent\n @click=\"clear\"\n >\n <circle-close />\n </el-icon>\n <el-icon\n v-if=\"showPwdVisible\"\n :class=\"[nsInput.e('icon'), nsInput.e('clear')]\"\n @click=\"handlePasswordVisible\"\n >\n <icon-view />\n </el-icon>\n <span v-if=\"isWordLimitVisible\" :class=\"nsInput.e('count')\">\n <span :class=\"nsInput.e('count-inner')\">\n {{ textLength }} / {{ attrs.maxlength }}\n </span>\n </span>\n </span>\n <el-icon\n v-if=\"validateState && validateIcon && needStatusIcon\"\n :class=\"[nsInput.e('icon'), nsInput.e('validateIcon')]\"\n >\n <component :is=\"validateIcon\" />\n </el-icon>\n </span>\n\n <!-- append slot -->\n <div v-if=\"$slots.append\" :class=\"nsInput.be('group', 'append')\">\n <slot name=\"append\" />\n </div>\n </template>\n\n <!-- textarea -->\n <template v-else>\n <textarea\n ref=\"textarea\"\n :class=\"nsTextarea.e('inner')\"\n v-bind=\"attrs\"\n :tabindex=\"tabindex\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :style=\"computedTextareaStyle\"\n :aria-label=\"label\"\n :placeholder=\"placeholder\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n <span v-if=\"isWordLimitVisible\" :class=\"nsInput.e('count')\">\n {{ textLength }} / {{ attrs.maxlength }}\n </span>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport {\n defineComponent,\n computed,\n watch,\n nextTick,\n getCurrentInstance,\n ref,\n shallowRef,\n onMounted,\n onUpdated,\n} from 'vue'\nimport { isClient } from '@vueuse/core'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { CircleClose, View as IconView } from '@element-plus/icons-vue'\nimport { ValidateComponentsMap, isObject, isKorean } from '@element-plus/utils'\nimport {\n useAttrs,\n useDisabled,\n useFormItem,\n useSize,\n useNamespace,\n} from '@element-plus/hooks'\nimport { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { calcTextareaHeight } from './calc-textarea-height'\nimport { inputProps, inputEmits } from './input'\n\nimport type { StyleValue } from 'vue'\n\ntype TargetElement = HTMLInputElement | HTMLTextAreaElement\n\nconst PENDANT_MAP = {\n suffix: 'append',\n prefix: 'prepend',\n} as const\n\nexport default defineComponent({\n name: 'ElInput',\n\n components: { ElIcon, CircleClose, IconView },\n\n inheritAttrs: false,\n\n props: inputProps,\n emits: inputEmits,\n\n setup(props, { slots, emit, attrs: rawAttrs }) {\n const instance = getCurrentInstance()!\n const attrs = useAttrs()\n\n const { form, formItem } = useFormItem()\n const inputSize = useSize()\n const inputDisabled = useDisabled()\n const nsInput = useNamespace('input')\n const nsTextarea = useNamespace('textarea')\n\n const input = ref<HTMLInputElement>()\n const textarea = ref<HTMLTextAreaElement>()\n const focused = ref(false)\n const hovering = ref(false)\n const isComposing = ref(false)\n const passwordVisible = ref(false)\n const _textareaCalcStyle = shallowRef(props.inputStyle)\n\n const inputOrTextarea = computed(() => input.value || textarea.value)\n\n const needStatusIcon = computed(() => form?.statusIcon ?? false)\n const validateState = computed(() => formItem?.validateState || '')\n const validateIcon = computed(\n () => ValidateComponentsMap[validateState.value]\n )\n const containerStyle = computed(() => rawAttrs.style as StyleValue)\n const computedTextareaStyle = computed<StyleValue>(() => [\n props.inputStyle,\n _textareaCalcStyle.value,\n { resize: props.resize },\n ])\n const nativeInputValue = computed(() =>\n props.modelValue === null || props.modelValue === undefined\n ? ''\n : String(props.modelValue)\n )\n const showClear = computed(\n () =>\n props.clearable &&\n !inputDisabled.value &&\n !props.readonly &&\n !!nativeInputValue.value &&\n (focused.value || hovering.value)\n )\n const showPwdVisible = computed(\n () =>\n props.showPassword &&\n !inputDisabled.value &&\n !props.readonly &&\n (!!nativeInputValue.value || focused.value)\n )\n const isWordLimitVisible = computed(\n () =>\n props.showWordLimit &&\n !!attrs.value.maxlength &&\n (props.type === 'text' || props.type === 'textarea') &&\n !inputDisabled.value &&\n !props.readonly &&\n !props.showPassword\n )\n const textLength = computed(() => Array.from(nativeInputValue.value).length)\n const inputExceed = computed(\n () =>\n // show exceed style if length of initial value greater then maxlength\n !!isWordLimitVisible.value &&\n textLength.value > Number(attrs.value.maxlength)\n )\n\n const resizeTextarea = () => {\n const { type, autosize } = props\n\n if (!isClient || type !== 'textarea') return\n\n if (autosize) {\n const minRows = isObject(autosize) ? autosize.minRows : undefined\n const maxRows = isObject(autosize) ? autosize.maxRows : undefined\n _textareaCalcStyle.value = {\n ...calcTextareaHeight(textarea.value!, minRows, maxRows),\n }\n } else {\n _textareaCalcStyle.value = {\n minHeight: calcTextareaHeight(textarea.value!).minHeight,\n }\n }\n }\n\n const setNativeInputValue = () => {\n const input = inputOrTextarea.value\n if (!input || input.value === nativeInputValue.value) return\n input.value = nativeInputValue.value\n }\n\n const calcIconOffset = (place: 'prefix' | 'suffix') => {\n const { el } = instance.vnode\n if (!el) return\n const elList: HTMLSpanElement[] = Array.from(\n el.querySelectorAll(`.${nsInput.e(place)}`)\n )\n const target = elList.find((item) => item.parentNode === el)\n\n if (!target) return\n\n const pendant = PENDANT_MAP[place]\n\n if (slots[pendant]) {\n target.style.transform = `translateX(${place === 'suffix' ? '-' : ''}${\n el.querySelector(`.${nsInput.be('group', pendant)}`).offsetWidth\n }px)`\n } else {\n target.removeAttribute('style')\n }\n }\n\n const updateIconOffset = () => {\n calcIconOffset('prefix')\n calcIconOffset('suffix')\n }\n\n const handleInput = (event: Event) => {\n const { value } = event.target as TargetElement\n\n // should not emit input during composition\n // see: https://github.com/ElemeFE/element/issues/10516\n if (isComposing.value) return\n\n // hack for https://github.com/ElemeFE/element/issues/8548\n // should remove the following line when we don't support IE\n if (value === nativeInputValue.value) return\n\n emit(UPDATE_MODEL_EVENT, value)\n emit('input', value)\n\n // ensure native input value is controlled\n // see: https://github.com/ElemeFE/element/issues/12850\n nextTick(setNativeInputValue)\n }\n\n const handleChange = (event: Event) => {\n emit('change', (event.target as TargetElement).value)\n }\n\n const focus = () => {\n // see: https://github.com/ElemeFE/element/issues/18573\n nextTick(() => {\n inputOrTextarea.value?.focus()\n })\n }\n\n const blur = () => {\n inputOrTextarea.value?.blur()\n }\n\n const handleFocus = (event: FocusEvent) => {\n focused.value = true\n emit('focus', event)\n }\n\n const handleBlur = (event: FocusEvent) => {\n focused.value = false\n emit('blur', event)\n if (props.validateEvent) {\n formItem?.validate?.('blur')\n }\n }\n\n const select = () => {\n inputOrTextarea.value?.select()\n }\n\n const handleCompositionStart = (event: CompositionEvent) => {\n emit('compositionstart', event)\n isComposing.value = true\n }\n\n const handleCompositionUpdate = (event: CompositionEvent) => {\n emit('compositionupdate', event)\n const text = (event.target as HTMLInputElement)?.value\n const lastCharacter = text[text.length - 1] || ''\n isComposing.value = !isKorean(lastCharacter)\n }\n\n const handleCompositionEnd = (event: CompositionEvent) => {\n emit('compositionend', event)\n if (isComposing.value) {\n isComposing.value = false\n handleInput(event)\n }\n }\n\n const clear = () => {\n emit(UPDATE_MODEL_EVENT, '')\n emit('change', '')\n emit('clear')\n emit('input', '')\n }\n\n const handlePasswordVisible = () => {\n passwordVisible.value = !passwordVisible.value\n focus()\n }\n\n const suffixVisible = computed(\n () =>\n !!slots.suffix ||\n !!props.suffixIcon ||\n showClear.value ||\n props.showPassword ||\n isWordLimitVisible.value ||\n (!!validateState.value && needStatusIcon.value)\n )\n\n watch(\n () => props.modelValue,\n () => {\n nextTick(resizeTextarea)\n if (props.validateEvent) {\n formItem?.validate?.('change')\n }\n }\n )\n\n // native input value is set explicitly\n // do not use v-model / :value in template\n // see: https://github.com/ElemeFE/element/issues/14521\n watch(nativeInputValue, () => setNativeInputValue())\n\n // when change between <input> and <textarea>,\n // update DOM dependent value and styles\n // https://github.com/ElemeFE/element/issues/14857\n watch(\n () => props.type,\n () => {\n nextTick(() => {\n setNativeInputValue()\n resizeTextarea()\n updateIconOffset()\n })\n }\n )\n\n onMounted(() => {\n setNativeInputValue()\n updateIconOffset()\n nextTick(resizeTextarea)\n })\n\n onUpdated(() => {\n nextTick(updateIconOffset)\n })\n\n const onMouseLeave = (evt: MouseEvent) => {\n hovering.value = false\n emit('mouseleave', evt)\n }\n\n const onMouseEnter = (evt: MouseEvent) => {\n hovering.value = true\n emit('mouseenter', evt)\n }\n\n const handleKeydown = (evt: KeyboardEvent) => {\n emit('keydown', evt)\n }\n\n return {\n input,\n textarea,\n attrs,\n inputSize,\n validateState,\n validateIcon,\n containerStyle,\n computedTextareaStyle,\n inputDisabled,\n showClear,\n showPwdVisible,\n isWordLimitVisible,\n textLength,\n hovering,\n inputExceed,\n passwordVisible,\n inputOrTextarea,\n suffixVisible,\n needStatusIcon,\n\n resizeTextarea,\n handleInput,\n handleChange,\n handleFocus,\n handleBlur,\n handleCompositionStart,\n handleCompositionUpdate,\n handleCompositionEnd,\n handlePasswordVisible,\n clear,\n select,\n focus,\n blur,\n onMouseLeave,\n onMouseEnter,\n handleKeydown,\n\n nsInput,\n nsTextarea,\n }\n },\n})\n</script>\n"],"names":["defineComponent","ElIcon","CircleClose","IconView","inputProps","inputEmits","getCurrentInstance","useAttrs","useFormItem","useSize","useDisabled","useNamespace","ref","shallowRef","computed","_withDirectives","_renderSlot","_openBlock","_createVNode","_createElementBlock","_createCommentVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsKA,MAAM,cAAc;AAAA,EAClB,QAAQ;AAAA,EACR,QAAQ;AAAA;AAGV,MAAK,YAAaA,oBAAa;AAAA,EAC7B,MAAM;AAAA,EAEN,YAAY,UAAEC,2BAAQC,gCAAaC;AAAA,EAEnC,cAAc;AAAA,EAEd,OAAOC;AAAA,EACP,OAAOC;AAAA,EAEP,MAAM,OAAO,EAAE,OAAO,MAAM,OAAO,YAAY;AAC7C,UAAM,WAAWC;AACjB,UAAM,QAAQC;AAEd,UAAM,EAAE,MAAM,aAAaC;AAC3B,UAAM,YAAYC;AAClB,UAAM,gBAAgBC;AACtB,UAAM,UAAUC,qBAAa;AAC7B,UAAM,aAAaA,qBAAa;AAEhC,UAAM,QAAQC;AACd,UAAM,WA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R,WAAO;AAAE;;AAGZ;AAQO;QAPmC,OAAK,gBAAE,aAAQ;AAAC;QACxD;AAKO,gDALgB;AAAA;UACrB;AAA2B;AAGjB;;AAFkC;;AACZ;AAAd;AAAA;;;;;AAKtB;AAoCO;eAnC0BC;AAAW;;AA4BnC,iBA3BK;AAAW;WACJ;AAKN;AAJkB;AAGjB;;AAFkC;;AACZ;AAAd;AAAA;;;;AAUV;;AAL6B;AACrC;AAAkB;AACV;;AAEQ;AAAA;AAAA;;+CAElB;AAMU;YAJP,OAAK;AAA+B;AAC7B;;AAEK,cAAb;AAAa;AAAA;;;AAMR;YAJ0B,OAAK;AAAW;YAC/C;AAEO,cAFAC;AAAgB;AACgB;;sDAKFC;AAI/B;iBAHF,oBAAG,aAAQ,EAAC,SAAU;AAAS;;AAEL,oEAAhB;AAAA;AAAA;;;;AAIpB,iEAGM;AAAA;;AAFsC;;AACpB;;AA6Bf;AAzBX,MAEEC,uBAmBE;AAAA;AAlBI,QACH;AAAmB;AACP;AACF,QACVJ;AAAU;AACA;AACI;AACP;AACK,QACZ;AAAa,QACb;AAAkB;AACC,QACnB;AAAgB,QAChB;AAAO,QACP;AAAO,QACP;AAAM,QACN;AAAQ,QACR;AAAS;mEAIL;AAAA;QAF0B;AAAgB,0BAC5C,mBAAa,QAAG;;;2BA/HX;AAAA;AAAA;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"input2.js","sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <div\n v-show=\"type !== 'hidden'\"\n :class=\"[\n type === 'textarea' ? nsTextarea.b() : nsInput.b(),\n nsInput.m(inputSize),\n nsInput.is('disabled', inputDisabled),\n nsInput.is('exceed', inputExceed),\n {\n [nsInput.b('group')]: $slots.prepend || $slots.append,\n [nsInput.bm('group', 'append')]: $slots.append,\n [nsInput.bm('group', 'prepend')]: $slots.prepend,\n [nsInput.m('prefix')]: $slots.prefix || prefixIcon,\n [nsInput.m('suffix')]:\n $slots.suffix || suffixIcon || clearable || showPassword,\n [nsInput.m('suffix--password-clear')]: showClear && showPwdVisible,\n },\n $attrs.class,\n ]\"\n :style=\"containerStyle\"\n @mouseenter=\"onMouseEnter\"\n @mouseleave=\"onMouseLeave\"\n >\n <!-- input -->\n <template v-if=\"type !== 'textarea'\">\n <!-- prepend slot -->\n <div v-if=\"$slots.prepend\" :class=\"nsInput.be('group', 'prepend')\">\n <slot name=\"prepend\" />\n </div>\n\n <input\n ref=\"input\"\n :class=\"nsInput.e('inner')\"\n v-bind=\"attrs\"\n :type=\"showPassword ? (passwordVisible ? 'text' : 'password') : type\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :tabindex=\"tabindex\"\n :aria-label=\"label\"\n :placeholder=\"placeholder\"\n :style=\"inputStyle\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n\n <!-- prefix slot -->\n <span v-if=\"$slots.prefix || prefixIcon\" :class=\"nsInput.e('prefix')\">\n <span :class=\"nsInput.e('prefix-inner')\">\n <slot name=\"prefix\"></slot>\n <el-icon v-if=\"prefixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"prefixIcon\" />\n </el-icon>\n </span>\n </span>\n\n <!-- suffix slot -->\n <span v-if=\"suffixVisible\" :class=\"nsInput.e('suffix')\">\n <span :class=\"nsInput.e('suffix-inner')\">\n <template v-if=\"!showClear || !showPwdVisible || !isWordLimitVisible\">\n <slot name=\"suffix\"></slot>\n <el-icon v-if=\"suffixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"suffixIcon\" />\n </el-icon>\n </template>\n <el-icon\n v-if=\"showClear\"\n :class=\"[nsInput.e('icon'), nsInput.e('clear')]\"\n @mousedown.prevent\n @click=\"clear\"\n >\n <circle-close />\n </el-icon>\n <el-icon\n v-if=\"showPwdVisible\"\n :class=\"[nsInput.e('icon'), nsInput.e('clear')]\"\n @click=\"handlePasswordVisible\"\n >\n <icon-view />\n </el-icon>\n <span v-if=\"isWordLimitVisible\" :class=\"nsInput.e('count')\">\n <span :class=\"nsInput.e('count-inner')\">\n {{ textLength }} / {{ attrs.maxlength }}\n </span>\n </span>\n </span>\n <el-icon\n v-if=\"validateState && validateIcon && needStatusIcon\"\n :class=\"[nsInput.e('icon'), nsInput.e('validateIcon')]\"\n >\n <component :is=\"validateIcon\" />\n </el-icon>\n </span>\n\n <!-- append slot -->\n <div v-if=\"$slots.append\" :class=\"nsInput.be('group', 'append')\">\n <slot name=\"append\" />\n </div>\n </template>\n\n <!-- textarea -->\n <template v-else>\n <textarea\n ref=\"textarea\"\n :class=\"nsTextarea.e('inner')\"\n v-bind=\"attrs\"\n :tabindex=\"tabindex\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :style=\"computedTextareaStyle\"\n :aria-label=\"label\"\n :placeholder=\"placeholder\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n <span v-if=\"isWordLimitVisible\" :class=\"nsInput.e('count')\">\n {{ textLength }} / {{ attrs.maxlength }}\n </span>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport {\n defineComponent,\n computed,\n watch,\n nextTick,\n getCurrentInstance,\n ref,\n shallowRef,\n onMounted,\n onUpdated,\n} from 'vue'\nimport { isClient } from '@vueuse/core'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { CircleClose, View as IconView } from '@element-plus/icons-vue'\nimport {\n ValidateComponentsMap,\n isObject,\n isKorean,\n debugWarn,\n} from '@element-plus/utils'\nimport {\n useAttrs,\n useDisabled,\n useFormItem,\n useSize,\n useNamespace,\n} from '@element-plus/hooks'\nimport { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { calcTextareaHeight } from './calc-textarea-height'\nimport { inputProps, inputEmits } from './input'\n\nimport type { StyleValue } from 'vue'\n\ntype TargetElement = HTMLInputElement | HTMLTextAreaElement\n\nconst PENDANT_MAP = {\n suffix: 'append',\n prefix: 'prepend',\n} as const\n\nexport default defineComponent({\n name: 'ElInput',\n\n components: { ElIcon, CircleClose, IconView },\n\n inheritAttrs: false,\n\n props: inputProps,\n emits: inputEmits,\n\n setup(props, { slots, emit, attrs: rawAttrs }) {\n const instance = getCurrentInstance()!\n const attrs = useAttrs()\n\n const { form, formItem } = useFormItem()\n const inputSize = useSize()\n const inputDisabled = useDisabled()\n const nsInput = useNamespace('input')\n const nsTextarea = useNamespace('textarea')\n\n const input = ref<HTMLInputElement>()\n const textarea = ref<HTMLTextAreaElement>()\n const focused = ref(false)\n const hovering = ref(false)\n const isComposing = ref(false)\n const passwordVisible = ref(false)\n const _textareaCalcStyle = shallowRef(props.inputStyle)\n\n const inputOrTextarea = computed(() => input.value || textarea.value)\n\n const needStatusIcon = computed(() => form?.statusIcon ?? false)\n const validateState = computed(() => formItem?.validateState || '')\n const validateIcon = computed(\n () => ValidateComponentsMap[validateState.value]\n )\n const containerStyle = computed(() => rawAttrs.style as StyleValue)\n const computedTextareaStyle = computed<StyleValue>(() => [\n props.inputStyle,\n _textareaCalcStyle.value,\n { resize: props.resize },\n ])\n const nativeInputValue = computed(() =>\n props.modelValue === null || props.modelValue === undefined\n ? ''\n : String(props.modelValue)\n )\n const showClear = computed(\n () =>\n props.clearable &&\n !inputDisabled.value &&\n !props.readonly &&\n !!nativeInputValue.value &&\n (focused.value || hovering.value)\n )\n const showPwdVisible = computed(\n () =>\n props.showPassword &&\n !inputDisabled.value &&\n !props.readonly &&\n (!!nativeInputValue.value || focused.value)\n )\n const isWordLimitVisible = computed(\n () =>\n props.showWordLimit &&\n !!attrs.value.maxlength &&\n (props.type === 'text' || props.type === 'textarea') &&\n !inputDisabled.value &&\n !props.readonly &&\n !props.showPassword\n )\n const textLength = computed(() => Array.from(nativeInputValue.value).length)\n const inputExceed = computed(\n () =>\n // show exceed style if length of initial value greater then maxlength\n !!isWordLimitVisible.value &&\n textLength.value > Number(attrs.value.maxlength)\n )\n\n const resizeTextarea = () => {\n const { type, autosize } = props\n\n if (!isClient || type !== 'textarea') return\n\n if (autosize) {\n const minRows = isObject(autosize) ? autosize.minRows : undefined\n const maxRows = isObject(autosize) ? autosize.maxRows : undefined\n _textareaCalcStyle.value = {\n ...calcTextareaHeight(textarea.value!, minRows, maxRows),\n }\n } else {\n _textareaCalcStyle.value = {\n minHeight: calcTextareaHeight(textarea.value!).minHeight,\n }\n }\n }\n\n const setNativeInputValue = () => {\n const input = inputOrTextarea.value\n if (!input || input.value === nativeInputValue.value) return\n input.value = nativeInputValue.value\n }\n\n const calcIconOffset = (place: 'prefix' | 'suffix') => {\n const { el } = instance.vnode\n if (!el) return\n const elList: HTMLSpanElement[] = Array.from(\n el.querySelectorAll(`.${nsInput.e(place)}`)\n )\n const target = elList.find((item) => item.parentNode === el)\n\n if (!target) return\n\n const pendant = PENDANT_MAP[place]\n\n if (slots[pendant]) {\n target.style.transform = `translateX(${place === 'suffix' ? '-' : ''}${\n el.querySelector(`.${nsInput.be('group', pendant)}`).offsetWidth\n }px)`\n } else {\n target.removeAttribute('style')\n }\n }\n\n const updateIconOffset = () => {\n calcIconOffset('prefix')\n calcIconOffset('suffix')\n }\n\n const handleInput = (event: Event) => {\n const { value } = event.target as TargetElement\n\n // should not emit input during composition\n // see: https://github.com/ElemeFE/element/issues/10516\n if (isComposing.value) return\n\n // hack for https://github.com/ElemeFE/element/issues/8548\n // should remove the following line when we don't support IE\n if (value === nativeInputValue.value) return\n\n emit(UPDATE_MODEL_EVENT, value)\n emit('input', value)\n\n // ensure native input value is controlled\n // see: https://github.com/ElemeFE/element/issues/12850\n nextTick(setNativeInputValue)\n }\n\n const handleChange = (event: Event) => {\n emit('change', (event.target as TargetElement).value)\n }\n\n const focus = () => {\n // see: https://github.com/ElemeFE/element/issues/18573\n nextTick(() => {\n inputOrTextarea.value?.focus()\n })\n }\n\n const blur = () => {\n inputOrTextarea.value?.blur()\n }\n\n const handleFocus = (event: FocusEvent) => {\n focused.value = true\n emit('focus', event)\n }\n\n const handleBlur = (event: FocusEvent) => {\n focused.value = false\n emit('blur', event)\n if (props.validateEvent) {\n formItem?.validate?.('blur').catch((err) => debugWarn(err))\n }\n }\n\n const select = () => {\n inputOrTextarea.value?.select()\n }\n\n const handleCompositionStart = (event: CompositionEvent) => {\n emit('compositionstart', event)\n isComposing.value = true\n }\n\n const handleCompositionUpdate = (event: CompositionEvent) => {\n emit('compositionupdate', event)\n const text = (event.target as HTMLInputElement)?.value\n const lastCharacter = text[text.length - 1] || ''\n isComposing.value = !isKorean(lastCharacter)\n }\n\n const handleCompositionEnd = (event: CompositionEvent) => {\n emit('compositionend', event)\n if (isComposing.value) {\n isComposing.value = false\n handleInput(event)\n }\n }\n\n const clear = () => {\n emit(UPDATE_MODEL_EVENT, '')\n emit('change', '')\n emit('clear')\n emit('input', '')\n }\n\n const handlePasswordVisible = () => {\n passwordVisible.value = !passwordVisible.value\n focus()\n }\n\n const suffixVisible = computed(\n () =>\n !!slots.suffix ||\n !!props.suffixIcon ||\n showClear.value ||\n props.showPassword ||\n isWordLimitVisible.value ||\n (!!validateState.value && needStatusIcon.value)\n )\n\n watch(\n () => props.modelValue,\n () => {\n nextTick(resizeTextarea)\n if (props.validateEvent) {\n formItem?.validate?.('change').catch((err) => debugWarn(err))\n }\n }\n )\n\n // native input value is set explicitly\n // do not use v-model / :value in template\n // see: https://github.com/ElemeFE/element/issues/14521\n watch(nativeInputValue, () => setNativeInputValue())\n\n // when change between <input> and <textarea>,\n // update DOM dependent value and styles\n // https://github.com/ElemeFE/element/issues/14857\n watch(\n () => props.type,\n () => {\n nextTick(() => {\n setNativeInputValue()\n resizeTextarea()\n updateIconOffset()\n })\n }\n )\n\n onMounted(() => {\n setNativeInputValue()\n updateIconOffset()\n nextTick(resizeTextarea)\n })\n\n onUpdated(() => {\n nextTick(updateIconOffset)\n })\n\n const onMouseLeave = (evt: MouseEvent) => {\n hovering.value = false\n emit('mouseleave', evt)\n }\n\n const onMouseEnter = (evt: MouseEvent) => {\n hovering.value = true\n emit('mouseenter', evt)\n }\n\n const handleKeydown = (evt: KeyboardEvent) => {\n emit('keydown', evt)\n }\n\n return {\n input,\n textarea,\n attrs,\n inputSize,\n validateState,\n validateIcon,\n containerStyle,\n computedTextareaStyle,\n inputDisabled,\n showClear,\n showPwdVisible,\n isWordLimitVisible,\n textLength,\n hovering,\n inputExceed,\n passwordVisible,\n inputOrTextarea,\n suffixVisible,\n needStatusIcon,\n\n resizeTextarea,\n handleInput,\n handleChange,\n handleFocus,\n handleBlur,\n handleCompositionStart,\n handleCompositionUpdate,\n handleCompositionEnd,\n handlePasswordVisible,\n clear,\n select,\n focus,\n blur,\n onMouseLeave,\n onMouseEnter,\n handleKeydown,\n\n nsInput,\n nsTextarea,\n }\n },\n})\n</script>\n"],"names":["defineComponent","ElIcon","CircleClose","IconView","inputProps","inputEmits","getCurrentInstance","useAttrs","useFormItem","useSize","useDisabled","useNamespace","ref","shallowRef","computed","_withDirectives","_renderSlot","_openBlock","_createVNode","_createElementBlock","_createCommentVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2KA,MAAM,cAAc;AAAA,EAClB,QAAQ;AAAA,EACR,QAAQ;AAAA;AAGV,MAAK,YAAaA,oBAAa;AAAA,EAC7B,MAAM;AAAA,EAEN,YAAY,UAAEC,2BAAQC,gCAAaC;AAAA,EAEnC,cAAc;AAAA,EAEd,OAAOC;AAAA,EACP,OAAOC;AAAA,EAEP,MAAM,OAAO,EAAE,OAAO,MAAM,OAAO,YAAY;AAC7C,UAAM,WAAWC;AACjB,UAAM,QAAQC;AAEd,UAAM,EAAE,MAAM,aAAaC;AA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;AACJ;AACE,QACZ;AAAa,QACb,OAAO;AAAA;AACW,QAClB;AAAmB,QACnB;AAAgB,QAChB;AAAO,QACP;AAAO,QACP,QAAI;AAAE,QACN;AAAQ,QACR,WAAO;AAAE;;AAGZ;AAQO;QAPmC,OAAK,gBAAE,aAAQ;AAAC;QACxD;AAKO,gDALgB;AAAA;UACrB;AAA2B;AAGjB;;AAFkC;;AACZ;AAAd;AAAA;;;;;AAKtB;AAoCO;eAnC0BC;AAAW;;AA4BnC,iBA3BK;AAAW;WACJ;AAKN;AAJkB;AAGjB;;AAFkC;;AACZ;AAAd;AAAA;;;;AAUV;;AAL6B;AACrC;AAAkB;AACV;;AAEQ;AAAA;AAAA;;+CAElB;AAMU;YAJP,OAAK;AAA+B;AAC7B;;AAEK,cAAb;AAAa;AAAA;;;AAMR;YAJ0B,OAAK;AAAW;YAC/C;AAEO,cAFAC;AAAgB;AACgB;;sDAKFC;AAI/B;iBAHF,oBAAG,aAAQ,EAAC,SAAU;AAAS;;AAEL,oEAAhB;AAAA;AAAA;;;;AAIpB,iEAGM;AAAA;;AAFsC;;AACpB;;AA6Bf;AAzBX,MAEEC,uBAmBE;AAAA;AAlBI,QACH;AAAmB;AACP;AACF,QACVJ;AAAU;AACA;AACI;AACP;AACK,QACZ;AAAa,QACb;AAAkB;AACC,QACnB;AAAgB,QAChB;AAAO,QACP;AAAO,QACP;AAAM,QACN;AAAQ,QACR;AAAS;mEAIL;AAAA;QAF0B;AAAgB,0BAC5C,mBAAa,QAAG;;;2BA/HX;AAAA;AAAA;;;;;;;;;;;;;;"}
|
|
@@ -153,8 +153,8 @@ export declare const ElInputNumber: import("element-plus/es/utils").SFCWithInsta
|
|
|
153
153
|
type: string;
|
|
154
154
|
size: import("element-plus/es/utils").BuildPropType<StringConstructor, "default" | "small" | "large", never>;
|
|
155
155
|
disabled: boolean;
|
|
156
|
-
modelValue: import("element-plus/es/utils").BuildPropType<import("element-plus/es/utils").PropWrapper<string | number | null | undefined>, unknown, unknown>;
|
|
157
156
|
label: string;
|
|
157
|
+
modelValue: import("element-plus/es/utils").BuildPropType<import("element-plus/es/utils").PropWrapper<string | number | null | undefined>, unknown, unknown>;
|
|
158
158
|
resize: import("element-plus/es/utils").BuildPropType<StringConstructor, "none" | "both" | "horizontal" | "vertical", unknown>;
|
|
159
159
|
autosize: boolean | {
|
|
160
160
|
minRows?: number | undefined;
|
|
@@ -312,8 +312,8 @@ export declare const ElInputNumber: import("element-plus/es/utils").SFCWithInsta
|
|
|
312
312
|
type: string;
|
|
313
313
|
size: import("element-plus/es/utils").BuildPropType<StringConstructor, "default" | "small" | "large", never>;
|
|
314
314
|
disabled: boolean;
|
|
315
|
-
modelValue: import("element-plus/es/utils").BuildPropType<import("element-plus/es/utils").PropWrapper<string | number | null | undefined>, unknown, unknown>;
|
|
316
315
|
label: string;
|
|
316
|
+
modelValue: import("element-plus/es/utils").BuildPropType<import("element-plus/es/utils").PropWrapper<string | number | null | undefined>, unknown, unknown>;
|
|
317
317
|
resize: import("element-plus/es/utils").BuildPropType<StringConstructor, "none" | "both" | "horizontal" | "vertical", unknown>;
|
|
318
318
|
autosize: boolean | {
|
|
319
319
|
minRows?: number | undefined;
|
|
@@ -154,8 +154,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
154
154
|
type: string;
|
|
155
155
|
size: import("element-plus/es/utils").BuildPropType<StringConstructor, "default" | "small" | "large", never>;
|
|
156
156
|
disabled: boolean;
|
|
157
|
-
modelValue: import("element-plus/es/utils").BuildPropType<import("element-plus/es/utils").PropWrapper<string | number | null | undefined>, unknown, unknown>;
|
|
158
157
|
label: string;
|
|
158
|
+
modelValue: import("element-plus/es/utils").BuildPropType<import("element-plus/es/utils").PropWrapper<string | number | null | undefined>, unknown, unknown>;
|
|
159
159
|
resize: import("element-plus/es/utils").BuildPropType<StringConstructor, "none" | "both" | "horizontal" | "vertical", unknown>;
|
|
160
160
|
autosize: boolean | {
|
|
161
161
|
minRows?: number | undefined;
|
|
@@ -313,8 +313,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
313
313
|
type: string;
|
|
314
314
|
size: import("element-plus/es/utils").BuildPropType<StringConstructor, "default" | "small" | "large", never>;
|
|
315
315
|
disabled: boolean;
|
|
316
|
-
modelValue: import("element-plus/es/utils").BuildPropType<import("element-plus/es/utils").PropWrapper<string | number | null | undefined>, unknown, unknown>;
|
|
317
316
|
label: string;
|
|
317
|
+
modelValue: import("element-plus/es/utils").BuildPropType<import("element-plus/es/utils").PropWrapper<string | number | null | undefined>, unknown, unknown>;
|
|
318
318
|
resize: import("element-plus/es/utils").BuildPropType<StringConstructor, "none" | "both" | "horizontal" | "vertical", unknown>;
|
|
319
319
|
autosize: boolean | {
|
|
320
320
|
minRows?: number | undefined;
|
|
@@ -136,7 +136,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
136
136
|
emit("update:modelValue", newVal);
|
|
137
137
|
emit("input", newVal);
|
|
138
138
|
emit("change", newVal, oldVal);
|
|
139
|
-
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change");
|
|
139
|
+
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => error.debugWarn(err));
|
|
140
140
|
data.currentValue = newVal;
|
|
141
141
|
};
|
|
142
142
|
const handleInput = (value) => {
|
|
@@ -163,7 +163,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
163
163
|
const handleBlur = (event) => {
|
|
164
164
|
var _a;
|
|
165
165
|
emit("blur", event);
|
|
166
|
-
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur");
|
|
166
|
+
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => error.debugWarn(err));
|
|
167
167
|
};
|
|
168
168
|
vue.watch(() => props.modelValue, (value) => {
|
|
169
169
|
let newVal = Number(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-number2.js","sources":["../../../../../../packages/components/input-number/src/input-number.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n ns.b(),\n ns.m(inputNumberSize),\n ns.is('disabled', inputNumberDisabled),\n ns.is('without-controls', !controls),\n ns.is('controls-right', controlsAtRight),\n ]\"\n @dragstart.prevent\n >\n <span\n v-if=\"controls\"\n v-repeat-click=\"decrease\"\n role=\"button\"\n :class=\"[ns.e('decrease'), ns.is('disabled', minDisabled)]\"\n @keydown.enter=\"decrease\"\n >\n <el-icon>\n <arrow-down v-if=\"controlsAtRight\" />\n <minus v-else />\n </el-icon>\n </span>\n <span\n v-if=\"controls\"\n v-repeat-click=\"increase\"\n role=\"button\"\n :class=\"[ns.e('increase'), ns.is('disabled', maxDisabled)]\"\n @keydown.enter=\"increase\"\n >\n <el-icon>\n <arrow-up v-if=\"controlsAtRight\" />\n <plus v-else />\n </el-icon>\n </span>\n <el-input\n ref=\"input\"\n type=\"number\"\n :step=\"step\"\n :model-value=\"displayValue\"\n :placeholder=\"placeholder\"\n :disabled=\"inputNumberDisabled\"\n :size=\"inputNumberSize\"\n :max=\"max\"\n :min=\"min\"\n :name=\"name\"\n :label=\"label\"\n :validate-event=\"false\"\n @keydown.up.prevent=\"increase\"\n @keydown.down.prevent=\"decrease\"\n @blur=\"handleBlur\"\n @focus=\"handleFocus\"\n @input=\"handleInput\"\n @change=\"handleInputChange\"\n />\n </div>\n</template>\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n reactive,\n ref,\n watch,\n onMounted,\n onUpdated,\n} from 'vue'\n\nimport { ElIcon } from '@element-plus/components/icon'\nimport { RepeatClick } from '@element-plus/directives'\nimport {\n useDisabled,\n useFormItem,\n useSize,\n useNamespace,\n} from '@element-plus/hooks'\nimport ElInput from '@element-plus/components/input'\nimport { isNumber, debugWarn } from '@element-plus/utils'\nimport { ArrowUp, ArrowDown, Plus, Minus } from '@element-plus/icons-vue'\nimport { inputNumberProps, inputNumberEmits } from './input-number'\n\nimport type { ComponentPublicInstance } from 'vue'\n\ninterface IData {\n currentValue: number | undefined\n userInput: null | number | string\n}\n\nexport default defineComponent({\n name: 'ElInputNumber',\n components: {\n ElInput,\n ElIcon,\n ArrowUp,\n ArrowDown,\n Plus,\n Minus,\n },\n directives: {\n RepeatClick,\n },\n props: inputNumberProps,\n emits: inputNumberEmits,\n setup(props, { emit }) {\n const input = ref<ComponentPublicInstance<typeof ElInput>>()\n const data = reactive<IData>({\n currentValue: props.modelValue,\n userInput: null,\n })\n const { formItem } = useFormItem()\n const ns = useNamespace('input-number')\n\n const minDisabled = computed(() => _decrease(props.modelValue) < props.min)\n const maxDisabled = computed(() => _increase(props.modelValue) > props.max)\n\n const numPrecision = computed(() => {\n const stepPrecision = getPrecision(props.step)\n if (props.precision !== undefined) {\n if (stepPrecision > props.precision) {\n debugWarn(\n 'InputNumber',\n 'precision should not be less than the decimal places of step'\n )\n }\n return props.precision\n } else {\n return Math.max(getPrecision(props.modelValue), stepPrecision)\n }\n })\n const controlsAtRight = computed(() => {\n return props.controls && props.controlsPosition === 'right'\n })\n\n const inputNumberSize = useSize()\n const inputNumberDisabled = useDisabled()\n\n const displayValue = computed(() => {\n if (data.userInput !== null) {\n return data.userInput\n }\n let currentValue: number | string | undefined = data.currentValue\n if (isNumber(currentValue)) {\n if (Number.isNaN(currentValue)) return ''\n if (props.precision !== undefined) {\n currentValue = currentValue.toFixed(props.precision)\n }\n }\n return currentValue\n })\n const toPrecision = (num: number, pre?: number) => {\n if (pre === undefined) pre = numPrecision.value\n return parseFloat(\n `${Math.round(num * Math.pow(10, pre)) / Math.pow(10, pre)}`\n )\n }\n const getPrecision = (value: number | undefined) => {\n if (value === undefined) return 0\n const valueString = value.toString()\n const dotPosition = valueString.indexOf('.')\n let precision = 0\n if (dotPosition !== -1) {\n precision = valueString.length - dotPosition - 1\n }\n return precision\n }\n const _increase = (val: number) => {\n if (!isNumber(val)) return data.currentValue\n const precisionFactor = Math.pow(10, numPrecision.value)\n // Solve the accuracy problem of JS decimal calculation by converting the value to integer.\n val = isNumber(val) ? val : NaN\n return toPrecision(\n (precisionFactor * val + precisionFactor * props.step) / precisionFactor\n )\n }\n const _decrease = (val: number) => {\n if (!isNumber(val)) return data.currentValue\n const precisionFactor = Math.pow(10, numPrecision.value)\n // Solve the accuracy problem of JS decimal calculation by converting the value to integer.\n val = isNumber(val) ? val : NaN\n return toPrecision(\n (precisionFactor * val - precisionFactor * props.step) / precisionFactor\n )\n }\n const increase = () => {\n if (inputNumberDisabled.value || maxDisabled.value) return\n const value = props.modelValue || 0\n const newVal = _increase(value)\n setCurrentValue(newVal)\n }\n const decrease = () => {\n if (inputNumberDisabled.value || minDisabled.value) return\n const value = props.modelValue || 0\n const newVal = _decrease(value)\n setCurrentValue(newVal)\n }\n const setCurrentValue = (newVal: number | string) => {\n const oldVal = data.currentValue\n if (typeof newVal === 'number' && props.precision !== undefined) {\n newVal = toPrecision(newVal, props.precision)\n }\n if (newVal !== undefined && newVal >= props.max) newVal = props.max\n if (newVal !== undefined && newVal <= props.min) newVal = props.min\n if (oldVal === newVal) return\n if (!isNumber(newVal)) {\n newVal = undefined\n }\n data.userInput = null\n emit('update:modelValue', newVal)\n emit('input', newVal)\n emit('change', newVal, oldVal)\n formItem?.validate?.('change')\n data.currentValue = newVal\n }\n const handleInput = (value: string) => {\n return (data.userInput = value)\n }\n const handleInputChange = (value: string) => {\n const newVal = value !== '' ? Number(value) : ''\n if ((isNumber(newVal) && !Number.isNaN(newVal)) || value === '') {\n setCurrentValue(newVal)\n }\n data.userInput = null\n }\n\n const focus = () => {\n input.value?.focus?.()\n }\n\n const blur = () => {\n input.value?.blur?.()\n }\n\n const handleFocus = (event: MouseEvent) => {\n emit('focus', event)\n }\n\n const handleBlur = (event: MouseEvent) => {\n emit('blur', event)\n formItem?.validate?.('blur')\n }\n\n watch(\n () => props.modelValue,\n (value) => {\n let newVal = Number(value)\n if (value === null) {\n newVal = Number.NaN\n }\n if (!isNaN(newVal)) {\n if (props.stepStrictly) {\n const stepPrecision = getPrecision(props.step)\n const precisionFactor = Math.pow(10, stepPrecision)\n newVal =\n (Math.round(newVal / props.step) * precisionFactor * props.step) /\n precisionFactor\n }\n if (props.precision !== undefined) {\n newVal = toPrecision(newVal, props.precision)\n }\n\n if (newVal > props.max) {\n newVal = props.max\n emit('update:modelValue', newVal)\n }\n if (newVal < props.min) {\n newVal = props.min\n emit('update:modelValue', newVal)\n }\n }\n data.currentValue = newVal\n data.userInput = null\n },\n { immediate: true }\n )\n onMounted(() => {\n const innerInput = input.value?.input as HTMLInputElement\n innerInput.setAttribute('role', 'spinbutton')\n innerInput.setAttribute('aria-valuemax', String(props.max))\n innerInput.setAttribute('aria-valuemin', String(props.min))\n innerInput.setAttribute('aria-valuenow', String(data.currentValue))\n innerInput.setAttribute(\n 'aria-disabled',\n String(inputNumberDisabled.value)\n )\n if (!isNumber(props.modelValue)) {\n let val: number | undefined = Number(props.modelValue)\n if (isNaN(val)) {\n val = undefined\n }\n emit('update:modelValue', val)\n }\n })\n onUpdated(() => {\n const innerInput = input.value?.input\n innerInput?.setAttribute('aria-valuenow', data.currentValue)\n })\n return {\n input,\n displayValue,\n handleInput,\n handleInputChange,\n controlsAtRight,\n decrease,\n increase,\n inputNumberSize,\n inputNumberDisabled,\n maxDisabled,\n minDisabled,\n focus,\n blur,\n handleFocus,\n handleBlur,\n\n ns,\n }\n },\n})\n</script>\n"],"names":["defineComponent","ElInput","ElIcon","ArrowUp","ArrowDown","Plus","Minus","RepeatClick","inputNumberProps","inputNumberEmits","ref","reactive","useFormItem","useNamespace","computed","useSize","useDisabled","isNumber"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwFA,MAAK,YAAaA,oBAAa;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,aACVC;AAAA,YACAC;AAAA,aACAC;AAAA,eACAC;AAAA,UACAC;AAAA,WACAC;AAAA;AAAA,EAEF,YAAY;AAAA,iBACVC;AAAA;AAAA,EAEF,OAAOC;AAAA,EACP,OAAOC;AAAA,EACP,MAAM,OA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I,gBAAgB;AAClB;AACE;AACA;AACA,wBACQ;AACN;AAEJ,gCAAwB;AACtB,+BAAqB,QAAQ,MAAM;AAAA;AAGrC;AACE;AACA;AAA0B;AAE5B,YAAI,SAAS,MAAM,KAAK;AACtB,mBAAS,MAAM;AACf,eAAK,qBAAqB;AAAA;AAAA;AAG9B;AACA;AAAiB,SAEjB;AAEJ;AACE;AACA;AACA;AACA;AACA;AACA,+CAEE,OAAO;AAET;AACE;AACA;AACE,gBAAM;AAAA;AAER;AAA0B;AAAA;AAG9B;AACE;AACA;AAA+C;AAEjD;AAAO;AACL,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AACA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA;AAAA;AAAA;;;;;;;;;;AAlQE;AArDE;AAAa;AAAgB;AAA0C;AAAuD;AAAyC;AAAA,iBAOnK;AAAV;AAAkB;mDAElB;AAWO;MARL;AAAK,sCACO,EAAC,2BAAmB;AAAa,iBACrC;AAAgB;;AAKd;AAF6B,UAAnB;AACF;AAAA;;;mCAPF;AAAA;;AAqBX;;AARA,aACC;AAAuC,MAC5C;AAAuB;;AAKd;AAF2B,UAAnB;AACD;AAAA;;;mCAPD;AAAA;;AA6BhB,WAlBI;AAAA;AACC;AACE,MACN;AAAa,MACb;AAAa,mBACH;AAAA,MACV;AAAM,MACN;AAAK,MACL;AAAK,MACL;AAAM,MACN;AAAO,MACP;AAAgB,MAChB,WAAO;AAAA;AAAqB;AACE;AAAA,MAC9B;AAAM,MACN;AAAO,MACP,SAAO;AAAA;AACC;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"input-number2.js","sources":["../../../../../../packages/components/input-number/src/input-number.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n ns.b(),\n ns.m(inputNumberSize),\n ns.is('disabled', inputNumberDisabled),\n ns.is('without-controls', !controls),\n ns.is('controls-right', controlsAtRight),\n ]\"\n @dragstart.prevent\n >\n <span\n v-if=\"controls\"\n v-repeat-click=\"decrease\"\n role=\"button\"\n :class=\"[ns.e('decrease'), ns.is('disabled', minDisabled)]\"\n @keydown.enter=\"decrease\"\n >\n <el-icon>\n <arrow-down v-if=\"controlsAtRight\" />\n <minus v-else />\n </el-icon>\n </span>\n <span\n v-if=\"controls\"\n v-repeat-click=\"increase\"\n role=\"button\"\n :class=\"[ns.e('increase'), ns.is('disabled', maxDisabled)]\"\n @keydown.enter=\"increase\"\n >\n <el-icon>\n <arrow-up v-if=\"controlsAtRight\" />\n <plus v-else />\n </el-icon>\n </span>\n <el-input\n ref=\"input\"\n type=\"number\"\n :step=\"step\"\n :model-value=\"displayValue\"\n :placeholder=\"placeholder\"\n :disabled=\"inputNumberDisabled\"\n :size=\"inputNumberSize\"\n :max=\"max\"\n :min=\"min\"\n :name=\"name\"\n :label=\"label\"\n :validate-event=\"false\"\n @keydown.up.prevent=\"increase\"\n @keydown.down.prevent=\"decrease\"\n @blur=\"handleBlur\"\n @focus=\"handleFocus\"\n @input=\"handleInput\"\n @change=\"handleInputChange\"\n />\n </div>\n</template>\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n reactive,\n ref,\n watch,\n onMounted,\n onUpdated,\n} from 'vue'\n\nimport { ElIcon } from '@element-plus/components/icon'\nimport { RepeatClick } from '@element-plus/directives'\nimport {\n useDisabled,\n useFormItem,\n useSize,\n useNamespace,\n} from '@element-plus/hooks'\nimport ElInput from '@element-plus/components/input'\nimport { isNumber, debugWarn } from '@element-plus/utils'\nimport { ArrowUp, ArrowDown, Plus, Minus } from '@element-plus/icons-vue'\nimport { inputNumberProps, inputNumberEmits } from './input-number'\n\nimport type { ComponentPublicInstance } from 'vue'\n\ninterface IData {\n currentValue: number | undefined\n userInput: null | number | string\n}\n\nexport default defineComponent({\n name: 'ElInputNumber',\n components: {\n ElInput,\n ElIcon,\n ArrowUp,\n ArrowDown,\n Plus,\n Minus,\n },\n directives: {\n RepeatClick,\n },\n props: inputNumberProps,\n emits: inputNumberEmits,\n setup(props, { emit }) {\n const input = ref<ComponentPublicInstance<typeof ElInput>>()\n const data = reactive<IData>({\n currentValue: props.modelValue,\n userInput: null,\n })\n const { formItem } = useFormItem()\n const ns = useNamespace('input-number')\n\n const minDisabled = computed(() => _decrease(props.modelValue) < props.min)\n const maxDisabled = computed(() => _increase(props.modelValue) > props.max)\n\n const numPrecision = computed(() => {\n const stepPrecision = getPrecision(props.step)\n if (props.precision !== undefined) {\n if (stepPrecision > props.precision) {\n debugWarn(\n 'InputNumber',\n 'precision should not be less than the decimal places of step'\n )\n }\n return props.precision\n } else {\n return Math.max(getPrecision(props.modelValue), stepPrecision)\n }\n })\n const controlsAtRight = computed(() => {\n return props.controls && props.controlsPosition === 'right'\n })\n\n const inputNumberSize = useSize()\n const inputNumberDisabled = useDisabled()\n\n const displayValue = computed(() => {\n if (data.userInput !== null) {\n return data.userInput\n }\n let currentValue: number | string | undefined = data.currentValue\n if (isNumber(currentValue)) {\n if (Number.isNaN(currentValue)) return ''\n if (props.precision !== undefined) {\n currentValue = currentValue.toFixed(props.precision)\n }\n }\n return currentValue\n })\n const toPrecision = (num: number, pre?: number) => {\n if (pre === undefined) pre = numPrecision.value\n return parseFloat(\n `${Math.round(num * Math.pow(10, pre)) / Math.pow(10, pre)}`\n )\n }\n const getPrecision = (value: number | undefined) => {\n if (value === undefined) return 0\n const valueString = value.toString()\n const dotPosition = valueString.indexOf('.')\n let precision = 0\n if (dotPosition !== -1) {\n precision = valueString.length - dotPosition - 1\n }\n return precision\n }\n const _increase = (val: number) => {\n if (!isNumber(val)) return data.currentValue\n const precisionFactor = Math.pow(10, numPrecision.value)\n // Solve the accuracy problem of JS decimal calculation by converting the value to integer.\n val = isNumber(val) ? val : NaN\n return toPrecision(\n (precisionFactor * val + precisionFactor * props.step) / precisionFactor\n )\n }\n const _decrease = (val: number) => {\n if (!isNumber(val)) return data.currentValue\n const precisionFactor = Math.pow(10, numPrecision.value)\n // Solve the accuracy problem of JS decimal calculation by converting the value to integer.\n val = isNumber(val) ? val : NaN\n return toPrecision(\n (precisionFactor * val - precisionFactor * props.step) / precisionFactor\n )\n }\n const increase = () => {\n if (inputNumberDisabled.value || maxDisabled.value) return\n const value = props.modelValue || 0\n const newVal = _increase(value)\n setCurrentValue(newVal)\n }\n const decrease = () => {\n if (inputNumberDisabled.value || minDisabled.value) return\n const value = props.modelValue || 0\n const newVal = _decrease(value)\n setCurrentValue(newVal)\n }\n const setCurrentValue = (newVal: number | string) => {\n const oldVal = data.currentValue\n if (typeof newVal === 'number' && props.precision !== undefined) {\n newVal = toPrecision(newVal, props.precision)\n }\n if (newVal !== undefined && newVal >= props.max) newVal = props.max\n if (newVal !== undefined && newVal <= props.min) newVal = props.min\n if (oldVal === newVal) return\n if (!isNumber(newVal)) {\n newVal = undefined\n }\n data.userInput = null\n emit('update:modelValue', newVal)\n emit('input', newVal)\n emit('change', newVal, oldVal)\n formItem?.validate?.('change').catch((err) => debugWarn(err))\n data.currentValue = newVal\n }\n const handleInput = (value: string) => {\n return (data.userInput = value)\n }\n const handleInputChange = (value: string) => {\n const newVal = value !== '' ? Number(value) : ''\n if ((isNumber(newVal) && !Number.isNaN(newVal)) || value === '') {\n setCurrentValue(newVal)\n }\n data.userInput = null\n }\n\n const focus = () => {\n input.value?.focus?.()\n }\n\n const blur = () => {\n input.value?.blur?.()\n }\n\n const handleFocus = (event: MouseEvent) => {\n emit('focus', event)\n }\n\n const handleBlur = (event: MouseEvent) => {\n emit('blur', event)\n formItem?.validate?.('blur').catch((err) => debugWarn(err))\n }\n\n watch(\n () => props.modelValue,\n (value) => {\n let newVal = Number(value)\n if (value === null) {\n newVal = Number.NaN\n }\n if (!isNaN(newVal)) {\n if (props.stepStrictly) {\n const stepPrecision = getPrecision(props.step)\n const precisionFactor = Math.pow(10, stepPrecision)\n newVal =\n (Math.round(newVal / props.step) * precisionFactor * props.step) /\n precisionFactor\n }\n if (props.precision !== undefined) {\n newVal = toPrecision(newVal, props.precision)\n }\n\n if (newVal > props.max) {\n newVal = props.max\n emit('update:modelValue', newVal)\n }\n if (newVal < props.min) {\n newVal = props.min\n emit('update:modelValue', newVal)\n }\n }\n data.currentValue = newVal\n data.userInput = null\n },\n { immediate: true }\n )\n onMounted(() => {\n const innerInput = input.value?.input as HTMLInputElement\n innerInput.setAttribute('role', 'spinbutton')\n innerInput.setAttribute('aria-valuemax', String(props.max))\n innerInput.setAttribute('aria-valuemin', String(props.min))\n innerInput.setAttribute('aria-valuenow', String(data.currentValue))\n innerInput.setAttribute(\n 'aria-disabled',\n String(inputNumberDisabled.value)\n )\n if (!isNumber(props.modelValue)) {\n let val: number | undefined = Number(props.modelValue)\n if (isNaN(val)) {\n val = undefined\n }\n emit('update:modelValue', val)\n }\n })\n onUpdated(() => {\n const innerInput = input.value?.input\n innerInput?.setAttribute('aria-valuenow', data.currentValue)\n })\n return {\n input,\n displayValue,\n handleInput,\n handleInputChange,\n controlsAtRight,\n decrease,\n increase,\n inputNumberSize,\n inputNumberDisabled,\n maxDisabled,\n minDisabled,\n focus,\n blur,\n handleFocus,\n handleBlur,\n\n ns,\n }\n },\n})\n</script>\n"],"names":["defineComponent","ElInput","ElIcon","ArrowUp","ArrowDown","Plus","Minus","RepeatClick","inputNumberProps","inputNumberEmits","ref","reactive","useFormItem","useNamespace","computed","useSize","useDisabled","isNumber"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwFA,MAAK,YAAaA,oBAAa;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,aACVC;AAAA,YACAC;AAAA,aACAC;AAAA,eACAC;AAAA,UACAC;AAAA,WACAC;AAAA;AAAA,EAEF,YAAY;AAAA,iBACVC;AAAA;AAAA,EAEF,OAAOC;AAAA,EACP,OAAOC;AAAA,EACP,MAAM,OAAO,EAAE,QAAQ;AACrB,UAAM,QAAQC;AACd,UAAM,OAAOC,aAAgB;AAAA,MAC3B,cAAc,MAAM;AAAA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M;AAAA;AAGrC;AACE;AACA;AAA0B;AAE5B,YAAI,SAAS,MAAM,KAAK;AACtB,mBAAS,MAAM;AACf,eAAK,qBAAqB;AAAA;AAAA;AAG9B;AACA;AAAiB,SAEjB;AAEJ;AACE;AACA;AACA;AACA;AACA;AACA,+CAEE,OAAO;AAET;AACE;AACA;AACE,gBAAM;AAAA;AAER;AAA0B;AAAA;AAG9B;AACE;AACA;AAA+C;AAEjD;AAAO;AACL,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AACA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA;AAAA;AAAA;;;;;;;;;;AAlQE;AArDE;AAAa;AAAgB;AAA0C;AAAuD;AAAyC;AAAA,iBAOnK;AAAV;AAAkB;mDAElB;AAWO;MARL;AAAK,sCACO,EAAC,2BAAmB;AAAa,iBACrC;AAAgB;;AAKd;AAF6B,UAAnB;AACF;AAAA;;;mCAPF;AAAA;;AAqBX;;AARA,aACC;AAAuC,MAC5C;AAAuB;;AAKd;AAF2B,UAAnB;AACD;AAAA;;;mCAPD;AAAA;;AA6BhB,WAlBI;AAAA;AACC;AACE,MACN;AAAa,MACb;AAAa,mBACH;AAAA,MACV;AAAM,MACN;AAAK,MACL;AAAK,MACL;AAAM,MACN;AAAO,MACP;AAAgB,MAChB,WAAO;AAAA;AAAqB;AACE;AAAA,MAC9B;AAAM,MACN;AAAO,MACP,SAAO;AAAA;AACC;;;;;;;;;;;;;"}
|
|
@@ -7,6 +7,7 @@ require('./src/message-box.type.js');
|
|
|
7
7
|
|
|
8
8
|
const _MessageBox = messageBox["default"];
|
|
9
9
|
_MessageBox.install = (app) => {
|
|
10
|
+
_MessageBox._context = app._context;
|
|
10
11
|
app.config.globalProperties.$msgbox = _MessageBox;
|
|
11
12
|
app.config.globalProperties.$messageBox = _MessageBox;
|
|
12
13
|
app.config.globalProperties.$alert = _MessageBox.alert;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../packages/components/message-box/index.ts"],"sourcesContent":["import MessageBox from './src/messageBox'\n\nimport type { App } from 'vue'\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nconst _MessageBox = MessageBox as SFCWithInstall<typeof MessageBox>\n\n_MessageBox.install = (app: App) => {\n app.config.globalProperties.$msgbox = _MessageBox\n app.config.globalProperties.$messageBox = _MessageBox\n app.config.globalProperties.$alert = _MessageBox.alert\n app.config.globalProperties.$confirm = _MessageBox.confirm\n app.config.globalProperties.$prompt = _MessageBox.prompt\n}\n\nexport default _MessageBox\nexport const ElMessageBox = _MessageBox\n\nexport * from './src/message-box.type'\n"],"names":["MessageBox"],"mappings":";;;;;;;AACK,MAAC,WAAW,GAAGA,sBAAW;AAC/B,WAAW,CAAC,OAAO,GAAG,CAAC,GAAG,KAAK;AAC/B,EAAE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,GAAG,WAAW,CAAC;AACpD,EAAE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,WAAW,GAAG,WAAW,CAAC;AACxD,EAAE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC;AACzD,EAAE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC;AAC7D,EAAE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC;AAC3D,CAAC,CAAC;AAEU,MAAC,YAAY,GAAG;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../packages/components/message-box/index.ts"],"sourcesContent":["import MessageBox from './src/messageBox'\n\nimport type { App } from 'vue'\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nconst _MessageBox = MessageBox as SFCWithInstall<typeof MessageBox>\n\n_MessageBox.install = (app: App) => {\n _MessageBox._context = app._context\n app.config.globalProperties.$msgbox = _MessageBox\n app.config.globalProperties.$messageBox = _MessageBox\n app.config.globalProperties.$alert = _MessageBox.alert\n app.config.globalProperties.$confirm = _MessageBox.confirm\n app.config.globalProperties.$prompt = _MessageBox.prompt\n}\n\nexport default _MessageBox\nexport const ElMessageBox = _MessageBox\n\nexport * from './src/message-box.type'\n"],"names":["MessageBox"],"mappings":";;;;;;;AACK,MAAC,WAAW,GAAGA,sBAAW;AAC/B,WAAW,CAAC,OAAO,GAAG,CAAC,GAAG,KAAK;AAC/B,EAAE,WAAW,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AACtC,EAAE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,GAAG,WAAW,CAAC;AACpD,EAAE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,WAAW,GAAG,WAAW,CAAC;AACxD,EAAE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC;AACzD,EAAE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC;AAC7D,EAAE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC;AAC3D,CAAC,CAAC;AAEU,MAAC,YAAY,GAAG;;;;;"}
|
|
@@ -1858,8 +1858,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1858
1858
|
lockScroll: boolean;
|
|
1859
1859
|
modal: boolean;
|
|
1860
1860
|
container: string;
|
|
1861
|
-
closeOnHashChange: boolean;
|
|
1862
|
-
roundButton: boolean;
|
|
1863
1861
|
boxType: MessageBoxType;
|
|
1862
|
+
roundButton: boolean;
|
|
1863
|
+
closeOnHashChange: boolean;
|
|
1864
1864
|
}>;
|
|
1865
1865
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CSSProperties, VNode, Component } from 'vue';
|
|
1
|
+
import type { AppContext, CSSProperties, VNode, Component } from 'vue';
|
|
2
2
|
import type { ComponentSize } from 'element-plus/es/constants';
|
|
3
3
|
declare type MessageType = '' | 'success' | 'warning' | 'info' | 'error';
|
|
4
4
|
export declare type Action = 'confirm' | 'close' | 'cancel';
|
|
@@ -115,11 +115,12 @@ export interface ElMessageBoxOptions {
|
|
|
115
115
|
/** Custom size of confirm and cancel buttons */
|
|
116
116
|
buttonSize?: ComponentSize;
|
|
117
117
|
}
|
|
118
|
-
export declare type ElMessageBoxShortcutMethod = ((message: ElMessageBoxOptions['message'], title: ElMessageBoxOptions['title'], options?: ElMessageBoxOptions) => Promise<MessageBoxData>) & ((message: ElMessageBoxOptions['message'], options?: ElMessageBoxOptions) => Promise<MessageBoxData>);
|
|
118
|
+
export declare type ElMessageBoxShortcutMethod = ((message: ElMessageBoxOptions['message'], title: ElMessageBoxOptions['title'], options?: ElMessageBoxOptions, appContext?: AppContext | null) => Promise<MessageBoxData>) & ((message: ElMessageBoxOptions['message'], options?: ElMessageBoxOptions, appContext?: AppContext | null) => Promise<MessageBoxData>);
|
|
119
119
|
export interface IElMessageBox {
|
|
120
|
+
_context: AppContext | null;
|
|
120
121
|
/** Show a message box */
|
|
121
122
|
/** Show a message box */
|
|
122
|
-
(options: ElMessageBoxOptions): Promise<MessageBoxData>;
|
|
123
|
+
(options: ElMessageBoxOptions, appContext?: AppContext | null): Promise<MessageBoxData>;
|
|
123
124
|
/** Show an alert message box */
|
|
124
125
|
alert: ElMessageBoxShortcutMethod;
|
|
125
126
|
/** Show a confirm message box */
|
|
@@ -7,10 +7,12 @@ var core = require('@vueuse/core');
|
|
|
7
7
|
require('../../../utils/index.js');
|
|
8
8
|
var index = require('./index.js');
|
|
9
9
|
var shared = require('@vue/shared');
|
|
10
|
+
var types = require('../../../utils/types.js');
|
|
10
11
|
|
|
11
12
|
const messageInstance = /* @__PURE__ */ new Map();
|
|
12
|
-
const initInstance = (props, container) => {
|
|
13
|
+
const initInstance = (props, container, appContext = null) => {
|
|
13
14
|
const vnode = vue.h(index["default"], props);
|
|
15
|
+
vnode.appContext = appContext;
|
|
14
16
|
vue.render(vnode, container);
|
|
15
17
|
document.body.appendChild(container.firstElementChild);
|
|
16
18
|
return vnode.component;
|
|
@@ -18,7 +20,7 @@ const initInstance = (props, container) => {
|
|
|
18
20
|
const genContainer = () => {
|
|
19
21
|
return document.createElement("div");
|
|
20
22
|
};
|
|
21
|
-
const showMessage = (options) => {
|
|
23
|
+
const showMessage = (options, appContext) => {
|
|
22
24
|
const container = genContainer();
|
|
23
25
|
options.onVanish = () => {
|
|
24
26
|
vue.render(null, container);
|
|
@@ -46,7 +48,7 @@ const showMessage = (options) => {
|
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
};
|
|
49
|
-
const instance = initInstance(options, container);
|
|
51
|
+
const instance = initInstance(options, container, appContext);
|
|
50
52
|
const vm = instance.proxy;
|
|
51
53
|
for (const prop in options) {
|
|
52
54
|
if (shared.hasOwn(options, prop) && !shared.hasOwn(vm.$props, prop)) {
|
|
@@ -65,9 +67,9 @@ const showMessage = (options) => {
|
|
|
65
67
|
vm.visible = true;
|
|
66
68
|
return vm;
|
|
67
69
|
};
|
|
68
|
-
function MessageBox(options) {
|
|
70
|
+
function MessageBox(options, appContext = null) {
|
|
69
71
|
if (!core.isClient)
|
|
70
|
-
return;
|
|
72
|
+
return Promise.reject();
|
|
71
73
|
let callback;
|
|
72
74
|
if (shared.isString(options) || vue.isVNode(options)) {
|
|
73
75
|
options = {
|
|
@@ -77,7 +79,7 @@ function MessageBox(options) {
|
|
|
77
79
|
callback = options.callback;
|
|
78
80
|
}
|
|
79
81
|
return new Promise((resolve, reject) => {
|
|
80
|
-
const vm = showMessage(options);
|
|
82
|
+
const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
|
|
81
83
|
messageInstance.set(vm, {
|
|
82
84
|
options,
|
|
83
85
|
callback,
|
|
@@ -86,62 +88,43 @@ function MessageBox(options) {
|
|
|
86
88
|
});
|
|
87
89
|
});
|
|
88
90
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
title = "";
|
|
95
|
-
}
|
|
96
|
-
return MessageBox(Object.assign({
|
|
97
|
-
title,
|
|
98
|
-
message,
|
|
99
|
-
type: "",
|
|
100
|
-
closeOnPressEscape: false,
|
|
101
|
-
closeOnClickModal: false
|
|
102
|
-
}, options, {
|
|
103
|
-
boxType: "alert"
|
|
104
|
-
}));
|
|
105
|
-
};
|
|
106
|
-
MessageBox.confirm = (message, title, options) => {
|
|
107
|
-
if (typeof title === "object") {
|
|
108
|
-
options = title;
|
|
109
|
-
title = "";
|
|
110
|
-
} else if (title === void 0) {
|
|
111
|
-
title = "";
|
|
112
|
-
}
|
|
113
|
-
return MessageBox(Object.assign({
|
|
114
|
-
title,
|
|
115
|
-
message,
|
|
116
|
-
type: "",
|
|
117
|
-
showCancelButton: true
|
|
118
|
-
}, options, {
|
|
119
|
-
boxType: "confirm"
|
|
120
|
-
}));
|
|
121
|
-
};
|
|
122
|
-
MessageBox.prompt = (message, title, options) => {
|
|
123
|
-
if (typeof title === "object") {
|
|
124
|
-
options = title;
|
|
125
|
-
title = "";
|
|
126
|
-
} else if (title === void 0) {
|
|
127
|
-
title = "";
|
|
128
|
-
}
|
|
129
|
-
return MessageBox(Object.assign({
|
|
130
|
-
title,
|
|
131
|
-
message,
|
|
132
|
-
showCancelButton: true,
|
|
133
|
-
showInput: true,
|
|
134
|
-
type: ""
|
|
135
|
-
}, options, {
|
|
136
|
-
boxType: "prompt"
|
|
137
|
-
}));
|
|
91
|
+
const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
|
|
92
|
+
const MESSAGE_BOX_DEFAULT_OPTS = {
|
|
93
|
+
alert: { closeOnPressEscape: false, closeOnClickModal: false },
|
|
94
|
+
confirm: { showCancelButton: true },
|
|
95
|
+
prompt: { showCancelButton: true, showInput: true }
|
|
138
96
|
};
|
|
97
|
+
MESSAGE_BOX_VARIANTS.forEach((boxType) => {
|
|
98
|
+
MessageBox[boxType] = messageBoxFactory(boxType);
|
|
99
|
+
});
|
|
100
|
+
function messageBoxFactory(boxType) {
|
|
101
|
+
return (message, titleOrOpts, options, appContext) => {
|
|
102
|
+
let title;
|
|
103
|
+
if (shared.isObject(titleOrOpts)) {
|
|
104
|
+
options = titleOrOpts;
|
|
105
|
+
title = "";
|
|
106
|
+
} else if (types.isUndefined(titleOrOpts)) {
|
|
107
|
+
title = "";
|
|
108
|
+
} else {
|
|
109
|
+
title = titleOrOpts;
|
|
110
|
+
}
|
|
111
|
+
return MessageBox(Object.assign({
|
|
112
|
+
title,
|
|
113
|
+
message,
|
|
114
|
+
type: "",
|
|
115
|
+
...MESSAGE_BOX_DEFAULT_OPTS[boxType]
|
|
116
|
+
}, options, {
|
|
117
|
+
boxType
|
|
118
|
+
}), appContext);
|
|
119
|
+
};
|
|
120
|
+
}
|
|
139
121
|
MessageBox.close = () => {
|
|
140
122
|
messageInstance.forEach((_, vm) => {
|
|
141
123
|
vm.doClose();
|
|
142
124
|
});
|
|
143
125
|
messageInstance.clear();
|
|
144
126
|
};
|
|
127
|
+
MessageBox._context = null;
|
|
145
128
|
|
|
146
129
|
exports["default"] = MessageBox;
|
|
147
130
|
//# sourceMappingURL=messageBox.js.map
|