@questpie/admin 1.1.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +245 -474
- package/dist/_virtual/rolldown_runtime.mjs +18 -0
- package/dist/augmentation.d.mts +315 -0
- package/dist/augmentation.d.mts.map +1 -0
- package/dist/client/blocks/block-registry.d.mts +199 -0
- package/dist/client/blocks/block-registry.d.mts.map +1 -0
- package/dist/client/blocks/block-registry.mjs +88 -0
- package/dist/client/blocks/block-registry.mjs.map +1 -0
- package/dist/client/blocks/block-renderer.d.mts +52 -0
- package/dist/client/blocks/block-renderer.d.mts.map +1 -0
- package/dist/client/blocks/block-renderer.mjs +71 -0
- package/dist/client/blocks/block-renderer.mjs.map +1 -0
- package/dist/client/blocks/index.d.mts +4 -0
- package/dist/client/blocks/prefetch.d.mts +45 -0
- package/dist/client/blocks/prefetch.d.mts.map +1 -0
- package/dist/client/blocks/prefetch.mjs +26 -0
- package/dist/client/blocks/prefetch.mjs.map +1 -0
- package/dist/client/blocks/types.d.mts +69 -0
- package/dist/client/blocks/types.d.mts.map +1 -0
- package/dist/client/blocks/types.mjs +20 -0
- package/dist/client/blocks/types.mjs.map +1 -0
- package/dist/client/builder/admin-builder.d.mts +112 -0
- package/dist/client/builder/admin-builder.d.mts.map +1 -0
- package/dist/client/builder/admin-builder.mjs +185 -0
- package/dist/client/builder/admin-builder.mjs.map +1 -0
- package/dist/client/builder/admin-types.d.mts +73 -0
- package/dist/client/builder/admin-types.d.mts.map +1 -0
- package/dist/client/builder/admin.d.mts +121 -0
- package/dist/client/builder/admin.d.mts.map +1 -0
- package/dist/client/builder/admin.mjs +160 -0
- package/dist/client/builder/admin.mjs.map +1 -0
- package/dist/client/builder/defaults/components.mjs +20 -0
- package/dist/client/builder/defaults/components.mjs.map +1 -0
- package/dist/client/builder/defaults/core.d.mts +354 -0
- package/dist/client/builder/defaults/core.d.mts.map +1 -0
- package/dist/client/builder/defaults/core.mjs +49 -0
- package/dist/client/builder/defaults/core.mjs.map +1 -0
- package/dist/client/builder/defaults/fields.mjs +328 -0
- package/dist/client/builder/defaults/fields.mjs.map +1 -0
- package/dist/client/builder/defaults/pages.mjs +58 -0
- package/dist/client/builder/defaults/pages.mjs.map +1 -0
- package/dist/client/builder/defaults/starter.d.mts +351 -0
- package/dist/client/builder/defaults/starter.d.mts.map +1 -0
- package/dist/client/builder/defaults/starter.mjs +28 -0
- package/dist/client/builder/defaults/starter.mjs.map +1 -0
- package/dist/client/builder/defaults/views.mjs +27 -0
- package/dist/client/builder/defaults/views.mjs.map +1 -0
- package/dist/client/builder/defaults/widgets.mjs +31 -0
- package/dist/client/builder/defaults/widgets.mjs.map +1 -0
- package/dist/client/builder/field/field.d.mts +229 -0
- package/dist/client/builder/field/field.d.mts.map +1 -0
- package/dist/client/builder/field/field.mjs +83 -0
- package/dist/client/builder/field/field.mjs.map +1 -0
- package/dist/client/builder/index.d.mts +36 -0
- package/dist/client/builder/index.d.mts.map +1 -0
- package/dist/client/builder/page/page.d.mts +36 -0
- package/dist/client/builder/page/page.d.mts.map +1 -0
- package/dist/client/builder/page/page.mjs +27 -0
- package/dist/client/builder/page/page.mjs.map +1 -0
- package/dist/client/builder/proxies.d.mts +2 -0
- package/dist/client/builder/proxies.mjs +24 -0
- package/dist/client/builder/proxies.mjs.map +1 -0
- package/dist/client/builder/qa.d.mts +50 -0
- package/dist/client/builder/qa.d.mts.map +1 -0
- package/dist/client/builder/qa.mjs +42 -0
- package/dist/client/builder/qa.mjs.map +1 -0
- package/dist/client/builder/registry.d.mts +70 -0
- package/dist/client/builder/registry.d.mts.map +1 -0
- package/dist/client/builder/types/action-registry.d.mts +2 -0
- package/dist/client/builder/types/action-registry.mjs +142 -0
- package/dist/client/builder/types/action-registry.mjs.map +1 -0
- package/dist/client/builder/types/action-types.d.mts +253 -0
- package/dist/client/builder/types/action-types.d.mts.map +1 -0
- package/dist/client/builder/types/collection-types.d.mts +199 -0
- package/dist/client/builder/types/collection-types.d.mts.map +1 -0
- package/dist/client/builder/types/collection-types.mjs +11 -0
- package/dist/client/builder/types/collection-types.mjs.map +1 -0
- package/dist/client/builder/types/common.d.mts +60 -0
- package/dist/client/builder/types/common.d.mts.map +1 -0
- package/dist/client/builder/types/field-types.d.mts +593 -0
- package/dist/client/builder/types/field-types.d.mts.map +1 -0
- package/dist/client/builder/types/field-types.mjs +19 -0
- package/dist/client/builder/types/field-types.mjs.map +1 -0
- package/dist/client/builder/types/global-types.d.mts +22 -0
- package/dist/client/builder/types/global-types.d.mts.map +1 -0
- package/dist/client/builder/types/ui-config.d.mts +160 -0
- package/dist/client/builder/types/ui-config.d.mts.map +1 -0
- package/dist/client/builder/types/views.d.mts +89 -0
- package/dist/client/builder/types/views.d.mts.map +1 -0
- package/dist/client/builder/types/widget-types.d.mts +563 -0
- package/dist/client/builder/types/widget-types.d.mts.map +1 -0
- package/dist/client/builder/validation.d.mts +3 -0
- package/dist/client/builder/validation.mjs +208 -0
- package/dist/client/builder/validation.mjs.map +1 -0
- package/dist/client/builder/view/view.d.mts +129 -0
- package/dist/client/builder/view/view.d.mts.map +1 -0
- package/dist/client/builder/view/view.mjs +109 -0
- package/dist/client/builder/view/view.mjs.map +1 -0
- package/dist/client/builder/widget/widget.d.mts +33 -0
- package/dist/client/builder/widget/widget.d.mts.map +1 -0
- package/dist/client/builder/widget/widget.mjs +26 -0
- package/dist/client/builder/widget/widget.mjs.map +1 -0
- package/dist/client/components/actions/action-button.d.mts +2 -0
- package/dist/client/components/actions/action-button.mjs +135 -0
- package/dist/client/components/actions/action-button.mjs.map +1 -0
- package/dist/client/components/actions/action-dialog.d.mts +2 -0
- package/dist/client/components/actions/action-dialog.mjs +264 -0
- package/dist/client/components/actions/action-dialog.mjs.map +1 -0
- package/dist/client/components/actions/confirmation-dialog.d.mts +2 -0
- package/dist/client/components/actions/confirmation-dialog.mjs +82 -0
- package/dist/client/components/actions/confirmation-dialog.mjs.map +1 -0
- package/dist/client/components/actions/header-actions.d.mts +2 -0
- package/dist/client/components/actions/header-actions.mjs +117 -0
- package/dist/client/components/actions/header-actions.mjs.map +1 -0
- package/dist/client/components/actions/index.d.mts +4 -0
- package/dist/client/components/admin-link.d.mts +67 -0
- package/dist/client/components/admin-link.d.mts.map +1 -0
- package/dist/client/components/admin-link.mjs +92 -0
- package/dist/client/components/admin-link.mjs.map +1 -0
- package/dist/client/components/auth/auth-guard.d.mts +51 -0
- package/dist/client/components/auth/auth-guard.d.mts.map +1 -0
- package/dist/client/components/auth/auth-guard.mjs +60 -0
- package/dist/client/components/auth/auth-guard.mjs.map +1 -0
- package/dist/client/components/auth/auth-loading.d.mts +36 -0
- package/dist/client/components/auth/auth-loading.d.mts.map +1 -0
- package/dist/client/components/auth/auth-loading.mjs +27 -0
- package/dist/client/components/auth/auth-loading.mjs.map +1 -0
- package/dist/client/components/auth/index.d.mts +2 -0
- package/dist/client/components/blocks/block-canvas.mjs +90 -0
- package/dist/client/components/blocks/block-canvas.mjs.map +1 -0
- package/dist/client/components/blocks/block-editor-context.mjs +58 -0
- package/dist/client/components/blocks/block-editor-context.mjs.map +1 -0
- package/dist/client/components/blocks/block-editor-layout.mjs +82 -0
- package/dist/client/components/blocks/block-editor-layout.mjs.map +1 -0
- package/dist/client/components/blocks/block-editor-provider.mjs +155 -0
- package/dist/client/components/blocks/block-editor-provider.mjs.map +1 -0
- package/dist/client/components/blocks/block-fields-renderer.mjs +70 -0
- package/dist/client/components/blocks/block-fields-renderer.mjs.map +1 -0
- package/dist/client/components/blocks/block-insert-button.mjs +72 -0
- package/dist/client/components/blocks/block-insert-button.mjs.map +1 -0
- package/dist/client/components/blocks/block-item-menu.mjs +161 -0
- package/dist/client/components/blocks/block-item-menu.mjs.map +1 -0
- package/dist/client/components/blocks/block-item.mjs +187 -0
- package/dist/client/components/blocks/block-item.mjs.map +1 -0
- package/dist/client/components/blocks/block-library-sidebar.mjs +190 -0
- package/dist/client/components/blocks/block-library-sidebar.mjs.map +1 -0
- package/dist/client/components/blocks/block-tree.mjs +45 -0
- package/dist/client/components/blocks/block-tree.mjs.map +1 -0
- package/dist/client/components/blocks/block-type-icon.mjs +50 -0
- package/dist/client/components/blocks/block-type-icon.mjs.map +1 -0
- package/dist/client/components/blocks/utils/tree-utils.mjs +186 -0
- package/dist/client/components/blocks/utils/tree-utils.mjs.map +1 -0
- package/dist/client/components/component-renderer.d.mts +125 -0
- package/dist/client/components/component-renderer.d.mts.map +1 -0
- package/dist/client/components/component-renderer.mjs +145 -0
- package/dist/client/components/component-renderer.mjs.map +1 -0
- package/dist/client/components/error-boundary.mjs +92 -0
- package/dist/client/components/error-boundary.mjs.map +1 -0
- package/dist/client/components/fields/array-field.d.mts +44 -0
- package/dist/client/components/fields/array-field.d.mts.map +1 -0
- package/dist/client/components/fields/array-field.mjs +231 -0
- package/dist/client/components/fields/array-field.mjs.map +1 -0
- package/dist/client/components/fields/asset-preview-field.d.mts +52 -0
- package/dist/client/components/fields/asset-preview-field.d.mts.map +1 -0
- package/dist/client/components/fields/asset-preview-field.mjs +60 -0
- package/dist/client/components/fields/asset-preview-field.mjs.map +1 -0
- package/dist/client/components/fields/blocks-field/blocks-field.d.mts +41 -0
- package/dist/client/components/fields/blocks-field/blocks-field.d.mts.map +1 -0
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +101 -0
- package/dist/client/components/fields/blocks-field/blocks-field.mjs.map +1 -0
- package/dist/client/components/fields/blocks-field/index.d.mts +1 -0
- package/dist/client/components/fields/boolean-field.d.mts +30 -0
- package/dist/client/components/fields/boolean-field.d.mts.map +1 -0
- package/dist/client/components/fields/boolean-field.mjs +47 -0
- package/dist/client/components/fields/boolean-field.mjs.map +1 -0
- package/dist/client/components/fields/custom-field.d.mts +3 -0
- package/dist/client/components/fields/date-field.d.mts +22 -0
- package/dist/client/components/fields/date-field.d.mts.map +1 -0
- package/dist/client/components/fields/date-field.mjs +42 -0
- package/dist/client/components/fields/date-field.mjs.map +1 -0
- package/dist/client/components/fields/datetime-field.d.mts +23 -0
- package/dist/client/components/fields/datetime-field.d.mts.map +1 -0
- package/dist/client/components/fields/datetime-field.mjs +43 -0
- package/dist/client/components/fields/datetime-field.mjs.map +1 -0
- package/dist/client/components/fields/email-field.d.mts +19 -0
- package/dist/client/components/fields/email-field.d.mts.map +1 -0
- package/dist/client/components/fields/email-field.mjs +38 -0
- package/dist/client/components/fields/email-field.mjs.map +1 -0
- package/dist/client/components/fields/embedded-collection.d.mts +3 -0
- package/dist/client/components/fields/field-types.d.mts +571 -0
- package/dist/client/components/fields/field-types.d.mts.map +1 -0
- package/dist/client/components/fields/field-utils.d.mts +1 -0
- package/dist/client/components/fields/field-utils.mjs +65 -0
- package/dist/client/components/fields/field-utils.mjs.map +1 -0
- package/dist/client/components/fields/field-wrapper.d.mts +3 -0
- package/dist/client/components/fields/field-wrapper.mjs +49 -0
- package/dist/client/components/fields/field-wrapper.mjs.map +1 -0
- package/dist/client/components/fields/index.d.mts +33 -0
- package/dist/client/components/fields/json-field.d.mts +84 -0
- package/dist/client/components/fields/json-field.d.mts.map +1 -0
- package/dist/client/components/fields/json-field.mjs +248 -0
- package/dist/client/components/fields/json-field.mjs.map +1 -0
- package/dist/client/components/fields/locale-badge.d.mts +1 -0
- package/dist/client/components/fields/locale-badge.mjs +17 -0
- package/dist/client/components/fields/locale-badge.mjs.map +1 -0
- package/dist/client/components/fields/number-field.d.mts +23 -0
- package/dist/client/components/fields/number-field.d.mts.map +1 -0
- package/dist/client/components/fields/number-field.mjs +40 -0
- package/dist/client/components/fields/number-field.mjs.map +1 -0
- package/dist/client/components/fields/object-array-field.d.mts +2 -0
- package/dist/client/components/fields/object-array-field.mjs +313 -0
- package/dist/client/components/fields/object-array-field.mjs.map +1 -0
- package/dist/client/components/fields/object-field.d.mts +32 -0
- package/dist/client/components/fields/object-field.d.mts.map +1 -0
- package/dist/client/components/fields/object-field.mjs +128 -0
- package/dist/client/components/fields/object-field.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/cards-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/cards-display.mjs +140 -0
- package/dist/client/components/fields/relation/displays/cards-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/chips-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/chips-display.mjs +100 -0
- package/dist/client/components/fields/relation/displays/chips-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/grid-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/grid-display.mjs +114 -0
- package/dist/client/components/fields/relation/displays/grid-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/index.d.mts +6 -0
- package/dist/client/components/fields/relation/displays/list-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/list-display.mjs +128 -0
- package/dist/client/components/fields/relation/displays/list-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/table-display.d.mts +2 -0
- package/dist/client/components/fields/relation/displays/table-display.mjs +134 -0
- package/dist/client/components/fields/relation/displays/table-display.mjs.map +1 -0
- package/dist/client/components/fields/relation/displays/types.d.mts +22 -0
- package/dist/client/components/fields/relation/displays/types.d.mts.map +1 -0
- package/dist/client/components/fields/relation/displays/types.mjs +73 -0
- package/dist/client/components/fields/relation/displays/types.mjs.map +1 -0
- package/dist/client/components/fields/relation/index.d.mts +3 -0
- package/dist/client/components/fields/relation/relation-items-display.d.mts +5 -0
- package/dist/client/components/fields/relation/relation-items-display.mjs +47 -0
- package/dist/client/components/fields/relation/relation-items-display.mjs.map +1 -0
- package/dist/client/components/fields/relation-field.d.mts +134 -0
- package/dist/client/components/fields/relation-field.d.mts.map +1 -0
- package/dist/client/components/fields/relation-field.mjs +106 -0
- package/dist/client/components/fields/relation-field.mjs.map +1 -0
- package/dist/client/components/fields/relation-picker.d.mts +4 -0
- package/dist/client/components/fields/relation-picker.mjs +301 -0
- package/dist/client/components/fields/relation-picker.mjs.map +1 -0
- package/dist/client/components/fields/relation-select.d.mts +3 -0
- package/dist/client/components/fields/relation-select.mjs +219 -0
- package/dist/client/components/fields/relation-select.mjs.map +1 -0
- package/dist/client/components/fields/reverse-relation-field.d.mts +2 -0
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +56 -0
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/extensions.mjs +118 -0
- package/dist/client/components/fields/rich-text-editor/extensions.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +196 -0
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/index.d.mts +4 -0
- package/dist/client/components/fields/rich-text-editor/index.mjs +187 -0
- package/dist/client/components/fields/rich-text-editor/index.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/link-popover.mjs +86 -0
- package/dist/client/components/fields/rich-text-editor/link-popover.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/presets.d.mts +11 -0
- package/dist/client/components/fields/rich-text-editor/presets.d.mts.map +1 -0
- package/dist/client/components/fields/rich-text-editor/presets.mjs +124 -0
- package/dist/client/components/fields/rich-text-editor/presets.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +145 -0
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/table-controls.mjs +124 -0
- package/dist/client/components/fields/rich-text-editor/table-controls.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +280 -0
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/types.d.mts +78 -0
- package/dist/client/components/fields/rich-text-editor/types.d.mts.map +1 -0
- package/dist/client/components/fields/rich-text-editor/types.mjs +31 -0
- package/dist/client/components/fields/rich-text-editor/types.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/utils.mjs +51 -0
- package/dist/client/components/fields/rich-text-editor/utils.mjs.map +1 -0
- package/dist/client/components/fields/rich-text-editor/variants.d.mts +2 -0
- package/dist/client/components/fields/rich-text-field.d.mts +14 -0
- package/dist/client/components/fields/rich-text-field.d.mts.map +1 -0
- package/dist/client/components/fields/rich-text-field.mjs +26 -0
- package/dist/client/components/fields/rich-text-field.mjs.map +1 -0
- package/dist/client/components/fields/select-field.d.mts +25 -0
- package/dist/client/components/fields/select-field.d.mts.map +1 -0
- package/dist/client/components/fields/select-field.mjs +53 -0
- package/dist/client/components/fields/select-field.mjs.map +1 -0
- package/dist/client/components/fields/status-field.d.mts +2 -0
- package/dist/client/components/fields/text-field.d.mts +22 -0
- package/dist/client/components/fields/text-field.d.mts.map +1 -0
- package/dist/client/components/fields/text-field.mjs +39 -0
- package/dist/client/components/fields/text-field.mjs.map +1 -0
- package/dist/client/components/fields/textarea-field.d.mts +22 -0
- package/dist/client/components/fields/textarea-field.d.mts.map +1 -0
- package/dist/client/components/fields/textarea-field.mjs +39 -0
- package/dist/client/components/fields/textarea-field.mjs.map +1 -0
- package/dist/client/components/fields/time-field.d.mts +20 -0
- package/dist/client/components/fields/time-field.d.mts.map +1 -0
- package/dist/client/components/fields/time-field.mjs +39 -0
- package/dist/client/components/fields/time-field.mjs.map +1 -0
- package/dist/client/components/fields/upload-field.d.mts +97 -0
- package/dist/client/components/fields/upload-field.d.mts.map +1 -0
- package/dist/client/components/fields/upload-field.mjs +497 -0
- package/dist/client/components/fields/upload-field.mjs.map +1 -0
- package/dist/client/components/filter-builder/columns-tab.d.mts +1 -0
- package/dist/client/components/filter-builder/columns-tab.mjs +131 -0
- package/dist/client/components/filter-builder/columns-tab.mjs.map +1 -0
- package/dist/client/components/filter-builder/filter-builder-sheet.d.mts +1 -0
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +157 -0
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs.map +1 -0
- package/dist/client/components/filter-builder/filters-tab.d.mts +1 -0
- package/dist/client/components/filter-builder/filters-tab.mjs +380 -0
- package/dist/client/components/filter-builder/filters-tab.mjs.map +1 -0
- package/dist/client/components/filter-builder/index.d.mts +5 -0
- package/dist/client/components/filter-builder/saved-views-tab.d.mts +1 -0
- package/dist/client/components/filter-builder/saved-views-tab.mjs +125 -0
- package/dist/client/components/filter-builder/saved-views-tab.mjs.map +1 -0
- package/dist/client/components/index.d.mts +80 -0
- package/dist/client/components/locale-switcher.d.mts +2 -0
- package/dist/client/components/locale-switcher.mjs +128 -0
- package/dist/client/components/locale-switcher.mjs.map +1 -0
- package/dist/client/components/media/media-grid.mjs +139 -0
- package/dist/client/components/media/media-grid.mjs.map +1 -0
- package/dist/client/components/media/media-picker-dialog.mjs +255 -0
- package/dist/client/components/media/media-picker-dialog.mjs.map +1 -0
- package/dist/client/components/preview/live-preview-mode.mjs +211 -0
- package/dist/client/components/preview/live-preview-mode.mjs.map +1 -0
- package/dist/client/components/preview/preview-pane.mjs +179 -0
- package/dist/client/components/preview/preview-pane.mjs.map +1 -0
- package/dist/client/components/primitives/asset-preview.mjs +363 -0
- package/dist/client/components/primitives/asset-preview.mjs.map +1 -0
- package/dist/client/components/primitives/checkbox-input.mjs +33 -0
- package/dist/client/components/primitives/checkbox-input.mjs.map +1 -0
- package/dist/client/components/primitives/date-input.mjs +218 -0
- package/dist/client/components/primitives/date-input.mjs.map +1 -0
- package/dist/client/components/primitives/dropzone.mjs +239 -0
- package/dist/client/components/primitives/dropzone.mjs.map +1 -0
- package/dist/client/components/primitives/number-input.mjs +113 -0
- package/dist/client/components/primitives/number-input.mjs.map +1 -0
- package/dist/client/components/primitives/select-multi.mjs +256 -0
- package/dist/client/components/primitives/select-multi.mjs.map +1 -0
- package/dist/client/components/primitives/select-single.mjs +183 -0
- package/dist/client/components/primitives/select-single.mjs.map +1 -0
- package/dist/client/components/primitives/text-input.mjs +40 -0
- package/dist/client/components/primitives/text-input.mjs.map +1 -0
- package/dist/client/components/primitives/textarea-input.mjs +38 -0
- package/dist/client/components/primitives/textarea-input.mjs.map +1 -0
- package/dist/client/components/primitives/time-input.mjs +72 -0
- package/dist/client/components/primitives/time-input.mjs.map +1 -0
- package/dist/client/components/primitives/toggle-input.mjs +31 -0
- package/dist/client/components/primitives/toggle-input.mjs.map +1 -0
- package/dist/client/components/primitives/types.d.mts +14 -0
- package/dist/client/components/primitives/types.d.mts.map +1 -0
- package/dist/client/components/primitives/types.mjs +13 -0
- package/dist/client/components/primitives/types.mjs.map +1 -0
- package/dist/client/components/sheets/index.d.mts +1 -0
- package/dist/client/components/sheets/resource-sheet.d.mts +1 -0
- package/dist/client/components/sheets/resource-sheet.mjs +78 -0
- package/dist/client/components/sheets/resource-sheet.mjs.map +1 -0
- package/dist/client/components/ui/accordion.d.mts +2 -0
- package/dist/client/components/ui/accordion.mjs +50 -0
- package/dist/client/components/ui/accordion.mjs.map +1 -0
- package/dist/client/components/ui/alert.mjs +32 -0
- package/dist/client/components/ui/alert.mjs.map +1 -0
- package/dist/client/components/ui/avatar.d.mts +3 -0
- package/dist/client/components/ui/badge.d.mts +3 -0
- package/dist/client/components/ui/badge.mjs +35 -0
- package/dist/client/components/ui/badge.mjs.map +1 -0
- package/dist/client/components/ui/button.d.mts +3 -0
- package/dist/client/components/ui/button.mjs +49 -0
- package/dist/client/components/ui/button.mjs.map +1 -0
- package/dist/client/components/ui/card.d.mts +2 -0
- package/dist/{card-BKHjBQfw.mjs → client/components/ui/card.mjs} +3 -10
- package/dist/{card-BKHjBQfw.mjs.map → client/components/ui/card.mjs.map} +1 -1
- package/dist/client/components/ui/checkbox.d.mts +2 -0
- package/dist/client/components/ui/checkbox.mjs +27 -0
- package/dist/client/components/ui/checkbox.mjs.map +1 -0
- package/dist/client/components/ui/combobox.d.mts +3 -0
- package/dist/client/components/ui/command.mjs +69 -0
- package/dist/client/components/ui/command.mjs.map +1 -0
- package/dist/client/components/ui/dialog.d.mts +3 -0
- package/dist/client/components/ui/dialog.mjs +83 -0
- package/dist/client/components/ui/dialog.mjs.map +1 -0
- package/dist/client/components/ui/drawer.mjs +75 -0
- package/dist/client/components/ui/drawer.mjs.map +1 -0
- package/dist/client/components/ui/dropdown-menu.d.mts +3 -0
- package/dist/client/components/ui/dropdown-menu.mjs +89 -0
- package/dist/client/components/ui/dropdown-menu.mjs.map +1 -0
- package/dist/client/components/ui/empty-state.mjs +53 -0
- package/dist/client/components/ui/empty-state.mjs.map +1 -0
- package/dist/client/components/ui/field.d.mts +3 -0
- package/dist/client/components/ui/field.mjs +78 -0
- package/dist/client/components/ui/field.mjs.map +1 -0
- package/dist/client/components/ui/input-group.d.mts +4 -0
- package/dist/client/components/ui/input-group.mjs +68 -0
- package/dist/client/components/ui/input-group.mjs.map +1 -0
- package/dist/client/components/ui/input.d.mts +2 -0
- package/dist/client/components/ui/input.mjs +17 -0
- package/dist/client/components/ui/input.mjs.map +1 -0
- package/dist/client/components/ui/kbd.mjs +24 -0
- package/dist/client/components/ui/kbd.mjs.map +1 -0
- package/dist/client/components/ui/label.d.mts +2 -0
- package/dist/client/components/ui/label.mjs +15 -0
- package/dist/client/components/ui/label.mjs.map +1 -0
- package/dist/client/components/ui/popover.d.mts +3 -0
- package/dist/client/components/ui/popover.mjs +49 -0
- package/dist/client/components/ui/popover.mjs.map +1 -0
- package/dist/client/components/ui/responsive-dialog.mjs +102 -0
- package/dist/client/components/ui/responsive-dialog.mjs.map +1 -0
- package/dist/client/components/ui/scroll-area.d.mts +2 -0
- package/dist/client/components/ui/search-input.mjs +74 -0
- package/dist/client/components/ui/search-input.mjs.map +1 -0
- package/dist/client/components/ui/select.d.mts +3 -0
- package/dist/client/components/ui/select.mjs +85 -0
- package/dist/client/components/ui/select.mjs.map +1 -0
- package/dist/client/components/ui/separator.d.mts +2 -0
- package/dist/client/components/ui/separator.mjs +17 -0
- package/dist/client/components/ui/separator.mjs.map +1 -0
- package/dist/client/components/ui/sheet.d.mts +3 -0
- package/dist/client/components/ui/sheet.mjs +78 -0
- package/dist/client/components/ui/sheet.mjs.map +1 -0
- package/dist/client/components/ui/sidebar.d.mts +8 -0
- package/dist/client/components/ui/sidebar.mjs +256 -0
- package/dist/client/components/ui/sidebar.mjs.map +1 -0
- package/dist/client/components/ui/skeleton.d.mts +1 -0
- package/dist/client/components/ui/skeleton.mjs +15 -0
- package/dist/client/components/ui/skeleton.mjs.map +1 -0
- package/dist/client/components/ui/sonner.d.mts +14 -0
- package/dist/client/components/ui/sonner.d.mts.map +1 -0
- package/dist/client/components/ui/sonner.mjs +55 -0
- package/dist/client/components/ui/sonner.mjs.map +1 -0
- package/dist/client/components/ui/spinner.d.mts +1 -0
- package/dist/client/components/ui/spinner.mjs +18 -0
- package/dist/client/components/ui/spinner.mjs.map +1 -0
- package/dist/client/components/ui/switch.d.mts +2 -0
- package/dist/client/components/ui/switch.mjs +23 -0
- package/dist/client/components/ui/switch.mjs.map +1 -0
- package/dist/client/components/ui/table.d.mts +2 -0
- package/dist/client/components/ui/table.mjs +66 -0
- package/dist/client/components/ui/table.mjs.map +1 -0
- package/dist/client/components/ui/tabs.d.mts +3 -0
- package/dist/client/components/ui/tabs.mjs +49 -0
- package/dist/client/components/ui/tabs.mjs.map +1 -0
- package/dist/client/components/ui/textarea.d.mts +2 -0
- package/dist/client/components/ui/textarea.mjs +15 -0
- package/dist/client/components/ui/textarea.mjs.map +1 -0
- package/dist/client/components/ui/toolbar.mjs +54 -0
- package/dist/client/components/ui/toolbar.mjs.map +1 -0
- package/dist/client/components/ui/tooltip.d.mts +2 -0
- package/dist/client/components/ui/tooltip.mjs +45 -0
- package/dist/client/components/ui/tooltip.mjs.map +1 -0
- package/dist/client/components/widgets/chart-widget.d.mts +57 -0
- package/dist/client/components/widgets/chart-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/chart-widget.mjs +282 -0
- package/dist/client/components/widgets/chart-widget.mjs.map +1 -0
- package/dist/client/components/widgets/progress-widget.d.mts +41 -0
- package/dist/client/components/widgets/progress-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/progress-widget.mjs +110 -0
- package/dist/client/components/widgets/progress-widget.mjs.map +1 -0
- package/dist/client/components/widgets/quick-actions-widget.d.mts +29 -0
- package/dist/client/components/widgets/quick-actions-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/quick-actions-widget.mjs +121 -0
- package/dist/client/components/widgets/quick-actions-widget.mjs.map +1 -0
- package/dist/client/components/widgets/recent-items-widget.d.mts +51 -0
- package/dist/client/components/widgets/recent-items-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/recent-items-widget.mjs +101 -0
- package/dist/client/components/widgets/recent-items-widget.mjs.map +1 -0
- package/dist/client/components/widgets/stats-widget.d.mts +55 -0
- package/dist/client/components/widgets/stats-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/stats-widget.mjs +150 -0
- package/dist/client/components/widgets/stats-widget.mjs.map +1 -0
- package/dist/client/components/widgets/table-widget.d.mts +31 -0
- package/dist/client/components/widgets/table-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/table-widget.mjs +139 -0
- package/dist/client/components/widgets/table-widget.mjs.map +1 -0
- package/dist/client/components/widgets/timeline-widget.d.mts +51 -0
- package/dist/client/components/widgets/timeline-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/timeline-widget.mjs +168 -0
- package/dist/client/components/widgets/timeline-widget.mjs.map +1 -0
- package/dist/client/components/widgets/value-widget.d.mts +39 -0
- package/dist/client/components/widgets/value-widget.d.mts.map +1 -0
- package/dist/client/components/widgets/value-widget.mjs +111 -0
- package/dist/client/components/widgets/value-widget.mjs.map +1 -0
- package/dist/client/components/widgets/widget-skeletons.mjs +145 -0
- package/dist/client/components/widgets/widget-skeletons.mjs.map +1 -0
- package/dist/client/context/focus-context.d.mts +88 -0
- package/dist/client/context/focus-context.d.mts.map +1 -0
- package/dist/client/context/focus-context.mjs +178 -0
- package/dist/client/context/focus-context.mjs.map +1 -0
- package/dist/client/contexts/breadcrumb-context.mjs +32 -0
- package/dist/client/contexts/breadcrumb-context.mjs.map +1 -0
- package/dist/client/hooks/typed-hooks.d.mts +84 -0
- package/dist/client/hooks/typed-hooks.d.mts.map +1 -0
- package/dist/client/hooks/typed-hooks.mjs +272 -0
- package/dist/client/hooks/typed-hooks.mjs.map +1 -0
- package/dist/client/hooks/use-action.mjs +201 -0
- package/dist/client/hooks/use-action.mjs.map +1 -0
- package/dist/client/hooks/use-admin-config.mjs +40 -0
- package/dist/client/hooks/use-admin-config.mjs.map +1 -0
- package/dist/client/hooks/use-admin-preferences.mjs +68 -0
- package/dist/client/hooks/use-admin-preferences.mjs.map +1 -0
- package/dist/client/hooks/use-admin-routes.mjs +97 -0
- package/dist/client/hooks/use-admin-routes.mjs.map +1 -0
- package/dist/client/hooks/use-auth.d.mts +98 -0
- package/dist/client/hooks/use-auth.d.mts.map +1 -0
- package/dist/{use-auth-BoLmWtmU.mjs → client/hooks/use-auth.mjs} +3 -3
- package/dist/client/hooks/use-auth.mjs.map +1 -0
- package/dist/client/hooks/use-collection-fields.mjs +32 -0
- package/dist/client/hooks/use-collection-fields.mjs.map +1 -0
- package/dist/client/hooks/use-collection-meta.mjs +121 -0
- package/dist/client/hooks/use-collection-meta.mjs.map +1 -0
- package/dist/client/hooks/use-collection-schema.mjs +67 -0
- package/dist/client/hooks/use-collection-schema.mjs.map +1 -0
- package/dist/client/hooks/use-collection-validation.mjs +74 -0
- package/dist/client/hooks/use-collection-validation.mjs.map +1 -0
- package/dist/client/hooks/use-collection.d.mts +86 -0
- package/dist/client/hooks/use-collection.d.mts.map +1 -0
- package/dist/client/hooks/use-collection.mjs +214 -0
- package/dist/client/hooks/use-collection.mjs.map +1 -0
- package/dist/client/hooks/use-current-user.d.mts +57 -0
- package/dist/client/hooks/use-current-user.d.mts.map +1 -0
- package/dist/client/hooks/use-current-user.mjs +79 -0
- package/dist/client/hooks/use-current-user.mjs.map +1 -0
- package/dist/client/hooks/use-field-hooks.mjs +191 -0
- package/dist/client/hooks/use-field-hooks.mjs.map +1 -0
- package/dist/client/hooks/use-field-options.d.mts +90 -0
- package/dist/client/hooks/use-field-options.d.mts.map +1 -0
- package/dist/client/hooks/use-field-options.mjs +184 -0
- package/dist/client/hooks/use-field-options.mjs.map +1 -0
- package/dist/client/hooks/use-global-fields.mjs +27 -0
- package/dist/client/hooks/use-global-fields.mjs.map +1 -0
- package/dist/client/hooks/use-global-meta.mjs +59 -0
- package/dist/client/hooks/use-global-meta.mjs.map +1 -0
- package/dist/client/hooks/use-global-schema.mjs +33 -0
- package/dist/client/hooks/use-global-schema.mjs.map +1 -0
- package/dist/client/hooks/use-global.d.mts +40 -0
- package/dist/client/hooks/use-global.d.mts.map +1 -0
- package/dist/client/hooks/use-global.mjs +74 -0
- package/dist/client/hooks/use-global.mjs.map +1 -0
- package/dist/client/hooks/use-locks.mjs +245 -0
- package/dist/client/hooks/use-locks.mjs.map +1 -0
- package/dist/client/hooks/use-media-query.d.mts +23 -0
- package/dist/client/hooks/use-media-query.d.mts.map +1 -0
- package/dist/client/hooks/use-media-query.mjs +62 -0
- package/dist/client/hooks/use-media-query.mjs.map +1 -0
- package/dist/client/hooks/use-prefill-params.mjs +47 -0
- package/dist/client/hooks/use-prefill-params.mjs.map +1 -0
- package/dist/client/hooks/use-questpie-query-options.mjs +28 -0
- package/dist/client/hooks/use-questpie-query-options.mjs.map +1 -0
- package/dist/client/hooks/use-reactive-fields.d.mts +75 -0
- package/dist/client/hooks/use-reactive-fields.d.mts.map +1 -0
- package/dist/client/hooks/use-reactive-fields.mjs +164 -0
- package/dist/client/hooks/use-reactive-fields.mjs.map +1 -0
- package/dist/client/hooks/use-realtime-highlight.mjs +96 -0
- package/dist/client/hooks/use-realtime-highlight.mjs.map +1 -0
- package/dist/client/hooks/use-saved-views.mjs +65 -0
- package/dist/client/hooks/use-saved-views.mjs.map +1 -0
- package/dist/client/hooks/use-search.mjs +147 -0
- package/dist/client/hooks/use-search.mjs.map +1 -0
- package/dist/client/hooks/use-server-validation.mjs +199 -0
- package/dist/client/hooks/use-server-validation.mjs.map +1 -0
- package/dist/client/hooks/use-server-widget-data.d.mts +26 -0
- package/dist/client/hooks/use-server-widget-data.d.mts.map +1 -0
- package/dist/client/hooks/use-server-widget-data.mjs +40 -0
- package/dist/client/hooks/use-server-widget-data.mjs.map +1 -0
- package/dist/client/hooks/use-setup-status.d.mts +39 -0
- package/dist/client/hooks/use-setup-status.d.mts.map +1 -0
- package/dist/client/hooks/use-setup-status.mjs +50 -0
- package/dist/client/hooks/use-setup-status.mjs.map +1 -0
- package/dist/client/hooks/use-upload-collection.mjs +32 -0
- package/dist/client/hooks/use-upload-collection.mjs.map +1 -0
- package/dist/client/hooks/use-upload.d.mts +23 -0
- package/dist/client/hooks/use-upload.d.mts.map +1 -0
- package/dist/client/hooks/use-upload.mjs +145 -0
- package/dist/client/hooks/use-upload.mjs.map +1 -0
- package/dist/client/hooks/use-validation-error-map.mjs +53 -0
- package/dist/client/hooks/use-validation-error-map.mjs.map +1 -0
- package/dist/client/hooks/use-view-state.mjs +261 -0
- package/dist/client/hooks/use-view-state.mjs.map +1 -0
- package/dist/client/i18n/hooks.mjs +160 -0
- package/dist/client/i18n/hooks.mjs.map +1 -0
- package/dist/client/i18n/intl-cache.mjs +65 -0
- package/dist/client/i18n/intl-cache.mjs.map +1 -0
- package/dist/client/i18n/messages.mjs +7 -0
- package/dist/client/i18n/messages.mjs.map +1 -0
- package/dist/client/i18n/simple.d.mts +22 -0
- package/dist/client/i18n/simple.d.mts.map +1 -0
- package/dist/client/i18n/simple.mjs +157 -0
- package/dist/client/i18n/simple.mjs.map +1 -0
- package/dist/client/i18n/types.d.mts +110 -0
- package/dist/client/i18n/types.d.mts.map +1 -0
- package/dist/client/lib/utils.d.mts +1 -0
- package/dist/client/lib/utils.mjs +28 -0
- package/dist/client/lib/utils.mjs.map +1 -0
- package/dist/client/preview/block-scope-context.d.mts +74 -0
- package/dist/client/preview/block-scope-context.d.mts.map +1 -0
- package/dist/client/preview/block-scope-context.mjs +93 -0
- package/dist/client/preview/block-scope-context.mjs.map +1 -0
- package/dist/client/preview/index.d.mts +5 -0
- package/dist/client/preview/preview-banner.d.mts +46 -0
- package/dist/client/preview/preview-banner.d.mts.map +1 -0
- package/dist/client/preview/preview-banner.mjs +95 -0
- package/dist/client/preview/preview-banner.mjs.map +1 -0
- package/dist/client/preview/preview-field.d.mts +108 -0
- package/dist/client/preview/preview-field.d.mts.map +1 -0
- package/dist/client/preview/preview-field.mjs +125 -0
- package/dist/client/preview/preview-field.mjs.map +1 -0
- package/dist/client/preview/types.d.mts +115 -0
- package/dist/client/preview/types.d.mts.map +1 -0
- package/dist/client/preview/types.mjs +21 -0
- package/dist/client/preview/types.mjs.map +1 -0
- package/dist/client/preview/use-collection-preview.d.mts +71 -0
- package/dist/client/preview/use-collection-preview.d.mts.map +1 -0
- package/dist/client/preview/use-collection-preview.mjs +114 -0
- package/dist/client/preview/use-collection-preview.mjs.map +1 -0
- package/dist/client/runtime/content-locales-provider.d.mts +1 -0
- package/dist/client/runtime/content-locales-provider.mjs +85 -0
- package/dist/client/runtime/content-locales-provider.mjs.map +1 -0
- package/dist/client/runtime/index.d.mts +7 -0
- package/dist/client/runtime/index.mjs +8 -0
- package/dist/client/runtime/locale-scope.d.mts +2 -0
- package/dist/{runtime-6VZM878K.mjs → client/runtime/locale-scope.mjs} +3 -4
- package/dist/client/runtime/locale-scope.mjs.map +1 -0
- package/dist/client/runtime/provider.d.mts +10107 -0
- package/dist/client/runtime/provider.d.mts.map +1 -0
- package/dist/client/runtime/provider.mjs +229 -0
- package/dist/client/runtime/provider.mjs.map +1 -0
- package/dist/client/runtime/routes.d.mts +49 -0
- package/dist/client/runtime/routes.d.mts.map +1 -0
- package/dist/client/runtime/routes.mjs +107 -0
- package/dist/client/runtime/routes.mjs.map +1 -0
- package/dist/client/runtime/translations-provider.d.mts +2 -0
- package/dist/client/runtime/translations-provider.mjs +181 -0
- package/dist/client/runtime/translations-provider.mjs.map +1 -0
- package/dist/client/scope/index.d.mts +3 -0
- package/dist/client/scope/picker.d.mts +54 -0
- package/dist/client/scope/picker.d.mts.map +1 -0
- package/dist/client/scope/picker.mjs +161 -0
- package/dist/client/scope/picker.mjs.map +1 -0
- package/dist/client/scope/provider.d.mts +104 -0
- package/dist/client/scope/provider.d.mts.map +1 -0
- package/dist/client/scope/provider.mjs +159 -0
- package/dist/client/scope/provider.mjs.map +1 -0
- package/dist/client/scope/types.d.mts +112 -0
- package/dist/client/scope/types.d.mts.map +1 -0
- package/dist/client/styles/index.css +80 -0
- package/dist/client/utils/auto-expand-fields.mjs +65 -0
- package/dist/client/utils/auto-expand-fields.mjs.map +1 -0
- package/dist/client/utils/build-field-definitions-from-schema.mjs +256 -0
- package/dist/client/utils/build-field-definitions-from-schema.mjs.map +1 -0
- package/dist/client/utils/detect-relations.mjs +46 -0
- package/dist/client/utils/detect-relations.mjs.map +1 -0
- package/dist/client/utils/locale-to-flag.d.mts +118 -0
- package/dist/client/utils/locale-to-flag.d.mts.map +1 -0
- package/dist/client/utils/locale-to-flag.mjs +130 -0
- package/dist/client/utils/locale-to-flag.mjs.map +1 -0
- package/dist/client/utils/routes.mjs +196 -0
- package/dist/client/utils/routes.mjs.map +1 -0
- package/dist/client/views/auth/accept-invite-form.d.mts +73 -0
- package/dist/client/views/auth/accept-invite-form.d.mts.map +1 -0
- package/dist/client/views/auth/accept-invite-form.mjs +180 -0
- package/dist/client/views/auth/accept-invite-form.mjs.map +1 -0
- package/dist/client/views/auth/auth-layout.d.mts +44 -0
- package/dist/client/views/auth/auth-layout.d.mts.map +1 -0
- package/dist/client/views/auth/auth-layout.mjs +53 -0
- package/dist/client/views/auth/auth-layout.mjs.map +1 -0
- package/dist/client/views/auth/forgot-password-form.d.mts +59 -0
- package/dist/client/views/auth/forgot-password-form.d.mts.map +1 -0
- package/dist/{forgot-password-page-Bcp-An4Y.mjs → client/views/auth/forgot-password-form.mjs} +22 -89
- package/dist/client/views/auth/forgot-password-form.mjs.map +1 -0
- package/dist/client/views/auth/index.d.mts +7 -0
- package/dist/client/views/auth/invite-form.d.mts +1 -0
- package/dist/client/views/auth/invite-form.mjs +155 -0
- package/dist/client/views/auth/invite-form.mjs.map +1 -0
- package/dist/client/views/auth/login-form.d.mts +76 -0
- package/dist/client/views/auth/login-form.d.mts.map +1 -0
- package/dist/client/views/auth/login-form.mjs +167 -0
- package/dist/client/views/auth/login-form.mjs.map +1 -0
- package/dist/client/views/auth/reset-password-form.d.mts +66 -0
- package/dist/client/views/auth/reset-password-form.d.mts.map +1 -0
- package/dist/client/views/auth/reset-password-form.mjs +188 -0
- package/dist/client/views/auth/reset-password-form.mjs.map +1 -0
- package/dist/client/views/auth/setup-form.d.mts +61 -0
- package/dist/client/views/auth/setup-form.d.mts.map +1 -0
- package/dist/{setup-page-YAP_fzqh.mjs → client/views/auth/setup-form.mjs} +46 -124
- package/dist/client/views/auth/setup-form.mjs.map +1 -0
- package/dist/client/views/collection/auto-form-fields.d.mts +4 -0
- package/dist/client/views/collection/auto-form-fields.mjs +453 -0
- package/dist/client/views/collection/auto-form-fields.mjs.map +1 -0
- package/dist/client/views/collection/bulk-action-toolbar.mjs +291 -0
- package/dist/client/views/collection/bulk-action-toolbar.mjs.map +1 -0
- package/dist/client/views/collection/cells/complex-cells.d.mts +46 -0
- package/dist/client/views/collection/cells/complex-cells.d.mts.map +1 -0
- package/dist/client/views/collection/cells/complex-cells.mjs +327 -0
- package/dist/client/views/collection/cells/complex-cells.mjs.map +1 -0
- package/dist/client/views/collection/cells/index.d.mts +7 -0
- package/dist/client/views/collection/cells/primitive-cells.d.mts +76 -0
- package/dist/client/views/collection/cells/primitive-cells.d.mts.map +1 -0
- package/dist/client/views/collection/cells/primitive-cells.mjs +165 -0
- package/dist/client/views/collection/cells/primitive-cells.mjs.map +1 -0
- package/dist/client/views/collection/cells/relation-cells.d.mts +21 -0
- package/dist/client/views/collection/cells/relation-cells.d.mts.map +1 -0
- package/dist/client/views/collection/cells/relation-cells.mjs +105 -0
- package/dist/client/views/collection/cells/relation-cells.mjs.map +1 -0
- package/dist/client/views/collection/cells/shared/asset-thumbnail.d.mts +1 -0
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +189 -0
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs.map +1 -0
- package/dist/client/views/collection/cells/shared/cell-helpers.d.mts +2 -0
- package/dist/client/views/collection/cells/shared/cell-helpers.mjs +78 -0
- package/dist/client/views/collection/cells/shared/cell-helpers.mjs.map +1 -0
- package/dist/client/views/collection/cells/shared/relation-chip.d.mts +1 -0
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +37 -0
- package/dist/client/views/collection/cells/shared/relation-chip.mjs.map +1 -0
- package/dist/client/views/collection/cells/upload-cells.d.mts +25 -0
- package/dist/client/views/collection/cells/upload-cells.d.mts.map +1 -0
- package/dist/client/views/collection/cells/upload-cells.mjs +20 -0
- package/dist/client/views/collection/cells/upload-cells.mjs.map +1 -0
- package/dist/client/views/collection/columns/build-columns.d.mts +2 -0
- package/dist/client/views/collection/columns/build-columns.mjs +156 -0
- package/dist/client/views/collection/columns/build-columns.mjs.map +1 -0
- package/dist/client/views/collection/columns/column-defaults.d.mts +2 -0
- package/dist/client/views/collection/columns/column-defaults.mjs +108 -0
- package/dist/client/views/collection/columns/column-defaults.mjs.map +1 -0
- package/dist/client/views/collection/columns/index.d.mts +3 -0
- package/dist/client/views/collection/columns/types.d.mts +2 -0
- package/dist/client/views/collection/field-context.mjs +127 -0
- package/dist/client/views/collection/field-context.mjs.map +1 -0
- package/dist/client/views/collection/field-renderer.mjs +171 -0
- package/dist/client/views/collection/field-renderer.mjs.map +1 -0
- package/dist/client/views/collection/form-view.d.mts +112 -0
- package/dist/client/views/collection/form-view.d.mts.map +1 -0
- package/dist/client/views/collection/form-view.mjs +903 -0
- package/dist/client/views/collection/form-view.mjs.map +1 -0
- package/dist/client/views/collection/index.d.mts +9 -0
- package/dist/client/views/collection/table-view.d.mts +102 -0
- package/dist/client/views/collection/table-view.d.mts.map +1 -0
- package/dist/client/views/collection/table-view.mjs +695 -0
- package/dist/client/views/collection/table-view.mjs.map +1 -0
- package/dist/client/views/collection/view-skeletons.mjs +121 -0
- package/dist/client/views/collection/view-skeletons.mjs.map +1 -0
- package/dist/client/views/common/global-search.d.mts +1 -0
- package/dist/client/views/common/global-search.mjs +376 -0
- package/dist/client/views/common/global-search.mjs.map +1 -0
- package/dist/client/views/common/index.d.mts +1 -0
- package/dist/client/views/dashboard/dashboard-grid.mjs +385 -0
- package/dist/client/views/dashboard/dashboard-grid.mjs.map +1 -0
- package/dist/client/views/dashboard/dashboard-widget.mjs +178 -0
- package/dist/client/views/dashboard/dashboard-widget.mjs.map +1 -0
- package/dist/client/views/dashboard/widget-card.mjs +159 -0
- package/dist/client/views/dashboard/widget-card.mjs.map +1 -0
- package/dist/client/views/globals/global-form-view.d.mts +74 -0
- package/dist/client/views/globals/global-form-view.d.mts.map +1 -0
- package/dist/client/views/globals/global-form-view.mjs +181 -0
- package/dist/client/views/globals/global-form-view.mjs.map +1 -0
- package/dist/client/views/index.d.mts +28 -0
- package/dist/client/views/layout/admin-layout-provider.d.mts +140 -0
- package/dist/client/views/layout/admin-layout-provider.d.mts.map +1 -0
- package/dist/client/views/layout/admin-layout-provider.mjs +90 -0
- package/dist/client/views/layout/admin-layout-provider.mjs.map +1 -0
- package/dist/client/views/layout/admin-layout.d.mts +151 -0
- package/dist/client/views/layout/admin-layout.d.mts.map +1 -0
- package/dist/client/views/layout/admin-layout.mjs +144 -0
- package/dist/client/views/layout/admin-layout.mjs.map +1 -0
- package/dist/client/views/layout/admin-root.d.mts +7 -0
- package/dist/client/views/layout/admin-router.d.mts +125 -0
- package/dist/client/views/layout/admin-router.d.mts.map +1 -0
- package/dist/client/views/layout/admin-router.mjs +594 -0
- package/dist/client/views/layout/admin-router.mjs.map +1 -0
- package/dist/client/views/layout/admin-sidebar.d.mts +105 -0
- package/dist/client/views/layout/admin-sidebar.d.mts.map +1 -0
- package/dist/client/views/layout/admin-sidebar.mjs +550 -0
- package/dist/client/views/layout/admin-sidebar.mjs.map +1 -0
- package/dist/client/views/layout/admin-topbar.mjs +128 -0
- package/dist/client/views/layout/admin-topbar.mjs.map +1 -0
- package/dist/client/views/layout/index.d.mts +5 -0
- package/dist/client/views/pages/accept-invite-page.d.mts +67 -0
- package/dist/client/views/pages/accept-invite-page.d.mts.map +1 -0
- package/dist/client/views/pages/accept-invite-page.mjs +143 -0
- package/dist/client/views/pages/accept-invite-page.mjs.map +1 -0
- package/dist/client/views/pages/dashboard-page.d.mts +52 -0
- package/dist/client/views/pages/dashboard-page.d.mts.map +1 -0
- package/dist/client/views/pages/dashboard-page.mjs +45 -0
- package/dist/client/views/pages/dashboard-page.mjs.map +1 -0
- package/dist/client/views/pages/forgot-password-page.d.mts +59 -0
- package/dist/client/views/pages/forgot-password-page.d.mts.map +1 -0
- package/dist/client/views/pages/forgot-password-page.mjs +80 -0
- package/dist/client/views/pages/forgot-password-page.mjs.map +1 -0
- package/dist/client/views/pages/index.d.mts +7 -0
- package/dist/client/views/pages/invite-page.d.mts +71 -0
- package/dist/client/views/pages/invite-page.d.mts.map +1 -0
- package/dist/client/views/pages/invite-page.mjs +86 -0
- package/dist/client/views/pages/invite-page.mjs.map +1 -0
- package/dist/client/views/pages/login-page.d.mts +76 -0
- package/dist/client/views/pages/login-page.d.mts.map +1 -0
- package/dist/client/views/pages/login-page.mjs +98 -0
- package/dist/client/views/pages/login-page.mjs.map +1 -0
- package/dist/client/views/pages/reset-password-page.d.mts +66 -0
- package/dist/client/views/pages/reset-password-page.d.mts.map +1 -0
- package/dist/client/views/pages/reset-password-page.mjs +105 -0
- package/dist/client/views/pages/reset-password-page.mjs.map +1 -0
- package/dist/client/views/pages/setup-page.d.mts +64 -0
- package/dist/client/views/pages/setup-page.d.mts.map +1 -0
- package/dist/client/views/pages/setup-page.mjs +91 -0
- package/dist/client/views/pages/setup-page.mjs.map +1 -0
- package/dist/client.d.mts +92 -3
- package/dist/client.d.mts.map +1 -0
- package/dist/client.mjs +54 -12
- package/dist/components/rich-text/index.d.mts +1 -0
- package/dist/components/rich-text/rich-text-renderer.d.mts +104 -0
- package/dist/components/rich-text/rich-text-renderer.d.mts.map +1 -0
- package/dist/components/rich-text/rich-text-renderer.mjs +210 -0
- package/dist/components/rich-text/rich-text-renderer.mjs.map +1 -0
- package/dist/index.d.mts +62 -3
- package/dist/index.mjs +54 -12
- package/dist/server/adapters/nextjs.d.mts +121 -0
- package/dist/server/adapters/nextjs.d.mts.map +1 -0
- package/dist/server/adapters/nextjs.mjs +111 -0
- package/dist/server/adapters/nextjs.mjs.map +1 -0
- package/dist/server/adapters/tanstack.d.mts +133 -0
- package/dist/server/adapters/tanstack.d.mts.map +1 -0
- package/dist/server/adapters/tanstack.mjs +90 -0
- package/dist/server/adapters/tanstack.mjs.map +1 -0
- package/dist/server/augmentation.d.mts +1523 -0
- package/dist/server/augmentation.d.mts.map +1 -0
- package/dist/server/auth-helpers.d.mts +143 -0
- package/dist/server/auth-helpers.d.mts.map +1 -0
- package/dist/server/auth-helpers.mjs +108 -0
- package/dist/server/auth-helpers.mjs.map +1 -0
- package/dist/server/block/block-builder.d.mts +319 -0
- package/dist/server/block/block-builder.d.mts.map +1 -0
- package/dist/server/block/block-builder.mjs +217 -0
- package/dist/server/block/block-builder.mjs.map +1 -0
- package/dist/server/block/index.d.mts +3 -0
- package/dist/server/block/introspection.d.mts +84 -0
- package/dist/server/block/introspection.d.mts.map +1 -0
- package/dist/server/block/introspection.mjs +89 -0
- package/dist/server/block/introspection.mjs.map +1 -0
- package/dist/server/block/prefetch.d.mts +78 -0
- package/dist/server/block/prefetch.d.mts.map +1 -0
- package/dist/server/block/prefetch.mjs +240 -0
- package/dist/server/block/prefetch.mjs.map +1 -0
- package/dist/server/fields/blocks.d.mts +139 -0
- package/dist/server/fields/blocks.d.mts.map +1 -0
- package/dist/server/fields/blocks.mjs +192 -0
- package/dist/server/fields/blocks.mjs.map +1 -0
- package/dist/server/fields/index.d.mts +48 -0
- package/dist/server/fields/index.d.mts.map +1 -0
- package/dist/server/fields/index.mjs +16 -0
- package/dist/server/fields/index.mjs.map +1 -0
- package/dist/server/fields/rich-text.d.mts +135 -0
- package/dist/server/fields/rich-text.d.mts.map +1 -0
- package/dist/server/fields/rich-text.mjs +188 -0
- package/dist/server/fields/rich-text.mjs.map +1 -0
- package/dist/server/i18n/index.d.mts +16 -0
- package/dist/server/i18n/index.d.mts.map +1 -0
- package/dist/server/i18n/index.mjs +44 -0
- package/dist/server/i18n/index.mjs.map +1 -0
- package/dist/server/i18n/messages/cs.mjs +461 -0
- package/dist/server/i18n/messages/cs.mjs.map +1 -0
- package/dist/server/i18n/messages/de.mjs +461 -0
- package/dist/server/i18n/messages/de.mjs.map +1 -0
- package/dist/server/i18n/messages/en.mjs +493 -0
- package/dist/server/i18n/messages/en.mjs.map +1 -0
- package/dist/server/i18n/messages/es.mjs +461 -0
- package/dist/server/i18n/messages/es.mjs.map +1 -0
- package/dist/server/i18n/messages/fr.mjs +461 -0
- package/dist/server/i18n/messages/fr.mjs.map +1 -0
- package/dist/server/i18n/messages/index.mjs +24 -0
- package/dist/server/i18n/messages/index.mjs.map +1 -0
- package/dist/server/i18n/messages/pl.mjs +461 -0
- package/dist/server/i18n/messages/pl.mjs.map +1 -0
- package/dist/server/i18n/messages/pt.mjs +464 -0
- package/dist/server/i18n/messages/pt.mjs.map +1 -0
- package/dist/server/i18n/messages/sk.mjs +490 -0
- package/dist/server/i18n/messages/sk.mjs.map +1 -0
- package/dist/server/index.d.mts +20 -0
- package/dist/server/modules/admin/functions/admin-config.mjs +348 -0
- package/dist/server/modules/admin/functions/admin-config.mjs.map +1 -0
- package/dist/server/modules/admin/functions/execute-action.d.mts +107 -0
- package/dist/server/modules/admin/functions/execute-action.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/execute-action.mjs +331 -0
- package/dist/server/modules/admin/functions/execute-action.mjs.map +1 -0
- package/dist/server/modules/admin/functions/locales.mjs +80 -0
- package/dist/server/modules/admin/functions/locales.mjs.map +1 -0
- package/dist/server/modules/admin/functions/preview.d.mts +70 -0
- package/dist/server/modules/admin/functions/preview.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/preview.mjs +243 -0
- package/dist/server/modules/admin/functions/preview.mjs.map +1 -0
- package/dist/server/modules/admin/functions/reactive.d.mts +99 -0
- package/dist/server/modules/admin/functions/reactive.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/reactive.mjs +378 -0
- package/dist/server/modules/admin/functions/reactive.mjs.map +1 -0
- package/dist/server/modules/admin/functions/setup.d.mts +84 -0
- package/dist/server/modules/admin/functions/setup.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/setup.mjs +131 -0
- package/dist/server/modules/admin/functions/setup.mjs.map +1 -0
- package/dist/server/modules/admin/functions/translations.mjs +125 -0
- package/dist/server/modules/admin/functions/translations.mjs.map +1 -0
- package/dist/server/modules/admin/functions/widget-data.d.mts +33 -0
- package/dist/server/modules/admin/functions/widget-data.d.mts.map +1 -0
- package/dist/server/modules/admin/functions/widget-data.mjs +70 -0
- package/dist/server/modules/admin/functions/widget-data.mjs.map +1 -0
- package/dist/server/modules/admin/index.d.mts +16879 -0
- package/dist/server/modules/admin/index.d.mts.map +1 -0
- package/dist/server/modules/admin/index.mjs +249 -0
- package/dist/server/modules/admin/index.mjs.map +1 -0
- package/dist/server/modules/admin-preferences/collections/admin-preferences.collection.d.mts +3 -0
- package/dist/server/modules/admin-preferences/collections/admin-preferences.collection.mjs +48 -0
- package/dist/server/modules/admin-preferences/collections/admin-preferences.collection.mjs.map +1 -0
- package/dist/server/modules/admin-preferences/collections/locks.collection.d.mts +3 -0
- package/dist/server/modules/admin-preferences/collections/locks.collection.mjs +79 -0
- package/dist/server/modules/admin-preferences/collections/locks.collection.mjs.map +1 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.collection.d.mts +1490 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.collection.d.mts.map +1 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.collection.mjs +57 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.collection.mjs.map +1 -0
- package/dist/server/patch.d.mts +100 -0
- package/dist/server/patch.d.mts.map +1 -0
- package/dist/server/patch.mjs +1062 -0
- package/dist/server/patch.mjs.map +1 -0
- package/dist/server.d.mts +21 -250
- package/dist/server.mjs +19 -832
- package/dist/shared/preview-utils.d.mts +54 -0
- package/dist/shared/preview-utils.d.mts.map +1 -0
- package/dist/{preview-utils-BKQ9-TMa.mjs → shared/preview-utils.mjs} +2 -2
- package/dist/shared/preview-utils.mjs.map +1 -0
- package/dist/{saved-views.types-BMsz5mCy.d.mts → shared/types/saved-views.types.d.mts} +7 -2
- package/dist/shared/types/saved-views.types.d.mts.map +1 -0
- package/dist/shared.d.mts +3 -57
- package/dist/shared.mjs +1 -1
- package/package.json +12 -17
- package/dist/auth-layout-M8K8_q5R.mjs +0 -181
- package/dist/auth-layout-M8K8_q5R.mjs.map +0 -1
- package/dist/bulk-upload-dialog-D7w7W1Hl.mjs +0 -273
- package/dist/bulk-upload-dialog-D7w7W1Hl.mjs.map +0 -1
- package/dist/client-D1DqawtP.d.mts +0 -13403
- package/dist/client-D1DqawtP.d.mts.map +0 -1
- package/dist/client-njX1rZmi.mjs +0 -22612
- package/dist/client-njX1rZmi.mjs.map +0 -1
- package/dist/content-locales-provider-BXvuIgfg.mjs +0 -1650
- package/dist/content-locales-provider-BXvuIgfg.mjs.map +0 -1
- package/dist/dashboard-page-B4PGEdc2.mjs +0 -2500
- package/dist/dashboard-page-B4PGEdc2.mjs.map +0 -1
- package/dist/dashboard-page-mCY0pgZv.mjs +0 -3
- package/dist/dropzone-Do3awXKd.mjs +0 -634
- package/dist/dropzone-Do3awXKd.mjs.map +0 -1
- package/dist/forgot-password-page-Bcp-An4Y.mjs.map +0 -1
- package/dist/forgot-password-page-CEwsdLwn.mjs +0 -3
- package/dist/index-B4H3amCD.d.mts +0 -2753
- package/dist/index-B4H3amCD.d.mts.map +0 -1
- package/dist/login-page-BUnpCbCa.mjs +0 -3
- package/dist/login-page-CP4gA-dl.mjs +0 -298
- package/dist/login-page-CP4gA-dl.mjs.map +0 -1
- package/dist/preview-utils-BKQ9-TMa.mjs.map +0 -1
- package/dist/reset-password-page-BqfDmLxA.mjs +0 -281
- package/dist/reset-password-page-BqfDmLxA.mjs.map +0 -1
- package/dist/reset-password-page-CufHz3h3.mjs +0 -3
- package/dist/runtime-6VZM878K.mjs.map +0 -1
- package/dist/saved-views.types-BMsz5mCy.d.mts.map +0 -1
- package/dist/server.d.mts.map +0 -1
- package/dist/server.mjs.map +0 -1
- package/dist/setup-page-BNNzt_Z6.mjs +0 -3
- package/dist/setup-page-YAP_fzqh.mjs.map +0 -1
- package/dist/shared.d.mts.map +0 -1
- package/dist/use-auth-BoLmWtmU.mjs.map +0 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Button } from "../../../ui/button.mjs";
|
|
2
|
+
import { Skeleton } from "../../../ui/skeleton.mjs";
|
|
3
|
+
import { formatColumnHeader, resolveCellForColumn } from "./types.mjs";
|
|
4
|
+
import { CollectionEditLink } from "../../../admin-link.mjs";
|
|
5
|
+
import { Icon } from "@iconify/react";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/client/components/fields/relation/displays/table-display.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Table Display - table with columns
|
|
12
|
+
*
|
|
13
|
+
* Uses the same cell components as TableView for consistent rendering.
|
|
14
|
+
*/
|
|
15
|
+
function TableSkeleton({ count = 3, columns = ["_title"], hasActions = false }) {
|
|
16
|
+
const skeletonKeys = React$1.useMemo(() => Array.from({ length: count }, () => crypto.randomUUID()), [count]);
|
|
17
|
+
return /* @__PURE__ */ jsx("div", {
|
|
18
|
+
className: "rounded-md border",
|
|
19
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
20
|
+
className: "w-full text-sm",
|
|
21
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", {
|
|
22
|
+
className: "border-b border-border/40 bg-card/10 backdrop-blur-sm",
|
|
23
|
+
children: [columns.map((col) => /* @__PURE__ */ jsx("th", {
|
|
24
|
+
className: "px-3 py-2 text-left font-medium",
|
|
25
|
+
children: formatColumnHeader(col)
|
|
26
|
+
}, col)), hasActions && /* @__PURE__ */ jsx("th", { className: "px-3 py-2 w-20" })]
|
|
27
|
+
}) }), /* @__PURE__ */ jsx("tbody", { children: skeletonKeys.map((key) => /* @__PURE__ */ jsxs("tr", {
|
|
28
|
+
className: "border-b last:border-0",
|
|
29
|
+
children: [columns.map((col) => /* @__PURE__ */ jsx("td", {
|
|
30
|
+
className: "px-3 py-2",
|
|
31
|
+
children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24 rounded" })
|
|
32
|
+
}, col)), hasActions && /* @__PURE__ */ jsx("td", {
|
|
33
|
+
className: "px-3 py-2",
|
|
34
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: "flex items-center justify-end gap-1",
|
|
36
|
+
children: /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-7 rounded" })
|
|
37
|
+
})
|
|
38
|
+
})]
|
|
39
|
+
}, key)) })]
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Cell renderer that uses resolved cell components from field registry
|
|
45
|
+
*/
|
|
46
|
+
function CellRenderer({ item, column, collectionConfig }) {
|
|
47
|
+
const resolved = React$1.useMemo(() => resolveCellForColumn(column, collectionConfig), [column, collectionConfig]);
|
|
48
|
+
const value = item[resolved.accessorKey];
|
|
49
|
+
const { component: CellComponent, fieldDef, needsFieldDef } = resolved;
|
|
50
|
+
if (needsFieldDef) return /* @__PURE__ */ jsx(CellComponent, {
|
|
51
|
+
value,
|
|
52
|
+
row: item,
|
|
53
|
+
fieldDef
|
|
54
|
+
});
|
|
55
|
+
return /* @__PURE__ */ jsx(CellComponent, {
|
|
56
|
+
value,
|
|
57
|
+
row: item
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function TableDisplay({ items, collection, actions, editable = false, columns = ["_title"], linkToDetail = false, collectionConfig, isLoading = false, loadingCount = 3 }) {
|
|
61
|
+
const hasActions = editable || linkToDetail || !!actions?.onEdit;
|
|
62
|
+
if (isLoading && items.length === 0) return /* @__PURE__ */ jsx(TableSkeleton, {
|
|
63
|
+
count: loadingCount,
|
|
64
|
+
columns,
|
|
65
|
+
hasActions
|
|
66
|
+
});
|
|
67
|
+
return /* @__PURE__ */ jsx("div", {
|
|
68
|
+
className: "rounded-md border",
|
|
69
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
70
|
+
className: "w-full text-sm",
|
|
71
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", {
|
|
72
|
+
className: "border-b border-border/40 bg-card/10 backdrop-blur-sm",
|
|
73
|
+
children: [columns.map((col) => /* @__PURE__ */ jsx("th", {
|
|
74
|
+
className: "px-3 py-2 text-left font-medium",
|
|
75
|
+
children: formatColumnHeader(col)
|
|
76
|
+
}, col)), hasActions && /* @__PURE__ */ jsx("th", { className: "px-3 py-2 w-20" })]
|
|
77
|
+
}) }), /* @__PURE__ */ jsx("tbody", { children: items.map((item) => /* @__PURE__ */ jsxs("tr", {
|
|
78
|
+
className: "border-b last:border-0",
|
|
79
|
+
children: [columns.map((col) => /* @__PURE__ */ jsx("td", {
|
|
80
|
+
className: "px-3 py-2",
|
|
81
|
+
children: /* @__PURE__ */ jsx(CellRenderer, {
|
|
82
|
+
item,
|
|
83
|
+
column: col,
|
|
84
|
+
collectionConfig
|
|
85
|
+
})
|
|
86
|
+
}, col)), hasActions && /* @__PURE__ */ jsx("td", {
|
|
87
|
+
className: "px-3 py-2",
|
|
88
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
89
|
+
className: "flex items-center justify-end gap-1",
|
|
90
|
+
children: [
|
|
91
|
+
actions?.onEdit && /* @__PURE__ */ jsx(Button, {
|
|
92
|
+
type: "button",
|
|
93
|
+
variant: "ghost",
|
|
94
|
+
size: "icon",
|
|
95
|
+
className: "h-7 w-7",
|
|
96
|
+
onClick: () => actions.onEdit?.(item),
|
|
97
|
+
"aria-label": "Edit item",
|
|
98
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
99
|
+
icon: "ph:pencil",
|
|
100
|
+
className: "size-4"
|
|
101
|
+
})
|
|
102
|
+
}),
|
|
103
|
+
editable && actions?.onRemove && /* @__PURE__ */ jsx(Button, {
|
|
104
|
+
type: "button",
|
|
105
|
+
variant: "ghost",
|
|
106
|
+
size: "icon",
|
|
107
|
+
className: "h-7 w-7",
|
|
108
|
+
onClick: () => actions.onRemove?.(item),
|
|
109
|
+
"aria-label": "Remove item",
|
|
110
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
111
|
+
icon: "ph:x",
|
|
112
|
+
className: "size-4"
|
|
113
|
+
})
|
|
114
|
+
}),
|
|
115
|
+
!editable && linkToDetail && !actions?.onEdit && /* @__PURE__ */ jsx(CollectionEditLink, {
|
|
116
|
+
collection,
|
|
117
|
+
id: item.id,
|
|
118
|
+
className: "text-primary hover:underline",
|
|
119
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
120
|
+
icon: "ph:arrow-right",
|
|
121
|
+
className: "size-4"
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
})
|
|
126
|
+
})]
|
|
127
|
+
}, item.id)) })]
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
//#endregion
|
|
133
|
+
export { TableDisplay };
|
|
134
|
+
//# sourceMappingURL=table-display.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-display.mjs","names":["React"],"sources":["../../../../../../src/client/components/fields/relation/displays/table-display.tsx"],"sourcesContent":["/**\n * Table Display - table with columns\n *\n * Uses the same cell components as TableView for consistent rendering.\n */\n\nimport { Icon } from \"@iconify/react\";\nimport * as React from \"react\";\nimport { CollectionEditLink } from \"../../../admin-link\";\nimport { Button } from \"../../../ui/button\";\nimport { Skeleton } from \"../../../ui/skeleton\";\nimport {\n\tformatColumnHeader,\n\ttype RelationDisplayProps,\n\tresolveCellForColumn,\n} from \"./types\";\n\nfunction TableSkeleton({\n\tcount = 3,\n\tcolumns = [\"_title\"],\n\thasActions = false,\n}: {\n\tcount?: number;\n\tcolumns?: string[];\n\thasActions?: boolean;\n}) {\n\tconst skeletonKeys = React.useMemo(\n\t\t() => Array.from({ length: count }, () => crypto.randomUUID()),\n\t\t[count],\n\t);\n\n\treturn (\n\t\t<div className=\"rounded-md border\">\n\t\t\t<table className=\"w-full text-sm\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr className=\"border-b border-border/40 bg-card/10 backdrop-blur-sm\">\n\t\t\t\t\t\t{columns.map((col) => (\n\t\t\t\t\t\t\t<th key={col} className=\"px-3 py-2 text-left font-medium\">\n\t\t\t\t\t\t\t\t{formatColumnHeader(col)}\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t))}\n\t\t\t\t\t\t{hasActions && <th className=\"px-3 py-2 w-20\" />}\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\t\t\t\t\t{skeletonKeys.map((key) => (\n\t\t\t\t\t\t<tr key={key} className=\"border-b last:border-0\">\n\t\t\t\t\t\t\t{columns.map((col) => (\n\t\t\t\t\t\t\t\t<td key={col} className=\"px-3 py-2\">\n\t\t\t\t\t\t\t\t\t<Skeleton className=\"h-4 w-24 rounded\" />\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t{hasActions && (\n\t\t\t\t\t\t\t\t<td className=\"px-3 py-2\">\n\t\t\t\t\t\t\t\t\t<div className=\"flex items-center justify-end gap-1\">\n\t\t\t\t\t\t\t\t\t\t<Skeleton className=\"h-7 w-7 rounded\" />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t))}\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>\n\t);\n}\n\n/**\n * Cell renderer that uses resolved cell components from field registry\n */\nfunction CellRenderer({\n\titem,\n\tcolumn,\n\tcollectionConfig,\n}: {\n\titem: any;\n\tcolumn: string;\n\tcollectionConfig?: RelationDisplayProps[\"collectionConfig\"];\n}) {\n\tconst resolved = React.useMemo(\n\t\t() => resolveCellForColumn(column, collectionConfig),\n\t\t[column, collectionConfig],\n\t);\n\n\tconst value = item[resolved.accessorKey];\n\tconst { component: CellComponent, fieldDef, needsFieldDef } = resolved;\n\n\tif (needsFieldDef) {\n\t\treturn <CellComponent value={value} row={item} fieldDef={fieldDef} />;\n\t}\n\n\treturn <CellComponent value={value} row={item} />;\n}\n\nexport function TableDisplay({\n\titems,\n\tcollection,\n\tactions,\n\teditable = false,\n\tcolumns = [\"_title\"],\n\tlinkToDetail = false,\n\tcollectionConfig,\n\tisLoading = false,\n\tloadingCount = 3,\n}: RelationDisplayProps) {\n\tconst hasActions = editable || linkToDetail || !!actions?.onEdit;\n\n\t// Show skeleton when loading and no items\n\tif (isLoading && items.length === 0) {\n\t\treturn (\n\t\t\t<TableSkeleton\n\t\t\t\tcount={loadingCount}\n\t\t\t\tcolumns={columns}\n\t\t\t\thasActions={hasActions}\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className=\"rounded-md border\">\n\t\t\t<table className=\"w-full text-sm\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr className=\"border-b border-border/40 bg-card/10 backdrop-blur-sm\">\n\t\t\t\t\t\t{columns.map((col) => (\n\t\t\t\t\t\t\t<th key={col} className=\"px-3 py-2 text-left font-medium\">\n\t\t\t\t\t\t\t\t{formatColumnHeader(col)}\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t))}\n\t\t\t\t\t\t{hasActions && <th className=\"px-3 py-2 w-20\" />}\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\t\t\t\t\t{items.map((item) => (\n\t\t\t\t\t\t<tr key={item.id} className=\"border-b last:border-0\">\n\t\t\t\t\t\t\t{columns.map((col) => (\n\t\t\t\t\t\t\t\t<td key={col} className=\"px-3 py-2\">\n\t\t\t\t\t\t\t\t\t<CellRenderer\n\t\t\t\t\t\t\t\t\t\titem={item}\n\t\t\t\t\t\t\t\t\t\tcolumn={col}\n\t\t\t\t\t\t\t\t\t\tcollectionConfig={collectionConfig}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t{hasActions && (\n\t\t\t\t\t\t\t\t<td className=\"px-3 py-2\">\n\t\t\t\t\t\t\t\t\t<div className=\"flex items-center justify-end gap-1\">\n\t\t\t\t\t\t\t\t\t\t{/* Edit button */}\n\t\t\t\t\t\t\t\t\t\t{actions?.onEdit && (\n\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"h-7 w-7\"\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => actions.onEdit?.(item)}\n\t\t\t\t\t\t\t\t\t\t\t\taria-label=\"Edit item\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon=\"ph:pencil\" className=\"size-4\" />\n\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t\t\t\t{/* Remove button (editable mode) */}\n\t\t\t\t\t\t\t\t\t\t{editable && actions?.onRemove && (\n\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"h-7 w-7\"\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => actions.onRemove?.(item)}\n\t\t\t\t\t\t\t\t\t\t\t\taria-label=\"Remove item\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon=\"ph:x\" className=\"size-4\" />\n\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t\t\t\t{/* Link to detail (non-editable mode) */}\n\t\t\t\t\t\t\t\t\t\t{!editable && linkToDetail && !actions?.onEdit && (\n\t\t\t\t\t\t\t\t\t\t\t<CollectionEditLink\n\t\t\t\t\t\t\t\t\t\t\t\tcollection={collection as any}\n\t\t\t\t\t\t\t\t\t\t\t\tid={item.id}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"text-primary hover:underline\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<Icon icon=\"ph:arrow-right\" className=\"size-4\" />\n\t\t\t\t\t\t\t\t\t\t\t</CollectionEditLink>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t))}\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAS,cAAc,EACtB,QAAQ,GACR,UAAU,CAAC,SAAS,EACpB,aAAa,SAKX;CACF,MAAM,eAAeA,QAAM,cACpB,MAAM,KAAK,EAAE,QAAQ,OAAO,QAAQ,OAAO,YAAY,CAAC,EAC9D,CAAC,MAAM,CACP;AAED,QACC,oBAAC;EAAI,WAAU;YACd,qBAAC;GAAM,WAAU;cAChB,oBAAC,qBACA,qBAAC;IAAG,WAAU;eACZ,QAAQ,KAAK,QACb,oBAAC;KAAa,WAAU;eACtB,mBAAmB,IAAI;OADhB,IAEJ,CACJ,EACD,cAAc,oBAAC,QAAG,WAAU,mBAAmB;KAC5C,GACE,EACR,oBAAC,qBACC,aAAa,KAAK,QAClB,qBAAC;IAAa,WAAU;eACtB,QAAQ,KAAK,QACb,oBAAC;KAAa,WAAU;eACvB,oBAAC,YAAS,WAAU,qBAAqB;OADjC,IAEJ,CACJ,EACD,cACA,oBAAC;KAAG,WAAU;eACb,oBAAC;MAAI,WAAU;gBACd,oBAAC,YAAS,WAAU,oBAAoB;OACnC;MACF;MAXE,IAaJ,CACJ,GACK;IACD;GACH;;;;;AAOR,SAAS,aAAa,EACrB,MACA,QACA,oBAKE;CACF,MAAM,WAAWA,QAAM,cAChB,qBAAqB,QAAQ,iBAAiB,EACpD,CAAC,QAAQ,iBAAiB,CAC1B;CAED,MAAM,QAAQ,KAAK,SAAS;CAC5B,MAAM,EAAE,WAAW,eAAe,UAAU,kBAAkB;AAE9D,KAAI,cACH,QAAO,oBAAC;EAAqB;EAAO,KAAK;EAAgB;GAAY;AAGtE,QAAO,oBAAC;EAAqB;EAAO,KAAK;GAAQ;;AAGlD,SAAgB,aAAa,EAC5B,OACA,YACA,SACA,WAAW,OACX,UAAU,CAAC,SAAS,EACpB,eAAe,OACf,kBACA,YAAY,OACZ,eAAe,KACS;CACxB,MAAM,aAAa,YAAY,gBAAgB,CAAC,CAAC,SAAS;AAG1D,KAAI,aAAa,MAAM,WAAW,EACjC,QACC,oBAAC;EACA,OAAO;EACE;EACG;GACX;AAIJ,QACC,oBAAC;EAAI,WAAU;YACd,qBAAC;GAAM,WAAU;cAChB,oBAAC,qBACA,qBAAC;IAAG,WAAU;eACZ,QAAQ,KAAK,QACb,oBAAC;KAAa,WAAU;eACtB,mBAAmB,IAAI;OADhB,IAEJ,CACJ,EACD,cAAc,oBAAC,QAAG,WAAU,mBAAmB;KAC5C,GACE,EACR,oBAAC,qBACC,MAAM,KAAK,SACX,qBAAC;IAAiB,WAAU;eAC1B,QAAQ,KAAK,QACb,oBAAC;KAAa,WAAU;eACvB,oBAAC;MACM;MACN,QAAQ;MACU;OACjB;OALM,IAMJ,CACJ,EACD,cACA,oBAAC;KAAG,WAAU;eACb,qBAAC;MAAI,WAAU;;OAEb,SAAS,UACT,oBAAC;QACA,MAAK;QACL,SAAQ;QACR,MAAK;QACL,WAAU;QACV,eAAe,QAAQ,SAAS,KAAK;QACrC,cAAW;kBAEX,oBAAC;SAAK,MAAK;SAAY,WAAU;UAAW;SACpC;OAIT,YAAY,SAAS,YACrB,oBAAC;QACA,MAAK;QACL,SAAQ;QACR,MAAK;QACL,WAAU;QACV,eAAe,QAAQ,WAAW,KAAK;QACvC,cAAW;kBAEX,oBAAC;SAAK,MAAK;SAAO,WAAU;UAAW;SAC/B;OAIT,CAAC,YAAY,gBAAgB,CAAC,SAAS,UACvC,oBAAC;QACY;QACZ,IAAI,KAAK;QACT,WAAU;kBAEV,oBAAC;SAAK,MAAK;SAAiB,WAAU;UAAW;SAC7B;;OAEjB;MACF;MApDE,KAAK,GAsDT,CACJ,GACK;IACD;GACH"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "../../../../../server/index.mjs";
|
|
2
|
+
import "../../../../builder/field/field.mjs";
|
|
3
|
+
import "react";
|
|
4
|
+
|
|
5
|
+
//#region src/client/components/fields/relation/displays/types.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Display mode for relation items
|
|
9
|
+
*/
|
|
10
|
+
type RelationDisplayMode = "chips" | "list" | "table" | "cards" | "grid";
|
|
11
|
+
/**
|
|
12
|
+
* Field mapping for cards/grid display
|
|
13
|
+
*/
|
|
14
|
+
interface RelationDisplayFields {
|
|
15
|
+
title?: string;
|
|
16
|
+
subtitle?: string;
|
|
17
|
+
image?: string;
|
|
18
|
+
meta?: string[];
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { RelationDisplayFields, RelationDisplayMode };
|
|
22
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../src/client/components/fields/relation/displays/types.ts"],"sourcesContent":[],"mappings":";;;;;;;;;KAqBY,mBAAA;;;;UAcK,qBAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { formatLabel } from "../../../../lib/utils.mjs";
|
|
2
|
+
import { DefaultCell } from "../../../../views/collection/cells/primitive-cells.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/client/components/fields/relation/displays/types.ts
|
|
5
|
+
/**
|
|
6
|
+
* Get display value from item (_title fallback chain)
|
|
7
|
+
*/
|
|
8
|
+
function getItemDisplayValue(item) {
|
|
9
|
+
return item?._title || item?.name || item?.title || item?.id || "";
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Format column header (camelCase to Title Case)
|
|
13
|
+
*/
|
|
14
|
+
function formatColumnHeader(column) {
|
|
15
|
+
if (column === "_title") return "Name";
|
|
16
|
+
return formatLabel(column);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Format cell value for display
|
|
20
|
+
*/
|
|
21
|
+
function formatCellValue(value) {
|
|
22
|
+
if (value === null || value === void 0) return "-";
|
|
23
|
+
if (typeof value === "boolean") return value ? "Yes" : "No";
|
|
24
|
+
if (value instanceof Date) return value.toLocaleDateString();
|
|
25
|
+
if (typeof value === "object") return JSON.stringify(value);
|
|
26
|
+
return String(value);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get image URL from item field
|
|
30
|
+
*/
|
|
31
|
+
function getImageUrl(item, imageField) {
|
|
32
|
+
if (!imageField) return null;
|
|
33
|
+
const imageValue = item[imageField];
|
|
34
|
+
if (typeof imageValue === "string") return imageValue;
|
|
35
|
+
if (imageValue?.url) return imageValue.url;
|
|
36
|
+
if (imageValue?.key) return imageValue.key;
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Field types that need fieldDef passed to their cell component
|
|
41
|
+
*/
|
|
42
|
+
const FIELD_TYPES_NEEDING_FIELD_DEF = new Set([
|
|
43
|
+
"object",
|
|
44
|
+
"array",
|
|
45
|
+
"relation",
|
|
46
|
+
"reverseRelation"
|
|
47
|
+
]);
|
|
48
|
+
/**
|
|
49
|
+
* Resolve cell component for a column based on field config
|
|
50
|
+
* Uses the same priority as buildColumns:
|
|
51
|
+
* 1. Cell from field registry (fieldDef.cell.component)
|
|
52
|
+
* 2. DefaultCell fallback
|
|
53
|
+
*/
|
|
54
|
+
function resolveCellForColumn(column, collectionConfig) {
|
|
55
|
+
const fieldDef = collectionConfig?.fields?.[column];
|
|
56
|
+
const fieldType = fieldDef?.name ?? "text";
|
|
57
|
+
const fieldOptions = fieldDef?.["~options"] ?? {};
|
|
58
|
+
let component;
|
|
59
|
+
if (fieldDef?.cell?.component) component = fieldDef.cell.component;
|
|
60
|
+
else component = DefaultCell;
|
|
61
|
+
const needsFieldDef = FIELD_TYPES_NEEDING_FIELD_DEF.has(fieldType);
|
|
62
|
+
const accessorKey = fieldType === "relation" && fieldOptions.relationName ? fieldOptions.relationName : column;
|
|
63
|
+
return {
|
|
64
|
+
component,
|
|
65
|
+
fieldDef,
|
|
66
|
+
needsFieldDef,
|
|
67
|
+
accessorKey
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { formatCellValue, formatColumnHeader, getImageUrl, getItemDisplayValue, resolveCellForColumn };
|
|
73
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","names":["component: React.ComponentType<{\n\t\tvalue: unknown;\n\t\trow?: unknown;\n\t\tfieldDef?: FieldDefinition;\n\t}>","accessorKey: string"],"sources":["../../../../../../src/client/components/fields/relation/displays/types.ts"],"sourcesContent":["/**\n * Shared types for relation display components\n */\n\nimport type * as React from \"react\";\nimport type { ComponentReference } from \"#questpie/admin/server\";\nimport type { FieldDefinition } from \"../../../../builder/field/field\";\nimport { formatLabel } from \"../../../../lib/utils\";\nimport { DefaultCell } from \"../../../../views/collection/cells\";\n\n/**\n * Icon type that can be a React component or a server-defined ComponentReference\n */\nexport type IconType =\n\t| React.ComponentType<{ className?: string }>\n\t| ComponentReference\n\t| undefined;\n\n/**\n * Display mode for relation items\n */\nexport type RelationDisplayMode = \"chips\" | \"list\" | \"table\" | \"cards\" | \"grid\";\n\n/**\n * Action handlers for relation items\n */\nexport interface RelationItemActions {\n\tonEdit?: (item: any) => void;\n\tonRemove?: (item: any) => void;\n\tonNavigate?: (item: any) => void;\n}\n\n/**\n * Field mapping for cards/grid display\n */\nexport interface RelationDisplayFields {\n\ttitle?: string;\n\tsubtitle?: string;\n\timage?: string;\n\tmeta?: string[];\n}\n\n/**\n * Collection field definitions for cell rendering\n */\nexport interface CollectionFieldsConfig {\n\tfields?: Record<string, FieldDefinition>;\n}\n\n/**\n * Common props for all display components\n */\nexport interface RelationDisplayProps {\n\t/**\n\t * Items to display\n\t */\n\titems: any[];\n\n\t/**\n\t * Collection name for navigation links\n\t */\n\tcollection: string;\n\n\t/**\n\t * Collection icon (React component or server ComponentReference)\n\t */\n\tcollectionIcon?: IconType;\n\n\t/**\n\t * Action handlers\n\t */\n\tactions?: RelationItemActions;\n\n\t/**\n\t * Whether items are editable (shows edit/remove buttons)\n\t */\n\teditable?: boolean;\n\n\t/**\n\t * Whether items are orderable (shows drag handle)\n\t */\n\torderable?: boolean;\n\n\t/**\n\t * Columns to show in table display\n\t */\n\tcolumns?: string[];\n\n\t/**\n\t * Field mapping for cards/grid display\n\t */\n\tfields?: RelationDisplayFields;\n\n\t/**\n\t * Number of columns for grid/cards layout\n\t */\n\tgridColumns?: 1 | 2 | 3 | 4;\n\n\t/**\n\t * Whether to show navigation link to detail page\n\t */\n\tlinkToDetail?: boolean;\n\n\t/**\n\t * Custom render function for items\n\t */\n\trenderItem?: (item: any, index: number) => React.ReactNode;\n\n\t/**\n\t * Collection config for cell rendering (enables proper cell components)\n\t */\n\tcollectionConfig?: CollectionFieldsConfig;\n\n\t/**\n\t * Whether items are being loaded\n\t */\n\tisLoading?: boolean;\n\n\t/**\n\t * Number of skeleton items to show when loading\n\t */\n\tloadingCount?: number;\n}\n\n/**\n * Get display value from item (_title fallback chain)\n */\nexport function getItemDisplayValue(item: any): string {\n\treturn item?._title || item?.name || item?.title || item?.id || \"\";\n}\n\n/**\n * Format column header (camelCase to Title Case)\n */\nexport function formatColumnHeader(column: string): string {\n\tif (column === \"_title\") return \"Name\";\n\treturn formatLabel(column);\n}\n\n/**\n * Format cell value for display\n */\nexport function formatCellValue(value: unknown): string {\n\tif (value === null || value === undefined) return \"-\";\n\tif (typeof value === \"boolean\") return value ? \"Yes\" : \"No\";\n\tif (value instanceof Date) return value.toLocaleDateString();\n\tif (typeof value === \"object\") return JSON.stringify(value);\n\treturn String(value);\n}\n\n/**\n * Get image URL from item field\n */\nexport function getImageUrl(item: any, imageField?: string): string | null {\n\tif (!imageField) return null;\n\tconst imageValue = item[imageField];\n\tif (typeof imageValue === \"string\") return imageValue;\n\tif (imageValue?.url) return imageValue.url;\n\tif (imageValue?.key) return imageValue.key;\n\treturn null;\n}\n\n/**\n * Field types that need fieldDef passed to their cell component\n */\nconst FIELD_TYPES_NEEDING_FIELD_DEF = new Set([\n\t\"object\",\n\t\"array\",\n\t\"relation\",\n\t\"reverseRelation\",\n]);\n\n/**\n * Resolved cell info for rendering\n */\nexport interface ResolvedCell {\n\tcomponent: React.ComponentType<{\n\t\tvalue: unknown;\n\t\trow?: unknown;\n\t\tfieldDef?: FieldDefinition;\n\t}>;\n\tfieldDef?: FieldDefinition;\n\tneedsFieldDef: boolean;\n\taccessorKey: string;\n}\n\n/**\n * Resolve cell component for a column based on field config\n * Uses the same priority as buildColumns:\n * 1. Cell from field registry (fieldDef.cell.component)\n * 2. DefaultCell fallback\n */\nexport function resolveCellForColumn(\n\tcolumn: string,\n\tcollectionConfig?: CollectionFieldsConfig,\n): ResolvedCell {\n\tconst fieldDef = collectionConfig?.fields?.[column];\n\tconst fieldType = fieldDef?.name ?? \"text\";\n\tconst fieldOptions = (fieldDef as any)?.[\"~options\"] ?? {};\n\n\t// Resolve cell component\n\tlet component: React.ComponentType<{\n\t\tvalue: unknown;\n\t\trow?: unknown;\n\t\tfieldDef?: FieldDefinition;\n\t}>;\n\n\tif (fieldDef?.cell?.component) {\n\t\t// Cell from field registry\n\t\tcomponent = fieldDef.cell.component as React.ComponentType<{\n\t\t\tvalue: unknown;\n\t\t\trow?: unknown;\n\t\t\tfieldDef?: FieldDefinition;\n\t\t}>;\n\t} else {\n\t\t// DefaultCell fallback\n\t\tcomponent = DefaultCell;\n\t}\n\n\tconst needsFieldDef = FIELD_TYPES_NEEDING_FIELD_DEF.has(fieldType);\n\n\t// For relation fields, use relationName as accessor if specified\n\tconst accessorKey: string =\n\t\tfieldType === \"relation\" && fieldOptions.relationName\n\t\t\t? fieldOptions.relationName\n\t\t\t: column;\n\n\treturn {\n\t\tcomponent,\n\t\tfieldDef,\n\t\tneedsFieldDef,\n\t\taccessorKey,\n\t};\n}\n"],"mappings":";;;;;;;AA+HA,SAAgB,oBAAoB,MAAmB;AACtD,QAAO,MAAM,UAAU,MAAM,QAAQ,MAAM,SAAS,MAAM,MAAM;;;;;AAMjE,SAAgB,mBAAmB,QAAwB;AAC1D,KAAI,WAAW,SAAU,QAAO;AAChC,QAAO,YAAY,OAAO;;;;;AAM3B,SAAgB,gBAAgB,OAAwB;AACvD,KAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;AAClD,KAAI,OAAO,UAAU,UAAW,QAAO,QAAQ,QAAQ;AACvD,KAAI,iBAAiB,KAAM,QAAO,MAAM,oBAAoB;AAC5D,KAAI,OAAO,UAAU,SAAU,QAAO,KAAK,UAAU,MAAM;AAC3D,QAAO,OAAO,MAAM;;;;;AAMrB,SAAgB,YAAY,MAAW,YAAoC;AAC1E,KAAI,CAAC,WAAY,QAAO;CACxB,MAAM,aAAa,KAAK;AACxB,KAAI,OAAO,eAAe,SAAU,QAAO;AAC3C,KAAI,YAAY,IAAK,QAAO,WAAW;AACvC,KAAI,YAAY,IAAK,QAAO,WAAW;AACvC,QAAO;;;;;AAMR,MAAM,gCAAgC,IAAI,IAAI;CAC7C;CACA;CACA;CACA;CACA,CAAC;;;;;;;AAsBF,SAAgB,qBACf,QACA,kBACe;CACf,MAAM,WAAW,kBAAkB,SAAS;CAC5C,MAAM,YAAY,UAAU,QAAQ;CACpC,MAAM,eAAgB,WAAmB,eAAe,EAAE;CAG1D,IAAIA;AAMJ,KAAI,UAAU,MAAM,UAEnB,aAAY,SAAS,KAAK;KAO1B,aAAY;CAGb,MAAM,gBAAgB,8BAA8B,IAAI,UAAU;CAGlE,MAAMC,cACL,cAAc,cAAc,aAAa,eACtC,aAAa,eACb;AAEJ,QAAO;EACN;EACA;EACA;EACA;EACA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useResolveText } from "../../../i18n/hooks.mjs";
|
|
2
|
+
import { ChipsDisplay } from "./displays/chips-display.mjs";
|
|
3
|
+
import { ListDisplay } from "./displays/list-display.mjs";
|
|
4
|
+
import { TableDisplay } from "./displays/table-display.mjs";
|
|
5
|
+
import { CardsDisplay } from "./displays/cards-display.mjs";
|
|
6
|
+
import { GridDisplay } from "./displays/grid-display.mjs";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/client/components/fields/relation/relation-items-display.tsx
|
|
10
|
+
function RelationItemsDisplay({ display = "list", items, collection, collectionIcon, actions, editable = false, orderable = false, columns, fields, gridColumns, linkToDetail = false, renderItem, emptyMessage = "No items", collectionConfig, isLoading = false, loadingCount }) {
|
|
11
|
+
const resolvedEmptyMessage = useResolveText()(emptyMessage ?? "No items");
|
|
12
|
+
const displayProps = {
|
|
13
|
+
items,
|
|
14
|
+
collection,
|
|
15
|
+
collectionIcon,
|
|
16
|
+
actions,
|
|
17
|
+
editable,
|
|
18
|
+
orderable,
|
|
19
|
+
columns: columns || ["_title"],
|
|
20
|
+
fields,
|
|
21
|
+
gridColumns,
|
|
22
|
+
linkToDetail,
|
|
23
|
+
renderItem,
|
|
24
|
+
collectionConfig,
|
|
25
|
+
isLoading,
|
|
26
|
+
loadingCount
|
|
27
|
+
};
|
|
28
|
+
if (!isLoading && (!items || items.length === 0)) return /* @__PURE__ */ jsx("div", {
|
|
29
|
+
className: "rounded-lg border border-dashed p-4 text-center",
|
|
30
|
+
children: /* @__PURE__ */ jsx("p", {
|
|
31
|
+
className: "text-sm text-muted-foreground",
|
|
32
|
+
children: resolvedEmptyMessage
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
switch (display) {
|
|
36
|
+
case "chips": return /* @__PURE__ */ jsx(ChipsDisplay, { ...displayProps });
|
|
37
|
+
case "table": return /* @__PURE__ */ jsx(TableDisplay, { ...displayProps });
|
|
38
|
+
case "cards": return /* @__PURE__ */ jsx(CardsDisplay, { ...displayProps });
|
|
39
|
+
case "grid": return /* @__PURE__ */ jsx(GridDisplay, { ...displayProps });
|
|
40
|
+
case "list":
|
|
41
|
+
default: return /* @__PURE__ */ jsx(ListDisplay, { ...displayProps });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { RelationItemsDisplay };
|
|
47
|
+
//# sourceMappingURL=relation-items-display.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation-items-display.mjs","names":["displayProps: RelationDisplayProps"],"sources":["../../../../../src/client/components/fields/relation/relation-items-display.tsx"],"sourcesContent":["/**\n * RelationItemsDisplay Component\n *\n * Unified display component for relation items.\n * Renders items using the specified display mode.\n *\n * Used by:\n * - RelationPicker (editable M:N relations)\n * - ReverseRelationField (read-only reverse relations)\n */\n\nimport type * as React from \"react\";\nimport { useResolveText } from \"../../../i18n/hooks\";\nimport type { I18nText } from \"../../../i18n/types\";\nimport type {\n\tCollectionFieldsConfig,\n\tIconType,\n\tRelationDisplayFields,\n\tRelationDisplayMode,\n\tRelationDisplayProps,\n\tRelationItemActions,\n} from \"./displays\";\nimport { CardsDisplay } from \"./displays/cards-display\";\nimport { ChipsDisplay } from \"./displays/chips-display\";\nimport { GridDisplay } from \"./displays/grid-display\";\nimport { ListDisplay } from \"./displays/list-display\";\nimport { TableDisplay } from \"./displays/table-display\";\n\nexport interface RelationItemsDisplayProps {\n\t/**\n\t * Display mode\n\t */\n\tdisplay?: RelationDisplayMode;\n\n\t/**\n\t * Items to display\n\t */\n\titems: any[];\n\n\t/**\n\t * Collection name\n\t */\n\tcollection: string;\n\n\t/**\n\t * Collection icon (React component or server ComponentReference)\n\t */\n\tcollectionIcon?: IconType;\n\n\t/**\n\t * Action handlers\n\t */\n\tactions?: RelationItemActions;\n\n\t/**\n\t * Whether items are editable (shows edit/remove buttons inline)\n\t */\n\teditable?: boolean;\n\n\t/**\n\t * Whether items can be reordered (shows drag handle)\n\t */\n\torderable?: boolean;\n\n\t/**\n\t * Columns for table display\n\t */\n\tcolumns?: string[];\n\n\t/**\n\t * Field mapping for cards/grid display\n\t */\n\tfields?: RelationDisplayFields;\n\n\t/**\n\t * Number of columns for grid/cards layout\n\t */\n\tgridColumns?: 1 | 2 | 3 | 4;\n\n\t/**\n\t * Show link to detail page (for read-only displays)\n\t */\n\tlinkToDetail?: boolean;\n\n\t/**\n\t * Custom render function for list items\n\t */\n\trenderItem?: (item: any, index: number) => React.ReactNode;\n\n\t/**\n\t * Message to show when no items\n\t */\n\temptyMessage?: I18nText;\n\n\t/**\n\t * Collection config for cell rendering (enables proper cell components in table mode)\n\t */\n\tcollectionConfig?: CollectionFieldsConfig;\n\n\t/**\n\t * Whether items are being loaded\n\t */\n\tisLoading?: boolean;\n\n\t/**\n\t * Number of skeleton items to show when loading\n\t */\n\tloadingCount?: number;\n}\n\nexport function RelationItemsDisplay({\n\tdisplay = \"list\",\n\titems,\n\tcollection,\n\tcollectionIcon,\n\tactions,\n\teditable = false,\n\torderable = false,\n\tcolumns,\n\tfields,\n\tgridColumns,\n\tlinkToDetail = false,\n\trenderItem,\n\temptyMessage = \"No items\",\n\tcollectionConfig,\n\tisLoading = false,\n\tloadingCount,\n}: RelationItemsDisplayProps) {\n\tconst resolveText = useResolveText();\n\tconst resolvedEmptyMessage = resolveText(emptyMessage ?? \"No items\");\n\n\t// Show loading state (skeletons) when loading\n\t// Pass to display components so they can render skeletons\n\tconst displayProps: RelationDisplayProps = {\n\t\titems,\n\t\tcollection,\n\t\tcollectionIcon,\n\t\tactions,\n\t\teditable,\n\t\torderable,\n\t\tcolumns: columns || [\"_title\"],\n\t\tfields,\n\t\tgridColumns,\n\t\tlinkToDetail,\n\t\trenderItem,\n\t\tcollectionConfig,\n\t\tisLoading,\n\t\tloadingCount,\n\t};\n\n\t// Empty state - only show when not loading and no items\n\tif (!isLoading && (!items || items.length === 0)) {\n\t\treturn (\n\t\t\t<div className=\"rounded-lg border border-dashed p-4 text-center\">\n\t\t\t\t<p className=\"text-sm text-muted-foreground\">{resolvedEmptyMessage}</p>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tswitch (display) {\n\t\tcase \"chips\":\n\t\t\treturn <ChipsDisplay {...displayProps} />;\n\t\tcase \"table\":\n\t\t\treturn <TableDisplay {...displayProps} />;\n\t\tcase \"cards\":\n\t\t\treturn <CardsDisplay {...displayProps} />;\n\t\tcase \"grid\":\n\t\t\treturn <GridDisplay {...displayProps} />;\n\t\tcase \"list\":\n\t\tdefault:\n\t\t\treturn <ListDisplay {...displayProps} />;\n\t}\n}\n\n// Re-export types for convenience\nexport type {\n\tCollectionFieldsConfig,\n\tRelationDisplayFields,\n\tRelationDisplayMode,\n\tRelationDisplayProps,\n\tRelationItemActions,\n} from \"./displays\";\n"],"mappings":";;;;;;;;;AA8GA,SAAgB,qBAAqB,EACpC,UAAU,QACV,OACA,YACA,gBACA,SACA,WAAW,OACX,YAAY,OACZ,SACA,QACA,aACA,eAAe,OACf,YACA,eAAe,YACf,kBACA,YAAY,OACZ,gBAC6B;CAE7B,MAAM,uBADc,gBAAgB,CACK,gBAAgB,WAAW;CAIpE,MAAMA,eAAqC;EAC1C;EACA;EACA;EACA;EACA;EACA;EACA,SAAS,WAAW,CAAC,SAAS;EAC9B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAGD,KAAI,CAAC,cAAc,CAAC,SAAS,MAAM,WAAW,GAC7C,QACC,oBAAC;EAAI,WAAU;YACd,oBAAC;GAAE,WAAU;aAAiC;IAAyB;GAClE;AAIR,SAAQ,SAAR;EACC,KAAK,QACJ,QAAO,oBAAC,gBAAa,GAAI,eAAgB;EAC1C,KAAK,QACJ,QAAO,oBAAC,gBAAa,GAAI,eAAgB;EAC1C,KAAK,QACJ,QAAO,oBAAC,gBAAa,GAAI,eAAgB;EAC1C,KAAK,OACJ,QAAO,oBAAC,eAAY,GAAI,eAAgB;EACzC,KAAK;EACL,QACC,QAAO,oBAAC,eAAY,GAAI,eAAgB"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { Control } from "react-hook-form";
|
|
3
|
+
import * as react_jsx_runtime217 from "react/jsx-runtime";
|
|
4
|
+
import { Questpie } from "questpie";
|
|
5
|
+
|
|
6
|
+
//#region src/client/components/fields/relation-field.d.ts
|
|
7
|
+
|
|
8
|
+
type RelationFieldProps<T extends Questpie<any>> = {
|
|
9
|
+
/**
|
|
10
|
+
* Field name (for react-hook-form)
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* Target collection name
|
|
15
|
+
*/
|
|
16
|
+
targetCollection: string;
|
|
17
|
+
/**
|
|
18
|
+
* Relation type:
|
|
19
|
+
* - "single" (one-to-one) - uses RelationSelect
|
|
20
|
+
* - "multiple" (one-to-many, many-to-many) - uses RelationPicker
|
|
21
|
+
*/
|
|
22
|
+
type: "single" | "multiple";
|
|
23
|
+
/**
|
|
24
|
+
* Label for the field
|
|
25
|
+
*/
|
|
26
|
+
label?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Description/help text
|
|
29
|
+
*/
|
|
30
|
+
description?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Localized field
|
|
33
|
+
*/
|
|
34
|
+
localized?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Active locale
|
|
37
|
+
*/
|
|
38
|
+
locale?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Filter options based on form values
|
|
41
|
+
*/
|
|
42
|
+
filter?: (formValues: any) => any;
|
|
43
|
+
/**
|
|
44
|
+
* Is the field required
|
|
45
|
+
*/
|
|
46
|
+
required?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Is the field disabled
|
|
49
|
+
*/
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Is the field readonly
|
|
53
|
+
*/
|
|
54
|
+
readOnly?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Placeholder text
|
|
57
|
+
*/
|
|
58
|
+
placeholder?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Enable drag-and-drop reordering (only for multiple type)
|
|
61
|
+
*/
|
|
62
|
+
orderable?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Maximum number of items (only for multiple type)
|
|
65
|
+
*/
|
|
66
|
+
maxItems?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Custom render function for dropdown options
|
|
69
|
+
*/
|
|
70
|
+
renderOption?: (item: any) => React$1.ReactNode;
|
|
71
|
+
/**
|
|
72
|
+
* Custom render function for selected value (single) or items (multiple)
|
|
73
|
+
*/
|
|
74
|
+
renderValue?: (item: any) => React$1.ReactNode;
|
|
75
|
+
/**
|
|
76
|
+
* Custom render function for selected items (only for multiple type)
|
|
77
|
+
*/
|
|
78
|
+
renderItem?: (item: any, index: number) => React$1.ReactNode;
|
|
79
|
+
/**
|
|
80
|
+
* Form control (optional, will use useFormContext if not provided)
|
|
81
|
+
*/
|
|
82
|
+
control?: Control<any>;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Unified relation field component that integrates with react-hook-form.
|
|
86
|
+
*
|
|
87
|
+
* Automatically chooses between RelationSelect (single) and RelationPicker (multiple)
|
|
88
|
+
* based on the `type` prop.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* // Single relation (one-to-one)
|
|
93
|
+
* <RelationField
|
|
94
|
+
* name="author"
|
|
95
|
+
* targetCollection="users"
|
|
96
|
+
* type="single"
|
|
97
|
+
* label="Author"
|
|
98
|
+
* required
|
|
99
|
+
* />
|
|
100
|
+
*
|
|
101
|
+
* // Multiple relations (many-to-many)
|
|
102
|
+
* <RelationField
|
|
103
|
+
* name="tags"
|
|
104
|
+
* targetCollection="tags"
|
|
105
|
+
* type="multiple"
|
|
106
|
+
* label="Tags"
|
|
107
|
+
* maxItems={5}
|
|
108
|
+
* orderable
|
|
109
|
+
* />
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
declare function RelationField<T extends Questpie<any>>({
|
|
113
|
+
name,
|
|
114
|
+
targetCollection,
|
|
115
|
+
type,
|
|
116
|
+
label,
|
|
117
|
+
description,
|
|
118
|
+
localized,
|
|
119
|
+
locale,
|
|
120
|
+
filter,
|
|
121
|
+
required,
|
|
122
|
+
disabled,
|
|
123
|
+
readOnly,
|
|
124
|
+
placeholder,
|
|
125
|
+
orderable,
|
|
126
|
+
maxItems,
|
|
127
|
+
renderOption,
|
|
128
|
+
renderValue,
|
|
129
|
+
renderItem,
|
|
130
|
+
control: controlProp
|
|
131
|
+
}: RelationFieldProps<T>): react_jsx_runtime217.JSX.Element | null;
|
|
132
|
+
//#endregion
|
|
133
|
+
export { RelationField, RelationFieldProps };
|
|
134
|
+
//# sourceMappingURL=relation-field.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation-field.d.mts","names":[],"sources":["../../../../src/client/components/fields/relation-field.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA4GmB,KA3FP,kBA2FO,CAAA,UA3FsB,QA2FtB,CAAA,GAAA,CAAA,CAAA,GAAA;EA+BH;;;EAEd,IAAA,EAAA,MAAA;EACA;;;EAGA,gBAAA,EAAA,MAAA;EACA;;;;;EAKA,IAAA,EAAA,QAAA,GAAA,UAAA;EACA;;;EAGA,KAAA,CAAA,EAAA,MAAA;EACA;;;EAEC,WAAA,CAAA,EAAA,MAAA;EAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAjEQ,OAAA,CAAM;;;;+BAKP,OAAA,CAAM;;;;6CAKQ,OAAA,CAAM;;;;YAKvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+BI,wBAAwB;;;;;;;;;;;;;;;;;;WAkB7B;GACR,mBAAmB,KAAE,oBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { useResolveText } from "../../i18n/hooks.mjs";
|
|
2
|
+
import { RelationPicker } from "./relation-picker.mjs";
|
|
3
|
+
import { RelationSelect } from "./relation-select.mjs";
|
|
4
|
+
import { Controller, useFormContext } from "react-hook-form";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/client/components/fields/relation-field.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Unified relation field component that integrates with react-hook-form.
|
|
10
|
+
*
|
|
11
|
+
* Automatically chooses between RelationSelect (single) and RelationPicker (multiple)
|
|
12
|
+
* based on the `type` prop.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Single relation (one-to-one)
|
|
17
|
+
* <RelationField
|
|
18
|
+
* name="author"
|
|
19
|
+
* targetCollection="users"
|
|
20
|
+
* type="single"
|
|
21
|
+
* label="Author"
|
|
22
|
+
* required
|
|
23
|
+
* />
|
|
24
|
+
*
|
|
25
|
+
* // Multiple relations (many-to-many)
|
|
26
|
+
* <RelationField
|
|
27
|
+
* name="tags"
|
|
28
|
+
* targetCollection="tags"
|
|
29
|
+
* type="multiple"
|
|
30
|
+
* label="Tags"
|
|
31
|
+
* maxItems={5}
|
|
32
|
+
* orderable
|
|
33
|
+
* />
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
function RelationField({ name, targetCollection, type, label, description, localized, locale, filter, required, disabled, readOnly, placeholder, orderable, maxItems, renderOption, renderValue, renderItem, control: controlProp }) {
|
|
37
|
+
const resolveText = useResolveText();
|
|
38
|
+
const resolvedLabel = label ? resolveText(label) : void 0;
|
|
39
|
+
const resolvedDescription = description ? resolveText(description) : void 0;
|
|
40
|
+
const formContext = useFormContext();
|
|
41
|
+
const control = controlProp ?? formContext?.control;
|
|
42
|
+
if (!control) {
|
|
43
|
+
if (process.env.NODE_ENV !== "production") console.warn("RelationField: No form control found. Make sure to use within FormProvider or pass control prop.");
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
47
|
+
name,
|
|
48
|
+
control,
|
|
49
|
+
rules: { required: required ? `${resolvedLabel || name} is required` : void 0 },
|
|
50
|
+
render: ({ field, fieldState }) => {
|
|
51
|
+
const error = fieldState.error?.message;
|
|
52
|
+
if (type === "single") return /* @__PURE__ */ jsxs("div", {
|
|
53
|
+
className: "space-y-1",
|
|
54
|
+
children: [/* @__PURE__ */ jsx(RelationSelect, {
|
|
55
|
+
name,
|
|
56
|
+
value: field.value,
|
|
57
|
+
onChange: field.onChange,
|
|
58
|
+
targetCollection,
|
|
59
|
+
label: resolvedLabel,
|
|
60
|
+
localized,
|
|
61
|
+
locale,
|
|
62
|
+
filter,
|
|
63
|
+
required,
|
|
64
|
+
disabled,
|
|
65
|
+
readOnly,
|
|
66
|
+
placeholder,
|
|
67
|
+
error,
|
|
68
|
+
renderOption,
|
|
69
|
+
renderValue
|
|
70
|
+
}), resolvedDescription && !error && /* @__PURE__ */ jsx("p", {
|
|
71
|
+
className: "text-muted-foreground text-xs",
|
|
72
|
+
children: resolvedDescription
|
|
73
|
+
})]
|
|
74
|
+
});
|
|
75
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
76
|
+
className: "space-y-1",
|
|
77
|
+
children: [/* @__PURE__ */ jsx(RelationPicker, {
|
|
78
|
+
name,
|
|
79
|
+
value: field.value,
|
|
80
|
+
onChange: field.onChange,
|
|
81
|
+
targetCollection,
|
|
82
|
+
label: resolvedLabel,
|
|
83
|
+
localized,
|
|
84
|
+
locale,
|
|
85
|
+
filter,
|
|
86
|
+
required,
|
|
87
|
+
disabled,
|
|
88
|
+
readOnly,
|
|
89
|
+
placeholder,
|
|
90
|
+
error,
|
|
91
|
+
orderable,
|
|
92
|
+
maxItems,
|
|
93
|
+
renderOption,
|
|
94
|
+
renderItem
|
|
95
|
+
}), resolvedDescription && !error && /* @__PURE__ */ jsx("p", {
|
|
96
|
+
className: "text-muted-foreground text-xs",
|
|
97
|
+
children: resolvedDescription
|
|
98
|
+
})]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
//#endregion
|
|
105
|
+
export { RelationField };
|
|
106
|
+
//# sourceMappingURL=relation-field.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation-field.mjs","names":[],"sources":["../../../../src/client/components/fields/relation-field.tsx"],"sourcesContent":["/**\n * RelationField Component\n *\n * Unified relation field that automatically chooses between:\n * - RelationSelect (single relation / one-to-one)\n * - RelationPicker (multiple relations / one-to-many, many-to-many)\n *\n * Integrates with react-hook-form via Controller.\n */\n\nimport type { Questpie } from \"questpie\";\nimport type * as React from \"react\";\nimport { type Control, Controller, useFormContext } from \"react-hook-form\";\nimport { useResolveText } from \"../../i18n/hooks\";\nimport { RelationPicker, type RelationPickerProps } from \"./relation-picker\";\nimport { RelationSelect, type RelationSelectProps } from \"./relation-select\";\n\nexport type RelationFieldProps<T extends Questpie<any>> = {\n /**\n * Field name (for react-hook-form)\n */\n name: string;\n\n /**\n * Target collection name\n */\n targetCollection: string;\n\n /**\n * Relation type:\n * - \"single\" (one-to-one) - uses RelationSelect\n * - \"multiple\" (one-to-many, many-to-many) - uses RelationPicker\n */\n type: \"single\" | \"multiple\";\n\n /**\n * Label for the field\n */\n label?: string;\n\n /**\n * Description/help text\n */\n description?: string;\n\n /**\n * Localized field\n */\n localized?: boolean;\n\n /**\n * Active locale\n */\n locale?: string;\n\n /**\n * Filter options based on form values\n */\n filter?: (formValues: any) => any;\n\n /**\n * Is the field required\n */\n required?: boolean;\n\n /**\n * Is the field disabled\n */\n disabled?: boolean;\n\n /**\n * Is the field readonly\n */\n readOnly?: boolean;\n\n /**\n * Placeholder text\n */\n placeholder?: string;\n\n /**\n * Enable drag-and-drop reordering (only for multiple type)\n */\n orderable?: boolean;\n\n /**\n * Maximum number of items (only for multiple type)\n */\n maxItems?: number;\n\n /**\n * Custom render function for dropdown options\n */\n renderOption?: (item: any) => React.ReactNode;\n\n /**\n * Custom render function for selected value (single) or items (multiple)\n */\n renderValue?: (item: any) => React.ReactNode;\n\n /**\n * Custom render function for selected items (only for multiple type)\n */\n renderItem?: (item: any, index: number) => React.ReactNode;\n\n /**\n * Form control (optional, will use useFormContext if not provided)\n */\n control?: Control<any>;\n};\n\n/**\n * Unified relation field component that integrates with react-hook-form.\n *\n * Automatically chooses between RelationSelect (single) and RelationPicker (multiple)\n * based on the `type` prop.\n *\n * @example\n * ```tsx\n * // Single relation (one-to-one)\n * <RelationField\n * name=\"author\"\n * targetCollection=\"users\"\n * type=\"single\"\n * label=\"Author\"\n * required\n * />\n *\n * // Multiple relations (many-to-many)\n * <RelationField\n * name=\"tags\"\n * targetCollection=\"tags\"\n * type=\"multiple\"\n * label=\"Tags\"\n * maxItems={5}\n * orderable\n * />\n * ```\n */\nexport function RelationField<T extends Questpie<any>>({\n name,\n targetCollection,\n type,\n label,\n description,\n localized,\n locale,\n filter,\n required,\n disabled,\n readOnly,\n placeholder,\n orderable,\n maxItems,\n renderOption,\n renderValue,\n renderItem,\n control: controlProp,\n}: RelationFieldProps<T>) {\n const resolveText = useResolveText();\n const resolvedLabel = label ? resolveText(label) : undefined;\n const resolvedDescription = description\n ? resolveText(description)\n : undefined;\n const formContext = useFormContext();\n const control = controlProp ?? formContext?.control;\n\n if (!control) {\n if (process.env.NODE_ENV !== \"production\") {\n console.warn(\n \"RelationField: No form control found. Make sure to use within FormProvider or pass control prop.\",\n );\n }\n return null;\n }\n\n return (\n <Controller\n name={name}\n control={control}\n rules={{\n required: required ? `${resolvedLabel || name} is required` : undefined,\n }}\n render={({ field, fieldState }) => {\n const error = fieldState.error?.message;\n\n if (type === \"single\") {\n return (\n <div className=\"space-y-1\">\n <RelationSelect<T>\n name={name}\n value={field.value as string | null}\n onChange={field.onChange}\n targetCollection={targetCollection}\n label={resolvedLabel}\n localized={localized}\n locale={locale}\n filter={filter}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={placeholder}\n error={error}\n renderOption={renderOption}\n renderValue={renderValue}\n />\n {resolvedDescription && !error && (\n <p className=\"text-muted-foreground text-xs\">\n {resolvedDescription}\n </p>\n )}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-1\">\n <RelationPicker<T>\n name={name}\n value={field.value as string[] | null}\n onChange={field.onChange}\n targetCollection={targetCollection}\n label={resolvedLabel}\n localized={localized}\n locale={locale}\n filter={filter}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={placeholder}\n error={error}\n orderable={orderable}\n maxItems={maxItems}\n renderOption={renderOption}\n renderItem={renderItem}\n />\n {resolvedDescription && !error && (\n <p className=\"text-muted-foreground text-xs\">\n {resolvedDescription}\n </p>\n )}\n </div>\n );\n }}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2IA,SAAgB,cAAuC,EACrD,MACA,kBACA,MACA,OACA,aACA,WACA,QACA,QACA,UACA,UACA,UACA,aACA,WACA,UACA,cACA,aACA,YACA,SAAS,eACe;CACxB,MAAM,cAAc,gBAAgB;CACpC,MAAM,gBAAgB,QAAQ,YAAY,MAAM,GAAG;CACnD,MAAM,sBAAsB,cACxB,YAAY,YAAY,GACxB;CACJ,MAAM,cAAc,gBAAgB;CACpC,MAAM,UAAU,eAAe,aAAa;AAE5C,KAAI,CAAC,SAAS;AACZ,MAAI,QAAQ,IAAI,aAAa,aAC3B,SAAQ,KACN,mGACD;AAEH,SAAO;;AAGT,QACE,oBAAC;EACO;EACG;EACT,OAAO,EACL,UAAU,WAAW,GAAG,iBAAiB,KAAK,gBAAgB,QAC/D;EACD,SAAS,EAAE,OAAO,iBAAiB;GACjC,MAAM,QAAQ,WAAW,OAAO;AAEhC,OAAI,SAAS,SACX,QACE,qBAAC;IAAI,WAAU;eACb,oBAAC;KACO;KACN,OAAO,MAAM;KACb,UAAU,MAAM;KACE;KAClB,OAAO;KACI;KACH;KACA;KACE;KACA;KACA;KACG;KACN;KACO;KACD;MACb,EACD,uBAAuB,CAAC,SACvB,oBAAC;KAAE,WAAU;eACV;MACC;KAEF;AAIV,UACE,qBAAC;IAAI,WAAU;eACb,oBAAC;KACO;KACN,OAAO,MAAM;KACb,UAAU,MAAM;KACE;KAClB,OAAO;KACI;KACH;KACA;KACE;KACA;KACA;KACG;KACN;KACI;KACD;KACI;KACF;MACZ,EACD,uBAAuB,CAAC,SACvB,oBAAC;KAAE,WAAU;eACV;MACC;KAEF;;GAGV"}
|