@feugene/granularity 0.4.0 → 0.4.2
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-K6zZTzBi.js +4 -0
- package/dist/chunks/adapter-K6zZTzBi.js.map +1 -0
- package/dist/chunks/arrow-up-DNXrMoAI.js +23 -0
- package/dist/chunks/arrow-up-DNXrMoAI.js.map +1 -0
- package/dist/chunks/classTokens-BPeBXNzu.js +6 -0
- package/dist/chunks/classTokens-BPeBXNzu.js.map +1 -0
- package/dist/chunks/config-1I95Zy4V.js +14 -0
- package/dist/chunks/config-1I95Zy4V.js.map +1 -0
- package/dist/chunks/config-2wgwWaAB.js +8 -0
- package/dist/chunks/config-2wgwWaAB.js.map +1 -0
- package/dist/chunks/config-BA0BWYzs.js +8 -0
- package/dist/chunks/config-BA0BWYzs.js.map +1 -0
- package/dist/chunks/config-BCPyma1I.js +8 -0
- package/dist/chunks/config-BCPyma1I.js.map +1 -0
- package/dist/chunks/config-BDlh6iNz.js +24 -0
- package/dist/chunks/config-BDlh6iNz.js.map +1 -0
- package/dist/chunks/config-BKRmlivc.js +8 -0
- package/dist/chunks/config-BKRmlivc.js.map +1 -0
- package/dist/chunks/config-BN-B2K4r.js +17 -0
- package/dist/chunks/config-BN-B2K4r.js.map +1 -0
- package/dist/chunks/config-BNOf_qjD.js +40 -0
- package/dist/chunks/config-BNOf_qjD.js.map +1 -0
- package/dist/chunks/config-BaMO9dQh.js +20 -0
- package/dist/chunks/config-BaMO9dQh.js.map +1 -0
- package/dist/chunks/config-Bv2G0OU6.js +8 -0
- package/dist/chunks/config-Bv2G0OU6.js.map +1 -0
- package/dist/chunks/config-BvuQUBtZ.js +21 -0
- package/dist/chunks/config-BvuQUBtZ.js.map +1 -0
- package/dist/chunks/config-BzZGpWsj.js +9 -0
- package/dist/chunks/config-BzZGpWsj.js.map +1 -0
- package/dist/chunks/config-C0j836dC.js +8 -0
- package/dist/chunks/config-C0j836dC.js.map +1 -0
- package/dist/chunks/config-C2iI7_QX.js +9 -0
- package/dist/chunks/config-C2iI7_QX.js.map +1 -0
- package/dist/chunks/config-C4AlNm912.js +13 -0
- package/dist/chunks/config-C4AlNm912.js.map +1 -0
- package/dist/chunks/config-C5SJXHQ4.js +9 -0
- package/dist/chunks/config-C5SJXHQ4.js.map +1 -0
- package/dist/chunks/config-C6SBJxcH.js +8 -0
- package/dist/chunks/config-C6SBJxcH.js.map +1 -0
- package/dist/chunks/config-CByfsV-z2.js +9 -0
- package/dist/chunks/config-CByfsV-z2.js.map +1 -0
- package/dist/chunks/config-CM7nbATU2.js +78 -0
- package/dist/chunks/config-CM7nbATU2.js.map +1 -0
- package/dist/chunks/config-CMZE2fu0.js +9 -0
- package/dist/chunks/config-CMZE2fu0.js.map +1 -0
- package/dist/chunks/config-CU_CBd0k.js +22 -0
- package/dist/chunks/config-CU_CBd0k.js.map +1 -0
- package/dist/chunks/config-CUgvsjZx.js +171 -0
- package/dist/chunks/config-CUgvsjZx.js.map +1 -0
- package/dist/chunks/config-CWvHiaqr2.js +23 -0
- package/dist/chunks/config-CWvHiaqr2.js.map +1 -0
- package/dist/chunks/config-Cf0J6wCX.js +58 -0
- package/dist/chunks/config-Cf0J6wCX.js.map +1 -0
- package/dist/chunks/config-CgAY2WP9.js +9 -0
- package/dist/chunks/config-CgAY2WP9.js.map +1 -0
- package/dist/chunks/config-Cgc-D1K4.js +9 -0
- package/dist/chunks/config-Cgc-D1K4.js.map +1 -0
- package/dist/chunks/config-D19pyP4D.js +35 -0
- package/dist/chunks/config-D19pyP4D.js.map +1 -0
- package/dist/chunks/config-DCQO6H6h.js +11 -0
- package/dist/chunks/config-DCQO6H6h.js.map +1 -0
- package/dist/chunks/config-DEv4m-ZP.js +58 -0
- package/dist/chunks/config-DEv4m-ZP.js.map +1 -0
- package/dist/chunks/config-DFRYOcrP.js +9 -0
- package/dist/chunks/config-DFRYOcrP.js.map +1 -0
- package/dist/chunks/config-DTpwUHgF.js +9 -0
- package/dist/chunks/config-DTpwUHgF.js.map +1 -0
- package/dist/chunks/config-DW_RqmUp.js +8 -0
- package/dist/chunks/config-DW_RqmUp.js.map +1 -0
- package/dist/chunks/config-Da90XGsi.js +38 -0
- package/dist/chunks/config-Da90XGsi.js.map +1 -0
- package/dist/chunks/config-DgRJlF00.js +53 -0
- package/dist/chunks/config-DgRJlF00.js.map +1 -0
- package/dist/chunks/config-Dkq0HeLe.js +9 -0
- package/dist/chunks/config-Dkq0HeLe.js.map +1 -0
- package/dist/chunks/config-DmI1IQvI2.js +8 -0
- package/dist/chunks/config-DmI1IQvI2.js.map +1 -0
- package/dist/chunks/config-Dnu4VuO0.js +8 -0
- package/dist/chunks/config-Dnu4VuO0.js.map +1 -0
- package/dist/chunks/config-DxqpV-KM.js +45 -0
- package/dist/chunks/config-DxqpV-KM.js.map +1 -0
- package/dist/chunks/config-TyzU6gLf.js +8 -0
- package/dist/chunks/config-TyzU6gLf.js.map +1 -0
- package/dist/chunks/config-XwI6t8cn.js +39 -0
- package/dist/chunks/config-XwI6t8cn.js.map +1 -0
- package/dist/chunks/config-bpQYM5O-.js +44 -0
- package/dist/chunks/config-bpQYM5O-.js.map +1 -0
- package/dist/chunks/config-etXh7Bsr2.js +9 -0
- package/dist/chunks/config-etXh7Bsr2.js.map +1 -0
- package/dist/chunks/config-fCcRwjIB.js +13 -0
- package/dist/chunks/config-fCcRwjIB.js.map +1 -0
- package/dist/chunks/config-nfOMJXVs.js +9 -0
- package/dist/chunks/config-nfOMJXVs.js.map +1 -0
- package/dist/chunks/config-qJXIIY1E.js +8 -0
- package/dist/chunks/config-qJXIIY1E.js.map +1 -0
- package/dist/chunks/config-r6hzn2Bn2.js +9 -0
- package/dist/chunks/config-r6hzn2Bn2.js.map +1 -0
- package/dist/chunks/config-rQlbnEKn.js +8 -0
- package/dist/chunks/config-rQlbnEKn.js.map +1 -0
- package/dist/chunks/dialogShared-BtXUk6Zc.js +32 -0
- package/dist/chunks/dialogShared-BtXUk6Zc.js.map +1 -0
- package/dist/chunks/en-BeJa78lP.js +48 -0
- package/dist/chunks/en-BeJa78lP.js.map +1 -0
- package/dist/chunks/es-BPqm7rLm.js +20 -0
- package/dist/chunks/es-BPqm7rLm.js.map +1 -0
- package/dist/chunks/es-axYOwwWD.js +48 -0
- package/dist/chunks/es-axYOwwWD.js.map +1 -0
- package/dist/chunks/fileValidation-CwJA8Vmn.js +219 -0
- package/dist/chunks/fileValidation-CwJA8Vmn.js.map +1 -0
- package/dist/chunks/{grBadgeStyles-Bu4H8bFc.js → grBadgeStyles-pqqbVgLk.js} +18 -13
- package/dist/chunks/grBadgeStyles-pqqbVgLk.js.map +1 -0
- package/dist/chunks/{grButtonStyles-C5k0bN2e.js → grButtonStyles-BxZW2x0-.js} +60 -52
- package/dist/chunks/grButtonStyles-BxZW2x0-.js.map +1 -0
- package/dist/chunks/{grDropdownStyles-149X1NeB.js → grDropdownStyles-DMp7RrI9.js} +10 -9
- package/dist/chunks/grDropdownStyles-DMp7RrI9.js.map +1 -0
- package/dist/chunks/grLoadingStyles-CrxZHFL0.js +17 -0
- package/dist/chunks/grLoadingStyles-CrxZHFL0.js.map +1 -0
- package/dist/chunks/{grModalStyles-Dmd4havY.js → grModalStyles-Dv2NXBKi.js} +20 -11
- package/dist/chunks/grModalStyles-Dv2NXBKi.js.map +1 -0
- package/dist/chunks/grSelectStyles-B7doeAQp.js +50 -0
- package/dist/chunks/grSelectStyles-B7doeAQp.js.map +1 -0
- package/dist/chunks/granularityI18n-GCqUz_lo.js +26 -0
- package/dist/chunks/granularityI18n-GCqUz_lo.js.map +1 -0
- package/dist/chunks/info-C0bHmdZq.js +26 -0
- package/dist/chunks/info-C0bHmdZq.js.map +1 -0
- package/dist/chunks/loader-circle-B2rWDk5u.js +23 -0
- package/dist/chunks/loader-circle-B2rWDk5u.js.map +1 -0
- package/dist/chunks/ru-Dqh-2C00.js +48 -0
- package/dist/chunks/ru-Dqh-2C00.js.map +1 -0
- package/dist/chunks/safelist-BF822K15.js +13 -0
- package/dist/chunks/safelist-BF822K15.js.map +1 -0
- package/dist/chunks/safelist-BY7z8fOl.js +24 -0
- package/dist/chunks/safelist-BY7z8fOl.js.map +1 -0
- package/dist/chunks/{shared-BqUqjuxn.js → shared-Cu5QkNmt.js} +149 -111
- package/dist/chunks/shared-Cu5QkNmt.js.map +1 -0
- package/dist/chunks/transition-mJ3PZCHH.js +1692 -0
- package/dist/chunks/transition-mJ3PZCHH.js.map +1 -0
- package/dist/chunks/x-Pa6C2hwi.js +23 -0
- package/dist/chunks/x-Pa6C2hwi.js.map +1 -0
- package/dist/chunks/x-circle-DQSlBLmX.js +67 -0
- package/dist/chunks/x-circle-DQSlBLmX.js.map +1 -0
- package/dist/components/GrAlert/chunks/GrAlert-BjerGcU8.js +146 -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 +41 -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 +32 -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 +33 -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 +31 -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 +83 -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 +21 -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 +11 -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 +134 -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 +205 -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 +131 -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 +179 -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 +221 -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 +156 -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-BkACCXdp.js +151 -0
- package/dist/components/GrDropdown/chunks/GrDropdown-BkACCXdp.js.map +1 -0
- package/dist/components/GrDropdown/index.js +3 -3
- package/dist/components/GrDropdownMenu/chunks/GrDropdownMenu-BEenXrJw.js +309 -0
- package/dist/components/GrDropdownMenu/chunks/GrDropdownMenu-BEenXrJw.js.map +1 -0
- package/dist/components/GrDropdownMenu/index.js +3 -3
- package/dist/components/GrEmptyState/chunks/GrEmptyState-BLbMJFW-.js +62 -0
- package/dist/components/GrEmptyState/chunks/GrEmptyState-BLbMJFW-.js.map +1 -0
- package/dist/components/GrEmptyState/index.js +3 -3
- package/dist/components/GrFileUpload/chunks/GrFileUpload-u01j9S0t.js +368 -0
- package/dist/components/GrFileUpload/chunks/GrFileUpload-u01j9S0t.js.map +1 -0
- package/dist/components/GrFileUpload/index.js +4 -4
- package/dist/components/GrFormField/chunks/GrFormField-C6PfAs4u.js +35 -0
- package/dist/components/GrFormField/chunks/GrFormField-C6PfAs4u.js.map +1 -0
- package/dist/components/GrFormField/index.js +3 -3
- package/dist/components/GrFormFile/chunks/GrFormFile-DdM8Bc2B.js +313 -0
- package/dist/components/GrFormFile/chunks/GrFormFile-DdM8Bc2B.js.map +1 -0
- package/dist/components/GrFormFile/index.js +3 -3
- package/dist/components/GrFormSection/chunks/GrFormSection-5djEaQZQ.js +35 -0
- package/dist/components/GrFormSection/chunks/GrFormSection-5djEaQZQ.js.map +1 -0
- package/dist/components/GrFormSection/index.js +3 -3
- package/dist/components/GrIcon/chunks/GrIcon-BV7RBU_0.js +32 -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-CjSnohW7.js +397 -0
- package/dist/components/GrImageViewer/chunks/GrImageViewer-CjSnohW7.js.map +1 -0
- package/dist/components/GrImageViewer/index.js +3 -3
- package/dist/components/GrInput/chunks/GrInput-ghxaTf6d.js +211 -0
- package/dist/components/GrInput/chunks/GrInput-ghxaTf6d.js.map +1 -0
- package/dist/components/GrInput/index.js +3 -3
- package/dist/components/GrInputTag/chunks/GrInputTag-B0x4U0Yk.js +257 -0
- package/dist/components/GrInputTag/chunks/GrInputTag-B0x4U0Yk.js.map +1 -0
- package/dist/components/GrInputTag/index.js +3 -3
- package/dist/components/GrLink/chunks/GrLink-C7-Y1u88.js +80 -0
- package/dist/components/GrLink/chunks/GrLink-C7-Y1u88.js.map +1 -0
- package/dist/components/GrLink/index.js +3 -3
- package/dist/components/GrList/chunks/GrList--Ib4zLNw.js +77 -0
- package/dist/components/GrList/chunks/GrList--Ib4zLNw.js.map +1 -0
- package/dist/components/GrList/index.js +3 -3
- package/dist/components/GrLoading/chunks/GrLoading-C3QZKwE-.js +69 -0
- package/dist/components/GrLoading/chunks/GrLoading-C3QZKwE-.js.map +1 -0
- package/dist/components/GrLoading/index.js +3 -3
- package/dist/components/GrModal/chunks/GrModal-gvfvlp7k.js +168 -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-nIyuiVj1.js +75 -0
- package/dist/components/GrNavbar/chunks/GrNavbar-nIyuiVj1.js.map +1 -0
- package/dist/components/GrNavbar/index.js +3 -3
- package/dist/components/GrNumberInput/chunks/GrNumberInput-B0mPLjdv.js +397 -0
- package/dist/components/GrNumberInput/chunks/GrNumberInput-B0mPLjdv.js.map +1 -0
- package/dist/components/GrNumberInput/index.js +3 -3
- package/dist/components/GrPagination/chunks/GrPagination-BSTO6flk.js +114 -0
- package/dist/components/GrPagination/chunks/GrPagination-BSTO6flk.js.map +1 -0
- package/dist/components/GrPagination/index.js +3 -3
- package/dist/components/GrProgressBar/chunks/GrProgressBar-MvMnzsJl.js +39 -0
- package/dist/components/GrProgressBar/chunks/GrProgressBar-MvMnzsJl.js.map +1 -0
- package/dist/components/GrProgressBar/index.js +3 -3
- package/dist/components/GrPromptDialog/chunks/GrPromptDialog-DKhbN6ji.js +190 -0
- package/dist/components/GrPromptDialog/chunks/GrPromptDialog-DKhbN6ji.js.map +1 -0
- package/dist/components/GrPromptDialog/index.js +3 -3
- package/dist/components/GrRadio/chunks/GrRadio-BxBs3WHq.js +184 -0
- package/dist/components/GrRadio/chunks/GrRadio-BxBs3WHq.js.map +1 -0
- package/dist/components/GrRadio/index.js +3 -3
- package/dist/components/GrRadioGroup/chunks/GrRadioGroup-CEAfJQ6A.js +80 -0
- package/dist/components/GrRadioGroup/chunks/GrRadioGroup-CEAfJQ6A.js.map +1 -0
- package/dist/components/GrRadioGroup/index.js +3 -3
- package/dist/components/GrSegmented/chunks/GrSegmented-Bwn2qOY4.js +323 -0
- package/dist/components/GrSegmented/chunks/GrSegmented-Bwn2qOY4.js.map +1 -0
- package/dist/components/GrSegmented/index.js +3 -3
- package/dist/components/GrSelect/chunks/GrSelect-9wRWAu2R.js +443 -0
- package/dist/components/GrSelect/chunks/GrSelect-9wRWAu2R.js.map +1 -0
- package/dist/components/GrSelect/index.js +3 -3
- package/dist/components/GrSidebar/chunks/GrSidebar-CSZ3RpFB.js +44 -0
- package/dist/components/GrSidebar/chunks/GrSidebar-CSZ3RpFB.js.map +1 -0
- package/dist/components/GrSidebar/index.js +3 -3
- package/dist/components/GrSkeleton/chunks/GrSkeleton-DKXkqWDa.js +33 -0
- package/dist/components/GrSkeleton/chunks/GrSkeleton-DKXkqWDa.js.map +1 -0
- package/dist/components/GrSkeleton/index.js +3 -3
- package/dist/components/GrSwitch/chunks/GrSwitch-CdBxwV3k.js +79 -0
- package/dist/components/GrSwitch/chunks/GrSwitch-CdBxwV3k.js.map +1 -0
- package/dist/components/GrSwitch/index.js +3 -3
- package/dist/components/GrTable/chunks/GrTable-CyQ9uw8A.js +57 -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-BpF8AAUz.js +118 -0
- package/dist/components/GrTabs/chunks/GrTabs-BpF8AAUz.js.map +1 -0
- package/dist/components/GrTabs/index.js +3 -3
- package/dist/components/GrTextarea/chunks/GrTextarea-DFS9ZkrA.js +71 -0
- package/dist/components/GrTextarea/chunks/GrTextarea-DFS9ZkrA.js.map +1 -0
- package/dist/components/GrTextarea/index.js +3 -3
- package/dist/components/GrToaster/chunks/GrToaster-3Mf0Moxt.js +171 -0
- package/dist/components/GrToaster/chunks/GrToaster-3Mf0Moxt.js.map +1 -0
- package/dist/components/GrToaster/index.js +3 -3
- package/dist/components/GrTooltip/chunks/GrTooltip-BvmsukLW.js +55 -0
- package/dist/components/GrTooltip/chunks/GrTooltip-BvmsukLW.js.map +1 -0
- package/dist/components/GrTooltip/index.js +3 -3
- package/dist/components/GrTree/chunks/GrTree-C2kN-O4Q.js +734 -0
- package/dist/components/GrTree/chunks/GrTree-C2kN-O4Q.js.map +1 -0
- package/dist/components/GrTree/index.js +3 -3
- package/dist/components/GrTreeSelect/chunks/GrTreeSelect-Da-CpRqm.js +454 -0
- package/dist/components/GrTreeSelect/chunks/GrTreeSelect-Da-CpRqm.js.map +1 -0
- package/dist/components/GrTreeSelect/index.js +3 -3
- package/dist/composables/useTheme.js +39 -30
- package/dist/composables/useTheme.js.map +1 -0
- package/dist/composables/useToast.js +41 -34
- package/dist/composables/useToast.js.map +1 -0
- package/dist/directives/autofocus.js +55 -0
- package/dist/directives/autofocus.js.map +1 -0
- package/dist/directives/autosize.js +117 -0
- package/dist/directives/autosize.js.map +1 -0
- package/dist/directives/clickOutside.js +96 -0
- package/dist/directives/clickOutside.js.map +1 -0
- package/dist/directives/dropzone.js +164 -0
- package/dist/directives/dropzone.js.map +1 -0
- package/dist/directives/hotkey.js +138 -0
- package/dist/directives/hotkey.js.map +1 -0
- package/dist/directives/index.js +7 -2
- package/dist/directives/loading.js +163 -0
- package/dist/directives/loading.js.map +1 -0
- package/dist/fileValidation/index.js +2 -2
- package/dist/granular-provider-node.js +23 -14
- package/dist/granular-provider-node.js.map +1 -0
- package/dist/granular-provider.js +3 -3
- package/dist/granular-provider.js.map +1 -0
- package/dist/i18n/all.js +6 -6
- package/dist/i18n/all.js.map +1 -0
- package/dist/i18n/index.js +3 -3
- package/dist/index.js +110 -105
- package/dist/vue/index.js +64 -26
- package/dist/vue/index.js.map +1 -0
- package/package.json +25 -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/grLoadingStyles-Bjo7ylmq.js +0 -15
- 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,397 @@
|
|
|
1
|
+
import { i as grNumberInputShellClass, r as grNumberInputInputClass } from "../../../chunks/config-bpQYM5O-.js";
|
|
2
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, onUpdated, openBlock, ref, renderSlot, useSlots, withModifiers } from "vue";
|
|
3
|
+
//#region src/components/GrNumberInput/GrNumberInput.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var _hoisted_1 = [
|
|
5
|
+
"id",
|
|
6
|
+
"name",
|
|
7
|
+
"inputmode",
|
|
8
|
+
"autocomplete",
|
|
9
|
+
"placeholder",
|
|
10
|
+
"disabled",
|
|
11
|
+
"value",
|
|
12
|
+
"aria-invalid"
|
|
13
|
+
];
|
|
14
|
+
var _hoisted_2 = { class: "flex flex-col justify-center gap-1" };
|
|
15
|
+
var _hoisted_3 = ["disabled", "aria-label"];
|
|
16
|
+
var _hoisted_4 = ["disabled", "aria-label"];
|
|
17
|
+
var _hoisted_5 = ["disabled", "aria-label"];
|
|
18
|
+
var _hoisted_6 = ["disabled", "aria-label"];
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/components/GrNumberInput/GrNumberInput.vue
|
|
21
|
+
var GrNumberInput_default = /* @__PURE__ */ defineComponent({
|
|
22
|
+
inheritAttrs: false,
|
|
23
|
+
__name: "GrNumberInput",
|
|
24
|
+
props: {
|
|
25
|
+
modelValue: {},
|
|
26
|
+
placeholder: { default: void 0 },
|
|
27
|
+
autocomplete: { default: void 0 },
|
|
28
|
+
inputmode: { default: "decimal" },
|
|
29
|
+
disabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
invalid: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
},
|
|
37
|
+
state: { default: "default" },
|
|
38
|
+
name: { default: void 0 },
|
|
39
|
+
id: { default: void 0 },
|
|
40
|
+
size: { default: "md" },
|
|
41
|
+
textAlign: { default: "left" },
|
|
42
|
+
decimalSeparator: { default: "." },
|
|
43
|
+
step: { default: 1 },
|
|
44
|
+
min: { default: void 0 },
|
|
45
|
+
max: { default: void 0 },
|
|
46
|
+
precision: { default: void 0 },
|
|
47
|
+
controls: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
controlsDirection: { default: "vertical" },
|
|
52
|
+
prefixMinWidth: { default: void 0 },
|
|
53
|
+
prefixMaxWidth: { default: void 0 },
|
|
54
|
+
suffixMinWidth: { default: void 0 },
|
|
55
|
+
suffixMaxWidth: { default: void 0 },
|
|
56
|
+
increaseLabel: { default: "Increase" },
|
|
57
|
+
decreaseLabel: { default: "Decrease" }
|
|
58
|
+
},
|
|
59
|
+
emits: ["update:modelValue", "change"],
|
|
60
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
61
|
+
const ADDON_PX_BY_SIZE = {
|
|
62
|
+
xs: 32,
|
|
63
|
+
sm: 36,
|
|
64
|
+
md: 40,
|
|
65
|
+
lg: 48
|
|
66
|
+
};
|
|
67
|
+
const BASE_PADDING_X_LEN_BY_SIZE = {
|
|
68
|
+
xs: "10px",
|
|
69
|
+
sm: "12px",
|
|
70
|
+
md: "12px",
|
|
71
|
+
lg: "16px"
|
|
72
|
+
};
|
|
73
|
+
function px(n) {
|
|
74
|
+
return `${n}px`;
|
|
75
|
+
}
|
|
76
|
+
const props = __props;
|
|
77
|
+
const emit = __emit;
|
|
78
|
+
const inputEl = ref(null);
|
|
79
|
+
function focus() {
|
|
80
|
+
inputEl.value?.focus();
|
|
81
|
+
}
|
|
82
|
+
__expose({ focus });
|
|
83
|
+
const slots = useSlots();
|
|
84
|
+
const hasPrefix = computed(() => Boolean(slots.prefix));
|
|
85
|
+
const hasSuffix = computed(() => Boolean(slots.suffix));
|
|
86
|
+
const hasHorizontalControls = computed(() => props.controls && props.controlsDirection === "horizontal");
|
|
87
|
+
const hasVerticalControls = computed(() => props.controls && props.controlsDirection === "vertical");
|
|
88
|
+
const addonPx = computed(() => ADDON_PX_BY_SIZE[props.size]);
|
|
89
|
+
const addonLen = computed(() => px(addonPx.value));
|
|
90
|
+
const basePaddingXLen = computed(() => BASE_PADDING_X_LEN_BY_SIZE[props.size]);
|
|
91
|
+
const defaultAddonMinWidth = computed(() => addonLen.value);
|
|
92
|
+
const prefixMinWidth = computed(() => props.prefixMinWidth ?? defaultAddonMinWidth.value);
|
|
93
|
+
const suffixMinWidth = computed(() => props.suffixMinWidth ?? defaultAddonMinWidth.value);
|
|
94
|
+
const prefixEl = ref(null);
|
|
95
|
+
const suffixEl = ref(null);
|
|
96
|
+
const measuredPrefixWidth = ref(void 0);
|
|
97
|
+
const measuredSuffixWidth = ref(void 0);
|
|
98
|
+
let ro = null;
|
|
99
|
+
let scheduled = false;
|
|
100
|
+
function readWidthPx(el) {
|
|
101
|
+
if (!el) return void 0;
|
|
102
|
+
const width = Math.ceil(el.getBoundingClientRect().width || 0);
|
|
103
|
+
if (width <= 0) return void 0;
|
|
104
|
+
return `${width}px`;
|
|
105
|
+
}
|
|
106
|
+
function measure() {
|
|
107
|
+
measuredPrefixWidth.value = hasPrefix.value ? readWidthPx(prefixEl.value) : void 0;
|
|
108
|
+
measuredSuffixWidth.value = hasSuffix.value ? readWidthPx(suffixEl.value) : void 0;
|
|
109
|
+
}
|
|
110
|
+
function refreshObserver() {
|
|
111
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
112
|
+
if (!ro) ro = new ResizeObserver(() => measure());
|
|
113
|
+
ro.disconnect();
|
|
114
|
+
if (prefixEl.value) ro.observe(prefixEl.value);
|
|
115
|
+
if (suffixEl.value) ro.observe(suffixEl.value);
|
|
116
|
+
}
|
|
117
|
+
function scheduleMeasure() {
|
|
118
|
+
if (scheduled) return;
|
|
119
|
+
scheduled = true;
|
|
120
|
+
nextTick(() => {
|
|
121
|
+
scheduled = false;
|
|
122
|
+
measure();
|
|
123
|
+
refreshObserver();
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
onMounted(() => scheduleMeasure());
|
|
127
|
+
onUpdated(() => scheduleMeasure());
|
|
128
|
+
onBeforeUnmount(() => ro?.disconnect());
|
|
129
|
+
function addLen(a, b) {
|
|
130
|
+
if (a === "0px") return b;
|
|
131
|
+
if (b === "0px") return a;
|
|
132
|
+
const apx = a.endsWith("px") ? Number(a.slice(0, -2)) : null;
|
|
133
|
+
const bpx = b.endsWith("px") ? Number(b.slice(0, -2)) : null;
|
|
134
|
+
if (apx !== null && Number.isFinite(apx) && bpx !== null && Number.isFinite(bpx)) return `${apx + bpx}px`;
|
|
135
|
+
return `calc(${a} + ${b})`;
|
|
136
|
+
}
|
|
137
|
+
const prefixLen = computed(() => hasPrefix.value ? measuredPrefixWidth.value ?? prefixMinWidth.value : "0px");
|
|
138
|
+
const suffixLen = computed(() => hasSuffix.value ? measuredSuffixWidth.value ?? suffixMinWidth.value : "0px");
|
|
139
|
+
function addonStyle(side, offset) {
|
|
140
|
+
return {
|
|
141
|
+
width: addonLen.value,
|
|
142
|
+
[side]: offset
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
const inputStyle = computed(() => {
|
|
146
|
+
const leftControls = hasHorizontalControls.value ? addonLen.value : "0px";
|
|
147
|
+
const rightControlsCount = (hasHorizontalControls.value ? 1 : 0) + (hasVerticalControls.value ? 1 : 0);
|
|
148
|
+
const rightControls = rightControlsCount > 0 ? px(addonPx.value * rightControlsCount) : "0px";
|
|
149
|
+
const leftReserved = addLen(prefixLen.value, leftControls);
|
|
150
|
+
const rightReserved = addLen(suffixLen.value, rightControls);
|
|
151
|
+
return {
|
|
152
|
+
paddingLeft: hasPrefix.value || hasHorizontalControls.value ? addLen(leftReserved, basePaddingXLen.value) : void 0,
|
|
153
|
+
paddingRight: hasSuffix.value || rightControlsCount > 0 ? addLen(rightReserved, basePaddingXLen.value) : void 0
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
const suffixStyle = computed(() => {
|
|
157
|
+
return {
|
|
158
|
+
right: "0px",
|
|
159
|
+
minWidth: suffixMinWidth.value,
|
|
160
|
+
maxWidth: props.suffixMaxWidth
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
const prefixStyle = computed(() => {
|
|
164
|
+
return {
|
|
165
|
+
minWidth: prefixMinWidth.value,
|
|
166
|
+
maxWidth: props.prefixMaxWidth
|
|
167
|
+
};
|
|
168
|
+
});
|
|
169
|
+
const verticalControlsStyle = computed(() => addonStyle("right", suffixLen.value));
|
|
170
|
+
const horizontalLeftControlsStyle = computed(() => addonStyle("left", prefixLen.value));
|
|
171
|
+
const horizontalRightControlsStyle = computed(() => addonStyle("right", suffixLen.value));
|
|
172
|
+
const shellClassName = computed(() => {
|
|
173
|
+
return grNumberInputShellClass({
|
|
174
|
+
disabled: props.disabled,
|
|
175
|
+
state: props.invalid ? "danger" : props.state
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
const inputClassName = computed(() => {
|
|
179
|
+
return grNumberInputInputClass({
|
|
180
|
+
size: props.size,
|
|
181
|
+
textAlign: props.textAlign
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
function isDigit(ch) {
|
|
185
|
+
return ch >= "0" && ch <= "9";
|
|
186
|
+
}
|
|
187
|
+
function sanitize(raw) {
|
|
188
|
+
const sep = props.decimalSeparator || ".";
|
|
189
|
+
let out = "";
|
|
190
|
+
let hasSepLocal = false;
|
|
191
|
+
for (let i = 0; i < raw.length; i++) {
|
|
192
|
+
const ch = raw[i];
|
|
193
|
+
if (isDigit(ch)) {
|
|
194
|
+
out += ch;
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if ((ch === sep || ch === "." || ch === ",") && !hasSepLocal) {
|
|
198
|
+
out += sep;
|
|
199
|
+
hasSepLocal = true;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return out;
|
|
203
|
+
}
|
|
204
|
+
function toNumber(value) {
|
|
205
|
+
if (value.trim() === "") return null;
|
|
206
|
+
const sep = props.decimalSeparator || ".";
|
|
207
|
+
const normalized = sep === "." ? value : value.replace(sep, ".");
|
|
208
|
+
const n = Number(normalized);
|
|
209
|
+
if (!Number.isFinite(n)) return null;
|
|
210
|
+
return n;
|
|
211
|
+
}
|
|
212
|
+
function clamp(v) {
|
|
213
|
+
if (props.min !== void 0) v = Math.max(props.min, v);
|
|
214
|
+
if (props.max !== void 0) v = Math.min(props.max, v);
|
|
215
|
+
return v;
|
|
216
|
+
}
|
|
217
|
+
function normalize(v) {
|
|
218
|
+
if (props.precision === void 0) return v;
|
|
219
|
+
const p = Math.max(0, props.precision);
|
|
220
|
+
return Number(v.toFixed(p));
|
|
221
|
+
}
|
|
222
|
+
function format(n) {
|
|
223
|
+
const sep = props.decimalSeparator || ".";
|
|
224
|
+
const p = props.precision;
|
|
225
|
+
let s = p === void 0 ? String(n) : n.toFixed(Math.max(0, p));
|
|
226
|
+
if (sep !== ".") s = s.replace(".", sep);
|
|
227
|
+
return s;
|
|
228
|
+
}
|
|
229
|
+
function onInput(e) {
|
|
230
|
+
const el = e.target;
|
|
231
|
+
const next = sanitize(el.value);
|
|
232
|
+
if (el.value !== next) el.value = next;
|
|
233
|
+
emit("update:modelValue", next);
|
|
234
|
+
}
|
|
235
|
+
function onChange(e) {
|
|
236
|
+
const el = e.target;
|
|
237
|
+
const next = sanitize(el.value);
|
|
238
|
+
if (el.value !== next) el.value = next;
|
|
239
|
+
emit("change", next);
|
|
240
|
+
}
|
|
241
|
+
function stepBy(dir) {
|
|
242
|
+
if (props.disabled) return;
|
|
243
|
+
const nextStr = format(clamp(normalize((toNumber(props.modelValue) ?? 0) + (props.step ?? 1) * dir)));
|
|
244
|
+
emit("update:modelValue", nextStr);
|
|
245
|
+
emit("change", nextStr);
|
|
246
|
+
focus();
|
|
247
|
+
}
|
|
248
|
+
return (_ctx, _cache) => {
|
|
249
|
+
return openBlock(), createElementBlock("div", {
|
|
250
|
+
"data-ds-number-input": "",
|
|
251
|
+
class: normalizeClass(["relative w-full overflow-hidden rounded-md border bg-[var(--bg)] transition-colors duration-150 focus-within:ring-2 focus-within:ring-[var(--ring)]", shellClassName.value])
|
|
252
|
+
}, [
|
|
253
|
+
_ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
|
|
254
|
+
key: 0,
|
|
255
|
+
ref_key: "prefixEl",
|
|
256
|
+
ref: prefixEl,
|
|
257
|
+
"data-testid": "number-input-prefix",
|
|
258
|
+
"data-ds-number-input-prefix": "",
|
|
259
|
+
class: "absolute inset-y-0 left-0 flex items-center justify-center border-r border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate",
|
|
260
|
+
style: normalizeStyle(prefixStyle.value),
|
|
261
|
+
"aria-hidden": "true"
|
|
262
|
+
}, [renderSlot(_ctx.$slots, "prefix")], 4)) : createCommentVNode("", true),
|
|
263
|
+
createElementVNode("input", mergeProps({
|
|
264
|
+
id: __props.id,
|
|
265
|
+
ref_key: "inputEl",
|
|
266
|
+
ref: inputEl
|
|
267
|
+
}, _ctx.$attrs, {
|
|
268
|
+
name: __props.name,
|
|
269
|
+
type: "text",
|
|
270
|
+
inputmode: __props.inputmode,
|
|
271
|
+
autocomplete: __props.autocomplete,
|
|
272
|
+
placeholder: __props.placeholder,
|
|
273
|
+
disabled: __props.disabled,
|
|
274
|
+
value: __props.modelValue,
|
|
275
|
+
"aria-invalid": __props.invalid ? "true" : void 0,
|
|
276
|
+
class: ["w-full bg-transparent text-[var(--fg)] placeholder:text-[var(--muted-fg)] focus:placeholder:text-transparent focus:outline-none disabled:cursor-not-allowed", inputClassName.value],
|
|
277
|
+
style: inputStyle.value,
|
|
278
|
+
onInput,
|
|
279
|
+
onChange
|
|
280
|
+
}), null, 16, _hoisted_1),
|
|
281
|
+
_ctx.$slots.suffix ? (openBlock(), createElementBlock("div", {
|
|
282
|
+
key: 1,
|
|
283
|
+
ref_key: "suffixEl",
|
|
284
|
+
ref: suffixEl,
|
|
285
|
+
"data-testid": "number-input-suffix",
|
|
286
|
+
"data-ds-number-input-suffix": "",
|
|
287
|
+
class: "absolute inset-y-0 flex items-center justify-center border-l border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate",
|
|
288
|
+
style: normalizeStyle(suffixStyle.value),
|
|
289
|
+
"aria-hidden": "true"
|
|
290
|
+
}, [renderSlot(_ctx.$slots, "suffix")], 4)) : createCommentVNode("", true),
|
|
291
|
+
hasVerticalControls.value ? (openBlock(), createElementBlock("div", {
|
|
292
|
+
key: 2,
|
|
293
|
+
"data-testid": "number-input-controls-vertical",
|
|
294
|
+
"data-ds-number-input-controls": "vertical",
|
|
295
|
+
class: "absolute inset-y-0 flex items-center justify-center border-l border-[var(--brd)]",
|
|
296
|
+
style: normalizeStyle(verticalControlsStyle.value)
|
|
297
|
+
}, [createElementVNode("div", _hoisted_2, [createElementVNode("button", {
|
|
298
|
+
type: "button",
|
|
299
|
+
class: "h-4 w-7 inline-flex items-center justify-center rounded text-[10px] text-[var(--muted-fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50 disabled:cursor-not-allowed",
|
|
300
|
+
disabled: __props.disabled,
|
|
301
|
+
"aria-label": __props.increaseLabel,
|
|
302
|
+
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"])),
|
|
303
|
+
onClick: _cache[1] || (_cache[1] = ($event) => stepBy(1))
|
|
304
|
+
}, [..._cache[8] || (_cache[8] = [createElementVNode("svg", {
|
|
305
|
+
width: "12",
|
|
306
|
+
height: "12",
|
|
307
|
+
viewBox: "0 0 24 24",
|
|
308
|
+
fill: "none",
|
|
309
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
310
|
+
"aria-hidden": "true"
|
|
311
|
+
}, [createElementVNode("path", {
|
|
312
|
+
d: "M7 14l5-5 5 5",
|
|
313
|
+
stroke: "currentColor",
|
|
314
|
+
"stroke-width": "2",
|
|
315
|
+
"stroke-linecap": "round",
|
|
316
|
+
"stroke-linejoin": "round"
|
|
317
|
+
})], -1)])], 40, _hoisted_3), createElementVNode("button", {
|
|
318
|
+
type: "button",
|
|
319
|
+
class: "h-4 w-7 inline-flex items-center justify-center rounded text-[10px] text-[var(--muted-fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50 disabled:cursor-not-allowed",
|
|
320
|
+
disabled: __props.disabled,
|
|
321
|
+
"aria-label": __props.decreaseLabel,
|
|
322
|
+
onMousedown: _cache[2] || (_cache[2] = withModifiers(() => {}, ["prevent"])),
|
|
323
|
+
onClick: _cache[3] || (_cache[3] = ($event) => stepBy(-1))
|
|
324
|
+
}, [..._cache[9] || (_cache[9] = [createElementVNode("svg", {
|
|
325
|
+
width: "12",
|
|
326
|
+
height: "12",
|
|
327
|
+
viewBox: "0 0 24 24",
|
|
328
|
+
fill: "none",
|
|
329
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
330
|
+
"aria-hidden": "true"
|
|
331
|
+
}, [createElementVNode("path", {
|
|
332
|
+
d: "M7 10l5 5 5-5",
|
|
333
|
+
stroke: "currentColor",
|
|
334
|
+
"stroke-width": "2",
|
|
335
|
+
"stroke-linecap": "round",
|
|
336
|
+
"stroke-linejoin": "round"
|
|
337
|
+
})], -1)])], 40, _hoisted_4)])], 4)) : createCommentVNode("", true),
|
|
338
|
+
hasHorizontalControls.value ? (openBlock(), createElementBlock("div", {
|
|
339
|
+
key: 3,
|
|
340
|
+
"data-testid": "number-input-controls-horizontal-left",
|
|
341
|
+
"data-ds-number-input-controls": "horizontal-left",
|
|
342
|
+
class: "absolute inset-y-0 flex items-stretch justify-center border-r border-[var(--brd)]",
|
|
343
|
+
style: normalizeStyle(horizontalLeftControlsStyle.value)
|
|
344
|
+
}, [createElementVNode("button", {
|
|
345
|
+
type: "button",
|
|
346
|
+
class: "h-full w-full inline-flex items-center justify-center text-[var(--muted-fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50 disabled:cursor-not-allowed focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",
|
|
347
|
+
disabled: __props.disabled,
|
|
348
|
+
"aria-label": __props.decreaseLabel,
|
|
349
|
+
onMousedown: _cache[4] || (_cache[4] = withModifiers(() => {}, ["prevent"])),
|
|
350
|
+
onClick: _cache[5] || (_cache[5] = ($event) => stepBy(-1))
|
|
351
|
+
}, [..._cache[10] || (_cache[10] = [createElementVNode("svg", {
|
|
352
|
+
width: "12",
|
|
353
|
+
height: "12",
|
|
354
|
+
viewBox: "0 0 24 24",
|
|
355
|
+
fill: "none",
|
|
356
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
357
|
+
"aria-hidden": "true"
|
|
358
|
+
}, [createElementVNode("path", {
|
|
359
|
+
d: "M14 7l-5 5 5 5",
|
|
360
|
+
stroke: "currentColor",
|
|
361
|
+
"stroke-width": "2",
|
|
362
|
+
"stroke-linecap": "round",
|
|
363
|
+
"stroke-linejoin": "round"
|
|
364
|
+
})], -1)])], 40, _hoisted_5)], 4)) : createCommentVNode("", true),
|
|
365
|
+
hasHorizontalControls.value ? (openBlock(), createElementBlock("div", {
|
|
366
|
+
key: 4,
|
|
367
|
+
"data-testid": "number-input-controls-horizontal-right",
|
|
368
|
+
"data-ds-number-input-controls": "horizontal-right",
|
|
369
|
+
class: "absolute inset-y-0 flex items-stretch justify-center border-l border-[var(--brd)]",
|
|
370
|
+
style: normalizeStyle(horizontalRightControlsStyle.value)
|
|
371
|
+
}, [createElementVNode("button", {
|
|
372
|
+
type: "button",
|
|
373
|
+
class: "h-full w-full inline-flex items-center justify-center text-[var(--muted-fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50 disabled:cursor-not-allowed focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",
|
|
374
|
+
disabled: __props.disabled,
|
|
375
|
+
"aria-label": __props.increaseLabel,
|
|
376
|
+
onMousedown: _cache[6] || (_cache[6] = withModifiers(() => {}, ["prevent"])),
|
|
377
|
+
onClick: _cache[7] || (_cache[7] = ($event) => stepBy(1))
|
|
378
|
+
}, [..._cache[11] || (_cache[11] = [createElementVNode("svg", {
|
|
379
|
+
width: "12",
|
|
380
|
+
height: "12",
|
|
381
|
+
viewBox: "0 0 24 24",
|
|
382
|
+
fill: "none",
|
|
383
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
384
|
+
"aria-hidden": "true"
|
|
385
|
+
}, [createElementVNode("path", {
|
|
386
|
+
d: "M10 7l5 5-5 5",
|
|
387
|
+
stroke: "currentColor",
|
|
388
|
+
"stroke-width": "2",
|
|
389
|
+
"stroke-linecap": "round",
|
|
390
|
+
"stroke-linejoin": "round"
|
|
391
|
+
})], -1)])], 40, _hoisted_6)], 4)) : createCommentVNode("", true)
|
|
392
|
+
], 2);
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
//#endregion
|
|
397
|
+
export { GrNumberInput_default as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GrNumberInput-B0mPLjdv.js","names":["$slots","$attrs"],"sources":["../../../../src/components/GrNumberInput/GrNumberInput.vue","../../../../src/components/GrNumberInput/GrNumberInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { InputHTMLAttributes } from 'vue'\nimport { computed, nextTick, onBeforeUnmount, onMounted, onUpdated, ref, useSlots } from 'vue'\n\nimport {\n grNumberInputInputClass,\n grNumberInputShellClass,\n type GrNumberInputControlsDirection,\n type GrNumberInputSize,\n type GrNumberInputState,\n type GrNumberInputTextAlign,\n} from './grNumberInputStyles'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst ADDON_PX_BY_SIZE: Record<GrNumberInputSize, number> = {\n xs: 32,\n sm: 36,\n md: 40,\n lg: 48,\n}\n\nconst BASE_PADDING_X_LEN_BY_SIZE: Record<GrNumberInputSize, string> = {\n xs: '10px',\n sm: '12px',\n md: '12px',\n lg: '16px',\n}\n\nfunction px(n: number): string {\n return `${n}px`\n}\n\nexport interface GrNumberInputProps {\n /** Значение (строка — контролируем форматирование внутри). */\n modelValue: string\n placeholder?: string\n autocomplete?: string\n inputmode?: InputHTMLAttributes['inputmode']\n disabled?: boolean\n /** Быстрый флаг невалидности; эквивалент `state='danger'` + `aria-invalid`. */\n invalid?: boolean\n state?: GrNumberInputState\n name?: string\n id?: string\n size?: GrNumberInputSize\n\n textAlign?: GrNumberInputTextAlign\n\n decimalSeparator?: string\n step?: number\n min?: number\n max?: number\n precision?: number\n\n /** Показывать кнопки +/-. */\n controls?: boolean\n controlsDirection?: GrNumberInputControlsDirection\n\n prefixMinWidth?: string\n prefixMaxWidth?: string\n suffixMinWidth?: string\n suffixMaxWidth?: string\n\n /** i18n-friendly aria-label для кнопки \"увеличить\". */\n increaseLabel?: string\n /** i18n-friendly aria-label для кнопки \"уменьшить\". */\n decreaseLabel?: string\n}\n\nconst props = withDefaults(defineProps<GrNumberInputProps>(), {\n placeholder: undefined,\n autocomplete: undefined,\n inputmode: 'decimal',\n disabled: false,\n invalid: false,\n state: 'default',\n name: undefined,\n id: undefined,\n size: 'md',\n\n textAlign: 'left',\n\n decimalSeparator: '.',\n step: 1,\n min: undefined,\n max: undefined,\n precision: undefined,\n\n controls: false,\n controlsDirection: 'vertical',\n\n prefixMinWidth: undefined,\n prefixMaxWidth: undefined,\n suffixMinWidth: undefined,\n suffixMaxWidth: undefined,\n\n increaseLabel: 'Increase',\n decreaseLabel: 'Decrease',\n})\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: string): void\n (e: 'change', value: string): void\n}>()\n\nconst inputEl = ref<HTMLInputElement | null>(null)\n\nfunction focus(): void {\n inputEl.value?.focus()\n}\n\ndefineExpose({\n focus,\n})\n\nconst slots = useSlots()\n\nconst hasPrefix = computed(() => Boolean(slots.prefix))\nconst hasSuffix = computed(() => Boolean(slots.suffix))\n\nconst hasHorizontalControls = computed(() => props.controls && props.controlsDirection === 'horizontal')\nconst hasVerticalControls = computed(() => props.controls && props.controlsDirection === 'vertical')\n\nconst addonPx = computed(() => ADDON_PX_BY_SIZE[props.size])\nconst addonLen = computed(() => px(addonPx.value))\nconst basePaddingXLen = computed(() => BASE_PADDING_X_LEN_BY_SIZE[props.size])\n\nconst defaultAddonMinWidth = computed(() => addonLen.value)\nconst prefixMinWidth = computed(() => props.prefixMinWidth ?? defaultAddonMinWidth.value)\nconst suffixMinWidth = computed(() => props.suffixMinWidth ?? defaultAddonMinWidth.value)\n\nconst prefixEl = ref<HTMLElement | null>(null)\nconst suffixEl = ref<HTMLElement | null>(null)\n\nconst measuredPrefixWidth = ref<string | undefined>(undefined)\nconst measuredSuffixWidth = ref<string | undefined>(undefined)\n\nlet ro: ResizeObserver | null = null\nlet scheduled = false\n\nfunction readWidthPx(el: HTMLElement | null): string | undefined {\n if (!el) return undefined\n\n const width = Math.ceil(el.getBoundingClientRect().width || 0)\n if (width <= 0) return undefined\n\n return `${width}px`\n}\n\nfunction measure(): void {\n measuredPrefixWidth.value = hasPrefix.value ? readWidthPx(prefixEl.value) : undefined\n measuredSuffixWidth.value = hasSuffix.value ? readWidthPx(suffixEl.value) : undefined\n}\n\nfunction refreshObserver(): void {\n if (typeof ResizeObserver === 'undefined') return\n if (!ro) ro = new ResizeObserver(() => measure())\n\n ro.disconnect()\n if (prefixEl.value) ro.observe(prefixEl.value)\n if (suffixEl.value) ro.observe(suffixEl.value)\n}\n\nfunction scheduleMeasure(): void {\n if (scheduled) return\n scheduled = true\n\n void nextTick(() => {\n scheduled = false\n measure()\n refreshObserver()\n })\n}\n\nonMounted(() => scheduleMeasure())\nonUpdated(() => scheduleMeasure())\nonBeforeUnmount(() => ro?.disconnect())\n\nfunction addLen(a: string, b: string): string {\n if (a === '0px') return b\n if (b === '0px') return a\n\n const apx = a.endsWith('px') ? Number(a.slice(0, -2)) : null\n const bpx = b.endsWith('px') ? Number(b.slice(0, -2)) : null\n\n if (apx !== null && Number.isFinite(apx) && bpx !== null && Number.isFinite(bpx))\n return `${apx + bpx}px`\n\n return `calc(${a} + ${b})`\n}\n\nconst prefixLen = computed(() => (hasPrefix.value ? measuredPrefixWidth.value ?? prefixMinWidth.value : '0px'))\nconst suffixLen = computed(() => (hasSuffix.value ? measuredSuffixWidth.value ?? suffixMinWidth.value : '0px'))\n\nfunction addonStyle(side: 'left' | 'right', offset: string): Record<string, string> {\n return {\n width: addonLen.value,\n [side]: offset,\n }\n}\n\nconst inputStyle = computed(() => {\n const leftControls = hasHorizontalControls.value ? addonLen.value : '0px'\n const rightControlsCount = (hasHorizontalControls.value ? 1 : 0) + (hasVerticalControls.value ? 1 : 0)\n const rightControls = rightControlsCount > 0 ? px(addonPx.value * rightControlsCount) : '0px'\n\n const leftReserved = addLen(prefixLen.value, leftControls)\n const rightReserved = addLen(suffixLen.value, rightControls)\n\n const left = hasPrefix.value || hasHorizontalControls.value ? addLen(leftReserved, basePaddingXLen.value) : undefined\n const right = hasSuffix.value || rightControlsCount > 0 ? addLen(rightReserved, basePaddingXLen.value) : undefined\n\n return {\n paddingLeft: left,\n paddingRight: right,\n } as Record<string, string | undefined>\n})\n\nconst suffixStyle = computed(() => {\n return {\n right: '0px',\n minWidth: suffixMinWidth.value,\n maxWidth: props.suffixMaxWidth,\n }\n})\n\nconst prefixStyle = computed(() => {\n return {\n minWidth: prefixMinWidth.value,\n maxWidth: props.prefixMaxWidth,\n }\n})\n\nconst verticalControlsStyle = computed(() => addonStyle('right', suffixLen.value))\nconst horizontalLeftControlsStyle = computed(() => addonStyle('left', prefixLen.value))\nconst horizontalRightControlsStyle = computed(() => addonStyle('right', suffixLen.value))\n\nconst shellClassName = computed(() => {\n return grNumberInputShellClass({\n disabled: props.disabled,\n state: props.invalid ? 'danger' : props.state,\n })\n})\n\nconst inputClassName = computed(() => {\n return grNumberInputInputClass({\n size: props.size,\n textAlign: props.textAlign,\n })\n})\n\nfunction isDigit(ch: string): boolean {\n return ch >= '0' && ch <= '9'\n}\n\nfunction sanitize(raw: string): string {\n const sep = props.decimalSeparator || '.'\n\n let out = ''\n let hasSepLocal = false\n\n for (let i = 0; i < raw.length; i++) {\n const ch = raw[i]\n if (isDigit(ch)) {\n out += ch\n continue\n }\n\n if ((ch === sep || ch === '.' || ch === ',') && !hasSepLocal) {\n out += sep\n hasSepLocal = true\n }\n }\n\n return out\n}\n\nfunction toNumber(value: string): number | null {\n if (value.trim() === '') return null\n const sep = props.decimalSeparator || '.'\n const normalized = sep === '.' ? value : value.replace(sep, '.')\n const n = Number(normalized)\n if (!Number.isFinite(n)) return null\n return n\n}\n\nfunction clamp(v: number): number {\n if (props.min !== undefined) v = Math.max(props.min, v)\n if (props.max !== undefined) v = Math.min(props.max, v)\n return v\n}\n\nfunction normalize(v: number): number {\n if (props.precision === undefined) return v\n const p = Math.max(0, props.precision)\n return Number(v.toFixed(p))\n}\n\nfunction format(n: number): string {\n const sep = props.decimalSeparator || '.'\n const p = props.precision\n\n let s = p === undefined ? String(n) : n.toFixed(Math.max(0, p))\n if (sep !== '.') s = s.replace('.', sep)\n return s\n}\n\nfunction onInput(e: Event): void {\n const el = e.target as HTMLInputElement\n const next = sanitize(el.value)\n if (el.value !== next) el.value = next\n emit('update:modelValue', next)\n}\n\nfunction onChange(e: Event): void {\n const el = e.target as HTMLInputElement\n const next = sanitize(el.value)\n if (el.value !== next) el.value = next\n emit('change', next)\n}\n\nfunction stepBy(dir: 1 | -1): void {\n if (props.disabled) return\n\n const current = toNumber(props.modelValue) ?? 0\n const next = clamp(normalize(current + (props.step ?? 1) * dir))\n const nextStr = format(next)\n\n emit('update:modelValue', nextStr)\n emit('change', nextStr)\n focus()\n}\n</script>\n\n<template>\n <div\n data-ds-number-input\n class=\"relative w-full overflow-hidden rounded-md border bg-[var(--bg)] transition-colors duration-150 focus-within:ring-2 focus-within:ring-[var(--ring)]\"\n :class=\"shellClassName\"\n >\n <div\n v-if=\"$slots.prefix\"\n ref=\"prefixEl\"\n data-testid=\"number-input-prefix\"\n data-ds-number-input-prefix\n class=\"absolute inset-y-0 left-0 flex items-center justify-center border-r border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate\"\n :style=\"prefixStyle\"\n aria-hidden=\"true\"\n >\n <slot name=\"prefix\" />\n </div>\n\n <input\n :id=\"id\"\n ref=\"inputEl\"\n v-bind=\"$attrs\"\n :name=\"name\"\n type=\"text\"\n :inputmode=\"inputmode\"\n :autocomplete=\"autocomplete\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :value=\"modelValue\"\n :aria-invalid=\"invalid ? 'true' : undefined\"\n class=\"w-full bg-transparent text-[var(--fg)] placeholder:text-[var(--muted-fg)] focus:placeholder:text-transparent focus:outline-none disabled:cursor-not-allowed\"\n :class=\"inputClassName\"\n :style=\"inputStyle\"\n @input=\"onInput\"\n @change=\"onChange\"\n >\n\n <div\n v-if=\"$slots.suffix\"\n ref=\"suffixEl\"\n data-testid=\"number-input-suffix\"\n data-ds-number-input-suffix\n class=\"absolute inset-y-0 flex items-center justify-center border-l border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate\"\n :style=\"suffixStyle\"\n aria-hidden=\"true\"\n >\n <slot name=\"suffix\" />\n </div>\n\n <div\n v-if=\"hasVerticalControls\"\n data-testid=\"number-input-controls-vertical\"\n data-ds-number-input-controls=\"vertical\"\n class=\"absolute inset-y-0 flex items-center justify-center border-l border-[var(--brd)]\"\n :style=\"verticalControlsStyle\"\n >\n <div class=\"flex flex-col justify-center gap-1\">\n <button\n type=\"button\"\n class=\"h-4 w-7 inline-flex items-center justify-center rounded text-[10px] text-[var(--muted-fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50 disabled:cursor-not-allowed\"\n :disabled=\"disabled\"\n :aria-label=\"increaseLabel\"\n @mousedown.prevent\n @click=\"stepBy(1)\"\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n d=\"M7 14l5-5 5 5\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"h-4 w-7 inline-flex items-center justify-center rounded text-[10px] text-[var(--muted-fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50 disabled:cursor-not-allowed\"\n :disabled=\"disabled\"\n :aria-label=\"decreaseLabel\"\n @mousedown.prevent\n @click=\"stepBy(-1)\"\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n d=\"M7 10l5 5 5-5\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n </div>\n </div>\n\n <div\n v-if=\"hasHorizontalControls\"\n data-testid=\"number-input-controls-horizontal-left\"\n data-ds-number-input-controls=\"horizontal-left\"\n class=\"absolute inset-y-0 flex items-stretch justify-center border-r border-[var(--brd)]\"\n :style=\"horizontalLeftControlsStyle\"\n >\n <button\n type=\"button\"\n class=\"h-full w-full inline-flex items-center justify-center text-[var(--muted-fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50 disabled:cursor-not-allowed focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]\"\n :disabled=\"disabled\"\n :aria-label=\"decreaseLabel\"\n @mousedown.prevent\n @click=\"stepBy(-1)\"\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n d=\"M14 7l-5 5 5 5\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n </div>\n\n <div\n v-if=\"hasHorizontalControls\"\n data-testid=\"number-input-controls-horizontal-right\"\n data-ds-number-input-controls=\"horizontal-right\"\n class=\"absolute inset-y-0 flex items-stretch justify-center border-l border-[var(--brd)]\"\n :style=\"horizontalRightControlsStyle\"\n >\n <button\n type=\"button\"\n class=\"h-full w-full inline-flex items-center justify-center text-[var(--muted-fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50 disabled:cursor-not-allowed focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]\"\n :disabled=\"disabled\"\n :aria-label=\"increaseLabel\"\n @mousedown.prevent\n @click=\"stepBy(1)\"\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n d=\"M10 7l5 5-5 5\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport type { InputHTMLAttributes } from 'vue'\nimport { computed, nextTick, onBeforeUnmount, onMounted, onUpdated, ref, useSlots } from 'vue'\n\nimport {\n grNumberInputInputClass,\n grNumberInputShellClass,\n type GrNumberInputControlsDirection,\n type GrNumberInputSize,\n type GrNumberInputState,\n type GrNumberInputTextAlign,\n} from './grNumberInputStyles'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst ADDON_PX_BY_SIZE: Record<GrNumberInputSize, number> = {\n xs: 32,\n sm: 36,\n md: 40,\n lg: 48,\n}\n\nconst BASE_PADDING_X_LEN_BY_SIZE: Record<GrNumberInputSize, string> = {\n xs: '10px',\n sm: '12px',\n md: '12px',\n lg: '16px',\n}\n\nfunction px(n: number): string {\n return `${n}px`\n}\n\nexport interface GrNumberInputProps {\n /** Значение (строка — контролируем форматирование внутри). */\n modelValue: string\n placeholder?: string\n autocomplete?: string\n inputmode?: InputHTMLAttributes['inputmode']\n disabled?: boolean\n /** Быстрый флаг невалидности; эквивалент `state='danger'` + `aria-invalid`. */\n invalid?: boolean\n state?: GrNumberInputState\n name?: string\n id?: string\n size?: GrNumberInputSize\n\n textAlign?: GrNumberInputTextAlign\n\n decimalSeparator?: string\n step?: number\n min?: number\n max?: number\n precision?: number\n\n /** Показывать кнопки +/-. */\n controls?: boolean\n controlsDirection?: GrNumberInputControlsDirection\n\n prefixMinWidth?: string\n prefixMaxWidth?: string\n suffixMinWidth?: string\n suffixMaxWidth?: string\n\n /** i18n-friendly aria-label для кнопки \"увеличить\". */\n increaseLabel?: string\n /** i18n-friendly aria-label для кнопки \"уменьшить\". */\n decreaseLabel?: string\n}\n\nconst props = withDefaults(defineProps<GrNumberInputProps>(), {\n placeholder: undefined,\n autocomplete: undefined,\n inputmode: 'decimal',\n disabled: false,\n invalid: false,\n state: 'default',\n name: undefined,\n id: undefined,\n size: 'md',\n\n textAlign: 'left',\n\n decimalSeparator: '.',\n step: 1,\n min: undefined,\n max: undefined,\n precision: undefined,\n\n controls: false,\n controlsDirection: 'vertical',\n\n prefixMinWidth: undefined,\n prefixMaxWidth: undefined,\n suffixMinWidth: undefined,\n suffixMaxWidth: undefined,\n\n increaseLabel: 'Increase',\n decreaseLabel: 'Decrease',\n})\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: string): void\n (e: 'change', value: string): void\n}>()\n\nconst inputEl = ref<HTMLInputElement | null>(null)\n\nfunction focus(): void {\n inputEl.value?.focus()\n}\n\ndefineExpose({\n focus,\n})\n\nconst slots = useSlots()\n\nconst hasPrefix = computed(() => Boolean(slots.prefix))\nconst hasSuffix = computed(() => Boolean(slots.suffix))\n\nconst hasHorizontalControls = computed(() => props.controls && props.controlsDirection === 'horizontal')\nconst hasVerticalControls = computed(() => props.controls && props.controlsDirection === 'vertical')\n\nconst addonPx = computed(() => ADDON_PX_BY_SIZE[props.size])\nconst addonLen = computed(() => px(addonPx.value))\nconst basePaddingXLen = computed(() => BASE_PADDING_X_LEN_BY_SIZE[props.size])\n\nconst defaultAddonMinWidth = computed(() => addonLen.value)\nconst prefixMinWidth = computed(() => props.prefixMinWidth ?? defaultAddonMinWidth.value)\nconst suffixMinWidth = computed(() => props.suffixMinWidth ?? defaultAddonMinWidth.value)\n\nconst prefixEl = ref<HTMLElement | null>(null)\nconst suffixEl = ref<HTMLElement | null>(null)\n\nconst measuredPrefixWidth = ref<string | undefined>(undefined)\nconst measuredSuffixWidth = ref<string | undefined>(undefined)\n\nlet ro: ResizeObserver | null = null\nlet scheduled = false\n\nfunction readWidthPx(el: HTMLElement | null): string | undefined {\n if (!el) return undefined\n\n const width = Math.ceil(el.getBoundingClientRect().width || 0)\n if (width <= 0) return undefined\n\n return `${width}px`\n}\n\nfunction measure(): void {\n measuredPrefixWidth.value = hasPrefix.value ? readWidthPx(prefixEl.value) : undefined\n measuredSuffixWidth.value = hasSuffix.value ? readWidthPx(suffixEl.value) : undefined\n}\n\nfunction refreshObserver(): void {\n if (typeof ResizeObserver === 'undefined') return\n if (!ro) ro = new ResizeObserver(() => measure())\n\n ro.disconnect()\n if (prefixEl.value) ro.observe(prefixEl.value)\n if (suffixEl.value) ro.observe(suffixEl.value)\n}\n\nfunction scheduleMeasure(): void {\n if (scheduled) return\n scheduled = true\n\n void nextTick(() => {\n scheduled = false\n measure()\n refreshObserver()\n })\n}\n\nonMounted(() => scheduleMeasure())\nonUpdated(() => scheduleMeasure())\nonBeforeUnmount(() => ro?.disconnect())\n\nfunction addLen(a: string, b: string): string {\n if (a === '0px') return b\n if (b === '0px') return a\n\n const apx = a.endsWith('px') ? Number(a.slice(0, -2)) : null\n const bpx = b.endsWith('px') ? Number(b.slice(0, -2)) : null\n\n if (apx !== null && Number.isFinite(apx) && bpx !== null && Number.isFinite(bpx))\n return `${apx + bpx}px`\n\n return `calc(${a} + ${b})`\n}\n\nconst prefixLen = computed(() => (hasPrefix.value ? measuredPrefixWidth.value ?? prefixMinWidth.value : '0px'))\nconst suffixLen = computed(() => (hasSuffix.value ? measuredSuffixWidth.value ?? suffixMinWidth.value : '0px'))\n\nfunction addonStyle(side: 'left' | 'right', offset: string): Record<string, string> {\n return {\n width: addonLen.value,\n [side]: offset,\n }\n}\n\nconst inputStyle = computed(() => {\n const leftControls = hasHorizontalControls.value ? addonLen.value : '0px'\n const rightControlsCount = (hasHorizontalControls.value ? 1 : 0) + (hasVerticalControls.value ? 1 : 0)\n const rightControls = rightControlsCount > 0 ? px(addonPx.value * rightControlsCount) : '0px'\n\n const leftReserved = addLen(prefixLen.value, leftControls)\n const rightReserved = addLen(suffixLen.value, rightControls)\n\n const left = hasPrefix.value || hasHorizontalControls.value ? addLen(leftReserved, basePaddingXLen.value) : undefined\n const right = hasSuffix.value || rightControlsCount > 0 ? addLen(rightReserved, basePaddingXLen.value) : undefined\n\n return {\n paddingLeft: left,\n paddingRight: right,\n } as Record<string, string | undefined>\n})\n\nconst suffixStyle = computed(() => {\n return {\n right: '0px',\n minWidth: suffixMinWidth.value,\n maxWidth: props.suffixMaxWidth,\n }\n})\n\nconst prefixStyle = computed(() => {\n return {\n minWidth: prefixMinWidth.value,\n maxWidth: props.prefixMaxWidth,\n }\n})\n\nconst verticalControlsStyle = computed(() => addonStyle('right', suffixLen.value))\nconst horizontalLeftControlsStyle = computed(() => addonStyle('left', prefixLen.value))\nconst horizontalRightControlsStyle = computed(() => addonStyle('right', suffixLen.value))\n\nconst shellClassName = computed(() => {\n return grNumberInputShellClass({\n disabled: props.disabled,\n state: props.invalid ? 'danger' : props.state,\n })\n})\n\nconst inputClassName = computed(() => {\n return grNumberInputInputClass({\n size: props.size,\n textAlign: props.textAlign,\n })\n})\n\nfunction isDigit(ch: string): boolean {\n return ch >= '0' && ch <= '9'\n}\n\nfunction sanitize(raw: string): string {\n const sep = props.decimalSeparator || '.'\n\n let out = ''\n let hasSepLocal = false\n\n for (let i = 0; i < raw.length; i++) {\n const ch = raw[i]\n if (isDigit(ch)) {\n out += ch\n continue\n }\n\n if ((ch === sep || ch === '.' || ch === ',') && !hasSepLocal) {\n out += sep\n hasSepLocal = true\n }\n }\n\n return out\n}\n\nfunction toNumber(value: string): number | null {\n if (value.trim() === '') return null\n const sep = props.decimalSeparator || '.'\n const normalized = sep === '.' ? value : value.replace(sep, '.')\n const n = Number(normalized)\n if (!Number.isFinite(n)) return null\n return n\n}\n\nfunction clamp(v: number): number {\n if (props.min !== undefined) v = Math.max(props.min, v)\n if (props.max !== undefined) v = Math.min(props.max, v)\n return v\n}\n\nfunction normalize(v: number): number {\n if (props.precision === undefined) return v\n const p = Math.max(0, props.precision)\n return Number(v.toFixed(p))\n}\n\nfunction format(n: number): string {\n const sep = props.decimalSeparator || '.'\n const p = props.precision\n\n let s = p === undefined ? String(n) : n.toFixed(Math.max(0, p))\n if (sep !== '.') s = s.replace('.', sep)\n return s\n}\n\nfunction onInput(e: Event): void {\n const el = e.target as HTMLInputElement\n const next = sanitize(el.value)\n if (el.value !== next) el.value = next\n emit('update:modelValue', next)\n}\n\nfunction onChange(e: Event): void {\n const el = e.target as HTMLInputElement\n const next = sanitize(el.value)\n if (el.value !== next) el.value = next\n emit('change', next)\n}\n\nfunction stepBy(dir: 1 | -1): void {\n if (props.disabled) return\n\n const current = toNumber(props.modelValue) ?? 0\n const next = clamp(normalize(current + (props.step ?? 1) * dir))\n const nextStr = format(next)\n\n emit('update:modelValue', nextStr)\n emit('change', nextStr)\n focus()\n}\n</script>\n\n<template>\n <div\n data-ds-number-input\n class=\"relative w-full overflow-hidden rounded-md border bg-[var(--bg)] transition-colors duration-150 focus-within:ring-2 focus-within:ring-[var(--ring)]\"\n :class=\"shellClassName\"\n >\n <div\n v-if=\"$slots.prefix\"\n ref=\"prefixEl\"\n data-testid=\"number-input-prefix\"\n data-ds-number-input-prefix\n class=\"absolute inset-y-0 left-0 flex items-center justify-center border-r border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate\"\n :style=\"prefixStyle\"\n aria-hidden=\"true\"\n >\n <slot name=\"prefix\" />\n </div>\n\n <input\n :id=\"id\"\n ref=\"inputEl\"\n v-bind=\"$attrs\"\n :name=\"name\"\n type=\"text\"\n :inputmode=\"inputmode\"\n :autocomplete=\"autocomplete\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :value=\"modelValue\"\n :aria-invalid=\"invalid ? 'true' : undefined\"\n class=\"w-full bg-transparent text-[var(--fg)] placeholder:text-[var(--muted-fg)] focus:placeholder:text-transparent focus:outline-none disabled:cursor-not-allowed\"\n :class=\"inputClassName\"\n :style=\"inputStyle\"\n @input=\"onInput\"\n @change=\"onChange\"\n >\n\n <div\n v-if=\"$slots.suffix\"\n ref=\"suffixEl\"\n data-testid=\"number-input-suffix\"\n data-ds-number-input-suffix\n class=\"absolute inset-y-0 flex items-center justify-center border-l border-[var(--brd)] px-2 text-[var(--muted-fg)] pointer-events-none select-none truncate\"\n :style=\"suffixStyle\"\n aria-hidden=\"true\"\n >\n <slot name=\"suffix\" />\n </div>\n\n <div\n v-if=\"hasVerticalControls\"\n data-testid=\"number-input-controls-vertical\"\n data-ds-number-input-controls=\"vertical\"\n class=\"absolute inset-y-0 flex items-center justify-center border-l border-[var(--brd)]\"\n :style=\"verticalControlsStyle\"\n >\n <div class=\"flex flex-col justify-center gap-1\">\n <button\n type=\"button\"\n class=\"h-4 w-7 inline-flex items-center justify-center rounded text-[10px] text-[var(--muted-fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50 disabled:cursor-not-allowed\"\n :disabled=\"disabled\"\n :aria-label=\"increaseLabel\"\n @mousedown.prevent\n @click=\"stepBy(1)\"\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n d=\"M7 14l5-5 5 5\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"h-4 w-7 inline-flex items-center justify-center rounded text-[10px] text-[var(--muted-fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50 disabled:cursor-not-allowed\"\n :disabled=\"disabled\"\n :aria-label=\"decreaseLabel\"\n @mousedown.prevent\n @click=\"stepBy(-1)\"\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n d=\"M7 10l5 5 5-5\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n </div>\n </div>\n\n <div\n v-if=\"hasHorizontalControls\"\n data-testid=\"number-input-controls-horizontal-left\"\n data-ds-number-input-controls=\"horizontal-left\"\n class=\"absolute inset-y-0 flex items-stretch justify-center border-r border-[var(--brd)]\"\n :style=\"horizontalLeftControlsStyle\"\n >\n <button\n type=\"button\"\n class=\"h-full w-full inline-flex items-center justify-center text-[var(--muted-fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50 disabled:cursor-not-allowed focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]\"\n :disabled=\"disabled\"\n :aria-label=\"decreaseLabel\"\n @mousedown.prevent\n @click=\"stepBy(-1)\"\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n d=\"M14 7l-5 5 5 5\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n </div>\n\n <div\n v-if=\"hasHorizontalControls\"\n data-testid=\"number-input-controls-horizontal-right\"\n data-ds-number-input-controls=\"horizontal-right\"\n class=\"absolute inset-y-0 flex items-stretch justify-center border-l border-[var(--brd)]\"\n :style=\"horizontalRightControlsStyle\"\n >\n <button\n type=\"button\"\n class=\"h-full w-full inline-flex items-center justify-center text-[var(--muted-fg)] hover:bg-[var(--muted)] active:bg-[var(--muted)] disabled:opacity-50 disabled:cursor-not-allowed focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]\"\n :disabled=\"disabled\"\n :aria-label=\"increaseLabel\"\n @mousedown.prevent\n @click=\"stepBy(1)\"\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path\n d=\"M10 7l5 5-5 5\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n </div>\n </div>\n</template>\n"],"mappings":"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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { t as
|
|
3
|
-
export {
|
|
1
|
+
import { n as grNumberInputSafelist, t as grNumberInputConfig } from "../../chunks/config-bpQYM5O-.js";
|
|
2
|
+
import { t as GrNumberInput_default } from "./chunks/GrNumberInput-B0mPLjdv.js";
|
|
3
|
+
export { GrNumberInput_default as GrNumberInput, GrNumberInput_default as default, grNumberInputConfig, grNumberInputSafelist };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { t as GrButton_default } from "../../GrButton/chunks/GrButton-BmGdp8-4.js";
|
|
2
|
+
import { t as useGranularityTranslations } from "../../../chunks/granularityI18n-GCqUz_lo.js";
|
|
3
|
+
import { t as GrSelect_default } from "../../GrSelect/chunks/GrSelect-9wRWAu2R.js";
|
|
4
|
+
import { Fragment, computed, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, renderList, toDisplayString, unref, withCtx } from "vue";
|
|
5
|
+
//#region src/components/GrPagination/GrPagination.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var _hoisted_1 = ["aria-label"];
|
|
7
|
+
var _hoisted_2 = { class: "min-w-[100px]" };
|
|
8
|
+
var _hoisted_3 = { class: "flex items-center gap-1" };
|
|
9
|
+
var _hoisted_4 = [
|
|
10
|
+
"aria-current",
|
|
11
|
+
"aria-label",
|
|
12
|
+
"onClick"
|
|
13
|
+
];
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/components/GrPagination/GrPagination.vue
|
|
16
|
+
var GrPagination_default = /* @__PURE__ */ defineComponent({
|
|
17
|
+
__name: "GrPagination",
|
|
18
|
+
props: {
|
|
19
|
+
page: {},
|
|
20
|
+
pageSize: {},
|
|
21
|
+
total: {},
|
|
22
|
+
pageSizes: { default: () => [
|
|
23
|
+
10,
|
|
24
|
+
20,
|
|
25
|
+
50
|
|
26
|
+
] }
|
|
27
|
+
},
|
|
28
|
+
emits: ["update:page", "update:pageSize"],
|
|
29
|
+
setup(__props, { emit: __emit }) {
|
|
30
|
+
const { t } = useGranularityTranslations();
|
|
31
|
+
const props = __props;
|
|
32
|
+
const emit = __emit;
|
|
33
|
+
const pageCount = computed(() => Math.max(1, Math.ceil(props.total / props.pageSize)));
|
|
34
|
+
const pageSizeModel = computed({
|
|
35
|
+
get: () => String(props.pageSize),
|
|
36
|
+
set: (value) => emit("update:pageSize", Number(value))
|
|
37
|
+
});
|
|
38
|
+
const pageSizeOptions = computed(() => props.pageSizes.map((pageSize) => ({
|
|
39
|
+
value: String(pageSize),
|
|
40
|
+
label: String(pageSize)
|
|
41
|
+
})));
|
|
42
|
+
const pages = computed(() => {
|
|
43
|
+
const max = pageCount.value;
|
|
44
|
+
const current = props.page;
|
|
45
|
+
const windowSize = 5;
|
|
46
|
+
const half = Math.floor(windowSize / 2);
|
|
47
|
+
let start = Math.max(1, current - half);
|
|
48
|
+
const end = Math.min(max, start + windowSize - 1);
|
|
49
|
+
start = Math.max(1, end - windowSize + 1);
|
|
50
|
+
const list = [];
|
|
51
|
+
for (let page = start; page <= end; page += 1) list.push(page);
|
|
52
|
+
return list;
|
|
53
|
+
});
|
|
54
|
+
function goTo(page) {
|
|
55
|
+
emit("update:page", page);
|
|
56
|
+
}
|
|
57
|
+
function prev() {
|
|
58
|
+
goTo(Math.max(1, props.page - 1));
|
|
59
|
+
}
|
|
60
|
+
function next() {
|
|
61
|
+
goTo(Math.min(pageCount.value, props.page + 1));
|
|
62
|
+
}
|
|
63
|
+
return (_ctx, _cache) => {
|
|
64
|
+
return openBlock(), createElementBlock("div", {
|
|
65
|
+
class: "flex flex-wrap items-center justify-end gap-3",
|
|
66
|
+
"data-ds-pagination": "",
|
|
67
|
+
role: "navigation",
|
|
68
|
+
"aria-label": unref(t)("gr.pagination.pageSize", "Pagination")
|
|
69
|
+
}, [
|
|
70
|
+
createElementVNode("div", _hoisted_2, [createVNode(GrSelect_default, {
|
|
71
|
+
modelValue: pageSizeModel.value,
|
|
72
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => pageSizeModel.value = $event),
|
|
73
|
+
options: pageSizeOptions.value,
|
|
74
|
+
"aria-label": unref(t)("gr.pagination.pageSize", "Page size")
|
|
75
|
+
}, null, 8, [
|
|
76
|
+
"modelValue",
|
|
77
|
+
"options",
|
|
78
|
+
"aria-label"
|
|
79
|
+
])]),
|
|
80
|
+
createVNode(GrButton_default, {
|
|
81
|
+
variant: "ghost",
|
|
82
|
+
size: "sm",
|
|
83
|
+
disabled: __props.page <= 1,
|
|
84
|
+
onClick: prev
|
|
85
|
+
}, {
|
|
86
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("gr.pagination.prev", "Prev")), 1)]),
|
|
87
|
+
_: 1
|
|
88
|
+
}, 8, ["disabled"]),
|
|
89
|
+
createElementVNode("div", _hoisted_3, [(openBlock(true), createElementBlock(Fragment, null, renderList(pages.value, (pageNumber) => {
|
|
90
|
+
return openBlock(), createElementBlock("button", {
|
|
91
|
+
key: pageNumber,
|
|
92
|
+
type: "button",
|
|
93
|
+
"data-ds-pagination-page": "",
|
|
94
|
+
"aria-current": pageNumber === __props.page ? "page" : void 0,
|
|
95
|
+
"aria-label": `Page ${pageNumber}`,
|
|
96
|
+
class: normalizeClass(["h-8 min-w-8 px-2 rounded-md text-sm font-600 transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]", pageNumber === __props.page ? "bg-[var(--primary)] text-[var(--primary-fg)]" : "text-[var(--muted-fg)] hover:bg-[var(--muted)] hover:text-[var(--fg)]"]),
|
|
97
|
+
onClick: ($event) => goTo(pageNumber)
|
|
98
|
+
}, toDisplayString(pageNumber), 11, _hoisted_4);
|
|
99
|
+
}), 128))]),
|
|
100
|
+
createVNode(GrButton_default, {
|
|
101
|
+
variant: "ghost",
|
|
102
|
+
size: "sm",
|
|
103
|
+
disabled: __props.page >= pageCount.value,
|
|
104
|
+
onClick: next
|
|
105
|
+
}, {
|
|
106
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("gr.pagination.next", "Next")), 1)]),
|
|
107
|
+
_: 1
|
|
108
|
+
}, 8, ["disabled"])
|
|
109
|
+
], 8, _hoisted_1);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
//#endregion
|
|
114
|
+
export { GrPagination_default as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GrPagination-BSTO6flk.js","names":[],"sources":["../../../../src/components/GrPagination/GrPagination.vue","../../../../src/components/GrPagination/GrPagination.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nimport { useGranularityTranslations } from '../../internal/granularityI18n'\nimport GrButton from '../GrButton/GrButton.vue'\nimport GrSelect from '../GrSelect/GrSelect.vue'\n\n/**\n * Пропы пагинации.\n *\n * `total` интерпретируется как общее количество элементов; число страниц\n * вычисляется из `total` и `pageSize`. Окно отображаемых номеров — 5.\n */\nexport interface GrPaginationProps {\n page: number\n pageSize: number\n total: number\n pageSizes?: number[]\n}\n\nconst { t } = useGranularityTranslations()\n\nconst props = withDefaults(defineProps<GrPaginationProps>(), {\n pageSizes: () => [10, 20, 50],\n})\n\nconst emit = defineEmits<{\n (e: 'update:page', value: number): void\n (e: 'update:pageSize', value: number): void\n}>()\n\nconst pageCount = computed(() => Math.max(1, Math.ceil(props.total / props.pageSize)))\n\nconst pageSizeModel = computed({\n get: () => String(props.pageSize),\n set: (value: string) => emit('update:pageSize', Number(value)),\n})\n\nconst pageSizeOptions = computed(() =>\n props.pageSizes.map(pageSize => ({\n value: String(pageSize),\n label: String(pageSize),\n })),\n)\n\nconst pages = computed(() => {\n const max = pageCount.value\n const current = props.page\n const windowSize = 5\n const half = Math.floor(windowSize / 2)\n\n let start = Math.max(1, current - half)\n const end = Math.min(max, start + windowSize - 1)\n start = Math.max(1, end - windowSize + 1)\n\n const list: number[] = []\n for (let page = start; page <= end; page += 1)\n list.push(page)\n\n return list\n})\n\nfunction goTo(page: number): void {\n emit('update:page', page)\n}\n\nfunction prev(): void {\n goTo(Math.max(1, props.page - 1))\n}\n\nfunction next(): void {\n goTo(Math.min(pageCount.value, props.page + 1))\n}\n</script>\n\n<template>\n <div\n class=\"flex flex-wrap items-center justify-end gap-3\"\n data-ds-pagination\n role=\"navigation\"\n :aria-label=\"t('gr.pagination.pageSize', 'Pagination')\"\n >\n <div class=\"min-w-[100px]\">\n <GrSelect\n v-model=\"pageSizeModel\"\n :options=\"pageSizeOptions\"\n :aria-label=\"t('gr.pagination.pageSize', 'Page size')\"\n />\n </div>\n\n <GrButton variant=\"ghost\" size=\"sm\" :disabled=\"page <= 1\" @click=\"prev\">\n {{ t('gr.pagination.prev', 'Prev') }}\n </GrButton>\n\n <div class=\"flex items-center gap-1\">\n <button\n v-for=\"pageNumber in pages\"\n :key=\"pageNumber\"\n type=\"button\"\n data-ds-pagination-page\n :aria-current=\"pageNumber === page ? 'page' : undefined\"\n :aria-label=\"`Page ${pageNumber}`\"\n class=\"h-8 min-w-8 px-2 rounded-md text-sm font-600 transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]\"\n :class=\"pageNumber === page ? 'bg-[var(--primary)] text-[var(--primary-fg)]' : 'text-[var(--muted-fg)] hover:bg-[var(--muted)] hover:text-[var(--fg)]'\"\n @click=\"goTo(pageNumber)\"\n >\n {{ pageNumber }}\n </button>\n </div>\n\n <GrButton variant=\"ghost\" size=\"sm\" :disabled=\"page >= pageCount\" @click=\"next\">\n {{ t('gr.pagination.next', 'Next') }}\n </GrButton>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nimport { useGranularityTranslations } from '../../internal/granularityI18n'\nimport GrButton from '../GrButton/GrButton.vue'\nimport GrSelect from '../GrSelect/GrSelect.vue'\n\n/**\n * Пропы пагинации.\n *\n * `total` интерпретируется как общее количество элементов; число страниц\n * вычисляется из `total` и `pageSize`. Окно отображаемых номеров — 5.\n */\nexport interface GrPaginationProps {\n page: number\n pageSize: number\n total: number\n pageSizes?: number[]\n}\n\nconst { t } = useGranularityTranslations()\n\nconst props = withDefaults(defineProps<GrPaginationProps>(), {\n pageSizes: () => [10, 20, 50],\n})\n\nconst emit = defineEmits<{\n (e: 'update:page', value: number): void\n (e: 'update:pageSize', value: number): void\n}>()\n\nconst pageCount = computed(() => Math.max(1, Math.ceil(props.total / props.pageSize)))\n\nconst pageSizeModel = computed({\n get: () => String(props.pageSize),\n set: (value: string) => emit('update:pageSize', Number(value)),\n})\n\nconst pageSizeOptions = computed(() =>\n props.pageSizes.map(pageSize => ({\n value: String(pageSize),\n label: String(pageSize),\n })),\n)\n\nconst pages = computed(() => {\n const max = pageCount.value\n const current = props.page\n const windowSize = 5\n const half = Math.floor(windowSize / 2)\n\n let start = Math.max(1, current - half)\n const end = Math.min(max, start + windowSize - 1)\n start = Math.max(1, end - windowSize + 1)\n\n const list: number[] = []\n for (let page = start; page <= end; page += 1)\n list.push(page)\n\n return list\n})\n\nfunction goTo(page: number): void {\n emit('update:page', page)\n}\n\nfunction prev(): void {\n goTo(Math.max(1, props.page - 1))\n}\n\nfunction next(): void {\n goTo(Math.min(pageCount.value, props.page + 1))\n}\n</script>\n\n<template>\n <div\n class=\"flex flex-wrap items-center justify-end gap-3\"\n data-ds-pagination\n role=\"navigation\"\n :aria-label=\"t('gr.pagination.pageSize', 'Pagination')\"\n >\n <div class=\"min-w-[100px]\">\n <GrSelect\n v-model=\"pageSizeModel\"\n :options=\"pageSizeOptions\"\n :aria-label=\"t('gr.pagination.pageSize', 'Page size')\"\n />\n </div>\n\n <GrButton variant=\"ghost\" size=\"sm\" :disabled=\"page <= 1\" @click=\"prev\">\n {{ t('gr.pagination.prev', 'Prev') }}\n </GrButton>\n\n <div class=\"flex items-center gap-1\">\n <button\n v-for=\"pageNumber in pages\"\n :key=\"pageNumber\"\n type=\"button\"\n data-ds-pagination-page\n :aria-current=\"pageNumber === page ? 'page' : undefined\"\n :aria-label=\"`Page ${pageNumber}`\"\n class=\"h-8 min-w-8 px-2 rounded-md text-sm font-600 transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]\"\n :class=\"pageNumber === page ? 'bg-[var(--primary)] text-[var(--primary-fg)]' : 'text-[var(--muted-fg)] hover:bg-[var(--muted)] hover:text-[var(--fg)]'\"\n @click=\"goTo(pageNumber)\"\n >\n {{ pageNumber }}\n </button>\n </div>\n\n <GrButton variant=\"ghost\" size=\"sm\" :disabled=\"page >= pageCount\" @click=\"next\">\n {{ t('gr.pagination.next', 'Next') }}\n </GrButton>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBA,MAAM,EAAE,MAAM,4BAA2B;EAEzC,MAAM,QAAQ;EAId,MAAM,OAAO;EAKb,MAAM,YAAY,eAAe,KAAK,IAAI,GAAG,KAAK,KAAK,MAAM,QAAQ,MAAM,SAAS,CAAC,CAAA;EAErF,MAAM,gBAAgB,SAAS;GAC7B,WAAW,OAAO,MAAM,SAAS;GACjC,MAAM,UAAkB,KAAK,mBAAmB,OAAO,MAAM,CAAC;GAC/D,CAAA;EAED,MAAM,kBAAkB,eACtB,MAAM,UAAU,KAAI,cAAa;GAC/B,OAAO,OAAO,SAAS;GACvB,OAAO,OAAO,SAAS;GACxB,EAAE,CACL;EAEA,MAAM,QAAQ,eAAe;GAC3B,MAAM,MAAM,UAAU;GACtB,MAAM,UAAU,MAAM;GACtB,MAAM,aAAa;GACnB,MAAM,OAAO,KAAK,MAAM,aAAa,EAAC;GAEtC,IAAI,QAAQ,KAAK,IAAI,GAAG,UAAU,KAAI;GACtC,MAAM,MAAM,KAAK,IAAI,KAAK,QAAQ,aAAa,EAAC;AAChD,WAAQ,KAAK,IAAI,GAAG,MAAM,aAAa,EAAC;GAExC,MAAM,OAAiB,EAAC;AACxB,QAAK,IAAI,OAAO,OAAO,QAAQ,KAAK,QAAQ,EAC1C,MAAK,KAAK,KAAI;AAEhB,UAAO;IACR;EAED,SAAS,KAAK,MAAoB;AAChC,QAAK,eAAe,KAAI;;EAG1B,SAAS,OAAa;AACpB,QAAK,KAAK,IAAI,GAAG,MAAM,OAAO,EAAE,CAAA;;EAGlC,SAAS,OAAa;AACpB,QAAK,KAAK,IAAI,UAAU,OAAO,MAAM,OAAO,EAAE,CAAA;;;uBAK9C,mBAqCM,OAAA;IApCJ,OAAM;IACN,sBAAA;IACA,MAAK;IACJ,cAAY,MAAA,EAAC,CAAA,0BAAA,aAAA;;IAEd,mBAMM,OANN,YAMM,CALJ,YAIE,kBAAA;iBAHS,cAAA;gFAAa,QAAA;KACrB,SAAS,gBAAA;KACT,cAAY,MAAA,EAAC,CAAA,0BAAA,YAAA;;;;;;IAIlB,YAEW,kBAAA;KAFD,SAAQ;KAAQ,MAAK;KAAM,UAAU,QAAA,QAAI;KAAQ,SAAO;;4BAC3B,CAAA,gBAAA,gBAAlC,MAAA,EAAC,CAAA,sBAAA,OAAA,CAAA,EAAA,EAAA,CAAA,CAAA;;;IAGN,mBAcM,OAdN,YAcM,EAAA,UAAA,KAAA,EAbJ,mBAYS,UAAA,MAAA,WAXc,MAAA,QAAd,eAAU;yBADnB,mBAYS,UAAA;MAVN,KAAK;MACN,MAAK;MACL,2BAAA;MACC,gBAAc,eAAe,QAAA,OAAI,SAAY,KAAA;MAC7C,cAAU,QAAU;MACrB,OAAK,eAAA,CAAC,wJACE,eAAe,QAAA,OAAI,iDAAA,wEAAA,CAAA;MAC1B,UAAK,WAAE,KAAK,WAAU;wBAEpB,WAAU,EAAA,IAAA,WAAA;;IAIjB,YAEW,kBAAA;KAFD,SAAQ;KAAQ,MAAK;KAAM,UAAU,QAAA,QAAQ,UAAA;KAAY,SAAO;;4BACnC,CAAA,gBAAA,gBAAlC,MAAA,EAAC,CAAA,sBAAA,OAAA,CAAA,EAAA,EAAA,CAAA,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { t } from "../../chunks/config-
|
|
3
|
-
export {
|
|
1
|
+
import { t as GrPagination_default } from "./chunks/GrPagination-BSTO6flk.js";
|
|
2
|
+
import { t as grPaginationConfig } from "../../chunks/config-C2iI7_QX.js";
|
|
3
|
+
export { GrPagination_default as GrPagination, GrPagination_default as default, grPaginationConfig };
|