@kardalum/plugin-sdk 0.19.0 → 0.21.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/CHANGELOG.md +281 -0
- package/README.md +19 -0
- package/dist/admin-section-registry.d.ts +48 -1
- package/dist/admin-section-registry.js +90 -0
- package/dist/built-in-editor-ids.d.ts +1 -1
- package/dist/built-in-editor-ids.js +2 -20
- package/dist/built-in-settings-schemas.d.ts +10 -0
- package/dist/built-in-settings-schemas.js +86 -0
- package/dist/built-in-value-schemas.js +35 -0
- package/dist/built-ins.js +38 -7
- package/dist/capabilities.d.ts +11 -1
- package/dist/capabilities.js +101 -4
- package/dist/cli.d.ts +66 -0
- package/dist/cli.js +22 -0
- package/dist/consent-entry.d.ts +11 -0
- package/dist/consent-entry.js +18 -0
- package/dist/content-library.d.ts +102 -0
- package/dist/content-library.js +15 -0
- package/dist/content-list-extensions.d.ts +50 -0
- package/dist/content-list-extensions.js +11 -0
- package/dist/content-picker/page-picker-sheet.d.ts +15 -0
- package/dist/content-picker/page-picker-sheet.js +105 -0
- package/dist/content-picker/page-picker.d.ts +18 -0
- package/dist/content-picker/page-picker.js +20 -0
- package/dist/content-picker/page-tree.d.ts +25 -0
- package/dist/content-picker/page-tree.js +132 -0
- package/dist/data-type-plugin.d.ts +7 -1
- package/dist/datatype-validation.d.ts +4 -9
- package/dist/datatype-validation.js +147 -1
- package/dist/datatypes-entry.d.ts +1 -0
- package/dist/datatypes-entry.js +2 -0
- package/dist/entitlement-entry.d.ts +1 -1
- package/dist/entitlement-entry.js +1 -1
- package/dist/entitlement-gate.d.ts +14 -0
- package/dist/entitlement-gate.js +64 -7
- package/dist/entitlement-plan.d.ts +6 -0
- package/dist/entitlement-plan.js +10 -0
- package/dist/entitlement-types.d.ts +53 -12
- package/dist/entitlement.d.ts +31 -4
- package/dist/entitlement.js +58 -17
- package/dist/hook-entry.d.ts +5 -0
- package/dist/hook-entry.js +30 -0
- package/dist/host-entry.d.ts +7 -1
- package/dist/host-entry.js +14 -1
- package/dist/index.d.ts +67 -7
- package/dist/index.js +94 -6
- package/dist/mail.d.ts +34 -0
- package/dist/mail.js +1 -0
- package/dist/manifest-entry.d.ts +47 -4
- package/dist/manifest-entry.js +63 -2
- package/dist/manifest-schema.d.ts +993 -40
- package/dist/manifest-schema.js +516 -26
- package/dist/manifest.d.ts +1186 -62
- package/dist/manifest.js +8 -4
- package/dist/media/media-picker.js +31 -18
- package/dist/media/upload-error.d.ts +5 -1
- package/dist/media/upload-error.js +14 -2
- package/dist/media-library.d.ts +32 -0
- package/dist/media-library.js +15 -0
- package/dist/nested-field-host.d.ts +76 -0
- package/dist/nested-field-host.js +90 -0
- package/dist/notify.d.ts +12 -4
- package/dist/notify.js +1 -1
- package/dist/outbound.d.ts +47 -0
- package/dist/outbound.js +1 -0
- package/dist/plugin-context.d.ts +52 -0
- package/dist/plugin-context.js +27 -0
- package/dist/plugin-permissions.d.ts +18 -0
- package/dist/plugin-permissions.js +25 -0
- package/dist/plugin-screen-context.d.ts +262 -9
- package/dist/plugin-screen-context.js +56 -0
- package/dist/providers.d.ts +313 -0
- package/dist/providers.js +74 -0
- package/dist/read-all-pages.d.ts +5 -0
- package/dist/read-all-pages.js +3 -2
- package/dist/render-page.d.ts +15 -0
- package/dist/render-page.js +20 -0
- package/dist/richtext/block-panel.d.ts +12 -1
- package/dist/richtext/block-panel.js +36 -25
- package/dist/richtext/button-view.d.ts +11 -0
- package/dist/richtext/button-view.js +45 -0
- package/dist/richtext/content-guard.d.ts +4 -0
- package/dist/richtext/content-guard.js +27 -0
- package/dist/richtext/editor-handle.d.ts +34 -0
- package/dist/richtext/editor-handle.js +225 -0
- package/dist/richtext/extensions.d.ts +6 -0
- package/dist/richtext/extensions.js +16 -0
- package/dist/richtext/insert-menu.d.ts +6 -1
- package/dist/richtext/insert-menu.js +45 -22
- package/dist/richtext/item-attributes.d.ts +6 -0
- package/dist/richtext/item-attributes.js +19 -0
- package/dist/richtext/item-panel.d.ts +25 -0
- package/dist/richtext/item-panel.js +118 -0
- package/dist/richtext/item-view.d.ts +58 -0
- package/dist/richtext/item-view.js +172 -0
- package/dist/richtext/mark-form.d.ts +10 -0
- package/dist/richtext/mark-form.js +38 -0
- package/dist/richtext/paste-choice.d.ts +9 -0
- package/dist/richtext/paste-choice.js +13 -0
- package/dist/richtext/plugin-items.d.ts +72 -0
- package/dist/richtext/plugin-items.js +562 -0
- package/dist/richtext/plugin-mark-tooltips.d.ts +5 -0
- package/dist/richtext/plugin-mark-tooltips.js +44 -0
- package/dist/richtext/plugin-toolbar.d.ts +57 -0
- package/dist/richtext/plugin-toolbar.js +186 -0
- package/dist/richtext/rich-item-icons.d.ts +5 -0
- package/dist/richtext/rich-item-icons.js +42 -0
- package/dist/richtext/rich-items.d.ts +42 -0
- package/dist/richtext/rich-items.js +68 -0
- package/dist/richtext/rich-text-view-host.d.ts +24 -0
- package/dist/richtext/rich-text-view-host.js +11 -0
- package/dist/richtext/style-listbox.js +6 -4
- package/dist/richtext/toolbar-button.d.ts +16 -0
- package/dist/richtext/toolbar-button.js +9 -0
- package/dist/richtext/url-paste.d.ts +20 -0
- package/dist/richtext/url-paste.js +82 -0
- package/dist/richtext-html-entry.d.ts +5 -0
- package/dist/richtext-html-entry.js +11 -0
- package/dist/sdk-strings.d.ts +344 -0
- package/dist/sdk-strings.js +411 -0
- package/dist/sealing.d.ts +14 -0
- package/dist/sealing.js +1 -0
- package/dist/service-contract.d.ts +17 -0
- package/dist/service-contract.js +39 -0
- package/dist/services.d.ts +114 -0
- package/dist/services.js +1 -0
- package/dist/simple-storage-value-provider.js +24 -24
- package/dist/structured-storage-types.d.ts +429 -9
- package/dist/tailwind.js +10 -5
- package/dist/template-reads.d.ts +16 -0
- package/dist/template-reads.js +21 -0
- package/dist/testing-entry.d.ts +38 -0
- package/dist/testing-entry.js +173 -0
- package/dist/text-entry.d.ts +1 -0
- package/dist/text-entry.js +7 -0
- package/dist/tokens/system-dark.css +1 -0
- package/dist/tokens/tailwind-theme.css +7 -0
- package/dist/tokens/tokens.css +19 -3
- package/dist/tokens/tokens.json +13 -4
- package/dist/uploads.d.ts +43 -0
- package/dist/uploads.js +1 -0
- package/dist/user-library.d.ts +51 -0
- package/dist/user-library.js +15 -0
- package/dist/view-helpers.d.ts +18 -0
- package/dist/view-helpers.js +64 -0
- package/dist/views/asset-view.js +4 -1
- package/dist/views/content-list-preview.js +3 -1
- package/dist/views/content-list-settings-view.js +11 -7
- package/dist/views/content-list-view.d.ts +5 -3
- package/dist/views/content-list-view.js +243 -40
- package/dist/views/content-picker-view.d.ts +3 -0
- package/dist/views/content-picker-view.js +143 -0
- package/dist/views/crop-view.d.ts +4 -6
- package/dist/views/crop-view.js +22 -13
- package/dist/views/date-range-view.js +4 -1
- package/dist/views/file-upload-view.d.ts +5 -7
- package/dist/views/file-upload-view.js +16 -7
- package/dist/views/group-view.d.ts +8 -0
- package/dist/views/group-view.js +123 -0
- package/dist/views/html-view.js +7 -6
- package/dist/views/image-view.js +37 -19
- package/dist/views/link-view.d.ts +3 -0
- package/dist/views/link-view.js +150 -0
- package/dist/views/options-list-view.d.ts +3 -0
- package/dist/views/options-list-view.js +104 -0
- package/dist/views/repeatable-list-view.d.ts +3 -0
- package/dist/views/repeatable-list-view.js +113 -0
- package/dist/views/rich-text-view.d.ts +2 -0
- package/dist/views/rich-text-view.js +208 -35
- package/dist/views/suggest-key.d.ts +17 -0
- package/dist/views/suggest-key.js +55 -0
- package/dist/views/unreadable-rich-text.d.ts +17 -0
- package/dist/views/unreadable-rich-text.js +40 -0
- package/dist/visitors.d.ts +81 -0
- package/dist/visitors.js +1 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-hosts.d.ts +21 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-hosts.js +39 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-redirects.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-redirects.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.d.ts +334 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +254 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +5 -0
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +11 -1
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +4 -2
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +38 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +65 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +144 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +115 -3
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +58 -11
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +137 -2
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +178 -2
- package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-path.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-reads.schema.d.ts +213 -0
- package/node_modules/@kardalum/api-schemas/dist/content-reads.schema.js +234 -0
- package/node_modules/@kardalum/api-schemas/dist/content-search.schema.d.ts +50 -0
- package/node_modules/@kardalum/api-schemas/dist/content-search.schema.js +42 -0
- package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.d.ts +37 -0
- package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.js +86 -0
- package/node_modules/@kardalum/api-schemas/dist/contribution-issues.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/contribution-issues.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +55 -13
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +22 -10
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +25 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/data-type-issue.d.ts +35 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-issue.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +257 -15
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +78 -5
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +24 -6
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +90 -5
- package/node_modules/@kardalum/api-schemas/dist/experimental-points.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/experimental-points.js +250 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection-callers.d.ts +29 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection-callers.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection.js +12 -0
- package/node_modules/@kardalum/api-schemas/dist/graphql-limits.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/graphql-limits.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/held-embed-words.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/held-embed-words.js +70 -0
- package/node_modules/@kardalum/api-schemas/dist/html-scan.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/html-scan.js +122 -0
- package/node_modules/@kardalum/api-schemas/dist/html-start-tags.d.ts +48 -0
- package/node_modules/@kardalum/api-schemas/dist/html-start-tags.js +381 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +162 -48
- package/node_modules/@kardalum/api-schemas/dist/index.js +137 -30
- package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/json-depth.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/json-depth.js +20 -0
- package/node_modules/@kardalum/api-schemas/dist/legal-anchors.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/legal-anchors.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +63 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +54 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.d.ts +226 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +409 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.d.ts +145 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.js +154 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +490 -10
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +53 -3
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +15 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.d.ts +131 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.js +272 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.d.ts +84 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.js +138 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.d.ts +20 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.js +49 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.d.ts +211 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.js +424 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.d.ts +78 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.js +43 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +38 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +13 -1
- package/node_modules/@kardalum/api-schemas/dist/media-move.schema.d.ts +75 -0
- package/node_modules/@kardalum/api-schemas/dist/media-move.schema.js +53 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.d.ts +204 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.js +370 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.d.ts +60 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +333 -0
- package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +5 -5
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +1 -2
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +1 -2
- package/node_modules/@kardalum/api-schemas/dist/notification-kinds.d.ts +145 -0
- package/node_modules/@kardalum/api-schemas/dist/notification-kinds.js +177 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +258 -7
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +96 -5
- package/node_modules/@kardalum/api-schemas/dist/page-address.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/page-address.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/page-audience.schema.d.ts +87 -0
- package/node_modules/@kardalum/api-schemas/dist/page-audience.schema.js +44 -0
- package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.d.ts +34 -0
- package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +28 -3
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +55 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-admin-slots.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-admin-slots.js +61 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-caller.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-caller.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.d.ts +76 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.js +316 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.d.ts +44 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +84 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-slots.d.ts +136 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-slots.js +254 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-checks.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-checks.js +66 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-document.d.ts +130 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-document.js +173 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-fetch.d.ts +16 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-fetch.js +112 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-schema.js +380 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-types.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-types.js +68 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.d.ts +31 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.js +131 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +44 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +44 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +16 -5
- package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.d.ts +228 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.js +41 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.d.ts +34 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +102 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +43 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +126 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-events.d.ts +24 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-events.js +53 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.js +51 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.d.ts +32 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.js +102 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-guards.d.ts +112 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-guards.js +118 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.d.ts +119 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +216 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.js +21 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +46 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +41 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +304 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +220 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-kept-parts.d.ts +138 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-kept-parts.js +110 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +29 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +32 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +120 -14
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +408 -14
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +307 -23
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +23 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +61 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.d.ts +40 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.js +139 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +23 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +37 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.d.ts +25 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.js +43 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.d.ts +107 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.js +150 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.d.ts +346 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +461 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-rich-text.d.ts +638 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-rich-text.js +533 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.d.ts +45 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.js +99 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.d.ts +68 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.js +114 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-call.d.ts +36 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-call.js +32 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-connections.d.ts +193 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-connections.js +123 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-declarations.d.ts +209 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-declarations.js +372 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-services.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-services.js +204 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.d.ts +352 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +409 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +347 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +976 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-requests.d.ts +69 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-requests.js +149 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +47 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-styles.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-styles.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.d.ts +45 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.js +197 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-uploads.d.ts +96 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-uploads.js +185 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-user-accounts.d.ts +213 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-user-accounts.js +131 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-view-kit.d.ts +54 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-view-kit.js +154 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-visitor-points.d.ts +37 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-visitor-points.js +124 -0
- package/node_modules/@kardalum/api-schemas/dist/plural-rules.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/plural-rules.js +41 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +100 -12
- package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.d.ts +189 -0
- package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.js +164 -0
- package/node_modules/@kardalum/api-schemas/dist/render-cache.d.ts +126 -0
- package/node_modules/@kardalum/api-schemas/dist/render-cache.js +263 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +307 -4
- package/node_modules/@kardalum/api-schemas/dist/render-editing.js +61 -0
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +7 -3
- package/node_modules/@kardalum/api-schemas/dist/rich-text-paste-hosts.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-paste-hosts.js +108 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.d.ts +71 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +540 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.d.ts +66 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.js +394 -0
- package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.d.ts +82 -0
- package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.js +99 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +28 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +201 -1
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +36 -0
- package/node_modules/@kardalum/api-schemas/dist/security-overview.schema.d.ts +64 -0
- package/node_modules/@kardalum/api-schemas/dist/security-overview.schema.js +38 -0
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +97 -8
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +64 -1
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +136 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +53 -2
- package/node_modules/@kardalum/api-schemas/dist/sign-in-steps.d.ts +724 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in-steps.js +408 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.d.ts +386 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +618 -0
- package/node_modules/@kardalum/api-schemas/dist/site-consent.d.ts +77 -0
- package/node_modules/@kardalum/api-schemas/dist/site-consent.js +122 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.js +26 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +188 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +33 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +26 -1
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.js +29 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +72 -1
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +36 -3
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +5 -1
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +4 -3
- package/node_modules/@kardalum/api-schemas/dist/visitor-accounts.d.ts +482 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-accounts.js +380 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-groups.d.ts +109 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-groups.js +62 -0
- package/node_modules/@kardalum/api-schemas/package.json +2 -0
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +15 -1
- package/node_modules/@kardalum/design-tokens/dist/system-dark.css +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +7 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +2 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +19 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +18 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +13 -4
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +5 -1
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +38 -2
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +17 -2
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +17 -10
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +625 -35
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -0
- package/node_modules/@kardalum/plugin-package/dist/cms-range.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/cms-range.js +353 -0
- package/node_modules/@kardalum/plugin-package/dist/contract-fingerprint.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/contract-fingerprint.js +39 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/admin-styles.d.ts +23 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/admin-styles.js +351 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.js +26 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +3 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.js +47 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +2 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.js +40 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.js +22 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +3 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +76 -6
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.d.ts +27 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.js +99 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +9 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.js +68 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +316 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +40 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/rich-text.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/rich-text.js +173 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +91 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.d.ts +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.js +150 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/services-events.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/services-events.js +35 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sign-in-steps.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sign-in-steps.js +71 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.js +69 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +21 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/user-accounts.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/user-accounts.js +36 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/visitor-points.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/visitor-points.js +33 -0
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +8 -2
- package/node_modules/@kardalum/plugin-package/dist/index.js +7 -1
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +75 -0
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +123 -0
- package/node_modules/@kardalum/plugin-package/dist/public-suffix.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/public-suffix.js +23 -0
- package/node_modules/@kardalum/plugin-package/dist/rich-text-summary.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/rich-text-summary.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/stylesheet-load-hook.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/stylesheet-load-hook.js +28 -0
- package/node_modules/@kardalum/plugin-package/package.json +4 -0
- package/node_modules/@kardalum/ui/dist/components/select.d.ts +6 -0
- package/node_modules/@kardalum/ui/dist/components/select.js +7 -0
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/textarea.d.ts +6 -0
- package/node_modules/@kardalum/ui/dist/components/textarea.js +7 -0
- package/node_modules/@kardalum/ui/dist/components/tooltip.js +1 -2
- package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +6 -1
- package/node_modules/@kardalum/ui/dist/components/truncated-text.js +5 -4
- package/node_modules/@kardalum/ui/dist/index.d.ts +2 -0
- package/node_modules/@kardalum/ui/dist/index.js +2 -0
- package/package.json +25 -3
|
@@ -3,7 +3,8 @@ import { useId, useState } from "react";
|
|
|
3
3
|
import { CONTENT_LIST_PROPERTIES, } from "@kardalum/api-schemas";
|
|
4
4
|
import { Button, Input } from "@kardalum/ui";
|
|
5
5
|
import { useContentHost, usePluginSettingsValue } from "../plugin-context.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useSdkString } from "../sdk-strings.js";
|
|
7
|
+
import { CONTENT_LIST_PROPERTY_KEYS, contentListColumnKey, findFieldInTypes, resolveContentListColumns, } from "./content-list-view.js";
|
|
7
8
|
// The Content List datatype's column picker (S232). Rendered by the Data
|
|
8
9
|
// Types editor only, so it takes the settings-EDITING hook
|
|
9
10
|
// (usePluginSettingsValue), the same split every other built-in settings
|
|
@@ -19,6 +20,7 @@ export function ContentListSettingsView() {
|
|
|
19
20
|
const aliasId = useId();
|
|
20
21
|
const labelIdPrefix = useId();
|
|
21
22
|
const [alias, setAlias] = useState("");
|
|
23
|
+
const s = useSdkString();
|
|
22
24
|
const columns = resolveContentListColumns(settings);
|
|
23
25
|
const documentTypes = host?.documentTypes;
|
|
24
26
|
const chosenProperties = new Set(columns.flatMap((column) => (column.kind === "property" ? [column.property] : [])));
|
|
@@ -81,17 +83,19 @@ export function ContentListSettingsView() {
|
|
|
81
83
|
// the column it acts on, as the row itself names it.
|
|
82
84
|
function label(column) {
|
|
83
85
|
if (column.kind === "property")
|
|
84
|
-
return
|
|
86
|
+
return s(CONTENT_LIST_PROPERTY_KEYS[column.property]);
|
|
85
87
|
const found = findFieldInTypes(column.fieldId, documentTypes);
|
|
86
|
-
return found
|
|
88
|
+
return found
|
|
89
|
+
? s("contentListSettings.fieldColumn", { alias: column.fieldId, type: found.typeName, field: found.fieldName })
|
|
90
|
+
: column.fieldId;
|
|
87
91
|
}
|
|
88
|
-
return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx("ul", { className: "flex flex-col gap-2", children: columns.map((column, index) => (_jsxs("li", { className: "flex flex-wrap items-end gap-2 rounded-md border border-border-default p-2", children: [_jsx("span", { className: "text-sm text-text-primary", children: label(column) }), column.kind === "field" && (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { htmlFor: `${labelIdPrefix}-${index}`, className: "text-xs font-medium text-text-secondary", children: "
|
|
92
|
+
return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx("ul", { className: "flex flex-col gap-2", children: columns.map((column, index) => (_jsxs("li", { className: "flex flex-wrap items-end gap-2 rounded-md border border-border-default p-2", children: [_jsx("span", { className: "text-sm text-text-primary", children: label(column) }), column.kind === "field" && (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { htmlFor: `${labelIdPrefix}-${index}`, className: "text-xs font-medium text-text-secondary", children: s("contentListSettings.label") }), _jsx(Input, { id: `${labelIdPrefix}-${index}`, value: column.label ?? "", onChange: (event) => setLabel(index, event.target.value) })] })), _jsxs("div", { className: "flex items-center gap-1 ms-auto", children: [_jsx(Button, { type: "button", variant: "ghost", size: "sm", "aria-label": s("contentListSettings.moveUpNamed", { column: label(column) }), disabled: index === 0, onClick: () => move(index, -1), children: s("contentListSettings.moveUp") }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", "aria-label": s("contentListSettings.moveDownNamed", { column: label(column) }), disabled: index === columns.length - 1, onClick: () => move(index, 1), children: s("contentListSettings.moveDown") }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", "aria-label": s("contentListSettings.removeNamed", { column: label(column) }), disabled: columns.length <= 1, onClick: () => remove(index), children: s("contentListSettings.remove") })] })] }, contentListColumnKey(column)))) }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { htmlFor: addId, className: "text-xs font-medium text-text-secondary", children: s("contentListSettings.addColumn") }), _jsxs("select", { id: addId, value: "", className: SELECT_CLASS, onChange: (event) => handlePick(event.target.value), children: [_jsx("option", { value: "", children: s("contentListSettings.chooseColumn") }), availableProperties.length > 0 && (_jsx("optgroup", { label: s("contentListSettings.properties"), children: availableProperties.map((property) => (_jsx("option", { value: `${PROPERTY_PREFIX}${property}`, children: s(CONTENT_LIST_PROPERTY_KEYS[property]) }, property))) })), (documentTypes ?? []).map((documentType) => {
|
|
89
93
|
const fields = documentType.fields.filter((field) => !chosenFieldIds.has(field.id));
|
|
90
94
|
if (fields.length === 0)
|
|
91
95
|
return null;
|
|
92
|
-
return (_jsx("optgroup", { label: documentType.name, children: fields.map((field) => (_jsx("option", { value: `${FIELD_PREFIX}${field.id}`, children:
|
|
93
|
-
})] })] }), _jsxs("div", { className: "flex flex-wrap items-end gap-2", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { htmlFor: aliasId, className: "text-xs font-medium text-text-secondary", children: "
|
|
96
|
+
return (_jsx("optgroup", { label: documentType.name, children: fields.map((field) => (_jsx("option", { value: `${FIELD_PREFIX}${field.id}`, children: s("contentListSettings.fieldOption", { field: field.name, alias: field.id }) }, field.id))) }, documentType.id));
|
|
97
|
+
})] })] }), _jsxs("div", { className: "flex flex-wrap items-end gap-2", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { htmlFor: aliasId, className: "text-xs font-medium text-text-secondary", children: s("contentListSettings.otherAlias") }), _jsx(Input, { id: aliasId, value: alias, onChange: (event) => setAlias(event.target.value) })] }), _jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
94
98
|
addField(alias);
|
|
95
99
|
setAlias("");
|
|
96
|
-
}, children: "
|
|
100
|
+
}, children: s("contentListSettings.add") })] })] }));
|
|
97
101
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { CONTENT_LIST_PROPERTIES, type ContentListColumn, type ContentListSettings } from "@kardalum/api-schemas";
|
|
2
2
|
import { type ContentHostDocumentType } from "../plugin-context.js";
|
|
3
|
+
import { type SdkStringKey, type SdkTranslate } from "../sdk-strings.js";
|
|
3
4
|
export type ContentListProperty = (typeof CONTENT_LIST_PROPERTIES)[number];
|
|
4
|
-
/** Column headers for the six built-in row properties
|
|
5
|
-
|
|
5
|
+
/** Column headers for the six built-in row properties, as keys of the
|
|
6
|
+
* SDK's strings (S366f D11). */
|
|
7
|
+
export declare const CONTENT_LIST_PROPERTY_KEYS: Readonly<Record<ContentListProperty, SdkStringKey>>;
|
|
6
8
|
export declare const CONTENT_LIST_HEADER_CELL_CLASS = "border-b border-border-default px-2 py-2 text-start text-xs font-medium text-text-secondary";
|
|
7
9
|
/** A stable React key (and a settings identity) for one column. */
|
|
8
10
|
export declare function contentListColumnKey(column: ContentListColumn): string;
|
|
@@ -13,7 +15,7 @@ export declare function findFieldInTypes(fieldId: string, documentTypes: Content
|
|
|
13
15
|
} | null;
|
|
14
16
|
/** The header text for a column: an explicit label wins, then the field's
|
|
15
17
|
* own name where a document type declares it, then the raw alias. */
|
|
16
|
-
export declare function contentListColumnHeader(column: ContentListColumn, documentTypes: ContentHostDocumentType[] | undefined): string;
|
|
18
|
+
export declare function contentListColumnHeader(column: ContentListColumn, documentTypes: ContentHostDocumentType[] | undefined, s: SdkTranslate): string;
|
|
17
19
|
export declare function resolveContentListColumns(settings: Partial<ContentListSettings>): ContentListColumn[];
|
|
18
20
|
export declare function ContentListInputView(): import("react").JSX.Element;
|
|
19
21
|
export declare function ContentListReadOnlyView(): import("react").JSX.Element;
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { CONTENT_LIST_DEFAULT_SETTINGS, } from "@kardalum/api-schemas";
|
|
4
|
-
import { Badge, Button, Input } from "@kardalum/ui";
|
|
5
|
-
import { Lock } from "lucide-react";
|
|
3
|
+
import { BULK_ACTION_ROWS_MAX, CONTENT_LIST_DEFAULT_SETTINGS, LIST_FILTER_UNAVAILABLE_CODE, } from "@kardalum/api-schemas";
|
|
4
|
+
import { Badge, Button, Checkbox, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, IconTooltip, Input, } from "@kardalum/ui";
|
|
5
|
+
import { Ellipsis, Lock } from "lucide-react";
|
|
6
|
+
import { useContentListExtensions } from "../content-list-extensions.js";
|
|
6
7
|
import { MANAGE_API, useContentHost, usePluginApi, usePluginSettings, } from "../plugin-context.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
import { useAdminChromeProps, useContentTypingProps, useSdkLocale, useSdkString, } from "../sdk-strings.js";
|
|
9
|
+
/** Column headers for the six built-in row properties, as keys of the
|
|
10
|
+
* SDK's strings (S366f D11). */
|
|
11
|
+
export const CONTENT_LIST_PROPERTY_KEYS = {
|
|
12
|
+
name: "contentList.propertyName",
|
|
13
|
+
id: "contentList.propertyId",
|
|
14
|
+
url: "contentList.propertyUrl",
|
|
15
|
+
status: "contentList.propertyStatus",
|
|
16
|
+
updatedAt: "contentList.propertyUpdatedAt",
|
|
17
|
+
publishedAt: "contentList.propertyPublishedAt",
|
|
15
18
|
};
|
|
16
|
-
const
|
|
17
|
-
draft: "
|
|
18
|
-
published: "
|
|
19
|
-
changes: "
|
|
19
|
+
const STATUS_KEYS = {
|
|
20
|
+
draft: "contentList.statusDraft",
|
|
21
|
+
published: "contentList.statusPublished",
|
|
22
|
+
changes: "contentList.statusChanges",
|
|
20
23
|
};
|
|
21
24
|
const STATUS_VARIANTS = {
|
|
22
25
|
draft: "neutral",
|
|
@@ -25,25 +28,49 @@ const STATUS_VARIANTS = {
|
|
|
25
28
|
};
|
|
26
29
|
const PAGE_SIZE = 25;
|
|
27
30
|
const SEARCH_DEBOUNCE_MS = 300;
|
|
28
|
-
const LOAD_ERROR = "Could not load the children.";
|
|
29
31
|
// S278b (D1, D14): what a locked row says. A row the person may not read
|
|
30
32
|
// arrives with `fields: {}` (its name, url and status stay), so its field
|
|
31
|
-
// cells say so instead of rendering as empty.
|
|
32
|
-
const RESTRICTED_FOR_YOU = "Restricted for you";
|
|
33
|
-
const RESTRICTED_CELL = "Restricted";
|
|
33
|
+
// cells say so instead of rendering as empty (contentList.restricted).
|
|
34
34
|
/** D1: a restriction refused one of the row's actions. A refusal by the
|
|
35
35
|
* role is not the page's doing, so it lights no lock. */
|
|
36
36
|
function isRestrictedForYou(row) {
|
|
37
37
|
return Object.values(row.access?.denied ?? {}).some((denial) => denial?.reason === "not-granted");
|
|
38
38
|
}
|
|
39
39
|
function LockMark() {
|
|
40
|
-
|
|
40
|
+
const s = useSdkString();
|
|
41
|
+
return (_jsx("span", { role: "img", "aria-label": s("contentList.restrictedForYou"), className: "inline-flex shrink-0 text-text-tertiary", children: _jsx(Lock, { "aria-hidden": "true", className: "size-3" }) }));
|
|
41
42
|
}
|
|
42
43
|
// The row's own keyboard stop: the name is the only control in a row, so
|
|
43
44
|
// it carries the focus ring the row would otherwise need.
|
|
44
45
|
const NAME_BUTTON_CLASS = "text-start text-sm font-medium text-primary-600 hover:underline " +
|
|
45
46
|
"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600";
|
|
46
47
|
export const CONTENT_LIST_HEADER_CELL_CLASS = "border-b border-border-default px-2 py-2 text-start text-xs font-medium text-text-secondary";
|
|
48
|
+
// M35 C2: a row's menu trigger, the tree row's own shape (a square icon button).
|
|
49
|
+
const ROW_MENU_TRIGGER_CLASS = "grid size-6 place-items-center rounded-md text-text-secondary hover:bg-background-hover hover:text-text-primary " +
|
|
50
|
+
"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600";
|
|
51
|
+
// M35 C2: the filter select looks like the search box beside it (the Input component's own classes).
|
|
52
|
+
const FILTER_SELECT_CLASS = "flex h-10 rounded-md border border-border-strong bg-background-elevated px-3 py-2 text-sm text-text-primary " +
|
|
53
|
+
"transition-colors duration-fast focus-visible:border-primary-600 focus-visible:outline-hidden " +
|
|
54
|
+
"focus-visible:ring-4 focus-visible:ring-primary-50";
|
|
55
|
+
// M35 C2 (W5): a filter choice is `<key>::<value>`; `::` occurs in neither (a key is a plugin id and a
|
|
56
|
+
// slot id, a value an option value: none holds a ":"). "" is All pages.
|
|
57
|
+
const FILTER_CHOICE_SEPARATOR = "::";
|
|
58
|
+
function mergePluginCells(previous, answer, rowIds) {
|
|
59
|
+
const next = { ...previous };
|
|
60
|
+
for (const [key, column] of Object.entries(answer)) {
|
|
61
|
+
const before = next[key] ?? { failed: false, cells: {} };
|
|
62
|
+
if (column.failed) {
|
|
63
|
+
next[key] = { failed: true, cells: before.cells };
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const cells = { ...before.cells };
|
|
67
|
+
for (const id of rowIds) {
|
|
68
|
+
cells[id] = Object.prototype.hasOwnProperty.call(column.cells, id) ? (column.cells[id] ?? null) : null;
|
|
69
|
+
}
|
|
70
|
+
next[key] = { failed: before.failed, cells };
|
|
71
|
+
}
|
|
72
|
+
return next;
|
|
73
|
+
}
|
|
47
74
|
/** A stable React key (and a settings identity) for one column. */
|
|
48
75
|
export function contentListColumnKey(column) {
|
|
49
76
|
return column.kind === "property" ? `property:${column.property}` : `field:${column.fieldId}`;
|
|
@@ -59,9 +86,9 @@ export function findFieldInTypes(fieldId, documentTypes) {
|
|
|
59
86
|
}
|
|
60
87
|
/** The header text for a column: an explicit label wins, then the field's
|
|
61
88
|
* own name where a document type declares it, then the raw alias. */
|
|
62
|
-
export function contentListColumnHeader(column, documentTypes) {
|
|
89
|
+
export function contentListColumnHeader(column, documentTypes, s) {
|
|
63
90
|
if (column.kind === "property")
|
|
64
|
-
return
|
|
91
|
+
return s(CONTENT_LIST_PROPERTY_KEYS[column.property]);
|
|
65
92
|
if (column.label)
|
|
66
93
|
return column.label;
|
|
67
94
|
return findFieldInTypes(column.fieldId, documentTypes)?.fieldName ?? column.fieldId;
|
|
@@ -73,7 +100,7 @@ export function contentListColumnHeader(column, documentTypes) {
|
|
|
73
100
|
export function resolveContentListColumns(settings) {
|
|
74
101
|
return settings.columns && settings.columns.length > 0 ? settings.columns : CONTENT_LIST_DEFAULT_SETTINGS.columns;
|
|
75
102
|
}
|
|
76
|
-
function renderFieldValue(value) {
|
|
103
|
+
function renderFieldValue(value, s) {
|
|
77
104
|
if (value === undefined || value === null)
|
|
78
105
|
return null;
|
|
79
106
|
if (typeof value === "string")
|
|
@@ -81,23 +108,23 @@ function renderFieldValue(value) {
|
|
|
81
108
|
if (typeof value === "number")
|
|
82
109
|
return _jsx("span", { dir: "auto", children: String(value) });
|
|
83
110
|
if (typeof value === "boolean")
|
|
84
|
-
return value ? "
|
|
111
|
+
return value ? s("contentList.yes") : s("contentList.no");
|
|
85
112
|
if (typeof value !== "object")
|
|
86
|
-
return "
|
|
113
|
+
return s("contentList.value");
|
|
87
114
|
const candidate = value;
|
|
88
115
|
// A TipTap/ProseMirror document. Deliberately named rather than
|
|
89
116
|
// flattened to text: a list cell is not where a body is read, and a
|
|
90
117
|
// partial flattening would misrepresent what the field holds.
|
|
91
118
|
if (candidate["type"] === "doc")
|
|
92
|
-
return "
|
|
119
|
+
return s("contentList.valueRichText");
|
|
93
120
|
if (candidate["type"] === undefined && (candidate["mediaId"] !== undefined || candidate["id"] !== undefined)) {
|
|
94
|
-
return "
|
|
121
|
+
return s("contentList.valueImage");
|
|
95
122
|
}
|
|
96
123
|
// The built-in date range's real member names (built-in-value-schemas.ts
|
|
97
124
|
// and date-range-view.tsx), not from/to.
|
|
98
125
|
if (candidate["start"] !== undefined || candidate["end"] !== undefined)
|
|
99
|
-
return "
|
|
100
|
-
return "
|
|
126
|
+
return s("contentList.valueDateRange");
|
|
127
|
+
return s("contentList.value");
|
|
101
128
|
}
|
|
102
129
|
// A stored timestamp can be malformed (a hand-edited row, an import), and
|
|
103
130
|
// a list cell is not the place to take the whole editing screen down over
|
|
@@ -115,6 +142,14 @@ function ContentListTable({ canCreate = false }) {
|
|
|
115
142
|
const fetchApi = usePluginApi();
|
|
116
143
|
const settings = usePluginSettings();
|
|
117
144
|
const searchId = useId();
|
|
145
|
+
const s = useSdkString();
|
|
146
|
+
const locale = useSdkLocale();
|
|
147
|
+
const chrome = useAdminChromeProps();
|
|
148
|
+
const typing = useContentTypingProps();
|
|
149
|
+
// M35 C2 (W5): the plugin columns, filters and actions the admin hands this table; null elsewhere
|
|
150
|
+
// (a plugin's own tests, the dev harness), and then the table is exactly as before.
|
|
151
|
+
const extensions = useContentListExtensions();
|
|
152
|
+
const filterId = useId();
|
|
118
153
|
const columns = useMemo(() => resolveContentListColumns(settings), [settings]);
|
|
119
154
|
// Only the aliases the configured columns actually show, so the
|
|
120
155
|
// response stays bounded by the table rather than the whole document.
|
|
@@ -130,6 +165,22 @@ function ContentListTable({ canCreate = false }) {
|
|
|
130
165
|
// starting over. null is the first page, which is also what a failed
|
|
131
166
|
// first page should retry.
|
|
132
167
|
const [failedCursor, setFailedCursor] = useState(null);
|
|
168
|
+
const [filterChoice, setFilterChoice] = useState("");
|
|
169
|
+
const [pluginCells, setPluginCells] = useState({});
|
|
170
|
+
const [scanCapped, setScanCapped] = useState(false);
|
|
171
|
+
const [filterFailed, setFilterFailed] = useState(false);
|
|
172
|
+
// Bumped whenever the list starts over, so a column answer for the rows of a list that was replaced
|
|
173
|
+
// (a new search, a filter change) is dropped. An append keeps it: Load more does not make the cells
|
|
174
|
+
// of the pages already shown stale.
|
|
175
|
+
const listGeneration = useRef(0);
|
|
176
|
+
// M35 C2: the rows chosen for a bulk action, by id. It survives Load more and is cleared by a new
|
|
177
|
+
// search, a filter change or a refresh. At most BULK_ACTION_ROWS_MAX; a tick past it is refused and
|
|
178
|
+
// `selectionLimitHit` says so.
|
|
179
|
+
const [selected, setSelected] = useState(() => new Set());
|
|
180
|
+
const [selectionLimitHit, setSelectionLimitHit] = useState(false);
|
|
181
|
+
const rowMenuTriggers = useRef(new Map());
|
|
182
|
+
const bulkButtons = useRef(new Map());
|
|
183
|
+
const selectLoadedRef = useRef(null);
|
|
133
184
|
// Set when Load more is clicked, to the row index the first appended row
|
|
134
185
|
// will land on. Load more can be the last page, in which case the button
|
|
135
186
|
// unmounts and focus would fall to the body.
|
|
@@ -150,29 +201,81 @@ function ContentListTable({ canCreate = false }) {
|
|
|
150
201
|
// Guards against an out-of-order response overwriting a newer one
|
|
151
202
|
// (a slow first page landing after a fast filtered page).
|
|
152
203
|
const id = ++requestId.current;
|
|
204
|
+
if (!cursor)
|
|
205
|
+
listGeneration.current += 1;
|
|
206
|
+
const generation = listGeneration.current;
|
|
153
207
|
setLoading(true);
|
|
154
208
|
setError(null);
|
|
209
|
+
setFilterFailed(false);
|
|
155
210
|
try {
|
|
156
211
|
const params = new URLSearchParams({ limit: String(PAGE_SIZE) });
|
|
157
212
|
if (fieldsParam)
|
|
158
213
|
params.set("fields", fieldsParam);
|
|
159
214
|
if (appliedSearch)
|
|
160
215
|
params.set("name", appliedSearch);
|
|
216
|
+
if (filterChoice) {
|
|
217
|
+
const at = filterChoice.indexOf(FILTER_CHOICE_SEPARATOR);
|
|
218
|
+
params.set("filter", filterChoice.slice(0, at));
|
|
219
|
+
params.set("filterValue", filterChoice.slice(at + FILTER_CHOICE_SEPARATOR.length));
|
|
220
|
+
// The filter matches in the language the plugin columns are read in.
|
|
221
|
+
if (extensions?.culture)
|
|
222
|
+
params.set("culture", extensions.culture);
|
|
223
|
+
}
|
|
161
224
|
if (cursor)
|
|
162
225
|
params.set("cursor", cursor);
|
|
163
226
|
const response = await fetchApi(`${MANAGE_API}/content/${nodeId}/list?${params.toString()}`);
|
|
164
|
-
if (!response.ok)
|
|
227
|
+
if (!response.ok) {
|
|
228
|
+
// A filter the plugin could not answer is its own state, not the list failing: the person
|
|
229
|
+
// can try again or go back to All pages. Any other refusal is the existing error.
|
|
230
|
+
let code;
|
|
231
|
+
try {
|
|
232
|
+
code = (await response.json())?.code;
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
code = undefined;
|
|
236
|
+
}
|
|
237
|
+
if (code === LIST_FILTER_UNAVAILABLE_CODE) {
|
|
238
|
+
if (id !== requestId.current)
|
|
239
|
+
return;
|
|
240
|
+
if (!cursor)
|
|
241
|
+
setItems([]);
|
|
242
|
+
// Retry asks for this page again, so a failed Load more keeps its place in the list.
|
|
243
|
+
setFailedCursor(cursor);
|
|
244
|
+
setNextCursor(null);
|
|
245
|
+
setScanCapped(false);
|
|
246
|
+
setFilterFailed(true);
|
|
247
|
+
focusRowIndex.current = null;
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
165
250
|
throw new Error(`Request failed (${response.status})`);
|
|
251
|
+
}
|
|
166
252
|
const body = (await response.json());
|
|
167
253
|
if (id !== requestId.current)
|
|
168
254
|
return;
|
|
169
255
|
setItems((previous) => (cursor ? [...previous, ...body.items] : body.items));
|
|
170
256
|
setNextCursor(body.nextCursor);
|
|
257
|
+
setScanCapped(body.scanCapped === true);
|
|
258
|
+
if (!cursor)
|
|
259
|
+
setPluginCells({});
|
|
260
|
+
const rowIds = body.items.map((row) => row.id);
|
|
261
|
+
if (extensions && extensions.columns.length > 0 && rowIds.length > 0) {
|
|
262
|
+
void extensions.loadCells(rowIds).then((answer) => {
|
|
263
|
+
if (generation !== listGeneration.current)
|
|
264
|
+
return;
|
|
265
|
+
setPluginCells((previous) => mergePluginCells(previous, answer, rowIds));
|
|
266
|
+
}, () => {
|
|
267
|
+
// loadCells answers a failed column itself; a throw is the same failure for every column.
|
|
268
|
+
if (generation !== listGeneration.current)
|
|
269
|
+
return;
|
|
270
|
+
const failed = Object.fromEntries(extensions.columns.map((column) => [column.key, { failed: true, cells: {} }]));
|
|
271
|
+
setPluginCells((previous) => mergePluginCells(previous, failed, rowIds));
|
|
272
|
+
});
|
|
273
|
+
}
|
|
171
274
|
}
|
|
172
275
|
catch {
|
|
173
276
|
if (id !== requestId.current)
|
|
174
277
|
return;
|
|
175
|
-
setError(
|
|
278
|
+
setError(s("contentList.loadError"));
|
|
176
279
|
setFailedCursor(cursor);
|
|
177
280
|
setNextCursor(null);
|
|
178
281
|
focusRowIndex.current = null;
|
|
@@ -181,7 +284,7 @@ function ContentListTable({ canCreate = false }) {
|
|
|
181
284
|
if (id === requestId.current)
|
|
182
285
|
setLoading(false);
|
|
183
286
|
}
|
|
184
|
-
}, [appliedSearch, fetchApi, fieldsParam, nodeId]);
|
|
287
|
+
}, [appliedSearch, extensions, fetchApi, fieldsParam, filterChoice, nodeId, s]);
|
|
185
288
|
// `load` changes identity whenever the filter does, which is what makes
|
|
186
289
|
// a changed search term restart from the first page: a cursor minted
|
|
187
290
|
// against the unfiltered list points into a different result set and is
|
|
@@ -199,14 +302,33 @@ function ContentListTable({ canCreate = false }) {
|
|
|
199
302
|
if (index === null || items.length <= index)
|
|
200
303
|
return;
|
|
201
304
|
focusRowIndex.current = null;
|
|
202
|
-
|
|
305
|
+
// The name button by its mark: a row's checkbox and menu trigger are buttons too (M35 C2).
|
|
306
|
+
bodyRef.current?.querySelectorAll("tr")[index]?.querySelector("button[data-content-list-name]")?.focus();
|
|
203
307
|
}, [items]);
|
|
204
|
-
const dateFormat = useMemo(() => new Intl.DateTimeFormat(
|
|
308
|
+
const dateFormat = useMemo(() => new Intl.DateTimeFormat(locale, { dateStyle: "medium" }), [locale]);
|
|
309
|
+
// M35 C2: whenever the list starts over (a new search or filter, new extensions when the editor's or
|
|
310
|
+
// the admin's language switched), it is a different list, so what was chosen in the old one is dropped.
|
|
311
|
+
// `load` changes identity exactly then, as the effect that loads the first page says.
|
|
312
|
+
useEffect(() => {
|
|
313
|
+
setSelected((previous) => (previous.size === 0 ? previous : new Set()));
|
|
314
|
+
setSelectionLimitHit(false);
|
|
315
|
+
}, [load]);
|
|
316
|
+
const clearSelection = useCallback(() => {
|
|
317
|
+
setSelected(new Set());
|
|
318
|
+
setSelectionLimitHit(false);
|
|
319
|
+
}, []);
|
|
320
|
+
// A plugin action that changed pages asks for the first page again; the old selection goes with it.
|
|
321
|
+
const refresh = useCallback(() => {
|
|
322
|
+
clearSelection();
|
|
323
|
+
void load(null);
|
|
324
|
+
}, [clearSelection, load]);
|
|
325
|
+
// M35 C2: each row's tree actions, asked once per list of rows.
|
|
326
|
+
const rowActionLists = useMemo(() => new Map(items.map((row) => [row.id, extensions?.rowActions(row) ?? []])), [items, extensions]);
|
|
205
327
|
// A host with no page (the Data Types editor, which hosts this
|
|
206
328
|
// context only for its document types) is the same state as no host at
|
|
207
329
|
// all as far as a table of children goes.
|
|
208
330
|
if (!host || page === null) {
|
|
209
|
-
return _jsx("p", { className: "text-sm text-text-secondary", children: "
|
|
331
|
+
return _jsx("p", { className: "text-sm text-text-secondary", children: s("contentList.pageOnly") });
|
|
210
332
|
}
|
|
211
333
|
// `page` is passed in rather than closed over: it is narrowed to a real
|
|
212
334
|
// page by the guard above, and TypeScript does not carry that narrowing
|
|
@@ -217,17 +339,17 @@ function ContentListTable({ canCreate = false }) {
|
|
|
217
339
|
// A server from before S276 sent no flags: its rows are all readable.
|
|
218
340
|
const readable = row.access?.read !== false;
|
|
219
341
|
if (column.kind === "field") {
|
|
220
|
-
return readable ? (renderFieldValue(row.fields[column.fieldId])) : (_jsx("span", { className: "text-text-tertiary", children:
|
|
342
|
+
return readable ? (renderFieldValue(row.fields[column.fieldId], s)) : (_jsx("span", { className: "text-text-tertiary", children: s("contentList.restricted") }));
|
|
221
343
|
}
|
|
222
344
|
switch (column.property) {
|
|
223
345
|
case "name":
|
|
224
|
-
return (_jsxs("span", { className: "inline-flex items-center gap-2", children: [readable ? (_jsx("button", { type: "button", dir: "auto", className: NAME_BUTTON_CLASS, onClick: () => page.openContent(row.id), children: row.name })) : (_jsx("span", { dir: "auto", className: "text-sm text-text-tertiary", children: row.name })), isRestrictedForYou(row) && _jsx(LockMark, {})] }));
|
|
346
|
+
return (_jsxs("span", { className: "inline-flex items-center gap-2", children: [readable ? (_jsx("button", { type: "button", dir: "auto", "data-content-list-name": "", className: NAME_BUTTON_CLASS, onClick: () => page.openContent(row.id), children: row.name })) : (_jsx("span", { dir: "auto", className: "text-sm text-text-tertiary", children: row.name })), isRestrictedForYou(row) && _jsx(LockMark, {})] }));
|
|
225
347
|
case "id":
|
|
226
348
|
return _jsx("span", { className: "font-mono text-xs text-text-secondary", children: row.id });
|
|
227
349
|
case "url":
|
|
228
350
|
return _jsx("span", { dir: "auto", children: row.url });
|
|
229
351
|
case "status":
|
|
230
|
-
return _jsx(Badge, { variant: STATUS_VARIANTS[row.status], children:
|
|
352
|
+
return _jsx(Badge, { variant: STATUS_VARIANTS[row.status], children: s(STATUS_KEYS[row.status]) });
|
|
231
353
|
case "updatedAt":
|
|
232
354
|
return formatDate(dateFormat, row.updatedAt);
|
|
233
355
|
case "publishedAt":
|
|
@@ -235,10 +357,91 @@ function ContentListTable({ canCreate = false }) {
|
|
|
235
357
|
}
|
|
236
358
|
}
|
|
237
359
|
const documentTypes = host.documentTypes;
|
|
238
|
-
|
|
360
|
+
const pluginColumns = extensions?.columns ?? [];
|
|
361
|
+
const pluginFilters = extensions?.filters ?? [];
|
|
362
|
+
// M35 C2: a plugin column's cell is the plugin's plain text, rendered as a text child (never HTML).
|
|
363
|
+
function renderPluginCell(row, key) {
|
|
364
|
+
if (row.access?.read === false) {
|
|
365
|
+
return _jsx("span", { className: "text-text-tertiary", children: s("contentList.restricted") });
|
|
366
|
+
}
|
|
367
|
+
const column = pluginCells[key];
|
|
368
|
+
if (column && Object.prototype.hasOwnProperty.call(column.cells, row.id)) {
|
|
369
|
+
const text = column.cells[row.id];
|
|
370
|
+
return text === null || text === undefined ? null : _jsx("span", { dir: "auto", children: text });
|
|
371
|
+
}
|
|
372
|
+
if (column?.failed)
|
|
373
|
+
return _jsx("span", { className: "text-text-tertiary", children: s("contentList.cellUnavailable") });
|
|
374
|
+
return null;
|
|
375
|
+
}
|
|
376
|
+
// M35 C2: row menus show while any loaded row has a tree action; the checkbox column while any bulk
|
|
377
|
+
// action is usable. A row the person may not read can be neither acted on nor selected.
|
|
378
|
+
const anyRowActions = [...rowActionLists.values()].some((list) => list.length > 0);
|
|
379
|
+
const bulkActions = extensions?.bulkActions ?? [];
|
|
380
|
+
const selecting = bulkActions.length > 0;
|
|
381
|
+
const readableRows = items.filter((row) => row.access?.read !== false);
|
|
382
|
+
const selectedRows = items.filter((row) => selected.has(row.id));
|
|
383
|
+
const allLoadedSelected = readableRows.length > 0 && readableRows.every((row) => selected.has(row.id));
|
|
384
|
+
function toggleRow(row) {
|
|
385
|
+
if (selected.has(row.id)) {
|
|
386
|
+
const next = new Set(selected);
|
|
387
|
+
next.delete(row.id);
|
|
388
|
+
setSelected(next);
|
|
389
|
+
setSelectionLimitHit(false);
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (selected.size >= BULK_ACTION_ROWS_MAX) {
|
|
393
|
+
setSelectionLimitHit(true);
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
setSelected(new Set(selected).add(row.id));
|
|
397
|
+
}
|
|
398
|
+
function toggleLoaded() {
|
|
399
|
+
if (allLoadedSelected) {
|
|
400
|
+
clearSelection();
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
const next = new Set(selected);
|
|
404
|
+
for (const row of readableRows) {
|
|
405
|
+
if (next.size >= BULK_ACTION_ROWS_MAX)
|
|
406
|
+
break;
|
|
407
|
+
next.add(row.id);
|
|
408
|
+
}
|
|
409
|
+
setSelected(next);
|
|
410
|
+
setSelectionLimitHit(readableRows.some((row) => !next.has(row.id)));
|
|
411
|
+
}
|
|
412
|
+
function openBulk(key) {
|
|
413
|
+
extensions?.openBulkAction(key, selectedRows, (result) => {
|
|
414
|
+
if (result.refresh) {
|
|
415
|
+
refresh();
|
|
416
|
+
selectLoadedRef.current?.focus();
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
const button = bulkButtons.current.get(key);
|
|
420
|
+
if (button?.isConnected)
|
|
421
|
+
button.focus();
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
function openRowAction(key, row) {
|
|
425
|
+
extensions?.openRowAction(key, row, (result) => {
|
|
426
|
+
if (result.refresh)
|
|
427
|
+
refresh();
|
|
428
|
+
rowMenuTriggers.current.get(row.id)?.focus();
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
return (_jsxs("div", { ...chrome, className: "flex flex-col gap-3", children: [_jsxs("div", { className: "flex flex-wrap items-end gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { htmlFor: searchId, className: "text-xs font-medium text-text-secondary", children: s("contentList.search") }), _jsx(Input, { id: searchId, ...typing, value: search, onChange: (event) => setSearch(event.target.value) })] }), pluginFilters.length > 0 && (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { htmlFor: filterId, className: "text-xs font-medium text-text-secondary", children: s("contentList.filter") }), _jsxs("select", { id: filterId, className: FILTER_SELECT_CLASS, value: filterChoice, onChange: (event) => setFilterChoice(event.target.value), children: [_jsx("option", { value: "", children: s("contentList.filterAll") }), pluginFilters.map((filter) => (_jsx("optgroup", { label: filter.label, children: filter.options.map((option) => (_jsx("option", { value: `${filter.key}${FILTER_CHOICE_SEPARATOR}${option.value}`, children: option.label }, option.value))) }, filter.key)))] })] })), canCreate && (_jsx(Button, { type: "button", className: "ms-auto", onClick: () => page.createChild(page.nodeId), children: s("contentList.new") }))] }), error && (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("p", { role: "alert", className: "text-sm text-danger-600", children: error }), _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => void load(failedCursor), children: s("contentList.retry") })] })), selecting && selected.size > 0 && (_jsxs("div", { role: "group", "aria-label": s("contentList.bulkActionsLabel"), className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "text-sm text-text-secondary", children: s("contentList.selectedCount", { selected: selected.size }) }), bulkActions.map((action) => (_jsx(Button, { ref: (element) => {
|
|
432
|
+
if (element)
|
|
433
|
+
bulkButtons.current.set(action.key, element);
|
|
434
|
+
else
|
|
435
|
+
bulkButtons.current.delete(action.key);
|
|
436
|
+
}, type: "button", variant: "outline", size: "sm", disabled: action.admits !== undefined && !selectedRows.some(action.admits), onClick: () => openBulk(action.key), children: _jsx("span", { dir: "auto", children: action.label }) }, action.key))), _jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: clearSelection, children: s("contentList.clearSelection") })] })), selecting && selectionLimitHit && (_jsx("p", { role: "status", className: "text-sm text-text-secondary", children: s("contentList.selectionLimit", { max: BULK_ACTION_ROWS_MAX }) })), items.length > 0 && (_jsxs("table", { className: "w-full border-collapse text-sm text-text-primary", children: [_jsx("caption", { className: "sr-only", children: s("contentList.caption") }), _jsx("thead", { children: _jsxs("tr", { children: [selecting && (_jsx("th", { scope: "col", className: CONTENT_LIST_HEADER_CELL_CLASS, children: _jsx(Checkbox, { ref: selectLoadedRef, "aria-label": s("contentList.selectLoaded"), checked: allLoadedSelected ? true : selected.size > 0 ? "indeterminate" : false, disabled: readableRows.length === 0, onCheckedChange: toggleLoaded }) })), columns.map((column) => (_jsx("th", { scope: "col", className: CONTENT_LIST_HEADER_CELL_CLASS, children: contentListColumnHeader(column, documentTypes, s) }, contentListColumnKey(column)))), pluginColumns.map((column) => (_jsx("th", { scope: "col", className: CONTENT_LIST_HEADER_CELL_CLASS, children: _jsx("span", { dir: "auto", children: column.header }) }, `plugin:${column.key}`))), anyRowActions && (_jsx("th", { scope: "col", className: CONTENT_LIST_HEADER_CELL_CLASS, children: _jsx("span", { className: "sr-only", children: s("contentList.rowActionsHeader") }) }))] }) }), _jsx("tbody", { ref: bodyRef, children: items.map((row) => (_jsxs("tr", { children: [selecting && (_jsx("td", { className: "border-b border-border-subtle px-2 py-2 align-top", children: _jsx(Checkbox, { "aria-label": s("contentList.select", { name: row.name }), checked: selected.has(row.id), disabled: row.access?.read === false, onCheckedChange: () => toggleRow(row) }) })), columns.map((column) => (_jsx("td", { className: "border-b border-border-subtle px-2 py-2 align-top", children: renderCell(row, column, page) }, contentListColumnKey(column)))), pluginColumns.map((column) => (_jsx("td", { className: "border-b border-border-subtle px-2 py-2 align-top", children: renderPluginCell(row, column.key) }, `plugin:${column.key}`))), anyRowActions && (_jsx("td", { className: "border-b border-border-subtle px-2 py-2 align-top", children: (rowActionLists.get(row.id) ?? []).length > 0 && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(IconTooltip, { children: _jsx("button", { ref: (element) => {
|
|
437
|
+
if (element)
|
|
438
|
+
rowMenuTriggers.current.set(row.id, element);
|
|
439
|
+
else
|
|
440
|
+
rowMenuTriggers.current.delete(row.id);
|
|
441
|
+
}, type: "button", "aria-label": s("contentList.rowActions", { name: row.name }), className: ROW_MENU_TRIGGER_CLASS, children: _jsx(Ellipsis, { "aria-hidden": "true", className: "size-4" }) }) }) }), _jsx(DropdownMenuContent, { align: "end", children: (rowActionLists.get(row.id) ?? []).map((action) => (_jsx(DropdownMenuItem, { onSelect: () => openRowAction(action.key, row), children: _jsx("span", { dir: "auto", children: action.label }) }, action.key))) })] })) }))] }, row.id))) })] })), loading && (_jsx("p", { role: "status", className: "text-sm text-text-secondary", children: s("contentList.loading") })), filterFailed && (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("p", { role: "alert", className: "text-sm text-danger-600", children: s("contentList.filterUnavailable") }), _jsx(Button, { type: "button", variant: "outline", size: "sm", disabled: loading, onClick: () => void load(failedCursor), children: s("contentList.retry") })] })), scanCapped && !loading && (_jsx("p", { role: "status", className: "text-sm text-text-secondary", children: s("contentList.scanCapped") })), !loading && !error && !filterFailed && items.length === 0 && (_jsx("p", { role: "status", className: "text-sm text-text-secondary", children: appliedSearch || filterChoice ? s("contentList.noMatches") : s("contentList.noChildren") })), nextCursor !== null && (_jsx(Button, { type: "button", variant: "outline", size: "sm", className: "self-start", disabled: loading, onClick: () => {
|
|
239
442
|
focusRowIndex.current = items.length;
|
|
240
443
|
void load(nextCursor);
|
|
241
|
-
}, children: "
|
|
444
|
+
}, children: s("contentList.loadMore") }))] }));
|
|
242
445
|
}
|
|
243
446
|
export function ContentListInputView() {
|
|
244
447
|
return _jsx(ContentListTable, { canCreate: true });
|