fast-element-plus 1.0.21 → 2.0.1
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/CHANGELOG.md +47 -0
- package/CONTRIBUTING.md +83 -0
- package/README.md +74 -115
- package/README.zh.md +74 -115
- package/SECURITY.md +34 -0
- package/dist/component.d.ts +4 -0
- package/dist/component.mjs +56 -0
- package/dist/component.mjs.map +1 -0
- package/dist/components/avatar/index.d.ts +15 -0
- package/dist/components/avatar/index.mjs +9 -0
- package/dist/components/avatar/index.mjs.map +1 -0
- package/dist/components/avatar/src/avatar.d.ts +128 -0
- package/dist/components/avatar/src/avatar.mjs +64 -0
- package/dist/components/avatar/src/avatar.mjs.map +1 -0
- package/dist/components/button/index.d.ts +14 -0
- package/dist/components/button/index.mjs +9 -0
- package/dist/components/button/index.mjs.map +1 -0
- package/dist/components/button/src/button.d.ts +180 -0
- package/dist/components/button/src/button.mjs +108 -0
- package/dist/components/button/src/button.mjs.map +1 -0
- package/dist/components/carNumber/index.d.ts +8 -0
- package/dist/components/carNumber/index.mjs +10 -0
- package/dist/components/carNumber/index.mjs.map +1 -0
- package/dist/components/carNumber/src/carNumber.d.ts +230 -0
- package/dist/components/carNumber/src/carNumber.mjs +148 -0
- package/dist/components/carNumber/src/carNumber.mjs.map +1 -0
- package/dist/components/carNumber/src/common.d.ts +15 -0
- package/dist/components/carNumber/src/common.mjs +97 -0
- package/dist/components/carNumber/src/common.mjs.map +1 -0
- package/dist/components/contextMenu/index.d.ts +8 -0
- package/dist/components/contextMenu/index.mjs +9 -0
- package/dist/components/contextMenu/index.mjs.map +1 -0
- package/dist/components/contextMenu/src/contextMenu.d.ts +32 -0
- package/dist/components/contextMenu/src/contextMenu.mjs +79 -0
- package/dist/components/contextMenu/src/contextMenu.mjs.map +1 -0
- package/dist/components/contextMenu/src/contextMenu.type.d.ts +31 -0
- package/dist/components/dialog/index.d.ts +14 -0
- package/dist/components/dialog/index.mjs +9 -0
- package/dist/components/dialog/index.mjs.map +1 -0
- package/dist/components/dialog/src/dialog.d.ts +472 -0
- package/dist/components/dialog/src/dialog.mjs +287 -0
- package/dist/components/dialog/src/dialog.mjs.map +1 -0
- package/dist/components/drawer/index.d.ts +15 -0
- package/dist/components/drawer/index.mjs +9 -0
- package/dist/components/drawer/index.mjs.map +1 -0
- package/dist/components/drawer/src/drawer.d.ts +470 -0
- package/dist/components/drawer/src/drawer.mjs +297 -0
- package/dist/components/drawer/src/drawer.mjs.map +1 -0
- package/dist/components/form/index.d.ts +23 -0
- package/dist/components/form/index.mjs +13 -0
- package/dist/components/form/index.mjs.map +1 -0
- package/dist/components/form/src/form.d.ts +208 -0
- package/dist/components/form/src/form.mjs +119 -0
- package/dist/components/form/src/form.mjs.map +1 -0
- package/dist/components/form/src/formItem.d.ts +208 -0
- package/dist/components/form/src/formItem.mjs +86 -0
- package/dist/components/form/src/formItem.mjs.map +1 -0
- package/dist/components/form/utils/form.d.ts +83 -0
- package/dist/components/form/utils/form.mjs +176 -0
- package/dist/components/form/utils/form.mjs.map +1 -0
- package/dist/components/formItemTip/index.d.ts +12 -0
- package/dist/components/formItemTip/index.mjs +9 -0
- package/dist/components/formItemTip/index.mjs.map +1 -0
- package/dist/components/formItemTip/src/formItemTip.d.ts +24 -0
- package/dist/components/formItemTip/src/formItemTip.mjs +30 -0
- package/dist/components/formItemTip/src/formItemTip.mjs.map +1 -0
- package/dist/components/icon/index.d.ts +12 -0
- package/dist/components/icon/index.mjs +9 -0
- package/dist/components/icon/index.mjs.map +1 -0
- package/dist/components/icon/src/icon.d.ts +40 -0
- package/dist/components/icon/src/icon.mjs +54 -0
- package/dist/components/icon/src/icon.mjs.map +1 -0
- package/dist/components/iconSelector/index.d.ts +7 -0
- package/dist/components/iconSelector/index.mjs +9 -0
- package/dist/components/iconSelector/index.mjs.map +1 -0
- package/dist/components/iconSelector/src/iconSelector.d.ts +35 -0
- package/dist/components/iconSelector/src/iconSelector.mjs +146 -0
- package/dist/components/iconSelector/src/iconSelector.mjs.map +1 -0
- package/dist/components/image/index.d.ts +12 -0
- package/dist/components/image/index.mjs +9 -0
- package/dist/components/image/index.mjs.map +1 -0
- package/dist/components/image/src/image.d.ts +277 -0
- package/dist/components/image/src/image.mjs +97 -0
- package/dist/components/image/src/image.mjs.map +1 -0
- package/dist/components/index.d.ts +22 -0
- package/dist/components/inputDialogPage/index.d.ts +14 -0
- package/dist/components/inputDialogPage/index.mjs +9 -0
- package/dist/components/inputDialogPage/index.mjs.map +1 -0
- package/dist/components/inputDialogPage/src/inputDialogPage.d.ts +134 -0
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs +151 -0
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs.map +1 -0
- package/dist/components/layoutGrid/index.d.ts +17 -0
- package/dist/components/layoutGrid/index.mjs +12 -0
- package/dist/components/layoutGrid/index.mjs.map +1 -0
- package/dist/components/layoutGrid/src/layoutGrid.d.ts +61 -0
- package/dist/components/layoutGrid/src/layoutGrid.mjs +161 -0
- package/dist/components/layoutGrid/src/layoutGrid.mjs.map +1 -0
- package/dist/components/layoutGrid/src/layoutGrid.type.d.ts +7 -0
- package/dist/components/layoutGrid/src/layoutGridItem.d.ts +101 -0
- package/dist/components/layoutGrid/src/layoutGridItem.mjs +85 -0
- package/dist/components/layoutGrid/src/layoutGridItem.mjs.map +1 -0
- package/dist/components/select/index.d.ts +23 -0
- package/dist/components/select/index.mjs +12 -0
- package/dist/components/select/index.mjs.map +1 -0
- package/dist/components/select/src/select.d.ts +618 -0
- package/dist/components/select/src/select.mjs +342 -0
- package/dist/components/select/src/select.mjs.map +1 -0
- package/dist/components/select/src/select.type.d.ts +32 -0
- package/dist/components/select/src/selectOption.d.ts +59 -0
- package/dist/components/select/src/selectOption.mjs +69 -0
- package/dist/components/select/src/selectOption.mjs.map +1 -0
- package/dist/components/selectPage/index.d.ts +14 -0
- package/dist/components/selectPage/index.mjs +9 -0
- package/dist/components/selectPage/index.mjs.map +1 -0
- package/dist/components/selectPage/src/selectPage.d.ts +583 -0
- package/dist/components/selectPage/src/selectPage.mjs +381 -0
- package/dist/components/selectPage/src/selectPage.mjs.map +1 -0
- package/dist/components/selectV2/index.d.ts +15 -0
- package/dist/components/selectV2/index.mjs +9 -0
- package/dist/components/selectV2/index.mjs.map +1 -0
- package/dist/components/selectV2/src/selectV2.d.ts +1477 -0
- package/dist/components/selectV2/src/selectV2.mjs +642 -0
- package/dist/components/selectV2/src/selectV2.mjs.map +1 -0
- package/dist/components/table/images/artwork.mjs +6 -0
- package/dist/components/table/images/artwork.mjs.map +1 -0
- package/dist/components/table/images/notImage.mjs +6 -0
- package/dist/components/table/images/notImage.mjs.map +1 -0
- package/dist/components/table/index.d.ts +34 -0
- package/dist/components/table/index.mjs +25 -0
- package/dist/components/table/index.mjs.map +1 -0
- package/dist/components/table/src/page.type.d.ts +145 -0
- package/dist/components/table/src/page.type.mjs +45 -0
- package/dist/components/table/src/page.type.mjs.map +1 -0
- package/dist/components/table/src/table.d.ts +1522 -0
- package/dist/components/table/src/table.mjs +1004 -0
- package/dist/components/table/src/table.mjs.map +1 -0
- package/dist/components/table/src/table.state.d.ts +113 -0
- package/dist/components/table/src/table.type.d.ts +266 -0
- package/dist/components/table/src/table.type.mjs +20 -0
- package/dist/components/table/src/table.type.mjs.map +1 -0
- package/dist/components/table/src/tableColumn.d.ts +666 -0
- package/dist/components/table/src/tableColumn.mjs +599 -0
- package/dist/components/table/src/tableColumn.mjs.map +1 -0
- package/dist/components/table/src/tableColumnSettingDialog.d.ts +18 -0
- package/dist/components/table/src/tableColumnSettingDialog.mjs +307 -0
- package/dist/components/table/src/tableColumnSettingDialog.mjs.map +1 -0
- package/dist/components/table/src/tablePagination.d.ts +24 -0
- package/dist/components/table/src/tablePagination.mjs +57 -0
- package/dist/components/table/src/tablePagination.mjs.map +1 -0
- package/dist/components/table/src/tableSearchForm.d.ts +86 -0
- package/dist/components/table/src/tableSearchForm.mjs +229 -0
- package/dist/components/table/src/tableSearchForm.mjs.map +1 -0
- package/dist/components/table/src/tableSearchFormItem.d.ts +35 -0
- package/dist/components/table/src/tableSearchFormItem.mjs +216 -0
- package/dist/components/table/src/tableSearchFormItem.mjs.map +1 -0
- package/dist/components/table/src/useTable.d.ts +44 -0
- package/dist/components/table/src/useTable.mjs +407 -0
- package/dist/components/table/src/useTable.mjs.map +1 -0
- package/dist/components/table/utils/table.d.ts +46 -0
- package/dist/components/table/utils/table.mjs +111 -0
- package/dist/components/table/utils/table.mjs.map +1 -0
- package/dist/components/tree/index.d.ts +15 -0
- package/dist/components/tree/index.mjs +9 -0
- package/dist/components/tree/index.mjs.map +1 -0
- package/dist/components/tree/src/tree.d.ts +579 -0
- package/dist/components/tree/src/tree.mjs +334 -0
- package/dist/components/tree/src/tree.mjs.map +1 -0
- package/dist/components/tree/src/tree.props.d.ts +33 -0
- package/dist/components/tree/src/tree.type.d.ts +38 -0
- package/dist/components/treeSelect/index.d.ts +14 -0
- package/dist/components/treeSelect/index.mjs +9 -0
- package/dist/components/treeSelect/index.mjs.map +1 -0
- package/dist/components/treeSelect/src/treeSelect.d.ts +1036 -0
- package/dist/components/treeSelect/src/treeSelect.mjs +456 -0
- package/dist/components/treeSelect/src/treeSelect.mjs.map +1 -0
- package/dist/components/upload/index.d.ts +14 -0
- package/dist/components/upload/index.mjs +9 -0
- package/dist/components/upload/index.mjs.map +1 -0
- package/dist/components/upload/src/upload.d.ts +488 -0
- package/dist/components/upload/src/upload.mjs +134 -0
- package/dist/components/upload/src/upload.mjs.map +1 -0
- package/dist/components/upload/src/useUpload.d.ts +35 -0
- package/dist/components/upload/src/useUpload.mjs +168 -0
- package/dist/components/upload/src/useUpload.mjs.map +1 -0
- package/dist/components/upload/utils/upload.d.ts +34 -0
- package/dist/components/upload/utils/upload.mjs +108 -0
- package/dist/components/upload/utils/upload.mjs.map +1 -0
- package/dist/components/uploadImage/index.d.ts +14 -0
- package/dist/components/uploadImage/index.mjs +9 -0
- package/dist/components/uploadImage/index.mjs.map +1 -0
- package/dist/components/uploadImage/src/uploadImage.d.ts +538 -0
- package/dist/components/uploadImage/src/uploadImage.mjs +201 -0
- package/dist/components/uploadImage/src/uploadImage.mjs.map +1 -0
- package/dist/components/uploadImages/index.d.ts +15 -0
- package/dist/components/uploadImages/index.mjs +9 -0
- package/dist/components/uploadImages/index.mjs.map +1 -0
- package/dist/components/uploadImages/src/uploadImages.d.ts +507 -0
- package/dist/components/uploadImages/src/uploadImages.mjs +185 -0
- package/dist/components/uploadImages/src/uploadImages.mjs.map +1 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/mime.d.ts +59 -0
- package/dist/constants/mime.mjs +64 -0
- package/dist/constants/mime.mjs.map +1 -0
- package/dist/constants/regex.d.ts +76 -0
- package/dist/constants/regex.mjs +81 -0
- package/dist/constants/regex.mjs.map +1 -0
- package/dist/directive.d.ts +4 -0
- package/dist/directive.mjs +20 -0
- package/dist/directive.mjs.map +1 -0
- package/dist/directives/click-copy/index.d.ts +3 -0
- package/dist/directives/click-copy/index.mjs +39 -0
- package/dist/directives/click-copy/index.mjs.map +1 -0
- package/dist/directives/click-debounce/index.d.ts +7 -0
- package/dist/directives/click-debounce/index.mjs +17 -0
- package/dist/directives/click-debounce/index.mjs.map +1 -0
- package/dist/directives/click-draggable/index.d.ts +3 -0
- package/dist/directives/click-draggable/index.mjs +31 -0
- package/dist/directives/click-draggable/index.mjs.map +1 -0
- package/dist/directives/click-icon-copy/index.d.ts +3 -0
- package/dist/directives/click-icon-copy/index.mjs +47 -0
- package/dist/directives/click-icon-copy/index.mjs.map +1 -0
- package/dist/directives/click-longpress/index.d.ts +3 -0
- package/dist/directives/click-longpress/index.mjs +31 -0
- package/dist/directives/click-longpress/index.mjs.map +1 -0
- package/dist/directives/click-throttle/index.d.ts +7 -0
- package/dist/directives/click-throttle/index.mjs +26 -0
- package/dist/directives/click-throttle/index.mjs.map +1 -0
- package/dist/directives/index.d.ts +6 -0
- package/dist/element-plus.d.ts +8 -0
- package/dist/element-plus.mjs +171 -0
- package/dist/element-plus.mjs.map +1 -0
- package/dist/global.d.ts +58 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/use-loading/index.d.ts +7 -0
- package/dist/hooks/use-loading/index.mjs +43 -0
- package/dist/hooks/use-loading/index.mjs.map +1 -0
- package/dist/hooks/use-overlay/index.d.ts +11 -0
- package/dist/hooks/use-overlay/index.mjs +33 -0
- package/dist/hooks/use-overlay/index.mjs.map +1 -0
- package/dist/hooks/use-screenFull/index.d.ts +15 -0
- package/dist/hooks/use-screenFull/index.mjs +56 -0
- package/dist/hooks/use-screenFull/index.mjs.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.global.min.js +23 -0
- package/dist/index.global.min.js.map +1 -0
- package/dist/index.mjs +70 -0
- package/dist/index.mjs.map +1 -0
- package/dist/make-installer.d.ts +8 -0
- package/dist/make-installer.mjs +28 -0
- package/dist/make-installer.mjs.map +1 -0
- package/dist/utils/async/index.d.ts +35 -0
- package/dist/utils/async/index.mjs +94 -0
- package/dist/utils/async/index.mjs.map +1 -0
- package/dist/utils/date/index.d.ts +74 -0
- package/dist/utils/date/index.mjs +190 -0
- package/dist/utils/date/index.mjs.map +1 -0
- package/dist/utils/dom/index.d.ts +9 -0
- package/dist/utils/dom/index.mjs +35 -0
- package/dist/utils/dom/index.mjs.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/string/index.d.ts +20 -0
- package/dist/utils/string/index.mjs +101 -0
- package/dist/utils/string/index.mjs.map +1 -0
- package/dist/utils/vue/emits.d.ts +23 -0
- package/dist/utils/vue/emits.mjs +47 -0
- package/dist/utils/vue/emits.mjs.map +1 -0
- package/dist/utils/vue/expose.d.ts +8 -0
- package/dist/utils/vue/expose.mjs +16 -0
- package/dist/utils/vue/expose.mjs.map +1 -0
- package/dist/utils/vue/func.d.ts +10 -0
- package/dist/utils/vue/func.mjs +16 -0
- package/dist/utils/vue/func.mjs.map +1 -0
- package/dist/utils/vue/index.d.ts +13 -0
- package/dist/utils/vue/install.d.ts +47 -0
- package/dist/utils/vue/install.mjs +123 -0
- package/dist/utils/vue/install.mjs.map +1 -0
- package/dist/utils/vue/props.d.ts +19 -0
- package/dist/utils/vue/props.mjs +41 -0
- package/dist/utils/vue/props.mjs.map +1 -0
- package/dist/utils/vue/render.d.ts +8 -0
- package/dist/utils/vue/render.mjs +17 -0
- package/dist/utils/vue/render.mjs.map +1 -0
- package/dist/utils/vue/slots.d.ts +18 -0
- package/dist/utils/vue/slots.mjs +13 -0
- package/dist/utils/vue/slots.mjs.map +1 -0
- package/dist/utils/vue/with.d.ts +8 -0
- package/dist/utils/vue/with.mjs +15 -0
- package/dist/utils/vue/with.mjs.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.mjs +7 -0
- package/dist/version.mjs.map +1 -0
- package/package.json +91 -101
- package/dist/index.full.js +0 -27745
- package/dist/index.full.js.map +0 -1
- package/dist/index.full.min.js +0 -11042
- package/dist/index.full.min.js.map +0 -1
- package/dist/index.full.min.mjs +0 -11033
- package/dist/index.full.min.mjs.map +0 -1
- package/dist/index.full.mjs +0 -27737
- package/dist/index.full.mjs.map +0 -1
- package/dist/styles/index.css +0 -1003
- package/dist/styles/index.css.map +0 -1
- package/es/_virtual/_rolldown/runtime.mjs +0 -1
- package/es/component.d.ts +0 -3
- package/es/component.mjs +0 -2
- package/es/component.mjs.map +0 -1
- package/es/components/avatar/index.d.ts +0 -14
- package/es/components/avatar/index.mjs +0 -2
- package/es/components/avatar/index.mjs.map +0 -1
- package/es/components/avatar/src/avatar.d.ts +0 -125
- package/es/components/avatar/src/avatar.mjs +0 -2
- package/es/components/avatar/src/avatar.mjs.map +0 -1
- package/es/components/button/index.d.ts +0 -15
- package/es/components/button/index.mjs +0 -2
- package/es/components/button/index.mjs.map +0 -1
- package/es/components/button/src/button.d.ts +0 -177
- package/es/components/button/src/button.mjs +0 -2
- package/es/components/button/src/button.mjs.map +0 -1
- package/es/components/carNumber/index.d.ts +0 -9
- package/es/components/carNumber/index.mjs +0 -2
- package/es/components/carNumber/index.mjs.map +0 -1
- package/es/components/carNumber/src/carNumber.d.ts +0 -228
- package/es/components/carNumber/src/carNumber.mjs +0 -2
- package/es/components/carNumber/src/carNumber.mjs.map +0 -1
- package/es/components/carNumber/src/common.d.ts +0 -15
- package/es/components/carNumber/src/common.mjs +0 -2
- package/es/components/carNumber/src/common.mjs.map +0 -1
- package/es/components/contextMenu/index.d.ts +0 -9
- package/es/components/contextMenu/index.mjs +0 -2
- package/es/components/contextMenu/index.mjs.map +0 -1
- package/es/components/contextMenu/src/contextMenu.d.ts +0 -32
- package/es/components/contextMenu/src/contextMenu.mjs +0 -2
- package/es/components/contextMenu/src/contextMenu.mjs.map +0 -1
- package/es/components/contextMenu/src/contextMenu.type.d.ts +0 -33
- package/es/components/dialog/index.d.ts +0 -14
- package/es/components/dialog/index.mjs +0 -2
- package/es/components/dialog/index.mjs.map +0 -1
- package/es/components/dialog/src/dialog.d.ts +0 -454
- package/es/components/dialog/src/dialog.mjs +0 -2
- package/es/components/dialog/src/dialog.mjs.map +0 -1
- package/es/components/drawer/index.d.ts +0 -14
- package/es/components/drawer/index.mjs +0 -2
- package/es/components/drawer/index.mjs.map +0 -1
- package/es/components/drawer/src/drawer.d.ts +0 -458
- package/es/components/drawer/src/drawer.mjs +0 -2
- package/es/components/drawer/src/drawer.mjs.map +0 -1
- package/es/components/form/index.d.ts +0 -23
- package/es/components/form/index.mjs +0 -2
- package/es/components/form/index.mjs.map +0 -1
- package/es/components/form/src/form.d.ts +0 -194
- package/es/components/form/src/form.mjs +0 -2
- package/es/components/form/src/form.mjs.map +0 -1
- package/es/components/form/src/formItem.d.ts +0 -204
- package/es/components/form/src/formItem.mjs +0 -2
- package/es/components/form/src/formItem.mjs.map +0 -1
- package/es/components/form/utils/form.d.ts +0 -81
- package/es/components/form/utils/form.mjs +0 -2
- package/es/components/form/utils/form.mjs.map +0 -1
- package/es/components/formItemTip/index.d.ts +0 -12
- package/es/components/formItemTip/index.mjs +0 -2
- package/es/components/formItemTip/index.mjs.map +0 -1
- package/es/components/formItemTip/src/formItemTip.d.ts +0 -22
- package/es/components/formItemTip/src/formItemTip.mjs +0 -2
- package/es/components/formItemTip/src/formItemTip.mjs.map +0 -1
- package/es/components/icon/index.d.ts +0 -12
- package/es/components/icon/index.mjs +0 -2
- package/es/components/icon/index.mjs.map +0 -1
- package/es/components/icon/src/icon.d.ts +0 -39
- package/es/components/icon/src/icon.mjs +0 -2
- package/es/components/icon/src/icon.mjs.map +0 -1
- package/es/components/iconSelector/index.d.ts +0 -7
- package/es/components/iconSelector/index.mjs +0 -2
- package/es/components/iconSelector/index.mjs.map +0 -1
- package/es/components/iconSelector/src/iconSelector.d.ts +0 -23
- package/es/components/iconSelector/src/iconSelector.mjs +0 -2
- package/es/components/iconSelector/src/iconSelector.mjs.map +0 -1
- package/es/components/image/index.d.ts +0 -12
- package/es/components/image/index.mjs +0 -2
- package/es/components/image/index.mjs.map +0 -1
- package/es/components/image/src/image.d.ts +0 -232
- package/es/components/image/src/image.mjs +0 -2
- package/es/components/image/src/image.mjs.map +0 -1
- package/es/components/index.d.ts +0 -22
- package/es/components/index.mjs +0 -2
- package/es/components/index.mjs.map +0 -1
- package/es/components/inputDialogPage/index.d.ts +0 -14
- package/es/components/inputDialogPage/index.mjs +0 -2
- package/es/components/inputDialogPage/index.mjs.map +0 -1
- package/es/components/inputDialogPage/src/inputDialogPage.d.ts +0 -132
- package/es/components/inputDialogPage/src/inputDialogPage.mjs +0 -2
- package/es/components/inputDialogPage/src/inputDialogPage.mjs.map +0 -1
- package/es/components/layoutGrid/index.d.ts +0 -16
- package/es/components/layoutGrid/index.mjs +0 -2
- package/es/components/layoutGrid/index.mjs.map +0 -1
- package/es/components/layoutGrid/src/layoutGrid.d.ts +0 -60
- package/es/components/layoutGrid/src/layoutGrid.mjs +0 -2
- package/es/components/layoutGrid/src/layoutGrid.mjs.map +0 -1
- package/es/components/layoutGrid/src/layoutGrid.type.d.ts +0 -12
- package/es/components/layoutGrid/src/layoutGrid.type.mjs +0 -0
- package/es/components/layoutGrid/src/layoutGridItem.d.ts +0 -100
- package/es/components/layoutGrid/src/layoutGridItem.mjs +0 -2
- package/es/components/layoutGrid/src/layoutGridItem.mjs.map +0 -1
- package/es/components/select/index.d.ts +0 -22
- package/es/components/select/index.mjs +0 -2
- package/es/components/select/index.mjs.map +0 -1
- package/es/components/select/src/select.d.ts +0 -1206
- package/es/components/select/src/select.mjs +0 -2
- package/es/components/select/src/select.mjs.map +0 -1
- package/es/components/select/src/select.type.d.ts +0 -28
- package/es/components/select/src/select.type.mjs +0 -0
- package/es/components/select/src/selectOption.d.ts +0 -99
- package/es/components/select/src/selectOption.mjs +0 -2
- package/es/components/select/src/selectOption.mjs.map +0 -1
- package/es/components/selectPage/index.d.ts +0 -14
- package/es/components/selectPage/index.mjs +0 -2
- package/es/components/selectPage/index.mjs.map +0 -1
- package/es/components/selectPage/src/selectPage.d.ts +0 -609
- package/es/components/selectPage/src/selectPage.mjs +0 -2
- package/es/components/selectPage/src/selectPage.mjs.map +0 -1
- package/es/components/selectV2/index.d.ts +0 -14
- package/es/components/selectV2/index.mjs +0 -2
- package/es/components/selectV2/index.mjs.map +0 -1
- package/es/components/selectV2/src/selectV2.d.ts +0 -1399
- package/es/components/selectV2/src/selectV2.mjs +0 -2
- package/es/components/selectV2/src/selectV2.mjs.map +0 -1
- package/es/components/table/images/artwork.mjs +0 -2
- package/es/components/table/images/artwork.mjs.map +0 -1
- package/es/components/table/images/index.d.ts +0 -4
- package/es/components/table/images/notImage.mjs +0 -2
- package/es/components/table/images/notImage.mjs.map +0 -1
- package/es/components/table/index.d.ts +0 -35
- package/es/components/table/index.mjs +0 -2
- package/es/components/table/index.mjs.map +0 -1
- package/es/components/table/src/page.type.d.ts +0 -145
- package/es/components/table/src/page.type.mjs +0 -2
- package/es/components/table/src/page.type.mjs.map +0 -1
- package/es/components/table/src/table.d.ts +0 -1439
- package/es/components/table/src/table.mjs +0 -2
- package/es/components/table/src/table.mjs.map +0 -1
- package/es/components/table/src/table.state.d.ts +0 -111
- package/es/components/table/src/table.state.mjs +0 -0
- package/es/components/table/src/table.type.d.ts +0 -261
- package/es/components/table/src/table.type.mjs +0 -2
- package/es/components/table/src/table.type.mjs.map +0 -1
- package/es/components/table/src/tableColumn.d.ts +0 -658
- package/es/components/table/src/tableColumn.mjs +0 -2
- package/es/components/table/src/tableColumn.mjs.map +0 -1
- package/es/components/table/src/tableColumnSettingDialog.d.ts +0 -18
- package/es/components/table/src/tableColumnSettingDialog.mjs +0 -2
- package/es/components/table/src/tableColumnSettingDialog.mjs.map +0 -1
- package/es/components/table/src/tablePagination.d.ts +0 -24
- package/es/components/table/src/tablePagination.mjs +0 -2
- package/es/components/table/src/tablePagination.mjs.map +0 -1
- package/es/components/table/src/tableSearchForm.d.ts +0 -88
- package/es/components/table/src/tableSearchForm.mjs +0 -2
- package/es/components/table/src/tableSearchForm.mjs.map +0 -1
- package/es/components/table/src/tableSearchFormItem.d.ts +0 -37
- package/es/components/table/src/tableSearchFormItem.mjs +0 -2
- package/es/components/table/src/tableSearchFormItem.mjs.map +0 -1
- package/es/components/table/src/useTable.d.ts +0 -32
- package/es/components/table/src/useTable.mjs +0 -2
- package/es/components/table/src/useTable.mjs.map +0 -1
- package/es/components/table/utils/table.d.ts +0 -45
- package/es/components/table/utils/table.mjs +0 -2
- package/es/components/table/utils/table.mjs.map +0 -1
- package/es/components/tree/index.d.ts +0 -15
- package/es/components/tree/index.mjs +0 -2
- package/es/components/tree/index.mjs.map +0 -1
- package/es/components/tree/src/tree.d.ts +0 -562
- package/es/components/tree/src/tree.mjs +0 -2
- package/es/components/tree/src/tree.mjs.map +0 -1
- package/es/components/tree/src/tree.props.d.ts +0 -81
- package/es/components/tree/src/tree.props.mjs +0 -2
- package/es/components/tree/src/tree.props.mjs.map +0 -1
- package/es/components/tree/src/tree.type.d.ts +0 -36
- package/es/components/tree/src/tree.type.mjs +0 -0
- package/es/components/treeSelect/index.d.ts +0 -14
- package/es/components/treeSelect/index.mjs +0 -2
- package/es/components/treeSelect/index.mjs.map +0 -1
- package/es/components/treeSelect/src/treeSelect.d.ts +0 -965
- package/es/components/treeSelect/src/treeSelect.mjs +0 -2
- package/es/components/treeSelect/src/treeSelect.mjs.map +0 -1
- package/es/components/upload/index.d.ts +0 -15
- package/es/components/upload/index.mjs +0 -2
- package/es/components/upload/index.mjs.map +0 -1
- package/es/components/upload/src/upload.d.ts +0 -529
- package/es/components/upload/src/upload.mjs +0 -2
- package/es/components/upload/src/upload.mjs.map +0 -1
- package/es/components/upload/src/useUpload.d.ts +0 -65
- package/es/components/upload/src/useUpload.mjs +0 -2
- package/es/components/upload/src/useUpload.mjs.map +0 -1
- package/es/components/upload/utils/upload.d.ts +0 -30
- package/es/components/upload/utils/upload.mjs +0 -2
- package/es/components/upload/utils/upload.mjs.map +0 -1
- package/es/components/uploadImage/index.d.ts +0 -14
- package/es/components/uploadImage/index.mjs +0 -2
- package/es/components/uploadImage/index.mjs.map +0 -1
- package/es/components/uploadImage/src/uploadImage.d.ts +0 -579
- package/es/components/uploadImage/src/uploadImage.mjs +0 -2
- package/es/components/uploadImage/src/uploadImage.mjs.map +0 -1
- package/es/components/uploadImages/index.d.ts +0 -14
- package/es/components/uploadImages/index.mjs +0 -2
- package/es/components/uploadImages/index.mjs.map +0 -1
- package/es/components/uploadImages/src/uploadImages.d.ts +0 -548
- package/es/components/uploadImages/src/uploadImages.mjs +0 -2
- package/es/components/uploadImages/src/uploadImages.mjs.map +0 -1
- package/es/constants/index.d.ts +0 -2
- package/es/constants/index.mjs +0 -1
- package/es/constants/mime.d.ts +0 -61
- package/es/constants/mime.mjs +0 -2
- package/es/constants/mime.mjs.map +0 -1
- package/es/constants/regex.d.ts +0 -78
- package/es/constants/regex.mjs +0 -2
- package/es/constants/regex.mjs.map +0 -1
- package/es/directive.d.ts +0 -2
- package/es/directive.mjs +0 -2
- package/es/directive.mjs.map +0 -1
- package/es/directives/click-copy/index.d.ts +0 -2
- package/es/directives/click-copy/index.mjs +0 -2
- package/es/directives/click-copy/index.mjs.map +0 -1
- package/es/directives/click-debounce/index.d.ts +0 -2
- package/es/directives/click-debounce/index.mjs +0 -2
- package/es/directives/click-debounce/index.mjs.map +0 -1
- package/es/directives/click-draggable/index.d.ts +0 -2
- package/es/directives/click-draggable/index.mjs +0 -2
- package/es/directives/click-draggable/index.mjs.map +0 -1
- package/es/directives/click-icon-copy/index.d.ts +0 -2
- package/es/directives/click-icon-copy/index.mjs +0 -2
- package/es/directives/click-icon-copy/index.mjs.map +0 -1
- package/es/directives/click-longpress/index.d.ts +0 -2
- package/es/directives/click-longpress/index.mjs +0 -2
- package/es/directives/click-longpress/index.mjs.map +0 -1
- package/es/directives/click-throttle/index.d.ts +0 -2
- package/es/directives/click-throttle/index.mjs +0 -2
- package/es/directives/click-throttle/index.mjs.map +0 -1
- package/es/directives/index.d.ts +0 -6
- package/es/directives/index.mjs +0 -1
- package/es/element-plus.d.ts +0 -2
- package/es/element-plus.mjs +0 -2
- package/es/element-plus.mjs.map +0 -1
- package/es/hooks/index.d.ts +0 -3
- package/es/hooks/index.mjs +0 -1
- package/es/hooks/use-loading/index.d.ts +0 -4
- package/es/hooks/use-loading/index.mjs +0 -2
- package/es/hooks/use-loading/index.mjs.map +0 -1
- package/es/hooks/use-overlay/index.d.ts +0 -4
- package/es/hooks/use-overlay/index.mjs +0 -2
- package/es/hooks/use-overlay/index.mjs.map +0 -1
- package/es/hooks/use-screenFull/index.d.ts +0 -7
- package/es/hooks/use-screenFull/index.mjs +0 -2
- package/es/hooks/use-screenFull/index.mjs.map +0 -1
- package/es/index.d.ts +0 -14
- package/es/index.es.d.ts +0 -6
- package/es/index.mjs +0 -2
- package/es/index.mjs.map +0 -1
- package/es/make-installer.d.ts +0 -6
- package/es/make-installer.mjs +0 -2
- package/es/make-installer.mjs.map +0 -1
- package/es/version.d.ts +0 -1
- package/es/version.mjs +0 -2
- package/es/version.mjs.map +0 -1
- package/global.d.ts +0 -2
- package/lib/_virtual/_rolldown/runtime.js +0 -1
- package/lib/component.d.ts +0 -3
- package/lib/component.js +0 -2
- package/lib/component.js.map +0 -1
- package/lib/components/avatar/index.d.ts +0 -14
- package/lib/components/avatar/index.js +0 -2
- package/lib/components/avatar/index.js.map +0 -1
- package/lib/components/avatar/src/avatar.d.ts +0 -125
- package/lib/components/avatar/src/avatar.js +0 -2
- package/lib/components/avatar/src/avatar.js.map +0 -1
- package/lib/components/button/index.d.ts +0 -15
- package/lib/components/button/index.js +0 -2
- package/lib/components/button/index.js.map +0 -1
- package/lib/components/button/src/button.d.ts +0 -177
- package/lib/components/button/src/button.js +0 -2
- package/lib/components/button/src/button.js.map +0 -1
- package/lib/components/carNumber/index.d.ts +0 -9
- package/lib/components/carNumber/index.js +0 -2
- package/lib/components/carNumber/index.js.map +0 -1
- package/lib/components/carNumber/src/carNumber.d.ts +0 -228
- package/lib/components/carNumber/src/carNumber.js +0 -2
- package/lib/components/carNumber/src/carNumber.js.map +0 -1
- package/lib/components/carNumber/src/common.d.ts +0 -15
- package/lib/components/carNumber/src/common.js +0 -2
- package/lib/components/carNumber/src/common.js.map +0 -1
- package/lib/components/contextMenu/index.d.ts +0 -9
- package/lib/components/contextMenu/index.js +0 -2
- package/lib/components/contextMenu/index.js.map +0 -1
- package/lib/components/contextMenu/src/contextMenu.d.ts +0 -32
- package/lib/components/contextMenu/src/contextMenu.js +0 -2
- package/lib/components/contextMenu/src/contextMenu.js.map +0 -1
- package/lib/components/contextMenu/src/contextMenu.type.d.ts +0 -33
- package/lib/components/contextMenu/src/contextMenu.type.js +0 -0
- package/lib/components/dialog/index.d.ts +0 -14
- package/lib/components/dialog/index.js +0 -2
- package/lib/components/dialog/index.js.map +0 -1
- package/lib/components/dialog/src/dialog.d.ts +0 -454
- package/lib/components/dialog/src/dialog.js +0 -2
- package/lib/components/dialog/src/dialog.js.map +0 -1
- package/lib/components/drawer/index.d.ts +0 -14
- package/lib/components/drawer/index.js +0 -2
- package/lib/components/drawer/index.js.map +0 -1
- package/lib/components/drawer/src/drawer.d.ts +0 -458
- package/lib/components/drawer/src/drawer.js +0 -2
- package/lib/components/drawer/src/drawer.js.map +0 -1
- package/lib/components/form/index.d.ts +0 -23
- package/lib/components/form/index.js +0 -2
- package/lib/components/form/index.js.map +0 -1
- package/lib/components/form/src/form.d.ts +0 -194
- package/lib/components/form/src/form.js +0 -2
- package/lib/components/form/src/form.js.map +0 -1
- package/lib/components/form/src/formItem.d.ts +0 -204
- package/lib/components/form/src/formItem.js +0 -2
- package/lib/components/form/src/formItem.js.map +0 -1
- package/lib/components/form/utils/form.d.ts +0 -81
- package/lib/components/form/utils/form.js +0 -2
- package/lib/components/form/utils/form.js.map +0 -1
- package/lib/components/formItemTip/index.d.ts +0 -12
- package/lib/components/formItemTip/index.js +0 -2
- package/lib/components/formItemTip/index.js.map +0 -1
- package/lib/components/formItemTip/src/formItemTip.d.ts +0 -22
- package/lib/components/formItemTip/src/formItemTip.js +0 -2
- package/lib/components/formItemTip/src/formItemTip.js.map +0 -1
- package/lib/components/icon/index.d.ts +0 -12
- package/lib/components/icon/index.js +0 -2
- package/lib/components/icon/index.js.map +0 -1
- package/lib/components/icon/src/icon.d.ts +0 -39
- package/lib/components/icon/src/icon.js +0 -2
- package/lib/components/icon/src/icon.js.map +0 -1
- package/lib/components/iconSelector/index.d.ts +0 -7
- package/lib/components/iconSelector/index.js +0 -2
- package/lib/components/iconSelector/index.js.map +0 -1
- package/lib/components/iconSelector/src/iconSelector.d.ts +0 -23
- package/lib/components/iconSelector/src/iconSelector.js +0 -2
- package/lib/components/iconSelector/src/iconSelector.js.map +0 -1
- package/lib/components/image/index.d.ts +0 -12
- package/lib/components/image/index.js +0 -2
- package/lib/components/image/index.js.map +0 -1
- package/lib/components/image/src/image.d.ts +0 -232
- package/lib/components/image/src/image.js +0 -2
- package/lib/components/image/src/image.js.map +0 -1
- package/lib/components/index.d.ts +0 -22
- package/lib/components/index.js +0 -2
- package/lib/components/index.js.map +0 -1
- package/lib/components/inputDialogPage/index.d.ts +0 -14
- package/lib/components/inputDialogPage/index.js +0 -2
- package/lib/components/inputDialogPage/index.js.map +0 -1
- package/lib/components/inputDialogPage/src/inputDialogPage.d.ts +0 -132
- package/lib/components/inputDialogPage/src/inputDialogPage.js +0 -2
- package/lib/components/inputDialogPage/src/inputDialogPage.js.map +0 -1
- package/lib/components/layoutGrid/index.d.ts +0 -16
- package/lib/components/layoutGrid/index.js +0 -2
- package/lib/components/layoutGrid/index.js.map +0 -1
- package/lib/components/layoutGrid/src/layoutGrid.d.ts +0 -60
- package/lib/components/layoutGrid/src/layoutGrid.js +0 -2
- package/lib/components/layoutGrid/src/layoutGrid.js.map +0 -1
- package/lib/components/layoutGrid/src/layoutGrid.type.d.ts +0 -12
- package/lib/components/layoutGrid/src/layoutGrid.type.js +0 -0
- package/lib/components/layoutGrid/src/layoutGridItem.d.ts +0 -100
- package/lib/components/layoutGrid/src/layoutGridItem.js +0 -2
- package/lib/components/layoutGrid/src/layoutGridItem.js.map +0 -1
- package/lib/components/select/index.d.ts +0 -22
- package/lib/components/select/index.js +0 -2
- package/lib/components/select/index.js.map +0 -1
- package/lib/components/select/src/select.d.ts +0 -1206
- package/lib/components/select/src/select.js +0 -2
- package/lib/components/select/src/select.js.map +0 -1
- package/lib/components/select/src/select.type.d.ts +0 -28
- package/lib/components/select/src/select.type.js +0 -0
- package/lib/components/select/src/selectOption.d.ts +0 -99
- package/lib/components/select/src/selectOption.js +0 -2
- package/lib/components/select/src/selectOption.js.map +0 -1
- package/lib/components/selectPage/index.d.ts +0 -14
- package/lib/components/selectPage/index.js +0 -2
- package/lib/components/selectPage/index.js.map +0 -1
- package/lib/components/selectPage/src/selectPage.d.ts +0 -609
- package/lib/components/selectPage/src/selectPage.js +0 -2
- package/lib/components/selectPage/src/selectPage.js.map +0 -1
- package/lib/components/selectV2/index.d.ts +0 -14
- package/lib/components/selectV2/index.js +0 -2
- package/lib/components/selectV2/index.js.map +0 -1
- package/lib/components/selectV2/src/selectV2.d.ts +0 -1399
- package/lib/components/selectV2/src/selectV2.js +0 -2
- package/lib/components/selectV2/src/selectV2.js.map +0 -1
- package/lib/components/table/images/artwork.js +0 -2
- package/lib/components/table/images/artwork.js.map +0 -1
- package/lib/components/table/images/index.d.ts +0 -4
- package/lib/components/table/images/notImage.js +0 -2
- package/lib/components/table/images/notImage.js.map +0 -1
- package/lib/components/table/index.d.ts +0 -35
- package/lib/components/table/index.js +0 -2
- package/lib/components/table/index.js.map +0 -1
- package/lib/components/table/src/page.type.d.ts +0 -145
- package/lib/components/table/src/page.type.js +0 -2
- package/lib/components/table/src/page.type.js.map +0 -1
- package/lib/components/table/src/table.d.ts +0 -1439
- package/lib/components/table/src/table.js +0 -2
- package/lib/components/table/src/table.js.map +0 -1
- package/lib/components/table/src/table.state.d.ts +0 -111
- package/lib/components/table/src/table.state.js +0 -0
- package/lib/components/table/src/table.type.d.ts +0 -261
- package/lib/components/table/src/table.type.js +0 -2
- package/lib/components/table/src/table.type.js.map +0 -1
- package/lib/components/table/src/tableColumn.d.ts +0 -658
- package/lib/components/table/src/tableColumn.js +0 -2
- package/lib/components/table/src/tableColumn.js.map +0 -1
- package/lib/components/table/src/tableColumnSettingDialog.d.ts +0 -18
- package/lib/components/table/src/tableColumnSettingDialog.js +0 -2
- package/lib/components/table/src/tableColumnSettingDialog.js.map +0 -1
- package/lib/components/table/src/tablePagination.d.ts +0 -24
- package/lib/components/table/src/tablePagination.js +0 -2
- package/lib/components/table/src/tablePagination.js.map +0 -1
- package/lib/components/table/src/tableSearchForm.d.ts +0 -88
- package/lib/components/table/src/tableSearchForm.js +0 -2
- package/lib/components/table/src/tableSearchForm.js.map +0 -1
- package/lib/components/table/src/tableSearchFormItem.d.ts +0 -37
- package/lib/components/table/src/tableSearchFormItem.js +0 -2
- package/lib/components/table/src/tableSearchFormItem.js.map +0 -1
- package/lib/components/table/src/useTable.d.ts +0 -32
- package/lib/components/table/src/useTable.js +0 -2
- package/lib/components/table/src/useTable.js.map +0 -1
- package/lib/components/table/utils/table.d.ts +0 -45
- package/lib/components/table/utils/table.js +0 -2
- package/lib/components/table/utils/table.js.map +0 -1
- package/lib/components/tree/index.d.ts +0 -15
- package/lib/components/tree/index.js +0 -2
- package/lib/components/tree/index.js.map +0 -1
- package/lib/components/tree/src/tree.d.ts +0 -562
- package/lib/components/tree/src/tree.js +0 -2
- package/lib/components/tree/src/tree.js.map +0 -1
- package/lib/components/tree/src/tree.props.d.ts +0 -81
- package/lib/components/tree/src/tree.props.js +0 -2
- package/lib/components/tree/src/tree.props.js.map +0 -1
- package/lib/components/tree/src/tree.type.d.ts +0 -36
- package/lib/components/tree/src/tree.type.js +0 -0
- package/lib/components/treeSelect/index.d.ts +0 -14
- package/lib/components/treeSelect/index.js +0 -2
- package/lib/components/treeSelect/index.js.map +0 -1
- package/lib/components/treeSelect/src/treeSelect.d.ts +0 -965
- package/lib/components/treeSelect/src/treeSelect.js +0 -2
- package/lib/components/treeSelect/src/treeSelect.js.map +0 -1
- package/lib/components/upload/index.d.ts +0 -15
- package/lib/components/upload/index.js +0 -2
- package/lib/components/upload/index.js.map +0 -1
- package/lib/components/upload/src/upload.d.ts +0 -529
- package/lib/components/upload/src/upload.js +0 -2
- package/lib/components/upload/src/upload.js.map +0 -1
- package/lib/components/upload/src/useUpload.d.ts +0 -65
- package/lib/components/upload/src/useUpload.js +0 -2
- package/lib/components/upload/src/useUpload.js.map +0 -1
- package/lib/components/upload/utils/upload.d.ts +0 -30
- package/lib/components/upload/utils/upload.js +0 -2
- package/lib/components/upload/utils/upload.js.map +0 -1
- package/lib/components/uploadImage/index.d.ts +0 -14
- package/lib/components/uploadImage/index.js +0 -2
- package/lib/components/uploadImage/index.js.map +0 -1
- package/lib/components/uploadImage/src/uploadImage.d.ts +0 -579
- package/lib/components/uploadImage/src/uploadImage.js +0 -2
- package/lib/components/uploadImage/src/uploadImage.js.map +0 -1
- package/lib/components/uploadImages/index.d.ts +0 -14
- package/lib/components/uploadImages/index.js +0 -2
- package/lib/components/uploadImages/index.js.map +0 -1
- package/lib/components/uploadImages/src/uploadImages.d.ts +0 -548
- package/lib/components/uploadImages/src/uploadImages.js +0 -2
- package/lib/components/uploadImages/src/uploadImages.js.map +0 -1
- package/lib/constants/index.d.ts +0 -2
- package/lib/constants/index.js +0 -1
- package/lib/constants/mime.d.ts +0 -61
- package/lib/constants/mime.js +0 -2
- package/lib/constants/mime.js.map +0 -1
- package/lib/constants/regex.d.ts +0 -78
- package/lib/constants/regex.js +0 -2
- package/lib/constants/regex.js.map +0 -1
- package/lib/directive.d.ts +0 -2
- package/lib/directive.js +0 -2
- package/lib/directive.js.map +0 -1
- package/lib/directives/click-copy/index.d.ts +0 -2
- package/lib/directives/click-copy/index.js +0 -2
- package/lib/directives/click-copy/index.js.map +0 -1
- package/lib/directives/click-debounce/index.d.ts +0 -2
- package/lib/directives/click-debounce/index.js +0 -2
- package/lib/directives/click-debounce/index.js.map +0 -1
- package/lib/directives/click-draggable/index.d.ts +0 -2
- package/lib/directives/click-draggable/index.js +0 -2
- package/lib/directives/click-draggable/index.js.map +0 -1
- package/lib/directives/click-icon-copy/index.d.ts +0 -2
- package/lib/directives/click-icon-copy/index.js +0 -2
- package/lib/directives/click-icon-copy/index.js.map +0 -1
- package/lib/directives/click-longpress/index.d.ts +0 -2
- package/lib/directives/click-longpress/index.js +0 -2
- package/lib/directives/click-longpress/index.js.map +0 -1
- package/lib/directives/click-throttle/index.d.ts +0 -2
- package/lib/directives/click-throttle/index.js +0 -2
- package/lib/directives/click-throttle/index.js.map +0 -1
- package/lib/directives/index.d.ts +0 -6
- package/lib/directives/index.js +0 -1
- package/lib/element-plus.d.ts +0 -2
- package/lib/element-plus.js +0 -2
- package/lib/element-plus.js.map +0 -1
- package/lib/hooks/index.d.ts +0 -3
- package/lib/hooks/index.js +0 -1
- package/lib/hooks/use-loading/index.d.ts +0 -4
- package/lib/hooks/use-loading/index.js +0 -2
- package/lib/hooks/use-loading/index.js.map +0 -1
- package/lib/hooks/use-overlay/index.d.ts +0 -4
- package/lib/hooks/use-overlay/index.js +0 -2
- package/lib/hooks/use-overlay/index.js.map +0 -1
- package/lib/hooks/use-screenFull/index.d.ts +0 -7
- package/lib/hooks/use-screenFull/index.js +0 -2
- package/lib/hooks/use-screenFull/index.js.map +0 -1
- package/lib/index.d.ts +0 -14
- package/lib/index.es.d.ts +0 -6
- package/lib/index.js +0 -2
- package/lib/index.js.map +0 -1
- package/lib/make-installer.d.ts +0 -6
- package/lib/make-installer.js +0 -2
- package/lib/make-installer.js.map +0 -1
- package/lib/version.d.ts +0 -1
- package/lib/version.js +0 -2
- package/lib/version.js.map +0 -1
- package/styles/common/animation.scss +0 -46
- package/styles/common/common.scss +0 -44
- package/styles/common/loading.scss +0 -29
- package/styles/common/overlay.scss +0 -12
- package/styles/components/carNumber.scss +0 -44
- package/styles/components/contextMenu.scss +0 -34
- package/styles/components/dialog.scss +0 -88
- package/styles/components/drawer.scss +0 -87
- package/styles/components/form.scss +0 -44
- package/styles/components/formItemTip.scss +0 -7
- package/styles/components/image.scss +0 -19
- package/styles/components/select.scss +0 -35
- package/styles/components/selectPage.scss +0 -44
- package/styles/components/selectV2.scss +0 -22
- package/styles/components/table.scss +0 -440
- package/styles/components/tree.scss +0 -115
- package/styles/components/uploadImage.scss +0 -61
- package/styles/components/uploadImages.scss +0 -9
- package/styles/index.scss +0 -19
- package/types/components.d.ts +0 -145
- package/types/env.d.ts +0 -17
- /package/{es/components/contextMenu/src/contextMenu.type.mjs → dist/global.mjs} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 把文本复制到系统剪贴板。
|
|
3
|
+
*
|
|
4
|
+
* @remarks uni-app 使用 `setClipboardData`;浏览器优先使用 Clipboard API,并在该 API 不可用时
|
|
5
|
+
* 回退到 `document.execCommand("copy")`。平台拒绝访问剪贴板时不会静默忽略错误。
|
|
6
|
+
* @param value - 要复制的文本。
|
|
7
|
+
* @returns 复制完成后兑现的 Promise。
|
|
8
|
+
* @throws `Error` 当运行时没有可用的剪贴板能力或复制失败。
|
|
9
|
+
*/
|
|
10
|
+
export declare function copy(value: string): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* 生成随机字符串。
|
|
13
|
+
*
|
|
14
|
+
* @remarks 优先使用 Web Crypto;平台缺少安全随机能力时回退到 `Math.random()`。
|
|
15
|
+
* @param length - 字符数量,必须是 0 至 1,000,000 的安全整数。
|
|
16
|
+
* @param alphabet - 不得为空、包含重复字符或超过 2^32 个 Unicode 码点。
|
|
17
|
+
* @returns 由 `alphabet` 中 Unicode 码点组成的随机文本。
|
|
18
|
+
* @throws `RangeError` 当长度或字母表非法。
|
|
19
|
+
*/
|
|
20
|
+
export declare function randomString(length: number, alphabet?: string): string;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
//#region src/utils/string/index.ts
|
|
2
|
+
const defaultRandomAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
3
|
+
const maximumRandomStringLength = 1e6;
|
|
4
|
+
const maximumRandomValuesPerBatch = 16384;
|
|
5
|
+
const uint32Range = 4294967296;
|
|
6
|
+
/** 使用 Web Crypto 填充随机值,能力缺失时回退到 `Math.random()`。 */
|
|
7
|
+
const fillRandomValues = (values) => {
|
|
8
|
+
const crypto = globalThis.crypto;
|
|
9
|
+
if (typeof crypto?.getRandomValues === "function") {
|
|
10
|
+
crypto.getRandomValues(values);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const range = values.BYTES_PER_ELEMENT === Uint8Array.BYTES_PER_ELEMENT ? 256 : uint32Range;
|
|
14
|
+
for (let index = 0; index < values.length; index += 1) values[index] = Math.floor(Math.random() * range);
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* 把文本复制到系统剪贴板。
|
|
18
|
+
*
|
|
19
|
+
* @remarks uni-app 使用 `setClipboardData`;浏览器优先使用 Clipboard API,并在该 API 不可用时
|
|
20
|
+
* 回退到 `document.execCommand("copy")`。平台拒绝访问剪贴板时不会静默忽略错误。
|
|
21
|
+
* @param value - 要复制的文本。
|
|
22
|
+
* @returns 复制完成后兑现的 Promise。
|
|
23
|
+
* @throws `Error` 当运行时没有可用的剪贴板能力或复制失败。
|
|
24
|
+
*/
|
|
25
|
+
async function copy(value) {
|
|
26
|
+
const uni = Reflect.get(globalThis, "uni");
|
|
27
|
+
if (uni !== void 0) {
|
|
28
|
+
if (typeof uni !== "object" && typeof uni !== "function" || uni === null) throw new TypeError("全局 uni 对象未提供 `setClipboardData`。");
|
|
29
|
+
const setClipboardData = Reflect.get(uni, "setClipboardData");
|
|
30
|
+
if (typeof setClipboardData !== "function") throw new TypeError("全局 uni 对象未提供 `setClipboardData`。");
|
|
31
|
+
await new Promise((resolve, reject) => {
|
|
32
|
+
Reflect.apply(setClipboardData, uni, [{
|
|
33
|
+
data: value,
|
|
34
|
+
fail: (error) => {
|
|
35
|
+
reject(error instanceof Error ? error : new Error("文本复制到剪贴板失败。", { cause: error }));
|
|
36
|
+
},
|
|
37
|
+
success: resolve
|
|
38
|
+
}]);
|
|
39
|
+
});
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const clipboard = globalThis.navigator?.clipboard;
|
|
43
|
+
if (globalThis.isSecureContext === true && typeof clipboard?.writeText === "function") {
|
|
44
|
+
await clipboard.writeText(value);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const document = globalThis.document;
|
|
48
|
+
if (typeof document?.createElement !== "function" || document.body === null || typeof document.execCommand !== "function") throw new Error("当前运行环境不支持访问剪贴板。");
|
|
49
|
+
const textarea = document.createElement("textarea");
|
|
50
|
+
textarea.value = value;
|
|
51
|
+
textarea.style.left = "-999999px";
|
|
52
|
+
textarea.style.opacity = "0";
|
|
53
|
+
textarea.style.position = "fixed";
|
|
54
|
+
textarea.style.top = "-999999px";
|
|
55
|
+
document.body.appendChild(textarea);
|
|
56
|
+
let copied;
|
|
57
|
+
try {
|
|
58
|
+
textarea.focus();
|
|
59
|
+
textarea.select();
|
|
60
|
+
copied = document.execCommand("copy");
|
|
61
|
+
} finally {
|
|
62
|
+
textarea.remove();
|
|
63
|
+
}
|
|
64
|
+
if (!copied) throw new Error("文本复制到剪贴板失败。");
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 生成随机字符串。
|
|
68
|
+
*
|
|
69
|
+
* @remarks 优先使用 Web Crypto;平台缺少安全随机能力时回退到 `Math.random()`。
|
|
70
|
+
* @param length - 字符数量,必须是 0 至 1,000,000 的安全整数。
|
|
71
|
+
* @param alphabet - 不得为空、包含重复字符或超过 2^32 个 Unicode 码点。
|
|
72
|
+
* @returns 由 `alphabet` 中 Unicode 码点组成的随机文本。
|
|
73
|
+
* @throws `RangeError` 当长度或字母表非法。
|
|
74
|
+
*/
|
|
75
|
+
function randomString(length, alphabet = defaultRandomAlphabet) {
|
|
76
|
+
if (!Number.isSafeInteger(length) || length < 0 || length > maximumRandomStringLength) throw new RangeError(`\`length\` 必须是 0 到 ${maximumRandomStringLength} 之间的安全整数。`);
|
|
77
|
+
const characters = Array.from(alphabet);
|
|
78
|
+
if (characters.length === 0) throw new RangeError("`alphabet` 不能为空。");
|
|
79
|
+
if (new Set(characters).size !== characters.length) throw new RangeError("`alphabet` 不能包含重复字符。");
|
|
80
|
+
if (characters.length > 4294967296) throw new RangeError("`alphabet` 不能包含超过 2^32 个字符。");
|
|
81
|
+
if (length === 0) return "";
|
|
82
|
+
const acceptanceLimit = Math.floor(uint32Range / characters.length) * characters.length;
|
|
83
|
+
const result = [];
|
|
84
|
+
while (result.length < length) {
|
|
85
|
+
const remaining = length - result.length;
|
|
86
|
+
const samples = new Uint32Array(Math.min(remaining, maximumRandomValuesPerBatch));
|
|
87
|
+
fillRandomValues(samples);
|
|
88
|
+
for (const sample of samples) {
|
|
89
|
+
if (sample >= acceptanceLimit) continue;
|
|
90
|
+
const character = characters[sample % characters.length];
|
|
91
|
+
if (character === void 0) continue;
|
|
92
|
+
result.push(character);
|
|
93
|
+
if (result.length === length) break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return result.join("");
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { copy, randomString };
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/utils/string/index.ts"],"sourcesContent":["const defaultRandomAlphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\nconst maximumRandomStringLength = 1_000_000;\nconst maximumRandomValuesPerBatch = 16_384;\nconst uint32Range = 0x1_0000_0000;\n\n/** 使用 Web Crypto 填充随机值,能力缺失时回退到 `Math.random()`。 */\nconst fillRandomValues = (values: Uint8Array<ArrayBuffer> | Uint32Array<ArrayBuffer>): void => {\n\tconst crypto = globalThis.crypto;\n\tif (typeof crypto?.getRandomValues === \"function\") {\n\t\tcrypto.getRandomValues(values);\n\t\treturn;\n\t}\n\tconst range = values.BYTES_PER_ELEMENT === Uint8Array.BYTES_PER_ELEMENT ? 0x100 : uint32Range;\n\tfor (let index = 0; index < values.length; index += 1) values[index] = Math.floor(Math.random() * range);\n};\n\n/**\n * 把文本复制到系统剪贴板。\n *\n * @remarks uni-app 使用 `setClipboardData`;浏览器优先使用 Clipboard API,并在该 API 不可用时\n * 回退到 `document.execCommand(\"copy\")`。平台拒绝访问剪贴板时不会静默忽略错误。\n * @param value - 要复制的文本。\n * @returns 复制完成后兑现的 Promise。\n * @throws `Error` 当运行时没有可用的剪贴板能力或复制失败。\n */\nexport async function copy(value: string): Promise<void> {\n\tconst uni: unknown = Reflect.get(globalThis, \"uni\");\n\tif (uni !== undefined) {\n\t\tif ((typeof uni !== \"object\" && typeof uni !== \"function\") || uni === null) {\n\t\t\tthrow new TypeError(\"全局 uni 对象未提供 `setClipboardData`。\");\n\t\t}\n\t\tconst setClipboardData: unknown = Reflect.get(uni, \"setClipboardData\");\n\t\tif (typeof setClipboardData !== \"function\") throw new TypeError(\"全局 uni 对象未提供 `setClipboardData`。\");\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tReflect.apply(setClipboardData, uni, [\n\t\t\t\t{\n\t\t\t\t\tdata: value,\n\t\t\t\t\tfail: (error: unknown): void => {\n\t\t\t\t\t\treject(error instanceof Error ? error : new Error(\"文本复制到剪贴板失败。\", { cause: error }));\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: resolve,\n\t\t\t\t},\n\t\t\t]);\n\t\t});\n\t\treturn;\n\t}\n\n\tconst clipboard = globalThis.navigator?.clipboard;\n\tif (globalThis.isSecureContext === true && typeof clipboard?.writeText === \"function\") {\n\t\tawait clipboard.writeText(value);\n\t\treturn;\n\t}\n\n\tconst document = globalThis.document;\n\tif (typeof document?.createElement !== \"function\" || document.body === null || typeof document.execCommand !== \"function\") {\n\t\tthrow new Error(\"当前运行环境不支持访问剪贴板。\");\n\t}\n\tconst textarea = document.createElement(\"textarea\");\n\ttextarea.value = value;\n\ttextarea.style.left = \"-999999px\";\n\ttextarea.style.opacity = \"0\";\n\ttextarea.style.position = \"fixed\";\n\ttextarea.style.top = \"-999999px\";\n\tdocument.body.appendChild(textarea);\n\tlet copied: boolean;\n\ttry {\n\t\ttextarea.focus();\n\t\ttextarea.select();\n\t\tcopied = document.execCommand(\"copy\");\n\t} finally {\n\t\ttextarea.remove();\n\t}\n\tif (!copied) throw new Error(\"文本复制到剪贴板失败。\");\n}\n\n/**\n * 生成随机字符串。\n *\n * @remarks 优先使用 Web Crypto;平台缺少安全随机能力时回退到 `Math.random()`。\n * @param length - 字符数量,必须是 0 至 1,000,000 的安全整数。\n * @param alphabet - 不得为空、包含重复字符或超过 2^32 个 Unicode 码点。\n * @returns 由 `alphabet` 中 Unicode 码点组成的随机文本。\n * @throws `RangeError` 当长度或字母表非法。\n */\nexport function randomString(length: number, alphabet: string = defaultRandomAlphabet): string {\n\tif (!Number.isSafeInteger(length) || length < 0 || length > maximumRandomStringLength) {\n\t\tthrow new RangeError(`\\`length\\` 必须是 0 到 ${maximumRandomStringLength} 之间的安全整数。`);\n\t}\n\tconst characters = Array.from(alphabet);\n\tif (characters.length === 0) throw new RangeError(\"`alphabet` 不能为空。\");\n\tif (new Set(characters).size !== characters.length) throw new RangeError(\"`alphabet` 不能包含重复字符。\");\n\tif (characters.length > 0x1_0000_0000) throw new RangeError(\"`alphabet` 不能包含超过 2^32 个字符。\");\n\tif (length === 0) return \"\";\n\n\t// 丢弃不能平均映射到字母表的尾部区间,避免 `%` 造成前部字符概率偏高。\n\tconst acceptanceLimit = Math.floor(uint32Range / characters.length) * characters.length;\n\tconst result: string[] = [];\n\twhile (result.length < length) {\n\t\tconst remaining = length - result.length;\n\t\t// 分批填充可控制临时内存,并避开 Web Crypto 单次随机数组大小限制。\n\t\tconst samples = new Uint32Array(Math.min(remaining, maximumRandomValuesPerBatch));\n\t\tfillRandomValues(samples);\n\t\tfor (const sample of samples) {\n\t\t\tif (sample >= acceptanceLimit) continue;\n\t\t\tconst character = characters[sample % characters.length];\n\t\t\tif (character === undefined) continue;\n\t\t\tresult.push(character);\n\t\t\tif (result.length === length) break;\n\t\t}\n\t}\n\treturn result.join(\"\");\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ComputedRef } from "vue";
|
|
2
|
+
/** Vue Emits 对象中允许的校验器形状。 */
|
|
3
|
+
type EmitValidator = ((...arguments_: never[]) => unknown) | null;
|
|
4
|
+
/** 事件名到可选参数校验器的内部映射。 */
|
|
5
|
+
type EmitsOptions = Record<string, EmitValidator>;
|
|
6
|
+
/** 从校验器中提取事件参数;无校验器时保留未知参数。 */
|
|
7
|
+
type EventArguments<Validator> = Validator extends (...arguments_: infer Arguments) => unknown ? Arguments : unknown[];
|
|
8
|
+
/** 在类型层递归把 kebab-case 事件名转换为 PascalCase。 */
|
|
9
|
+
type PascalEventName<Value extends string> = Value extends `${infer Head}-${infer Tail}` ? `${Capitalize<Head>}${PascalEventName<Tail>}` : Capitalize<Value>;
|
|
10
|
+
/** 把事件配置映射为 Vue `onXxx` 属性。 */
|
|
11
|
+
export type EmitHandlers<Emits extends EmitsOptions> = {
|
|
12
|
+
[Name in keyof Emits as Name extends string ? `on${PascalEventName<Name>}` : never]: (...arguments_: EventArguments<Emits[Name]>) => void;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 构建响应式 Vue 事件处理器。
|
|
16
|
+
*
|
|
17
|
+
* @param emits - Vue emits 配置对象。
|
|
18
|
+
* @param emit - `setup` 上下文提供的 emit 函数。
|
|
19
|
+
* @param ignoredEvents - 不需要向子组件透传的事件名。
|
|
20
|
+
* @returns 随配置重新计算的事件处理器对象。
|
|
21
|
+
*/
|
|
22
|
+
export declare function useEmits<Emits extends EmitsOptions>(emits: Emits, emit: (...arguments_: never[]) => unknown, ignoredEvents?: readonly (keyof Emits)[]): ComputedRef<Partial<EmitHandlers<Emits>>>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
//#region src/utils/vue/emits.ts
|
|
3
|
+
/**
|
|
4
|
+
* 把事件名转换为 Vue Handler Prop 名称。
|
|
5
|
+
*
|
|
6
|
+
* @param eventName - Emits 对象中的原始事件名,可使用 kebab-case。
|
|
7
|
+
* @returns `onPascalCase` 形式的属性名。
|
|
8
|
+
* @throws `TypeError` 当事件名包含空片段或无法生成有效 Handler 名称。
|
|
9
|
+
*/
|
|
10
|
+
const toHandlerName = (eventName) => {
|
|
11
|
+
return `on${eventName.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("")}`;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 构建响应式 Vue 事件处理器。
|
|
15
|
+
*
|
|
16
|
+
* @param emits - Vue emits 配置对象。
|
|
17
|
+
* @param emit - `setup` 上下文提供的 emit 函数。
|
|
18
|
+
* @param ignoredEvents - 不需要向子组件透传的事件名。
|
|
19
|
+
* @returns 随配置重新计算的事件处理器对象。
|
|
20
|
+
*/
|
|
21
|
+
function useEmits(emits, emit, ignoredEvents = []) {
|
|
22
|
+
const ignored = new Set(ignoredEvents);
|
|
23
|
+
const emitEvent = emit;
|
|
24
|
+
return computed(() => {
|
|
25
|
+
const handlers = {};
|
|
26
|
+
const handlerNames = /* @__PURE__ */ new Set();
|
|
27
|
+
for (const eventName of Object.keys(emits)) {
|
|
28
|
+
if (ignored.has(eventName)) continue;
|
|
29
|
+
if (eventName.length === 0 || /\s/u.test(eventName)) throw new TypeError(`无效的 Vue 事件名称:“${eventName}”。`);
|
|
30
|
+
const handlerName = toHandlerName(eventName);
|
|
31
|
+
if (handlerNames.has(handlerName)) throw new TypeError(`多个 Vue 事件映射到同一处理器属性:“${handlerName}”。`);
|
|
32
|
+
handlerNames.add(handlerName);
|
|
33
|
+
Object.defineProperty(handlers, handlerName, {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
value: (...arguments_) => {
|
|
36
|
+
emitEvent(eventName, ...arguments_);
|
|
37
|
+
},
|
|
38
|
+
writable: true
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return handlers;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { useEmits };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=emits.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emits.mjs","names":[],"sources":["../../../src/utils/vue/emits.ts"],"sourcesContent":["import { computed } from \"vue\";\nimport type { ComputedRef } from \"vue\";\n\n/** Vue Emits 对象中允许的校验器形状。 */\ntype EmitValidator = ((...arguments_: never[]) => unknown) | null;\n/** 事件名到可选参数校验器的内部映射。 */\ntype EmitsOptions = Record<string, EmitValidator>;\n/** 从校验器中提取事件参数;无校验器时保留未知参数。 */\ntype EventArguments<Validator> = Validator extends (...arguments_: infer Arguments) => unknown ? Arguments : unknown[];\n/** 在类型层递归把 kebab-case 事件名转换为 PascalCase。 */\ntype PascalEventName<Value extends string> = Value extends `${infer Head}-${infer Tail}`\n\t? `${Capitalize<Head>}${PascalEventName<Tail>}`\n\t: Capitalize<Value>;\n\n/** 把事件配置映射为 Vue `onXxx` 属性。 */\nexport type EmitHandlers<Emits extends EmitsOptions> = {\n\t[Name in keyof Emits as Name extends string ? `on${PascalEventName<Name>}` : never]: (...arguments_: EventArguments<Emits[Name]>) => void;\n};\n\n/**\n * 把事件名转换为 Vue Handler Prop 名称。\n *\n * @param eventName - Emits 对象中的原始事件名,可使用 kebab-case。\n * @returns `onPascalCase` 形式的属性名。\n * @throws `TypeError` 当事件名包含空片段或无法生成有效 Handler 名称。\n */\nconst toHandlerName = (eventName: string): string => {\n\treturn `on${eventName\n\t\t.split(\"-\")\n\t\t.map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n\t\t.join(\"\")}`;\n};\n\n/**\n * 构建响应式 Vue 事件处理器。\n *\n * @param emits - Vue emits 配置对象。\n * @param emit - `setup` 上下文提供的 emit 函数。\n * @param ignoredEvents - 不需要向子组件透传的事件名。\n * @returns 随配置重新计算的事件处理器对象。\n */\nexport function useEmits<Emits extends EmitsOptions>(\n\temits: Emits,\n\temit: (...arguments_: never[]) => unknown,\n\tignoredEvents: readonly (keyof Emits)[] = []\n): ComputedRef<Partial<EmitHandlers<Emits>>> {\n\tconst ignored = new Set<PropertyKey>(ignoredEvents);\n\tconst emitEvent = emit as unknown as (eventName: string, ...arguments_: unknown[]) => void;\n\treturn computed<Partial<EmitHandlers<Emits>>>(() => {\n\t\tconst handlers = {} as Partial<EmitHandlers<Emits>>;\n\t\tconst handlerNames = new Set<string>();\n\t\tfor (const eventName of Object.keys(emits)) {\n\t\t\tif (ignored.has(eventName)) continue;\n\t\t\tif (eventName.length === 0 || /\\s/u.test(eventName)) throw new TypeError(`无效的 Vue 事件名称:“${eventName}”。`);\n\t\t\tconst handlerName = toHandlerName(eventName);\n\t\t\tif (handlerNames.has(handlerName)) {\n\t\t\t\tthrow new TypeError(`多个 Vue 事件映射到同一处理器属性:“${handlerName}”。`);\n\t\t\t}\n\t\t\thandlerNames.add(handlerName);\n\t\t\tObject.defineProperty(handlers, handlerName, {\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: (...arguments_: unknown[]): void => {\n\t\t\t\t\temitEvent(eventName, ...arguments_);\n\t\t\t\t},\n\t\t\t\twritable: true,\n\t\t\t});\n\t\t}\n\t\treturn handlers;\n\t});\n}\n"],"mappings":";;;;;;;;;AA0BA,MAAM,iBAAiB,cAA8B;CACpD,OAAO,KAAK,UACV,MAAM,GAAG,CAAC,CACV,KAAK,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAC3D,KAAK,EAAE;AACV;;;;;;;;;AAUA,SAAgB,SACf,OACA,MACA,gBAA0C,CAAC,GACC;CAC5C,MAAM,UAAU,IAAI,IAAiB,aAAa;CAClD,MAAM,YAAY;CAClB,OAAO,eAA6C;EACnD,MAAM,WAAW,CAAC;EAClB,MAAM,+BAAe,IAAI,IAAY;EACrC,KAAK,MAAM,aAAa,OAAO,KAAK,KAAK,GAAG;GAC3C,IAAI,QAAQ,IAAI,SAAS,GAAG;GAC5B,IAAI,UAAU,WAAW,KAAK,MAAM,KAAK,SAAS,GAAG,MAAM,IAAI,UAAU,iBAAiB,UAAU,GAAG;GACvG,MAAM,cAAc,cAAc,SAAS;GAC3C,IAAI,aAAa,IAAI,WAAW,GAC/B,MAAM,IAAI,UAAU,wBAAwB,YAAY,GAAG;GAE5D,aAAa,IAAI,WAAW;GAC5B,OAAO,eAAe,UAAU,aAAa;IAC5C,YAAY;IACZ,QAAQ,GAAG,eAAgC;KAC1C,UAAU,WAAW,GAAG,UAAU;IACnC;IACA,UAAU;GACX,CAAC;EACF;EACA,OAAO;CACR,CAAC;AACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 同时暴露组件实例能力并返回同一个对象,便于 `setup` 返回状态供 Vue Devtools 查看。
|
|
3
|
+
*
|
|
4
|
+
* @param expose - `setup` 上下文提供的 expose 函数。
|
|
5
|
+
* @param exposed - 需要暴露的状态和方法。
|
|
6
|
+
* @returns 原始 exposed 对象。
|
|
7
|
+
*/
|
|
8
|
+
export declare function useExpose<Exposed extends object>(expose: (exposed?: Exposed) => void, exposed: Exposed): Exposed;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/utils/vue/expose.ts
|
|
2
|
+
/**
|
|
3
|
+
* 同时暴露组件实例能力并返回同一个对象,便于 `setup` 返回状态供 Vue Devtools 查看。
|
|
4
|
+
*
|
|
5
|
+
* @param expose - `setup` 上下文提供的 expose 函数。
|
|
6
|
+
* @param exposed - 需要暴露的状态和方法。
|
|
7
|
+
* @returns 原始 exposed 对象。
|
|
8
|
+
*/
|
|
9
|
+
function useExpose(expose, exposed) {
|
|
10
|
+
expose(exposed);
|
|
11
|
+
return exposed;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { useExpose };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=expose.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expose.mjs","names":[],"sources":["../../../src/utils/vue/expose.ts"],"sourcesContent":["/**\n * 同时暴露组件实例能力并返回同一个对象,便于 `setup` 返回状态供 Vue Devtools 查看。\n *\n * @param expose - `setup` 上下文提供的 expose 函数。\n * @param exposed - 需要暴露的状态和方法。\n * @returns 原始 exposed 对象。\n */\nexport function useExpose<Exposed extends object>(expose: (exposed?: Exposed) => void, exposed: Exposed): Exposed {\n\texpose(exposed);\n\treturn exposed;\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,UAAkC,QAAqC,SAA2B;CACjH,OAAO,OAAO;CACd,OAAO;AACR"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** 可同步或异步返回结果的函数。 */
|
|
2
|
+
export type AwaitableFunction<Arguments extends readonly unknown[], Result> = (...arguments_: Arguments) => Result | PromiseLike<Result>;
|
|
3
|
+
/**
|
|
4
|
+
* 统一执行同步或异步函数,异常保持原样向调用方传播。
|
|
5
|
+
*
|
|
6
|
+
* @param function_ - 可选的待执行函数。
|
|
7
|
+
* @param arguments_ - 原样传入函数的参数。
|
|
8
|
+
* @returns 函数结果;未传函数时返回 `undefined`。
|
|
9
|
+
*/
|
|
10
|
+
export declare function callOptionalFunction<Arguments extends readonly unknown[], Result>(function_: AwaitableFunction<Arguments, Result> | null | undefined, ...arguments_: Arguments): Promise<Awaited<Result> | undefined>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/utils/vue/func.ts
|
|
2
|
+
/**
|
|
3
|
+
* 统一执行同步或异步函数,异常保持原样向调用方传播。
|
|
4
|
+
*
|
|
5
|
+
* @param function_ - 可选的待执行函数。
|
|
6
|
+
* @param arguments_ - 原样传入函数的参数。
|
|
7
|
+
* @returns 函数结果;未传函数时返回 `undefined`。
|
|
8
|
+
*/
|
|
9
|
+
async function callOptionalFunction(function_, ...arguments_) {
|
|
10
|
+
if (function_ === null || function_ === void 0) return void 0;
|
|
11
|
+
return Promise.resolve(function_(...arguments_));
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { callOptionalFunction };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=func.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"func.mjs","names":[],"sources":["../../../src/utils/vue/func.ts"],"sourcesContent":["/** 可同步或异步返回结果的函数。 */\nexport type AwaitableFunction<Arguments extends readonly unknown[], Result> = (...arguments_: Arguments) => Result | PromiseLike<Result>;\n\n/**\n * 统一执行同步或异步函数,异常保持原样向调用方传播。\n *\n * @param function_ - 可选的待执行函数。\n * @param arguments_ - 原样传入函数的参数。\n * @returns 函数结果;未传函数时返回 `undefined`。\n */\nexport async function callOptionalFunction<Arguments extends readonly unknown[], Result>(\n\tfunction_: AwaitableFunction<Arguments, Result> | null | undefined,\n\t...arguments_: Arguments\n): Promise<Awaited<Result> | undefined> {\n\tif (function_ === null || function_ === undefined) return undefined;\n\treturn Promise.resolve(function_(...arguments_));\n}\n"],"mappings":";;;;;;;;AAUA,eAAsB,qBACrB,WACA,GAAG,YACoC;CACvC,IAAI,cAAc,QAAQ,cAAc,KAAA,GAAW,OAAO,KAAA;CAC1D,OAAO,QAAQ,QAAQ,UAAU,GAAG,UAAU,CAAC;AAChD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fast.Element.Plus 内部使用的 Vue 3 工具。
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export * from "./emits";
|
|
7
|
+
export * from "./expose";
|
|
8
|
+
export * from "./func";
|
|
9
|
+
export * from "./install";
|
|
10
|
+
export * from "./props";
|
|
11
|
+
export * from "./render";
|
|
12
|
+
export * from "./slots";
|
|
13
|
+
export * from "./with";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { App } from "vue";
|
|
2
|
+
/** Vue 组件对象、函数组件或指令对象可接受的最小结构类型。 */
|
|
3
|
+
export type VueInstallValue = object | ((...arguments_: never[]) => unknown);
|
|
4
|
+
/** 为 Vue 组件或指令附加供 Vue 3 `app.use()` 调用的安装能力。 */
|
|
5
|
+
export type Installable<Value> = Value & {
|
|
6
|
+
/**
|
|
7
|
+
* 把当前组件或指令安装到 Vue 3 App。
|
|
8
|
+
* @param app - Vue 3 App 实例。
|
|
9
|
+
*/
|
|
10
|
+
install: (app: App) => void;
|
|
11
|
+
};
|
|
12
|
+
/** TSX 组件安装类型;与 {@link Installable} 保持同一运行时契约。 */
|
|
13
|
+
export type TSXWithInstall<Value> = Installable<Value>;
|
|
14
|
+
/**
|
|
15
|
+
* 为主组件附加 Vue 3 `app.use()` 安装能力。
|
|
16
|
+
*
|
|
17
|
+
* @remarks 函数会直接为 `main` 定义附属组件属性和 `install`。所有组件名称、附属属性
|
|
18
|
+
* 冲突会在修改 `main` 前完成校验;安装到 App 时也会先预检全部全局名称,再统一注册。
|
|
19
|
+
* @param main - 具有非空 `name` 的组件。
|
|
20
|
+
* @param extras - 同时注册并以可枚举属性挂到主组件的附属组件映射。
|
|
21
|
+
* @returns 原始 `main` 引用,并附加类型化的 `install` 与 `extras` 属性。
|
|
22
|
+
* @throws `TypeError` 当组件缺少合法名称、已有 `install`、附属键或名称发生冲突。
|
|
23
|
+
* @throws `Error` 当 App 中同名位置已经注册其他组件。
|
|
24
|
+
*/
|
|
25
|
+
export declare function withInstall<Main extends VueInstallValue, Extras extends Record<string, VueInstallValue> = Record<never, never>>(main: Main, extras?: Extras): Installable<Main> & Extras;
|
|
26
|
+
/**
|
|
27
|
+
* 为不需要单独注册的附属组件附加空安装函数。
|
|
28
|
+
*
|
|
29
|
+
* @remarks 适用于只能作为主组件附属属性使用、但仍需满足 Vue Plugin 类型的组件。
|
|
30
|
+
* 函数直接修改并返回传入组件,不会向 Vue 3 App 注册内容。
|
|
31
|
+
* @param component - 尚未定义或继承 `install` 属性的组件。
|
|
32
|
+
* @returns 原组件引用及无副作用的 `install` 方法。
|
|
33
|
+
* @throws `TypeError` 当组件自身或原型链已经存在 `install`。
|
|
34
|
+
*/
|
|
35
|
+
export declare function withNoopInstall<Value extends VueInstallValue>(component: Value): TSXWithInstall<Value>;
|
|
36
|
+
/**
|
|
37
|
+
* 为 Vue 3 指令附加插件安装能力。
|
|
38
|
+
*
|
|
39
|
+
* @remarks 函数直接修改并返回指令。安装时重复注册同一引用保持幂等,不会覆盖同名的
|
|
40
|
+
* 其他指令。名称只传给 `directive()`,不得包含 `v-` 前缀。
|
|
41
|
+
* @param directive - 尚未定义或继承 `install` 属性的 Vue 指令对象。
|
|
42
|
+
* @param name - 非空、无空白且不以 `v-` 开头的全局指令名。
|
|
43
|
+
* @returns 原指令引用及 Vue Plugin `install` 方法。
|
|
44
|
+
* @throws `TypeError` 当名称非法、指令已有 `install`,或安装目标无效。
|
|
45
|
+
* @throws `Error` 当 App 中同名位置已经注册其他指令。
|
|
46
|
+
*/
|
|
47
|
+
export declare function withInstallDirective<Value extends VueInstallValue>(directive: Value, name: string): Installable<Value>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
//#region src/utils/vue/install.ts
|
|
2
|
+
/**
|
|
3
|
+
* 校验 Vue 3 插件安装目标。
|
|
4
|
+
*
|
|
5
|
+
* @param value - Vue 3 App 实例。
|
|
6
|
+
* @returns 只包含组件和指令注册能力的 App。
|
|
7
|
+
* @throws `TypeError` 当目标不是对象或缺少 `component`、`directive` 方法。
|
|
8
|
+
*/
|
|
9
|
+
const assertApp = (value) => {
|
|
10
|
+
if (typeof value !== "object" || value === null) throw new TypeError("安装 Vue 插件需要 Vue 3 App 实例。");
|
|
11
|
+
const app = value;
|
|
12
|
+
if (typeof app.component !== "function" || typeof app.directive !== "function") throw new TypeError("安装 Vue 插件需要 `component()` 和 `directive()` 注册方法。");
|
|
13
|
+
return app;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 提取组件的全局注册名称。
|
|
17
|
+
*
|
|
18
|
+
* @param component - 待注册组件。
|
|
19
|
+
* @returns 经过校验的显式名称。
|
|
20
|
+
* @throws `TypeError` 当组件没有非空字符串名称,或名称包含空白。
|
|
21
|
+
*/
|
|
22
|
+
const getComponentName = (component) => {
|
|
23
|
+
const name = component.name;
|
|
24
|
+
if (typeof name !== "string" || name.length === 0 || /\s/u.test(name)) throw new TypeError("可安装的 Vue 组件必须公开不含空白的非空名称。");
|
|
25
|
+
return name;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* 预检单个组件注册。
|
|
29
|
+
*
|
|
30
|
+
* @remarks 先读取同名组件并完成冲突判断,再返回延迟执行动作;调用方可以在所有组件预检通过后统一提交。
|
|
31
|
+
* @param app - 已校验的 Vue 3 App 注册目标。
|
|
32
|
+
* @param component - 待注册组件。
|
|
33
|
+
* @returns 已校验的组件引用、名称和目标中是否已经存在同一引用。
|
|
34
|
+
* @throws `Error` 当同名位置已由其他组件占用。
|
|
35
|
+
*/
|
|
36
|
+
const prepareComponentRegistration = (app, component) => {
|
|
37
|
+
const name = getComponentName(component);
|
|
38
|
+
const existing = app.component(name);
|
|
39
|
+
if (existing !== void 0 && existing !== component) throw new Error(`Vue 组件名称“${name}”已被其他组件注册。`);
|
|
40
|
+
return {
|
|
41
|
+
component,
|
|
42
|
+
name,
|
|
43
|
+
registered: existing === component
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* 为主组件附加 Vue 3 `app.use()` 安装能力。
|
|
48
|
+
*
|
|
49
|
+
* @remarks 函数会直接为 `main` 定义附属组件属性和 `install`。所有组件名称、附属属性
|
|
50
|
+
* 冲突会在修改 `main` 前完成校验;安装到 App 时也会先预检全部全局名称,再统一注册。
|
|
51
|
+
* @param main - 具有非空 `name` 的组件。
|
|
52
|
+
* @param extras - 同时注册并以可枚举属性挂到主组件的附属组件映射。
|
|
53
|
+
* @returns 原始 `main` 引用,并附加类型化的 `install` 与 `extras` 属性。
|
|
54
|
+
* @throws `TypeError` 当组件缺少合法名称、已有 `install`、附属键或名称发生冲突。
|
|
55
|
+
* @throws `Error` 当 App 中同名位置已经注册其他组件。
|
|
56
|
+
*/
|
|
57
|
+
function withInstall(main, extras) {
|
|
58
|
+
const componentNames = /* @__PURE__ */ new Set([getComponentName(main)]);
|
|
59
|
+
if ("install" in Object(main)) throw new TypeError("Vue 组件已定义 `install` 属性。");
|
|
60
|
+
const extraEntries = Object.entries(extras ?? {});
|
|
61
|
+
if (extras !== void 0 && Object.getOwnPropertySymbols(extras).some((key) => Object.prototype.propertyIsEnumerable.call(extras, key))) throw new TypeError("Vue 组件附属项必须使用字符串属性名。");
|
|
62
|
+
for (const [key, component] of extraEntries) {
|
|
63
|
+
const componentName = getComponentName(component);
|
|
64
|
+
if (componentNames.has(componentName)) throw new TypeError(`Vue 组件名称“${componentName}”被重复注册。`);
|
|
65
|
+
componentNames.add(componentName);
|
|
66
|
+
if (key === "install" || key in Object(main)) throw new TypeError(`Vue 组件附属项“${key}”会覆盖主组件上的属性。`);
|
|
67
|
+
}
|
|
68
|
+
const installable = main;
|
|
69
|
+
for (const [key, component] of extraEntries) Object.defineProperty(installable, key, {
|
|
70
|
+
configurable: true,
|
|
71
|
+
enumerable: true,
|
|
72
|
+
value: component,
|
|
73
|
+
writable: true
|
|
74
|
+
});
|
|
75
|
+
installable.install = (value) => {
|
|
76
|
+
const app = assertApp(value);
|
|
77
|
+
const registrations = [main, ...extraEntries.map(([, component]) => component)].map((component) => prepareComponentRegistration(app, component));
|
|
78
|
+
for (const registration of registrations) if (!registration.registered) app.component(registration.name, registration.component);
|
|
79
|
+
};
|
|
80
|
+
return installable;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 为不需要单独注册的附属组件附加空安装函数。
|
|
84
|
+
*
|
|
85
|
+
* @remarks 适用于只能作为主组件附属属性使用、但仍需满足 Vue Plugin 类型的组件。
|
|
86
|
+
* 函数直接修改并返回传入组件,不会向 Vue 3 App 注册内容。
|
|
87
|
+
* @param component - 尚未定义或继承 `install` 属性的组件。
|
|
88
|
+
* @returns 原组件引用及无副作用的 `install` 方法。
|
|
89
|
+
* @throws `TypeError` 当组件自身或原型链已经存在 `install`。
|
|
90
|
+
*/
|
|
91
|
+
function withNoopInstall(component) {
|
|
92
|
+
if ("install" in Object(component)) throw new TypeError("Vue 组件已定义 `install` 属性。");
|
|
93
|
+
const installable = component;
|
|
94
|
+
installable.install = () => void 0;
|
|
95
|
+
return installable;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 为 Vue 3 指令附加插件安装能力。
|
|
99
|
+
*
|
|
100
|
+
* @remarks 函数直接修改并返回指令。安装时重复注册同一引用保持幂等,不会覆盖同名的
|
|
101
|
+
* 其他指令。名称只传给 `directive()`,不得包含 `v-` 前缀。
|
|
102
|
+
* @param directive - 尚未定义或继承 `install` 属性的 Vue 指令对象。
|
|
103
|
+
* @param name - 非空、无空白且不以 `v-` 开头的全局指令名。
|
|
104
|
+
* @returns 原指令引用及 Vue Plugin `install` 方法。
|
|
105
|
+
* @throws `TypeError` 当名称非法、指令已有 `install`,或安装目标无效。
|
|
106
|
+
* @throws `Error` 当 App 中同名位置已经注册其他指令。
|
|
107
|
+
*/
|
|
108
|
+
function withInstallDirective(directive, name) {
|
|
109
|
+
if (name.length === 0 || /\s/u.test(name) || name.startsWith("v-")) throw new TypeError("可安装的 Vue 指令名称不能包含空白或 `v-` 前缀。");
|
|
110
|
+
if ("install" in Object(directive)) throw new TypeError("Vue 指令已定义 `install` 属性。");
|
|
111
|
+
const installable = directive;
|
|
112
|
+
installable.install = (value) => {
|
|
113
|
+
const app = assertApp(value);
|
|
114
|
+
const existing = app.directive(name);
|
|
115
|
+
if (existing !== void 0 && existing !== directive) throw new Error(`Vue 指令名称“${name}”已被其他指令注册。`);
|
|
116
|
+
if (existing !== directive) app.directive(name, directive);
|
|
117
|
+
};
|
|
118
|
+
return installable;
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
export { withInstall, withInstallDirective, withNoopInstall };
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=install.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.mjs","names":[],"sources":["../../../src/utils/vue/install.ts"],"sourcesContent":["import type { App } from \"vue\";\n\n/** Vue 组件对象、函数组件或指令对象可接受的最小结构类型。 */\nexport type VueInstallValue = object | ((...arguments_: never[]) => unknown);\n\n/** 为 Vue 组件或指令附加供 Vue 3 `app.use()` 调用的安装能力。 */\nexport type Installable<Value> = Value & {\n\t/**\n\t * 把当前组件或指令安装到 Vue 3 App。\n\t * @param app - Vue 3 App 实例。\n\t */\n\tinstall: (app: App) => void;\n};\n\n/** TSX 组件安装类型;与 {@link Installable} 保持同一运行时契约。 */\nexport type TSXWithInstall<Value> = Installable<Value>;\n\n/** 组件、指令注册所需的 Vue 3 App 能力。 */\ninterface VueAppRegistrationTarget {\n\t/**\n\t * 读取或注册全局组件。\n\t *\n\t * @param name - 全局组件名。\n\t * @param component - 注册时传入的组件;省略时读取现有组件。\n\t * @returns Vue App 返回的现有组件、注册结果或 App 自身。\n\t */\n\tcomponent: (name: string, component?: unknown) => unknown;\n\t/**\n\t * 读取或注册全局指令。\n\t *\n\t * @param name - 不带 `v-` 的全局指令名。\n\t * @param directive - 注册时传入的指令;省略时读取现有指令。\n\t * @returns Vue App 返回的现有指令、注册结果或 App 自身。\n\t */\n\tdirective: (name: string, directive?: unknown) => unknown;\n}\n\n/**\n * 校验 Vue 3 插件安装目标。\n *\n * @param value - Vue 3 App 实例。\n * @returns 只包含组件和指令注册能力的 App。\n * @throws `TypeError` 当目标不是对象或缺少 `component`、`directive` 方法。\n */\nconst assertApp = (value: App): VueAppRegistrationTarget => {\n\tif (typeof value !== \"object\" || value === null) {\n\t\tthrow new TypeError(\"安装 Vue 插件需要 Vue 3 App 实例。\");\n\t}\n\tconst app = value as unknown as Partial<VueAppRegistrationTarget>;\n\tif (typeof app.component !== \"function\" || typeof app.directive !== \"function\") {\n\t\tthrow new TypeError(\"安装 Vue 插件需要 `component()` 和 `directive()` 注册方法。\");\n\t}\n\treturn app as VueAppRegistrationTarget;\n};\n\n/**\n * 提取组件的全局注册名称。\n *\n * @param component - 待注册组件。\n * @returns 经过校验的显式名称。\n * @throws `TypeError` 当组件没有非空字符串名称,或名称包含空白。\n */\nconst getComponentName = (component: VueInstallValue): string => {\n\tconst name = (component as { name?: unknown }).name;\n\tif (typeof name !== \"string\" || name.length === 0 || /\\s/u.test(name)) {\n\t\tthrow new TypeError(\"可安装的 Vue 组件必须公开不含空白的非空名称。\");\n\t}\n\treturn name;\n};\n\n/** 预检完成、可以无失败注册的组件动作。 */\ninterface ComponentRegistration {\n\t/** 已校验的组件引用。 */\n\tcomponent: VueInstallValue;\n\t/** 已校验的组件名称。 */\n\tname: string;\n\t/** 目标中是否已经注册了完全相同的组件引用。 */\n\tregistered: boolean;\n}\n\n/**\n * 预检单个组件注册。\n *\n * @remarks 先读取同名组件并完成冲突判断,再返回延迟执行动作;调用方可以在所有组件预检通过后统一提交。\n * @param app - 已校验的 Vue 3 App 注册目标。\n * @param component - 待注册组件。\n * @returns 已校验的组件引用、名称和目标中是否已经存在同一引用。\n * @throws `Error` 当同名位置已由其他组件占用。\n */\nconst prepareComponentRegistration = (app: VueAppRegistrationTarget, component: VueInstallValue): ComponentRegistration => {\n\tconst name = getComponentName(component);\n\tconst existing = app.component(name);\n\tif (existing !== undefined && existing !== component) {\n\t\tthrow new Error(`Vue 组件名称“${name}”已被其他组件注册。`);\n\t}\n\treturn { component, name, registered: existing === component };\n};\n\n/**\n * 为主组件附加 Vue 3 `app.use()` 安装能力。\n *\n * @remarks 函数会直接为 `main` 定义附属组件属性和 `install`。所有组件名称、附属属性\n * 冲突会在修改 `main` 前完成校验;安装到 App 时也会先预检全部全局名称,再统一注册。\n * @param main - 具有非空 `name` 的组件。\n * @param extras - 同时注册并以可枚举属性挂到主组件的附属组件映射。\n * @returns 原始 `main` 引用,并附加类型化的 `install` 与 `extras` 属性。\n * @throws `TypeError` 当组件缺少合法名称、已有 `install`、附属键或名称发生冲突。\n * @throws `Error` 当 App 中同名位置已经注册其他组件。\n */\nexport function withInstall<Main extends VueInstallValue, Extras extends Record<string, VueInstallValue> = Record<never, never>>(\n\tmain: Main,\n\textras?: Extras\n): Installable<Main> & Extras {\n\tconst componentNames = new Set([getComponentName(main)]);\n\tif (\"install\" in Object(main)) throw new TypeError(\"Vue 组件已定义 `install` 属性。\");\n\tconst extraEntries = Object.entries(extras ?? {});\n\tif (extras !== undefined && Object.getOwnPropertySymbols(extras).some((key) => Object.prototype.propertyIsEnumerable.call(extras, key))) {\n\t\tthrow new TypeError(\"Vue 组件附属项必须使用字符串属性名。\");\n\t}\n\tfor (const [key, component] of extraEntries) {\n\t\tconst componentName = getComponentName(component);\n\t\tif (componentNames.has(componentName)) throw new TypeError(`Vue 组件名称“${componentName}”被重复注册。`);\n\t\tcomponentNames.add(componentName);\n\t\tif (key === \"install\" || key in Object(main)) {\n\t\t\tthrow new TypeError(`Vue 组件附属项“${key}”会覆盖主组件上的属性。`);\n\t\t}\n\t}\n\tconst installable = main as Installable<Main> & Extras;\n\tfor (const [key, component] of extraEntries) {\n\t\tObject.defineProperty(installable, key, { configurable: true, enumerable: true, value: component, writable: true });\n\t}\n\tinstallable.install = (value: App): void => {\n\t\tconst app = assertApp(value);\n\t\t// 先完成全部冲突检查,再统一注册,避免安装到一半留下部分全局组件。\n\t\tconst registrations = [main, ...extraEntries.map(([, component]) => component)].map((component) =>\n\t\t\tprepareComponentRegistration(app, component)\n\t\t);\n\t\tfor (const registration of registrations) {\n\t\t\tif (!registration.registered) app.component(registration.name, registration.component);\n\t\t}\n\t};\n\treturn installable;\n}\n\n/**\n * 为不需要单独注册的附属组件附加空安装函数。\n *\n * @remarks 适用于只能作为主组件附属属性使用、但仍需满足 Vue Plugin 类型的组件。\n * 函数直接修改并返回传入组件,不会向 Vue 3 App 注册内容。\n * @param component - 尚未定义或继承 `install` 属性的组件。\n * @returns 原组件引用及无副作用的 `install` 方法。\n * @throws `TypeError` 当组件自身或原型链已经存在 `install`。\n */\nexport function withNoopInstall<Value extends VueInstallValue>(component: Value): TSXWithInstall<Value> {\n\tif (\"install\" in Object(component)) throw new TypeError(\"Vue 组件已定义 `install` 属性。\");\n\tconst installable = component as TSXWithInstall<Value>;\n\tinstallable.install = (): void => undefined;\n\treturn installable;\n}\n\n/**\n * 为 Vue 3 指令附加插件安装能力。\n *\n * @remarks 函数直接修改并返回指令。安装时重复注册同一引用保持幂等,不会覆盖同名的\n * 其他指令。名称只传给 `directive()`,不得包含 `v-` 前缀。\n * @param directive - 尚未定义或继承 `install` 属性的 Vue 指令对象。\n * @param name - 非空、无空白且不以 `v-` 开头的全局指令名。\n * @returns 原指令引用及 Vue Plugin `install` 方法。\n * @throws `TypeError` 当名称非法、指令已有 `install`,或安装目标无效。\n * @throws `Error` 当 App 中同名位置已经注册其他指令。\n */\nexport function withInstallDirective<Value extends VueInstallValue>(directive: Value, name: string): Installable<Value> {\n\tif (name.length === 0 || /\\s/u.test(name) || name.startsWith(\"v-\")) {\n\t\tthrow new TypeError(\"可安装的 Vue 指令名称不能包含空白或 `v-` 前缀。\");\n\t}\n\tif (\"install\" in Object(directive)) throw new TypeError(\"Vue 指令已定义 `install` 属性。\");\n\tconst installable = directive as Installable<Value>;\n\tinstallable.install = (value: App): void => {\n\t\tconst app = assertApp(value);\n\t\tconst existing = app.directive(name);\n\t\tif (existing !== undefined && existing !== directive) {\n\t\t\tthrow new Error(`Vue 指令名称“${name}”已被其他指令注册。`);\n\t\t}\n\t\tif (existing !== directive) app.directive(name, directive);\n\t};\n\treturn installable;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComputedRef, PropType } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* 为 Vue 运行时 Props 构造器附加泛型类型。
|
|
4
|
+
*
|
|
5
|
+
* @remarks 该函数只帮助 TypeScript 建模,不验证运行时值与 `Value` 一致;调用方仍应
|
|
6
|
+
* 传入 Vue 支持的构造器或构造器数组。
|
|
7
|
+
* @param runtimeType - Vue 支持的运行时构造器或构造器数组。
|
|
8
|
+
* @returns 同一引用,仅在类型层收窄为 `PropType<Value>`。
|
|
9
|
+
*/
|
|
10
|
+
export declare function definePropType<Value>(runtimeType: unknown): PropType<Value>;
|
|
11
|
+
/**
|
|
12
|
+
* 构建需要透传给子组件的响应式 Props。
|
|
13
|
+
*
|
|
14
|
+
* @param props - Vue `setup` 接收的只读响应式 Props 对象。
|
|
15
|
+
* @param rawProps - 子组件的运行时 Props 配置。
|
|
16
|
+
* @param ignoredProps - 不需要透传的 Props 名称。
|
|
17
|
+
* @returns 只包含 `rawProps` 声明键且随 Props 更新的 ComputedRef。
|
|
18
|
+
*/
|
|
19
|
+
export declare function useProps<Props extends object, RawProps extends object, IgnoredProp extends keyof RawProps = never>(props: Props, rawProps: RawProps, ignoredProps?: readonly IgnoredProp[]): ComputedRef<Omit<Pick<Props, Extract<keyof Props, keyof RawProps>>, Extract<IgnoredProp, keyof Props>>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
//#region src/utils/vue/props.ts
|
|
3
|
+
/**
|
|
4
|
+
* 为 Vue 运行时 Props 构造器附加泛型类型。
|
|
5
|
+
*
|
|
6
|
+
* @remarks 该函数只帮助 TypeScript 建模,不验证运行时值与 `Value` 一致;调用方仍应
|
|
7
|
+
* 传入 Vue 支持的构造器或构造器数组。
|
|
8
|
+
* @param runtimeType - Vue 支持的运行时构造器或构造器数组。
|
|
9
|
+
* @returns 同一引用,仅在类型层收窄为 `PropType<Value>`。
|
|
10
|
+
*/
|
|
11
|
+
function definePropType(runtimeType) {
|
|
12
|
+
return runtimeType;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 构建需要透传给子组件的响应式 Props。
|
|
16
|
+
*
|
|
17
|
+
* @param props - Vue `setup` 接收的只读响应式 Props 对象。
|
|
18
|
+
* @param rawProps - 子组件的运行时 Props 配置。
|
|
19
|
+
* @param ignoredProps - 不需要透传的 Props 名称。
|
|
20
|
+
* @returns 只包含 `rawProps` 声明键且随 Props 更新的 ComputedRef。
|
|
21
|
+
*/
|
|
22
|
+
function useProps(props, rawProps, ignoredProps = []) {
|
|
23
|
+
const ignored = new Set(ignoredProps);
|
|
24
|
+
return computed(() => {
|
|
25
|
+
const result = {};
|
|
26
|
+
for (const key of Reflect.ownKeys(rawProps)) {
|
|
27
|
+
if (ignored.has(key) || !Object.hasOwn(props, key)) continue;
|
|
28
|
+
Object.defineProperty(result, key, {
|
|
29
|
+
configurable: true,
|
|
30
|
+
enumerable: true,
|
|
31
|
+
value: Reflect.get(props, key),
|
|
32
|
+
writable: true
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { definePropType, useProps };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=props.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.mjs","names":[],"sources":["../../../src/utils/vue/props.ts"],"sourcesContent":["import { computed } from \"vue\";\nimport type { ComputedRef, PropType } from \"vue\";\n\n/**\n * 为 Vue 运行时 Props 构造器附加泛型类型。\n *\n * @remarks 该函数只帮助 TypeScript 建模,不验证运行时值与 `Value` 一致;调用方仍应\n * 传入 Vue 支持的构造器或构造器数组。\n * @param runtimeType - Vue 支持的运行时构造器或构造器数组。\n * @returns 同一引用,仅在类型层收窄为 `PropType<Value>`。\n */\nexport function definePropType<Value>(runtimeType: unknown): PropType<Value> {\n\treturn runtimeType as PropType<Value>;\n}\n\n/**\n * 构建需要透传给子组件的响应式 Props。\n *\n * @param props - Vue `setup` 接收的只读响应式 Props 对象。\n * @param rawProps - 子组件的运行时 Props 配置。\n * @param ignoredProps - 不需要透传的 Props 名称。\n * @returns 只包含 `rawProps` 声明键且随 Props 更新的 ComputedRef。\n */\nexport function useProps<Props extends object, RawProps extends object, IgnoredProp extends keyof RawProps = never>(\n\tprops: Props,\n\trawProps: RawProps,\n\tignoredProps: readonly IgnoredProp[] = []\n): ComputedRef<Omit<Pick<Props, Extract<keyof Props, keyof RawProps>>, Extract<IgnoredProp, keyof Props>>> {\n\tconst ignored = new Set<PropertyKey>(ignoredProps);\n\ttype Result = Omit<Pick<Props, Extract<keyof Props, keyof RawProps>>, Extract<IgnoredProp, keyof Props>>;\n\treturn computed<Result>(() => {\n\t\tconst result = {} as Result;\n\t\tfor (const key of Reflect.ownKeys(rawProps)) {\n\t\t\tif (ignored.has(key) || !Object.hasOwn(props, key)) continue;\n\t\t\tObject.defineProperty(result, key, { configurable: true, enumerable: true, value: Reflect.get(props, key), writable: true });\n\t\t}\n\t\treturn result;\n\t});\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,eAAsB,aAAuC;CAC5E,OAAO;AACR;;;;;;;;;AAUA,SAAgB,SACf,OACA,UACA,eAAuC,CAAC,GACkE;CAC1G,MAAM,UAAU,IAAI,IAAiB,YAAY;CAEjD,OAAO,eAAuB;EAC7B,MAAM,SAAS,CAAC;EAChB,KAAK,MAAM,OAAO,QAAQ,QAAQ,QAAQ,GAAG;GAC5C,IAAI,QAAQ,IAAI,GAAG,KAAK,CAAC,OAAO,OAAO,OAAO,GAAG,GAAG;GACpD,OAAO,eAAe,QAAQ,KAAK;IAAE,cAAc;IAAM,YAAY;IAAM,OAAO,QAAQ,IAAI,OAAO,GAAG;IAAG,UAAU;GAAK,CAAC;EAC5H;EACA,OAAO;CACR,CAAC;AACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { VNode } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* 在当前 Vue 3 组件实例上安装 TSX 渲染函数。
|
|
4
|
+
* @remarks `setup` 仍可返回状态对象,因此状态能够显示在 Vue Devtools 中。
|
|
5
|
+
* @param render - 当前组件的渲染函数。
|
|
6
|
+
* @throws 不在组件 `setup` 调用栈中使用时抛出 `Error`。
|
|
7
|
+
*/
|
|
8
|
+
export declare function useRender(render: () => VNode): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getCurrentInstance } from "vue";
|
|
2
|
+
//#region src/utils/vue/render.ts
|
|
3
|
+
/**
|
|
4
|
+
* 在当前 Vue 3 组件实例上安装 TSX 渲染函数。
|
|
5
|
+
* @remarks `setup` 仍可返回状态对象,因此状态能够显示在 Vue Devtools 中。
|
|
6
|
+
* @param render - 当前组件的渲染函数。
|
|
7
|
+
* @throws 不在组件 `setup` 调用栈中使用时抛出 `Error`。
|
|
8
|
+
*/
|
|
9
|
+
function useRender(render) {
|
|
10
|
+
const instance = getCurrentInstance();
|
|
11
|
+
if (instance === null) throw new Error("`useRender` 必须在 `setup` 函数内部调用。");
|
|
12
|
+
instance.render = render;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { useRender };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=render.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.mjs","names":[],"sources":["../../../src/utils/vue/render.ts"],"sourcesContent":["import { getCurrentInstance } from \"vue\";\nimport type { VNode } from \"vue\";\n\n/** `useRender` 需要写入的 Vue 3 内部组件实例字段。 */\ninterface MutableVueComponentInstance {\n\trender?: () => VNode;\n}\n\n/**\n * 在当前 Vue 3 组件实例上安装 TSX 渲染函数。\n * @remarks `setup` 仍可返回状态对象,因此状态能够显示在 Vue Devtools 中。\n * @param render - 当前组件的渲染函数。\n * @throws 不在组件 `setup` 调用栈中使用时抛出 `Error`。\n */\nexport function useRender(render: () => VNode): void {\n\tconst instance = getCurrentInstance();\n\tif (instance === null) throw new Error(\"`useRender` 必须在 `setup` 函数内部调用。\");\n\t(instance as unknown as MutableVueComponentInstance).render = render;\n}\n"],"mappings":";;;;;;;;AAcA,SAAgB,UAAU,QAA2B;CACpD,MAAM,WAAW,mBAAmB;CACpC,IAAI,aAAa,MAAM,MAAM,IAAI,MAAM,iCAAiC;CACxE,SAAqD,SAAS;AAC/D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SlotsType, VNode } from "vue";
|
|
2
|
+
/** Slot 名到 Props 类型的内部声明映射。 */
|
|
3
|
+
type RawSlots = Record<string, unknown>;
|
|
4
|
+
/** 根据 Slot Props 是否为 never 生成无参数或有参数的 Slot 签名。 */
|
|
5
|
+
type VueSlot<Properties> = [Properties] extends [never] ? () => VNode[] : (properties: Properties) => VNode[];
|
|
6
|
+
/** 把 Slot 名称与作用域参数映射为 Vue 3 Slot 函数。 */
|
|
7
|
+
export type TypedSlots<Slots extends RawSlots> = {
|
|
8
|
+
[Name in keyof Slots]: VueSlot<Slots[Name]>;
|
|
9
|
+
};
|
|
10
|
+
/** Vue 3 `slots` 选项接受的运行时声明与官方静态类型标记。 */
|
|
11
|
+
export type TypedSlotsDeclaration<Slots extends RawSlots> = SlotsType<Partial<TypedSlots<Slots>>>;
|
|
12
|
+
/**
|
|
13
|
+
* 为 Options API 的 `slots` 选项创建带作用域参数的类型声明。
|
|
14
|
+
*
|
|
15
|
+
* @returns 运行时 `Object` 构造器,并携带仅供 TypeScript 使用的 Slot 类型标记。
|
|
16
|
+
*/
|
|
17
|
+
export declare function makeSlots<Slots extends RawSlots>(): TypedSlotsDeclaration<Slots>;
|
|
18
|
+
export {};
|