ikoncomponents 1.5.7 → 1.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -36
- package/bin.js +2 -0
- package/dist/commands/init.js +63 -0
- package/dist/index.js +14 -116
- package/dist/utlis/copyDir.js +7 -0
- package/package.json +17 -91
- package/templates/default/hooks/use-mobile.ts +19 -0
- package/templates/default/ikonS/accordion.tsx +66 -0
- package/templates/default/ikonS/alert-dialog.tsx +179 -0
- package/templates/default/ikonS/alert.tsx +66 -0
- package/templates/default/ikonS/aspect-ratio.tsx +11 -0
- package/templates/default/ikonS/avatar.tsx +53 -0
- package/templates/default/ikonS/badge.tsx +49 -0
- package/templates/default/ikonS/breadcrumb.tsx +109 -0
- package/templates/default/ikonS/button.tsx +64 -0
- package/templates/default/ikonS/calendar.tsx +227 -0
- package/templates/default/ikonS/card.tsx +92 -0
- package/templates/default/ikonS/checkbox.tsx +33 -0
- package/templates/default/ikonS/collapsible.tsx +33 -0
- package/templates/default/ikonS/command.tsx +184 -0
- package/templates/default/ikonS/date-input.tsx +259 -0
- package/templates/default/ikonS/date-range-picker.tsx +103 -0
- package/templates/default/ikonS/dialog.tsx +143 -0
- package/templates/default/ikonS/drawer.tsx +134 -0
- package/templates/default/ikonS/dropdown-menu.tsx +259 -0
- package/templates/default/ikonS/form.tsx +166 -0
- package/templates/default/ikonS/hover-card.tsx +44 -0
- package/templates/default/ikonS/input-otp.tsx +71 -0
- package/templates/default/ikonS/input.tsx +22 -0
- package/templates/default/ikonS/label.tsx +24 -0
- package/templates/default/ikonS/navigation-menu.tsx +195 -0
- package/templates/default/ikonS/popover.tsx +48 -0
- package/templates/default/ikonS/progress.tsx +40 -0
- package/templates/default/ikonS/radio-group.tsx +45 -0
- package/templates/default/ikonS/scroll-area.tsx +58 -0
- package/templates/default/ikonS/select.tsx +184 -0
- package/templates/default/ikonS/separator.tsx +28 -0
- package/templates/default/ikonS/sheet.tsx +139 -0
- package/templates/default/ikonS/sidebar.tsx +726 -0
- package/templates/default/ikonS/skeleton.tsx +15 -0
- package/templates/default/ikonS/slider.tsx +64 -0
- package/templates/default/ikonS/sonner.tsx +25 -0
- package/templates/default/ikonS/switch.tsx +31 -0
- package/templates/default/ikonS/table.tsx +116 -0
- package/templates/default/ikonS/tabs.tsx +67 -0
- package/templates/default/ikonS/textarea.tsx +18 -0
- package/templates/default/ikonS/toggle-group.tsx +83 -0
- package/templates/default/ikonS/toggle.tsx +47 -0
- package/templates/default/ikonS/tooltip.tsx +65 -0
- package/templates/default/ikonS/workflow.tsx +119 -0
- package/templates/default/ikoncomponents/action-menu/index.tsx +108 -0
- package/templates/default/ikoncomponents/action-menu/type.ts +18 -0
- package/templates/default/ikoncomponents/activity-sheet/index.tsx +63 -0
- package/templates/default/ikoncomponents/alert-dialog/dialog-context.tsx +65 -0
- package/templates/default/ikoncomponents/alert-dialog/index.tsx +80 -0
- package/templates/default/ikoncomponents/app-breadcrumb/BreadcrumbProvider.tsx +68 -0
- package/templates/default/ikoncomponents/app-breadcrumb/index.tsx +222 -0
- package/templates/default/ikoncomponents/big-calendar/big-calender-event/index.tsx +38 -0
- package/templates/default/ikoncomponents/big-calendar/big-calender-toolbar/index.tsx +81 -0
- package/templates/default/ikoncomponents/big-calendar/index.css +879 -0
- package/templates/default/ikoncomponents/big-calendar/index.tsx +59 -0
- package/templates/default/ikoncomponents/big-calendar/type.ts +37 -0
- package/templates/default/ikoncomponents/buttons/index.tsx +127 -0
- package/templates/default/ikoncomponents/combobox-input/index.tsx +75 -0
- package/templates/default/ikoncomponents/combobox-input/type.ts +14 -0
- package/templates/default/ikoncomponents/custom-combo-dropdown/index.tsx +242 -0
- package/templates/default/ikoncomponents/data-table/datatable-column-filter/index.tsx +80 -0
- package/templates/default/ikoncomponents/data-table/datatable-faceted-filter/index.tsx +149 -0
- package/templates/default/ikoncomponents/data-table/datatable-filter-menu/index.tsx +98 -0
- package/templates/default/ikoncomponents/data-table/datatable-pagination/index.tsx +119 -0
- package/templates/default/ikoncomponents/data-table/datatable-toolbar/index.tsx +45 -0
- package/templates/default/ikoncomponents/data-table/function.ts +7 -0
- package/templates/default/ikoncomponents/data-table/index.tsx +549 -0
- package/templates/default/ikoncomponents/data-table/type.ts +75 -0
- package/templates/default/ikoncomponents/e-chart/index.tsx +183 -0
- package/templates/default/ikoncomponents/file-input/index.tsx +27 -0
- package/templates/default/ikoncomponents/fileUpload/index.tsx +121 -0
- package/templates/default/ikoncomponents/form-fields/combobox-input/index.tsx +111 -0
- package/templates/default/ikoncomponents/form-fields/combobox-input-value/index.tsx +121 -0
- package/templates/default/ikoncomponents/form-fields/date-input/index.tsx +80 -0
- package/templates/default/ikoncomponents/form-fields/file-input/index.tsx +9 -0
- package/templates/default/ikoncomponents/form-fields/input/index.tsx +27 -0
- package/{dist/ikoncomponents/form-fields/multi-combobox-input/index.js → templates/default/ikoncomponents/form-fields/multi-combobox-input/index.tsx} +574 -381
- package/templates/default/ikoncomponents/form-fields/otp-input/index.tsx +39 -0
- package/templates/default/ikoncomponents/form-fields/password-input/index.tsx +52 -0
- package/templates/default/ikoncomponents/form-fields/phone-input/index.tsx +7 -0
- package/templates/default/ikoncomponents/form-fields/textarea/index.tsx +28 -0
- package/templates/default/ikoncomponents/form-fields/types/index.ts +46 -0
- package/templates/default/ikoncomponents/glowing-effect/index.tsx +171 -0
- package/templates/default/ikoncomponents/icon/index.tsx +22 -0
- package/templates/default/ikoncomponents/image-cropper-upload/components/cropperImg.css +19 -0
- package/{dist/ikoncomponents/image-cropper-upload/components/newCropper.js → templates/default/ikoncomponents/image-cropper-upload/components/newCropper.tsx} +117 -85
- package/templates/default/ikoncomponents/image-cropper-upload/components/newImageUploadForm.tsx +352 -0
- package/templates/default/ikoncomponents/image-cropper-upload/cropper-form/index.tsx +250 -0
- package/templates/default/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.tsx +32 -0
- package/{dist/ikoncomponents/image-cropper-upload/image-cropper/index.js → templates/default/ikoncomponents/image-cropper-upload/image-cropper/index.tsx} +119 -87
- package/templates/default/ikoncomponents/image-cropper-upload/index.tsx +95 -0
- package/templates/default/ikoncomponents/image-cropper-upload/utils/index.ts +117 -0
- package/templates/default/ikoncomponents/loading-spinner/index.tsx +43 -0
- package/templates/default/ikoncomponents/main-layout/RefreshContext.tsx +30 -0
- package/templates/default/ikoncomponents/main-layout/SidebarNavContext.tsx +103 -0
- package/templates/default/ikoncomponents/main-layout/app-sidebar.tsx +36 -0
- package/templates/default/ikoncomponents/main-layout/footer.tsx +21 -0
- package/templates/default/ikoncomponents/main-layout/header.tsx +53 -0
- package/templates/default/ikoncomponents/main-layout/index.tsx +38 -0
- package/templates/default/ikoncomponents/main-layout/main-sidebar.tsx +389 -0
- package/templates/default/ikoncomponents/main-layout/nav-main.tsx +103 -0
- package/templates/default/ikoncomponents/multi-combobox/index.tsx +345 -0
- package/templates/default/ikoncomponents/no-data/index.tsx +11 -0
- package/templates/default/ikoncomponents/page-wrapper/index.tsx +30 -0
- package/templates/default/ikoncomponents/password-strength-meter/index.tsx +49 -0
- package/templates/default/ikoncomponents/phone-input/index.tsx +72 -0
- package/templates/default/ikoncomponents/provider-wrapper/index.tsx +32 -0
- package/templates/default/ikoncomponents/search-input/index.tsx +18 -0
- package/templates/default/ikoncomponents/sheet/index.tsx +34 -0
- package/templates/default/ikoncomponents/simple-widget/index.tsx +54 -0
- package/templates/default/ikoncomponents/skeleton-loader/skeleton-table.tsx +34 -0
- package/templates/default/ikoncomponents/skeleton-loader/skeleton-widget.tsx +13 -0
- package/templates/default/ikoncomponents/tabs/index.tsx +139 -0
- package/{dist/ikoncomponents/tabs/type.d.ts → templates/default/ikoncomponents/tabs/type.ts} +20 -19
- package/{dist/ikoncomponents/theme-toggle-btn/index.js → templates/default/ikoncomponents/theme-toggle-btn/index.tsx} +189 -118
- package/templates/default/ikoncomponents/title-progress/index.tsx +41 -0
- package/templates/default/ikoncomponents/tooltip/index.tsx +17 -0
- package/templates/default/ikoncomponents/twolevel-dropdown/convertToDropdownNodes.tsx +33 -0
- package/templates/default/ikoncomponents/twolevel-dropdown/index.tsx +279 -0
- package/templates/default/ikoncomponents/upload-tab/index.tsx +237 -0
- package/templates/default/ikoncomponents/widgets/index.tsx +81 -0
- package/templates/default/ikoncomponents/widgets/type.ts +11 -0
- package/templates/default/ikoncomponents/work-in-progress/index.tsx +16 -0
- package/templates/default/styles.css +1159 -0
- package/templates/default/utils/actions/account/index.ts +33 -0
- package/templates/default/utils/actions/account/type.ts +4 -0
- package/{dist/utils/actions/auth/index.js → templates/default/utils/actions/auth/index.ts} +69 -58
- package/templates/default/utils/actions/common/revalidate.ts +18 -0
- package/templates/default/utils/actions/common/type.ts +4 -0
- package/{dist/utils/actions/common/utils.js → templates/default/utils/actions/common/utils.ts} +28 -25
- package/templates/default/utils/actions/software/index.ts +106 -0
- package/templates/default/utils/api/accountService/index.ts +103 -0
- package/templates/default/utils/api/accountService/type.ts +4 -0
- package/templates/default/utils/api/file-upload/index.ts +103 -0
- package/templates/default/utils/api/file-upload/type.ts +8 -0
- package/{dist/utils/api/ikonBaseApi.js → templates/default/utils/api/ikonBaseApi.ts} +132 -104
- package/templates/default/utils/api/loginService/index.ts +106 -0
- package/{dist/utils/api/loginService/type.d.ts → templates/default/utils/api/loginService/type.ts} +35 -31
- package/templates/default/utils/api/softwareService/index.ts +356 -0
- package/templates/default/utils/api/softwareService/type.ts +62 -0
- package/{dist/utils/border-radius-provider.js → templates/default/utils/border-radius-provider.tsx} +59 -35
- package/templates/default/utils/cn.ts +6 -0
- package/{dist/utils/font-provider.js → templates/default/utils/font-provider.tsx} +61 -37
- package/templates/default/utils/session/cookieSession.ts +49 -0
- package/templates/default/utils/theme-provider/index.tsx +11 -0
- package/templates/default/utils/token-management/index.ts +115 -0
- package/templates/default/utils/token-management/types.ts +6 -0
- package/dist/hooks/use-mobile.d.ts +0 -1
- package/dist/hooks/use-mobile.js +0 -15
- package/dist/ikoncomponents/action-menu/index.d.ts +0 -5
- package/dist/ikoncomponents/action-menu/index.js +0 -42
- package/dist/ikoncomponents/action-menu/type.d.ts +0 -14
- package/dist/ikoncomponents/action-menu/type.js +0 -1
- package/dist/ikoncomponents/activity-sheet/index.d.ts +0 -11
- package/dist/ikoncomponents/activity-sheet/index.js +0 -23
- package/dist/ikoncomponents/alert-dialog/dialog-context.d.ts +0 -21
- package/dist/ikoncomponents/alert-dialog/dialog-context.js +0 -30
- package/dist/ikoncomponents/alert-dialog/index.d.ts +0 -14
- package/dist/ikoncomponents/alert-dialog/index.js +0 -20
- package/dist/ikoncomponents/app-breadcrumb/BreadcrumbProvider.d.ts +0 -18
- package/dist/ikoncomponents/app-breadcrumb/BreadcrumbProvider.js +0 -43
- package/dist/ikoncomponents/app-breadcrumb/index.d.ts +0 -5
- package/dist/ikoncomponents/app-breadcrumb/index.js +0 -57
- package/dist/ikoncomponents/big-calendar/big-calender-event/index.d.ts +0 -5
- package/dist/ikoncomponents/big-calendar/big-calender-event/index.js +0 -16
- package/dist/ikoncomponents/big-calendar/big-calender-toolbar/index.d.ts +0 -2
- package/dist/ikoncomponents/big-calendar/big-calender-toolbar/index.js +0 -39
- package/dist/ikoncomponents/big-calendar/index.d.ts +0 -3
- package/dist/ikoncomponents/big-calendar/index.js +0 -35
- package/dist/ikoncomponents/big-calendar/type.d.ts +0 -31
- package/dist/ikoncomponents/big-calendar/type.js +0 -1
- package/dist/ikoncomponents/buttons/index.d.ts +0 -18
- package/dist/ikoncomponents/buttons/index.js +0 -38
- package/dist/ikoncomponents/combobox-input/index.d.ts +0 -2
- package/dist/ikoncomponents/combobox-input/index.js +0 -18
- package/dist/ikoncomponents/combobox-input/type.d.ts +0 -13
- package/dist/ikoncomponents/combobox-input/type.js +0 -1
- package/dist/ikoncomponents/custom-combo-dropdown/index.d.ts +0 -21
- package/dist/ikoncomponents/custom-combo-dropdown/index.js +0 -85
- package/dist/ikoncomponents/data-table/datatable-column-filter/index.d.ts +0 -2
- package/dist/ikoncomponents/data-table/datatable-column-filter/index.js +0 -22
- package/dist/ikoncomponents/data-table/datatable-faceted-filter/index.d.ts +0 -2
- package/dist/ikoncomponents/data-table/datatable-faceted-filter/index.js +0 -35
- package/dist/ikoncomponents/data-table/datatable-filter-menu/index.d.ts +0 -2
- package/dist/ikoncomponents/data-table/datatable-filter-menu/index.js +0 -38
- package/dist/ikoncomponents/data-table/datatable-pagination/index.d.ts +0 -2
- package/dist/ikoncomponents/data-table/datatable-pagination/index.js +0 -13
- package/dist/ikoncomponents/data-table/datatable-toolbar/index.d.ts +0 -2
- package/dist/ikoncomponents/data-table/datatable-toolbar/index.js +0 -18
- package/dist/ikoncomponents/data-table/function.d.ts +0 -1
- package/dist/ikoncomponents/data-table/function.js +0 -6
- package/dist/ikoncomponents/data-table/index.d.ts +0 -2
- package/dist/ikoncomponents/data-table/index.js +0 -223
- package/dist/ikoncomponents/data-table/type.d.ts +0 -60
- package/dist/ikoncomponents/data-table/type.js +0 -1
- package/dist/ikoncomponents/e-chart/index.d.ts +0 -15
- package/dist/ikoncomponents/e-chart/index.js +0 -115
- package/dist/ikoncomponents/file-input/index.d.ts +0 -1
- package/dist/ikoncomponents/file-input/index.js +0 -21
- package/dist/ikoncomponents/fileUpload/index.d.ts +0 -15
- package/dist/ikoncomponents/fileUpload/index.js +0 -69
- package/dist/ikoncomponents/form-fields/combobox-input/index.d.ts +0 -2
- package/dist/ikoncomponents/form-fields/combobox-input/index.js +0 -21
- package/dist/ikoncomponents/form-fields/combobox-input-value/index.d.ts +0 -18
- package/dist/ikoncomponents/form-fields/combobox-input-value/index.js +0 -26
- package/dist/ikoncomponents/form-fields/date-input/index.d.ts +0 -2
- package/dist/ikoncomponents/form-fields/date-input/index.js +0 -15
- package/dist/ikoncomponents/form-fields/file-input/index.d.ts +0 -1
- package/dist/ikoncomponents/form-fields/file-input/index.js +0 -4
- package/dist/ikoncomponents/form-fields/input/index.d.ts +0 -2
- package/dist/ikoncomponents/form-fields/input/index.js +0 -18
- package/dist/ikoncomponents/form-fields/multi-combobox-input/index.d.ts +0 -6
- package/dist/ikoncomponents/form-fields/otp-input/index.d.ts +0 -2
- package/dist/ikoncomponents/form-fields/otp-input/index.js +0 -18
- package/dist/ikoncomponents/form-fields/phone-input/index.d.ts +0 -1
- package/dist/ikoncomponents/form-fields/phone-input/index.js +0 -4
- package/dist/ikoncomponents/form-fields/textarea/index.d.ts +0 -2
- package/dist/ikoncomponents/form-fields/textarea/index.js +0 -18
- package/dist/ikoncomponents/form-fields/types/index.d.ts +0 -36
- package/dist/ikoncomponents/form-fields/types/index.js +0 -1
- package/dist/ikoncomponents/glowing-effect/index.d.ts +0 -14
- package/dist/ikoncomponents/glowing-effect/index.js +0 -84
- package/dist/ikoncomponents/icon/index.d.ts +0 -8
- package/dist/ikoncomponents/icon/index.js +0 -23
- package/dist/ikoncomponents/image-cropper-upload/components/newCropper.d.ts +0 -15
- package/dist/ikoncomponents/image-cropper-upload/components/newImageUploadForm.d.ts +0 -7
- package/dist/ikoncomponents/image-cropper-upload/components/newImageUploadForm.js +0 -145
- package/dist/ikoncomponents/image-cropper-upload/cropper-form/index.d.ts +0 -6
- package/dist/ikoncomponents/image-cropper-upload/cropper-form/index.js +0 -92
- package/dist/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.d.ts +0 -6
- package/dist/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.js +0 -14
- package/dist/ikoncomponents/image-cropper-upload/image-cropper/index.d.ts +0 -14
- package/dist/ikoncomponents/image-cropper-upload/index.d.ts +0 -27
- package/dist/ikoncomponents/image-cropper-upload/index.js +0 -49
- package/dist/ikoncomponents/image-cropper-upload/utils/index.d.ts +0 -16
- package/dist/ikoncomponents/image-cropper-upload/utils/index.js +0 -73
- package/dist/ikoncomponents/loading-spinner/index.d.ts +0 -9
- package/dist/ikoncomponents/loading-spinner/index.js +0 -19
- package/dist/ikoncomponents/main-layout/RefreshContext.d.ts +0 -10
- package/dist/ikoncomponents/main-layout/RefreshContext.js +0 -17
- package/dist/ikoncomponents/main-layout/SidebarNavContext.d.ts +0 -33
- package/dist/ikoncomponents/main-layout/SidebarNavContext.js +0 -52
- package/dist/ikoncomponents/main-layout/app-sidebar.d.ts +0 -3
- package/dist/ikoncomponents/main-layout/app-sidebar.js +0 -24
- package/dist/ikoncomponents/main-layout/footer.d.ts +0 -1
- package/dist/ikoncomponents/main-layout/footer.js +0 -5
- package/dist/ikoncomponents/main-layout/header.d.ts +0 -3
- package/dist/ikoncomponents/main-layout/header.js +0 -15
- package/dist/ikoncomponents/main-layout/index.d.ts +0 -6
- package/dist/ikoncomponents/main-layout/index.js +0 -11
- package/dist/ikoncomponents/main-layout/main-sidebar.d.ts +0 -60
- package/dist/ikoncomponents/main-layout/main-sidebar.js +0 -119
- package/dist/ikoncomponents/main-layout/nav-main.d.ts +0 -11
- package/dist/ikoncomponents/main-layout/nav-main.js +0 -33
- package/dist/ikoncomponents/multi-combobox/index.d.ts +0 -13
- package/dist/ikoncomponents/multi-combobox/index.js +0 -202
- package/dist/ikoncomponents/no-data/index.d.ts +0 -3
- package/dist/ikoncomponents/no-data/index.js +0 -5
- package/dist/ikoncomponents/page-wrapper/index.d.ts +0 -9
- package/dist/ikoncomponents/page-wrapper/index.js +0 -7
- package/dist/ikoncomponents/password-strength-meter/index.d.ts +0 -3
- package/dist/ikoncomponents/password-strength-meter/index.js +0 -40
- package/dist/ikoncomponents/phone-input/index.d.ts +0 -1
- package/dist/ikoncomponents/phone-input/index.js +0 -41
- package/dist/ikoncomponents/provider-wrapper/index.d.ts +0 -6
- package/dist/ikoncomponents/provider-wrapper/index.js +0 -11
- package/dist/ikoncomponents/search-input/index.d.ts +0 -1
- package/dist/ikoncomponents/search-input/index.js +0 -19
- package/dist/ikoncomponents/sheet/index.d.ts +0 -10
- package/dist/ikoncomponents/sheet/index.js +0 -6
- package/dist/ikoncomponents/simple-widget/index.d.ts +0 -14
- package/dist/ikoncomponents/simple-widget/index.js +0 -14
- package/dist/ikoncomponents/skeleton-loader/skeleton-table.d.ts +0 -5
- package/dist/ikoncomponents/skeleton-loader/skeleton-table.js +0 -6
- package/dist/ikoncomponents/skeleton-loader/skeleton-widget.d.ts +0 -3
- package/dist/ikoncomponents/skeleton-loader/skeleton-widget.js +0 -5
- package/dist/ikoncomponents/tabs/index.d.ts +0 -2
- package/dist/ikoncomponents/tabs/index.js +0 -50
- package/dist/ikoncomponents/tabs/type.js +0 -2
- package/dist/ikoncomponents/theme-toggle-btn/index.d.ts +0 -1
- package/dist/ikoncomponents/title-progress/index.d.ts +0 -12
- package/dist/ikoncomponents/title-progress/index.js +0 -10
- package/dist/ikoncomponents/tooltip/index.d.ts +0 -5
- package/dist/ikoncomponents/tooltip/index.js +0 -5
- package/dist/ikoncomponents/twolevel-dropdown/index.d.ts +0 -31
- package/dist/ikoncomponents/twolevel-dropdown/index.js +0 -143
- package/dist/ikoncomponents/upload-tab/index.d.ts +0 -1
- package/dist/ikoncomponents/upload-tab/index.js +0 -92
- package/dist/ikoncomponents/widgets/index.d.ts +0 -2
- package/dist/ikoncomponents/widgets/index.js +0 -14
- package/dist/ikoncomponents/widgets/type.d.ts +0 -10
- package/dist/ikoncomponents/widgets/type.js +0 -2
- package/dist/ikoncomponents/work-in-progress/index.d.ts +0 -1
- package/dist/ikoncomponents/work-in-progress/index.js +0 -4
- package/dist/index.d.ts +0 -138
- package/dist/shadcn/accordion.d.ts +0 -7
- package/dist/shadcn/accordion.js +0 -33
- package/dist/shadcn/alert-dialog.d.ts +0 -20
- package/dist/shadcn/alert-dialog.js +0 -83
- package/dist/shadcn/alert.d.ts +0 -9
- package/dist/shadcn/alert.js +0 -38
- package/dist/shadcn/aspect-ratio.d.ts +0 -3
- package/dist/shadcn/aspect-ratio.js +0 -19
- package/dist/shadcn/avatar.d.ts +0 -6
- package/dist/shadcn/avatar.js +0 -28
- package/dist/shadcn/badge.d.ts +0 -9
- package/dist/shadcn/badge.js +0 -35
- package/dist/shadcn/breadcrumb.d.ts +0 -11
- package/dist/shadcn/breadcrumb.js +0 -45
- package/dist/shadcn/button.d.ts +0 -10
- package/dist/shadcn/button.js +0 -47
- package/dist/shadcn/calendar.d.ts +0 -8
- package/dist/shadcn/calendar.js +0 -61
- package/dist/shadcn/card.d.ts +0 -9
- package/dist/shadcn/card.js +0 -42
- package/dist/shadcn/checkbox.d.ts +0 -4
- package/dist/shadcn/checkbox.js +0 -21
- package/dist/shadcn/collapsible.d.ts +0 -5
- package/dist/shadcn/collapsible.js +0 -27
- package/dist/shadcn/command.d.ts +0 -18
- package/dist/shadcn/command.js +0 -54
- package/dist/shadcn/date-input.d.ts +0 -7
- package/dist/shadcn/date-input.js +0 -179
- package/dist/shadcn/date-range-picker.d.ts +0 -24
- package/dist/shadcn/date-range-picker.js +0 -45
- package/dist/shadcn/dialog.d.ts +0 -15
- package/dist/shadcn/dialog.js +0 -57
- package/dist/shadcn/drawer.d.ts +0 -13
- package/dist/shadcn/drawer.js +0 -56
- package/dist/shadcn/dropdown-menu.d.ts +0 -25
- package/dist/shadcn/dropdown-menu.js +0 -77
- package/dist/shadcn/form.d.ts +0 -24
- package/dist/shadcn/form.js +0 -70
- package/dist/shadcn/hover-card.d.ts +0 -6
- package/dist/shadcn/hover-card.js +0 -28
- package/dist/shadcn/input-otp.d.ts +0 -34
- package/dist/shadcn/input-otp.js +0 -40
- package/dist/shadcn/input.d.ts +0 -3
- package/dist/shadcn/input.js +0 -18
- package/dist/shadcn/label.d.ts +0 -4
- package/dist/shadcn/label.js +0 -20
- package/dist/shadcn/navigation-menu.d.ts +0 -16
- package/dist/shadcn/navigation-menu.js +0 -74
- package/dist/shadcn/popover.d.ts +0 -7
- package/dist/shadcn/popover.js +0 -32
- package/dist/shadcn/progress.d.ts +0 -8
- package/dist/shadcn/progress.js +0 -23
- package/dist/shadcn/radio-group.d.ts +0 -5
- package/dist/shadcn/radio-group.js +0 -25
- package/dist/shadcn/scroll-area.d.ts +0 -5
- package/dist/shadcn/scroll-area.js +0 -26
- package/dist/shadcn/select.d.ts +0 -15
- package/dist/shadcn/select.js +0 -59
- package/dist/shadcn/separator.d.ts +0 -4
- package/dist/shadcn/separator.js +0 -20
- package/dist/shadcn/sheet.d.ts +0 -13
- package/dist/shadcn/sheet.js +0 -61
- package/dist/shadcn/sidebar.d.ts +0 -69
- package/dist/shadcn/sidebar.js +0 -242
- package/dist/shadcn/skeleton.d.ts +0 -3
- package/dist/shadcn/skeleton.js +0 -18
- package/dist/shadcn/slider.d.ts +0 -4
- package/dist/shadcn/slider.js +0 -26
- package/dist/shadcn/sonner.d.ts +0 -3
- package/dist/shadcn/sonner.js +0 -25
- package/dist/shadcn/switch.d.ts +0 -4
- package/dist/shadcn/switch.js +0 -20
- package/dist/shadcn/table.d.ts +0 -10
- package/dist/shadcn/table.js +0 -47
- package/dist/shadcn/tabs.d.ts +0 -7
- package/dist/shadcn/tabs.js +0 -32
- package/dist/shadcn/textarea.d.ts +0 -3
- package/dist/shadcn/textarea.js +0 -18
- package/dist/shadcn/toggle-group.d.ts +0 -9
- package/dist/shadcn/toggle-group.js +0 -35
- package/dist/shadcn/toggle.d.ts +0 -9
- package/dist/shadcn/toggle.js +0 -38
- package/dist/shadcn/tooltip.d.ts +0 -7
- package/dist/shadcn/tooltip.js +0 -32
- package/dist/shadcn/workflow.d.ts +0 -20
- package/dist/shadcn/workflow.js +0 -20
- package/dist/styles.css +0 -6163
- package/dist/utils/actions/account/index.d.ts +0 -5
- package/dist/utils/actions/account/index.js +0 -28
- package/dist/utils/actions/account/type.d.ts +0 -4
- package/dist/utils/actions/account/type.js +0 -1
- package/dist/utils/actions/auth/index.d.ts +0 -7
- package/dist/utils/actions/common/utils.d.ts +0 -5
- package/dist/utils/actions/software/index.d.ts +0 -11
- package/dist/utils/actions/software/index.js +0 -75
- package/dist/utils/api/accountService/index.d.ts +0 -23
- package/dist/utils/api/accountService/index.js +0 -64
- package/dist/utils/api/accountService/type.d.ts +0 -4
- package/dist/utils/api/accountService/type.js +0 -1
- package/dist/utils/api/file-upload/index.d.ts +0 -5
- package/dist/utils/api/file-upload/index.js +0 -80
- package/dist/utils/api/file-upload/type.d.ts +0 -6
- package/dist/utils/api/file-upload/type.js +0 -1
- package/dist/utils/api/ikonBaseApi.d.ts +0 -12
- package/dist/utils/api/loginService/index.d.ts +0 -12
- package/dist/utils/api/loginService/index.js +0 -72
- package/dist/utils/api/loginService/type.js +0 -1
- package/dist/utils/api/softwareService/index.d.ts +0 -64
- package/dist/utils/api/softwareService/index.js +0 -212
- package/dist/utils/api/softwareService/type.d.ts +0 -54
- package/dist/utils/api/softwareService/type.js +0 -1
- package/dist/utils/border-radius-provider.d.ts +0 -11
- package/dist/utils/cn.d.ts +0 -2
- package/dist/utils/cn.js +0 -5
- package/dist/utils/font-provider.d.ts +0 -11
- package/dist/utils/session/cookieSession.d.ts +0 -8
- package/dist/utils/session/cookieSession.js +0 -33
- package/dist/utils/theme-provider/index.d.ts +0 -3
- package/dist/utils/theme-provider/index.js +0 -18
- package/dist/utils/token-management/index.d.ts +0 -10
- package/dist/utils/token-management/index.js +0 -69
- package/dist/utils/token-management/types.d.ts +0 -6
- package/dist/utils/token-management/types.js +0 -1
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { TooltipComponent as Tooltip } from "../tooltip";
|
|
14
|
-
import { Button } from "../../shadcn/button";
|
|
15
|
-
export function TextButton(_a) {
|
|
16
|
-
var { children, variant, asChild = false, size } = _a, props = __rest(_a, ["children", "variant", "asChild", "size"]);
|
|
17
|
-
return (_jsx(Button, Object.assign({ variant: variant, size: size }, props, { asChild: asChild, children: children })));
|
|
18
|
-
}
|
|
19
|
-
export function TextButtonWithTooltip(_a) {
|
|
20
|
-
var { children, variant, asChild = false, size, tooltipContent } = _a, props = __rest(_a, ["children", "variant", "asChild", "size", "tooltipContent"]);
|
|
21
|
-
return (_jsx(Tooltip, { tooltipContent: tooltipContent, children: _jsx(TextButton, Object.assign({ variant: variant, size: size }, props, { asChild: asChild, children: children })) }));
|
|
22
|
-
}
|
|
23
|
-
export function IconTextButton(_a) {
|
|
24
|
-
var { children, variant, asChild = false, size } = _a, props = __rest(_a, ["children", "variant", "asChild", "size"]);
|
|
25
|
-
return (_jsx(Button, Object.assign({ variant: variant || "outline", size: size || "sm" }, props, { asChild: asChild, children: children })));
|
|
26
|
-
}
|
|
27
|
-
export function IconTextButtonWithTooltip(_a) {
|
|
28
|
-
var { children, variant, size, asChild = false, tooltipContent } = _a, props = __rest(_a, ["children", "variant", "size", "asChild", "tooltipContent"]);
|
|
29
|
-
return (_jsx(Tooltip, { tooltipContent: tooltipContent, children: _jsx(IconTextButton, Object.assign({ variant: variant, size: size }, props, { asChild: asChild, children: children })) }));
|
|
30
|
-
}
|
|
31
|
-
export function IconButton(_a) {
|
|
32
|
-
var { children, variant, size, asChild = false } = _a, props = __rest(_a, ["children", "variant", "size", "asChild"]);
|
|
33
|
-
return (_jsx(Button, Object.assign({ variant: variant || "outline", size: size || "icon" }, props, { asChild: asChild, children: children })));
|
|
34
|
-
}
|
|
35
|
-
export function IconButtonWithTooltip(_a) {
|
|
36
|
-
var { children, tooltipContent, asChild = false, variant, size } = _a, props = __rest(_a, ["children", "tooltipContent", "asChild", "variant", "size"]);
|
|
37
|
-
return (_jsx(Tooltip, { tooltipContent: tooltipContent, children: _jsx(IconButton, Object.assign({ variant: variant, size: size }, props, { asChild: asChild, children: children })) }));
|
|
38
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { Popover, PopoverContent, PopoverTrigger } from "../../shadcn/popover";
|
|
4
|
-
import { Button } from "../../shadcn/button";
|
|
5
|
-
import { Check, ChevronsUpDown } from "lucide-react";
|
|
6
|
-
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "../../shadcn/command";
|
|
7
|
-
import { cn } from "../../utils/cn";
|
|
8
|
-
export function ComboboxInput({ placeholder, items, disabled, onSelect, defaultValue }) {
|
|
9
|
-
var _a;
|
|
10
|
-
const [value, setValue] = useState(defaultValue ? defaultValue : '');
|
|
11
|
-
return (_jsx(_Fragment, { children: _jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, className: "w-full", children: _jsxs(Button, { variant: "outline", role: "combobox", className: cn("justify-between", !value && "text-muted-foreground", "bg-secondary"), disabled: disabled == true || (disabled && disabled(...arguments)), children: [value
|
|
12
|
-
? ((_a = items.find((item) => item.value === value)) === null || _a === void 0 ? void 0 : _a.label) || value
|
|
13
|
-
: placeholder, _jsx(ChevronsUpDown, { className: "opacity-50" })] }) }), _jsx(PopoverContent, { className: "p-0", align: "start", children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: "Search..." }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: "No items found." }), _jsx(CommandGroup, { children: items.map((item) => (_jsxs(CommandItem, { value: item.value, disabled: item.disabled == true ||
|
|
14
|
-
(item.disabled && item.disabled(item)), onSelect: (value) => {
|
|
15
|
-
setValue(value);
|
|
16
|
-
onSelect && onSelect(value);
|
|
17
|
-
}, children: [(item === null || item === void 0 ? void 0 : item.label) || item.value, _jsx(Check, { className: cn("ml-auto", item.value === value ? "opacity-100" : "opacity-0") })] }, item.value))) })] })] }) })] }) }));
|
|
18
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface ComboBoxInputProps {
|
|
2
|
-
placeholder?: string;
|
|
3
|
-
items: ComboboxItemProps[];
|
|
4
|
-
onSelect?: (value: string | string[]) => void;
|
|
5
|
-
disabled?: ((...args: any) => boolean) | boolean;
|
|
6
|
-
defaultValue?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface ComboboxItemProps {
|
|
9
|
-
value: string;
|
|
10
|
-
label?: string | undefined;
|
|
11
|
-
extra?: any;
|
|
12
|
-
disabled?: ((...args: any) => boolean) | boolean;
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
export type Option = {
|
|
3
|
-
value: string;
|
|
4
|
-
label: string;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
};
|
|
7
|
-
type CustomComboboxInputProps = {
|
|
8
|
-
formControl: any;
|
|
9
|
-
name: string;
|
|
10
|
-
label?: string | React.ReactNode;
|
|
11
|
-
options: Option[];
|
|
12
|
-
placeholder?: string;
|
|
13
|
-
emptyMessage?: string;
|
|
14
|
-
onValueChange?: (value: string) => void;
|
|
15
|
-
className?: string;
|
|
16
|
-
addNewPlaceholder?: string;
|
|
17
|
-
formDescription?: string;
|
|
18
|
-
disabled?: boolean;
|
|
19
|
-
};
|
|
20
|
-
export declare function CustomComboboxInput({ formControl, name, label, options, placeholder, emptyMessage, onValueChange, className, addNewPlaceholder, formDescription, disabled, }: CustomComboboxInputProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
export {};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { Check, ChevronsUpDown, Plus } from "lucide-react";
|
|
5
|
-
import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "../../shadcn/form";
|
|
6
|
-
import { cn } from "../../utils/cn";
|
|
7
|
-
import { Button } from "../../shadcn/button";
|
|
8
|
-
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../../shadcn/command";
|
|
9
|
-
import { Popover, PopoverContent, PopoverTrigger } from "../../shadcn/popover";
|
|
10
|
-
import { Input } from "../../shadcn/input";
|
|
11
|
-
export function CustomComboboxInput({ formControl, name, label, options, placeholder = "Select an option", emptyMessage = "No options found.", onValueChange, className, addNewPlaceholder = "Add custom value...", formDescription, disabled, }) {
|
|
12
|
-
const [open, setOpen] = React.useState(false);
|
|
13
|
-
const [searchValue, setSearchValue] = React.useState("");
|
|
14
|
-
const [items, setItems] = React.useState(options);
|
|
15
|
-
const [isAddingNew, setIsAddingNew] = React.useState(false);
|
|
16
|
-
const [newValue, setNewValue] = React.useState("");
|
|
17
|
-
React.useEffect(() => {
|
|
18
|
-
setItems(options);
|
|
19
|
-
}, [options]);
|
|
20
|
-
return (_jsx(FormField, { control: formControl, name: name, render: ({ field }) => {
|
|
21
|
-
const selectedItem = items.find((item) => item.value === field.value);
|
|
22
|
-
const handleAddNewItem = () => {
|
|
23
|
-
const trimmedValue = newValue.trim();
|
|
24
|
-
if (!trimmedValue)
|
|
25
|
-
return;
|
|
26
|
-
if (items.some((item) => item.value === trimmedValue)) {
|
|
27
|
-
const existingItem = items.find(i => i.value === trimmedValue);
|
|
28
|
-
if (existingItem) {
|
|
29
|
-
field.onChange(existingItem.value);
|
|
30
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(existingItem.value);
|
|
31
|
-
setNewValue("");
|
|
32
|
-
setIsAddingNew(false);
|
|
33
|
-
setOpen(false);
|
|
34
|
-
setSearchValue("");
|
|
35
|
-
}
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const newOption = {
|
|
39
|
-
value: trimmedValue,
|
|
40
|
-
label: trimmedValue,
|
|
41
|
-
disabled: true,
|
|
42
|
-
};
|
|
43
|
-
setItems((prev) => [...prev, newOption]);
|
|
44
|
-
field.onChange(trimmedValue);
|
|
45
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(trimmedValue);
|
|
46
|
-
setNewValue("");
|
|
47
|
-
setIsAddingNew(false);
|
|
48
|
-
setOpen(false);
|
|
49
|
-
setSearchValue("");
|
|
50
|
-
};
|
|
51
|
-
return (_jsxs(FormItem, { className: cn(className), children: [label && (_jsxs(_Fragment, { children: [_jsx(FormLabel, { children: label }), _jsx("br", {})] })), _jsxs(Popover, { open: open, onOpenChange: (isOpen) => {
|
|
52
|
-
setOpen(isOpen);
|
|
53
|
-
if (!isOpen) {
|
|
54
|
-
setSearchValue("");
|
|
55
|
-
setIsAddingNew(false);
|
|
56
|
-
setNewValue("");
|
|
57
|
-
}
|
|
58
|
-
}, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(FormControl, { children: _jsxs(Button, { variant: "outline", role: "combobox", "aria-expanded": open, className: cn("w-full justify-between", !field.value && "text-foreground/50", className), disabled: disabled || field.disabled, children: [_jsx("span", { className: "line-clamp-1 text-left", children: field.value
|
|
59
|
-
? selectedItem
|
|
60
|
-
? selectedItem.label
|
|
61
|
-
: field.value
|
|
62
|
-
: placeholder }), _jsx(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })] }) }) }), _jsx(PopoverContent, { className: "p-0 w-[--radix-popover-trigger-width]", align: "start", children: _jsxs(Command, { shouldFilter: true, children: [_jsx(CommandInput, { placeholder: "Search...", value: searchValue, onValueChange: setSearchValue }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: searchValue && items.length > 0 ? "No results found." : emptyMessage }), _jsx(CommandGroup, { children: items
|
|
63
|
-
.filter(item => item.label.toLowerCase().includes(searchValue.toLowerCase()) || item.value.toLowerCase().includes(searchValue.toLowerCase()))
|
|
64
|
-
.map((item) => (_jsxs(CommandItem, { value: item.value, onSelect: (currentValue) => {
|
|
65
|
-
field.onChange(currentValue);
|
|
66
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(currentValue);
|
|
67
|
-
setOpen(false);
|
|
68
|
-
setSearchValue("");
|
|
69
|
-
}, className: "cursor-pointer", disabled: item === null || item === void 0 ? void 0 : item.disabled, children: [_jsx(Check, { className: cn("mr-2 h-4 w-4", field.value === item.value
|
|
70
|
-
? "opacity-100"
|
|
71
|
-
: "opacity-0") }), item.label] }, item.value))) })] }), _jsx("div", { className: "border-t p-2", children: isAddingNew ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { placeholder: addNewPlaceholder, value: newValue, onChange: (e) => setNewValue(e.target.value), onKeyDown: (e) => {
|
|
72
|
-
if (e.key === "Enter") {
|
|
73
|
-
e.preventDefault();
|
|
74
|
-
handleAddNewItem();
|
|
75
|
-
}
|
|
76
|
-
if (e.key === "Escape") {
|
|
77
|
-
setIsAddingNew(false);
|
|
78
|
-
setNewValue("");
|
|
79
|
-
}
|
|
80
|
-
}, autoFocus: true, className: "h-8" }), _jsx(Button, { size: "sm", variant: "ghost", onClick: () => {
|
|
81
|
-
setIsAddingNew(false);
|
|
82
|
-
setNewValue("");
|
|
83
|
-
}, className: "h-8", children: "Cancel" }), _jsx(Button, { size: "sm", variant: "default", onClick: handleAddNewItem, className: "h-8", disabled: !newValue.trim() || items.some(item => item.value === newValue.trim()), children: "Add" })] })) : (_jsxs(Button, { variant: "outline", className: "w-full justify-start", onClick: () => setIsAddingNew(true), children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), "Add new option"] })) })] }) })] }), formDescription && (_jsx(FormDescription, { children: formDescription })), _jsx(FormMessage, {})] }));
|
|
84
|
-
} }));
|
|
85
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "../../../shadcn/command";
|
|
3
|
-
import { Popover, PopoverContent, PopoverTrigger } from "../../../shadcn/popover";
|
|
4
|
-
import { Check, Settings2 } from "lucide-react";
|
|
5
|
-
import { getDataTableColumnTitle } from "../function";
|
|
6
|
-
import { TooltipComponent as Tooltip } from "../../tooltip";
|
|
7
|
-
import { IconTextButton } from "../../buttons";
|
|
8
|
-
import { cn } from "../../../utils/cn";
|
|
9
|
-
export function DataTableColumnFilter({ table, }) {
|
|
10
|
-
return (_jsxs(Popover, { children: [_jsx(Tooltip, { tooltipContent: "Column View", children: _jsx(PopoverTrigger, { asChild: true, children: _jsxs(IconTextButton, { children: [_jsx(Settings2, {}), "View"] }) }) }), _jsx(PopoverContent, { className: "w-[220px] p-0", align: "end", children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: "Search..." }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: "No results found." }), _jsx(CommandGroup, { children: table
|
|
11
|
-
.getAllColumns()
|
|
12
|
-
.filter((column) => typeof column.accessorFn !== "undefined" &&
|
|
13
|
-
column.getCanHide())
|
|
14
|
-
.map((column) => {
|
|
15
|
-
const isVisbile = column.getIsVisible();
|
|
16
|
-
return (_jsxs(CommandItem, { onSelect: () => {
|
|
17
|
-
column.toggleVisibility(!isVisbile);
|
|
18
|
-
}, disabled: column.getIsGrouped(), children: [_jsx("div", { className: cn("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white", isVisbile
|
|
19
|
-
? "bg-black dark:bg-white text-white dark:text-black"
|
|
20
|
-
: "opacity-50 [&_svg]:invisible"), children: _jsx(Check, {}) }), _jsx("span", { className: "overflow-hidden text-ellipsis", title: getDataTableColumnTitle(column), children: getDataTableColumnTitle(column) })] }, column.id));
|
|
21
|
-
}) })] })] }) })] }));
|
|
22
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { Check, Plus, X } from "lucide-react";
|
|
4
|
-
import { cn } from "../../../utils/cn";
|
|
5
|
-
import { Badge } from "../../../shadcn/badge";
|
|
6
|
-
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, } from "../../../shadcn/command";
|
|
7
|
-
import { Popover, PopoverContent, PopoverTrigger } from "../../../shadcn/popover";
|
|
8
|
-
import { Separator } from "../../../shadcn/separator";
|
|
9
|
-
import { getDataTableColumnTitle } from "../function";
|
|
10
|
-
import { IconTextButtonWithTooltip } from "../../buttons";
|
|
11
|
-
export function DataTableFacetedFilter({ column, }) {
|
|
12
|
-
const facets = column === null || column === void 0 ? void 0 : column.getFacetedUniqueValues();
|
|
13
|
-
const selectedValues = new Set(column === null || column === void 0 ? void 0 : column.getFilterValue());
|
|
14
|
-
const sortedUniqueValues = React.useMemo(() => Array.from(column.getFacetedUniqueValues().keys()).sort().slice(0, 5000), [column.getFacetedUniqueValues()]);
|
|
15
|
-
return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(IconTextButtonWithTooltip, { variant: "dashed", tooltipContent: getDataTableColumnTitle(column), children: [(selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.size) > 0 ?
|
|
16
|
-
_jsx(X, {})
|
|
17
|
-
:
|
|
18
|
-
_jsx(Plus, {}), getDataTableColumnTitle(column), (selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.size) > 0 && (_jsxs(_Fragment, { children: [_jsx(Separator, { orientation: "vertical", className: "mx-2 h-4" }), _jsx(Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal lg:hidden", children: selectedValues.size }), _jsx("div", { className: "hidden space-x-1 lg:flex", children: selectedValues.size > 2 ? (_jsxs(Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal", children: [selectedValues.size, " selected"] })) : (sortedUniqueValues
|
|
19
|
-
.filter((option) => selectedValues.has(option))
|
|
20
|
-
.map((option) => (_jsx(Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal", children: option }, option)))) })] }))] }) }), _jsx(PopoverContent, { className: "max-w-[250px] p-0", align: "start", children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: getDataTableColumnTitle(column) }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: "No results found." }), _jsx(CommandGroup, { children: sortedUniqueValues.map((option) => {
|
|
21
|
-
const isSelected = selectedValues.has(option);
|
|
22
|
-
return (_jsxs(CommandItem, { onSelect: () => {
|
|
23
|
-
if (isSelected) {
|
|
24
|
-
selectedValues.delete(option);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
selectedValues.add(option);
|
|
28
|
-
}
|
|
29
|
-
const filterValues = Array.from(selectedValues);
|
|
30
|
-
column === null || column === void 0 ? void 0 : column.setFilterValue(filterValues.length ? filterValues : undefined);
|
|
31
|
-
}, children: [_jsx("div", { className: cn("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white", isSelected
|
|
32
|
-
? "bg-black dark:bg-white text-white dark:text-black"
|
|
33
|
-
: "opacity-50 [&_svg]:invisible"), children: _jsx(Check, {}) }), _jsx("span", { className: "overflow-hidden text-ellipsis", title: option, children: option }), (facets === null || facets === void 0 ? void 0 : facets.get(option)) && (_jsx("span", { className: "ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs", children: facets.get(option) }))] }, option));
|
|
34
|
-
}) })] }), selectedValues.size > 0 && (_jsxs(_Fragment, { children: [_jsx(CommandSeparator, {}), _jsx(CommandGroup, { children: _jsx(CommandItem, { onSelect: () => column === null || column === void 0 ? void 0 : column.setFilterValue(undefined), className: "justify-center text-center", children: "Clear filters" }) })] }))] }) })] }));
|
|
35
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "../../../shadcn/command";
|
|
4
|
-
import { Popover, PopoverContent, PopoverTrigger } from "../../../shadcn/popover";
|
|
5
|
-
import { cn } from "../../../utils/cn";
|
|
6
|
-
import { useState } from "react";
|
|
7
|
-
import { TooltipComponent as Tooltip } from "../../tooltip";
|
|
8
|
-
import { IconTextButton } from "../../buttons";
|
|
9
|
-
import { Check, Filter } from "lucide-react";
|
|
10
|
-
import { getDataTableColumnTitle } from "../function";
|
|
11
|
-
import { DataTableFacetedFilter } from "../datatable-faceted-filter";
|
|
12
|
-
export function DataTableFilterMenu({ table }) {
|
|
13
|
-
const [selectedFilterItems, setSelectedFilterItems] = useState([]);
|
|
14
|
-
return (_jsxs("div", { className: "flex-grow flex gap-3 items-center overflow-hidden", children: [_jsxs(Popover, { children: [_jsx(Tooltip, { tooltipContent: "Filter", children: _jsx(PopoverTrigger, { asChild: true, children: _jsxs(IconTextButton, { children: [_jsx(Filter, {}), "Filter"] }) }) }), _jsx(PopoverContent, { className: "w-[220px] p-0", align: "start", children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: "Search..." }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: "No results found." }), _jsx(CommandGroup, { children: table
|
|
15
|
-
.getAllColumns()
|
|
16
|
-
.filter((column) => typeof column.accessorFn !== "undefined" &&
|
|
17
|
-
column.getCanHide())
|
|
18
|
-
.map((column) => {
|
|
19
|
-
const previousValues = new Set(selectedFilterItems);
|
|
20
|
-
const isSelected = previousValues.has(column.id);
|
|
21
|
-
return (_jsxs(CommandItem, { onSelect: () => {
|
|
22
|
-
if (isSelected) {
|
|
23
|
-
previousValues.delete(column.id);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
previousValues.add(column.id);
|
|
27
|
-
}
|
|
28
|
-
setSelectedFilterItems([...previousValues]);
|
|
29
|
-
}, children: [_jsx("div", { className: cn("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white", isSelected
|
|
30
|
-
? "bg-black dark:bg-white text-white dark:text-black"
|
|
31
|
-
: "opacity-50 [&_svg]:invisible"), children: _jsx(Check, {}) }), _jsx("span", { className: "overflow-hidden text-ellipsis", title: getDataTableColumnTitle(column), children: getDataTableColumnTitle(column) })] }, column.id));
|
|
32
|
-
}) })] })] }) })] }), _jsx("div", { className: "flex-grow flex gap-3 items-center overflow-auto", children: selectedFilterItems.map((columnId) => {
|
|
33
|
-
const column = table.getColumn(columnId);
|
|
34
|
-
if (column) {
|
|
35
|
-
return _jsx(DataTableFacetedFilter, { column: column }, columnId);
|
|
36
|
-
}
|
|
37
|
-
}) })] }));
|
|
38
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, } from "lucide-react";
|
|
3
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../../../shadcn/select";
|
|
4
|
-
import { IconButtonWithTooltip } from "../../buttons";
|
|
5
|
-
const defaultPageSizeArray = [15, 20, 30, 40, 50, 100];
|
|
6
|
-
export function DataTablePagination({ table, extraParams, }) {
|
|
7
|
-
return (_jsxs("div", { className: "flex flex-col md:flex-row items-start md:items-center justify-between ", children: [_jsx("small", { className: "flex-1 px-2 text-gray-600 dark:text-gray-400", children: ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.numberOfRows) == undefined ||
|
|
8
|
-
(extraParams === null || extraParams === void 0 ? void 0 : extraParams.numberOfRows)) &&
|
|
9
|
-
(extraParams === null || extraParams === void 0 ? void 0 : extraParams.checkBoxColumn) ? (_jsxs(_Fragment, { children: [table.getFilteredSelectedRowModel().rows.length, " of", " ", table.getFilteredRowModel().rows.length, " row(s) selected."] })) : (_jsxs(_Fragment, { children: ["Total ", table.getFilteredRowModel().rows.length, " no(s) of rows."] })) }), ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.pagination) == undefined || extraParams.pagination) && (_jsxs("div", { className: "flex items-start md:items-center gap-3 flex-col md:flex-row ", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("small", { className: "text-gray-600 dark:text-gray-400", children: "Rows per page" }), ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.rowsPerPage) == undefined ||
|
|
10
|
-
extraParams.rowsPerPage) && (_jsxs(Select, { value: `${table.getState().pagination.pageSize}`, onValueChange: (value) => {
|
|
11
|
-
table.setPageSize(Number(value));
|
|
12
|
-
}, children: [_jsx(SelectTrigger, { className: "w-[70px] h-8", children: _jsx(SelectValue, { placeholder: table.getState().pagination.pageSize }) }), _jsx(SelectContent, { side: "top", children: ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.pageSizeArray) || defaultPageSizeArray).map((pageSize) => (_jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize))) })] }))] }), _jsxs(_Fragment, { children: [_jsxs("small", { className: "flex w-[100px] items-center justify-center text-gray-600 dark:text-gray-400", children: ["Page ", table.getState().pagination.pageIndex + 1, " of", " ", table.getPageCount()] }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(IconButtonWithTooltip, { tooltipContent: "Go to first page", size: "smIcon", className: "dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground", onClick: () => table.setPageIndex(0), disabled: !table.getCanPreviousPage(), children: _jsx(ChevronsLeft, {}) }), _jsx(IconButtonWithTooltip, { tooltipContent: "Go to previous page", size: "smIcon", className: "dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground", onClick: () => table.previousPage(), disabled: !table.getCanPreviousPage(), children: _jsx(ChevronLeft, {}) }), _jsx(IconButtonWithTooltip, { tooltipContent: "Go to next page", size: "smIcon", className: "dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground", onClick: () => table.nextPage(), disabled: !table.getCanNextPage(), children: _jsx(ChevronRight, {}) }), _jsx(IconButtonWithTooltip, { tooltipContent: "Go to last page", size: "smIcon", className: "dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground", onClick: () => table.setPageIndex(table.getPageCount() - 1), disabled: !table.getCanNextPage(), children: _jsx(ChevronsRight, {}) })] })] })] }))] }));
|
|
13
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment } from "react";
|
|
3
|
-
import { DataTableFilterMenu } from "../datatable-filter-menu";
|
|
4
|
-
import { DataTableColumnFilter } from "../datatable-column-filter";
|
|
5
|
-
import { SearchInput } from "../../search-input";
|
|
6
|
-
export function DataTableToolbar({ table, extraParams, }) {
|
|
7
|
-
var _a, _b, _c, _d;
|
|
8
|
-
return (_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { className: "flex-grow flex items-center justify-between gap-3 overflow-hidden", children: [((extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) == undefined ||
|
|
9
|
-
(extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) == true ||
|
|
10
|
-
(Array.isArray(extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) &&
|
|
11
|
-
((_a = extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) === null || _a === void 0 ? void 0 : _a.includes("search")))) && (_jsx(SearchInput, { placeholder: "Search ...", onChange: (event) => table.setGlobalFilter(event.target.value), className: "max-w-sm" })), ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) == undefined ||
|
|
12
|
-
(extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) == true ||
|
|
13
|
-
(Array.isArray(extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) &&
|
|
14
|
-
((_b = extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) === null || _b === void 0 ? void 0 : _b.includes("filter")))) && (_jsx(DataTableFilterMenu, { table: table }))] }), _jsxs("div", { className: "flex gap-3", children: [(_c = extraParams === null || extraParams === void 0 ? void 0 : extraParams.extraTools) === null || _c === void 0 ? void 0 : _c.map((tool, index) => (_jsx(Fragment, { children: tool }, index))), ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) == undefined ||
|
|
15
|
-
(extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) == true ||
|
|
16
|
-
(Array.isArray(extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) &&
|
|
17
|
-
((_d = extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) === null || _d === void 0 ? void 0 : _d.includes("columnFilter")))) && (_jsx(DataTableColumnFilter, { table: table }))] })] }));
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getDataTableColumnTitle: (column: any) => any;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export const getDataTableColumnTitle = (column) => {
|
|
2
|
-
var _a, _b, _c;
|
|
3
|
-
return ((_a = column === null || column === void 0 ? void 0 : column.columnDef) === null || _a === void 0 ? void 0 : _a.title) ||
|
|
4
|
-
(((_b = column === null || column === void 0 ? void 0 : column.columnDef) === null || _b === void 0 ? void 0 : _b.header) && typeof column.columnDef.header == 'string' && ((_c = column === null || column === void 0 ? void 0 : column.columnDef) === null || _c === void 0 ? void 0 : _c.header)) ||
|
|
5
|
-
column.id;
|
|
6
|
-
};
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import React, { useEffect, useImperativeHandle, useState, } from "react";
|
|
4
|
-
import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, getGroupedRowModel, getExpandedRowModel, useReactTable, getFacetedUniqueValues, getFacetedMinMaxValues, getFacetedRowModel, } from "@tanstack/react-table";
|
|
5
|
-
import { ChevronDown, ChevronRight, ChevronUp, X, } from "lucide-react";
|
|
6
|
-
import { Button } from "../../shadcn/button";
|
|
7
|
-
import { Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, } from "../../shadcn/table";
|
|
8
|
-
import { DataTableToolbar } from "./datatable-toolbar";
|
|
9
|
-
import { getDataTableColumnTitle } from "./function";
|
|
10
|
-
import { Checkbox } from "../../shadcn/checkbox";
|
|
11
|
-
import { DataTablePagination } from "./datatable-pagination";
|
|
12
|
-
import { ActionMenu } from "../action-menu";
|
|
13
|
-
import { cx } from "class-variance-authority";
|
|
14
|
-
export const DataTable = (({ columns, data, extraParams, onTableReady }, ref) => {
|
|
15
|
-
const [sorting, setSorting] = React.useState([]);
|
|
16
|
-
const [globalFilter, setGlobalFilter] = React.useState("");
|
|
17
|
-
const [columnFilters, setColumnFilters] = React.useState([]);
|
|
18
|
-
const [pagination, setPagination] = React.useState({
|
|
19
|
-
pageIndex: (extraParams === null || extraParams === void 0 ? void 0 : extraParams.pageIndex) || 0,
|
|
20
|
-
pageSize: (extraParams === null || extraParams === void 0 ? void 0 : extraParams.pageSize) || 15,
|
|
21
|
-
});
|
|
22
|
-
// useImperativeHandle(ref, () => ({
|
|
23
|
-
// toggleAllRowsExpanded: (expanded: boolean) => {
|
|
24
|
-
// table.toggleAllRowsExpanded(expanded);
|
|
25
|
-
// },
|
|
26
|
-
// getTableInstance: () => table, // Optional: Expose the entire table instance if needed
|
|
27
|
-
// }));
|
|
28
|
-
const [columnVisibility, setColumnVisibility] = React.useState({});
|
|
29
|
-
const [grouping, setGrouping] = React.useState([]);
|
|
30
|
-
const [expanded, setExpanded] = React.useState({});
|
|
31
|
-
const [rowSelection, setRowSelection] = React.useState({});
|
|
32
|
-
columns = columns.map((column) => {
|
|
33
|
-
if (!(column === null || column === void 0 ? void 0 : column.filterFn)) {
|
|
34
|
-
column.filterFn = "arrIncludesSome";
|
|
35
|
-
}
|
|
36
|
-
return column;
|
|
37
|
-
});
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (extraParams === null || extraParams === void 0 ? void 0 : extraParams.checkBoxColumnCallback)
|
|
40
|
-
extraParams.checkBoxColumnCallback(table.getFilteredSelectedRowModel().rows);
|
|
41
|
-
}, [rowSelection]);
|
|
42
|
-
if (extraParams === null || extraParams === void 0 ? void 0 : extraParams.checkBoxColumn) {
|
|
43
|
-
columns.splice(0, 0, {
|
|
44
|
-
id: "checkBoxColumn",
|
|
45
|
-
header: ({ table }) => (_jsx(Checkbox, { checked: table.getIsAllPageRowsSelected() ||
|
|
46
|
-
(table.getIsSomePageRowsSelected() && "indeterminate"), onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value), "aria-label": "Select all" })),
|
|
47
|
-
cell: ({ row }) => (_jsx(_Fragment, { children: _jsx(Checkbox, { checked: row.getIsSelected(), onCheckedChange: (value) => row.toggleSelected(!!value), "aria-label": "Select row" }) })),
|
|
48
|
-
enableSorting: false,
|
|
49
|
-
enableHiding: false,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
if ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.actionMenu) || (extraParams === null || extraParams === void 0 ? void 0 : extraParams.groupActionMenu)) {
|
|
53
|
-
columns.push({
|
|
54
|
-
id: "DTActions",
|
|
55
|
-
accessorKey: "Actions",
|
|
56
|
-
header: () => _jsx("div", { className: "text-center", children: "Action" }),
|
|
57
|
-
size: 20,
|
|
58
|
-
headerClassName: "text-center",
|
|
59
|
-
cell: ({ row }) => {
|
|
60
|
-
if (row.getIsGrouped()) {
|
|
61
|
-
return (extraParams === null || extraParams === void 0 ? void 0 : extraParams.groupActionMenu) ? (_jsx("div", { className: "text-end", children: _jsx(ActionMenu, { actionMenus: extraParams.groupActionMenu.items, extraActionParams: {
|
|
62
|
-
arguments: [
|
|
63
|
-
row.original,
|
|
64
|
-
...(extraParams.groupActionMenu.extraArguments || []),
|
|
65
|
-
],
|
|
66
|
-
} }) })) : null;
|
|
67
|
-
}
|
|
68
|
-
else if (extraParams === null || extraParams === void 0 ? void 0 : extraParams.actionMenu) {
|
|
69
|
-
return (_jsx("div", { className: "text-center", children: _jsx(ActionMenu, { actionMenus: extraParams.actionMenu.items, extraActionParams: {
|
|
70
|
-
arguments: [
|
|
71
|
-
row.original,
|
|
72
|
-
...(extraParams.actionMenu.extraArguments || []),
|
|
73
|
-
],
|
|
74
|
-
} }) }));
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
enableSorting: false,
|
|
81
|
-
enableHiding: false,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
// const onPaginationChange = (state: any) => {
|
|
85
|
-
// console.warn(state);
|
|
86
|
-
// setPagination(state);
|
|
87
|
-
// extraParams?.onPaginationChange?.(state);
|
|
88
|
-
// }
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
var _a;
|
|
91
|
-
(_a = extraParams === null || extraParams === void 0 ? void 0 : extraParams.onPaginationChange) === null || _a === void 0 ? void 0 : _a.call(extraParams, pagination);
|
|
92
|
-
}, [pagination]);
|
|
93
|
-
const table = useReactTable({
|
|
94
|
-
data,
|
|
95
|
-
columns,
|
|
96
|
-
state: {
|
|
97
|
-
sorting,
|
|
98
|
-
globalFilter,
|
|
99
|
-
columnFilters,
|
|
100
|
-
columnVisibility,
|
|
101
|
-
rowSelection,
|
|
102
|
-
grouping,
|
|
103
|
-
expanded,
|
|
104
|
-
pagination,
|
|
105
|
-
},
|
|
106
|
-
onPaginationChange: setPagination,
|
|
107
|
-
onSortingChange: setSorting,
|
|
108
|
-
onExpandedChange: setExpanded,
|
|
109
|
-
onColumnFiltersChange: setColumnFilters,
|
|
110
|
-
onColumnVisibilityChange: setColumnVisibility,
|
|
111
|
-
onGroupingChange: setGrouping,
|
|
112
|
-
onGlobalFilterChange: setGlobalFilter,
|
|
113
|
-
onRowSelectionChange: setRowSelection,
|
|
114
|
-
getCoreRowModel: getCoreRowModel(),
|
|
115
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
116
|
-
getSortedRowModel: getSortedRowModel(),
|
|
117
|
-
getFilteredRowModel: getFilteredRowModel(),
|
|
118
|
-
getGroupedRowModel: getGroupedRowModel(),
|
|
119
|
-
getExpandedRowModel: getExpandedRowModel(),
|
|
120
|
-
getFacetedRowModel: getFacetedRowModel(),
|
|
121
|
-
getFacetedUniqueValues: getFacetedUniqueValues(),
|
|
122
|
-
getFacetedMinMaxValues: getFacetedMinMaxValues(),
|
|
123
|
-
manualPagination: ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.pagination) == undefined || (extraParams === null || extraParams === void 0 ? void 0 : extraParams.pagination) == true) ? undefined : true
|
|
124
|
-
});
|
|
125
|
-
useImperativeHandle(ref, () => table);
|
|
126
|
-
const [droppedHeaders, setDroppedHeaders] = useState([]);
|
|
127
|
-
// Drag Event Handlers
|
|
128
|
-
const handleDragStart = (e, header) => {
|
|
129
|
-
const headerObj = {
|
|
130
|
-
id: header.id,
|
|
131
|
-
title: getDataTableColumnTitle(header.column),
|
|
132
|
-
};
|
|
133
|
-
e.dataTransfer.setData("headerObj", JSON.stringify(headerObj));
|
|
134
|
-
e.dataTransfer.effectAllowed = "move";
|
|
135
|
-
};
|
|
136
|
-
const handleDrop = (e) => {
|
|
137
|
-
e.preventDefault();
|
|
138
|
-
const headerObj = JSON.parse(e.dataTransfer.getData("headerObj"));
|
|
139
|
-
if (!droppedHeaders.find((e) => e.id == headerObj.id)) {
|
|
140
|
-
setDroppedHeaders((prevHeaders) => [...prevHeaders, headerObj]);
|
|
141
|
-
const column = table.getColumn(headerObj.id);
|
|
142
|
-
if (column) {
|
|
143
|
-
column.getToggleGroupingHandler()();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
const handleDragOver = (e) => {
|
|
148
|
-
e.preventDefault(); // Necessary to allow dropping
|
|
149
|
-
};
|
|
150
|
-
const handleRemoveGrouping = (groupId) => {
|
|
151
|
-
const newDroppedHeaders = droppedHeaders.filter((header) => header.id !== groupId);
|
|
152
|
-
setDroppedHeaders(() => [...newDroppedHeaders]);
|
|
153
|
-
const column = table.getColumn(groupId);
|
|
154
|
-
if (column) {
|
|
155
|
-
column.getToggleGroupingHandler()();
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
const [isMount, setIsMount] = useState(false);
|
|
159
|
-
useEffect(() => {
|
|
160
|
-
if (!isMount) {
|
|
161
|
-
setIsMount(true);
|
|
162
|
-
}
|
|
163
|
-
if (extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultGroups) {
|
|
164
|
-
table.setGrouping(extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultGroups);
|
|
165
|
-
}
|
|
166
|
-
}, []);
|
|
167
|
-
useEffect(() => {
|
|
168
|
-
if (onTableReady) {
|
|
169
|
-
onTableReady(table);
|
|
170
|
-
}
|
|
171
|
-
}, [onTableReady, table]);
|
|
172
|
-
return (isMount && (_jsxs("div", { className: "w-full h-full flex flex-col gap-3 justify-between", children: [_jsxs("div", { className: "flex-grow flex flex-col gap-3 overflow-hidden", children: [((extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) == undefined ||
|
|
173
|
-
extraParams.defaultTools ||
|
|
174
|
-
extraParams.extraTools) && (_jsx(DataTableToolbar, { table: table, extraParams: extraParams })), _jsxs("div", { className: "flex-grow flex flex-col overflow-hidden", children: [((extraParams === null || extraParams === void 0 ? void 0 : extraParams.grouping) == undefined || extraParams.grouping) && (_jsx("div", { className: "w-full border-t min-h-10 px-2 py-1 flex gap-3 items-center text-sm bg-card-new", onDrop: handleDrop, onDragOver: handleDragOver, children: droppedHeaders.length === 0
|
|
175
|
-
? "Drag a column header here to group its column"
|
|
176
|
-
: droppedHeaders.map((header, index) => (_jsxs("div", { className: "rounded-md px-2 py-1 bg-muted text-muted-foreground flex gap-3 items-center", children: [header.title, _jsx("span", { onClick: () => handleRemoveGrouping(header.id), children: _jsx(X, { size: 15 }) })] }, header.id))) })), _jsx("div", { className: "flex-grow overflow-hidden", children: _jsxs(Table, { className: "border-t whitespace-nowrap bg-card-new", children: [((extraParams === null || extraParams === void 0 ? void 0 : extraParams.header) == undefined || extraParams.header) && (_jsx(TableHeader, { className: "sticky top-0 z-10 border-t bg-card-new", children: table.getHeaderGroups().map((headerGroup) => (_jsx(TableRow, { className: cx(""), children: headerGroup.headers.map((header) => {
|
|
177
|
-
if (header.column.getIsGrouped()) {
|
|
178
|
-
if (header.column.getGroupedIndex() <
|
|
179
|
-
droppedHeaders.length - 1) {
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
return (_jsx(TableHead, { colSpan: droppedHeaders.length, className: cx("w-36 ", "text-left") }, header.id));
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
return (_jsx(TableHead, Object.assign({}, ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.grouping) == undefined ||
|
|
186
|
-
extraParams.grouping
|
|
187
|
-
? {
|
|
188
|
-
onDragStart: (e) => handleDragStart(e, header),
|
|
189
|
-
draggable: true,
|
|
190
|
-
}
|
|
191
|
-
: {}), { className: cx("text-left"), children: header.isPlaceholder ? null : ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.sorting) ==
|
|
192
|
-
undefined ||
|
|
193
|
-
extraParams.sorting) &&
|
|
194
|
-
header.column.getCanSort() ? (_jsxs("div", { onClick: header.column.getToggleSortingHandler(), className: cx("-mx-2 inline-flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1 hover:bg-muted"), children: [_jsx("div", { children: flexRender(header.column.columnDef.header, header.getContext()) }), header.column.getCanSort() ? (_jsxs("div", { className: "-space-y-2", children: [_jsx(ChevronUp, { className: cx("size-3.5 text-foreground", header.column.getIsSorted() ===
|
|
195
|
-
"desc"
|
|
196
|
-
? "opacity-30"
|
|
197
|
-
: ""), "aria-hidden": "true" }), _jsx(ChevronDown, { className: cx("size-3.5 text-foreground", header.column.getIsSorted() ===
|
|
198
|
-
"asc"
|
|
199
|
-
? "opacity-30"
|
|
200
|
-
: ""), "aria-hidden": "true" })] })) : null] })) : (flexRender(header.column.columnDef.header, header.getContext())) }), header.id));
|
|
201
|
-
}
|
|
202
|
-
}) }, headerGroup.id))) })), _jsx(TableBody, { children: table.getRowModel().rows.length ? (table.getRowModel().rows.map((row) => row.getIsGrouped() ? (_jsx(TableRow, { children: row.getVisibleCells().map((cell) => {
|
|
203
|
-
var _a;
|
|
204
|
-
if (cell.column.getIndex() < row.depth) {
|
|
205
|
-
return null;
|
|
206
|
-
}
|
|
207
|
-
return (
|
|
208
|
-
// colSpan={cell.column.getIndex() == row.depth ? row.depth + 1 : undefined}
|
|
209
|
-
_jsx(TableCell, { colSpan: cell.column.getIndex() == row.depth
|
|
210
|
-
? row.depth + 1
|
|
211
|
-
: undefined, className: cell.column.getIndex() == row.depth
|
|
212
|
-
? "w-36"
|
|
213
|
-
: "", children: cell.getIsGrouped() ? (_jsxs(Button, { variant: "link", onClick: row.getToggleExpandedHandler(), className: `text-right text-foreground`, style: {
|
|
214
|
-
marginLeft: row.depth + "rem",
|
|
215
|
-
}, children: [row.getIsExpanded() ? (_jsx(ChevronDown, {})) : (_jsx(ChevronRight, {})), " ", flexRender(cell.column.columnDef.cell, cell.getContext()), " ", "(", row.subRows.length, ")"] })) : cell.column.id == "DTActions" ? (flexRender(cell.column.columnDef.cell, cell.getContext())) : cell.getIsAggregated() ? (flexRender((_a = cell.column.columnDef.aggregatedCell) !== null && _a !== void 0 ? _a : cell.column.columnDef.cell, cell.getContext())) : cell.getIsPlaceholder() ? null : (flexRender(cell.column.columnDef.cell, cell.getContext())) }, cell.id));
|
|
216
|
-
}) }, row.id)) : (_jsx(TableRow, Object.assign({ className: cx(row.getIsSelected() ? "bg-accent/10" : "") }, ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.checkBoxColumn) && {
|
|
217
|
-
onClick: () => row.toggleSelected(!row.getIsSelected()),
|
|
218
|
-
}), { children: row.getVisibleCells().map((cell, index) => (_jsxs(TableCell, { className: cx(row.getIsSelected() ? "relative" : "", !((extraParams === null || extraParams === void 0 ? void 0 : extraParams.actionMenu) ||
|
|
219
|
-
(extraParams === null || extraParams === void 0 ? void 0 : extraParams.groupActionMenu)) && "py-2"), children: [index === 0 && row.getIsSelected() && (_jsx("div", { className: "absolute inset-y-0 left-0 w-0.5 bg-primary" })), cell.getIsPlaceholder()
|
|
220
|
-
? null
|
|
221
|
-
: flexRender(cell.column.columnDef.cell, cell.getContext())] }, cell.id))) }), row.id)))) : (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "No results." }) })) }), (extraParams === null || extraParams === void 0 ? void 0 : extraParams.footer) && (_jsx(TableFooter, { className: "sticky bottom-0 bg-background text-foreground", children: table.getFooterGroups().map((group) => (_jsx(TableRow, { children: group.headers.map((header) => (_jsx(TableCell, { children: header.isPlaceholder ? null : (_jsx("div", { className: "flex items-center", children: flexRender(header.column.columnDef.footer, header.getContext()) })) }))) }))) }))] }) })] })] }), ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.paginationBar) == undefined ||
|
|
222
|
-
extraParams.paginationBar) && (_jsx(DataTablePagination, { table: table, extraParams: extraParams }))] })));
|
|
223
|
-
});
|