opacacms 0.1.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/bun.lock +34 -0
- package/dist/admin/api-client.d.ts +8 -0
- package/dist/admin/auth-client.d.ts +940 -0
- package/dist/admin/custom-field.d.ts +71 -0
- package/dist/admin/index.d.ts +11 -0
- package/dist/admin/react.d.ts +3 -0
- package/dist/admin/router.d.ts +7 -0
- package/dist/admin/stores/admin-queries.d.ts +32 -0
- package/dist/admin/stores/auth.d.ts +33 -0
- package/dist/admin/stores/column-visibility.d.ts +21 -0
- package/dist/admin/stores/config.d.ts +7 -0
- package/dist/admin/stores/media.d.ts +44 -0
- package/dist/admin/stores/query.d.ts +4 -0
- package/dist/admin/stores/ui.d.ts +11 -0
- package/dist/admin/ui/admin-client.d.ts +7 -0
- package/dist/admin/ui/admin-layout.d.ts +14 -0
- package/dist/admin/ui/components/ColumnVisibilityToggle.d.ts +10 -0
- package/dist/admin/ui/components/DataDetailSheet.d.ts +13 -0
- package/dist/admin/ui/components/DataDetailView.d.ts +9 -0
- package/dist/admin/ui/components/Table.d.ts +10 -0
- package/dist/admin/ui/components/fields/ArrayField.d.ts +13 -0
- package/dist/admin/ui/components/fields/BlocksField.d.ts +17 -0
- package/dist/admin/ui/components/fields/BooleanField.d.ts +13 -0
- package/dist/admin/ui/components/fields/CollapsibleField.d.ts +16 -0
- package/dist/admin/ui/components/fields/DateField.d.ts +13 -0
- package/dist/admin/ui/components/fields/FileField.d.ts +23 -0
- package/dist/admin/ui/components/fields/GroupField.d.ts +13 -0
- package/dist/admin/ui/components/fields/JoinField.d.ts +15 -0
- package/dist/admin/ui/components/fields/NumberField.d.ts +14 -0
- package/dist/admin/ui/components/fields/RadioField.d.ts +17 -0
- package/dist/admin/ui/components/fields/RelationshipField.d.ts +16 -0
- package/dist/admin/ui/components/fields/RowField.d.ts +12 -0
- package/dist/admin/ui/components/fields/SelectField.d.ts +18 -0
- package/dist/admin/ui/components/fields/TabsField.d.ts +15 -0
- package/dist/admin/ui/components/fields/TextAreaField.d.ts +14 -0
- package/dist/admin/ui/components/fields/TextField.d.ts +14 -0
- package/dist/admin/ui/components/fields/VirtualField.d.ts +8 -0
- package/dist/admin/ui/components/fields/index.d.ts +28 -0
- package/dist/admin/ui/components/fields/richtext-editor/index.d.ts +10 -0
- package/dist/admin/ui/components/fields/richtext-editor/nodes/ImageComponent.d.ts +7 -0
- package/dist/admin/ui/components/fields/richtext-editor/nodes/ImageNode.d.ts +27 -0
- package/dist/admin/ui/components/fields/richtext-editor/plugins/ComponentPickerPlugin.d.ts +1 -0
- package/dist/admin/ui/components/fields/richtext-editor/plugins/EditableSyncPlugin.d.ts +5 -0
- package/dist/admin/ui/components/fields/richtext-editor/plugins/NotionToolbarPlugin.d.ts +1 -0
- package/dist/admin/ui/components/fields/richtext-editor/plugins/SimpleToolbarPlugin.d.ts +1 -0
- package/dist/admin/ui/components/fields/richtext-editor/plugins/ValueSyncPlugin.d.ts +5 -0
- package/dist/admin/ui/components/fields/utils.d.ts +1 -0
- package/dist/admin/ui/components/link.d.ts +8 -0
- package/dist/admin/ui/components/media/AssetManagerModal.d.ts +17 -0
- package/dist/admin/ui/components/toast.d.ts +10 -0
- package/dist/admin/ui/components/ui/accordion.d.ts +11 -0
- package/dist/admin/ui/components/ui/alert-dialog.d.ts +12 -0
- package/dist/admin/ui/components/ui/blocks.d.ts +5 -0
- package/dist/admin/ui/components/ui/breadcrumbs.d.ts +7 -0
- package/dist/admin/ui/components/ui/button.d.ts +7 -0
- package/dist/admin/ui/components/ui/collapsible.d.ts +16 -0
- package/dist/admin/ui/components/ui/dialog.d.ts +27 -0
- package/dist/admin/ui/components/ui/group.d.ts +6 -0
- package/dist/admin/ui/components/ui/index.d.ts +17 -0
- package/dist/admin/ui/components/ui/input.d.ts +5 -0
- package/dist/admin/ui/components/ui/join.d.ts +7 -0
- package/dist/admin/ui/components/ui/label.d.ts +3 -0
- package/dist/admin/ui/components/ui/radio-group.d.ts +13 -0
- package/dist/admin/ui/components/ui/relationship-detail-sheet.d.ts +9 -0
- package/dist/admin/ui/components/ui/relationship.d.ts +8 -0
- package/dist/admin/ui/components/ui/scroll-area.d.ts +7 -0
- package/dist/admin/ui/components/ui/select.d.ts +37 -0
- package/dist/admin/ui/components/ui/separator.d.ts +8 -0
- package/dist/admin/ui/components/ui/sheet.d.ts +28 -0
- package/dist/admin/ui/components/ui/tabs.d.ts +17 -0
- package/dist/admin/ui/components/ui/utils.d.ts +1 -0
- package/dist/admin/ui/hooks/use-debounce.d.ts +1 -0
- package/dist/admin/ui/views/collection-list-view.d.ts +5 -0
- package/dist/admin/ui/views/dashboard-view.d.ts +10 -0
- package/dist/admin/ui/views/document-edit-view.d.ts +7 -0
- package/dist/admin/ui/views/global-edit-view.d.ts +19 -0
- package/dist/admin/ui/views/init-view.d.ts +4 -0
- package/dist/admin/ui/views/login-view.d.ts +4 -0
- package/dist/admin/ui/views/media-registry-view.d.ts +7 -0
- package/dist/admin/ui/views/settings-view.d.ts +7 -0
- package/dist/admin/webcomponent.d.ts +1 -0
- package/dist/api.d.ts +6 -0
- package/dist/auth/index.d.ts +2107 -0
- package/dist/auth/migrations.d.ts +5 -0
- package/dist/auth/premissions.d.ts +6 -0
- package/dist/chunk-16vgcf3k.js +88 -0
- package/dist/chunk-2zm8cy1w.js +9482 -0
- package/dist/chunk-5gvbp2qa.js +167 -0
- package/dist/chunk-62ev8gnc.js +41 -0
- package/dist/chunk-6dhs73zq.js +126 -0
- package/dist/chunk-6ew02s0c.js +472 -0
- package/dist/chunk-7a9kn0np.js +116 -0
- package/dist/chunk-8gkhn1d4.js +309 -0
- package/dist/chunk-8sqjbsgt.js +42 -0
- package/dist/chunk-9kxpbcb1.js +85 -0
- package/dist/chunk-cvdd4eqh.js +110 -0
- package/dist/chunk-d3ffeqp9.js +87 -0
- package/dist/chunk-dy5t83hr.js +261 -0
- package/dist/chunk-f3nvxn63.js +17 -0
- package/dist/chunk-hmhcense.js +1352 -0
- package/dist/chunk-j4d50hrx.js +20 -0
- package/dist/chunk-jwjk85ze.js +15 -0
- package/dist/chunk-kwp83w8b.js +250 -0
- package/dist/chunk-s8mqwnm1.js +14 -0
- package/dist/chunk-srsac177.js +85 -0
- package/dist/chunk-v521d72w.js +10 -0
- package/dist/chunk-xa7rjsn2.js +20 -0
- package/dist/chunk-xg35h5a3.js +15 -0
- package/dist/chunk-ybbbqj63.js +130 -0
- package/dist/chunk-zvwb67nd.js +332 -0
- package/dist/cli/commands/generate-types.d.ts +1 -0
- package/dist/cli/commands/init.d.ts +1 -0
- package/dist/cli/commands/migrate-commands.d.ts +5 -0
- package/dist/cli/commands/seed-command.d.ts +2 -0
- package/dist/cli/d1-mock.d.ts +30 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.test.d.ts +1 -0
- package/dist/cli/r2-mock.d.ts +46 -0
- package/dist/cli/seeding.d.ts +17 -0
- package/dist/client.d.ts +51 -0
- package/dist/config-utils.d.ts +6 -0
- package/dist/config.d.ts +10 -0
- package/dist/db/adapter.d.ts +34 -0
- package/dist/db/better-sqlite.d.ts +40 -0
- package/dist/db/bun-sqlite.d.ts +40 -0
- package/dist/db/d1.d.ts +42 -0
- package/dist/db/kysely/data-mapper.d.ts +6 -0
- package/dist/db/kysely/field-mapper.d.ts +22 -0
- package/dist/db/kysely/migration-generator.d.ts +9 -0
- package/dist/db/kysely/query-builder.d.ts +9 -0
- package/dist/db/kysely/schema-builder.d.ts +15 -0
- package/dist/db/kysely/sql-utils.d.ts +1 -0
- package/dist/db/postgres.d.ts +51 -0
- package/dist/db/sqlite.d.ts +41 -0
- package/dist/db/system-schema.d.ts +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/runtimes/bun.d.ts +17 -0
- package/dist/runtimes/cloudflare-workers.d.ts +10 -0
- package/dist/runtimes/next.d.ts +16 -0
- package/dist/runtimes/node.d.ts +18 -0
- package/dist/schema/collection.d.ts +100 -0
- package/dist/schema/fields/base.d.ts +83 -0
- package/dist/schema/fields/index.d.ts +135 -0
- package/dist/schema/global.d.ts +82 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/infer.d.ts +55 -0
- package/dist/server/admin-router.d.ts +9 -0
- package/dist/server/admin.d.ts +18 -0
- package/dist/server/assets.d.ts +47 -0
- package/dist/server/collection-router.d.ts +14 -0
- package/dist/server/handlers.d.ts +76 -0
- package/dist/server/middlewares/admin.d.ts +6 -0
- package/dist/server/middlewares/auth.d.ts +16 -0
- package/dist/server/middlewares/context.d.ts +9 -0
- package/dist/server/middlewares/cors.d.ts +3 -0
- package/dist/server/middlewares/database-init.d.ts +11 -0
- package/dist/server/middlewares/rate-limit.d.ts +3 -0
- package/dist/server/router.d.ts +7 -0
- package/dist/server/setup-middlewares.d.ts +17 -0
- package/dist/server/system-router.d.ts +9 -0
- package/dist/server.d.ts +6 -0
- package/dist/src/admin/index.css +47 -0
- package/dist/src/admin/index.js +176 -0
- package/dist/src/admin/webcomponent.js +19 -0
- package/dist/src/api.js +27 -0
- package/dist/src/cli/index.js +157 -0
- package/dist/src/client.js +9 -0
- package/dist/src/db/bun-sqlite.js +523 -0
- package/dist/src/db/d1.js +568 -0
- package/dist/src/db/postgres.js +520 -0
- package/dist/src/db/sqlite.js +534 -0
- package/dist/src/index.js +20 -0
- package/dist/src/runtimes/bun.js +36 -0
- package/dist/src/runtimes/cloudflare-workers.js +29 -0
- package/dist/src/runtimes/next.js +26 -0
- package/dist/src/runtimes/node.js +38 -0
- package/dist/src/server.js +27 -0
- package/dist/src/storage/index.js +355 -0
- package/dist/storage/adapters/cloudflare-r2.d.ts +6 -0
- package/dist/storage/adapters/local.d.ts +6 -0
- package/dist/storage/adapters/s3.d.ts +13 -0
- package/dist/storage/errors.d.ts +12 -0
- package/dist/storage/index.d.ts +5 -0
- package/dist/storage/types.d.ts +31 -0
- package/dist/types.d.ts +484 -0
- package/dist/utils/lexical.d.ts +5 -0
- package/dist/utils/logger.d.ts +35 -0
- package/dist/validation.d.ts +300 -0
- package/dist/validator.d.ts +9 -0
- package/global.d.ts +11 -0
- package/package.json +151 -0
- package/src/admin/api-client.ts +63 -0
- package/src/admin/auth-client.ts +40 -0
- package/src/admin/custom-field.ts +179 -0
- package/src/admin/index.ts +15 -0
- package/src/admin/react.tsx +72 -0
- package/src/admin/router.ts +9 -0
- package/src/admin/stores/admin-queries.ts +121 -0
- package/src/admin/stores/auth.ts +61 -0
- package/src/admin/stores/column-visibility.ts +67 -0
- package/src/admin/stores/config.ts +15 -0
- package/src/admin/stores/media.ts +95 -0
- package/src/admin/stores/query.ts +13 -0
- package/src/admin/stores/ui.ts +29 -0
- package/src/admin/ui/admin-client.tsx +283 -0
- package/src/admin/ui/admin-layout.tsx +276 -0
- package/src/admin/ui/components/ColumnVisibilityToggle.tsx +141 -0
- package/src/admin/ui/components/DataDetailSheet.tsx +141 -0
- package/src/admin/ui/components/DataDetailView.tsx +175 -0
- package/src/admin/ui/components/Table.tsx +67 -0
- package/src/admin/ui/components/fields/ArrayField.tsx +166 -0
- package/src/admin/ui/components/fields/BlocksField.tsx +202 -0
- package/src/admin/ui/components/fields/BooleanField.tsx +50 -0
- package/src/admin/ui/components/fields/CollapsibleField.tsx +75 -0
- package/src/admin/ui/components/fields/DateField.tsx +45 -0
- package/src/admin/ui/components/fields/FileField.tsx +322 -0
- package/src/admin/ui/components/fields/GroupField.tsx +50 -0
- package/src/admin/ui/components/fields/JoinField.tsx +23 -0
- package/src/admin/ui/components/fields/NumberField.tsx +46 -0
- package/src/admin/ui/components/fields/RadioField.tsx +62 -0
- package/src/admin/ui/components/fields/RelationshipField.tsx +278 -0
- package/src/admin/ui/components/fields/RowField.tsx +40 -0
- package/src/admin/ui/components/fields/SelectField.tsx +59 -0
- package/src/admin/ui/components/fields/TabsField.tsx +101 -0
- package/src/admin/ui/components/fields/TextAreaField.tsx +54 -0
- package/src/admin/ui/components/fields/TextField.tsx +49 -0
- package/src/admin/ui/components/fields/VirtualField.tsx +53 -0
- package/src/admin/ui/components/fields/index.tsx +371 -0
- package/src/admin/ui/components/fields/richtext-editor/index.tsx +211 -0
- package/src/admin/ui/components/fields/richtext-editor/nodes/ImageComponent.tsx +142 -0
- package/src/admin/ui/components/fields/richtext-editor/nodes/ImageNode.tsx +95 -0
- package/src/admin/ui/components/fields/richtext-editor/plugins/ComponentPickerPlugin.tsx +226 -0
- package/src/admin/ui/components/fields/richtext-editor/plugins/EditableSyncPlugin.tsx +16 -0
- package/src/admin/ui/components/fields/richtext-editor/plugins/NotionToolbarPlugin.tsx +184 -0
- package/src/admin/ui/components/fields/richtext-editor/plugins/SimpleToolbarPlugin.tsx +240 -0
- package/src/admin/ui/components/fields/richtext-editor/plugins/ValueSyncPlugin.tsx +40 -0
- package/src/admin/ui/components/fields/utils.ts +1 -0
- package/src/admin/ui/components/link.tsx +41 -0
- package/src/admin/ui/components/media/AssetManagerModal.tsx +334 -0
- package/src/admin/ui/components/toast.tsx +72 -0
- package/src/admin/ui/components/ui/accordion.tsx +51 -0
- package/src/admin/ui/components/ui/alert-dialog.tsx +98 -0
- package/src/admin/ui/components/ui/blocks.tsx +32 -0
- package/src/admin/ui/components/ui/breadcrumbs.tsx +59 -0
- package/src/admin/ui/components/ui/button.tsx +26 -0
- package/src/admin/ui/components/ui/collapsible.tsx +124 -0
- package/src/admin/ui/components/ui/dialog.tsx +79 -0
- package/src/admin/ui/components/ui/group.tsx +20 -0
- package/src/admin/ui/components/ui/index.ts +17 -0
- package/src/admin/ui/components/ui/input.tsx +12 -0
- package/src/admin/ui/components/ui/join.tsx +53 -0
- package/src/admin/ui/components/ui/label.tsx +11 -0
- package/src/admin/ui/components/ui/radio-group.tsx +75 -0
- package/src/admin/ui/components/ui/relationship-detail-sheet.tsx +122 -0
- package/src/admin/ui/components/ui/relationship.tsx +58 -0
- package/src/admin/ui/components/ui/scroll-area.tsx +19 -0
- package/src/admin/ui/components/ui/select.tsx +187 -0
- package/src/admin/ui/components/ui/separator.tsx +21 -0
- package/src/admin/ui/components/ui/sheet.tsx +106 -0
- package/src/admin/ui/components/ui/tabs.tsx +116 -0
- package/src/admin/ui/components/ui/utils.ts +3 -0
- package/src/admin/ui/hooks/use-debounce.ts +15 -0
- package/src/admin/ui/styles/_locale-switcher.scss +33 -0
- package/src/admin/ui/styles/accordion.scss +60 -0
- package/src/admin/ui/styles/animations.scss +41 -0
- package/src/admin/ui/styles/asset-manager.scss +547 -0
- package/src/admin/ui/styles/badge.scss +13 -0
- package/src/admin/ui/styles/base.scss +22 -0
- package/src/admin/ui/styles/button.scss +161 -0
- package/src/admin/ui/styles/card.scss +13 -0
- package/src/admin/ui/styles/collapsible.scss +75 -0
- package/src/admin/ui/styles/data-detail.scss +92 -0
- package/src/admin/ui/styles/dialog.scss +102 -0
- package/src/admin/ui/styles/empty-state.scss +22 -0
- package/src/admin/ui/styles/group.scss +19 -0
- package/src/admin/ui/styles/index.scss +33 -0
- package/src/admin/ui/styles/input.scss +80 -0
- package/src/admin/ui/styles/label.scss +12 -0
- package/src/admin/ui/styles/layout.scss +56 -0
- package/src/admin/ui/styles/lexical.scss +469 -0
- package/src/admin/ui/styles/loading.scss +102 -0
- package/src/admin/ui/styles/media-registry.scss +597 -0
- package/src/admin/ui/styles/pagination.scss +20 -0
- package/src/admin/ui/styles/radio-group.scss +66 -0
- package/src/admin/ui/styles/row.scss +17 -0
- package/src/admin/ui/styles/scrollbar.scss +36 -0
- package/src/admin/ui/styles/select.scss +121 -0
- package/src/admin/ui/styles/separator.scss +14 -0
- package/src/admin/ui/styles/sheet.scss +152 -0
- package/src/admin/ui/styles/sidebar.scss +148 -0
- package/src/admin/ui/styles/switch.scss +59 -0
- package/src/admin/ui/styles/table.scss +207 -0
- package/src/admin/ui/styles/tabs.scss +62 -0
- package/src/admin/ui/styles/toast.scss +45 -0
- package/src/admin/ui/styles/variables.scss +24 -0
- package/src/admin/ui/views/collection-list-view.tsx +720 -0
- package/src/admin/ui/views/dashboard-view.tsx +263 -0
- package/src/admin/ui/views/document-edit-view.tsx +384 -0
- package/src/admin/ui/views/global-edit-view.tsx +226 -0
- package/src/admin/ui/views/init-view.tsx +182 -0
- package/src/admin/ui/views/login-view.tsx +123 -0
- package/src/admin/ui/views/media-registry-view.tsx +1104 -0
- package/src/admin/ui/views/settings-view.tsx +729 -0
- package/src/admin/webcomponent.tsx +15 -0
- package/src/api.ts +9 -0
- package/src/auth/index.ts +194 -0
- package/src/auth/migrations.ts +87 -0
- package/src/auth/premissions.ts +46 -0
- package/src/cli/commands/generate-types.ts +116 -0
- package/src/cli/commands/init.ts +95 -0
- package/src/cli/commands/migrate-commands.ts +160 -0
- package/src/cli/commands/seed-command.ts +11 -0
- package/src/cli/d1-mock.ts +101 -0
- package/src/cli/index.test.ts +84 -0
- package/src/cli/index.ts +183 -0
- package/src/cli/r2-mock.ts +217 -0
- package/src/cli/seeding.ts +405 -0
- package/src/client.ts +181 -0
- package/src/config-utils.ts +102 -0
- package/src/config.ts +49 -0
- package/src/db/adapter.ts +53 -0
- package/src/db/better-sqlite.ts +630 -0
- package/src/db/bun-sqlite.ts +646 -0
- package/src/db/d1.ts +711 -0
- package/src/db/kysely/data-mapper.ts +142 -0
- package/src/db/kysely/field-mapper.ts +148 -0
- package/src/db/kysely/migration-generator.ts +223 -0
- package/src/db/kysely/query-builder.ts +92 -0
- package/src/db/kysely/schema-builder.ts +439 -0
- package/src/db/kysely/sql-utils.ts +13 -0
- package/src/db/postgres.ts +621 -0
- package/src/db/sqlite.ts +658 -0
- package/src/db/system-schema.ts +121 -0
- package/src/index.ts +13 -0
- package/src/runtimes/README.md +59 -0
- package/src/runtimes/bun.ts +49 -0
- package/src/runtimes/cloudflare-workers.ts +38 -0
- package/src/runtimes/next.ts +26 -0
- package/src/runtimes/node.ts +52 -0
- package/src/schema/collection.ts +184 -0
- package/src/schema/fields/base.ts +164 -0
- package/src/schema/fields/index.ts +427 -0
- package/src/schema/global.ts +145 -0
- package/src/schema/index.ts +4 -0
- package/src/schema/infer.ts +72 -0
- package/src/server/admin-router.ts +20 -0
- package/src/server/admin.ts +142 -0
- package/src/server/assets.ts +306 -0
- package/src/server/collection-router.ts +55 -0
- package/src/server/handlers.ts +722 -0
- package/src/server/middlewares/admin.ts +27 -0
- package/src/server/middlewares/auth.ts +89 -0
- package/src/server/middlewares/context.ts +17 -0
- package/src/server/middlewares/cors.ts +24 -0
- package/src/server/middlewares/database-init.ts +74 -0
- package/src/server/middlewares/rate-limit.ts +71 -0
- package/src/server/router.ts +47 -0
- package/src/server/setup-middlewares.ts +58 -0
- package/src/server/system-router.ts +35 -0
- package/src/server.ts +9 -0
- package/src/storage/adapters/cloudflare-r2.ts +136 -0
- package/src/storage/adapters/local.ts +146 -0
- package/src/storage/adapters/s3.ts +186 -0
- package/src/storage/errors.ts +46 -0
- package/src/storage/index.ts +5 -0
- package/src/storage/types.ts +39 -0
- package/src/types.ts +577 -0
- package/src/utils/lexical.ts +37 -0
- package/src/utils/logger.ts +73 -0
- package/src/validation.ts +429 -0
- package/src/validator.ts +179 -0
- package/test/admin-custom-field.test.ts +162 -0
- package/test/admin-react-field.test.tsx +134 -0
- package/test/api-features.test.ts +78 -0
- package/test/api.test.ts +178 -0
- package/test/auth.test.ts +62 -0
- package/test/cli-integration.test.ts +146 -0
- package/test/cli.test.ts +25 -0
- package/test/db/postgres.test.ts +95 -0
- package/test/db/sqlite-filter.test.ts +53 -0
- package/test/db/sqlite.test.ts +82 -0
- package/test/engine-features.test.ts +79 -0
- package/test/globals.test.ts +74 -0
- package/test/integration-tmp/db-app/opacacms.config.ts +15 -0
- package/test/integration-tmp/my-sqlite-app/opacacms.config.ts +25 -0
- package/test/integration-tmp/my-test-app/index.ts +8 -0
- package/test/integration-tmp/my-test-app/opacacms.config.ts +16 -0
- package/test/integration-tmp/my-test-app/package.json +12 -0
- package/test/populate.test.ts +79 -0
- package/test/runtimes.test.ts +43 -0
- package/test/schema-builder.test.ts +107 -0
- package/test/schema-features.test.ts +63 -0
- package/test/seeding.test.ts +68 -0
- package/test/storage/local.test.ts +72 -0
- package/test/storage/s3.test.ts +60 -0
- package/test/structural-data.test.ts +100 -0
- package/test/test-setup.ts +11 -0
- package/test/validation.test.ts +162 -0
- package/tsconfig.json +42 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export interface CustomFieldProps<TValue = any, TConfig = Record<string, any>> {
|
|
2
|
+
/** The current value of the field from the CMS database */
|
|
3
|
+
value: TValue;
|
|
4
|
+
/** The full schema configuration of the field */
|
|
5
|
+
fieldConfig: TConfig;
|
|
6
|
+
/** Whether the field is currently disabled by access control */
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
/** Whether the field is currently read-only by access control */
|
|
9
|
+
readOnly: boolean;
|
|
10
|
+
/** A validation error message from the CMS, if any */
|
|
11
|
+
error?: string;
|
|
12
|
+
/** The current full state of the parent form or row */
|
|
13
|
+
parentData?: Record<string, unknown>;
|
|
14
|
+
/** Callback to notify the CMS that the data has changed */
|
|
15
|
+
onChange: (value: TValue) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface CustomFieldAdapter {
|
|
18
|
+
/**
|
|
19
|
+
* Called exactly once when the field is inserted into the CMS Admin UI.
|
|
20
|
+
* Use this to render your React root, Vue app, or Vanilla DOM nodes.
|
|
21
|
+
*
|
|
22
|
+
* @param container The DOM element acting as the wrapper for your component.
|
|
23
|
+
* @param props The initial properties (value, config, onChange) from the CMS.
|
|
24
|
+
*/
|
|
25
|
+
mount: (container: HTMLElement, props: CustomFieldProps) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Called whenever the CMS pushes new data to the field (e.g. form resets,
|
|
28
|
+
* external value changes).
|
|
29
|
+
*
|
|
30
|
+
* @param container The same DOM element wrapper.
|
|
31
|
+
* @param props The updated properties.
|
|
32
|
+
*/
|
|
33
|
+
update?: (container: HTMLElement, props: CustomFieldProps) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Called exactly once when the field is removed from the DOM (e.g., navigating away).
|
|
36
|
+
* Use this to unmount your React root or Vue app to prevent memory leaks.
|
|
37
|
+
*
|
|
38
|
+
* @param container The same DOM element wrapper.
|
|
39
|
+
*/
|
|
40
|
+
unmount?: (container: HTMLElement) => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A built-in utility to register framework-agnostic Custom Web Components for the OpacaCMS Admin UI.
|
|
44
|
+
*
|
|
45
|
+
* It acts as an adapter, translating the Web Component lifecycle (`connectedCallback`, `disconnectedCallback`,
|
|
46
|
+
* property setters) into a simple `mount` / `update` / `unmount` paradigm that can easily wrap React, Vue, Angular,
|
|
47
|
+
* or plain Javascript applications.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* import { defineCustomField } from 'opacacms/admin';
|
|
52
|
+
* import { createRoot } from 'react-dom/client';
|
|
53
|
+
*
|
|
54
|
+
* defineCustomField('my-react-picker', {
|
|
55
|
+
* mount: (container, props) => {
|
|
56
|
+
* (container as any)._root = createRoot(container);
|
|
57
|
+
* (container as any)._root.render(<MyPicker {...props} />);
|
|
58
|
+
* },
|
|
59
|
+
* update: (container, props) => {
|
|
60
|
+
* (container as any)._root.render(<MyPicker {...props} />);
|
|
61
|
+
* },
|
|
62
|
+
* unmount: (container) => {
|
|
63
|
+
* (container as any)._root.unmount();
|
|
64
|
+
* }
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @param tagName The tag name to register in the browser (e.g., `opaca-color-picker`). Must contain a hyphen.
|
|
69
|
+
* @param adapter The adapter containing `mount`, optional `update`, and optional `unmount` lifecycle methods.
|
|
70
|
+
*/
|
|
71
|
+
export declare function defineCustomField(tagName: string, adapter: CustomFieldAdapter): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { type CustomFieldAdapter, type CustomFieldProps, defineCustomField, } from "./custom-field";
|
|
2
|
+
export { defineReactField } from "./react";
|
|
3
|
+
export * from "./router";
|
|
4
|
+
export * from "./stores/config";
|
|
5
|
+
export * from "./stores/query";
|
|
6
|
+
export * from "./stores/ui";
|
|
7
|
+
export { AdminClient } from "./ui/admin-client";
|
|
8
|
+
export { AdminLayout } from "./ui/admin-layout";
|
|
9
|
+
export { Breadcrumbs } from "./ui/components/ui/breadcrumbs";
|
|
10
|
+
export { Link } from "./ui/components/link";
|
|
11
|
+
export { Toast, ToastContainer } from "./ui/components/toast";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const $router: import("@nanostores/router").Router<{
|
|
2
|
+
readonly dashboard: "/admin";
|
|
3
|
+
readonly collections: "/admin/collections/:slug";
|
|
4
|
+
readonly document: "/admin/collections/:slug/:id";
|
|
5
|
+
readonly globals: "/admin/globals/:slug";
|
|
6
|
+
readonly settings: "/admin/settings";
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { PaginatedResult } from "../../types";
|
|
2
|
+
export interface CollectionQueryParams {
|
|
3
|
+
slug: string;
|
|
4
|
+
page?: number;
|
|
5
|
+
limit?: number;
|
|
6
|
+
sort?: string;
|
|
7
|
+
search?: string;
|
|
8
|
+
searchField?: string;
|
|
9
|
+
filter?: Record<string, unknown>;
|
|
10
|
+
populate?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const $collectionQuery: import("nanostores").PreinitializedWritableAtom<CollectionQueryParams | null> & object;
|
|
13
|
+
export declare const $collectionData: import("@nanostores/query").FetcherStore<PaginatedResult<Record<string, unknown>>, any>;
|
|
14
|
+
export interface DocumentQueryParams {
|
|
15
|
+
slug: string;
|
|
16
|
+
id: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const $documentQuery: import("nanostores").PreinitializedWritableAtom<DocumentQueryParams | null> & object;
|
|
19
|
+
export declare const $documentData: import("@nanostores/query").FetcherStore<Record<string, unknown>, any>;
|
|
20
|
+
export interface SaveDocumentParams {
|
|
21
|
+
slug: string;
|
|
22
|
+
id: string;
|
|
23
|
+
body: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export declare const $saveDocument: import("@nanostores/query").MutatorStore<SaveDocumentParams, Record<string, unknown>, any>;
|
|
26
|
+
export declare const $globalQuery: import("nanostores").PreinitializedWritableAtom<string | null> & object;
|
|
27
|
+
export declare const $globalData: import("@nanostores/query").FetcherStore<Record<string, unknown>, any>;
|
|
28
|
+
export interface SaveGlobalParams {
|
|
29
|
+
slug: string;
|
|
30
|
+
body: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
export declare const $saveGlobal: import("@nanostores/query").MutatorStore<SaveGlobalParams, Record<string, unknown>, any>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const $session: import("nanostores").PreinitializedWritableAtom<any> & object;
|
|
2
|
+
export declare const $isAuthPending: import("nanostores").PreinitializedWritableAtom<boolean> & object;
|
|
3
|
+
export declare const $user: import("nanostores").ReadableAtom<any>;
|
|
4
|
+
export declare const $isAuthenticated: import("nanostores").ReadableAtom<boolean>;
|
|
5
|
+
export declare function syncSession(): Promise<void>;
|
|
6
|
+
export declare function login(data: Record<string, string>): Promise<{
|
|
7
|
+
data: Omit<{
|
|
8
|
+
redirect: boolean;
|
|
9
|
+
token: string;
|
|
10
|
+
url?: string | undefined;
|
|
11
|
+
user: {
|
|
12
|
+
id: string;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
updatedAt: Date;
|
|
15
|
+
email: string;
|
|
16
|
+
emailVerified: boolean;
|
|
17
|
+
name: string;
|
|
18
|
+
image?: string | null | undefined | undefined;
|
|
19
|
+
};
|
|
20
|
+
}, "user"> & {
|
|
21
|
+
user: import("better-auth").StripEmptyObjects<{
|
|
22
|
+
id: string;
|
|
23
|
+
createdAt: Date;
|
|
24
|
+
updatedAt: Date;
|
|
25
|
+
email: string;
|
|
26
|
+
emailVerified: boolean;
|
|
27
|
+
name: string;
|
|
28
|
+
image?: string | null | undefined;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
error: null;
|
|
32
|
+
}>;
|
|
33
|
+
export declare function logout(): Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stores column visibility preferences per collection.
|
|
3
|
+
* Key: collection slug
|
|
4
|
+
* Value: JSON string of string[] containing visible field names
|
|
5
|
+
*/
|
|
6
|
+
export declare const $columnVisibility: import("nanostores").WritableAtom<Record<string, string[]>>;
|
|
7
|
+
/**
|
|
8
|
+
* Toggle visibility of a column in a collection
|
|
9
|
+
*/
|
|
10
|
+
export declare function toggleColumnVisibility(slug: string, fieldName: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* Set visible columns for a collection
|
|
13
|
+
*/
|
|
14
|
+
export declare function setVisibleColumns(slug: string, columns: string[]): void;
|
|
15
|
+
/**
|
|
16
|
+
* Initialize column visibility for a collection if not already set.
|
|
17
|
+
* Uses defaultColumns from config or all available named fields.
|
|
18
|
+
*/
|
|
19
|
+
export declare function initColumnVisibility(slug: string, fields: {
|
|
20
|
+
name?: string;
|
|
21
|
+
}[], defaultColumns?: string[]): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SerializableConfig } from "../../types";
|
|
2
|
+
export declare const $config: import("nanostores").PreinitializedWritableAtom<SerializableConfig | null> & object;
|
|
3
|
+
export declare const $needsInit: import("nanostores").PreinitializedWritableAtom<boolean> & object;
|
|
4
|
+
export declare const $isFetchingConfig: import("nanostores").PreinitializedWritableAtom<boolean> & object;
|
|
5
|
+
export declare const $hasMetadataError: import("nanostores").PreinitializedWritableAtom<boolean> & object;
|
|
6
|
+
export declare function setConfig(config: SerializableConfig | null): void;
|
|
7
|
+
export declare function setNeedsInit(needs: boolean): void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface AssetDoc {
|
|
2
|
+
id: string;
|
|
3
|
+
key: string;
|
|
4
|
+
filename: string;
|
|
5
|
+
originalFilename: string;
|
|
6
|
+
original_filename?: string;
|
|
7
|
+
mimeType: string;
|
|
8
|
+
mime_type?: string;
|
|
9
|
+
filesize: number;
|
|
10
|
+
bucket: string;
|
|
11
|
+
folder: string | null;
|
|
12
|
+
altText: string | null;
|
|
13
|
+
alt_text?: string | null;
|
|
14
|
+
caption: string | null;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
created_at?: string;
|
|
18
|
+
updated_at?: string;
|
|
19
|
+
url?: string;
|
|
20
|
+
thumbnailUrl?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface AssetRegistryData {
|
|
23
|
+
docs: AssetDoc[];
|
|
24
|
+
folders: {
|
|
25
|
+
name: string;
|
|
26
|
+
buckets: string[];
|
|
27
|
+
}[];
|
|
28
|
+
totalDocs: number;
|
|
29
|
+
limit: number;
|
|
30
|
+
page: number;
|
|
31
|
+
totalPages: number;
|
|
32
|
+
}
|
|
33
|
+
export declare const $mediaViewMode: import("nanostores").WritableAtom<"list" | "grid">;
|
|
34
|
+
export declare const $mediaSelectedBucket: import("nanostores").WritableAtom<string>;
|
|
35
|
+
export declare const $bucketColors: import("nanostores").WritableAtom<Record<string, string>>;
|
|
36
|
+
export declare const $mediaCurrentFolder: import("nanostores").PreinitializedWritableAtom<string> & object;
|
|
37
|
+
export declare const $mediaSearch: import("nanostores").PreinitializedWritableAtom<string> & object;
|
|
38
|
+
export declare const $mediaPage: import("nanostores").PreinitializedWritableAtom<number> & object;
|
|
39
|
+
export declare const $assets: import("@nanostores/query").FetcherStore<AssetRegistryData, any>;
|
|
40
|
+
export declare const setMediaBucket: (bucket: string) => void;
|
|
41
|
+
export declare const setMediaFolder: (folder: string) => void;
|
|
42
|
+
export declare const setMediaSearch: (search: string) => void;
|
|
43
|
+
export declare const setMediaPage: (page: number) => void;
|
|
44
|
+
export declare const setBucketColor: (bucket: string, color: string) => void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const createFetcherStore: <T = unknown, E = any>(keyInput: import("@nanostores/query").KeyInput, { fetcher, ...fetcherSettings }?: import("@nanostores/query").CommonSettings<T>) => import("@nanostores/query").FetcherStore<T, E>, createMutatorStore: <Data = void, Result = unknown, E_1 = any>(mutator: import("@nanostores/query").ManualMutator<Data, Result>, opts?: {
|
|
2
|
+
throttleCalls?: boolean | undefined;
|
|
3
|
+
onError?: ((error: unknown) => void) | undefined;
|
|
4
|
+
} | undefined) => import("@nanostores/query").MutatorStore<Data, Result, E_1>, invalidateKeys: (keySelector: import("@nanostores/query").KeySelector) => void, revalidateKeys: (keySelector: import("@nanostores/query").KeySelector) => void, mutateCache: (keySelector: import("@nanostores/query").KeySelector, data?: unknown) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ToastItem {
|
|
2
|
+
id: string;
|
|
3
|
+
message: string;
|
|
4
|
+
type: "success" | "error" | "info";
|
|
5
|
+
}
|
|
6
|
+
export type ToastType = ToastItem["type"];
|
|
7
|
+
export declare const $toasts: import("nanostores").PreinitializedWritableAtom<ToastItem[]> & object;
|
|
8
|
+
export declare const $isSidebarCollapsed: import("nanostores").WritableAtom<boolean>;
|
|
9
|
+
export declare function toggleSidebar(): void;
|
|
10
|
+
export declare function notify(message: string, type?: ToastItem["type"]): void;
|
|
11
|
+
export declare function clearToast(id: string): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SerializableConfig } from '../../types';
|
|
2
|
+
export interface AdminClientProps {
|
|
3
|
+
config: SerializableConfig | null;
|
|
4
|
+
serverUrl: string;
|
|
5
|
+
initialNeedsInit?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function AdminClient({ config: initialConfig, serverUrl, initialNeedsInit, }: AdminClientProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { SerializableConfig } from "../../types";
|
|
3
|
+
import "./styles/index.scss";
|
|
4
|
+
export interface AdminLayoutProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
config: SerializableConfig;
|
|
7
|
+
user?: {
|
|
8
|
+
name: string;
|
|
9
|
+
email: string;
|
|
10
|
+
image?: string | null;
|
|
11
|
+
} | null;
|
|
12
|
+
onLogout?: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function AdminLayout({ children, config, user, onLogout }: AdminLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import "../styles/data-detail.scss";
|
|
3
|
+
interface DataDetailSheetProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
data: any;
|
|
9
|
+
onSave?: (updatedData: any) => void;
|
|
10
|
+
field?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const DataDetailSheet: React.FC<DataDetailSheetProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
|
|
3
|
+
declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
4
|
+
declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
5
|
+
declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
6
|
+
declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
7
|
+
declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
8
|
+
declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
9
|
+
declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
10
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface ArrayFieldProps {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
fields: any[];
|
|
6
|
+
value: any[];
|
|
7
|
+
onChange: (val: any[]) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
renderField: (field: any, value: any, onChange: (val: any) => void) => React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const ArrayField: React.FC<ArrayFieldProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface BlocksFieldProps {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
blocks: Array<{
|
|
6
|
+
slug: string;
|
|
7
|
+
fields: any[];
|
|
8
|
+
label?: string;
|
|
9
|
+
}>;
|
|
10
|
+
value: any[];
|
|
11
|
+
onChange: (val: any[]) => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
readOnly?: boolean;
|
|
14
|
+
renderField: (field: any, value: any, onChange: (val: any) => void) => React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare const BlocksField: React.FC<BlocksFieldProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface BooleanFieldProps {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
value: boolean;
|
|
6
|
+
onChange: (val: boolean) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
error?: string;
|
|
10
|
+
renderType?: "switch" | "toggle" | "checkbox";
|
|
11
|
+
}
|
|
12
|
+
export declare const BooleanField: React.FC<BooleanFieldProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface CollapsibleFieldProps {
|
|
3
|
+
label?: string;
|
|
4
|
+
fields: any[];
|
|
5
|
+
parentData: any;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
readOnly?: boolean;
|
|
8
|
+
options?: {
|
|
9
|
+
initiallyCollapsed?: boolean;
|
|
10
|
+
useAsTitle?: string;
|
|
11
|
+
};
|
|
12
|
+
onChange: (fieldName: string, value: any) => void;
|
|
13
|
+
renderField: (field: any, value: any, onChange: (val: any) => void) => React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare const CollapsibleField: React.FC<CollapsibleFieldProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface DateFieldProps {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
value: string | number | Date;
|
|
6
|
+
onChange: (val: string) => void;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
error?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const DateField: React.FC<DateFieldProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import "../../styles/asset-manager.scss";
|
|
3
|
+
interface FileFieldProps {
|
|
4
|
+
name: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
value: any;
|
|
7
|
+
onChange: (value: any) => void;
|
|
8
|
+
options?: {
|
|
9
|
+
allowedmime_types?: string[];
|
|
10
|
+
maxFileSize?: number;
|
|
11
|
+
metaFields?: Array<{
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
readOnly?: boolean;
|
|
20
|
+
bucket?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const FileField: React.FC<FileFieldProps>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface GroupFieldProps {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
fields: any[];
|
|
6
|
+
value: any;
|
|
7
|
+
onChange: (val: any) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
renderField: (field: any, value: any, onChange: (val: any) => void) => React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const GroupField: React.FC<GroupFieldProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface JoinFieldProps {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
collection: string;
|
|
6
|
+
value: any;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
on?: string;
|
|
10
|
+
onChange?: (val: any) => void;
|
|
11
|
+
error?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const JoinField: React.FC<JoinFieldProps>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface NumberFieldProps {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
value: number;
|
|
6
|
+
onChange: (val: number) => void;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const NumberField: React.FC<NumberFieldProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface RadioFieldProps {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (val: string) => void;
|
|
7
|
+
choices: Array<{
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
} | string>;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
readOnly?: boolean;
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const RadioField: React.FC<RadioFieldProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface RelationshipFieldProps {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
relationTo: string;
|
|
6
|
+
value: any;
|
|
7
|
+
onChange: (val: any) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
error?: string;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
displayField?: string;
|
|
13
|
+
hasMany?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const RelationshipField: React.FC<RelationshipFieldProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface RowFieldProps {
|
|
3
|
+
fields: any[];
|
|
4
|
+
parentData: any;
|
|
5
|
+
onChange: (fieldName: string, value: any) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
readOnly?: boolean;
|
|
8
|
+
errors?: Record<string, string>;
|
|
9
|
+
renderField: (field: any, value: any, onChange: (val: any) => void) => React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const RowField: React.FC<RowFieldProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface SelectFieldProps {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (val: string) => void;
|
|
7
|
+
choices: Array<{
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
} | string>;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
readOnly?: boolean;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const SelectField: React.FC<SelectFieldProps>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface TabsFieldProps {
|
|
3
|
+
tabs: Array<{
|
|
4
|
+
label: string;
|
|
5
|
+
fields: any[];
|
|
6
|
+
}>;
|
|
7
|
+
value: any;
|
|
8
|
+
parentData?: any;
|
|
9
|
+
onChange: (val: any, secondaryVal?: any) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
readOnly?: boolean;
|
|
12
|
+
renderField: (field: any, value: any, onChange: (val: any, secondaryVal?: any) => void) => React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const TabsField: React.FC<TabsFieldProps>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface TextAreaFieldProps {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
value: string | null;
|
|
6
|
+
onChange: (val: string | null) => void;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const TextAreaField: React.FC<TextAreaFieldProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface TextFieldProps {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
value: string | null;
|
|
6
|
+
onChange: (val: string | null) => void;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const TextField: React.FC<TextFieldProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ArrayField } from "./ArrayField";
|
|
3
|
+
import { BlocksField } from "./BlocksField";
|
|
4
|
+
import { BooleanField } from "./BooleanField";
|
|
5
|
+
import { CollapsibleField } from "./CollapsibleField";
|
|
6
|
+
import { DateField } from "./DateField";
|
|
7
|
+
import { FileField } from "./FileField";
|
|
8
|
+
import { GroupField } from "./GroupField";
|
|
9
|
+
import { JoinField } from "./JoinField";
|
|
10
|
+
import { NumberField } from "./NumberField";
|
|
11
|
+
import { RadioField } from "./RadioField";
|
|
12
|
+
import { RelationshipField } from "./RelationshipField";
|
|
13
|
+
import { SelectField } from "./SelectField";
|
|
14
|
+
import { TabsField } from "./TabsField";
|
|
15
|
+
import { TextAreaField } from "./TextAreaField";
|
|
16
|
+
import { TextField } from "./TextField";
|
|
17
|
+
import { VirtualField } from "./VirtualField";
|
|
18
|
+
export { ArrayField, BlocksField, BooleanField, CollapsibleField, DateField, FileField, GroupField, JoinField, NumberField, RadioField, RelationshipField, SelectField, TabsField, TextAreaField, TextField, VirtualField, };
|
|
19
|
+
interface FieldRendererProps {
|
|
20
|
+
field: any;
|
|
21
|
+
value: any;
|
|
22
|
+
onChange: (val: any, secondaryVal?: any) => void;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
readOnly?: boolean;
|
|
25
|
+
error?: string;
|
|
26
|
+
parentData?: any;
|
|
27
|
+
}
|
|
28
|
+
export declare const FieldRenderer: React.FC<FieldRendererProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "../../../styles/lexical.scss";
|
|
2
|
+
export interface RichTextEditorProps {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
defaultMode?: "simple" | "notion";
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
readOnly?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const normalizeEditorState: (value: unknown) => string | undefined;
|
|
10
|
+
export declare function RichTextEditor({ value, onChange, defaultMode, disabled, readOnly, }: RichTextEditorProps): import("react/jsx-runtime").JSX.Element;
|