ikoncomponents 1.5.8 → 1.5.10
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/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/ikoncomponents/action-menu/index.d.ts +5 -0
- package/dist/ikoncomponents/action-menu/index.js +42 -0
- package/dist/ikoncomponents/action-menu/type.d.ts +14 -0
- package/dist/ikoncomponents/action-menu/type.js +1 -0
- package/dist/ikoncomponents/activity-sheet/index.d.ts +11 -0
- package/dist/ikoncomponents/activity-sheet/index.js +23 -0
- package/dist/ikoncomponents/alert-dialog/dialog-context.d.ts +21 -0
- package/dist/ikoncomponents/alert-dialog/dialog-context.js +30 -0
- package/dist/ikoncomponents/alert-dialog/index.d.ts +14 -0
- package/dist/ikoncomponents/alert-dialog/index.js +20 -0
- package/dist/ikoncomponents/app-breadcrumb/BreadcrumbProvider.d.ts +18 -0
- package/dist/ikoncomponents/app-breadcrumb/BreadcrumbProvider.js +43 -0
- package/dist/ikoncomponents/app-breadcrumb/index.d.ts +5 -0
- package/dist/ikoncomponents/app-breadcrumb/index.js +57 -0
- package/dist/ikoncomponents/big-calendar/big-calender-event/index.d.ts +5 -0
- package/dist/ikoncomponents/big-calendar/big-calender-event/index.js +16 -0
- package/dist/ikoncomponents/big-calendar/big-calender-toolbar/index.d.ts +2 -0
- package/dist/ikoncomponents/big-calendar/big-calender-toolbar/index.js +39 -0
- package/dist/ikoncomponents/big-calendar/index.d.ts +3 -0
- package/dist/ikoncomponents/big-calendar/index.js +35 -0
- package/dist/ikoncomponents/big-calendar/type.d.ts +31 -0
- package/dist/ikoncomponents/big-calendar/type.js +1 -0
- package/dist/ikoncomponents/buttons/index.d.ts +18 -0
- package/dist/ikoncomponents/buttons/index.js +38 -0
- package/dist/ikoncomponents/combobox-input/index.d.ts +2 -0
- package/dist/ikoncomponents/combobox-input/index.js +18 -0
- package/dist/ikoncomponents/combobox-input/type.d.ts +13 -0
- package/dist/ikoncomponents/combobox-input/type.js +1 -0
- package/dist/ikoncomponents/custom-combo-dropdown/index.d.ts +21 -0
- package/dist/ikoncomponents/custom-combo-dropdown/index.js +85 -0
- package/dist/ikoncomponents/data-table/datatable-column-filter/index.d.ts +2 -0
- package/dist/ikoncomponents/data-table/datatable-column-filter/index.js +22 -0
- package/dist/ikoncomponents/data-table/datatable-faceted-filter/index.d.ts +2 -0
- package/dist/ikoncomponents/data-table/datatable-faceted-filter/index.js +35 -0
- package/dist/ikoncomponents/data-table/datatable-filter-menu/index.d.ts +2 -0
- package/dist/ikoncomponents/data-table/datatable-filter-menu/index.js +38 -0
- package/dist/ikoncomponents/data-table/datatable-pagination/index.d.ts +2 -0
- package/dist/ikoncomponents/data-table/datatable-pagination/index.js +13 -0
- package/dist/ikoncomponents/data-table/datatable-toolbar/index.d.ts +2 -0
- package/dist/ikoncomponents/data-table/datatable-toolbar/index.js +18 -0
- package/dist/ikoncomponents/data-table/function.d.ts +1 -0
- package/dist/ikoncomponents/data-table/function.js +6 -0
- package/dist/ikoncomponents/data-table/index.d.ts +2 -0
- package/dist/ikoncomponents/data-table/index.js +223 -0
- package/dist/ikoncomponents/data-table/type.d.ts +60 -0
- package/dist/ikoncomponents/data-table/type.js +1 -0
- package/dist/ikoncomponents/e-chart/index.d.ts +15 -0
- package/dist/ikoncomponents/e-chart/index.js +115 -0
- package/dist/ikoncomponents/file-input/index.d.ts +1 -0
- package/dist/ikoncomponents/file-input/index.js +21 -0
- package/dist/ikoncomponents/fileUpload/index.d.ts +15 -0
- package/dist/ikoncomponents/fileUpload/index.js +69 -0
- package/dist/ikoncomponents/form-fields/combobox-input/index.d.ts +2 -0
- package/dist/ikoncomponents/form-fields/combobox-input/index.js +21 -0
- package/dist/ikoncomponents/form-fields/combobox-input-value/index.d.ts +18 -0
- package/dist/ikoncomponents/form-fields/combobox-input-value/index.js +26 -0
- package/dist/ikoncomponents/form-fields/date-input/index.d.ts +2 -0
- package/dist/ikoncomponents/form-fields/date-input/index.js +15 -0
- package/dist/ikoncomponents/form-fields/file-input/index.d.ts +1 -0
- package/dist/ikoncomponents/form-fields/file-input/index.js +4 -0
- package/dist/ikoncomponents/form-fields/input/index.d.ts +2 -0
- package/dist/ikoncomponents/form-fields/input/index.js +18 -0
- package/dist/ikoncomponents/form-fields/multi-combobox-input/index.d.ts +6 -0
- package/{templates/default/ikoncomponents/form-fields/multi-combobox-input/index.tsx → dist/ikoncomponents/form-fields/multi-combobox-input/index.js} +381 -574
- package/dist/ikoncomponents/form-fields/otp-input/index.d.ts +2 -0
- package/dist/ikoncomponents/form-fields/otp-input/index.js +18 -0
- package/dist/ikoncomponents/form-fields/phone-input/index.d.ts +1 -0
- package/dist/ikoncomponents/form-fields/phone-input/index.js +4 -0
- package/dist/ikoncomponents/form-fields/textarea/index.d.ts +2 -0
- package/dist/ikoncomponents/form-fields/textarea/index.js +18 -0
- package/dist/ikoncomponents/form-fields/types/index.d.ts +36 -0
- package/dist/ikoncomponents/form-fields/types/index.js +1 -0
- package/dist/ikoncomponents/glowing-effect/index.d.ts +14 -0
- package/dist/ikoncomponents/glowing-effect/index.js +84 -0
- package/dist/ikoncomponents/icon/index.d.ts +8 -0
- package/dist/ikoncomponents/icon/index.js +23 -0
- package/dist/ikoncomponents/image-cropper-upload/components/newCropper.d.ts +15 -0
- package/{templates/default/ikoncomponents/image-cropper-upload/components/newCropper.tsx → dist/ikoncomponents/image-cropper-upload/components/newCropper.js} +85 -117
- package/dist/ikoncomponents/image-cropper-upload/components/newImageUploadForm.d.ts +7 -0
- package/dist/ikoncomponents/image-cropper-upload/components/newImageUploadForm.js +145 -0
- package/dist/ikoncomponents/image-cropper-upload/cropper-form/index.d.ts +6 -0
- package/dist/ikoncomponents/image-cropper-upload/cropper-form/index.js +92 -0
- package/dist/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.d.ts +6 -0
- package/dist/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.js +14 -0
- package/dist/ikoncomponents/image-cropper-upload/image-cropper/index.d.ts +14 -0
- package/{templates/default/ikoncomponents/image-cropper-upload/image-cropper/index.tsx → dist/ikoncomponents/image-cropper-upload/image-cropper/index.js} +87 -119
- package/dist/ikoncomponents/image-cropper-upload/index.d.ts +27 -0
- package/dist/ikoncomponents/image-cropper-upload/index.js +49 -0
- package/dist/ikoncomponents/image-cropper-upload/utils/index.d.ts +16 -0
- package/dist/ikoncomponents/image-cropper-upload/utils/index.js +73 -0
- package/dist/ikoncomponents/loading-spinner/index.d.ts +9 -0
- package/dist/ikoncomponents/loading-spinner/index.js +19 -0
- package/dist/ikoncomponents/main-layout/RefreshContext.d.ts +10 -0
- package/dist/ikoncomponents/main-layout/RefreshContext.js +18 -0
- package/dist/ikoncomponents/main-layout/SidebarNavContext.d.ts +33 -0
- package/dist/ikoncomponents/main-layout/SidebarNavContext.js +52 -0
- package/dist/ikoncomponents/main-layout/app-sidebar.d.ts +3 -0
- package/dist/ikoncomponents/main-layout/app-sidebar.js +24 -0
- package/dist/ikoncomponents/main-layout/footer.d.ts +1 -0
- package/dist/ikoncomponents/main-layout/footer.js +5 -0
- package/dist/ikoncomponents/main-layout/header.d.ts +3 -0
- package/dist/ikoncomponents/main-layout/header.js +15 -0
- package/dist/ikoncomponents/main-layout/index.d.ts +6 -0
- package/dist/ikoncomponents/main-layout/index.js +11 -0
- package/dist/ikoncomponents/main-layout/main-sidebar.d.ts +60 -0
- package/dist/ikoncomponents/main-layout/main-sidebar.js +119 -0
- package/dist/ikoncomponents/main-layout/nav-main.d.ts +11 -0
- package/dist/ikoncomponents/main-layout/nav-main.js +33 -0
- package/dist/ikoncomponents/multi-combobox/index.d.ts +13 -0
- package/dist/ikoncomponents/multi-combobox/index.js +202 -0
- package/dist/ikoncomponents/no-data/index.d.ts +3 -0
- package/dist/ikoncomponents/no-data/index.js +5 -0
- package/dist/ikoncomponents/page-wrapper/index.d.ts +9 -0
- package/dist/ikoncomponents/page-wrapper/index.js +7 -0
- package/dist/ikoncomponents/password-strength-meter/index.d.ts +3 -0
- package/dist/ikoncomponents/password-strength-meter/index.js +40 -0
- package/dist/ikoncomponents/phone-input/index.d.ts +1 -0
- package/dist/ikoncomponents/phone-input/index.js +41 -0
- package/dist/ikoncomponents/provider-wrapper/index.d.ts +6 -0
- package/dist/ikoncomponents/provider-wrapper/index.js +11 -0
- package/dist/ikoncomponents/search-input/index.d.ts +1 -0
- package/dist/ikoncomponents/search-input/index.js +19 -0
- package/dist/ikoncomponents/sheet/index.d.ts +10 -0
- package/dist/ikoncomponents/sheet/index.js +6 -0
- package/dist/ikoncomponents/simple-widget/index.d.ts +14 -0
- package/dist/ikoncomponents/simple-widget/index.js +14 -0
- package/dist/ikoncomponents/skeleton-loader/skeleton-table.d.ts +5 -0
- package/dist/ikoncomponents/skeleton-loader/skeleton-table.js +6 -0
- package/dist/ikoncomponents/skeleton-loader/skeleton-widget.d.ts +3 -0
- package/dist/ikoncomponents/skeleton-loader/skeleton-widget.js +5 -0
- package/dist/ikoncomponents/tabs/index.d.ts +2 -0
- package/dist/ikoncomponents/tabs/index.js +50 -0
- package/{templates/default/ikoncomponents/tabs/type.ts → dist/ikoncomponents/tabs/type.d.ts} +19 -20
- package/dist/ikoncomponents/tabs/type.js +2 -0
- package/dist/ikoncomponents/theme-toggle-btn/index.d.ts +1 -0
- package/{templates/default/ikoncomponents/theme-toggle-btn/index.tsx → dist/ikoncomponents/theme-toggle-btn/index.js} +118 -189
- package/dist/ikoncomponents/title-progress/index.d.ts +12 -0
- package/dist/ikoncomponents/title-progress/index.js +10 -0
- package/dist/ikoncomponents/tooltip/index.d.ts +5 -0
- package/dist/ikoncomponents/tooltip/index.js +5 -0
- package/dist/ikoncomponents/twolevel-dropdown/index.d.ts +31 -0
- package/dist/ikoncomponents/twolevel-dropdown/index.js +143 -0
- package/dist/ikoncomponents/upload-tab/index.d.ts +1 -0
- package/dist/ikoncomponents/upload-tab/index.js +92 -0
- package/dist/ikoncomponents/widgets/index.d.ts +2 -0
- package/dist/ikoncomponents/widgets/index.js +14 -0
- package/dist/ikoncomponents/widgets/type.d.ts +10 -0
- package/dist/ikoncomponents/widgets/type.js +2 -0
- package/dist/ikoncomponents/work-in-progress/index.d.ts +1 -0
- package/dist/ikoncomponents/work-in-progress/index.js +4 -0
- package/dist/index.d.ts +138 -0
- package/dist/index.js +116 -14
- package/dist/shadcn/accordion.d.ts +7 -0
- package/dist/shadcn/accordion.js +33 -0
- package/dist/shadcn/alert-dialog.d.ts +20 -0
- package/dist/shadcn/alert-dialog.js +83 -0
- package/dist/shadcn/alert.d.ts +9 -0
- package/dist/shadcn/alert.js +38 -0
- package/dist/shadcn/aspect-ratio.d.ts +3 -0
- package/dist/shadcn/aspect-ratio.js +19 -0
- package/dist/shadcn/avatar.d.ts +6 -0
- package/dist/shadcn/avatar.js +28 -0
- package/dist/shadcn/badge.d.ts +9 -0
- package/dist/shadcn/badge.js +35 -0
- package/dist/shadcn/breadcrumb.d.ts +11 -0
- package/dist/shadcn/breadcrumb.js +45 -0
- package/dist/shadcn/button.d.ts +10 -0
- package/dist/shadcn/button.js +47 -0
- package/dist/shadcn/calendar.d.ts +8 -0
- package/dist/shadcn/calendar.js +61 -0
- package/dist/shadcn/card.d.ts +9 -0
- package/dist/shadcn/card.js +42 -0
- package/dist/shadcn/checkbox.d.ts +4 -0
- package/dist/shadcn/checkbox.js +21 -0
- package/dist/shadcn/collapsible.d.ts +5 -0
- package/dist/shadcn/collapsible.js +27 -0
- package/dist/shadcn/command.d.ts +18 -0
- package/dist/shadcn/command.js +54 -0
- package/dist/shadcn/date-input.d.ts +7 -0
- package/dist/shadcn/date-input.js +179 -0
- package/dist/shadcn/date-range-picker.d.ts +24 -0
- package/dist/shadcn/date-range-picker.js +45 -0
- package/dist/shadcn/dialog.d.ts +15 -0
- package/dist/shadcn/dialog.js +57 -0
- package/dist/shadcn/drawer.d.ts +13 -0
- package/dist/shadcn/drawer.js +56 -0
- package/dist/shadcn/dropdown-menu.d.ts +25 -0
- package/dist/shadcn/dropdown-menu.js +77 -0
- package/dist/shadcn/form.d.ts +24 -0
- package/dist/shadcn/form.js +70 -0
- package/dist/shadcn/hover-card.d.ts +6 -0
- package/dist/shadcn/hover-card.js +28 -0
- package/dist/shadcn/input-otp.d.ts +34 -0
- package/dist/shadcn/input-otp.js +40 -0
- package/dist/shadcn/input.d.ts +3 -0
- package/dist/shadcn/input.js +18 -0
- package/dist/shadcn/label.d.ts +4 -0
- package/dist/shadcn/label.js +20 -0
- package/dist/shadcn/navigation-menu.d.ts +16 -0
- package/dist/shadcn/navigation-menu.js +74 -0
- package/dist/shadcn/popover.d.ts +7 -0
- package/dist/shadcn/popover.js +32 -0
- package/dist/shadcn/progress.d.ts +8 -0
- package/dist/shadcn/progress.js +23 -0
- package/dist/shadcn/radio-group.d.ts +5 -0
- package/dist/shadcn/radio-group.js +25 -0
- package/dist/shadcn/scroll-area.d.ts +5 -0
- package/dist/shadcn/scroll-area.js +26 -0
- package/dist/shadcn/select.d.ts +15 -0
- package/dist/shadcn/select.js +59 -0
- package/dist/shadcn/separator.d.ts +4 -0
- package/dist/shadcn/separator.js +20 -0
- package/dist/shadcn/sheet.d.ts +13 -0
- package/dist/shadcn/sheet.js +61 -0
- package/dist/shadcn/sidebar.d.ts +69 -0
- package/dist/shadcn/sidebar.js +242 -0
- package/dist/shadcn/skeleton.d.ts +3 -0
- package/dist/shadcn/skeleton.js +18 -0
- package/dist/shadcn/slider.d.ts +4 -0
- package/dist/shadcn/slider.js +26 -0
- package/dist/shadcn/sonner.d.ts +3 -0
- package/dist/shadcn/sonner.js +25 -0
- package/dist/shadcn/switch.d.ts +4 -0
- package/dist/shadcn/switch.js +20 -0
- package/dist/shadcn/table.d.ts +10 -0
- package/dist/shadcn/table.js +47 -0
- package/dist/shadcn/tabs.d.ts +7 -0
- package/dist/shadcn/tabs.js +32 -0
- package/dist/shadcn/textarea.d.ts +3 -0
- package/dist/shadcn/textarea.js +18 -0
- package/dist/shadcn/toggle-group.d.ts +9 -0
- package/dist/shadcn/toggle-group.js +35 -0
- package/dist/shadcn/toggle.d.ts +9 -0
- package/dist/shadcn/toggle.js +38 -0
- package/dist/shadcn/tooltip.d.ts +7 -0
- package/dist/shadcn/tooltip.js +32 -0
- package/dist/shadcn/workflow.d.ts +20 -0
- package/dist/shadcn/workflow.js +20 -0
- package/dist/styles.css +6163 -0
- package/dist/utils/actions/account/index.d.ts +5 -0
- package/dist/utils/actions/account/index.js +28 -0
- package/dist/utils/actions/account/type.d.ts +4 -0
- package/dist/utils/actions/account/type.js +1 -0
- package/dist/utils/actions/auth/index.d.ts +7 -0
- package/{templates/default/utils/actions/auth/index.ts → dist/utils/actions/auth/index.js} +58 -69
- package/dist/utils/actions/common/utils.d.ts +5 -0
- package/{templates/default/utils/actions/common/utils.ts → dist/utils/actions/common/utils.js} +25 -28
- package/dist/utils/actions/software/index.d.ts +11 -0
- package/dist/utils/actions/software/index.js +75 -0
- package/dist/utils/api/accountService/index.d.ts +23 -0
- package/dist/utils/api/accountService/index.js +64 -0
- package/dist/utils/api/accountService/type.d.ts +4 -0
- package/dist/utils/api/accountService/type.js +1 -0
- package/dist/utils/api/file-upload/index.d.ts +5 -0
- package/dist/utils/api/file-upload/index.js +80 -0
- package/dist/utils/api/file-upload/type.d.ts +6 -0
- package/dist/utils/api/file-upload/type.js +1 -0
- package/dist/utils/api/ikonBaseApi.d.ts +12 -0
- package/{templates/default/utils/api/ikonBaseApi.ts → dist/utils/api/ikonBaseApi.js} +104 -132
- package/dist/utils/api/loginService/index.d.ts +12 -0
- package/dist/utils/api/loginService/index.js +72 -0
- package/{templates/default/utils/api/loginService/type.ts → dist/utils/api/loginService/type.d.ts} +31 -35
- package/dist/utils/api/loginService/type.js +1 -0
- package/dist/utils/api/softwareService/index.d.ts +64 -0
- package/dist/utils/api/softwareService/index.js +212 -0
- package/dist/utils/api/softwareService/type.d.ts +54 -0
- package/dist/utils/api/softwareService/type.js +1 -0
- package/dist/utils/border-radius-provider.d.ts +11 -0
- package/{templates/default/utils/border-radius-provider.tsx → dist/utils/border-radius-provider.js} +35 -59
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +5 -0
- package/dist/utils/font-provider.d.ts +11 -0
- package/{templates/default/utils/font-provider.tsx → dist/utils/font-provider.js} +37 -61
- package/dist/utils/session/cookieSession.d.ts +8 -0
- package/dist/utils/session/cookieSession.js +33 -0
- package/dist/utils/theme-provider/index.d.ts +3 -0
- package/dist/utils/theme-provider/index.js +18 -0
- package/dist/utils/token-management/index.d.ts +10 -0
- package/dist/utils/token-management/index.js +69 -0
- package/dist/utils/token-management/types.d.ts +6 -0
- package/dist/utils/token-management/types.js +1 -0
- package/package.json +91 -17
- package/bin.js +0 -2
- package/dist/commands/init.js +0 -63
- package/dist/utlis/copyDir.js +0 -7
- package/templates/default/hooks/use-mobile.ts +0 -19
- package/templates/default/ikonS/accordion.tsx +0 -66
- package/templates/default/ikonS/alert-dialog.tsx +0 -179
- package/templates/default/ikonS/alert.tsx +0 -66
- package/templates/default/ikonS/aspect-ratio.tsx +0 -11
- package/templates/default/ikonS/avatar.tsx +0 -53
- package/templates/default/ikonS/badge.tsx +0 -49
- package/templates/default/ikonS/breadcrumb.tsx +0 -109
- package/templates/default/ikonS/button.tsx +0 -64
- package/templates/default/ikonS/calendar.tsx +0 -227
- package/templates/default/ikonS/card.tsx +0 -92
- package/templates/default/ikonS/checkbox.tsx +0 -33
- package/templates/default/ikonS/collapsible.tsx +0 -33
- package/templates/default/ikonS/command.tsx +0 -184
- package/templates/default/ikonS/date-input.tsx +0 -259
- package/templates/default/ikonS/date-range-picker.tsx +0 -103
- package/templates/default/ikonS/dialog.tsx +0 -143
- package/templates/default/ikonS/drawer.tsx +0 -134
- package/templates/default/ikonS/dropdown-menu.tsx +0 -259
- package/templates/default/ikonS/form.tsx +0 -166
- package/templates/default/ikonS/hover-card.tsx +0 -44
- package/templates/default/ikonS/input-otp.tsx +0 -71
- package/templates/default/ikonS/input.tsx +0 -22
- package/templates/default/ikonS/label.tsx +0 -24
- package/templates/default/ikonS/navigation-menu.tsx +0 -195
- package/templates/default/ikonS/popover.tsx +0 -48
- package/templates/default/ikonS/progress.tsx +0 -40
- package/templates/default/ikonS/radio-group.tsx +0 -45
- package/templates/default/ikonS/scroll-area.tsx +0 -58
- package/templates/default/ikonS/select.tsx +0 -184
- package/templates/default/ikonS/separator.tsx +0 -28
- package/templates/default/ikonS/sheet.tsx +0 -139
- package/templates/default/ikonS/sidebar.tsx +0 -726
- package/templates/default/ikonS/skeleton.tsx +0 -15
- package/templates/default/ikonS/slider.tsx +0 -64
- package/templates/default/ikonS/sonner.tsx +0 -25
- package/templates/default/ikonS/switch.tsx +0 -31
- package/templates/default/ikonS/table.tsx +0 -116
- package/templates/default/ikonS/tabs.tsx +0 -67
- package/templates/default/ikonS/textarea.tsx +0 -18
- package/templates/default/ikonS/toggle-group.tsx +0 -83
- package/templates/default/ikonS/toggle.tsx +0 -47
- package/templates/default/ikonS/tooltip.tsx +0 -65
- package/templates/default/ikonS/workflow.tsx +0 -119
- package/templates/default/ikoncomponents/action-menu/index.tsx +0 -108
- package/templates/default/ikoncomponents/action-menu/type.ts +0 -18
- package/templates/default/ikoncomponents/activity-sheet/index.tsx +0 -63
- package/templates/default/ikoncomponents/alert-dialog/dialog-context.tsx +0 -65
- package/templates/default/ikoncomponents/alert-dialog/index.tsx +0 -80
- package/templates/default/ikoncomponents/app-breadcrumb/BreadcrumbProvider.tsx +0 -68
- package/templates/default/ikoncomponents/app-breadcrumb/index.tsx +0 -222
- package/templates/default/ikoncomponents/big-calendar/big-calender-event/index.tsx +0 -38
- package/templates/default/ikoncomponents/big-calendar/big-calender-toolbar/index.tsx +0 -81
- package/templates/default/ikoncomponents/big-calendar/index.css +0 -879
- package/templates/default/ikoncomponents/big-calendar/index.tsx +0 -59
- package/templates/default/ikoncomponents/big-calendar/type.ts +0 -37
- package/templates/default/ikoncomponents/buttons/index.tsx +0 -127
- package/templates/default/ikoncomponents/combobox-input/index.tsx +0 -75
- package/templates/default/ikoncomponents/combobox-input/type.ts +0 -14
- package/templates/default/ikoncomponents/custom-combo-dropdown/index.tsx +0 -242
- package/templates/default/ikoncomponents/data-table/datatable-column-filter/index.tsx +0 -80
- package/templates/default/ikoncomponents/data-table/datatable-faceted-filter/index.tsx +0 -149
- package/templates/default/ikoncomponents/data-table/datatable-filter-menu/index.tsx +0 -98
- package/templates/default/ikoncomponents/data-table/datatable-pagination/index.tsx +0 -119
- package/templates/default/ikoncomponents/data-table/datatable-toolbar/index.tsx +0 -45
- package/templates/default/ikoncomponents/data-table/function.ts +0 -7
- package/templates/default/ikoncomponents/data-table/index.tsx +0 -549
- package/templates/default/ikoncomponents/data-table/type.ts +0 -75
- package/templates/default/ikoncomponents/e-chart/index.tsx +0 -183
- package/templates/default/ikoncomponents/file-input/index.tsx +0 -27
- package/templates/default/ikoncomponents/fileUpload/index.tsx +0 -121
- package/templates/default/ikoncomponents/form-fields/combobox-input/index.tsx +0 -111
- package/templates/default/ikoncomponents/form-fields/combobox-input-value/index.tsx +0 -121
- package/templates/default/ikoncomponents/form-fields/date-input/index.tsx +0 -80
- package/templates/default/ikoncomponents/form-fields/file-input/index.tsx +0 -9
- package/templates/default/ikoncomponents/form-fields/input/index.tsx +0 -27
- package/templates/default/ikoncomponents/form-fields/otp-input/index.tsx +0 -39
- package/templates/default/ikoncomponents/form-fields/password-input/index.tsx +0 -52
- package/templates/default/ikoncomponents/form-fields/phone-input/index.tsx +0 -7
- package/templates/default/ikoncomponents/form-fields/textarea/index.tsx +0 -28
- package/templates/default/ikoncomponents/form-fields/types/index.ts +0 -46
- package/templates/default/ikoncomponents/glowing-effect/index.tsx +0 -171
- package/templates/default/ikoncomponents/icon/index.tsx +0 -22
- package/templates/default/ikoncomponents/image-cropper-upload/components/cropperImg.css +0 -19
- package/templates/default/ikoncomponents/image-cropper-upload/components/newImageUploadForm.tsx +0 -352
- package/templates/default/ikoncomponents/image-cropper-upload/cropper-form/index.tsx +0 -250
- package/templates/default/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.tsx +0 -32
- package/templates/default/ikoncomponents/image-cropper-upload/index.tsx +0 -95
- package/templates/default/ikoncomponents/image-cropper-upload/utils/index.ts +0 -117
- package/templates/default/ikoncomponents/loading-spinner/index.tsx +0 -43
- package/templates/default/ikoncomponents/main-layout/RefreshContext.tsx +0 -30
- package/templates/default/ikoncomponents/main-layout/SidebarNavContext.tsx +0 -103
- package/templates/default/ikoncomponents/main-layout/app-sidebar.tsx +0 -36
- package/templates/default/ikoncomponents/main-layout/footer.tsx +0 -21
- package/templates/default/ikoncomponents/main-layout/header.tsx +0 -53
- package/templates/default/ikoncomponents/main-layout/index.tsx +0 -38
- package/templates/default/ikoncomponents/main-layout/main-sidebar.tsx +0 -389
- package/templates/default/ikoncomponents/main-layout/nav-main.tsx +0 -103
- package/templates/default/ikoncomponents/multi-combobox/index.tsx +0 -345
- package/templates/default/ikoncomponents/no-data/index.tsx +0 -11
- package/templates/default/ikoncomponents/page-wrapper/index.tsx +0 -30
- package/templates/default/ikoncomponents/password-strength-meter/index.tsx +0 -49
- package/templates/default/ikoncomponents/phone-input/index.tsx +0 -72
- package/templates/default/ikoncomponents/provider-wrapper/index.tsx +0 -32
- package/templates/default/ikoncomponents/search-input/index.tsx +0 -18
- package/templates/default/ikoncomponents/sheet/index.tsx +0 -34
- package/templates/default/ikoncomponents/simple-widget/index.tsx +0 -54
- package/templates/default/ikoncomponents/skeleton-loader/skeleton-table.tsx +0 -34
- package/templates/default/ikoncomponents/skeleton-loader/skeleton-widget.tsx +0 -13
- package/templates/default/ikoncomponents/tabs/index.tsx +0 -139
- package/templates/default/ikoncomponents/title-progress/index.tsx +0 -41
- package/templates/default/ikoncomponents/tooltip/index.tsx +0 -17
- package/templates/default/ikoncomponents/twolevel-dropdown/convertToDropdownNodes.tsx +0 -33
- package/templates/default/ikoncomponents/twolevel-dropdown/index.tsx +0 -279
- package/templates/default/ikoncomponents/upload-tab/index.tsx +0 -237
- package/templates/default/ikoncomponents/widgets/index.tsx +0 -81
- package/templates/default/ikoncomponents/widgets/type.ts +0 -11
- package/templates/default/ikoncomponents/work-in-progress/index.tsx +0 -16
- package/templates/default/styles.css +0 -1159
- package/templates/default/utils/actions/account/index.ts +0 -33
- package/templates/default/utils/actions/account/type.ts +0 -4
- package/templates/default/utils/actions/common/revalidate.ts +0 -18
- package/templates/default/utils/actions/common/type.ts +0 -4
- package/templates/default/utils/actions/software/index.ts +0 -106
- package/templates/default/utils/api/accountService/index.ts +0 -103
- package/templates/default/utils/api/accountService/type.ts +0 -4
- package/templates/default/utils/api/file-upload/index.ts +0 -103
- package/templates/default/utils/api/file-upload/type.ts +0 -8
- package/templates/default/utils/api/loginService/index.ts +0 -106
- package/templates/default/utils/api/softwareService/index.ts +0 -356
- package/templates/default/utils/api/softwareService/type.ts +0 -62
- package/templates/default/utils/cn.ts +0 -6
- package/templates/default/utils/session/cookieSession.ts +0 -49
- package/templates/default/utils/theme-provider/index.tsx +0 -11
- package/templates/default/utils/token-management/index.ts +0 -115
- package/templates/default/utils/token-management/types.ts +0 -6
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getDataTableColumnTitle: (column: any) => any;
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,223 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Column, ColumnDef, PaginationState, Table } from "@tanstack/react-table";
|
|
2
|
+
import { ActionMenuProps } from "../action-menu/type";
|
|
3
|
+
export interface DataTableProps<TData, TValue> {
|
|
4
|
+
data: TData[];
|
|
5
|
+
columns: DTColumnsProps<TData, TValue>[];
|
|
6
|
+
extraParams?: DTExtraParamsProps;
|
|
7
|
+
onTableReady?: (table: any) => void;
|
|
8
|
+
}
|
|
9
|
+
export type DTColumnsProps<TData, TValue = unknown> = ColumnDef<TData, TValue> & {
|
|
10
|
+
title?: string;
|
|
11
|
+
headerClassName?: string;
|
|
12
|
+
};
|
|
13
|
+
export interface DTExtraParamsProps {
|
|
14
|
+
defaultGroups?: string[];
|
|
15
|
+
grouping?: boolean;
|
|
16
|
+
header?: boolean;
|
|
17
|
+
footer?: boolean;
|
|
18
|
+
defaultTools?: ("columnFilter" | "search" | "filter")[] | boolean;
|
|
19
|
+
extraTools?: any;
|
|
20
|
+
sorting?: boolean;
|
|
21
|
+
paginationBar?: boolean;
|
|
22
|
+
rowsPerPage?: boolean;
|
|
23
|
+
pagination?: boolean;
|
|
24
|
+
numberOfRows?: boolean;
|
|
25
|
+
checkBoxColumn?: boolean;
|
|
26
|
+
checkBoxColumnCallback?: (selectedRows: any[]) => void;
|
|
27
|
+
actionMenu?: DTActionMenuProps;
|
|
28
|
+
groupActionMenu?: DTActionMenuProps;
|
|
29
|
+
pageSize?: number;
|
|
30
|
+
pageIndex?: number;
|
|
31
|
+
pageSizeArray?: number[];
|
|
32
|
+
rowSelection?: boolean;
|
|
33
|
+
onPaginationChange?: (state: PaginationState) => void;
|
|
34
|
+
defaultRowSelection?: (row: any) => boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface DTActionMenuProps {
|
|
37
|
+
items: ActionMenuProps[];
|
|
38
|
+
extraArguments?: any[];
|
|
39
|
+
}
|
|
40
|
+
export interface DataTableViewOptionsProps<TData> {
|
|
41
|
+
table: Table<TData>;
|
|
42
|
+
}
|
|
43
|
+
export interface DTToolBarProps<TData> {
|
|
44
|
+
table: Table<TData>;
|
|
45
|
+
extraParams?: DTExtraParamsProps;
|
|
46
|
+
}
|
|
47
|
+
export interface DataTableFilterProps<TData> {
|
|
48
|
+
table: Table<TData>;
|
|
49
|
+
}
|
|
50
|
+
export interface DataTableFacetedFilterProps<TData, TValue> {
|
|
51
|
+
column: Column<TData, TValue>;
|
|
52
|
+
}
|
|
53
|
+
export interface DataTablePaginationProps<TData> {
|
|
54
|
+
table: Table<TData>;
|
|
55
|
+
extraParams?: DTExtraParamsProps;
|
|
56
|
+
}
|
|
57
|
+
export interface DragDropHeaderProp {
|
|
58
|
+
id: string;
|
|
59
|
+
title: string;
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
parentDivProps?: any;
|
|
4
|
+
option?: Record<string | number, any>;
|
|
5
|
+
style?: Record<string, string>;
|
|
6
|
+
settings?: Record<string, any>;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
theme?: string | object | null;
|
|
9
|
+
isConfigurable?: boolean;
|
|
10
|
+
resizeKey?: null | boolean | number | string;
|
|
11
|
+
onClick?: (...args: any) => void;
|
|
12
|
+
onConfigure?: (...args: any) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const EChart: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLElement>>;
|
|
15
|
+
export {};
|