@ayasofyazilim/ui 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aria/index.js +2 -0
- package/dist/aria/index.js.map +1 -0
- package/dist/aria/number-field.js +46 -0
- package/dist/aria/number-field.js.map +1 -0
- package/dist/components/accordion.js +66 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert-dialog.js +148 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/alert.js +69 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/aspect-ratio.js +12 -0
- package/dist/components/aspect-ratio.js.map +1 -0
- package/dist/components/avatar.js +55 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.js +62 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/breadcrumb.js +104 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button-group.js +77 -0
- package/dist/components/button-group.js.map +1 -0
- package/dist/components/button.js +56 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar.js +196 -0
- package/dist/components/calendar.js.map +1 -0
- package/dist/components/card.js +91 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/carousel.js +200 -0
- package/dist/components/carousel.js.map +1 -0
- package/dist/components/chart.js +250 -0
- package/dist/components/chart.js.map +1 -0
- package/dist/components/checkbox.js +33 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/collapsible.js +36 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/command.js +178 -0
- package/dist/components/command.js.map +1 -0
- package/dist/components/context-menu.js +225 -0
- package/dist/components/context-menu.js.map +1 -0
- package/dist/components/dialog.js +139 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/drawer.js +130 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown-menu.js +234 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/empty.js +100 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/field.js +231 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/form.js +124 -0
- package/dist/components/form.js.map +1 -0
- package/dist/components/hover-card.js +40 -0
- package/dist/components/hover-card.js.map +1 -0
- package/dist/components/input-group.js +156 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input-otp.js +68 -0
- package/dist/components/input-otp.js.map +1 -0
- package/dist/components/input.js +22 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/item.js +188 -0
- package/dist/components/item.js.map +1 -0
- package/dist/components/kbd.js +32 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/label.js +24 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/menubar.js +253 -0
- package/dist/components/menubar.js.map +1 -0
- package/dist/components/navigation-menu.js +171 -0
- package/dist/components/navigation-menu.js.map +1 -0
- package/dist/components/pagination.js +125 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/popover.js +82 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.js +33 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/radio-group.js +47 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/resizable.js +50 -0
- package/dist/components/resizable.js.map +1 -0
- package/dist/components/scroll-area.js +62 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/select.js +173 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.js +28 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/sheet.js +129 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/sidebar.js +759 -0
- package/dist/components/sidebar.js.map +1 -0
- package/dist/components/skeleton.js +16 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.js +65 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sonner.js +40 -0
- package/dist/components/sonner.js.map +1 -0
- package/dist/components/spinner.js +18 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/stepper.js +220 -0
- package/dist/components/stepper.js.map +1 -0
- package/dist/components/switch.js +33 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.js +131 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.js +69 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/textarea.js +19 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/toggle-group.js +70 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.js +45 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/tooltip.js +65 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/custom/action-button.js +38 -0
- package/dist/custom/action-button.js.map +1 -0
- package/dist/custom/async-select.js +249 -0
- package/dist/custom/async-select.js.map +1 -0
- package/dist/custom/awesome-not-found.js +113 -0
- package/dist/custom/awesome-not-found.js.map +1 -0
- package/dist/custom/charts/area-chart.js +125 -0
- package/dist/custom/charts/area-chart.js.map +1 -0
- package/dist/custom/charts/bar-chart.js +232 -0
- package/dist/custom/charts/bar-chart.js.map +1 -0
- package/dist/custom/charts/chart-card.js +71 -0
- package/dist/custom/charts/chart-card.js.map +1 -0
- package/dist/custom/charts/index.js +5 -0
- package/dist/custom/charts/index.js.map +1 -0
- package/dist/custom/charts/pie-chart.js +153 -0
- package/dist/custom/charts/pie-chart.js.map +1 -0
- package/dist/custom/charts/radar-chart.js +112 -0
- package/dist/custom/charts/radar-chart.js.map +1 -0
- package/dist/custom/checkbox-tree.js +70 -0
- package/dist/custom/checkbox-tree.js.map +1 -0
- package/dist/custom/combobox.js +233 -0
- package/dist/custom/combobox.js.map +1 -0
- package/dist/custom/confirm-dialog.js +90 -0
- package/dist/custom/confirm-dialog.js.map +1 -0
- package/dist/custom/country-selector.js +151 -0
- package/dist/custom/country-selector.js.map +1 -0
- package/dist/custom/date-picker/calendar-rac.js +91 -0
- package/dist/custom/date-picker/calendar-rac.js.map +1 -0
- package/dist/custom/date-picker/datefield-rac.js +77 -0
- package/dist/custom/date-picker/datefield-rac.js.map +1 -0
- package/dist/custom/date-picker/index.js +251 -0
- package/dist/custom/date-picker/index.js.map +1 -0
- package/dist/custom/date-picker/types/index.js +1 -0
- package/dist/custom/date-picker/types/index.js.map +1 -0
- package/dist/custom/date-picker/utils/index.js +30 -0
- package/dist/custom/date-picker/utils/index.js.map +1 -0
- package/dist/custom/date-picker-old.js +46 -0
- package/dist/custom/date-picker-old.js.map +1 -0
- package/dist/custom/date-tooltip.js +89 -0
- package/dist/custom/date-tooltip.js.map +1 -0
- package/dist/custom/document-scanner/consts.js +13 -0
- package/dist/custom/document-scanner/consts.js.map +1 -0
- package/dist/custom/document-scanner/corner-adjustment/action-buttons.js +24 -0
- package/dist/custom/document-scanner/corner-adjustment/action-buttons.js.map +1 -0
- package/dist/custom/document-scanner/corner-adjustment/corner-handle.js +44 -0
- package/dist/custom/document-scanner/corner-adjustment/corner-handle.js.map +1 -0
- package/dist/custom/document-scanner/corner-adjustment/hooks/use-corner-drag.js +60 -0
- package/dist/custom/document-scanner/corner-adjustment/hooks/use-corner-drag.js.map +1 -0
- package/dist/custom/document-scanner/corner-adjustment/index.js +124 -0
- package/dist/custom/document-scanner/corner-adjustment/index.js.map +1 -0
- package/dist/custom/document-scanner/corner-adjustment/types.js +1 -0
- package/dist/custom/document-scanner/corner-adjustment/types.js.map +1 -0
- package/dist/custom/document-scanner/corner-adjustment/utils/clip-path.js +16 -0
- package/dist/custom/document-scanner/corner-adjustment/utils/clip-path.js.map +1 -0
- package/dist/custom/document-scanner/corner-adjustment/zoom-magnifier.js +85 -0
- package/dist/custom/document-scanner/corner-adjustment/zoom-magnifier.js.map +1 -0
- package/dist/custom/document-scanner/hooks/use-document-capture.js +61 -0
- package/dist/custom/document-scanner/hooks/use-document-capture.js.map +1 -0
- package/dist/custom/document-scanner/hooks/use-document-scanner.js +59 -0
- package/dist/custom/document-scanner/hooks/use-document-scanner.js.map +1 -0
- package/dist/custom/document-scanner/hooks/use-perspective-crop.js +31 -0
- package/dist/custom/document-scanner/hooks/use-perspective-crop.js.map +1 -0
- package/dist/custom/document-scanner/index.js +229 -0
- package/dist/custom/document-scanner/index.js.map +1 -0
- package/dist/custom/document-scanner/lib.js +289 -0
- package/dist/custom/document-scanner/lib.js.map +1 -0
- package/dist/custom/document-scanner/types.js +1 -0
- package/dist/custom/document-scanner/types.js.map +1 -0
- package/dist/custom/document-scanner/utils/perspective-correction.js +100 -0
- package/dist/custom/document-scanner/utils/perspective-correction.js.map +1 -0
- package/dist/custom/document-viewer/controllers.js +76 -0
- package/dist/custom/document-viewer/controllers.js.map +1 -0
- package/dist/custom/document-viewer/index.js +36 -0
- package/dist/custom/document-viewer/index.js.map +1 -0
- package/dist/custom/document-viewer/renderers/image.js +40 -0
- package/dist/custom/document-viewer/renderers/image.js.map +1 -0
- package/dist/custom/document-viewer/renderers/index.js +3 -0
- package/dist/custom/document-viewer/renderers/index.js.map +1 -0
- package/dist/custom/document-viewer/renderers/pdf.js +95 -0
- package/dist/custom/document-viewer/renderers/pdf.js.map +1 -0
- package/dist/custom/email-input/email.js +184 -0
- package/dist/custom/email-input/email.js.map +1 -0
- package/dist/custom/email-input/index.js +8 -0
- package/dist/custom/email-input/index.js.map +1 -0
- package/dist/custom/email-input/types.js +13 -0
- package/dist/custom/email-input/types.js.map +1 -0
- package/dist/custom/file-uploader.js +389 -0
- package/dist/custom/file-uploader.js.map +1 -0
- package/dist/custom/filter-component/fields/async-select.js +31 -0
- package/dist/custom/filter-component/fields/async-select.js.map +1 -0
- package/dist/custom/filter-component/fields/date.js +56 -0
- package/dist/custom/filter-component/fields/date.js.map +1 -0
- package/dist/custom/filter-component/fields/multi-select.js +28 -0
- package/dist/custom/filter-component/fields/multi-select.js.map +1 -0
- package/dist/custom/filter-component/index.js +149 -0
- package/dist/custom/filter-component/index.js.map +1 -0
- package/dist/custom/image-canvas.js +193 -0
- package/dist/custom/image-canvas.js.map +1 -0
- package/dist/custom/json-editor.js +30 -0
- package/dist/custom/json-editor.js.map +1 -0
- package/dist/custom/master-data-grid/components/dialogs/column-settings-dialog.js +84 -0
- package/dist/custom/master-data-grid/components/dialogs/column-settings-dialog.js.map +1 -0
- package/dist/custom/master-data-grid/components/dialogs/index.js +5 -0
- package/dist/custom/master-data-grid/components/dialogs/index.js.map +1 -0
- package/dist/custom/master-data-grid/components/filters/client-filter.js +310 -0
- package/dist/custom/master-data-grid/components/filters/client-filter.js.map +1 -0
- package/dist/custom/master-data-grid/components/filters/filter-input.js +209 -0
- package/dist/custom/master-data-grid/components/filters/filter-input.js.map +1 -0
- package/dist/custom/master-data-grid/components/filters/index.js +9 -0
- package/dist/custom/master-data-grid/components/filters/index.js.map +1 -0
- package/dist/custom/master-data-grid/components/filters/inline-column-filter.js +188 -0
- package/dist/custom/master-data-grid/components/filters/inline-column-filter.js.map +1 -0
- package/dist/custom/master-data-grid/components/filters/multi-filter-dialog.js +65 -0
- package/dist/custom/master-data-grid/components/filters/multi-filter-dialog.js.map +1 -0
- package/dist/custom/master-data-grid/components/filters/server-filter.js +213 -0
- package/dist/custom/master-data-grid/components/filters/server-filter.js.map +1 -0
- package/dist/custom/master-data-grid/components/master-data-grid.js +421 -0
- package/dist/custom/master-data-grid/components/master-data-grid.js.map +1 -0
- package/dist/custom/master-data-grid/components/pagination/index.js +5 -0
- package/dist/custom/master-data-grid/components/pagination/index.js.map +1 -0
- package/dist/custom/master-data-grid/components/pagination/pagination.js +159 -0
- package/dist/custom/master-data-grid/components/pagination/pagination.js.map +1 -0
- package/dist/custom/master-data-grid/components/table/cell-renderer.js +442 -0
- package/dist/custom/master-data-grid/components/table/cell-renderer.js.map +1 -0
- package/dist/custom/master-data-grid/components/table/header-cell.js +116 -0
- package/dist/custom/master-data-grid/components/table/header-cell.js.map +1 -0
- package/dist/custom/master-data-grid/components/table/index.js +5 -0
- package/dist/custom/master-data-grid/components/table/index.js.map +1 -0
- package/dist/custom/master-data-grid/components/table/table-body-renderer.js +79 -0
- package/dist/custom/master-data-grid/components/table/table-body-renderer.js.map +1 -0
- package/dist/custom/master-data-grid/components/table/virtual-body.js +86 -0
- package/dist/custom/master-data-grid/components/table/virtual-body.js.map +1 -0
- package/dist/custom/master-data-grid/components/toolbar/index.js +5 -0
- package/dist/custom/master-data-grid/components/toolbar/index.js.map +1 -0
- package/dist/custom/master-data-grid/components/toolbar/toolbar.js +238 -0
- package/dist/custom/master-data-grid/components/toolbar/toolbar.js.map +1 -0
- package/dist/custom/master-data-grid/hooks/index.js +7 -0
- package/dist/custom/master-data-grid/hooks/index.js.map +1 -0
- package/dist/custom/master-data-grid/hooks/use-columns.js +278 -0
- package/dist/custom/master-data-grid/hooks/use-columns.js.map +1 -0
- package/dist/custom/master-data-grid/hooks/use-editing.js +75 -0
- package/dist/custom/master-data-grid/hooks/use-editing.js.map +1 -0
- package/dist/custom/master-data-grid/hooks/use-table-state-reducer.js +96 -0
- package/dist/custom/master-data-grid/hooks/use-table-state-reducer.js.map +1 -0
- package/dist/custom/master-data-grid/hooks/use-table-state.js +25 -0
- package/dist/custom/master-data-grid/hooks/use-table-state.js.map +1 -0
- package/dist/custom/master-data-grid/index.js +5 -0
- package/dist/custom/master-data-grid/index.js.map +1 -0
- package/dist/custom/master-data-grid/types.js +1 -0
- package/dist/custom/master-data-grid/types.js.map +1 -0
- package/dist/custom/master-data-grid/utils/column-generator.js +203 -0
- package/dist/custom/master-data-grid/utils/column-generator.js.map +1 -0
- package/dist/custom/master-data-grid/utils/export-utils.js +46 -0
- package/dist/custom/master-data-grid/utils/export-utils.js.map +1 -0
- package/dist/custom/master-data-grid/utils/filter-fns.js +218 -0
- package/dist/custom/master-data-grid/utils/filter-fns.js.map +1 -0
- package/dist/custom/master-data-grid/utils/index.js +16 -0
- package/dist/custom/master-data-grid/utils/index.js.map +1 -0
- package/dist/custom/master-data-grid/utils/pinning-utils.js +70 -0
- package/dist/custom/master-data-grid/utils/pinning-utils.js.map +1 -0
- package/dist/custom/master-data-grid/utils/translation-utils.js +33 -0
- package/dist/custom/master-data-grid/utils/translation-utils.js.map +1 -0
- package/dist/custom/multi-select.js +339 -0
- package/dist/custom/multi-select.js.map +1 -0
- package/dist/custom/password-input.js +158 -0
- package/dist/custom/password-input.js.map +1 -0
- package/dist/custom/phone-input.js +127 -0
- package/dist/custom/phone-input.js.map +1 -0
- package/dist/custom/schema-form/custom/index.js +2 -0
- package/dist/custom/schema-form/custom/index.js.map +1 -0
- package/dist/custom/schema-form/custom/label.js +39 -0
- package/dist/custom/schema-form/custom/label.js.map +1 -0
- package/dist/custom/schema-form/fields/base-input-field.js +73 -0
- package/dist/custom/schema-form/fields/base-input-field.js.map +1 -0
- package/dist/custom/schema-form/fields/field.js +72 -0
- package/dist/custom/schema-form/fields/field.js.map +1 -0
- package/dist/custom/schema-form/fields/index.js +6 -0
- package/dist/custom/schema-form/fields/index.js.map +1 -0
- package/dist/custom/schema-form/fields/object.js +9 -0
- package/dist/custom/schema-form/fields/object.js.map +1 -0
- package/dist/custom/schema-form/fields/table-array/array-field-item.js +58 -0
- package/dist/custom/schema-form/fields/table-array/array-field-item.js.map +1 -0
- package/dist/custom/schema-form/fields/table-array/array-field-template.js +104 -0
- package/dist/custom/schema-form/fields/table-array/array-field-template.js.map +1 -0
- package/dist/custom/schema-form/index.js +219 -0
- package/dist/custom/schema-form/index.js.map +1 -0
- package/dist/custom/schema-form/templates/description.js +19 -0
- package/dist/custom/schema-form/templates/description.js.map +1 -0
- package/dist/custom/schema-form/templates/index.js +3 -0
- package/dist/custom/schema-form/templates/index.js.map +1 -0
- package/dist/custom/schema-form/templates/submit.js +31 -0
- package/dist/custom/schema-form/templates/submit.js.map +1 -0
- package/dist/custom/schema-form/types.js +1 -0
- package/dist/custom/schema-form/types.js.map +1 -0
- package/dist/custom/schema-form/utils/index.js +10 -0
- package/dist/custom/schema-form/utils/index.js.map +1 -0
- package/dist/custom/schema-form/utils/schema-dependency.js +349 -0
- package/dist/custom/schema-form/utils/schema-dependency.js.map +1 -0
- package/dist/custom/schema-form/utils/schemas.js +190 -0
- package/dist/custom/schema-form/utils/schemas.js.map +1 -0
- package/dist/custom/schema-form/utils/validation.js +19 -0
- package/dist/custom/schema-form/utils/validation.js.map +1 -0
- package/dist/custom/schema-form/widgets/boolean.js +73 -0
- package/dist/custom/schema-form/widgets/boolean.js.map +1 -0
- package/dist/custom/schema-form/widgets/combobox.js +222 -0
- package/dist/custom/schema-form/widgets/combobox.js.map +1 -0
- package/dist/custom/schema-form/widgets/date.js +56 -0
- package/dist/custom/schema-form/widgets/date.js.map +1 -0
- package/dist/custom/schema-form/widgets/email.js +37 -0
- package/dist/custom/schema-form/widgets/email.js.map +1 -0
- package/dist/custom/schema-form/widgets/index.js +11 -0
- package/dist/custom/schema-form/widgets/index.js.map +1 -0
- package/dist/custom/schema-form/widgets/password.js +42 -0
- package/dist/custom/schema-form/widgets/password.js.map +1 -0
- package/dist/custom/schema-form/widgets/phone.js +39 -0
- package/dist/custom/schema-form/widgets/phone.js.map +1 -0
- package/dist/custom/schema-form/widgets/select.js +78 -0
- package/dist/custom/schema-form/widgets/select.js.map +1 -0
- package/dist/custom/schema-form/widgets/selectable.js +25 -0
- package/dist/custom/schema-form/widgets/selectable.js.map +1 -0
- package/dist/custom/schema-form/widgets/string-array.js +237 -0
- package/dist/custom/schema-form/widgets/string-array.js.map +1 -0
- package/dist/custom/schema-form/widgets/url.js +53 -0
- package/dist/custom/schema-form/widgets/url.js.map +1 -0
- package/dist/custom/section-layout-v2.js +150 -0
- package/dist/custom/section-layout-v2.js.map +1 -0
- package/dist/custom/select-tabs.js +66 -0
- package/dist/custom/select-tabs.js.map +1 -0
- package/dist/custom/selectable.js +231 -0
- package/dist/custom/selectable.js.map +1 -0
- package/dist/custom/stepper.js +166 -0
- package/dist/custom/stepper.js.map +1 -0
- package/dist/custom/tab-layout.js +182 -0
- package/dist/custom/tab-layout.js.map +1 -0
- package/dist/custom/tanstack-table/fields/index.js +13 -0
- package/dist/custom/tanstack-table/fields/index.js.map +1 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-action-dialogs.js +76 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-action-dialogs.js.map +1 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-column-header.js +47 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-column-header.js.map +1 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-filter-date.js +132 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-filter-date.js.map +1 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-filter-faceted.js +131 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-filter-faceted.js.map +1 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-filter-text.js +64 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-filter-text.js.map +1 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-pagination.js +135 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-pagination.js.map +1 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-plain-table.js +111 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-plain-table.js.map +1 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-row-actions-confirmation.js +65 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-row-actions-confirmation.js.map +1 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-row-actions-custom-dialog.js +69 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-row-actions-custom-dialog.js.map +1 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-row-actions.js +119 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-row-actions.js.map +1 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-table-actions-custom-dialog.js +75 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-table-actions-custom-dialog.js.map +1 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-table-actions-schemaform-dialog.js +41 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-table-actions-schemaform-dialog.js.map +1 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-toolbar.js +106 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-toolbar.js.map +1 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-view-options.js +132 -0
- package/dist/custom/tanstack-table/fields/tanstack-table-view-options.js.map +1 -0
- package/dist/custom/tanstack-table/index.js +217 -0
- package/dist/custom/tanstack-table/index.js.map +1 -0
- package/dist/custom/tanstack-table/types/index.js +1 -0
- package/dist/custom/tanstack-table/types/index.js.map +1 -0
- package/dist/custom/tanstack-table/utils/cell-with-actions.js +16 -0
- package/dist/custom/tanstack-table/utils/cell-with-actions.js.map +1 -0
- package/dist/custom/tanstack-table/utils/column-names.js +15 -0
- package/dist/custom/tanstack-table/utils/column-names.js.map +1 -0
- package/dist/custom/tanstack-table/utils/columns-by-row-data.js +246 -0
- package/dist/custom/tanstack-table/utils/columns-by-row-data.js.map +1 -0
- package/dist/custom/tanstack-table/utils/editable-columns-by-row-data.js +187 -0
- package/dist/custom/tanstack-table/utils/editable-columns-by-row-data.js.map +1 -0
- package/dist/custom/tanstack-table/utils/faceted-boolean-options.js +25 -0
- package/dist/custom/tanstack-table/utils/faceted-boolean-options.js.map +1 -0
- package/dist/custom/tanstack-table/utils/index.js +10 -0
- package/dist/custom/tanstack-table/utils/index.js.map +1 -0
- package/dist/custom/tanstack-table/utils/pinning-styles.js +38 -0
- package/dist/custom/tanstack-table/utils/pinning-styles.js.map +1 -0
- package/dist/custom/tanstack-table/utils/table.js +66 -0
- package/dist/custom/tanstack-table/utils/table.js.map +1 -0
- package/dist/custom/tanstack-table/utils/test-conditions.js +10 -0
- package/dist/custom/tanstack-table/utils/test-conditions.js.map +1 -0
- package/dist/custom/timeline.js +165 -0
- package/dist/custom/timeline.js.map +1 -0
- package/dist/custom/tree.js +130 -0
- package/dist/custom/tree.js.map +1 -0
- package/dist/custom/tscanify/browser.js +36 -0
- package/dist/custom/tscanify/browser.js.map +1 -0
- package/dist/custom/tscanify/index.js +34 -0
- package/dist/custom/tscanify/index.js.map +1 -0
- package/dist/custom/tscanify/tscanify-browser.js +363 -0
- package/dist/custom/tscanify/tscanify-browser.js.map +1 -0
- package/dist/custom/tscanify/tscanify.js +197 -0
- package/dist/custom/tscanify/tscanify.js.map +1 -0
- package/dist/custom/tscanify/types.js +1 -0
- package/dist/custom/tscanify/types.js.map +1 -0
- package/dist/custom/webcam.js +519 -0
- package/dist/custom/webcam.js.map +1 -0
- package/dist/hooks/use-callback-ref.js +15 -0
- package/dist/hooks/use-callback-ref.js.map +1 -0
- package/dist/hooks/use-controllable-state.js +49 -0
- package/dist/hooks/use-controllable-state.js.map +1 -0
- package/dist/hooks/use-debounce.js +18 -0
- package/dist/hooks/use-debounce.js.map +1 -0
- package/dist/hooks/use-is-visible.js +22 -0
- package/dist/hooks/use-is-visible.js.map +1 -0
- package/dist/hooks/use-media-query.js +19 -0
- package/dist/hooks/use-media-query.js.map +1 -0
- package/dist/hooks/use-mobile.js +21 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/hooks/use-on-window-resize.js +15 -0
- package/dist/hooks/use-on-window-resize.js.map +1 -0
- package/dist/hooks/use-scroll.js +20 -0
- package/dist/hooks/use-scroll.js.map +1 -0
- package/dist/lib/utils.js +48 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/zod.js +7 -0
- package/dist/lib/zod.js.map +1 -0
- package/package.json +34 -8
- package/src/aria/index.tsx +1 -1
- package/src/aria/number-field.tsx +41 -41
- package/src/components/accordion.tsx +66 -66
- package/src/components/alert-dialog.tsx +157 -157
- package/src/components/alert.tsx +70 -70
- package/src/components/aspect-ratio.tsx +11 -11
- package/src/components/avatar.tsx +53 -53
- package/src/components/badge.tsx +74 -67
- package/src/components/breadcrumb.tsx +109 -109
- package/src/components/button-group.tsx +83 -83
- package/src/components/button.tsx +69 -68
- package/src/components/calendar.tsx +216 -219
- package/src/components/card.tsx +92 -92
- package/src/components/carousel.tsx +241 -241
- package/src/components/chart.tsx +363 -363
- package/src/components/checkbox.tsx +32 -32
- package/src/components/collapsible.tsx +33 -33
- package/src/components/command.tsx +184 -184
- package/src/components/context-menu.tsx +252 -252
- package/src/components/dialog.tsx +144 -144
- package/src/components/drawer.tsx +135 -135
- package/src/components/dropdown-menu.tsx +258 -258
- package/src/components/empty.tsx +100 -100
- package/src/components/field.tsx +248 -248
- package/src/components/form.tsx +169 -169
- package/src/components/hover-card.tsx +44 -44
- package/src/components/input-group.tsx +170 -170
- package/src/components/input-otp.tsx +77 -77
- package/src/components/input.tsx +21 -21
- package/src/components/item.tsx +193 -193
- package/src/components/kbd.tsx +28 -28
- package/src/components/label.tsx +24 -24
- package/src/components/menubar.tsx +276 -276
- package/src/components/navigation-menu.tsx +168 -168
- package/src/components/pagination.tsx +127 -130
- package/src/components/popover.tsx +88 -88
- package/src/components/progress.tsx +31 -31
- package/src/components/radio-group.tsx +45 -45
- package/src/components/resizable.tsx +56 -56
- package/src/components/scroll-area.tsx +58 -58
- package/src/components/select.tsx +189 -189
- package/src/components/separator.tsx +28 -28
- package/src/components/sheet.tsx +140 -140
- package/src/components/sidebar.tsx +862 -862
- package/src/components/skeleton.tsx +13 -13
- package/src/components/slider.tsx +63 -63
- package/src/components/sonner.tsx +40 -40
- package/src/components/spinner.tsx +16 -16
- package/src/components/stepper.tsx +290 -291
- package/src/components/switch.tsx +31 -31
- package/src/components/table.tsx +133 -133
- package/src/components/tabs.tsx +66 -66
- package/src/components/textarea.tsx +18 -18
- package/src/components/toggle-group.tsx +83 -83
- package/src/components/toggle.tsx +47 -47
- package/src/components/tooltip.tsx +66 -66
- package/src/custom/action-button.tsx +45 -48
- package/src/custom/async-select.tsx +287 -287
- package/src/custom/awesome-not-found.tsx +116 -116
- package/src/custom/charts/area-chart.tsx +147 -147
- package/src/custom/charts/bar-chart.tsx +233 -233
- package/src/custom/charts/chart-card.tsx +103 -103
- package/src/custom/charts/index.tsx +16 -16
- package/src/custom/charts/pie-chart.tsx +168 -168
- package/src/custom/charts/radar-chart.tsx +126 -126
- package/src/custom/checkbox-tree.tsx +100 -100
- package/src/custom/combobox.tsx +296 -296
- package/src/custom/confirm-dialog.tsx +114 -102
- package/src/custom/country-selector.tsx +204 -204
- package/src/custom/date-picker/calendar-rac.tsx +109 -109
- package/src/custom/date-picker/datefield-rac.tsx +84 -84
- package/src/custom/date-picker/index.tsx +273 -273
- package/src/custom/date-picker/types/index.ts +4 -4
- package/src/custom/date-picker/utils/index.ts +42 -42
- package/src/custom/date-picker-old.tsx +50 -50
- package/src/custom/date-tooltip.tsx +98 -98
- package/src/custom/document-scanner/consts.ts +5 -5
- package/src/custom/document-scanner/corner-adjustment/action-buttons.tsx +33 -33
- package/src/custom/document-scanner/corner-adjustment/corner-handle.tsx +43 -43
- package/src/custom/document-scanner/corner-adjustment/hooks/use-corner-drag.ts +85 -85
- package/src/custom/document-scanner/corner-adjustment/index.tsx +125 -125
- package/src/custom/document-scanner/corner-adjustment/types.ts +53 -53
- package/src/custom/document-scanner/corner-adjustment/utils/clip-path.ts +22 -22
- package/src/custom/document-scanner/corner-adjustment/zoom-magnifier.tsx +115 -115
- package/src/custom/document-scanner/hooks/use-document-capture.ts +81 -81
- package/src/custom/document-scanner/hooks/use-document-scanner.ts +80 -80
- package/src/custom/document-scanner/hooks/use-perspective-crop.ts +38 -38
- package/src/custom/document-scanner/index.tsx +255 -255
- package/src/custom/document-scanner/lib.ts +407 -407
- package/src/custom/document-scanner/types.ts +205 -205
- package/src/custom/document-scanner/utils/perspective-correction.ts +139 -139
- package/src/custom/document-viewer/controllers.tsx +98 -98
- package/src/custom/document-viewer/index.tsx +43 -43
- package/src/custom/document-viewer/renderers/image.tsx +37 -37
- package/src/custom/document-viewer/renderers/index.tsx +2 -2
- package/src/custom/document-viewer/renderers/pdf.tsx +105 -105
- package/src/custom/email-input/domains.json +159 -159
- package/src/custom/email-input/email.tsx +231 -229
- package/src/custom/email-input/index.tsx +4 -4
- package/src/custom/email-input/types.ts +104 -104
- package/src/custom/file-uploader.tsx +541 -541
- package/src/custom/filter-component/fields/async-select.tsx +33 -33
- package/src/custom/filter-component/fields/date.tsx +60 -60
- package/src/custom/filter-component/fields/multi-select.tsx +30 -30
- package/src/custom/filter-component/index.tsx +217 -217
- package/src/custom/image-canvas.tsx +260 -260
- package/src/custom/json-editor.tsx +22 -22
- package/src/custom/master-data-grid/components/dialogs/column-settings-dialog.tsx +100 -100
- package/src/custom/master-data-grid/components/dialogs/index.ts +1 -1
- package/src/custom/master-data-grid/components/filters/client-filter.tsx +369 -368
- package/src/custom/master-data-grid/components/filters/filter-input.tsx +256 -256
- package/src/custom/master-data-grid/components/filters/index.ts +3 -3
- package/src/custom/master-data-grid/components/filters/inline-column-filter.tsx +233 -233
- package/src/custom/master-data-grid/components/filters/multi-filter-dialog.tsx +91 -90
- package/src/custom/master-data-grid/components/filters/server-filter.tsx +265 -255
- package/src/custom/master-data-grid/components/master-data-grid.tsx +472 -472
- package/src/custom/master-data-grid/components/pagination/index.ts +1 -1
- package/src/custom/master-data-grid/components/pagination/pagination.tsx +178 -178
- package/src/custom/master-data-grid/components/table/cell-renderer.tsx +621 -634
- package/src/custom/master-data-grid/components/table/header-cell.tsx +162 -162
- package/src/custom/master-data-grid/components/table/index.ts +4 -4
- package/src/custom/master-data-grid/components/table/table-body-renderer.tsx +113 -113
- package/src/custom/master-data-grid/components/table/virtual-body.tsx +138 -138
- package/src/custom/master-data-grid/components/toolbar/index.ts +1 -1
- package/src/custom/master-data-grid/components/toolbar/toolbar.tsx +314 -314
- package/src/custom/master-data-grid/hooks/index.ts +3 -3
- package/src/custom/master-data-grid/hooks/use-columns.tsx +353 -332
- package/src/custom/master-data-grid/hooks/use-editing.ts +106 -106
- package/src/custom/master-data-grid/hooks/use-table-state-reducer.ts +157 -157
- package/src/custom/master-data-grid/hooks/use-table-state.ts +31 -31
- package/src/custom/master-data-grid/index.ts +16 -16
- package/src/custom/master-data-grid/types.ts +487 -466
- package/src/custom/master-data-grid/utils/column-generator.tsx +324 -306
- package/src/custom/master-data-grid/utils/export-utils.ts +67 -67
- package/src/custom/master-data-grid/utils/filter-fns.ts +310 -290
- package/src/custom/master-data-grid/utils/index.ts +8 -8
- package/src/custom/master-data-grid/utils/pinning-utils.ts +88 -88
- package/src/custom/master-data-grid/utils/translation-utils.ts +42 -42
- package/src/custom/multi-select.tsx +434 -432
- package/src/custom/password-input.tsx +194 -194
- package/src/custom/phone-input.tsx +172 -172
- package/src/custom/schema-form/custom/index.tsx +1 -1
- package/src/custom/schema-form/custom/label.tsx +53 -53
- package/src/custom/schema-form/fields/base-input-field.tsx +82 -82
- package/src/custom/schema-form/fields/field.tsx +67 -67
- package/src/custom/schema-form/fields/index.tsx +5 -5
- package/src/custom/schema-form/fields/object.tsx +12 -12
- package/src/custom/schema-form/fields/table-array/array-field-item.tsx +90 -90
- package/src/custom/schema-form/fields/table-array/array-field-template.tsx +115 -115
- package/src/custom/schema-form/index.tsx +259 -259
- package/src/custom/schema-form/templates/description.tsx +20 -20
- package/src/custom/schema-form/templates/index.tsx +2 -2
- package/src/custom/schema-form/templates/submit.tsx +32 -32
- package/src/custom/schema-form/types.ts +64 -64
- package/src/custom/schema-form/utils/index.ts +4 -4
- package/src/custom/schema-form/utils/schema-dependency.ts +655 -655
- package/src/custom/schema-form/utils/schemas.ts +289 -289
- package/src/custom/schema-form/utils/validation.ts +23 -23
- package/src/custom/schema-form/widgets/boolean.tsx +77 -77
- package/src/custom/schema-form/widgets/combobox.tsx +274 -274
- package/src/custom/schema-form/widgets/date.tsx +59 -59
- package/src/custom/schema-form/widgets/email.tsx +34 -34
- package/src/custom/schema-form/widgets/index.tsx +10 -10
- package/src/custom/schema-form/widgets/password.tsx +40 -40
- package/src/custom/schema-form/widgets/phone.tsx +40 -40
- package/src/custom/schema-form/widgets/select.tsx +105 -105
- package/src/custom/schema-form/widgets/selectable.tsx +25 -25
- package/src/custom/schema-form/widgets/string-array.tsx +296 -296
- package/src/custom/schema-form/widgets/url.tsx +56 -56
- package/src/custom/section-layout-v2.tsx +212 -212
- package/src/custom/select-tabs.tsx +109 -109
- package/src/custom/selectable.tsx +316 -316
- package/src/custom/stepper.tsx +236 -236
- package/src/custom/tab-layout.tsx +213 -213
- package/src/custom/tanstack-table/fields/index.tsx +12 -12
- package/src/custom/tanstack-table/fields/tanstack-table-action-dialogs.tsx +89 -89
- package/src/custom/tanstack-table/fields/tanstack-table-column-header.tsx +68 -66
- package/src/custom/tanstack-table/fields/tanstack-table-filter-date.tsx +180 -180
- package/src/custom/tanstack-table/fields/tanstack-table-filter-faceted.tsx +158 -158
- package/src/custom/tanstack-table/fields/tanstack-table-filter-text.tsx +73 -76
- package/src/custom/tanstack-table/fields/tanstack-table-pagination.tsx +136 -136
- package/src/custom/tanstack-table/fields/tanstack-table-plain-table.tsx +142 -142
- package/src/custom/tanstack-table/fields/tanstack-table-row-actions-confirmation.tsx +77 -77
- package/src/custom/tanstack-table/fields/tanstack-table-row-actions-custom-dialog.tsx +87 -87
- package/src/custom/tanstack-table/fields/tanstack-table-row-actions.tsx +151 -151
- package/src/custom/tanstack-table/fields/tanstack-table-table-actions-custom-dialog.tsx +88 -88
- package/src/custom/tanstack-table/fields/tanstack-table-table-actions-schemaform-dialog.tsx +47 -47
- package/src/custom/tanstack-table/fields/tanstack-table-toolbar.tsx +143 -143
- package/src/custom/tanstack-table/fields/tanstack-table-view-options.tsx +171 -171
- package/src/custom/tanstack-table/index.tsx +244 -244
- package/src/custom/tanstack-table/types/index.ts +328 -328
- package/src/custom/tanstack-table/utils/cell-with-actions.tsx +21 -21
- package/src/custom/tanstack-table/utils/column-names.ts +26 -26
- package/src/custom/tanstack-table/utils/columns-by-row-data.tsx +312 -312
- package/src/custom/tanstack-table/utils/editable-columns-by-row-data.tsx +219 -219
- package/src/custom/tanstack-table/utils/faceted-boolean-options.tsx +22 -22
- package/src/custom/tanstack-table/utils/index.tsx +10 -10
- package/src/custom/tanstack-table/utils/pinning-styles.ts +57 -57
- package/src/custom/tanstack-table/utils/table.tsx +83 -83
- package/src/custom/tanstack-table/utils/test-conditions.ts +17 -17
- package/src/custom/timeline.tsx +208 -208
- package/src/custom/tree.tsx +202 -200
- package/src/custom/tscanify/browser.ts +66 -66
- package/src/custom/tscanify/index.ts +51 -51
- package/src/custom/tscanify/tscanify-browser.ts +522 -522
- package/src/custom/tscanify/tscanify.ts +262 -262
- package/src/custom/tscanify/types.ts +22 -22
- package/src/custom/webcam.tsx +737 -737
- package/src/hooks/use-callback-ref.ts +27 -27
- package/src/hooks/use-controllable-state.ts +67 -67
- package/src/hooks/use-debounce.ts +19 -19
- package/src/hooks/use-is-visible.ts +23 -23
- package/src/hooks/use-media-query.ts +21 -21
- package/src/hooks/use-mobile.ts +21 -21
- package/src/hooks/use-on-window-resize.ts +15 -15
- package/src/hooks/use-scroll.tsx +22 -22
- package/src/lib/utils.ts +61 -61
- package/src/lib/zod.ts +2 -2
- package/src/styles/core.css +57 -57
- package/src/test/email-input.test.tsx +217 -217
- package/src/test/password-input.test.tsx +92 -92
- package/src/test/select-tabs.test.tsx +302 -302
- package/src/test/selectable.test.tsx +1093 -1093
- package/__mocks__/canvas.ts +0 -8
- package/components.json +0 -21
- package/eslint.config.js +0 -4
- package/jest-environment.js +0 -37
- package/jest.config.ts +0 -47
- package/jest.setup.ts +0 -69
- package/postcss.config.mjs +0 -6
- package/tsconfig.json +0 -13
- package/tsconfig.lint.json +0 -8
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { DropdownMenuTrigger } from "@radix-ui/react-dropdown-menu";
|
|
4
|
+
import { ChevronDownIcon } from "lucide-react";
|
|
5
|
+
import { Button } from "@repo/ayasofyazilim-ui/components/button";
|
|
6
|
+
import {
|
|
7
|
+
DropdownMenu,
|
|
8
|
+
DropdownMenuContent,
|
|
9
|
+
DropdownMenuItem
|
|
10
|
+
} from "@repo/ayasofyazilim-ui/components/dropdown-menu";
|
|
11
|
+
function TablePrimaryActionButton({
|
|
12
|
+
table,
|
|
13
|
+
action,
|
|
14
|
+
setRowAction
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */ jsxs(
|
|
17
|
+
Button,
|
|
18
|
+
{
|
|
19
|
+
variant: "outline",
|
|
20
|
+
size: "sm",
|
|
21
|
+
type: "button",
|
|
22
|
+
onClick: () => handleActionOnClick(table, action, setRowAction),
|
|
23
|
+
children: [
|
|
24
|
+
action?.icon && /* @__PURE__ */ jsx(action.icon, { className: "mr-2 h-4 w-4" }),
|
|
25
|
+
action.cta?.toString()
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function handleActionOnClick(table, action, setRowAction) {
|
|
31
|
+
if (action.type === "simple") {
|
|
32
|
+
action.onClick();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (action.type === "create-row") {
|
|
36
|
+
table.options.meta?.addRow(-1, "", null);
|
|
37
|
+
action?.onClick?.();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
setRowAction(action);
|
|
41
|
+
}
|
|
42
|
+
function TanstackTableViewOptions(props) {
|
|
43
|
+
const {
|
|
44
|
+
table,
|
|
45
|
+
tableActions,
|
|
46
|
+
selectedRowAction,
|
|
47
|
+
setTableAction: setRowAction,
|
|
48
|
+
tableData,
|
|
49
|
+
editable
|
|
50
|
+
} = props;
|
|
51
|
+
const filteredActions = tableActions?.filter(
|
|
52
|
+
(action) => !action.condition || action.condition(tableData)
|
|
53
|
+
) ?? [];
|
|
54
|
+
const primaryAction = filteredActions[0];
|
|
55
|
+
const secondaryAction = filteredActions[1];
|
|
56
|
+
const otherActions = filteredActions.slice(2);
|
|
57
|
+
const selectedRowCount = Object.keys(table.getState().rowSelection).length;
|
|
58
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
59
|
+
selectedRowAction && selectedRowCount > 0 && /* @__PURE__ */ jsx(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: primaryAction && (primaryAction.condition && primaryAction.condition?.(tableData) || true) && otherActions && "mr-2",
|
|
63
|
+
children: /* @__PURE__ */ jsxs(
|
|
64
|
+
Button,
|
|
65
|
+
{
|
|
66
|
+
variant: "outline",
|
|
67
|
+
size: "sm",
|
|
68
|
+
type: "button",
|
|
69
|
+
className: "ml-2",
|
|
70
|
+
onClick: () => {
|
|
71
|
+
const selectedRowIds = table.getState().rowSelection;
|
|
72
|
+
selectedRowAction.onClick(Object.keys(selectedRowIds), tableData);
|
|
73
|
+
},
|
|
74
|
+
children: [
|
|
75
|
+
selectedRowAction?.icon && /* @__PURE__ */ jsx(selectedRowAction.icon, { className: "mr-2 h-4 w-4" }),
|
|
76
|
+
`${selectedRowAction.cta?.toString()} (${selectedRowCount})`
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
editable && null,
|
|
83
|
+
/* @__PURE__ */ jsxs("div", { className: "space-x-2", children: [
|
|
84
|
+
primaryAction && /* @__PURE__ */ jsx(
|
|
85
|
+
TablePrimaryActionButton,
|
|
86
|
+
{
|
|
87
|
+
table,
|
|
88
|
+
action: primaryAction,
|
|
89
|
+
setRowAction
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
secondaryAction && /* @__PURE__ */ jsx(
|
|
93
|
+
TablePrimaryActionButton,
|
|
94
|
+
{
|
|
95
|
+
table,
|
|
96
|
+
action: secondaryAction,
|
|
97
|
+
setRowAction
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
otherActions && otherActions.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
101
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
102
|
+
Button,
|
|
103
|
+
{
|
|
104
|
+
size: "sm",
|
|
105
|
+
type: "button",
|
|
106
|
+
variant: "outline",
|
|
107
|
+
className: "px-2",
|
|
108
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })
|
|
109
|
+
}
|
|
110
|
+
) }),
|
|
111
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", className: "w-40", children: otherActions?.map((action) => /* @__PURE__ */ jsx(DropdownMenuItem, { children: /* @__PURE__ */ jsxs(
|
|
112
|
+
Button,
|
|
113
|
+
{
|
|
114
|
+
variant: "ghost",
|
|
115
|
+
type: "button",
|
|
116
|
+
size: "sm",
|
|
117
|
+
className: "justify-start w-full",
|
|
118
|
+
onClick: () => handleActionOnClick(table, action, setRowAction),
|
|
119
|
+
children: [
|
|
120
|
+
action.icon && /* @__PURE__ */ jsx(action.icon, { className: "w-4 h-4" }),
|
|
121
|
+
/* @__PURE__ */ jsx("span", { className: "ml-2", children: action.cta })
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
) }, action.cta)) })
|
|
125
|
+
] })
|
|
126
|
+
] })
|
|
127
|
+
] });
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
TanstackTableViewOptions
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=tanstack-table-view-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/custom/tanstack-table/fields/tanstack-table-view-options.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport { DropdownMenuTrigger } from \"@radix-ui/react-dropdown-menu\";\r\nimport { Table } from \"@tanstack/react-table\";\r\n\r\nimport { ChevronDownIcon } from \"lucide-react\";\r\nimport { Button } from \"@repo/ayasofyazilim-ui/components/button\";\r\nimport {\r\n DropdownMenu,\r\n DropdownMenuContent,\r\n DropdownMenuItem,\r\n} from \"@repo/ayasofyazilim-ui/components/dropdown-menu\";\r\nimport {\r\n TanstackTableSelectedRowActionType,\r\n TanstackTableTableActionsType,\r\n} from \"../types\";\r\n\r\ninterface TanstackTableViewOptionsProps<TData> {\r\n editable?: boolean;\r\n selectedRowAction?: TanstackTableSelectedRowActionType<TData>;\r\n setTableAction: (actions: TanstackTableTableActionsType<TData>) => void;\r\n table: Table<TData>;\r\n tableActions?: TanstackTableTableActionsType<TData>[];\r\n tableData: TData[];\r\n}\r\n\r\nfunction TablePrimaryActionButton<TData>({\r\n table,\r\n action,\r\n setRowAction,\r\n}: {\r\n action: TanstackTableTableActionsType<TData>;\r\n setRowAction: (actions: TanstackTableTableActionsType<TData>) => void;\r\n table: Table<TData>;\r\n}) {\r\n return (\r\n <Button\r\n variant=\"outline\"\r\n size=\"sm\"\r\n type=\"button\"\r\n onClick={() => handleActionOnClick(table, action, setRowAction)}\r\n >\r\n {action?.icon && <action.icon className=\"mr-2 h-4 w-4\" />}\r\n {action.cta?.toString()}\r\n </Button>\r\n );\r\n}\r\nfunction handleActionOnClick<TData>(\r\n table: Table<TData>,\r\n action: TanstackTableTableActionsType<TData>,\r\n setRowAction: (actions: TanstackTableTableActionsType<TData>) => void\r\n) {\r\n if (action.type === \"simple\") {\r\n action.onClick();\r\n return;\r\n }\r\n if (action.type === \"create-row\") {\r\n table.options.meta?.addRow(-1, \"\", null);\r\n action?.onClick?.();\r\n return;\r\n }\r\n setRowAction(action);\r\n}\r\n\r\nexport function TanstackTableViewOptions<TData>(\r\n props: TanstackTableViewOptionsProps<TData>\r\n) {\r\n const {\r\n table,\r\n tableActions,\r\n selectedRowAction,\r\n setTableAction: setRowAction,\r\n tableData,\r\n editable,\r\n } = props;\r\n\r\n // Filter actions based on condition, keeping backward compatibility\r\n const filteredActions =\r\n tableActions?.filter(\r\n (action) => !action.condition || action.condition(tableData)\r\n ) ?? [];\r\n\r\n const primaryAction = filteredActions[0];\r\n const secondaryAction = filteredActions[1];\r\n const otherActions = filteredActions.slice(2);\r\n const selectedRowCount = Object.keys(table.getState().rowSelection).length;\r\n\r\n return (\r\n <>\r\n {selectedRowAction && selectedRowCount > 0 && (\r\n <div\r\n className={\r\n primaryAction &&\r\n ((primaryAction.condition &&\r\n primaryAction.condition?.(tableData)) ||\r\n true) &&\r\n otherActions &&\r\n \"mr-2\"\r\n }\r\n >\r\n <Button\r\n variant=\"outline\"\r\n size=\"sm\"\r\n type=\"button\"\r\n className=\"ml-2\"\r\n onClick={() => {\r\n const selectedRowIds = table.getState().rowSelection;\r\n selectedRowAction.onClick(Object.keys(selectedRowIds), tableData);\r\n }}\r\n >\r\n {selectedRowAction?.icon && (\r\n <selectedRowAction.icon className=\"mr-2 h-4 w-4\" />\r\n )}\r\n {`${selectedRowAction.cta?.toString()} (${selectedRowCount})`}\r\n </Button>\r\n </div>\r\n )}\r\n\r\n {editable && null}\r\n\r\n <div className=\"space-x-2\">\r\n {primaryAction && (\r\n <TablePrimaryActionButton\r\n table={table}\r\n action={primaryAction}\r\n setRowAction={setRowAction}\r\n />\r\n )}\r\n {secondaryAction && (\r\n <TablePrimaryActionButton\r\n table={table}\r\n action={secondaryAction}\r\n setRowAction={setRowAction}\r\n />\r\n )}\r\n {otherActions && otherActions.length > 0 && (\r\n <DropdownMenu>\r\n <DropdownMenuTrigger asChild>\r\n <Button\r\n size=\"sm\"\r\n type=\"button\"\r\n variant=\"outline\"\r\n className=\"px-2\"\r\n >\r\n <ChevronDownIcon className=\"size-4\" />\r\n </Button>\r\n </DropdownMenuTrigger>\r\n <DropdownMenuContent align=\"end\" className=\"w-40\">\r\n {otherActions?.map((action) => (\r\n <DropdownMenuItem key={action.cta}>\r\n <Button\r\n variant=\"ghost\"\r\n type=\"button\"\r\n size=\"sm\"\r\n className=\"justify-start w-full\"\r\n onClick={() =>\r\n handleActionOnClick(table, action, setRowAction)\r\n }\r\n >\r\n {action.icon && <action.icon className=\"w-4 h-4\" />}\r\n <span className=\"ml-2\">{action.cta}</span>\r\n </Button>\r\n </DropdownMenuItem>\r\n ))}\r\n </DropdownMenuContent>\r\n </DropdownMenu>\r\n )}\r\n </div>\r\n </>\r\n );\r\n}\r\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use no memo";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import {
|
|
5
|
+
getCoreRowModel,
|
|
6
|
+
getExpandedRowModel,
|
|
7
|
+
getPaginationRowModel,
|
|
8
|
+
getSortedRowModel,
|
|
9
|
+
useReactTable
|
|
10
|
+
} from "@tanstack/react-table";
|
|
11
|
+
import { useCallback, useMemo, useState } from "react";
|
|
12
|
+
import {
|
|
13
|
+
TanstackTableActionDialogs,
|
|
14
|
+
TanstackTablePagination,
|
|
15
|
+
TanstackTablePlainTable,
|
|
16
|
+
TanstackTableToolbar
|
|
17
|
+
} from "./fields";
|
|
18
|
+
import {
|
|
19
|
+
CellWithActions,
|
|
20
|
+
EditableTanstackTable,
|
|
21
|
+
NonEditableTanstackTable
|
|
22
|
+
} from "./utils";
|
|
23
|
+
function TanstackTable({
|
|
24
|
+
data,
|
|
25
|
+
rowCount,
|
|
26
|
+
columns,
|
|
27
|
+
columnOrder,
|
|
28
|
+
columnVisibility,
|
|
29
|
+
pinColumns,
|
|
30
|
+
rowActions,
|
|
31
|
+
tableActions,
|
|
32
|
+
selectedRowAction,
|
|
33
|
+
expandedRowComponent,
|
|
34
|
+
fillerColumn,
|
|
35
|
+
editable,
|
|
36
|
+
excludeColumns,
|
|
37
|
+
onTableDataChange,
|
|
38
|
+
filters,
|
|
39
|
+
title,
|
|
40
|
+
resizeable = true,
|
|
41
|
+
showPagination = true
|
|
42
|
+
}) {
|
|
43
|
+
const commonProps = {
|
|
44
|
+
pinColumns,
|
|
45
|
+
columnOrder,
|
|
46
|
+
columnVisibility,
|
|
47
|
+
rowActions,
|
|
48
|
+
tableActions,
|
|
49
|
+
selectedRowAction,
|
|
50
|
+
excludeColumns,
|
|
51
|
+
expandedRowComponent,
|
|
52
|
+
title,
|
|
53
|
+
resizeable
|
|
54
|
+
};
|
|
55
|
+
if (editable) {
|
|
56
|
+
return /* @__PURE__ */ jsx(
|
|
57
|
+
TanstackBase,
|
|
58
|
+
{
|
|
59
|
+
...commonProps,
|
|
60
|
+
...EditableTanstackTable({ initialData: data, onTableDataChange }),
|
|
61
|
+
columns,
|
|
62
|
+
editable: true,
|
|
63
|
+
fillerColumn
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
return /* @__PURE__ */ jsx(
|
|
68
|
+
TanstackBase,
|
|
69
|
+
{
|
|
70
|
+
...commonProps,
|
|
71
|
+
...NonEditableTanstackTable(data, rowCount || 0),
|
|
72
|
+
columns,
|
|
73
|
+
editable: false,
|
|
74
|
+
filters,
|
|
75
|
+
fillerColumn,
|
|
76
|
+
showPagination
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
function TanstackBase(props) {
|
|
81
|
+
const {
|
|
82
|
+
data,
|
|
83
|
+
columns,
|
|
84
|
+
columnOrder,
|
|
85
|
+
rowCount,
|
|
86
|
+
columnVisibility,
|
|
87
|
+
pinColumns,
|
|
88
|
+
rowActions,
|
|
89
|
+
tableActions,
|
|
90
|
+
selectedRowAction,
|
|
91
|
+
expandedRowComponent,
|
|
92
|
+
fillerColumn,
|
|
93
|
+
editable,
|
|
94
|
+
excludeColumns,
|
|
95
|
+
onPaginationChange,
|
|
96
|
+
onColumnFiltersChange,
|
|
97
|
+
columnFilters,
|
|
98
|
+
pagination,
|
|
99
|
+
filters,
|
|
100
|
+
meta,
|
|
101
|
+
showPagination,
|
|
102
|
+
title,
|
|
103
|
+
resizeable
|
|
104
|
+
} = props;
|
|
105
|
+
const [sorting, setSorting] = useState([]);
|
|
106
|
+
const [colVisibility, setColumnVisibility] = useState(
|
|
107
|
+
columnVisibility ? Object.fromEntries(
|
|
108
|
+
columns.map((col) => [
|
|
109
|
+
col.id || "",
|
|
110
|
+
columnVisibility?.columns.includes(
|
|
111
|
+
col.id || ""
|
|
112
|
+
) === (columnVisibility.type === "show")
|
|
113
|
+
])
|
|
114
|
+
) : {}
|
|
115
|
+
);
|
|
116
|
+
const [rowAction, setRowAction] = useState(null);
|
|
117
|
+
const [tableAction, setTableAction] = useState(null);
|
|
118
|
+
const tableColumns = useMemo(() => {
|
|
119
|
+
const _columns = [...columns].filter(
|
|
120
|
+
(col) => !excludeColumns?.includes(col.id)
|
|
121
|
+
);
|
|
122
|
+
if (rowActions) {
|
|
123
|
+
_columns.push({
|
|
124
|
+
id: "actions",
|
|
125
|
+
cell: ({ row }) => CellWithActions(table, row, rowActions, setRowAction)
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
if (!resizeable) return _columns;
|
|
129
|
+
return _columns.map((col) => ({
|
|
130
|
+
...col,
|
|
131
|
+
minSize: fillerColumn === col.id ? 600 : void 0
|
|
132
|
+
}));
|
|
133
|
+
}, [columns, rowActions]);
|
|
134
|
+
const getRowId = useCallback(
|
|
135
|
+
(row, index) => editable ? index.toString() : row.id,
|
|
136
|
+
[]
|
|
137
|
+
);
|
|
138
|
+
const table = useReactTable({
|
|
139
|
+
data,
|
|
140
|
+
columns: tableColumns,
|
|
141
|
+
getRowId,
|
|
142
|
+
columnResizeMode: "onChange",
|
|
143
|
+
columnResizeDirection: "ltr",
|
|
144
|
+
state: {
|
|
145
|
+
sorting,
|
|
146
|
+
columnVisibility: colVisibility,
|
|
147
|
+
columnFilters,
|
|
148
|
+
pagination
|
|
149
|
+
},
|
|
150
|
+
initialState: {
|
|
151
|
+
columnOrder,
|
|
152
|
+
columnPinning: {
|
|
153
|
+
left: [
|
|
154
|
+
"expanded-content",
|
|
155
|
+
"select",
|
|
156
|
+
...pinColumns ?? []
|
|
157
|
+
],
|
|
158
|
+
right: ["actions"]
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
enableRowSelection: true,
|
|
162
|
+
enableColumnResizing: true,
|
|
163
|
+
enableColumnPinning: true,
|
|
164
|
+
manualPagination: true,
|
|
165
|
+
getRowCanExpand: () => !!expandedRowComponent,
|
|
166
|
+
getCoreRowModel: getCoreRowModel(),
|
|
167
|
+
onSortingChange: setSorting,
|
|
168
|
+
getSortedRowModel: getSortedRowModel(),
|
|
169
|
+
onColumnVisibilityChange: setColumnVisibility,
|
|
170
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
171
|
+
getExpandedRowModel: getExpandedRowModel(),
|
|
172
|
+
onPaginationChange,
|
|
173
|
+
onColumnFiltersChange,
|
|
174
|
+
rowCount,
|
|
175
|
+
meta
|
|
176
|
+
});
|
|
177
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 overflow-hidden", children: [
|
|
178
|
+
/* @__PURE__ */ jsx(
|
|
179
|
+
TanstackTableToolbar,
|
|
180
|
+
{
|
|
181
|
+
title,
|
|
182
|
+
table,
|
|
183
|
+
filters,
|
|
184
|
+
selectedRowAction,
|
|
185
|
+
tableActions,
|
|
186
|
+
tableData: data,
|
|
187
|
+
setTableAction,
|
|
188
|
+
editable
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-md border overflow-auto flex-1 h-0 max-h-max", children: /* @__PURE__ */ jsx(
|
|
192
|
+
TanstackTablePlainTable,
|
|
193
|
+
{
|
|
194
|
+
resizeable,
|
|
195
|
+
table,
|
|
196
|
+
columns: tableColumns,
|
|
197
|
+
editable,
|
|
198
|
+
expandedRowComponent,
|
|
199
|
+
fillerColumn
|
|
200
|
+
}
|
|
201
|
+
) }),
|
|
202
|
+
pagination && showPagination && /* @__PURE__ */ jsx(TanstackTablePagination, { table, pagination }),
|
|
203
|
+
/* @__PURE__ */ jsx(
|
|
204
|
+
TanstackTableActionDialogs,
|
|
205
|
+
{
|
|
206
|
+
tableAction,
|
|
207
|
+
setTableAction,
|
|
208
|
+
rowAction,
|
|
209
|
+
setRowAction
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
] });
|
|
213
|
+
}
|
|
214
|
+
export {
|
|
215
|
+
TanstackTable as default
|
|
216
|
+
};
|
|
217
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/custom/tanstack-table/index.tsx"],"sourcesContent":["\"use client\";\r\n\"use no memo\";\r\nimport {\r\n getCoreRowModel,\r\n getExpandedRowModel,\r\n getPaginationRowModel,\r\n getSortedRowModel,\r\n RowData,\r\n SortingState,\r\n useReactTable,\r\n VisibilityState,\r\n} from \"@tanstack/react-table\";\r\nimport { useCallback, useMemo, useState } from \"react\";\r\n\r\nimport {\r\n TanstackTableActionDialogs,\r\n TanstackTablePagination,\r\n TanstackTablePlainTable,\r\n TanstackTableToolbar,\r\n} from \"./fields\";\r\n\r\nimport {\r\n TanstackBaseProps,\r\n TanstackTablePropsType,\r\n TanstackTableRowActionsType,\r\n TanstackTableTableActionsType,\r\n} from \"./types\";\r\nimport {\r\n CellWithActions,\r\n EditableTanstackTable,\r\n NonEditableTanstackTable,\r\n} from \"./utils\";\r\n\r\ndeclare module \"@tanstack/react-table\" {\r\n // eslint-disaxxble-next-line @typescript-eslint/no-unused-vars\r\n interface TableMeta<TData extends RowData> {\r\n addRow: (rowIndex: number, columnId: string, value: unknown) => void;\r\n removeRow: (rowIndex: number, columnId: string, value: unknown) => void;\r\n updateData: (rowIndex: number, columnId: string, value: unknown) => void;\r\n duplicateRow: (rowIndex: number, value: TData) => void;\r\n orderRow: (newIndex: number, oldIndex: number) => void;\r\n }\r\n}\r\n\r\nexport default function TanstackTable<TData, TValue>({\r\n data,\r\n rowCount,\r\n columns,\r\n columnOrder,\r\n columnVisibility,\r\n pinColumns,\r\n rowActions,\r\n tableActions,\r\n selectedRowAction,\r\n expandedRowComponent,\r\n fillerColumn,\r\n editable,\r\n excludeColumns,\r\n onTableDataChange,\r\n filters,\r\n title,\r\n resizeable = true,\r\n showPagination = true,\r\n}: TanstackTablePropsType<TData, TValue>) {\r\n const commonProps = {\r\n pinColumns,\r\n columnOrder,\r\n columnVisibility,\r\n rowActions,\r\n tableActions,\r\n selectedRowAction,\r\n excludeColumns,\r\n expandedRowComponent,\r\n title,\r\n resizeable,\r\n };\r\n if (editable) {\r\n return (\r\n <TanstackBase<TData, TValue>\r\n {...commonProps}\r\n {...EditableTanstackTable({ initialData: data, onTableDataChange })}\r\n columns={columns}\r\n editable\r\n fillerColumn={fillerColumn}\r\n />\r\n );\r\n }\r\n return (\r\n <TanstackBase<TData, TValue>\r\n {...commonProps}\r\n {...NonEditableTanstackTable(data, rowCount || 0)}\r\n columns={columns}\r\n editable={false}\r\n filters={filters}\r\n fillerColumn={fillerColumn}\r\n showPagination={showPagination}\r\n />\r\n );\r\n}\r\n\r\nfunction TanstackBase<TData, TValue>(props: TanstackBaseProps<TData, TValue>) {\r\n const {\r\n data,\r\n columns,\r\n columnOrder,\r\n rowCount,\r\n columnVisibility,\r\n pinColumns,\r\n rowActions,\r\n tableActions,\r\n selectedRowAction,\r\n expandedRowComponent,\r\n fillerColumn,\r\n editable,\r\n excludeColumns,\r\n onPaginationChange,\r\n onColumnFiltersChange,\r\n columnFilters,\r\n pagination,\r\n filters,\r\n meta,\r\n showPagination,\r\n title,\r\n resizeable,\r\n } = props;\r\n const [sorting, setSorting] = useState<SortingState>([]);\r\n const [colVisibility, setColumnVisibility] = useState<VisibilityState>(\r\n columnVisibility\r\n ? Object.fromEntries(\r\n columns.map((col) => [\r\n col.id || \"\",\r\n\r\n columnVisibility?.columns.includes(\r\n (col.id || \"\") as keyof TData\r\n ) ===\r\n (columnVisibility.type === \"show\"),\r\n ])\r\n )\r\n : {}\r\n );\r\n const [rowAction, setRowAction] = useState<\r\n (TanstackTableRowActionsType<TData> & { row: TData }) | null\r\n >(null);\r\n const [tableAction, setTableAction] =\r\n useState<TanstackTableTableActionsType<TData> | null>(null);\r\n\r\n const tableColumns = useMemo(() => {\r\n const _columns = [...columns].filter(\r\n (col) => !excludeColumns?.includes(col.id as keyof TData)\r\n );\r\n\r\n if (rowActions) {\r\n _columns.push({\r\n id: \"actions\",\r\n cell: ({ row }) =>\r\n CellWithActions(table, row, rowActions, setRowAction),\r\n });\r\n }\r\n if (!resizeable) return _columns;\r\n return _columns.map((col) => ({\r\n ...col,\r\n minSize: fillerColumn === col.id ? 600 : undefined,\r\n }));\r\n }, [columns, rowActions]);\r\n\r\n const getRowId = useCallback(\r\n (row: TData, index: number) =>\r\n editable ? index.toString() : (row as TData & { id: string }).id,\r\n []\r\n );\r\n\r\n const table = useReactTable({\r\n data,\r\n columns: tableColumns,\r\n getRowId,\r\n columnResizeMode: \"onChange\",\r\n columnResizeDirection: \"ltr\",\r\n state: {\r\n sorting,\r\n columnVisibility: colVisibility,\r\n columnFilters,\r\n pagination,\r\n },\r\n initialState: {\r\n columnOrder: columnOrder as string[],\r\n columnPinning: {\r\n left: [\r\n \"expanded-content\",\r\n \"select\",\r\n ...((pinColumns as string[]) ?? []),\r\n ],\r\n right: [\"actions\"],\r\n },\r\n },\r\n enableRowSelection: true,\r\n enableColumnResizing: true,\r\n enableColumnPinning: true,\r\n manualPagination: true,\r\n getRowCanExpand: () => !!expandedRowComponent,\r\n getCoreRowModel: getCoreRowModel(),\r\n onSortingChange: setSorting,\r\n getSortedRowModel: getSortedRowModel(),\r\n onColumnVisibilityChange: setColumnVisibility,\r\n getPaginationRowModel: getPaginationRowModel(),\r\n getExpandedRowModel: getExpandedRowModel(),\r\n onPaginationChange,\r\n onColumnFiltersChange,\r\n rowCount,\r\n meta,\r\n });\r\n return (\r\n <div className=\"flex flex-col gap-2 overflow-hidden\">\r\n <TanstackTableToolbar<TData>\r\n title={title}\r\n table={table}\r\n filters={filters}\r\n selectedRowAction={selectedRowAction}\r\n tableActions={tableActions}\r\n tableData={data}\r\n setTableAction={setTableAction}\r\n editable={editable}\r\n />\r\n <div className=\"rounded-md border overflow-auto flex-1 h-0 max-h-max\">\r\n <TanstackTablePlainTable\r\n resizeable={resizeable}\r\n table={table}\r\n columns={tableColumns}\r\n editable={editable}\r\n expandedRowComponent={expandedRowComponent}\r\n fillerColumn={fillerColumn}\r\n />\r\n </div>\r\n {pagination && showPagination && (\r\n <TanstackTablePagination table={table} pagination={pagination} />\r\n )}\r\n <TanstackTableActionDialogs\r\n tableAction={tableAction}\r\n setTableAction={setTableAction}\r\n rowAction={rowAction}\r\n setRowAction={setRowAction}\r\n />\r\n </div>\r\n );\r\n}\r\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { TanstackTableRowActions } from "../fields";
|
|
4
|
+
const CellWithActions = (table, row, actions, setRowAction) => /* @__PURE__ */ jsx(
|
|
5
|
+
TanstackTableRowActions,
|
|
6
|
+
{
|
|
7
|
+
row,
|
|
8
|
+
actions,
|
|
9
|
+
setRowAction,
|
|
10
|
+
table
|
|
11
|
+
}
|
|
12
|
+
);
|
|
13
|
+
export {
|
|
14
|
+
CellWithActions
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=cell-with-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/custom/tanstack-table/utils/cell-with-actions.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport { Row, Table as TableType } from \"@tanstack/react-table\";\r\nimport { TanstackTableRowActions } from \"../fields\";\r\nimport { TanstackTableRowActionsType } from \"../types\";\r\n\r\nexport const CellWithActions = <TData,>(\r\n table: TableType<TData>,\r\n row: Row<TData>,\r\n actions: TanstackTableRowActionsType<TData>[],\r\n setRowAction: (\r\n actions: TanstackTableRowActionsType<TData> & { row: TData }\r\n ) => void\r\n) => (\r\n <TanstackTableRowActions\r\n row={row}\r\n actions={actions}\r\n setRowAction={setRowAction}\r\n table={table}\r\n />\r\n);\r\n"],"mappings":";AAcE;AAXF,SAAS,+BAA+B;AAGjC,MAAM,kBAAkB,CAC7B,OACA,KACA,SACA,iBAIA;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AACF;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const isTypeLanguageDataTypeWithConstantKey = (value) => value && typeof value !== "undefined" && "constantKey" in value;
|
|
2
|
+
function tanstackTableCreateTitleWithLanguageData({
|
|
3
|
+
languageData,
|
|
4
|
+
accessorKey
|
|
5
|
+
}) {
|
|
6
|
+
if (languageData && isTypeLanguageDataTypeWithConstantKey(languageData)) {
|
|
7
|
+
const { constantKey, languageData: res } = languageData;
|
|
8
|
+
return res[`${constantKey}.${accessorKey}`] || accessorKey;
|
|
9
|
+
}
|
|
10
|
+
return languageData?.[accessorKey] || accessorKey;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
tanstackTableCreateTitleWithLanguageData
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=column-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/custom/tanstack-table/utils/column-names.ts"],"sourcesContent":["import {\r\n TanstackTableLanguageDataType,\r\n TanstackTableLanguageDataTypeWithConstantKey,\r\n} from \"../types\";\r\n\r\nconst isTypeLanguageDataTypeWithConstantKey = (\r\n value: object\r\n): value is TanstackTableLanguageDataTypeWithConstantKey =>\r\n value && typeof value !== \"undefined\" && \"constantKey\" in value;\r\n\r\nexport function tanstackTableCreateTitleWithLanguageData({\r\n languageData,\r\n accessorKey,\r\n}: {\r\n accessorKey: string;\r\n languageData?:\r\n | TanstackTableLanguageDataType\r\n | TanstackTableLanguageDataTypeWithConstantKey;\r\n}): string {\r\n if (languageData && isTypeLanguageDataTypeWithConstantKey(languageData)) {\r\n const { constantKey, languageData: res } = languageData;\r\n return res[`${constantKey}.${accessorKey}`] || accessorKey;\r\n }\r\n\r\n return languageData?.[accessorKey] || accessorKey;\r\n}\r\n"],"mappings":"AAKA,MAAM,wCAAwC,CAC5C,UAEA,SAAS,OAAO,UAAU,eAAe,iBAAiB;AAErD,SAAS,yCAAyC;AAAA,EACvD;AAAA,EACA;AACF,GAKW;AACT,MAAI,gBAAgB,sCAAsC,YAAY,GAAG;AACvE,UAAM,EAAE,aAAa,cAAc,IAAI,IAAI;AAC3C,WAAO,IAAI,GAAG,WAAW,IAAI,WAAW,EAAE,KAAK;AAAA,EACjD;AAEA,SAAO,eAAe,WAAW,KAAK;AACxC;","names":[]}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { Badge } from "@repo/ayasofyazilim-ui/components/badge";
|
|
5
|
+
import { Checkbox } from "@repo/ayasofyazilim-ui/components/checkbox";
|
|
6
|
+
import { cn } from "@repo/ayasofyazilim-ui/lib/utils";
|
|
7
|
+
import { tanstackTableCreateTitleWithLanguageData, testConditions } from ".";
|
|
8
|
+
import DateTooltip from "../../date-tooltip";
|
|
9
|
+
import { TanstackTableColumnHeader } from "../fields";
|
|
10
|
+
function createCell(props) {
|
|
11
|
+
const {
|
|
12
|
+
accessorKey,
|
|
13
|
+
row,
|
|
14
|
+
link,
|
|
15
|
+
badge,
|
|
16
|
+
icon,
|
|
17
|
+
className,
|
|
18
|
+
expandRowTrigger,
|
|
19
|
+
format,
|
|
20
|
+
custom,
|
|
21
|
+
config,
|
|
22
|
+
faceted,
|
|
23
|
+
localization
|
|
24
|
+
} = props;
|
|
25
|
+
let content = row.getValue(accessorKey.toString())?.toString() || "";
|
|
26
|
+
if (format) {
|
|
27
|
+
if (format === "date" || format === "date-time") {
|
|
28
|
+
content = content ? /* @__PURE__ */ jsx(
|
|
29
|
+
DateTooltip,
|
|
30
|
+
{
|
|
31
|
+
date: content,
|
|
32
|
+
dateOptions: config?.dateOptions,
|
|
33
|
+
localization
|
|
34
|
+
}
|
|
35
|
+
) : "";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (icon) {
|
|
39
|
+
const position = icon.position || "before";
|
|
40
|
+
content = /* @__PURE__ */ jsxs("div", { className: "inline-flex", children: [
|
|
41
|
+
icon.icon && position === "before" && /* @__PURE__ */ jsx(icon.icon, { className: cn("w-4 h-4 mr-2", icon.iconClassName) }),
|
|
42
|
+
row.getValue(accessorKey.toString()),
|
|
43
|
+
icon.icon && position === "after" && /* @__PURE__ */ jsx(icon.icon, { className: cn("w-4 h-4 ml-2", icon.iconClassName) })
|
|
44
|
+
] });
|
|
45
|
+
}
|
|
46
|
+
if (badge) {
|
|
47
|
+
const position = {
|
|
48
|
+
before: [],
|
|
49
|
+
after: []
|
|
50
|
+
};
|
|
51
|
+
badge.values.forEach((item) => {
|
|
52
|
+
const itemPosition = item.position || "before";
|
|
53
|
+
item.conditions?.forEach((condition) => {
|
|
54
|
+
if (condition.when(row.getValue(condition.conditionAccessorKey))) {
|
|
55
|
+
position[itemPosition].push(
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
Badge,
|
|
58
|
+
{
|
|
59
|
+
variant: "outline",
|
|
60
|
+
className: item.badgeClassName,
|
|
61
|
+
children: item.label
|
|
62
|
+
},
|
|
63
|
+
item.label
|
|
64
|
+
)
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
71
|
+
position.before,
|
|
72
|
+
!badge.hideColumnValue && content,
|
|
73
|
+
position.after
|
|
74
|
+
] });
|
|
75
|
+
}
|
|
76
|
+
if (faceted) {
|
|
77
|
+
const facetedItem = faceted.find(
|
|
78
|
+
(item) => item.when?.(row.getValue(accessorKey.toString())) || row.getValue(accessorKey.toString()) === item.value
|
|
79
|
+
);
|
|
80
|
+
if (facetedItem) {
|
|
81
|
+
content = /* @__PURE__ */ jsxs("div", { className: cn("flex items-center", facetedItem.className), children: [
|
|
82
|
+
facetedItem.icon && /* @__PURE__ */ jsx(
|
|
83
|
+
facetedItem.icon,
|
|
84
|
+
{
|
|
85
|
+
className: cn(
|
|
86
|
+
"text-muted-foreground mr-2 h-4 w-4",
|
|
87
|
+
facetedItem.iconClassName
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
facetedItem.hideColumnValue ? "" : /* @__PURE__ */ jsx("span", { children: facetedItem.label })
|
|
92
|
+
] });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const containerClassName = className?.map((item) => {
|
|
96
|
+
if (testConditions(item.conditions, row)) {
|
|
97
|
+
return item.className;
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}).join(" ");
|
|
101
|
+
if (custom) content = custom.content(row.original, row);
|
|
102
|
+
if (!link || !testConditions(link.conditions, row)) {
|
|
103
|
+
if (expandRowTrigger) {
|
|
104
|
+
return /* @__PURE__ */ jsx(
|
|
105
|
+
"button",
|
|
106
|
+
{
|
|
107
|
+
type: "button",
|
|
108
|
+
onClick: row.getToggleExpandedHandler(),
|
|
109
|
+
"data-testid": `expand-row-${accessorKey.toString()}`,
|
|
110
|
+
className: cn(
|
|
111
|
+
"font-medium text-blue-700 flex items-center gap-2 cursor-pointer",
|
|
112
|
+
containerClassName
|
|
113
|
+
),
|
|
114
|
+
children: content
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
return /* @__PURE__ */ jsx("div", { className: cn(" flex items-center gap-2", containerClassName), children: content });
|
|
119
|
+
}
|
|
120
|
+
let url = link.prefix;
|
|
121
|
+
if (link.targetAccessorKey) {
|
|
122
|
+
url += `/${row._getAllCellsByColumnId()?.[link.targetAccessorKey || ""]?.getValue()?.toString()}`;
|
|
123
|
+
}
|
|
124
|
+
if (link.suffix) {
|
|
125
|
+
url += `/${link.suffix}`;
|
|
126
|
+
}
|
|
127
|
+
return /* @__PURE__ */ jsx(
|
|
128
|
+
Link,
|
|
129
|
+
{
|
|
130
|
+
href: url,
|
|
131
|
+
className: cn(
|
|
132
|
+
"font-medium text-blue-700 flex items-center gap-2",
|
|
133
|
+
containerClassName
|
|
134
|
+
),
|
|
135
|
+
children: content
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
function tanstackTableCreateColumnsByRowData(params) {
|
|
140
|
+
const { rows, config } = params;
|
|
141
|
+
const {
|
|
142
|
+
excludeColumns,
|
|
143
|
+
languageData,
|
|
144
|
+
links,
|
|
145
|
+
faceted,
|
|
146
|
+
badges,
|
|
147
|
+
classNames,
|
|
148
|
+
icons,
|
|
149
|
+
expandRowTrigger,
|
|
150
|
+
custom,
|
|
151
|
+
localization,
|
|
152
|
+
onSelectedRowChange
|
|
153
|
+
} = params;
|
|
154
|
+
const columns = [];
|
|
155
|
+
if (params.selectableRows) {
|
|
156
|
+
columns.push({
|
|
157
|
+
size: 64,
|
|
158
|
+
id: "select",
|
|
159
|
+
header: ({ table }) => /* @__PURE__ */ jsx("div", { className: "w-full h-9 flex items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
160
|
+
Checkbox,
|
|
161
|
+
{
|
|
162
|
+
checked: table.getRowModel().rows.filter((row) => !params.disabledRowIds?.includes(row.id)).every((row) => row.getIsSelected()) && table.getRowModel().rows.some(
|
|
163
|
+
(row) => !params.disabledRowIds?.includes(row.id) && row.getIsSelected()
|
|
164
|
+
),
|
|
165
|
+
onCheckedChange: (value) => {
|
|
166
|
+
const selectedRows = [];
|
|
167
|
+
table.getRowModel().rows.forEach((row) => {
|
|
168
|
+
if (!params.disabledRowIds?.includes(row.id)) {
|
|
169
|
+
row.toggleSelected(!!value);
|
|
170
|
+
if (value) {
|
|
171
|
+
selectedRows.push(row.original);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
onSelectedRowChange?.(selectedRows);
|
|
176
|
+
},
|
|
177
|
+
"aria-label": "Select all",
|
|
178
|
+
className: "translate-y-0.5 align-middle"
|
|
179
|
+
}
|
|
180
|
+
) }),
|
|
181
|
+
cell: ({ row, table }) => /* @__PURE__ */ jsx("div", { className: "w-full h-9 flex items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
182
|
+
Checkbox,
|
|
183
|
+
{
|
|
184
|
+
checked: row.getIsSelected(),
|
|
185
|
+
onCheckedChange: (value) => {
|
|
186
|
+
const selectedRows = [];
|
|
187
|
+
table.getSelectedRowModel().rows.forEach((row2) => {
|
|
188
|
+
selectedRows.push(row2.original);
|
|
189
|
+
});
|
|
190
|
+
if (value) {
|
|
191
|
+
selectedRows.push(row.original);
|
|
192
|
+
} else {
|
|
193
|
+
selectedRows.splice(selectedRows.indexOf(row.original), 1);
|
|
194
|
+
}
|
|
195
|
+
row.toggleSelected(!!value);
|
|
196
|
+
onSelectedRowChange?.(selectedRows);
|
|
197
|
+
},
|
|
198
|
+
disabled: params.disabledRowIds?.some((id) => id === row.id),
|
|
199
|
+
"aria-label": "Select row",
|
|
200
|
+
className: "translate-y-0.5 align-top"
|
|
201
|
+
}
|
|
202
|
+
) }),
|
|
203
|
+
enableSorting: false,
|
|
204
|
+
enableHiding: false
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
const rowKeys = Object.keys(rows);
|
|
208
|
+
rowKeys.filter((key) => !excludeColumns?.includes(key)).forEach((accessorKey) => {
|
|
209
|
+
const title = tanstackTableCreateTitleWithLanguageData({
|
|
210
|
+
languageData,
|
|
211
|
+
accessorKey: accessorKey.toString()
|
|
212
|
+
});
|
|
213
|
+
const link = links?.[accessorKey];
|
|
214
|
+
const { format } = rows[accessorKey];
|
|
215
|
+
const column = {
|
|
216
|
+
id: accessorKey.toString(),
|
|
217
|
+
accessorKey,
|
|
218
|
+
meta: title,
|
|
219
|
+
header: !custom?.[accessorKey] || custom?.[accessorKey]?.showHeader ? ({ column: column2 }) => /* @__PURE__ */ jsx(TanstackTableColumnHeader, { column: column2, title }) : void 0,
|
|
220
|
+
cell: ({ row }) => createCell({
|
|
221
|
+
accessorKey,
|
|
222
|
+
row,
|
|
223
|
+
link,
|
|
224
|
+
faceted: faceted?.[accessorKey]?.options,
|
|
225
|
+
badge: badges?.[accessorKey],
|
|
226
|
+
icon: icons?.[accessorKey],
|
|
227
|
+
className: classNames?.[accessorKey],
|
|
228
|
+
expandRowTrigger: expandRowTrigger === accessorKey,
|
|
229
|
+
format,
|
|
230
|
+
custom: custom?.[accessorKey],
|
|
231
|
+
config,
|
|
232
|
+
localization
|
|
233
|
+
})
|
|
234
|
+
};
|
|
235
|
+
if (faceted?.[accessorKey]) {
|
|
236
|
+
column.filterFn = (row, id, value) => value.includes(row.getValue(id));
|
|
237
|
+
}
|
|
238
|
+
columns.push(column);
|
|
239
|
+
});
|
|
240
|
+
return columns;
|
|
241
|
+
}
|
|
242
|
+
export {
|
|
243
|
+
createCell,
|
|
244
|
+
tanstackTableCreateColumnsByRowData
|
|
245
|
+
};
|
|
246
|
+
//# sourceMappingURL=columns-by-row-data.js.map
|