@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,219 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { lodash } from "@repo/ayasofyazilim-ui/lib/utils";
|
|
4
|
+
import { Form } from "@rjsf/shadcn";
|
|
5
|
+
import { customizeValidator } from "@rjsf/validator-ajv8";
|
|
6
|
+
import { useCallback, useMemo } from "react";
|
|
7
|
+
import {
|
|
8
|
+
ArrayFieldItemTemplate,
|
|
9
|
+
ArrayFieldTemplate,
|
|
10
|
+
BaseInputTemplate,
|
|
11
|
+
FieldTemplate,
|
|
12
|
+
ObjectFieldTemplate
|
|
13
|
+
} from "./fields";
|
|
14
|
+
import { DescriptionFieldTemplate, SubmitButton } from "./templates";
|
|
15
|
+
import {
|
|
16
|
+
createSchemaWithFilters,
|
|
17
|
+
removeFieldsfromGenericSchema,
|
|
18
|
+
isValueEmpty,
|
|
19
|
+
cleanFormDataForSubmit,
|
|
20
|
+
cleanHiddenFieldsFromFormData,
|
|
21
|
+
createRuntimeValidator,
|
|
22
|
+
createDynamicSchema,
|
|
23
|
+
applyFieldDependencies
|
|
24
|
+
} from "./utils";
|
|
25
|
+
import {
|
|
26
|
+
CheckboxWidget,
|
|
27
|
+
DateTimeWidget,
|
|
28
|
+
DateWidget,
|
|
29
|
+
EmailInputWidget,
|
|
30
|
+
PasswordInputWidget,
|
|
31
|
+
PhoneWithParseWidget,
|
|
32
|
+
PhoneWithValueWidget,
|
|
33
|
+
SelectWidget,
|
|
34
|
+
SwitchWidget,
|
|
35
|
+
URLInputWidget
|
|
36
|
+
} from "./widgets";
|
|
37
|
+
export * from "./custom";
|
|
38
|
+
export * from "./types";
|
|
39
|
+
export * from "./utils";
|
|
40
|
+
export * from "./widgets";
|
|
41
|
+
const INTERNAL_WIDGETS = {
|
|
42
|
+
switch: SwitchWidget,
|
|
43
|
+
checkbox: CheckboxWidget,
|
|
44
|
+
date: DateWidget,
|
|
45
|
+
"date-time": DateTimeWidget,
|
|
46
|
+
email: EmailInputWidget,
|
|
47
|
+
password: PasswordInputWidget,
|
|
48
|
+
phone: PhoneWithValueWidget,
|
|
49
|
+
"phone-with-parse": PhoneWithParseWidget,
|
|
50
|
+
select: SelectWidget,
|
|
51
|
+
url: URLInputWidget
|
|
52
|
+
};
|
|
53
|
+
const INTERNAL_TEMPLATES = {
|
|
54
|
+
ObjectFieldTemplate,
|
|
55
|
+
BaseInputTemplate,
|
|
56
|
+
FieldTemplate,
|
|
57
|
+
DescriptionFieldTemplate,
|
|
58
|
+
ButtonTemplates: { SubmitButton }
|
|
59
|
+
};
|
|
60
|
+
const FIELDS_TO_REMOVE = ["extraProperties", "additionalProperties"];
|
|
61
|
+
function SchemaForm(props) {
|
|
62
|
+
const {
|
|
63
|
+
validator: customValidator,
|
|
64
|
+
schema: originalSchema,
|
|
65
|
+
widgets,
|
|
66
|
+
fields,
|
|
67
|
+
templates,
|
|
68
|
+
filter,
|
|
69
|
+
useTableForArrayFields = false,
|
|
70
|
+
formData,
|
|
71
|
+
transformErrors: userTransformErrors,
|
|
72
|
+
runtimeDependencyConfig,
|
|
73
|
+
fieldDependencies,
|
|
74
|
+
onSubmit: userOnSubmit,
|
|
75
|
+
customValidate: userCustomValidate,
|
|
76
|
+
...restProps
|
|
77
|
+
} = props;
|
|
78
|
+
const validatorToUse = useMemo(() => {
|
|
79
|
+
if (customValidator) return customValidator;
|
|
80
|
+
return customizeValidator({
|
|
81
|
+
ajvOptionsOverrides: {
|
|
82
|
+
removeAdditional: true
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}, [customValidator]);
|
|
86
|
+
const processedSchema = useMemo(() => {
|
|
87
|
+
let schema = originalSchema;
|
|
88
|
+
if (fieldDependencies) {
|
|
89
|
+
schema = applyFieldDependencies(schema, fieldDependencies);
|
|
90
|
+
}
|
|
91
|
+
if (runtimeDependencyConfig && formData) {
|
|
92
|
+
schema = createDynamicSchema(
|
|
93
|
+
schema,
|
|
94
|
+
runtimeDependencyConfig,
|
|
95
|
+
formData
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
if (filter) {
|
|
99
|
+
schema = createSchemaWithFilters({
|
|
100
|
+
filter,
|
|
101
|
+
schema
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return removeFieldsfromGenericSchema(schema, FIELDS_TO_REMOVE);
|
|
105
|
+
}, [
|
|
106
|
+
originalSchema,
|
|
107
|
+
filter,
|
|
108
|
+
runtimeDependencyConfig,
|
|
109
|
+
formData,
|
|
110
|
+
fieldDependencies
|
|
111
|
+
]);
|
|
112
|
+
const transformErrors = useCallback(
|
|
113
|
+
(errors) => {
|
|
114
|
+
const errorsToFilterWhenEmpty = ["format", "minLength", "pattern"];
|
|
115
|
+
let filteredErrors = errors.filter((error) => {
|
|
116
|
+
if (!error.name || !errorsToFilterWhenEmpty.includes(error.name))
|
|
117
|
+
return true;
|
|
118
|
+
const path = (error.property || "").replace(/^\./, "").split(".").filter(Boolean);
|
|
119
|
+
if (path.length === 0 || !formData) return true;
|
|
120
|
+
let value = formData;
|
|
121
|
+
for (const key of path) {
|
|
122
|
+
if (value && typeof value === "object" && key in value) {
|
|
123
|
+
value = value[key];
|
|
124
|
+
} else {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return !isValueEmpty(value);
|
|
129
|
+
});
|
|
130
|
+
if (userTransformErrors) {
|
|
131
|
+
filteredErrors = userTransformErrors(filteredErrors, {});
|
|
132
|
+
}
|
|
133
|
+
return filteredErrors;
|
|
134
|
+
},
|
|
135
|
+
[formData, userTransformErrors]
|
|
136
|
+
);
|
|
137
|
+
const combinedCustomValidate = useCallback(
|
|
138
|
+
(formDataToValidate, errors) => {
|
|
139
|
+
let validationErrors = errors;
|
|
140
|
+
if (runtimeDependencyConfig) {
|
|
141
|
+
const runtimeValidator = createRuntimeValidator(
|
|
142
|
+
runtimeDependencyConfig
|
|
143
|
+
);
|
|
144
|
+
validationErrors = runtimeValidator(
|
|
145
|
+
formDataToValidate,
|
|
146
|
+
validationErrors
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
if (userCustomValidate) {
|
|
150
|
+
validationErrors = userCustomValidate(
|
|
151
|
+
formDataToValidate,
|
|
152
|
+
validationErrors
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
return validationErrors;
|
|
156
|
+
},
|
|
157
|
+
[runtimeDependencyConfig, userCustomValidate]
|
|
158
|
+
);
|
|
159
|
+
const memoizedWidgets = useMemo(
|
|
160
|
+
() => lodash.merge(INTERNAL_WIDGETS, widgets),
|
|
161
|
+
[widgets]
|
|
162
|
+
);
|
|
163
|
+
const memoizedFields = useMemo(() => fields, [fields]);
|
|
164
|
+
const memoizedTemplates = useMemo(() => {
|
|
165
|
+
return lodash.merge(
|
|
166
|
+
INTERNAL_TEMPLATES,
|
|
167
|
+
templates,
|
|
168
|
+
useTableForArrayFields ? { ArrayFieldItemTemplate, ArrayFieldTemplate } : {}
|
|
169
|
+
);
|
|
170
|
+
}, [templates]);
|
|
171
|
+
const handleSubmit = useCallback(
|
|
172
|
+
(data, event) => {
|
|
173
|
+
if (!userOnSubmit) return;
|
|
174
|
+
let submitData = data;
|
|
175
|
+
let cleanedFormData = data.formData;
|
|
176
|
+
if (fieldDependencies && cleanedFormData) {
|
|
177
|
+
cleanedFormData = cleanHiddenFieldsFromFormData(
|
|
178
|
+
cleanedFormData,
|
|
179
|
+
fieldDependencies
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
if (runtimeDependencyConfig && cleanedFormData) {
|
|
183
|
+
cleanedFormData = cleanFormDataForSubmit(
|
|
184
|
+
cleanedFormData,
|
|
185
|
+
runtimeDependencyConfig
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
if (fieldDependencies || runtimeDependencyConfig) {
|
|
189
|
+
submitData = { ...data, formData: cleanedFormData };
|
|
190
|
+
}
|
|
191
|
+
userOnSubmit(submitData, event);
|
|
192
|
+
},
|
|
193
|
+
[userOnSubmit, runtimeDependencyConfig, fieldDependencies]
|
|
194
|
+
);
|
|
195
|
+
return /* @__PURE__ */ jsx(
|
|
196
|
+
Form,
|
|
197
|
+
{
|
|
198
|
+
...restProps,
|
|
199
|
+
customValidate: runtimeDependencyConfig || userCustomValidate ? combinedCustomValidate : void 0,
|
|
200
|
+
formContext: {
|
|
201
|
+
useTableForArrayFields
|
|
202
|
+
},
|
|
203
|
+
formData,
|
|
204
|
+
onSubmit: handleSubmit,
|
|
205
|
+
schema: processedSchema,
|
|
206
|
+
transformErrors,
|
|
207
|
+
validator: validatorToUse,
|
|
208
|
+
widgets: memoizedWidgets,
|
|
209
|
+
fields: memoizedFields,
|
|
210
|
+
templates: memoizedTemplates,
|
|
211
|
+
noHtml5Validate: restProps.noHtml5Validate ?? true,
|
|
212
|
+
showErrorList: restProps.showErrorList ?? false
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
export {
|
|
217
|
+
SchemaForm
|
|
218
|
+
};
|
|
219
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/custom/schema-form/index.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport { lodash } from \"@repo/ayasofyazilim-ui/lib/utils\";\r\nimport { Form } from \"@rjsf/shadcn\";\r\nimport { customizeValidator } from \"@rjsf/validator-ajv8\";\r\nimport type { RJSFValidationError, FormValidation } from \"@rjsf/utils\";\r\nimport { useCallback, useMemo } from \"react\";\r\nimport {\r\n ArrayFieldItemTemplate,\r\n ArrayFieldTemplate,\r\n BaseInputTemplate,\r\n FieldTemplate,\r\n ObjectFieldTemplate,\r\n} from \"./fields\";\r\nimport { DescriptionFieldTemplate, SubmitButton } from \"./templates\";\r\nimport { SchemaFormProps } from \"./types\";\r\nimport {\r\n createSchemaWithFilters,\r\n removeFieldsfromGenericSchema,\r\n isValueEmpty,\r\n cleanFormDataForSubmit,\r\n cleanHiddenFieldsFromFormData,\r\n createRuntimeValidator,\r\n createDynamicSchema,\r\n applyFieldDependencies,\r\n} from \"./utils\";\r\nimport {\r\n CheckboxWidget,\r\n DateTimeWidget,\r\n DateWidget,\r\n EmailInputWidget,\r\n PasswordInputWidget,\r\n PhoneWithParseWidget,\r\n PhoneWithValueWidget,\r\n SelectWidget,\r\n SwitchWidget,\r\n URLInputWidget,\r\n} from \"./widgets\";\r\n\r\nexport * from \"./custom\";\r\nexport * from \"./types\";\r\nexport * from \"./utils\";\r\nexport * from \"./widgets\";\r\n\r\nconst INTERNAL_WIDGETS = {\r\n switch: SwitchWidget,\r\n checkbox: CheckboxWidget,\r\n date: DateWidget,\r\n \"date-time\": DateTimeWidget,\r\n email: EmailInputWidget,\r\n password: PasswordInputWidget,\r\n phone: PhoneWithValueWidget,\r\n \"phone-with-parse\": PhoneWithParseWidget,\r\n select: SelectWidget,\r\n url: URLInputWidget,\r\n};\r\n\r\nconst INTERNAL_TEMPLATES = {\r\n ObjectFieldTemplate,\r\n BaseInputTemplate,\r\n FieldTemplate,\r\n DescriptionFieldTemplate,\r\n ButtonTemplates: { SubmitButton },\r\n};\r\n\r\nconst FIELDS_TO_REMOVE = [\"extraProperties\", \"additionalProperties\"];\r\n\r\nexport function SchemaForm<T = any>(props: SchemaFormProps<T>) {\r\n const {\r\n validator: customValidator,\r\n schema: originalSchema,\r\n widgets,\r\n fields,\r\n templates,\r\n filter,\r\n useTableForArrayFields = false,\r\n formData,\r\n transformErrors: userTransformErrors,\r\n runtimeDependencyConfig,\r\n fieldDependencies,\r\n onSubmit: userOnSubmit,\r\n customValidate: userCustomValidate,\r\n ...restProps\r\n } = props;\r\n\r\n const validatorToUse = useMemo(() => {\r\n if (customValidator) return customValidator;\r\n\r\n return customizeValidator({\r\n ajvOptionsOverrides: {\r\n removeAdditional: true,\r\n },\r\n });\r\n }, [customValidator]);\r\n\r\n const processedSchema = useMemo(() => {\r\n let schema = originalSchema;\r\n\r\n if (fieldDependencies) {\r\n schema = applyFieldDependencies(schema, fieldDependencies);\r\n }\r\n\r\n if (runtimeDependencyConfig && formData) {\r\n schema = createDynamicSchema(\r\n schema,\r\n runtimeDependencyConfig,\r\n formData as Record<string, unknown>\r\n );\r\n }\r\n\r\n if (filter) {\r\n schema = createSchemaWithFilters({\r\n filter,\r\n schema,\r\n });\r\n }\r\n return removeFieldsfromGenericSchema(schema, FIELDS_TO_REMOVE);\r\n }, [\r\n originalSchema,\r\n filter,\r\n runtimeDependencyConfig,\r\n formData,\r\n fieldDependencies,\r\n ]);\r\n\r\n const transformErrors = useCallback(\r\n (errors: RJSFValidationError[]): RJSFValidationError[] => {\r\n const errorsToFilterWhenEmpty = [\"format\", \"minLength\", \"pattern\"];\r\n\r\n let filteredErrors = errors.filter((error) => {\r\n if (!error.name || !errorsToFilterWhenEmpty.includes(error.name))\r\n return true;\r\n\r\n const path = (error.property || \"\")\r\n .replace(/^\\./, \"\")\r\n .split(\".\")\r\n .filter(Boolean);\r\n\r\n if (path.length === 0 || !formData) return true;\r\n\r\n let value: unknown = formData;\r\n for (const key of path) {\r\n if (value && typeof value === \"object\" && key in value) {\r\n value = (value as Record<string, unknown>)[key];\r\n } else {\r\n return true;\r\n }\r\n }\r\n\r\n return !isValueEmpty(value);\r\n });\r\n\r\n if (userTransformErrors) {\r\n filteredErrors = userTransformErrors(filteredErrors, {} as any);\r\n }\r\n\r\n return filteredErrors;\r\n },\r\n [formData, userTransformErrors]\r\n );\r\n\r\n const combinedCustomValidate = useCallback(\r\n (formDataToValidate: T, errors: FormValidation<T>): FormValidation<T> => {\r\n let validationErrors = errors;\r\n\r\n if (runtimeDependencyConfig) {\r\n const runtimeValidator = createRuntimeValidator(\r\n runtimeDependencyConfig\r\n );\r\n validationErrors = runtimeValidator(\r\n formDataToValidate as Record<string, unknown>,\r\n validationErrors as FormValidation<Record<string, unknown>>\r\n ) as FormValidation<T>;\r\n }\r\n\r\n if (userCustomValidate) {\r\n validationErrors = userCustomValidate(\r\n formDataToValidate,\r\n validationErrors\r\n );\r\n }\r\n\r\n return validationErrors;\r\n },\r\n [runtimeDependencyConfig, userCustomValidate]\r\n );\r\n\r\n const memoizedWidgets = useMemo(\r\n () => lodash.merge(INTERNAL_WIDGETS, widgets),\r\n [widgets]\r\n );\r\n const memoizedFields = useMemo(() => fields, [fields]);\r\n const memoizedTemplates = useMemo(() => {\r\n return lodash.merge(\r\n INTERNAL_TEMPLATES,\r\n templates,\r\n useTableForArrayFields\r\n ? { ArrayFieldItemTemplate, ArrayFieldTemplate }\r\n : {}\r\n );\r\n }, [templates]);\r\n\r\n const handleSubmit = useCallback(\r\n (\r\n data: Parameters<NonNullable<typeof userOnSubmit>>[0],\r\n event: React.FormEvent<HTMLFormElement>\r\n ) => {\r\n if (!userOnSubmit) return;\r\n\r\n let submitData = data;\r\n let cleanedFormData = data.formData as T;\r\n\r\n if (fieldDependencies && cleanedFormData) {\r\n cleanedFormData = cleanHiddenFieldsFromFormData(\r\n cleanedFormData as Record<string, unknown>,\r\n fieldDependencies\r\n ) as T;\r\n }\r\n\r\n if (runtimeDependencyConfig && cleanedFormData) {\r\n cleanedFormData = cleanFormDataForSubmit(\r\n cleanedFormData as Record<string, unknown>,\r\n runtimeDependencyConfig\r\n ) as T;\r\n }\r\n\r\n if (fieldDependencies || runtimeDependencyConfig) {\r\n submitData = { ...data, formData: cleanedFormData };\r\n }\r\n\r\n userOnSubmit(submitData, event);\r\n },\r\n [userOnSubmit, runtimeDependencyConfig, fieldDependencies]\r\n );\r\n\r\n return (\r\n <Form\r\n {...restProps}\r\n customValidate={\r\n runtimeDependencyConfig || userCustomValidate\r\n ? combinedCustomValidate\r\n : undefined\r\n }\r\n formContext={{\r\n useTableForArrayFields,\r\n }}\r\n formData={formData}\r\n onSubmit={handleSubmit}\r\n schema={processedSchema}\r\n transformErrors={transformErrors}\r\n validator={validatorToUse}\r\n widgets={memoizedWidgets}\r\n fields={memoizedFields}\r\n templates={memoizedTemplates}\r\n noHtml5Validate={restProps.noHtml5Validate ?? true}\r\n showErrorList={restProps.showErrorList ?? false}\r\n />\r\n );\r\n}\r\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
Tooltip,
|
|
4
|
+
TooltipTrigger,
|
|
5
|
+
TooltipContent
|
|
6
|
+
} from "@repo/ayasofyazilim-ui/components/tooltip";
|
|
7
|
+
import { InfoIcon } from "lucide-react";
|
|
8
|
+
function DescriptionFieldTemplate(props) {
|
|
9
|
+
const { description, id } = props;
|
|
10
|
+
if (!description) return null;
|
|
11
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
12
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { id, type: "button", children: /* @__PURE__ */ jsx(InfoIcon, { className: "size-3.5 ml-1 text-muted-foreground cursor-help" }) }),
|
|
13
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: description })
|
|
14
|
+
] });
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
DescriptionFieldTemplate
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/custom/schema-form/templates/description.tsx"],"sourcesContent":["import {\r\n Tooltip,\r\n TooltipTrigger,\r\n TooltipContent,\r\n} from \"@repo/ayasofyazilim-ui/components/tooltip\";\r\nimport { DescriptionFieldProps } from \"@rjsf/utils\";\r\nimport { InfoIcon, MessageCircleQuestion } from \"lucide-react\";\r\n\r\nexport function DescriptionFieldTemplate(props: DescriptionFieldProps) {\r\n const { description, id } = props;\r\n if (!description) return null;\r\n return (\r\n <Tooltip>\r\n <TooltipTrigger id={id} type=\"button\">\r\n <InfoIcon className=\"size-3.5 ml-1 text-muted-foreground cursor-help\" />\r\n </TooltipTrigger>\r\n <TooltipContent>{description}</TooltipContent>\r\n </Tooltip>\r\n );\r\n}\r\n"],"mappings":"AAYI,SAEI,KAFJ;AAZJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,gBAAuC;AAEzC,SAAS,yBAAyB,OAA8B;AACrE,QAAM,EAAE,aAAa,GAAG,IAAI;AAC5B,MAAI,CAAC,YAAa,QAAO;AACzB,SACE,qBAAC,WACC;AAAA,wBAAC,kBAAe,IAAQ,MAAK,UAC3B,8BAAC,YAAS,WAAU,mDAAkD,GACxE;AAAA,IACA,oBAAC,kBAAgB,uBAAY;AAAA,KAC/B;AAEJ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/custom/schema-form/templates/index.tsx"],"sourcesContent":["export * from \"./submit\";\r\nexport * from \"./description\";\r\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
getSubmitButtonOptions
|
|
4
|
+
} from "@rjsf/utils";
|
|
5
|
+
import { Button } from "@repo/ayasofyazilim-ui/components/button";
|
|
6
|
+
import { cn } from "@repo/ayasofyazilim-ui/lib/utils";
|
|
7
|
+
function SubmitButton(props) {
|
|
8
|
+
const { uiSchema } = props;
|
|
9
|
+
const {
|
|
10
|
+
norender,
|
|
11
|
+
props: options,
|
|
12
|
+
disabled,
|
|
13
|
+
submitText
|
|
14
|
+
} = getSubmitButtonOptions(uiSchema);
|
|
15
|
+
if (norender) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
Button,
|
|
20
|
+
{
|
|
21
|
+
type: "submit",
|
|
22
|
+
className: cn("w-full mt-3", options?.className),
|
|
23
|
+
disabled: options?.disabled || disabled,
|
|
24
|
+
children: submitText || "Submit"
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
SubmitButton
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=submit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/custom/schema-form/templates/submit.tsx"],"sourcesContent":["import React from \"react\";\r\nimport {\r\n getSubmitButtonOptions,\r\n SubmitButtonProps,\r\n UISchemaSubmitButtonOptions,\r\n} from \"@rjsf/utils\";\r\nimport { Button } from \"@repo/ayasofyazilim-ui/components/button\";\r\nimport { cn } from \"@repo/ayasofyazilim-ui/lib/utils\";\r\n\r\nexport function SubmitButton(props: SubmitButtonProps) {\r\n const { uiSchema } = props;\r\n const {\r\n norender,\r\n props: options,\r\n disabled,\r\n submitText,\r\n }: UISchemaSubmitButtonOptions & {\r\n disabled?: boolean;\r\n } = getSubmitButtonOptions(uiSchema);\r\n if (norender) {\r\n return null;\r\n }\r\n return (\r\n <Button\r\n type=\"submit\"\r\n className={cn(\"w-full mt-3\", options?.className)}\r\n disabled={options?.disabled || disabled}\r\n >\r\n {submitText || \"Submit\"}\r\n </Button>\r\n );\r\n}\r\n"],"mappings":"AAuBI;AAtBJ;AAAA,EACE;AAAA,OAGK;AACP,SAAS,cAAc;AACvB,SAAS,UAAU;AAEZ,SAAS,aAAa,OAA0B;AACrD,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM;AAAA,IACJ;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,EACF,IAEI,uBAAuB,QAAQ;AACnC,MAAI,UAAU;AACZ,WAAO;AAAA,EACT;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,WAAW,GAAG,eAAe,SAAS,SAAS;AAAA,MAC/C,UAAU,SAAS,YAAY;AAAA,MAE9B,wBAAc;AAAA;AAAA,EACjB;AAEJ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./schemas";
|
|
2
|
+
export * from "./validation";
|
|
3
|
+
export * from "./schema-dependency";
|
|
4
|
+
import { getTemplate, getUiOptions, getChangedFields } from "@rjsf/utils";
|
|
5
|
+
export {
|
|
6
|
+
getChangedFields,
|
|
7
|
+
getTemplate,
|
|
8
|
+
getUiOptions
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/custom/schema-form/utils/index.ts"],"sourcesContent":["export * from \"./schemas\";\r\nexport * from \"./validation\";\r\nexport * from \"./schema-dependency\";\r\nexport { getTemplate, getUiOptions, getChangedFields } from \"@rjsf/utils\";\r\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,aAAa,cAAc,wBAAwB;","names":[]}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
function getNestedProperty(obj, path) {
|
|
2
|
+
const parts = path.split(".");
|
|
3
|
+
let current = obj;
|
|
4
|
+
for (const part of parts) {
|
|
5
|
+
if (!current?.properties?.[part]) return void 0;
|
|
6
|
+
current = current.properties[part];
|
|
7
|
+
}
|
|
8
|
+
return current;
|
|
9
|
+
}
|
|
10
|
+
function getFieldValues(schema, fieldPath) {
|
|
11
|
+
const field = getNestedProperty(schema, fieldPath);
|
|
12
|
+
if (!field) return [];
|
|
13
|
+
if (field.enum) return field.enum;
|
|
14
|
+
if (field.type === "boolean") return [true, false];
|
|
15
|
+
if (field.type === "integer" || field.type === "number")
|
|
16
|
+
return ["__NUMERIC_RANGE__"];
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
function applyFieldDependencies(originalSchema, dependencies) {
|
|
20
|
+
const schema = JSON.parse(JSON.stringify(originalSchema));
|
|
21
|
+
if (!schema.properties) return schema;
|
|
22
|
+
for (const [fieldPath, fieldDeps] of Object.entries(dependencies)) {
|
|
23
|
+
const fieldValues = getFieldValues(schema, fieldPath);
|
|
24
|
+
if (fieldValues.length > 0) {
|
|
25
|
+
const parentPath = fieldPath.split(".").slice(0, -1).join(".");
|
|
26
|
+
const parentSchema = parentPath ? getNestedProperty(schema, parentPath) : schema;
|
|
27
|
+
const fieldName = fieldPath.split(".").pop();
|
|
28
|
+
if (parentSchema) {
|
|
29
|
+
const allHidesTargets = /* @__PURE__ */ new Set();
|
|
30
|
+
if (fieldDeps.HIDES) {
|
|
31
|
+
for (const rule of fieldDeps.HIDES) {
|
|
32
|
+
rule.targets.forEach((t) => allHidesTargets.add(t));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
for (const hiddenTarget of Array.from(allHidesTargets)) {
|
|
36
|
+
if (schema.properties[hiddenTarget]) {
|
|
37
|
+
delete schema.properties[hiddenTarget];
|
|
38
|
+
if (schema.required?.includes(hiddenTarget)) {
|
|
39
|
+
schema.required = schema.required.filter(
|
|
40
|
+
(r) => r !== hiddenTarget
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const conditionalSchemas = [];
|
|
46
|
+
for (const value of fieldValues) {
|
|
47
|
+
const requiredFields = [];
|
|
48
|
+
const visibleFields = [];
|
|
49
|
+
if (fieldDeps.REQUIRES) {
|
|
50
|
+
for (const rule of fieldDeps.REQUIRES) {
|
|
51
|
+
if (rule.when(value)) {
|
|
52
|
+
requiredFields.push(...rule.targets);
|
|
53
|
+
visibleFields.push(...rule.targets);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (fieldDeps.HIDES) {
|
|
58
|
+
for (const rule of fieldDeps.HIDES) {
|
|
59
|
+
if (rule.when(value)) {
|
|
60
|
+
} else {
|
|
61
|
+
visibleFields.push(...rule.targets);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
visibleFields.push(fieldName);
|
|
66
|
+
const visibleFieldsUnique = Array.from(new Set(visibleFields));
|
|
67
|
+
const conditionalProperties = {};
|
|
68
|
+
visibleFieldsUnique.forEach((targetField) => {
|
|
69
|
+
if (targetField === fieldName) {
|
|
70
|
+
conditionalProperties[targetField] = {
|
|
71
|
+
enum: [value]
|
|
72
|
+
};
|
|
73
|
+
} else {
|
|
74
|
+
const originalFieldSchema = getNestedProperty(
|
|
75
|
+
originalSchema,
|
|
76
|
+
targetField
|
|
77
|
+
);
|
|
78
|
+
if (originalFieldSchema) {
|
|
79
|
+
conditionalProperties[targetField] = { ...originalFieldSchema };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
const conditionalSchema = {
|
|
84
|
+
properties: conditionalProperties
|
|
85
|
+
};
|
|
86
|
+
if (requiredFields.length > 0) {
|
|
87
|
+
conditionalSchema.required = requiredFields.filter(
|
|
88
|
+
(r) => visibleFieldsUnique.includes(r)
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
conditionalSchemas.push(conditionalSchema);
|
|
92
|
+
}
|
|
93
|
+
if (!parentSchema.dependencies) parentSchema.dependencies = {};
|
|
94
|
+
parentSchema.dependencies[fieldName] = { oneOf: conditionalSchemas };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return schema;
|
|
99
|
+
}
|
|
100
|
+
function getFormDataValue(formData, path) {
|
|
101
|
+
const parts = path.split(".");
|
|
102
|
+
let current = formData;
|
|
103
|
+
for (const part of parts) {
|
|
104
|
+
if (current === null || current === void 0) return void 0;
|
|
105
|
+
current = current[part];
|
|
106
|
+
}
|
|
107
|
+
return current;
|
|
108
|
+
}
|
|
109
|
+
function deleteFormDataProperty(formData, path) {
|
|
110
|
+
const parts = path.split(".");
|
|
111
|
+
if (parts.length === 1) {
|
|
112
|
+
delete formData[path];
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const parentPath = parts.slice(0, -1);
|
|
116
|
+
const fieldName = parts.at(-1);
|
|
117
|
+
if (!fieldName) return;
|
|
118
|
+
let current = formData;
|
|
119
|
+
for (const part of parentPath) {
|
|
120
|
+
if (current === null || current === void 0) return;
|
|
121
|
+
current = current[part];
|
|
122
|
+
}
|
|
123
|
+
if (current && typeof current === "object") {
|
|
124
|
+
delete current[fieldName];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function cleanHiddenFieldsFromFormData(formData, dependencies) {
|
|
128
|
+
const cleanedData = JSON.parse(JSON.stringify(formData));
|
|
129
|
+
for (const [fieldPath, fieldDeps] of Object.entries(dependencies)) {
|
|
130
|
+
if (!fieldDeps.HIDES) continue;
|
|
131
|
+
const controllingValue = getFormDataValue(cleanedData, fieldPath);
|
|
132
|
+
for (const rule of fieldDeps.HIDES) {
|
|
133
|
+
if (rule.when(controllingValue)) {
|
|
134
|
+
for (const target of rule.targets) {
|
|
135
|
+
deleteFormDataProperty(cleanedData, target);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return cleanedData;
|
|
141
|
+
}
|
|
142
|
+
const EMPTY_GUID = "00000000-0000-0000-0000-000000000000";
|
|
143
|
+
function isValueEmpty(value) {
|
|
144
|
+
if (value === null || value === void 0) return true;
|
|
145
|
+
if (typeof value === "string") {
|
|
146
|
+
return value.trim() === "" || value === EMPTY_GUID;
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
function getNestedValue(obj, path) {
|
|
151
|
+
const parts = path.split(".");
|
|
152
|
+
let current = obj;
|
|
153
|
+
for (const part of parts) {
|
|
154
|
+
if (current === null || current === void 0) return void 0;
|
|
155
|
+
current = current[part];
|
|
156
|
+
}
|
|
157
|
+
return current;
|
|
158
|
+
}
|
|
159
|
+
function applyRuntimeDependencies(originalSchema, config) {
|
|
160
|
+
const schema = JSON.parse(JSON.stringify(originalSchema));
|
|
161
|
+
const schemaAsJson = schema;
|
|
162
|
+
for (const [objectPath, fieldConfig] of Object.entries(config)) {
|
|
163
|
+
const nestedSchema = getNestedProperty(schemaAsJson, objectPath);
|
|
164
|
+
if (nestedSchema) {
|
|
165
|
+
const fieldsToMakeOptional = [
|
|
166
|
+
...fieldConfig.triggerFields,
|
|
167
|
+
...fieldConfig.requiredFields
|
|
168
|
+
];
|
|
169
|
+
if (nestedSchema.required) {
|
|
170
|
+
nestedSchema.required = nestedSchema.required.filter(
|
|
171
|
+
(field) => !fieldsToMakeOptional.includes(field)
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (schemaAsJson.required) {
|
|
177
|
+
for (const objectPath of Object.keys(config)) {
|
|
178
|
+
const topLevelField = objectPath.split(".")[0];
|
|
179
|
+
if (topLevelField && schemaAsJson.required.includes(topLevelField)) {
|
|
180
|
+
schemaAsJson.required = schemaAsJson.required.filter(
|
|
181
|
+
(field) => field !== topLevelField
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return schema;
|
|
187
|
+
}
|
|
188
|
+
function createRuntimeValidator(config) {
|
|
189
|
+
return function validate(formData, errors) {
|
|
190
|
+
if (!formData) return errors;
|
|
191
|
+
for (const [objectPath, fieldConfig] of Object.entries(config)) {
|
|
192
|
+
const nestedObject = getNestedValue(formData, objectPath);
|
|
193
|
+
if (!nestedObject) continue;
|
|
194
|
+
const errorMessage = fieldConfig.errorMessage || "Required";
|
|
195
|
+
const filledTriggerFields = fieldConfig.triggerFields.filter((field) => {
|
|
196
|
+
const value = nestedObject[field];
|
|
197
|
+
const emptyCheck = fieldConfig.emptyChecks?.[field] || isValueEmpty;
|
|
198
|
+
return !emptyCheck(value);
|
|
199
|
+
});
|
|
200
|
+
if (filledTriggerFields.length >= 2) {
|
|
201
|
+
const nestedErrors = getNestedValue(
|
|
202
|
+
errors,
|
|
203
|
+
objectPath
|
|
204
|
+
);
|
|
205
|
+
for (const requiredField of fieldConfig.requiredFields) {
|
|
206
|
+
const value = nestedObject[requiredField];
|
|
207
|
+
const emptyCheck = fieldConfig.emptyChecks?.[requiredField] || isValueEmpty;
|
|
208
|
+
if (emptyCheck(value)) {
|
|
209
|
+
const fieldError = nestedErrors?.[requiredField];
|
|
210
|
+
fieldError?.addError?.(errorMessage);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return errors;
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function createConditionalRequirements(originalSchema, config) {
|
|
219
|
+
return {
|
|
220
|
+
schema: applyRuntimeDependencies(originalSchema, config),
|
|
221
|
+
validate: createRuntimeValidator(config)
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function shouldRequireFields(formData, objectPath, fieldConfig) {
|
|
225
|
+
if (!formData) return false;
|
|
226
|
+
const nestedObject = getNestedValue(formData, objectPath);
|
|
227
|
+
if (!nestedObject) return false;
|
|
228
|
+
const filledTriggerFields = fieldConfig.triggerFields.filter((field) => {
|
|
229
|
+
const value = nestedObject[field];
|
|
230
|
+
const emptyCheck = fieldConfig.emptyChecks?.[field] || isValueEmpty;
|
|
231
|
+
return !emptyCheck(value);
|
|
232
|
+
});
|
|
233
|
+
const minCount = fieldConfig.minFilledCount ?? 2;
|
|
234
|
+
return filledTriggerFields.length >= minCount;
|
|
235
|
+
}
|
|
236
|
+
function createDynamicSchema(originalSchema, config, formData) {
|
|
237
|
+
const schema = JSON.parse(JSON.stringify(originalSchema));
|
|
238
|
+
const schemaAsJson = schema;
|
|
239
|
+
for (const [objectPath, fieldConfig] of Object.entries(config)) {
|
|
240
|
+
const nestedSchema = getNestedProperty(schemaAsJson, objectPath);
|
|
241
|
+
if (!nestedSchema) continue;
|
|
242
|
+
const requirementsActive = shouldRequireFields(
|
|
243
|
+
formData,
|
|
244
|
+
objectPath,
|
|
245
|
+
fieldConfig
|
|
246
|
+
);
|
|
247
|
+
if (requirementsActive) {
|
|
248
|
+
const currentRequired = nestedSchema.required || [];
|
|
249
|
+
const newRequired = /* @__PURE__ */ new Set([
|
|
250
|
+
...currentRequired,
|
|
251
|
+
...fieldConfig.requiredFields
|
|
252
|
+
]);
|
|
253
|
+
nestedSchema.required = Array.from(newRequired);
|
|
254
|
+
} else {
|
|
255
|
+
const fieldsToMakeOptional = [
|
|
256
|
+
...fieldConfig.triggerFields,
|
|
257
|
+
...fieldConfig.requiredFields
|
|
258
|
+
];
|
|
259
|
+
if (nestedSchema.required) {
|
|
260
|
+
nestedSchema.required = nestedSchema.required.filter(
|
|
261
|
+
(field) => !fieldsToMakeOptional.includes(field)
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (schemaAsJson.required) {
|
|
267
|
+
for (const [objectPath, fieldConfig] of Object.entries(config)) {
|
|
268
|
+
const topLevelField = objectPath.split(".")[0];
|
|
269
|
+
if (!topLevelField) continue;
|
|
270
|
+
const requirementsActive = shouldRequireFields(
|
|
271
|
+
formData,
|
|
272
|
+
objectPath,
|
|
273
|
+
fieldConfig
|
|
274
|
+
);
|
|
275
|
+
if (requirementsActive) {
|
|
276
|
+
if (!schemaAsJson.required.includes(topLevelField)) {
|
|
277
|
+
schemaAsJson.required.push(topLevelField);
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
schemaAsJson.required = schemaAsJson.required.filter(
|
|
281
|
+
(field) => field !== topLevelField
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return schema;
|
|
287
|
+
}
|
|
288
|
+
function createEmptyValueTransformErrors(formData) {
|
|
289
|
+
return function transformErrors(errors) {
|
|
290
|
+
return errors.filter((error) => {
|
|
291
|
+
if (error.name !== "format") return true;
|
|
292
|
+
const path = (error.property || "").replace(/^\./, "").split(".").filter(Boolean);
|
|
293
|
+
if (path.length === 0 || !formData) return true;
|
|
294
|
+
let value = formData;
|
|
295
|
+
for (const key of path) {
|
|
296
|
+
if (value && typeof value === "object" && key in value) {
|
|
297
|
+
value = value[key];
|
|
298
|
+
} else {
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return !isValueEmpty(value);
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
function cleanFormDataForSubmit(formData, config) {
|
|
307
|
+
const result = { ...formData };
|
|
308
|
+
for (const [objectPath, fieldConfig] of Object.entries(config)) {
|
|
309
|
+
if (!fieldConfig.removeFromSubmit) continue;
|
|
310
|
+
const requirementsActive = shouldRequireFields(
|
|
311
|
+
formData,
|
|
312
|
+
objectPath,
|
|
313
|
+
fieldConfig
|
|
314
|
+
);
|
|
315
|
+
if (!requirementsActive) {
|
|
316
|
+
const pathParts = objectPath.split(".");
|
|
317
|
+
if (pathParts.length === 1) {
|
|
318
|
+
delete result[objectPath];
|
|
319
|
+
} else {
|
|
320
|
+
let current = result;
|
|
321
|
+
for (let i = 0; i < pathParts.length - 1; i++) {
|
|
322
|
+
const part = pathParts[i];
|
|
323
|
+
if (current[part] && typeof current[part] === "object") {
|
|
324
|
+
current = current[part];
|
|
325
|
+
} else {
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
const leafKey = pathParts[pathParts.length - 1];
|
|
330
|
+
delete current[leafKey];
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return result;
|
|
335
|
+
}
|
|
336
|
+
export {
|
|
337
|
+
EMPTY_GUID,
|
|
338
|
+
applyFieldDependencies,
|
|
339
|
+
applyRuntimeDependencies,
|
|
340
|
+
cleanFormDataForSubmit,
|
|
341
|
+
cleanHiddenFieldsFromFormData,
|
|
342
|
+
createConditionalRequirements,
|
|
343
|
+
createDynamicSchema,
|
|
344
|
+
createEmptyValueTransformErrors,
|
|
345
|
+
createRuntimeValidator,
|
|
346
|
+
isValueEmpty,
|
|
347
|
+
shouldRequireFields
|
|
348
|
+
};
|
|
349
|
+
//# sourceMappingURL=schema-dependency.js.map
|