@feugene/granularity 0.4.0 → 0.4.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/dist/chunks/_plugin-vue_export-helper-BG_EqiDU.js +8 -0
- package/dist/chunks/adapter-C7fKeUa4.js +6 -0
- package/dist/chunks/adapter-C7fKeUa4.js.map +1 -0
- package/dist/chunks/arrow-up-DNXrMoAI.js +25 -0
- package/dist/chunks/arrow-up-DNXrMoAI.js.map +1 -0
- package/dist/chunks/classTokens-BPeBXNzu.js +8 -0
- package/dist/chunks/classTokens-BPeBXNzu.js.map +1 -0
- package/dist/chunks/config-2wgwWaAB.js +10 -0
- package/dist/chunks/config-2wgwWaAB.js.map +1 -0
- package/dist/chunks/config-BKRmlivc.js +10 -0
- package/dist/chunks/config-BKRmlivc.js.map +1 -0
- package/dist/chunks/config-BRU5PR8_.js +10 -0
- package/dist/chunks/config-BRU5PR8_.js.map +1 -0
- package/dist/chunks/config-BUGfFjmC.js +16 -0
- package/dist/chunks/config-BUGfFjmC.js.map +1 -0
- package/dist/chunks/config-BXffa3ta.js +60 -0
- package/dist/chunks/config-BXffa3ta.js.map +1 -0
- package/dist/chunks/config-BaMO9dQh.js +22 -0
- package/dist/chunks/config-BaMO9dQh.js.map +1 -0
- package/dist/chunks/config-BbtK511H.js +11 -0
- package/dist/chunks/config-BbtK511H.js.map +1 -0
- package/dist/chunks/config-BcFOkUhh.js +15 -0
- package/dist/chunks/config-BcFOkUhh.js.map +1 -0
- package/dist/chunks/config-BcpRsZTe.js +10 -0
- package/dist/chunks/config-BcpRsZTe.js.map +1 -0
- package/dist/chunks/config-BhubOeci.js +15 -0
- package/dist/chunks/config-BhubOeci.js.map +1 -0
- package/dist/chunks/config-BhvNm4Pp.js +173 -0
- package/dist/chunks/config-BhvNm4Pp.js.map +1 -0
- package/dist/chunks/config-Bv2G0OU6.js +10 -0
- package/dist/chunks/config-Bv2G0OU6.js.map +1 -0
- package/dist/chunks/config-Bv5Dok4j.js +41 -0
- package/dist/chunks/config-Bv5Dok4j.js.map +1 -0
- package/dist/chunks/config-BzQ4S4Hb.js +11 -0
- package/dist/chunks/config-BzQ4S4Hb.js.map +1 -0
- package/dist/chunks/config-BzZGpWsj.js +11 -0
- package/dist/chunks/config-BzZGpWsj.js.map +1 -0
- package/dist/chunks/config-C0b_3LJV.js +42 -0
- package/dist/chunks/config-C0b_3LJV.js.map +1 -0
- package/dist/chunks/config-C2JKq8-2.js +60 -0
- package/dist/chunks/config-C2JKq8-2.js.map +1 -0
- package/dist/chunks/config-C6SBJxcH.js +10 -0
- package/dist/chunks/config-C6SBJxcH.js.map +1 -0
- package/dist/chunks/config-CJbjLC5X.js +55 -0
- package/dist/chunks/config-CJbjLC5X.js.map +1 -0
- package/dist/chunks/config-CJeyaUTp.js +40 -0
- package/dist/chunks/config-CJeyaUTp.js.map +1 -0
- package/dist/chunks/config-CMZE2fu0.js +11 -0
- package/dist/chunks/config-CMZE2fu0.js.map +1 -0
- package/dist/chunks/config-CU_CBd0k.js +24 -0
- package/dist/chunks/config-CU_CBd0k.js.map +1 -0
- package/dist/chunks/config-CYPU3ztl.js +26 -0
- package/dist/chunks/config-CYPU3ztl.js.map +1 -0
- package/dist/chunks/config-CcmeMlic.js +19 -0
- package/dist/chunks/config-CcmeMlic.js.map +1 -0
- package/dist/chunks/config-CdAx6ify2.js +11 -0
- package/dist/chunks/config-CdAx6ify2.js.map +1 -0
- package/dist/chunks/config-CxCAfXZ1.js +23 -0
- package/dist/chunks/config-CxCAfXZ1.js.map +1 -0
- package/dist/chunks/config-D1gSaT52.js +11 -0
- package/dist/chunks/config-D1gSaT52.js.map +1 -0
- package/dist/chunks/config-D7iuXJbl.js +11 -0
- package/dist/chunks/config-D7iuXJbl.js.map +1 -0
- package/dist/chunks/config-D7tRu8u3.js +11 -0
- package/dist/chunks/config-D7tRu8u3.js.map +1 -0
- package/dist/chunks/config-DBYCntwl.js +10 -0
- package/dist/chunks/config-DBYCntwl.js.map +1 -0
- package/dist/chunks/config-DFRYOcrP.js +11 -0
- package/dist/chunks/config-DFRYOcrP.js.map +1 -0
- package/dist/chunks/config-DW_RqmUp.js +10 -0
- package/dist/chunks/config-DW_RqmUp.js.map +1 -0
- package/dist/chunks/config-Dkq0HeLe.js +11 -0
- package/dist/chunks/config-Dkq0HeLe.js.map +1 -0
- package/dist/chunks/config-DlLE49_I.js +11 -0
- package/dist/chunks/config-DlLE49_I.js.map +1 -0
- package/dist/chunks/config-DvTUDLT1.js +46 -0
- package/dist/chunks/config-DvTUDLT1.js.map +1 -0
- package/dist/chunks/config-DwB5-qdP2.js +10 -0
- package/dist/chunks/config-DwB5-qdP2.js.map +1 -0
- package/dist/chunks/config-DxqMXzNV2.js +25 -0
- package/dist/chunks/config-DxqMXzNV2.js.map +1 -0
- package/dist/chunks/config-DxqpV-KM.js +47 -0
- package/dist/chunks/config-DxqpV-KM.js.map +1 -0
- package/dist/chunks/config-Dzz9P-GV2.js +11 -0
- package/dist/chunks/config-Dzz9P-GV2.js.map +1 -0
- package/dist/chunks/config-KGTIAFD92.js +10 -0
- package/dist/chunks/config-KGTIAFD92.js.map +1 -0
- package/dist/chunks/config-TyzU6gLf.js +10 -0
- package/dist/chunks/config-TyzU6gLf.js.map +1 -0
- package/dist/chunks/config-cn6knwud.js +37 -0
- package/dist/chunks/config-cn6knwud.js.map +1 -0
- package/dist/chunks/config-dD6Po-Cq.js +10 -0
- package/dist/chunks/config-dD6Po-Cq.js.map +1 -0
- package/dist/chunks/config-rFwazRKi.js +11 -0
- package/dist/chunks/config-rFwazRKi.js.map +1 -0
- package/dist/chunks/config-rQlbnEKn.js +10 -0
- package/dist/chunks/config-rQlbnEKn.js.map +1 -0
- package/dist/chunks/config-rxFL-6yF2.js +80 -0
- package/dist/chunks/config-rxFL-6yF2.js.map +1 -0
- package/dist/chunks/config-ug8O8epd.js +13 -0
- package/dist/chunks/config-ug8O8epd.js.map +1 -0
- package/dist/chunks/dialogShared-BtXUk6Zc.js +34 -0
- package/dist/chunks/dialogShared-BtXUk6Zc.js.map +1 -0
- package/dist/chunks/directives-Cuib0yOO.js +728 -0
- package/dist/chunks/directives-Cuib0yOO.js.map +1 -0
- package/dist/chunks/en-BMjJZttK.js +50 -0
- package/dist/chunks/en-BMjJZttK.js.map +1 -0
- package/dist/chunks/es-Cu_RlgIr.js +22 -0
- package/dist/chunks/es-Cu_RlgIr.js.map +1 -0
- package/dist/chunks/es-EYCf8G_1.js +50 -0
- package/dist/chunks/es-EYCf8G_1.js.map +1 -0
- package/dist/chunks/fileValidation-CgjTGoUx.js +221 -0
- package/dist/chunks/fileValidation-CgjTGoUx.js.map +1 -0
- package/dist/chunks/{grBadgeStyles-Bu4H8bFc.js → grBadgeStyles-pqqbVgLk.js} +20 -13
- package/dist/chunks/grBadgeStyles-pqqbVgLk.js.map +1 -0
- package/dist/chunks/{grButtonStyles-C5k0bN2e.js → grButtonStyles-BxZW2x0-.js} +62 -52
- package/dist/chunks/grButtonStyles-BxZW2x0-.js.map +1 -0
- package/dist/chunks/grDropdownStyles-DQfLh-bp.js +34 -0
- package/dist/chunks/grDropdownStyles-DQfLh-bp.js.map +1 -0
- package/dist/chunks/grLoadingStyles-CERsxyk9.js +19 -0
- package/dist/chunks/grLoadingStyles-CERsxyk9.js.map +1 -0
- package/dist/chunks/grModalStyles-Dv2NXBKi.js +49 -0
- package/dist/chunks/grModalStyles-Dv2NXBKi.js.map +1 -0
- package/dist/chunks/grSelectStyles-C1zNEkV7.js +52 -0
- package/dist/chunks/grSelectStyles-C1zNEkV7.js.map +1 -0
- package/dist/chunks/granularityI18n-BEWP9aJs.js +28 -0
- package/dist/chunks/granularityI18n-BEWP9aJs.js.map +1 -0
- package/dist/chunks/info-C0bHmdZq.js +28 -0
- package/dist/chunks/info-C0bHmdZq.js.map +1 -0
- package/dist/chunks/loader-circle-B2rWDk5u.js +25 -0
- package/dist/chunks/loader-circle-B2rWDk5u.js.map +1 -0
- package/dist/chunks/ru-DKswMSdd.js +50 -0
- package/dist/chunks/ru-DKswMSdd.js.map +1 -0
- package/dist/chunks/safelist-BF822K15.js +15 -0
- package/dist/chunks/safelist-BF822K15.js.map +1 -0
- package/dist/chunks/safelist-BY7z8fOl.js +26 -0
- package/dist/chunks/safelist-BY7z8fOl.js.map +1 -0
- package/dist/chunks/{shared-BqUqjuxn.js → shared-Bvjkhhm2.js} +151 -111
- package/dist/chunks/shared-Bvjkhhm2.js.map +1 -0
- package/dist/chunks/transition-mJ3PZCHH.js +1694 -0
- package/dist/chunks/transition-mJ3PZCHH.js.map +1 -0
- package/dist/chunks/x-Pa6C2hwi.js +25 -0
- package/dist/chunks/x-Pa6C2hwi.js.map +1 -0
- package/dist/chunks/x-circle-DQSlBLmX.js +69 -0
- package/dist/chunks/x-circle-DQSlBLmX.js.map +1 -0
- package/dist/components/GrAlert/chunks/GrAlert-BjerGcU8.js +148 -0
- package/dist/components/GrAlert/chunks/GrAlert-BjerGcU8.js.map +1 -0
- package/dist/components/GrAlert/index.js +3 -3
- package/dist/components/GrAvatar/chunks/GrAvatar-BjnPKNAL.js +43 -0
- package/dist/components/GrAvatar/chunks/GrAvatar-BjnPKNAL.js.map +1 -0
- package/dist/components/GrAvatar/index.js +3 -3
- package/dist/components/GrBadge/chunks/GrBadge-wuIb4_2K.js +34 -0
- package/dist/components/GrBadge/chunks/GrBadge-wuIb4_2K.js.map +1 -0
- package/dist/components/GrBadge/index.js +3 -3
- package/dist/components/GrBadgeWrap/chunks/GrBadgeWrap-CxtamOZ-.js +35 -0
- package/dist/components/GrBadgeWrap/chunks/GrBadgeWrap-CxtamOZ-.js.map +1 -0
- package/dist/components/GrBadgeWrap/index.js +3 -3
- package/dist/components/GrBottomNav/chunks/GrBottomNav-CsmQ7mTJ.js +33 -0
- package/dist/components/GrBottomNav/chunks/GrBottomNav-CsmQ7mTJ.js.map +1 -0
- package/dist/components/GrBottomNav/index.js +3 -3
- package/dist/components/GrButton/chunks/GrButton-BmGdp8-4.js +85 -0
- package/dist/components/GrButton/chunks/GrButton-BmGdp8-4.js.map +1 -0
- package/dist/components/GrButton/index.js +5 -5
- package/dist/components/GrButtonGroup/chunks/GrButtonGroup-CBj4tpms.js +23 -0
- package/dist/components/GrButtonGroup/chunks/GrButtonGroup-CBj4tpms.js.map +1 -0
- package/dist/components/GrButtonGroup/index.js +3 -3
- package/dist/components/GrCard/chunks/GrCard-xtDcXBr7.js +13 -0
- package/dist/components/GrCard/chunks/GrCard-xtDcXBr7.js.map +1 -0
- package/dist/components/GrCard/index.js +3 -3
- package/dist/components/GrCheckbox/chunks/GrCheckbox-Bt3d7ckE.js +136 -0
- package/dist/components/GrCheckbox/chunks/GrCheckbox-Bt3d7ckE.js.map +1 -0
- package/dist/components/GrCheckbox/index.js +3 -3
- package/dist/components/GrCollapse/chunks/GrCollapse-HU20VTVn.js +207 -0
- package/dist/components/GrCollapse/chunks/GrCollapse-HU20VTVn.js.map +1 -0
- package/dist/components/GrCollapse/index.js +3 -3
- package/dist/components/GrConfirmDialog/chunks/GrConfirmDialog-DjGOX9Hd.js +133 -0
- package/dist/components/GrConfirmDialog/chunks/GrConfirmDialog-DjGOX9Hd.js.map +1 -0
- package/dist/components/GrConfirmDialog/index.js +3 -3
- package/dist/components/GrDataTable/chunks/GrDataTable-QDOJWmdY.js +181 -0
- package/dist/components/GrDataTable/chunks/GrDataTable-QDOJWmdY.js.map +1 -0
- package/dist/components/GrDataTable/index.js +3 -3
- package/dist/components/GrDialog/chunks/GrDialog-gObmaVEl.js +223 -0
- package/dist/components/GrDialog/chunks/GrDialog-gObmaVEl.js.map +1 -0
- package/dist/components/GrDialog/index.js +4 -4
- package/dist/components/GrDrawer/chunks/GrDrawer-BJL_gTxI.js +158 -0
- package/dist/components/GrDrawer/chunks/GrDrawer-BJL_gTxI.js.map +1 -0
- package/dist/components/GrDrawer/index.js +3 -3
- package/dist/components/GrDropdown/chunks/GrDropdown-DVTU32T_.js +153 -0
- package/dist/components/GrDropdown/chunks/GrDropdown-DVTU32T_.js.map +1 -0
- package/dist/components/GrDropdown/index.js +3 -3
- package/dist/components/GrDropdownMenu/chunks/GrDropdownMenu-fePQRcgh.js +311 -0
- package/dist/components/GrDropdownMenu/chunks/GrDropdownMenu-fePQRcgh.js.map +1 -0
- package/dist/components/GrDropdownMenu/index.js +3 -3
- package/dist/components/GrEmptyState/chunks/GrEmptyState-Bs8d3tgb.js +64 -0
- package/dist/components/GrEmptyState/chunks/GrEmptyState-Bs8d3tgb.js.map +1 -0
- package/dist/components/GrEmptyState/index.js +3 -3
- package/dist/components/GrFileUpload/chunks/GrFileUpload-DVv8yXpl.js +370 -0
- package/dist/components/GrFileUpload/chunks/GrFileUpload-DVv8yXpl.js.map +1 -0
- package/dist/components/GrFileUpload/index.js +4 -4
- package/dist/components/GrFormField/chunks/GrFormField-BzezYcS8.js +37 -0
- package/dist/components/GrFormField/chunks/GrFormField-BzezYcS8.js.map +1 -0
- package/dist/components/GrFormField/index.js +3 -3
- package/dist/components/GrFormFile/chunks/GrFormFile-DtZOypJW.js +315 -0
- package/dist/components/GrFormFile/chunks/GrFormFile-DtZOypJW.js.map +1 -0
- package/dist/components/GrFormFile/index.js +3 -3
- package/dist/components/GrFormSection/chunks/GrFormSection-BIPB1RIk.js +37 -0
- package/dist/components/GrFormSection/chunks/GrFormSection-BIPB1RIk.js.map +1 -0
- package/dist/components/GrFormSection/index.js +3 -3
- package/dist/components/GrIcon/chunks/GrIcon-BV7RBU_0.js +34 -0
- package/dist/components/GrIcon/chunks/GrIcon-BV7RBU_0.js.map +1 -0
- package/dist/components/GrIcon/index.js +3 -3
- package/dist/components/GrImageViewer/chunks/GrImageViewer-fn8ilJTA.js +399 -0
- package/dist/components/GrImageViewer/chunks/GrImageViewer-fn8ilJTA.js.map +1 -0
- package/dist/components/GrImageViewer/index.js +3 -3
- package/dist/components/GrInput/chunks/GrInput-DLLRrH1A.js +213 -0
- package/dist/components/GrInput/chunks/GrInput-DLLRrH1A.js.map +1 -0
- package/dist/components/GrInput/index.js +3 -3
- package/dist/components/GrInputTag/chunks/GrInputTag-CzrrBxgU.js +259 -0
- package/dist/components/GrInputTag/chunks/GrInputTag-CzrrBxgU.js.map +1 -0
- package/dist/components/GrInputTag/index.js +3 -3
- package/dist/components/GrLink/chunks/GrLink-Dhkid3Mp.js +82 -0
- package/dist/components/GrLink/chunks/GrLink-Dhkid3Mp.js.map +1 -0
- package/dist/components/GrLink/index.js +3 -3
- package/dist/components/GrList/chunks/GrList-CjgeVjhY.js +79 -0
- package/dist/components/GrList/chunks/GrList-CjgeVjhY.js.map +1 -0
- package/dist/components/GrList/index.js +3 -3
- package/dist/components/GrLoading/chunks/GrLoading-DihGX3ol.js +71 -0
- package/dist/components/GrLoading/chunks/GrLoading-DihGX3ol.js.map +1 -0
- package/dist/components/GrLoading/index.js +3 -3
- package/dist/components/GrModal/chunks/GrModal-gvfvlp7k.js +170 -0
- package/dist/components/GrModal/chunks/GrModal-gvfvlp7k.js.map +1 -0
- package/dist/components/GrModal/index.js +4 -4
- package/dist/components/GrNavbar/chunks/GrNavbar-CQOAfO6y.js +77 -0
- package/dist/components/GrNavbar/chunks/GrNavbar-CQOAfO6y.js.map +1 -0
- package/dist/components/GrNavbar/index.js +3 -3
- package/dist/components/GrNumberInput/chunks/GrNumberInput-CyHgUotG.js +399 -0
- package/dist/components/GrNumberInput/chunks/GrNumberInput-CyHgUotG.js.map +1 -0
- package/dist/components/GrNumberInput/index.js +3 -3
- package/dist/components/GrPagination/chunks/GrPagination-C5cxRJsF.js +116 -0
- package/dist/components/GrPagination/chunks/GrPagination-C5cxRJsF.js.map +1 -0
- package/dist/components/GrPagination/index.js +3 -3
- package/dist/components/GrProgressBar/chunks/GrProgressBar-C9wAAFxR.js +41 -0
- package/dist/components/GrProgressBar/chunks/GrProgressBar-C9wAAFxR.js.map +1 -0
- package/dist/components/GrProgressBar/index.js +3 -3
- package/dist/components/GrPromptDialog/chunks/GrPromptDialog-Cfq9bvL3.js +192 -0
- package/dist/components/GrPromptDialog/chunks/GrPromptDialog-Cfq9bvL3.js.map +1 -0
- package/dist/components/GrPromptDialog/index.js +3 -3
- package/dist/components/GrRadio/chunks/GrRadio-B_t_ZNVl.js +186 -0
- package/dist/components/GrRadio/chunks/GrRadio-B_t_ZNVl.js.map +1 -0
- package/dist/components/GrRadio/index.js +3 -3
- package/dist/components/GrRadioGroup/chunks/GrRadioGroup-CVlgpUBr.js +82 -0
- package/dist/components/GrRadioGroup/chunks/GrRadioGroup-CVlgpUBr.js.map +1 -0
- package/dist/components/GrRadioGroup/index.js +3 -3
- package/dist/components/GrSegmented/chunks/GrSegmented-BPl1koHc.js +325 -0
- package/dist/components/GrSegmented/chunks/GrSegmented-BPl1koHc.js.map +1 -0
- package/dist/components/GrSegmented/index.js +3 -3
- package/dist/components/GrSelect/chunks/GrSelect-aVqUL-1F.js +445 -0
- package/dist/components/GrSelect/chunks/GrSelect-aVqUL-1F.js.map +1 -0
- package/dist/components/GrSelect/index.js +3 -3
- package/dist/components/GrSidebar/chunks/GrSidebar-DVucgcfV.js +46 -0
- package/dist/components/GrSidebar/chunks/GrSidebar-DVucgcfV.js.map +1 -0
- package/dist/components/GrSidebar/index.js +3 -3
- package/dist/components/GrSkeleton/chunks/GrSkeleton-CDTvCSoH.js +35 -0
- package/dist/components/GrSkeleton/chunks/GrSkeleton-CDTvCSoH.js.map +1 -0
- package/dist/components/GrSkeleton/index.js +3 -3
- package/dist/components/GrSwitch/chunks/GrSwitch-Bnamgqb2.js +81 -0
- package/dist/components/GrSwitch/chunks/GrSwitch-Bnamgqb2.js.map +1 -0
- package/dist/components/GrSwitch/index.js +3 -3
- package/dist/components/GrTable/chunks/GrTable-CyQ9uw8A.js +59 -0
- package/dist/components/GrTable/chunks/GrTable-CyQ9uw8A.js.map +1 -0
- package/dist/components/GrTable/index.js +3 -3
- package/dist/components/GrTabs/chunks/GrTabs-CiGmcmvm.js +120 -0
- package/dist/components/GrTabs/chunks/GrTabs-CiGmcmvm.js.map +1 -0
- package/dist/components/GrTabs/index.js +3 -3
- package/dist/components/GrTextarea/chunks/GrTextarea-VBSc6A7D.js +73 -0
- package/dist/components/GrTextarea/chunks/GrTextarea-VBSc6A7D.js.map +1 -0
- package/dist/components/GrTextarea/index.js +3 -3
- package/dist/components/GrToaster/chunks/GrToaster-I1e-zCpf.js +173 -0
- package/dist/components/GrToaster/chunks/GrToaster-I1e-zCpf.js.map +1 -0
- package/dist/components/GrToaster/index.js +3 -3
- package/dist/components/GrTooltip/chunks/GrTooltip-CrV1gI_c.js +57 -0
- package/dist/components/GrTooltip/chunks/GrTooltip-CrV1gI_c.js.map +1 -0
- package/dist/components/GrTooltip/index.js +3 -3
- package/dist/components/GrTree/chunks/GrTree-Dlev9oBd.js +736 -0
- package/dist/components/GrTree/chunks/GrTree-Dlev9oBd.js.map +1 -0
- package/dist/components/GrTree/index.js +3 -3
- package/dist/components/GrTreeSelect/chunks/GrTreeSelect-DN6XFjOD.js +456 -0
- package/dist/components/GrTreeSelect/chunks/GrTreeSelect-DN6XFjOD.js.map +1 -0
- package/dist/components/GrTreeSelect/index.js +3 -3
- package/dist/composables/useTheme.js +41 -30
- package/dist/composables/useTheme.js.map +1 -0
- package/dist/composables/useToast.js +43 -34
- package/dist/composables/useToast.js.map +1 -0
- package/dist/directives/index.js +2 -2
- package/dist/fileValidation/index.js +2 -2
- package/dist/granular-provider-node.js +25 -14
- package/dist/granular-provider-node.js.map +1 -0
- package/dist/granular-provider.js +5 -3
- package/dist/granular-provider.js.map +1 -0
- package/dist/i18n/all.js +8 -6
- package/dist/i18n/all.js.map +1 -0
- package/dist/i18n/index.js +3 -3
- package/dist/index.js +105 -105
- package/dist/vue/index.js +66 -26
- package/dist/vue/index.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunks/_plugin-vue_export-helper-CHO2XVys.js +0 -8
- package/dist/chunks/adapter-D5uYoOZj.js +0 -4
- package/dist/chunks/arrow-up-Dv3dC3hu.js +0 -23
- package/dist/chunks/classTokens-CT1tqF2j.js +0 -6
- package/dist/chunks/config-B5JCvHys.js +0 -13
- package/dist/chunks/config-BDXa5Sna2.js +0 -9
- package/dist/chunks/config-BG5_FuZ-.js +0 -34
- package/dist/chunks/config-BMYKG1oB.js +0 -10
- package/dist/chunks/config-BQREEXFD.js +0 -8
- package/dist/chunks/config-BUZtbeTr.js +0 -40
- package/dist/chunks/config-BVXycfiO.js +0 -9
- package/dist/chunks/config-BZW-RL6E.js +0 -14
- package/dist/chunks/config-BhbfV-Is.js +0 -48
- package/dist/chunks/config-BmYFupZh.js +0 -8
- package/dist/chunks/config-BsZc_QQ-2.js +0 -20
- package/dist/chunks/config-C1Sn7mn-.js +0 -27
- package/dist/chunks/config-C4_REX-3.js +0 -9
- package/dist/chunks/config-CBFllZZ4.js +0 -9
- package/dist/chunks/config-CDyD_fCt.js +0 -8
- package/dist/chunks/config-CJeG727i.js +0 -149
- package/dist/chunks/config-CLawBqde.js +0 -21
- package/dist/chunks/config-CMz46RPG.js +0 -8
- package/dist/chunks/config-CO-7HRZd2.js +0 -8
- package/dist/chunks/config-CS7E7LME.js +0 -9
- package/dist/chunks/config-CVy124Xj.js +0 -8
- package/dist/chunks/config-CcixQGaN.js +0 -47
- package/dist/chunks/config-CiVXZxyQ.js +0 -9
- package/dist/chunks/config-CoMQmunP.js +0 -8
- package/dist/chunks/config-Cq6ufYtp.js +0 -9
- package/dist/chunks/config-D8CIEWcb.js +0 -8
- package/dist/chunks/config-D8hKc39m.js +0 -18
- package/dist/chunks/config-D9MxGwCJ.js +0 -8
- package/dist/chunks/config-DBXTZE36.js +0 -15
- package/dist/chunks/config-DK9C8O7L.js +0 -9
- package/dist/chunks/config-DTegOmx2.js +0 -8
- package/dist/chunks/config-DYI8XADo.js +0 -47
- package/dist/chunks/config-DlidGf7P.js +0 -8
- package/dist/chunks/config-DtNe7EIX.js +0 -35
- package/dist/chunks/config-EdWeK_ge.js +0 -17
- package/dist/chunks/config-FGAkxHFh.js +0 -8
- package/dist/chunks/config-M76gNxd2.js +0 -37
- package/dist/chunks/config-NuqoO_Of.js +0 -33
- package/dist/chunks/config-QsovJrku2.js +0 -66
- package/dist/chunks/config-R6F6zRJk.js +0 -9
- package/dist/chunks/config-SLwkDc4Q2.js +0 -9
- package/dist/chunks/config-aJ7sb62Y.js +0 -8
- package/dist/chunks/config-b9nc87Oc.js +0 -9
- package/dist/chunks/config-dSI8RttH2.js +0 -8
- package/dist/chunks/config-im2VHeSM.js +0 -9
- package/dist/chunks/config-vKeQ035f.js +0 -9
- package/dist/chunks/config-vMcxHlWi.js +0 -14
- package/dist/chunks/dialogShared-CONROtU2.js +0 -26
- package/dist/chunks/directives-Dr5NPOT8.js +0 -530
- package/dist/chunks/en-j3simI0h.js +0 -41
- package/dist/chunks/es-CIT9s_vo.js +0 -4
- package/dist/chunks/es-CLpJj7KP.js +0 -41
- package/dist/chunks/fileValidation-LFD-vwil.js +0 -193
- package/dist/chunks/grDropdownStyles-149X1NeB.js +0 -31
- package/dist/chunks/grLoadingStyles-Bjo7ylmq.js +0 -15
- package/dist/chunks/grModalStyles-Dmd4havY.js +0 -38
- package/dist/chunks/grSelectStyles-C3QKIn1J.js +0 -40
- package/dist/chunks/granularityI18n-8_v1B11L.js +0 -24
- package/dist/chunks/info-CNJnuTYC.js +0 -26
- package/dist/chunks/loader-circle-C5vCCMfB.js +0 -23
- package/dist/chunks/ru-CiOZPnBu.js +0 -41
- package/dist/chunks/safelist-Bq32hAXc.js +0 -13
- package/dist/chunks/safelist-CLcTRYB-.js +0 -22
- package/dist/chunks/transition-BJXMi52x.js +0 -1617
- package/dist/chunks/x--kxrj3ez.js +0 -23
- package/dist/chunks/x-circle-ChJ87u1v.js +0 -61
- package/dist/components/GrAlert/chunks/GrAlert-DLHkusb-.js +0 -129
- package/dist/components/GrAvatar/chunks/GrAvatar-BFYH3HJw.js +0 -32
- package/dist/components/GrBadge/chunks/GrBadge-D_AoqGrn.js +0 -27
- package/dist/components/GrBadgeWrap/chunks/GrBadgeWrap-C_N0QJfA.js +0 -26
- package/dist/components/GrBottomNav/chunks/GrBottomNav-Chpu3SVd.js +0 -21
- package/dist/components/GrButton/chunks/GrButton-BXVVt6Od.js +0 -67
- package/dist/components/GrButtonGroup/chunks/GrButtonGroup-CmnYHVH7.js +0 -16
- package/dist/components/GrCard/chunks/GrCard-DEpN6Ptf.js +0 -10
- package/dist/components/GrCheckbox/chunks/GrCheckbox-DF3vJApB.js +0 -111
- package/dist/components/GrCollapse/chunks/GrCollapse-D7QYRqNa.js +0 -150
- package/dist/components/GrConfirmDialog/chunks/GrConfirmDialog-C7Eh8-Vn.js +0 -111
- package/dist/components/GrDataTable/chunks/GrDataTable-Dxsg1NMP.js +0 -142
- package/dist/components/GrDialog/chunks/GrDialog-BSd4-uP5.js +0 -169
- package/dist/components/GrDrawer/chunks/GrDrawer-DBBSwe1s.js +0 -135
- package/dist/components/GrDropdown/chunks/GrDropdown-BELyRP4A.js +0 -110
- package/dist/components/GrDropdownMenu/chunks/GrDropdownMenu-B8fuk7iP.js +0 -233
- package/dist/components/GrEmptyState/chunks/GrEmptyState-BPGoafJI.js +0 -49
- package/dist/components/GrFileUpload/chunks/GrFileUpload-BPzx3LEM.js +0 -294
- package/dist/components/GrFormField/chunks/GrFormField-Cn8g9eFP.js +0 -28
- package/dist/components/GrFormFile/chunks/GrFormFile-DfinD5Iv.js +0 -248
- package/dist/components/GrFormSection/chunks/GrFormSection-dKpQw-vh.js +0 -27
- package/dist/components/GrIcon/chunks/GrIcon-CXIHuG7L.js +0 -25
- package/dist/components/GrImageViewer/chunks/GrImageViewer-CQSNx-D7.js +0 -322
- package/dist/components/GrInput/chunks/GrInput-CLKX1inm.js +0 -158
- package/dist/components/GrInputTag/chunks/GrInputTag-BAtLody2.js +0 -214
- package/dist/components/GrLink/chunks/GrLink-BpXnly-Y.js +0 -59
- package/dist/components/GrList/chunks/GrList-BrFc7VdS.js +0 -55
- package/dist/components/GrLoading/chunks/GrLoading-dFuoryMY.js +0 -53
- package/dist/components/GrModal/chunks/GrModal-uaWXH08K.js +0 -136
- package/dist/components/GrNavbar/chunks/GrNavbar-KzLHgdjX.js +0 -62
- package/dist/components/GrNumberInput/chunks/GrNumberInput-rENn1802.js +0 -315
- package/dist/components/GrPagination/chunks/GrPagination-DP0x3rx6.js +0 -93
- package/dist/components/GrProgressBar/chunks/GrProgressBar-DpW93sOi.js +0 -29
- package/dist/components/GrPromptDialog/chunks/GrPromptDialog-ASfBwyzQ.js +0 -158
- package/dist/components/GrRadio/chunks/GrRadio-8BOo97XV.js +0 -147
- package/dist/components/GrRadioGroup/chunks/GrRadioGroup-BymbUmqI.js +0 -66
- package/dist/components/GrSegmented/chunks/GrSegmented-CK5C_lN7.js +0 -250
- package/dist/components/GrSelect/chunks/GrSelect-BMfc1-vs.js +0 -314
- package/dist/components/GrSidebar/chunks/GrSidebar-C4SXXhfO.js +0 -29
- package/dist/components/GrSkeleton/chunks/GrSkeleton-QlieOdpY.js +0 -25
- package/dist/components/GrSwitch/chunks/GrSwitch-Cefiutzu.js +0 -64
- package/dist/components/GrTable/chunks/GrTable-k_FUiJQk.js +0 -44
- package/dist/components/GrTabs/chunks/GrTabs-B46P-lUc.js +0 -98
- package/dist/components/GrTextarea/chunks/GrTextarea-BX7L1MJk.js +0 -57
- package/dist/components/GrToaster/chunks/GrToaster-C4l_BjOh.js +0 -139
- package/dist/components/GrTooltip/chunks/GrTooltip-BqRAzuLT.js +0 -37
- package/dist/components/GrTree/chunks/GrTree-C2CXR_vW.js +0 -614
- package/dist/components/GrTreeSelect/chunks/GrTreeSelect-DAAay-QB.js +0 -353
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { t as GrIcon_default } from "../../GrIcon/chunks/GrIcon-BV7RBU_0.js";
|
|
2
|
+
import { t as arrow_up_default } from "../../../chunks/arrow-up-DNXrMoAI.js";
|
|
3
|
+
import { l as runFileValidators, u as FileValidationError } from "../../../chunks/fileValidation-CgjTGoUx.js";
|
|
4
|
+
import { Comment, Fragment, Text, computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, nextTick, normalizeClass, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useSlots, withCtx } from "vue";
|
|
5
|
+
//#region src/components/GrFileUpload/GrFileUpload.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var _hoisted_1 = [
|
|
7
|
+
"role",
|
|
8
|
+
"tabindex",
|
|
9
|
+
"aria-disabled"
|
|
10
|
+
];
|
|
11
|
+
var _hoisted_2 = [
|
|
12
|
+
"name",
|
|
13
|
+
"multiple",
|
|
14
|
+
"disabled"
|
|
15
|
+
];
|
|
16
|
+
var _hoisted_3 = {
|
|
17
|
+
key: 1,
|
|
18
|
+
class: "flex items-start gap-4"
|
|
19
|
+
};
|
|
20
|
+
var _hoisted_4 = {
|
|
21
|
+
"data-ds-file-upload-icon": "",
|
|
22
|
+
class: "h-12 w-12 shrink-0 rounded-[12px] bg-[var(--muted)] border border-[var(--brd)] flex items-center justify-center",
|
|
23
|
+
"aria-hidden": "true"
|
|
24
|
+
};
|
|
25
|
+
var _hoisted_5 = { class: "min-w-0" };
|
|
26
|
+
var _hoisted_6 = {
|
|
27
|
+
"data-ds-file-upload-label": "",
|
|
28
|
+
class: "text-[14px] font-700"
|
|
29
|
+
};
|
|
30
|
+
var _hoisted_7 = {
|
|
31
|
+
key: 0,
|
|
32
|
+
"data-ds-file-upload-tip": "",
|
|
33
|
+
class: "mt-1 text-[13px] text-[var(--muted-fg)]"
|
|
34
|
+
};
|
|
35
|
+
var _hoisted_8 = {
|
|
36
|
+
key: 1,
|
|
37
|
+
class: "mt-1 text-[13px] text-[var(--muted-fg)]"
|
|
38
|
+
};
|
|
39
|
+
var _hoisted_9 = {
|
|
40
|
+
key: 2,
|
|
41
|
+
"data-ds-file-upload-list": "",
|
|
42
|
+
class: "mt-3 space-y-1"
|
|
43
|
+
};
|
|
44
|
+
var _hoisted_10 = { class: "font-600" };
|
|
45
|
+
var _hoisted_11 = { class: "text-[var(--muted-fg)]" };
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/components/GrFileUpload/GrFileUpload.vue
|
|
48
|
+
var GrFileUpload_default = /* @__PURE__ */ defineComponent({
|
|
49
|
+
__name: "GrFileUpload",
|
|
50
|
+
props: {
|
|
51
|
+
action: { default: void 0 },
|
|
52
|
+
request: {
|
|
53
|
+
type: Function,
|
|
54
|
+
default: void 0
|
|
55
|
+
},
|
|
56
|
+
name: { default: "file" },
|
|
57
|
+
multiple: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false
|
|
60
|
+
},
|
|
61
|
+
limit: { default: void 0 },
|
|
62
|
+
onExceed: {
|
|
63
|
+
type: Function,
|
|
64
|
+
default: void 0
|
|
65
|
+
},
|
|
66
|
+
beforeUpload: {
|
|
67
|
+
type: Function,
|
|
68
|
+
default: void 0
|
|
69
|
+
},
|
|
70
|
+
validators: { default: void 0 },
|
|
71
|
+
disabled: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
74
|
+
},
|
|
75
|
+
headers: { default: void 0 },
|
|
76
|
+
withCredentials: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: false
|
|
79
|
+
},
|
|
80
|
+
showFileList: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: false
|
|
83
|
+
},
|
|
84
|
+
uploadExtraData: {
|
|
85
|
+
type: Function,
|
|
86
|
+
default: void 0
|
|
87
|
+
},
|
|
88
|
+
placeholder: { default: "Drag files here or click to select" }
|
|
89
|
+
},
|
|
90
|
+
emits: [
|
|
91
|
+
"success",
|
|
92
|
+
"error",
|
|
93
|
+
"progress",
|
|
94
|
+
"change"
|
|
95
|
+
],
|
|
96
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
97
|
+
const props = __props;
|
|
98
|
+
const emit = __emit;
|
|
99
|
+
const slots = useSlots();
|
|
100
|
+
function flattenSlotNodes(nodes) {
|
|
101
|
+
const out = [];
|
|
102
|
+
for (const node of nodes) {
|
|
103
|
+
if (node.type === Fragment && Array.isArray(node.children)) {
|
|
104
|
+
out.push(...flattenSlotNodes(node.children));
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
out.push(node);
|
|
108
|
+
}
|
|
109
|
+
return out;
|
|
110
|
+
}
|
|
111
|
+
function isWhitespaceTextNode(node) {
|
|
112
|
+
if (node.type !== Text) return false;
|
|
113
|
+
return typeof node.children === "string" && node.children.trim().length === 0;
|
|
114
|
+
}
|
|
115
|
+
function slotIsTextOnly(nodes) {
|
|
116
|
+
const meaningful = flattenSlotNodes(nodes).filter((node) => node.type !== Comment && !isWhitespaceTextNode(node));
|
|
117
|
+
if (meaningful.length === 0) return true;
|
|
118
|
+
for (const node of meaningful) if (node.type !== Text) return false;
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
const defaultSlotNodes = computed(() => {
|
|
122
|
+
return slots.default ? flattenSlotNodes(slots.default({})) : [];
|
|
123
|
+
});
|
|
124
|
+
const hasCustomUi = computed(() => {
|
|
125
|
+
return !!slots.default && !slotIsTextOnly(defaultSlotNodes.value);
|
|
126
|
+
});
|
|
127
|
+
const inputRef = ref(null);
|
|
128
|
+
const isOver = ref(false);
|
|
129
|
+
let overCounter = 0;
|
|
130
|
+
const lastFiles = ref([]);
|
|
131
|
+
let activeController = null;
|
|
132
|
+
const tabIndex = computed(() => props.disabled ? -1 : 0);
|
|
133
|
+
const hiddenInputStyle = {
|
|
134
|
+
position: "fixed",
|
|
135
|
+
top: "-9999px",
|
|
136
|
+
left: "-9999px",
|
|
137
|
+
width: "1px",
|
|
138
|
+
height: "1px",
|
|
139
|
+
opacity: "0",
|
|
140
|
+
overflow: "hidden",
|
|
141
|
+
pointerEvents: "none"
|
|
142
|
+
};
|
|
143
|
+
function setOver(next) {
|
|
144
|
+
if (isOver.value === next) return;
|
|
145
|
+
isOver.value = next;
|
|
146
|
+
}
|
|
147
|
+
function openDialog() {
|
|
148
|
+
if (props.disabled) return;
|
|
149
|
+
inputRef.value?.click();
|
|
150
|
+
}
|
|
151
|
+
function abort() {
|
|
152
|
+
activeController?.abort();
|
|
153
|
+
activeController = null;
|
|
154
|
+
}
|
|
155
|
+
function normalizeLimit(limit) {
|
|
156
|
+
if (typeof limit !== "number") return void 0;
|
|
157
|
+
if (!Number.isFinite(limit)) return void 0;
|
|
158
|
+
if (limit <= 0) return void 0;
|
|
159
|
+
return Math.floor(limit);
|
|
160
|
+
}
|
|
161
|
+
function appendExtraFormData(body, extraData) {
|
|
162
|
+
if (!extraData) return;
|
|
163
|
+
for (const [key, value] of Object.entries(extraData)) {
|
|
164
|
+
if (Array.isArray(value)) {
|
|
165
|
+
for (const entry of value) body.append(key, entry);
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
body.append(key, value);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async function uploadViaAction(files, signal, extraData) {
|
|
172
|
+
if (!props.action) throw new Error("GrFileUpload: either `action` or `request` must be provided");
|
|
173
|
+
const body = new FormData();
|
|
174
|
+
for (const file of files) body.append(props.name, file);
|
|
175
|
+
appendExtraFormData(body, extraData);
|
|
176
|
+
const response = await fetch(props.action, {
|
|
177
|
+
method: "POST",
|
|
178
|
+
headers: props.headers,
|
|
179
|
+
body,
|
|
180
|
+
signal,
|
|
181
|
+
credentials: props.withCredentials ? "include" : "same-origin"
|
|
182
|
+
});
|
|
183
|
+
const payload = response.headers.get("content-type")?.includes("application/json") ? await response.json() : await response.text();
|
|
184
|
+
if (!response.ok) {
|
|
185
|
+
const error = /* @__PURE__ */ new Error(`Upload failed with status ${response.status}`);
|
|
186
|
+
error.payload = payload;
|
|
187
|
+
error.status = response.status;
|
|
188
|
+
throw error;
|
|
189
|
+
}
|
|
190
|
+
return payload;
|
|
191
|
+
}
|
|
192
|
+
async function runBeforeUpload(files) {
|
|
193
|
+
if (!props.beforeUpload) return "ok";
|
|
194
|
+
for (const file of files) try {
|
|
195
|
+
const result = props.beforeUpload(file);
|
|
196
|
+
if (result === false) return {
|
|
197
|
+
aborted: true,
|
|
198
|
+
reason: /* @__PURE__ */ new Error("Upload aborted by beforeUpload")
|
|
199
|
+
};
|
|
200
|
+
if (result && typeof result.then === "function") await result;
|
|
201
|
+
} catch (error) {
|
|
202
|
+
return {
|
|
203
|
+
aborted: true,
|
|
204
|
+
reason: error
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
return "ok";
|
|
208
|
+
}
|
|
209
|
+
async function handleFiles(files, source = "input") {
|
|
210
|
+
if (props.disabled) return;
|
|
211
|
+
if (!files.length) return;
|
|
212
|
+
const normalizedLimit = normalizeLimit(props.limit);
|
|
213
|
+
if (props.multiple && normalizedLimit && files.length > normalizedLimit) {
|
|
214
|
+
props.onExceed?.(files, normalizedLimit);
|
|
215
|
+
emit("error", /* @__PURE__ */ new Error(`Too many files selected, limit=${normalizedLimit}`));
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const { files: valid, issues } = await runFileValidators(files, props.validators ?? [], {
|
|
219
|
+
source,
|
|
220
|
+
multiple: props.multiple
|
|
221
|
+
});
|
|
222
|
+
if (issues.length > 0) {
|
|
223
|
+
emit("error", new FileValidationError(issues, valid));
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (!valid.length) return;
|
|
227
|
+
lastFiles.value = valid;
|
|
228
|
+
const before = await runBeforeUpload(valid);
|
|
229
|
+
if (before !== "ok") {
|
|
230
|
+
emit("error", before.reason);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
let extraData;
|
|
234
|
+
try {
|
|
235
|
+
extraData = props.uploadExtraData?.(valid);
|
|
236
|
+
} catch (error) {
|
|
237
|
+
emit("error", error);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
abort();
|
|
241
|
+
const controller = new AbortController();
|
|
242
|
+
activeController = controller;
|
|
243
|
+
emit("progress", 0);
|
|
244
|
+
try {
|
|
245
|
+
emit("success", props.request ? await props.request(valid, {
|
|
246
|
+
signal: controller.signal,
|
|
247
|
+
extraData
|
|
248
|
+
}) : await uploadViaAction(valid, controller.signal, extraData));
|
|
249
|
+
emit("change", valid);
|
|
250
|
+
emit("progress", 100);
|
|
251
|
+
} catch (error) {
|
|
252
|
+
emit("error", error);
|
|
253
|
+
} finally {
|
|
254
|
+
if (activeController === controller) activeController = null;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function onDragEnter(event) {
|
|
258
|
+
if (hasCustomUi.value) return;
|
|
259
|
+
if (props.disabled) return;
|
|
260
|
+
event.preventDefault();
|
|
261
|
+
overCounter += 1;
|
|
262
|
+
setOver(true);
|
|
263
|
+
}
|
|
264
|
+
function onDragOver(event) {
|
|
265
|
+
if (hasCustomUi.value) return;
|
|
266
|
+
if (props.disabled) return;
|
|
267
|
+
event.preventDefault();
|
|
268
|
+
if (event.dataTransfer) event.dataTransfer.dropEffect = "copy";
|
|
269
|
+
}
|
|
270
|
+
function onDragLeave(event) {
|
|
271
|
+
if (hasCustomUi.value) return;
|
|
272
|
+
if (props.disabled) return;
|
|
273
|
+
event.preventDefault();
|
|
274
|
+
overCounter = Math.max(0, overCounter - 1);
|
|
275
|
+
if (overCounter === 0) setOver(false);
|
|
276
|
+
}
|
|
277
|
+
function onDrop(event) {
|
|
278
|
+
if (hasCustomUi.value) return;
|
|
279
|
+
if (props.disabled) return;
|
|
280
|
+
event.preventDefault();
|
|
281
|
+
overCounter = 0;
|
|
282
|
+
setOver(false);
|
|
283
|
+
handleFiles(event.dataTransfer?.files ? Array.prototype.slice.call(event.dataTransfer.files) : [], "drop");
|
|
284
|
+
}
|
|
285
|
+
async function onInputChange(event) {
|
|
286
|
+
if (props.disabled) return;
|
|
287
|
+
const target = event.target;
|
|
288
|
+
const files = target?.files ? Array.prototype.slice.call(target.files) : [];
|
|
289
|
+
if (target) target.value = "";
|
|
290
|
+
await nextTick();
|
|
291
|
+
await handleFiles(files, "input");
|
|
292
|
+
}
|
|
293
|
+
function onKeydown(event) {
|
|
294
|
+
if (hasCustomUi.value) return;
|
|
295
|
+
if (props.disabled) return;
|
|
296
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
297
|
+
event.preventDefault();
|
|
298
|
+
openDialog();
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function onRootClick() {
|
|
302
|
+
if (hasCustomUi.value) return;
|
|
303
|
+
openDialog();
|
|
304
|
+
}
|
|
305
|
+
function onRootKeydown(event) {
|
|
306
|
+
if (hasCustomUi.value) return;
|
|
307
|
+
onKeydown(event);
|
|
308
|
+
}
|
|
309
|
+
__expose({
|
|
310
|
+
uploadFiles: handleFiles,
|
|
311
|
+
abort,
|
|
312
|
+
openDialog
|
|
313
|
+
});
|
|
314
|
+
return (_ctx, _cache) => {
|
|
315
|
+
return openBlock(), createElementBlock("div", {
|
|
316
|
+
"data-ds-file-upload": "",
|
|
317
|
+
role: hasCustomUi.value ? void 0 : "button",
|
|
318
|
+
tabindex: hasCustomUi.value ? void 0 : tabIndex.value,
|
|
319
|
+
"aria-disabled": hasCustomUi.value ? void 0 : __props.disabled ? "true" : "false",
|
|
320
|
+
class: normalizeClass(hasCustomUi.value ? "inline-block" : [
|
|
321
|
+
"relative w-full rounded-[var(--ds-radius-lg)] border border-dashed border-[var(--brd)] bg-[var(--card)] px-5 py-6 outline-none transition",
|
|
322
|
+
__props.disabled ? "opacity-60 cursor-not-allowed" : "cursor-pointer hover:bg-[var(--muted)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--bg)]",
|
|
323
|
+
isOver.value && !__props.disabled ? "border-[var(--ring)] bg-[var(--muted)]" : ""
|
|
324
|
+
]),
|
|
325
|
+
onClick: onRootClick,
|
|
326
|
+
onKeydown: onRootKeydown,
|
|
327
|
+
onDragenter: onDragEnter,
|
|
328
|
+
onDragover: onDragOver,
|
|
329
|
+
onDragleave: onDragLeave,
|
|
330
|
+
onDrop
|
|
331
|
+
}, [createElementVNode("input", {
|
|
332
|
+
ref_key: "inputRef",
|
|
333
|
+
ref: inputRef,
|
|
334
|
+
"data-ds-file-upload-input": "",
|
|
335
|
+
style: hiddenInputStyle,
|
|
336
|
+
type: "file",
|
|
337
|
+
tabindex: "-1",
|
|
338
|
+
"aria-hidden": "true",
|
|
339
|
+
name: __props.name,
|
|
340
|
+
multiple: __props.multiple,
|
|
341
|
+
disabled: __props.disabled,
|
|
342
|
+
onChange: onInputChange
|
|
343
|
+
}, null, 40, _hoisted_2), hasCustomUi.value ? renderSlot(_ctx.$slots, "default", {
|
|
344
|
+
key: 0,
|
|
345
|
+
openDialog,
|
|
346
|
+
abort,
|
|
347
|
+
disabled: __props.disabled,
|
|
348
|
+
files: lastFiles.value,
|
|
349
|
+
isOver: isOver.value
|
|
350
|
+
}) : (openBlock(), createElementBlock("div", _hoisted_3, [createElementVNode("div", _hoisted_4, [createVNode(GrIcon_default, { class: "h-6 w-6 text-[var(--muted-fg)]" }, {
|
|
351
|
+
default: withCtx(() => [createVNode(unref(arrow_up_default))]),
|
|
352
|
+
_: 1
|
|
353
|
+
})]), createElementVNode("div", _hoisted_5, [
|
|
354
|
+
createElementVNode("div", _hoisted_6, [renderSlot(_ctx.$slots, "label", {}, () => [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.placeholder), 1)])])]),
|
|
355
|
+
_ctx.$slots.tip ? (openBlock(), createElementBlock("div", _hoisted_7, [renderSlot(_ctx.$slots, "tip")])) : (openBlock(), createElementBlock("div", _hoisted_8)),
|
|
356
|
+
__props.showFileList && lastFiles.value.length ? (openBlock(), createElementBlock("ul", _hoisted_9, [(openBlock(true), createElementBlock(Fragment, null, renderList(lastFiles.value, (file) => {
|
|
357
|
+
return openBlock(), createElementBlock("li", {
|
|
358
|
+
key: file.name,
|
|
359
|
+
"data-ds-file-upload-item": "",
|
|
360
|
+
class: "text-[13px]"
|
|
361
|
+
}, [createElementVNode("span", _hoisted_10, toDisplayString(file.name), 1), createElementVNode("span", _hoisted_11, " · " + toDisplayString(Math.ceil(file.size / 1024)) + " KB", 1)]);
|
|
362
|
+
}), 128))])) : createCommentVNode("", true)
|
|
363
|
+
])]))], 42, _hoisted_1);
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
//#endregion
|
|
368
|
+
export { GrFileUpload_default as t };
|
|
369
|
+
|
|
370
|
+
//# sourceMappingURL=GrFileUpload-DVv8yXpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GrFileUpload-DVv8yXpl.js","names":["$slots"],"sources":["../../../../src/components/GrFileUpload/GrFileUpload.vue","../../../../src/components/GrFileUpload/GrFileUpload.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Comment, computed, Fragment, nextTick, ref, Text, useSlots, type VNode } from 'vue'\n\nimport IconArrowUp from '~icons/lucide/arrow-up'\n\nimport GrIcon from '../GrIcon/GrIcon.vue'\nimport type { FileValidator, FileValidatorSource } from '../../fileValidation'\n\nimport { FileValidationError, runFileValidators } from '../../fileValidation'\n\nexport type GrFileUploadExtraDataValue = string | Blob\n\nexport type GrFileUploadExtraData = Record<string, GrFileUploadExtraDataValue | GrFileUploadExtraDataValue[]>\n\nexport type GrFileUploadRequestCtx = {\n signal: AbortSignal\n extraData?: GrFileUploadExtraData\n}\n\nexport type GrFileUploadRequest = (files: File[], ctx: GrFileUploadRequestCtx) => Promise<any>\n\n/**\n * Пропы `GrFileUpload`.\n *\n * Либо `action` (URL для POST multipart/form-data), либо `request` — кастомный\n * загрузчик (например, через axios). Если переданы оба — приоритет у `request`.\n *\n * `placeholder` — надпись в дефолтном UI-варианте (без слота default).\n */\nexport interface GrFileUploadProps {\n action?: string\n request?: GrFileUploadRequest\n name?: string\n multiple?: boolean\n limit?: number\n onExceed?: (files: File[], limit: number) => void\n beforeUpload?: (file: File) => boolean | Promise<unknown>\n validators?: FileValidator[]\n disabled?: boolean\n headers?: Record<string, string>\n withCredentials?: boolean\n showFileList?: boolean\n uploadExtraData?: (files: File[]) => GrFileUploadExtraData | undefined\n /** i18n: надпись-подсказка в дефолтном UI. */\n placeholder?: string\n}\n\nconst props = withDefaults(\n defineProps<GrFileUploadProps>(),\n {\n action: undefined,\n request: undefined,\n name: 'file',\n multiple: false,\n limit: undefined,\n onExceed: undefined,\n beforeUpload: undefined,\n validators: undefined,\n disabled: false,\n headers: undefined,\n withCredentials: false,\n showFileList: false,\n uploadExtraData: undefined,\n placeholder: 'Drag files here or click to select',\n },\n)\n\nconst emit = defineEmits<{\n (e: 'success', payload: any): void\n (e: 'error', error: unknown): void\n (e: 'progress', percent: number): void\n (e: 'change', files: File[]): void\n}>()\n\nconst slots = useSlots()\n\nfunction flattenSlotNodes(nodes: VNode[]): VNode[] {\n const out: VNode[] = []\n\n for (const node of nodes) {\n if (node.type === Fragment && Array.isArray(node.children)) {\n out.push(...flattenSlotNodes(node.children as VNode[]))\n continue\n }\n\n out.push(node)\n }\n\n return out\n}\n\nfunction isWhitespaceTextNode(node: VNode): boolean {\n if (node.type !== Text) return false\n return typeof node.children === 'string' && node.children.trim().length === 0\n}\n\nfunction slotIsTextOnly(nodes: VNode[]): boolean {\n const flat = flattenSlotNodes(nodes)\n const meaningful = flat.filter(node => node.type !== Comment && !isWhitespaceTextNode(node))\n\n if (meaningful.length === 0) return true\n\n for (const node of meaningful) {\n if (node.type !== Text) return false\n }\n\n return true\n}\n\nconst defaultSlotNodes = computed(() => {\n return slots.default ? flattenSlotNodes(slots.default({} as any)) : []\n})\n\nconst hasCustomUi = computed(() => {\n return !!slots.default && !slotIsTextOnly(defaultSlotNodes.value)\n})\n\nconst inputRef = ref<HTMLInputElement | null>(null)\nconst isOver = ref(false)\nlet overCounter = 0\n\nconst lastFiles = ref<File[]>([])\n\nlet activeController: AbortController | null = null\n\nconst tabIndex = computed(() => (props.disabled ? -1 : 0))\n\nconst hiddenInputStyle = {\n position: 'fixed',\n top: '-9999px',\n left: '-9999px',\n width: '1px',\n height: '1px',\n opacity: '0',\n overflow: 'hidden',\n pointerEvents: 'none',\n} as const satisfies Record<string, string>\n\nfunction setOver(next: boolean) {\n if (isOver.value === next) return\n isOver.value = next\n}\n\nfunction openDialog() {\n if (props.disabled) return\n inputRef.value?.click()\n}\n\nfunction abort() {\n activeController?.abort()\n activeController = null\n}\n\nfunction normalizeLimit(limit: number | undefined): number | undefined {\n if (typeof limit !== 'number') return undefined\n if (!Number.isFinite(limit)) return undefined\n if (limit <= 0) return undefined\n return Math.floor(limit)\n}\n\nfunction appendExtraFormData(body: FormData, extraData: GrFileUploadExtraData | undefined) {\n if (!extraData) return\n\n for (const [key, value] of Object.entries(extraData)) {\n if (Array.isArray(value)) {\n for (const entry of value) body.append(key, entry)\n continue\n }\n\n body.append(key, value)\n }\n}\n\nasync function uploadViaAction(files: File[], signal: AbortSignal, extraData: GrFileUploadExtraData | undefined) {\n if (!props.action) throw new Error('GrFileUpload: either `action` or `request` must be provided')\n\n const body = new FormData()\n for (const file of files)\n body.append(props.name, file)\n\n appendExtraFormData(body, extraData)\n\n const response = await fetch(props.action, {\n method: 'POST',\n headers: props.headers,\n body,\n signal,\n credentials: props.withCredentials ? 'include' : 'same-origin',\n })\n\n const contentType = response.headers.get('content-type')\n const payload = contentType?.includes('application/json') ? await response.json() : await response.text()\n\n if (!response.ok) {\n const error = new Error(`Upload failed with status ${response.status}`)\n ;(error as any).payload = payload\n ;(error as any).status = response.status\n throw error\n }\n\n return payload\n}\n\nasync function runBeforeUpload(files: File[]): Promise<'ok' | { aborted: true; reason: unknown }> {\n if (!props.beforeUpload) return 'ok'\n\n for (const file of files) {\n try {\n const result = props.beforeUpload(file)\n\n if (result === false) {\n return { aborted: true, reason: new Error('Upload aborted by beforeUpload') }\n }\n\n if (result && typeof (result as any).then === 'function')\n await result\n } catch (error) {\n return { aborted: true, reason: error }\n }\n }\n\n return 'ok'\n}\n\nasync function handleFiles(files: File[], source: FileValidatorSource = 'input') {\n if (props.disabled) return\n if (!files.length) return\n\n const normalizedLimit = normalizeLimit(props.limit)\n if (props.multiple && normalizedLimit && files.length > normalizedLimit) {\n props.onExceed?.(files, normalizedLimit)\n emit('error', new Error(`Too many files selected, limit=${normalizedLimit}`))\n return\n }\n\n const { files: valid, issues } = await runFileValidators(files, props.validators ?? [], {\n source,\n multiple: props.multiple,\n })\n\n if (issues.length > 0) {\n emit('error', new FileValidationError(issues, valid))\n return\n }\n\n if (!valid.length) return\n\n lastFiles.value = valid\n\n const before = await runBeforeUpload(valid)\n if (before !== 'ok') {\n emit('error', before.reason)\n return\n }\n\n let extraData: GrFileUploadExtraData | undefined\n try {\n extraData = props.uploadExtraData?.(valid)\n } catch (error) {\n emit('error', error)\n return\n }\n\n abort()\n\n const controller = new AbortController()\n activeController = controller\n\n emit('progress', 0)\n\n try {\n const payload = props.request\n ? await props.request(valid, { signal: controller.signal, extraData })\n : await uploadViaAction(valid, controller.signal, extraData)\n\n emit('success', payload)\n emit('change', valid)\n emit('progress', 100)\n } catch (error) {\n emit('error', error)\n } finally {\n if (activeController === controller) activeController = null\n }\n}\n\nfunction onDragEnter(event: DragEvent) {\n if (hasCustomUi.value) return\n if (props.disabled) return\n event.preventDefault()\n overCounter += 1\n setOver(true)\n}\n\nfunction onDragOver(event: DragEvent) {\n if (hasCustomUi.value) return\n if (props.disabled) return\n event.preventDefault()\n if (event.dataTransfer) event.dataTransfer.dropEffect = 'copy'\n}\n\nfunction onDragLeave(event: DragEvent) {\n if (hasCustomUi.value) return\n if (props.disabled) return\n event.preventDefault()\n overCounter = Math.max(0, overCounter - 1)\n if (overCounter === 0) setOver(false)\n}\n\nfunction onDrop(event: DragEvent) {\n if (hasCustomUi.value) return\n if (props.disabled) return\n event.preventDefault()\n overCounter = 0\n setOver(false)\n\n const files = event.dataTransfer?.files ? Array.prototype.slice.call(event.dataTransfer.files) as File[] : []\n void handleFiles(files, 'drop')\n}\n\nasync function onInputChange(event: Event) {\n if (props.disabled) return\n\n const target = event.target as HTMLInputElement | null\n const files = target?.files ? Array.prototype.slice.call(target.files) as File[] : []\n\n if (target) target.value = ''\n\n await nextTick()\n await handleFiles(files, 'input')\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (hasCustomUi.value) return\n if (props.disabled) return\n\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n openDialog()\n }\n}\n\nfunction onRootClick() {\n if (hasCustomUi.value) return\n openDialog()\n}\n\nfunction onRootKeydown(event: KeyboardEvent) {\n if (hasCustomUi.value) return\n onKeydown(event)\n}\n\ndefineExpose({\n uploadFiles: handleFiles,\n abort,\n openDialog,\n})\n</script>\n\n<template>\n <div\n data-ds-file-upload\n :role=\"hasCustomUi ? undefined : 'button'\"\n :tabindex=\"hasCustomUi ? undefined : tabIndex\"\n :aria-disabled=\"hasCustomUi ? undefined : disabled ? 'true' : 'false'\"\n :class=\"\n hasCustomUi\n ? 'inline-block'\n : [\n 'relative w-full rounded-[var(--ds-radius-lg)] border border-dashed border-[var(--brd)] bg-[var(--card)] px-5 py-6 outline-none transition',\n disabled\n ? 'opacity-60 cursor-not-allowed'\n : 'cursor-pointer hover:bg-[var(--muted)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--bg)]',\n isOver && !disabled ? 'border-[var(--ring)] bg-[var(--muted)]' : '',\n ]\n \"\n @click=\"onRootClick\"\n @keydown=\"onRootKeydown\"\n @dragenter=\"onDragEnter\"\n @dragover=\"onDragOver\"\n @dragleave=\"onDragLeave\"\n @drop=\"onDrop\"\n >\n <input\n ref=\"inputRef\"\n data-ds-file-upload-input\n :style=\"hiddenInputStyle\"\n type=\"file\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n :name=\"name\"\n :multiple=\"multiple\"\n :disabled=\"disabled\"\n @change=\"onInputChange\"\n >\n\n <slot\n v-if=\"hasCustomUi\"\n :open-dialog=\"openDialog\"\n :abort=\"abort\"\n :disabled=\"disabled\"\n :files=\"lastFiles\"\n :is-over=\"isOver\"\n />\n\n <div v-else class=\"flex items-start gap-4\">\n <div\n data-ds-file-upload-icon\n class=\"h-12 w-12 shrink-0 rounded-[12px] bg-[var(--muted)] border border-[var(--brd)] flex items-center justify-center\"\n aria-hidden=\"true\"\n >\n <GrIcon class=\"h-6 w-6 text-[var(--muted-fg)]\">\n <IconArrowUp />\n </GrIcon>\n </div>\n\n <div class=\"min-w-0\">\n <div data-ds-file-upload-label class=\"text-[14px] font-700\">\n <slot name=\"label\">\n <slot>\n {{ placeholder }}\n </slot>\n </slot>\n </div>\n\n <div v-if=\"$slots.tip\" data-ds-file-upload-tip class=\"mt-1 text-[13px] text-[var(--muted-fg)]\">\n <slot name=\"tip\" />\n </div>\n <div v-else class=\"mt-1 text-[13px] text-[var(--muted-fg)]\" />\n\n <ul v-if=\"showFileList && lastFiles.length\" data-ds-file-upload-list class=\"mt-3 space-y-1\">\n <li\n v-for=\"file in lastFiles\"\n :key=\"file.name\"\n data-ds-file-upload-item\n class=\"text-[13px]\"\n >\n <span class=\"font-600\">{{ file.name }}</span>\n <span class=\"text-[var(--muted-fg)]\"> · {{ Math.ceil(file.size / 1024) }} KB</span>\n </li>\n </ul>\n </div>\n </div>\n </div>\n</template>","<script setup lang=\"ts\">\nimport { Comment, computed, Fragment, nextTick, ref, Text, useSlots, type VNode } from 'vue'\n\nimport IconArrowUp from '~icons/lucide/arrow-up'\n\nimport GrIcon from '../GrIcon/GrIcon.vue'\nimport type { FileValidator, FileValidatorSource } from '../../fileValidation'\n\nimport { FileValidationError, runFileValidators } from '../../fileValidation'\n\nexport type GrFileUploadExtraDataValue = string | Blob\n\nexport type GrFileUploadExtraData = Record<string, GrFileUploadExtraDataValue | GrFileUploadExtraDataValue[]>\n\nexport type GrFileUploadRequestCtx = {\n signal: AbortSignal\n extraData?: GrFileUploadExtraData\n}\n\nexport type GrFileUploadRequest = (files: File[], ctx: GrFileUploadRequestCtx) => Promise<any>\n\n/**\n * Пропы `GrFileUpload`.\n *\n * Либо `action` (URL для POST multipart/form-data), либо `request` — кастомный\n * загрузчик (например, через axios). Если переданы оба — приоритет у `request`.\n *\n * `placeholder` — надпись в дефолтном UI-варианте (без слота default).\n */\nexport interface GrFileUploadProps {\n action?: string\n request?: GrFileUploadRequest\n name?: string\n multiple?: boolean\n limit?: number\n onExceed?: (files: File[], limit: number) => void\n beforeUpload?: (file: File) => boolean | Promise<unknown>\n validators?: FileValidator[]\n disabled?: boolean\n headers?: Record<string, string>\n withCredentials?: boolean\n showFileList?: boolean\n uploadExtraData?: (files: File[]) => GrFileUploadExtraData | undefined\n /** i18n: надпись-подсказка в дефолтном UI. */\n placeholder?: string\n}\n\nconst props = withDefaults(\n defineProps<GrFileUploadProps>(),\n {\n action: undefined,\n request: undefined,\n name: 'file',\n multiple: false,\n limit: undefined,\n onExceed: undefined,\n beforeUpload: undefined,\n validators: undefined,\n disabled: false,\n headers: undefined,\n withCredentials: false,\n showFileList: false,\n uploadExtraData: undefined,\n placeholder: 'Drag files here or click to select',\n },\n)\n\nconst emit = defineEmits<{\n (e: 'success', payload: any): void\n (e: 'error', error: unknown): void\n (e: 'progress', percent: number): void\n (e: 'change', files: File[]): void\n}>()\n\nconst slots = useSlots()\n\nfunction flattenSlotNodes(nodes: VNode[]): VNode[] {\n const out: VNode[] = []\n\n for (const node of nodes) {\n if (node.type === Fragment && Array.isArray(node.children)) {\n out.push(...flattenSlotNodes(node.children as VNode[]))\n continue\n }\n\n out.push(node)\n }\n\n return out\n}\n\nfunction isWhitespaceTextNode(node: VNode): boolean {\n if (node.type !== Text) return false\n return typeof node.children === 'string' && node.children.trim().length === 0\n}\n\nfunction slotIsTextOnly(nodes: VNode[]): boolean {\n const flat = flattenSlotNodes(nodes)\n const meaningful = flat.filter(node => node.type !== Comment && !isWhitespaceTextNode(node))\n\n if (meaningful.length === 0) return true\n\n for (const node of meaningful) {\n if (node.type !== Text) return false\n }\n\n return true\n}\n\nconst defaultSlotNodes = computed(() => {\n return slots.default ? flattenSlotNodes(slots.default({} as any)) : []\n})\n\nconst hasCustomUi = computed(() => {\n return !!slots.default && !slotIsTextOnly(defaultSlotNodes.value)\n})\n\nconst inputRef = ref<HTMLInputElement | null>(null)\nconst isOver = ref(false)\nlet overCounter = 0\n\nconst lastFiles = ref<File[]>([])\n\nlet activeController: AbortController | null = null\n\nconst tabIndex = computed(() => (props.disabled ? -1 : 0))\n\nconst hiddenInputStyle = {\n position: 'fixed',\n top: '-9999px',\n left: '-9999px',\n width: '1px',\n height: '1px',\n opacity: '0',\n overflow: 'hidden',\n pointerEvents: 'none',\n} as const satisfies Record<string, string>\n\nfunction setOver(next: boolean) {\n if (isOver.value === next) return\n isOver.value = next\n}\n\nfunction openDialog() {\n if (props.disabled) return\n inputRef.value?.click()\n}\n\nfunction abort() {\n activeController?.abort()\n activeController = null\n}\n\nfunction normalizeLimit(limit: number | undefined): number | undefined {\n if (typeof limit !== 'number') return undefined\n if (!Number.isFinite(limit)) return undefined\n if (limit <= 0) return undefined\n return Math.floor(limit)\n}\n\nfunction appendExtraFormData(body: FormData, extraData: GrFileUploadExtraData | undefined) {\n if (!extraData) return\n\n for (const [key, value] of Object.entries(extraData)) {\n if (Array.isArray(value)) {\n for (const entry of value) body.append(key, entry)\n continue\n }\n\n body.append(key, value)\n }\n}\n\nasync function uploadViaAction(files: File[], signal: AbortSignal, extraData: GrFileUploadExtraData | undefined) {\n if (!props.action) throw new Error('GrFileUpload: either `action` or `request` must be provided')\n\n const body = new FormData()\n for (const file of files)\n body.append(props.name, file)\n\n appendExtraFormData(body, extraData)\n\n const response = await fetch(props.action, {\n method: 'POST',\n headers: props.headers,\n body,\n signal,\n credentials: props.withCredentials ? 'include' : 'same-origin',\n })\n\n const contentType = response.headers.get('content-type')\n const payload = contentType?.includes('application/json') ? await response.json() : await response.text()\n\n if (!response.ok) {\n const error = new Error(`Upload failed with status ${response.status}`)\n ;(error as any).payload = payload\n ;(error as any).status = response.status\n throw error\n }\n\n return payload\n}\n\nasync function runBeforeUpload(files: File[]): Promise<'ok' | { aborted: true; reason: unknown }> {\n if (!props.beforeUpload) return 'ok'\n\n for (const file of files) {\n try {\n const result = props.beforeUpload(file)\n\n if (result === false) {\n return { aborted: true, reason: new Error('Upload aborted by beforeUpload') }\n }\n\n if (result && typeof (result as any).then === 'function')\n await result\n } catch (error) {\n return { aborted: true, reason: error }\n }\n }\n\n return 'ok'\n}\n\nasync function handleFiles(files: File[], source: FileValidatorSource = 'input') {\n if (props.disabled) return\n if (!files.length) return\n\n const normalizedLimit = normalizeLimit(props.limit)\n if (props.multiple && normalizedLimit && files.length > normalizedLimit) {\n props.onExceed?.(files, normalizedLimit)\n emit('error', new Error(`Too many files selected, limit=${normalizedLimit}`))\n return\n }\n\n const { files: valid, issues } = await runFileValidators(files, props.validators ?? [], {\n source,\n multiple: props.multiple,\n })\n\n if (issues.length > 0) {\n emit('error', new FileValidationError(issues, valid))\n return\n }\n\n if (!valid.length) return\n\n lastFiles.value = valid\n\n const before = await runBeforeUpload(valid)\n if (before !== 'ok') {\n emit('error', before.reason)\n return\n }\n\n let extraData: GrFileUploadExtraData | undefined\n try {\n extraData = props.uploadExtraData?.(valid)\n } catch (error) {\n emit('error', error)\n return\n }\n\n abort()\n\n const controller = new AbortController()\n activeController = controller\n\n emit('progress', 0)\n\n try {\n const payload = props.request\n ? await props.request(valid, { signal: controller.signal, extraData })\n : await uploadViaAction(valid, controller.signal, extraData)\n\n emit('success', payload)\n emit('change', valid)\n emit('progress', 100)\n } catch (error) {\n emit('error', error)\n } finally {\n if (activeController === controller) activeController = null\n }\n}\n\nfunction onDragEnter(event: DragEvent) {\n if (hasCustomUi.value) return\n if (props.disabled) return\n event.preventDefault()\n overCounter += 1\n setOver(true)\n}\n\nfunction onDragOver(event: DragEvent) {\n if (hasCustomUi.value) return\n if (props.disabled) return\n event.preventDefault()\n if (event.dataTransfer) event.dataTransfer.dropEffect = 'copy'\n}\n\nfunction onDragLeave(event: DragEvent) {\n if (hasCustomUi.value) return\n if (props.disabled) return\n event.preventDefault()\n overCounter = Math.max(0, overCounter - 1)\n if (overCounter === 0) setOver(false)\n}\n\nfunction onDrop(event: DragEvent) {\n if (hasCustomUi.value) return\n if (props.disabled) return\n event.preventDefault()\n overCounter = 0\n setOver(false)\n\n const files = event.dataTransfer?.files ? Array.prototype.slice.call(event.dataTransfer.files) as File[] : []\n void handleFiles(files, 'drop')\n}\n\nasync function onInputChange(event: Event) {\n if (props.disabled) return\n\n const target = event.target as HTMLInputElement | null\n const files = target?.files ? Array.prototype.slice.call(target.files) as File[] : []\n\n if (target) target.value = ''\n\n await nextTick()\n await handleFiles(files, 'input')\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (hasCustomUi.value) return\n if (props.disabled) return\n\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n openDialog()\n }\n}\n\nfunction onRootClick() {\n if (hasCustomUi.value) return\n openDialog()\n}\n\nfunction onRootKeydown(event: KeyboardEvent) {\n if (hasCustomUi.value) return\n onKeydown(event)\n}\n\ndefineExpose({\n uploadFiles: handleFiles,\n abort,\n openDialog,\n})\n</script>\n\n<template>\n <div\n data-ds-file-upload\n :role=\"hasCustomUi ? undefined : 'button'\"\n :tabindex=\"hasCustomUi ? undefined : tabIndex\"\n :aria-disabled=\"hasCustomUi ? undefined : disabled ? 'true' : 'false'\"\n :class=\"\n hasCustomUi\n ? 'inline-block'\n : [\n 'relative w-full rounded-[var(--ds-radius-lg)] border border-dashed border-[var(--brd)] bg-[var(--card)] px-5 py-6 outline-none transition',\n disabled\n ? 'opacity-60 cursor-not-allowed'\n : 'cursor-pointer hover:bg-[var(--muted)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--bg)]',\n isOver && !disabled ? 'border-[var(--ring)] bg-[var(--muted)]' : '',\n ]\n \"\n @click=\"onRootClick\"\n @keydown=\"onRootKeydown\"\n @dragenter=\"onDragEnter\"\n @dragover=\"onDragOver\"\n @dragleave=\"onDragLeave\"\n @drop=\"onDrop\"\n >\n <input\n ref=\"inputRef\"\n data-ds-file-upload-input\n :style=\"hiddenInputStyle\"\n type=\"file\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n :name=\"name\"\n :multiple=\"multiple\"\n :disabled=\"disabled\"\n @change=\"onInputChange\"\n >\n\n <slot\n v-if=\"hasCustomUi\"\n :open-dialog=\"openDialog\"\n :abort=\"abort\"\n :disabled=\"disabled\"\n :files=\"lastFiles\"\n :is-over=\"isOver\"\n />\n\n <div v-else class=\"flex items-start gap-4\">\n <div\n data-ds-file-upload-icon\n class=\"h-12 w-12 shrink-0 rounded-[12px] bg-[var(--muted)] border border-[var(--brd)] flex items-center justify-center\"\n aria-hidden=\"true\"\n >\n <GrIcon class=\"h-6 w-6 text-[var(--muted-fg)]\">\n <IconArrowUp />\n </GrIcon>\n </div>\n\n <div class=\"min-w-0\">\n <div data-ds-file-upload-label class=\"text-[14px] font-700\">\n <slot name=\"label\">\n <slot>\n {{ placeholder }}\n </slot>\n </slot>\n </div>\n\n <div v-if=\"$slots.tip\" data-ds-file-upload-tip class=\"mt-1 text-[13px] text-[var(--muted-fg)]\">\n <slot name=\"tip\" />\n </div>\n <div v-else class=\"mt-1 text-[13px] text-[var(--muted-fg)]\" />\n\n <ul v-if=\"showFileList && lastFiles.length\" data-ds-file-upload-list class=\"mt-3 space-y-1\">\n <li\n v-for=\"file in lastFiles\"\n :key=\"file.name\"\n data-ds-file-upload-item\n class=\"text-[13px]\"\n >\n <span class=\"font-600\">{{ file.name }}</span>\n <span class=\"text-[var(--muted-fg)]\"> · {{ Math.ceil(file.size / 1024) }} KB</span>\n </li>\n </ul>\n </div>\n </div>\n </div>\n</template>"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CA,MAAM,QAAQ;EAoBd,MAAM,OAAO;EAOb,MAAM,QAAQ,UAAS;EAEvB,SAAS,iBAAiB,OAAyB;GACjD,MAAM,MAAe,EAAC;AAEtB,QAAK,MA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,mBAUK,MAVL,YAUK,EAAA,UAAA,KAAA,EATH,mBAQK,UAAA,MAAA,WAPY,UAAA,QAAR,SAAI;yBADb,mBAQK,MAAA;MANF,KAAK,KAAK;MACX,4BAAA;MACA,OAAM;SAEN,mBAA6C,QAA7C,aAA6C,gBAAnB,KAAK,KAAI,EAAA,EAAA,EACnC,mBAAmF,QAAnF,aAAqC,QAAG,gBAAG,KAAK,KAAK,KAAK,OAAI,KAAA,CAAA,GAAW,OAAG,EAAA,CAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as
|
|
4
|
-
export {
|
|
1
|
+
import { a as allowedExtensionsValidator, c as normalizeFiles, i as allowedMimeTypesValidator, l as runFileValidators, n as maxSizeMbValidator, o as acceptValidator, r as maxFileSizeBytesValidator, s as matchAccept, t as maxTotalSizeBytesValidator, u as FileValidationError } from "../../chunks/fileValidation-CgjTGoUx.js";
|
|
2
|
+
import { t as GrFileUpload_default } from "./chunks/GrFileUpload-DVv8yXpl.js";
|
|
3
|
+
import { t as grFileUploadConfig } from "../../chunks/config-BzQ4S4Hb.js";
|
|
4
|
+
export { FileValidationError, GrFileUpload_default as GrFileUpload, GrFileUpload_default as default, acceptValidator, allowedExtensionsValidator, allowedMimeTypesValidator, grFileUploadConfig, matchAccept, maxFileSizeBytesValidator, maxSizeMbValidator, maxTotalSizeBytesValidator, normalizeFiles, runFileValidators };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createCommentVNode, createElementBlock, defineComponent, normalizeClass, openBlock, renderSlot, toDisplayString } from "vue";
|
|
2
|
+
//#region src/components/GrFormField/GrFormField.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var _hoisted_1 = { class: "flex flex-col gap-2" };
|
|
4
|
+
var _hoisted_2 = ["for"];
|
|
5
|
+
var _hoisted_3 = {
|
|
6
|
+
key: 1,
|
|
7
|
+
class: "text-sm text-[var(--ds-danger)]"
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/components/GrFormField/GrFormField.vue
|
|
11
|
+
var GrFormField_default = /* @__PURE__ */ defineComponent({
|
|
12
|
+
__name: "GrFormField",
|
|
13
|
+
props: {
|
|
14
|
+
label: { default: void 0 },
|
|
15
|
+
forId: { default: void 0 },
|
|
16
|
+
error: { default: void 0 },
|
|
17
|
+
labelClass: { default: void 0 }
|
|
18
|
+
},
|
|
19
|
+
setup(__props) {
|
|
20
|
+
const props = __props;
|
|
21
|
+
return (_ctx, _cache) => {
|
|
22
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
23
|
+
props.label ? (openBlock(), createElementBlock("label", {
|
|
24
|
+
key: 0,
|
|
25
|
+
for: props.forId,
|
|
26
|
+
class: normalizeClass(["text-sm text-[var(--muted-fg)]", props.labelClass])
|
|
27
|
+
}, toDisplayString(props.label), 11, _hoisted_2)) : createCommentVNode("", true),
|
|
28
|
+
renderSlot(_ctx.$slots, "default"),
|
|
29
|
+
props.error ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(props.error), 1)) : createCommentVNode("", true)
|
|
30
|
+
]);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
//#endregion
|
|
35
|
+
export { GrFormField_default as t };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=GrFormField-BzezYcS8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GrFormField-BzezYcS8.js","names":[],"sources":["../../../../src/components/GrFormField/GrFormField.vue","../../../../src/components/GrFormField/GrFormField.vue"],"sourcesContent":["<script setup lang=\"ts\">\ntype LabelClass = string | string[] | Record<string, boolean>\n\nconst props = withDefaults(\n defineProps<{\n label?: string\n forId?: string\n error?: string\n labelClass?: LabelClass\n }>(),\n {\n label: undefined,\n forId: undefined,\n error: undefined,\n labelClass: undefined,\n },\n)\n</script>\n\n<template>\n <div class=\"flex flex-col gap-2\">\n <label\n v-if=\"props.label\"\n :for=\"props.forId\"\n class=\"text-sm text-[var(--muted-fg)]\"\n :class=\"props.labelClass\"\n >\n {{ props.label }}\n </label>\n <slot />\n <div v-if=\"props.error\" class=\"text-sm text-[var(--ds-danger)]\">\n {{ props.error }}\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\ntype LabelClass = string | string[] | Record<string, boolean>\n\nconst props = withDefaults(\n defineProps<{\n label?: string\n forId?: string\n error?: string\n labelClass?: LabelClass\n }>(),\n {\n label: undefined,\n forId: undefined,\n error: undefined,\n labelClass: undefined,\n },\n)\n</script>\n\n<template>\n <div class=\"flex flex-col gap-2\">\n <label\n v-if=\"props.label\"\n :for=\"props.forId\"\n class=\"text-sm text-[var(--muted-fg)]\"\n :class=\"props.labelClass\"\n >\n {{ props.label }}\n </label>\n <slot />\n <div v-if=\"props.error\" class=\"text-sm text-[var(--ds-danger)]\">\n {{ props.error }}\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;EAGA,MAAM,QAAQ;;uBAiBZ,mBAaM,OAbN,YAaM;IAXI,MAAM,SAAA,WAAA,EADd,mBAOQ,SAAA;;KALL,KAAK,MAAM;KACZ,OAAK,eAAA,CAAC,kCACE,MAAM,WAAU,CAAA;uBAErB,MAAM,MAAK,EAAA,IAAA,WAAA,IAAA,mBAAA,IAAA,KAAA;IAEhB,WAAQ,KAAA,QAAA,UAAA;IACG,MAAM,SAAA,WAAA,EAAjB,mBAEM,OAFN,YAEM,gBADD,MAAM,MAAK,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { t } from "../../chunks/config-
|
|
3
|
-
export {
|
|
1
|
+
import { t as GrFormField_default } from "./chunks/GrFormField-BzezYcS8.js";
|
|
2
|
+
import { t as grFormFieldConfig } from "../../chunks/config-BRU5PR8_.js";
|
|
3
|
+
export { GrFormField_default as GrFormField, GrFormField_default as default, grFormFieldConfig };
|