@maxal_studio/kratosjs-react 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/dist/FieldRenderer.d.ts +13 -0
- package/dist/FieldRenderer.js +62 -0
- package/dist/FormRenderer.d.ts +7 -0
- package/dist/FormRenderer.js +78 -0
- package/dist/TableRenderer.d.ts +2 -0
- package/dist/TableRenderer.js +1 -0
- package/dist/api/actionsApi.d.ts +23 -0
- package/dist/api/actionsApi.js +46 -0
- package/dist/api/authenticatedFetch.d.ts +8 -0
- package/dist/api/authenticatedFetch.js +31 -0
- package/dist/api/exportApi.d.ts +18 -0
- package/dist/api/exportApi.js +50 -0
- package/dist/api/http.d.ts +24 -0
- package/dist/api/http.js +52 -0
- package/dist/api/resourceApi.d.ts +37 -0
- package/dist/api/resourceApi.js +52 -0
- package/dist/api/tableApi.d.ts +83 -0
- package/dist/api/tableApi.js +51 -0
- package/dist/api/urls.d.ts +19 -0
- package/dist/api/urls.js +46 -0
- package/dist/app.d.ts +101 -0
- package/dist/app.js +89 -0
- package/dist/auth/AuthContext.d.ts +22 -0
- package/dist/auth/AuthContext.js +147 -0
- package/dist/auth/LoginPage.d.ts +10 -0
- package/dist/auth/LoginPage.js +179 -0
- package/dist/auth/ProtectedRoute.d.ts +12 -0
- package/dist/auth/ProtectedRoute.js +22 -0
- package/dist/auth/authApiClient.d.ts +24 -0
- package/dist/auth/authApiClient.js +95 -0
- package/dist/auth/types.d.ts +103 -0
- package/dist/auth/types.js +1 -0
- package/dist/components/ActionFormModal.d.ts +22 -0
- package/dist/components/ActionFormModal.js +8 -0
- package/dist/components/AdminPanel.d.ts +11 -0
- package/dist/components/AdminPanel.js +194 -0
- package/dist/components/Checkbox.d.ts +10 -0
- package/dist/components/Checkbox.js +8 -0
- package/dist/components/CheckboxField.d.ts +7 -0
- package/dist/components/CheckboxField.js +26 -0
- package/dist/components/ColorPickerField.d.ts +7 -0
- package/dist/components/ColorPickerField.js +26 -0
- package/dist/components/DateTimePickerField.d.ts +7 -0
- package/dist/components/DateTimePickerField.js +64 -0
- package/dist/components/FileUploadField.d.ts +9 -0
- package/dist/components/FileUploadField.js +478 -0
- package/dist/components/GlobalSearch.d.ts +22 -0
- package/dist/components/GlobalSearch.js +181 -0
- package/dist/components/GroupField.d.ts +7 -0
- package/dist/components/GroupField.js +23 -0
- package/dist/components/HiddenField.d.ts +3 -0
- package/dist/components/HiddenField.js +10 -0
- package/dist/components/ModalBreadcrumb.d.ts +5 -0
- package/dist/components/ModalBreadcrumb.js +33 -0
- package/dist/components/ModalDrawer.d.ts +15 -0
- package/dist/components/ModalDrawer.js +40 -0
- package/dist/components/RadioField.d.ts +7 -0
- package/dist/components/RadioField.js +26 -0
- package/dist/components/RepeaterField.d.ts +3 -0
- package/dist/components/RepeaterField.js +191 -0
- package/dist/components/ResourceModalRenderer.d.ts +10 -0
- package/dist/components/ResourceModalRenderer.js +80 -0
- package/dist/components/RichEditorField.d.ts +3 -0
- package/dist/components/RichEditorField.js +655 -0
- package/dist/components/SectionField.d.ts +9 -0
- package/dist/components/SectionField.js +111 -0
- package/dist/components/SelectField.d.ts +8 -0
- package/dist/components/SelectField.js +523 -0
- package/dist/components/TabsField.d.ts +10 -0
- package/dist/components/TabsField.js +214 -0
- package/dist/components/TagsInputField.d.ts +7 -0
- package/dist/components/TagsInputField.js +172 -0
- package/dist/components/TextInputField.d.ts +7 -0
- package/dist/components/TextInputField.js +44 -0
- package/dist/components/TextareaField.d.ts +7 -0
- package/dist/components/TextareaField.js +31 -0
- package/dist/components/ToggleField.d.ts +7 -0
- package/dist/components/ToggleField.js +57 -0
- package/dist/components/ViewModal.d.ts +25 -0
- package/dist/components/ViewModal.js +159 -0
- package/dist/components/blocks/BlockRenderer.d.ts +7 -0
- package/dist/components/blocks/BlockRenderer.js +36 -0
- package/dist/components/blocks/FormBlockRenderer.d.ts +6 -0
- package/dist/components/blocks/FormBlockRenderer.js +110 -0
- package/dist/components/blocks/TableBlockRenderer.d.ts +6 -0
- package/dist/components/blocks/TableBlockRenderer.js +12 -0
- package/dist/components/blocks/TabsBlockRenderer.d.ts +7 -0
- package/dist/components/blocks/TabsBlockRenderer.js +11 -0
- package/dist/components/blocks/WidgetBlockRenderer.d.ts +6 -0
- package/dist/components/blocks/WidgetBlockRenderer.js +11 -0
- package/dist/components/columns/CheckboxColumnComponent.d.ts +6 -0
- package/dist/components/columns/CheckboxColumnComponent.js +21 -0
- package/dist/components/columns/ColorColumnComponent.d.ts +3 -0
- package/dist/components/columns/ColorColumnComponent.js +11 -0
- package/dist/components/columns/DeeplinkWrapper.d.ts +15 -0
- package/dist/components/columns/DeeplinkWrapper.js +85 -0
- package/dist/components/columns/IconColumnComponent.d.ts +3 -0
- package/dist/components/columns/IconColumnComponent.js +52 -0
- package/dist/components/columns/ImageColumnComponent.d.ts +3 -0
- package/dist/components/columns/ImageColumnComponent.js +98 -0
- package/dist/components/columns/MediaColumnComponent.d.ts +3 -0
- package/dist/components/columns/MediaColumnComponent.js +160 -0
- package/dist/components/columns/SelectColumnComponent.d.ts +6 -0
- package/dist/components/columns/SelectColumnComponent.js +26 -0
- package/dist/components/columns/TagsColumnComponent.d.ts +3 -0
- package/dist/components/columns/TagsColumnComponent.js +18 -0
- package/dist/components/columns/TextColumnComponent.d.ts +11 -0
- package/dist/components/columns/TextColumnComponent.js +107 -0
- package/dist/components/columns/TextInputColumnComponent.d.ts +6 -0
- package/dist/components/columns/TextInputColumnComponent.js +18 -0
- package/dist/components/columns/ToggleColumnComponent.d.ts +6 -0
- package/dist/components/columns/ToggleColumnComponent.js +25 -0
- package/dist/components/columns/VideoColumnComponent.d.ts +3 -0
- package/dist/components/columns/VideoColumnComponent.js +125 -0
- package/dist/components/columns/ViewColumnComponent.d.ts +3 -0
- package/dist/components/columns/ViewColumnComponent.js +7 -0
- package/dist/components/errors/ErrorBoundary.d.ts +23 -0
- package/dist/components/errors/ErrorBoundary.js +33 -0
- package/dist/components/filters/CustomFilterComponent.d.ts +10 -0
- package/dist/components/filters/CustomFilterComponent.js +33 -0
- package/dist/components/filters/DateFilterComponent.d.ts +15 -0
- package/dist/components/filters/DateFilterComponent.js +132 -0
- package/dist/components/filters/QueryBuilderFilterComponent.d.ts +11 -0
- package/dist/components/filters/QueryBuilderFilterComponent.js +200 -0
- package/dist/components/layout/Header.d.ts +10 -0
- package/dist/components/layout/Header.js +70 -0
- package/dist/components/layout/PanelBrandMark.d.ts +8 -0
- package/dist/components/layout/PanelBrandMark.js +28 -0
- package/dist/components/layout/Sidebar.d.ts +35 -0
- package/dist/components/layout/Sidebar.js +125 -0
- package/dist/components/modals/RelationCreateModal.d.ts +19 -0
- package/dist/components/modals/RelationCreateModal.js +57 -0
- package/dist/components/modals/ResourceFormModal.d.ts +37 -0
- package/dist/components/modals/ResourceFormModal.js +44 -0
- package/dist/components/modals/useResourceForm.d.ts +40 -0
- package/dist/components/modals/useResourceForm.js +138 -0
- package/dist/components/modals/view/RecordActions.d.ts +17 -0
- package/dist/components/modals/view/RecordActions.js +16 -0
- package/dist/components/modals/view/RecordDetails.d.ts +13 -0
- package/dist/components/modals/view/RecordDetails.js +29 -0
- package/dist/components/modals/view/RelationPanel.d.ts +18 -0
- package/dist/components/modals/view/RelationPanel.js +16 -0
- package/dist/components/modals/view/RelationTabs.d.ts +32 -0
- package/dist/components/modals/view/RelationTabs.js +42 -0
- package/dist/components/modals/view/useRecordView.d.ts +18 -0
- package/dist/components/modals/view/useRecordView.js +114 -0
- package/dist/components/pages/PageRenderer.d.ts +6 -0
- package/dist/components/pages/PageRenderer.js +107 -0
- package/dist/components/table/ColumnTogglePopup.d.ts +11 -0
- package/dist/components/table/ColumnTogglePopup.js +16 -0
- package/dist/components/table/GridCard.d.ts +21 -0
- package/dist/components/table/GridCard.js +30 -0
- package/dist/components/table/GridView.d.ts +23 -0
- package/dist/components/table/GridView.js +49 -0
- package/dist/components/table/LayoutToggle.d.ts +7 -0
- package/dist/components/table/LayoutToggle.js +9 -0
- package/dist/components/table/TableActionsDropdown.d.ts +13 -0
- package/dist/components/table/TableActionsDropdown.js +46 -0
- package/dist/components/table/TableBulkActions.d.ts +11 -0
- package/dist/components/table/TableBulkActions.js +21 -0
- package/dist/components/table/TableHeader.d.ts +14 -0
- package/dist/components/table/TableHeader.js +23 -0
- package/dist/components/table/TablePagination.d.ts +13 -0
- package/dist/components/table/TablePagination.js +55 -0
- package/dist/components/table/TableRow.d.ts +21 -0
- package/dist/components/table/TableRow.js +32 -0
- package/dist/components/table/TableSearchBar.d.ts +11 -0
- package/dist/components/table/TableSearchBar.js +12 -0
- package/dist/components/table/TableTabs.d.ts +14 -0
- package/dist/components/table/TableTabs.js +8 -0
- package/dist/components/ui/Badge.d.ts +6 -0
- package/dist/components/ui/Badge.js +12 -0
- package/dist/components/ui/Button.d.ts +22 -0
- package/dist/components/ui/Button.js +22 -0
- package/dist/components/ui/Card.d.ts +7 -0
- package/dist/components/ui/Card.js +5 -0
- package/dist/components/ui/ConfirmDialog.d.ts +19 -0
- package/dist/components/ui/ConfirmDialog.js +45 -0
- package/dist/components/ui/EmptyState.d.ts +9 -0
- package/dist/components/ui/EmptyState.js +6 -0
- package/dist/components/ui/ErrorAlert.d.ts +7 -0
- package/dist/components/ui/ErrorAlert.js +9 -0
- package/dist/components/ui/Input.d.ts +11 -0
- package/dist/components/ui/Input.js +10 -0
- package/dist/components/ui/Label.d.ts +5 -0
- package/dist/components/ui/Label.js +5 -0
- package/dist/components/ui/PillButton.d.ts +14 -0
- package/dist/components/ui/PillButton.js +19 -0
- package/dist/components/ui/Select.d.ts +7 -0
- package/dist/components/ui/Select.js +7 -0
- package/dist/components/ui/Spinner.d.ts +8 -0
- package/dist/components/ui/Spinner.js +14 -0
- package/dist/components/ui/Toast.d.ts +21 -0
- package/dist/components/ui/Toast.js +47 -0
- package/dist/components/ui/index.d.ts +24 -0
- package/dist/components/ui/index.js +12 -0
- package/dist/components/utils/HintDisplay.d.ts +11 -0
- package/dist/components/utils/HintDisplay.js +12 -0
- package/dist/components/utils/Icon.d.ts +22 -0
- package/dist/components/utils/Icon.js +22 -0
- package/dist/components/utils/MediaPreviewModal.d.ts +14 -0
- package/dist/components/utils/MediaPreviewModal.js +32 -0
- package/dist/components/utils/ViewFieldWrapper.d.ts +11 -0
- package/dist/components/utils/ViewFieldWrapper.js +9 -0
- package/dist/components/utils/layoutHelpers.d.ts +19 -0
- package/dist/components/utils/layoutHelpers.js +257 -0
- package/dist/components/widgets/ChartWidget.d.ts +16 -0
- package/dist/components/widgets/ChartWidget.js +192 -0
- package/dist/components/widgets/StatsWidget.d.ts +16 -0
- package/dist/components/widgets/StatsWidget.js +39 -0
- package/dist/components/widgets/WidgetRenderer.d.ts +10 -0
- package/dist/components/widgets/WidgetRenderer.js +50 -0
- package/dist/components/widgets/WidgetShell.d.ts +9 -0
- package/dist/components/widgets/WidgetShell.js +7 -0
- package/dist/contexts/AuthChallengeRegistryContext.d.ts +15 -0
- package/dist/contexts/AuthChallengeRegistryContext.js +15 -0
- package/dist/contexts/BlockRegistryContext.d.ts +18 -0
- package/dist/contexts/BlockRegistryContext.js +8 -0
- package/dist/contexts/ColumnRegistryContext.d.ts +8 -0
- package/dist/contexts/ColumnRegistryContext.js +30 -0
- package/dist/contexts/FieldRegistryContext.d.ts +13 -0
- package/dist/contexts/FieldRegistryContext.js +46 -0
- package/dist/contexts/PanelMetadataContext.d.ts +26 -0
- package/dist/contexts/PanelMetadataContext.js +26 -0
- package/dist/contexts/PanelProviders.d.ts +27 -0
- package/dist/contexts/PanelProviders.js +24 -0
- package/dist/contexts/ResourceModalContext.d.ts +26 -0
- package/dist/contexts/ResourceModalContext.js +76 -0
- package/dist/contexts/SlotRegistryContext.d.ts +19 -0
- package/dist/contexts/SlotRegistryContext.js +24 -0
- package/dist/contexts/TableRefreshContext.d.ts +10 -0
- package/dist/contexts/TableRefreshContext.js +30 -0
- package/dist/contexts/WidgetRegistryContext.d.ts +17 -0
- package/dist/contexts/WidgetRegistryContext.js +14 -0
- package/dist/contexts/createRegistryContext.d.ts +19 -0
- package/dist/contexts/createRegistryContext.js +20 -0
- package/dist/hooks/useAfterStateUpdated.d.ts +6 -0
- package/dist/hooks/useAfterStateUpdated.js +62 -0
- package/dist/hooks/useValidation.d.ts +26 -0
- package/dist/hooks/useValidation.js +76 -0
- package/dist/i18n/I18nProvider.d.ts +27 -0
- package/dist/i18n/I18nProvider.js +101 -0
- package/dist/i18n/LocaleSwitcher.d.ts +10 -0
- package/dist/i18n/LocaleSwitcher.js +30 -0
- package/dist/i18n/activeLocale.d.ts +11 -0
- package/dist/i18n/activeLocale.js +34 -0
- package/dist/i18n/buildClientI18n.d.ts +28 -0
- package/dist/i18n/buildClientI18n.js +67 -0
- package/dist/i18n/index.d.ts +11 -0
- package/dist/i18n/index.js +9 -0
- package/dist/i18n/locales/core/en.d.ts +225 -0
- package/dist/i18n/locales/core/en.js +252 -0
- package/dist/i18n/locales/core/index.d.ts +2 -0
- package/dist/i18n/locales/core/index.js +4 -0
- package/dist/i18n/locales/core/sq.d.ts +253 -0
- package/dist/i18n/locales/core/sq.js +255 -0
- package/dist/i18n/useFormatter.d.ts +18 -0
- package/dist/i18n/useFormatter.js +37 -0
- package/dist/i18n/useLocale.d.ts +11 -0
- package/dist/i18n/useLocale.js +11 -0
- package/dist/i18n/useTranslation.d.ts +12 -0
- package/dist/i18n/useTranslation.js +12 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.js +101 -0
- package/dist/pages/ResourceListPage.d.ts +8 -0
- package/dist/pages/ResourceListPage.js +139 -0
- package/dist/plugin.d.ts +79 -0
- package/dist/plugin.js +34 -0
- package/dist/runtime/conditions.d.ts +35 -0
- package/dist/runtime/conditions.js +97 -0
- package/dist/runtime/formTraversal.d.ts +25 -0
- package/dist/runtime/formTraversal.js +37 -0
- package/dist/runtime/serializedFunctions.d.ts +41 -0
- package/dist/runtime/serializedFunctions.js +264 -0
- package/dist/slots/Slot.d.ts +24 -0
- package/dist/slots/Slot.js +29 -0
- package/dist/slots/SlotCluster.d.ts +22 -0
- package/dist/slots/SlotCluster.js +49 -0
- package/dist/slots/index.d.ts +7 -0
- package/dist/slots/index.js +4 -0
- package/dist/slots/mergeSlots.d.ts +18 -0
- package/dist/slots/mergeSlots.js +35 -0
- package/dist/slots/types.d.ts +87 -0
- package/dist/slots/types.js +30 -0
- package/dist/styles.css +1 -0
- package/dist/table/TableContext.d.ts +36 -0
- package/dist/table/TableContext.js +13 -0
- package/dist/table/TableRenderer.d.ts +29 -0
- package/dist/table/TableRenderer.js +159 -0
- package/dist/table/components/FiltersPanel.d.ts +11 -0
- package/dist/table/components/FiltersPanel.js +52 -0
- package/dist/table/components/TableToolbar.d.ts +28 -0
- package/dist/table/components/TableToolbar.js +27 -0
- package/dist/table/components/TableToolbarButton.d.ts +6 -0
- package/dist/table/components/TableToolbarButton.js +9 -0
- package/dist/table/components/TableView.d.ts +12 -0
- package/dist/table/components/TableView.js +21 -0
- package/dist/table/defaultRowActions.d.ts +21 -0
- package/dist/table/defaultRowActions.js +37 -0
- package/dist/table/hooks/useColumnVisibility.d.ts +13 -0
- package/dist/table/hooks/useColumnVisibility.js +59 -0
- package/dist/table/hooks/useEditableRows.d.ts +22 -0
- package/dist/table/hooks/useEditableRows.js +63 -0
- package/dist/table/hooks/useTableActions.d.ts +54 -0
- package/dist/table/hooks/useTableActions.js +313 -0
- package/dist/table/hooks/useTableData.d.ts +28 -0
- package/dist/table/hooks/useTableData.js +63 -0
- package/dist/table/hooks/useTableLayout.d.ts +12 -0
- package/dist/table/hooks/useTableLayout.js +31 -0
- package/dist/table/hooks/useTableQuery.d.ts +29 -0
- package/dist/table/hooks/useTableQuery.js +135 -0
- package/dist/types/index.d.ts +224 -0
- package/dist/types/index.js +6 -0
- package/dist/utils/classNames.d.ts +7 -0
- package/dist/utils/classNames.js +9 -0
- package/dist/utils/columnMediaDimensions.d.ts +13 -0
- package/dist/utils/columnMediaDimensions.js +29 -0
- package/dist/utils/columnVisibilityStorage.d.ts +22 -0
- package/dist/utils/columnVisibilityStorage.js +56 -0
- package/dist/utils/fieldErrors.d.ts +13 -0
- package/dist/utils/fieldErrors.js +25 -0
- package/dist/utils/formatValue.d.ts +28 -0
- package/dist/utils/formatValue.js +109 -0
- package/dist/utils/layoutStorage.d.ts +23 -0
- package/dist/utils/layoutStorage.js +53 -0
- package/dist/utils/redirectHandler.d.ts +7 -0
- package/dist/utils/redirectHandler.js +25 -0
- package/dist/utils/tableFormatters.d.ts +14 -0
- package/dist/utils/tableFormatters.js +93 -0
- package/dist/utils/widgetVisibilityStorage.d.ts +11 -0
- package/dist/utils/widgetVisibilityStorage.js +39 -0
- package/package.json +101 -0
- package/src/FieldRenderer.test.tsx +44 -0
- package/src/FieldRenderer.tsx +104 -0
- package/src/FormRenderer.containers.test.tsx +121 -0
- package/src/FormRenderer.test.tsx +174 -0
- package/src/FormRenderer.tsx +140 -0
- package/src/TableRenderer.tsx +2 -0
- package/src/api/actionsApi.ts +76 -0
- package/src/api/authenticatedFetch.ts +40 -0
- package/src/api/exportApi.ts +66 -0
- package/src/api/http.test.ts +58 -0
- package/src/api/http.ts +68 -0
- package/src/api/resourceApi.ts +88 -0
- package/src/api/tableApi.test.ts +108 -0
- package/src/api/tableApi.ts +107 -0
- package/src/api/urls.ts +50 -0
- package/src/app.test.tsx +67 -0
- package/src/app.tsx +181 -0
- package/src/auth/AuthContext.tsx +188 -0
- package/src/auth/LoginPage.tsx +380 -0
- package/src/auth/ProtectedRoute.tsx +39 -0
- package/src/auth/authApiClient.ts +109 -0
- package/src/auth/authFlow.test.tsx +168 -0
- package/src/auth/types.ts +104 -0
- package/src/components/ActionFormModal.tsx +45 -0
- package/src/components/AdminPanel.tsx +368 -0
- package/src/components/Checkbox.tsx +59 -0
- package/src/components/CheckboxField.tsx +88 -0
- package/src/components/ColorPickerField.tsx +93 -0
- package/src/components/DateTimePickerField.tsx +112 -0
- package/src/components/FileUploadField.tsx +841 -0
- package/src/components/GlobalSearch.tsx +436 -0
- package/src/components/GroupField.tsx +85 -0
- package/src/components/HiddenField.tsx +14 -0
- package/src/components/ModalBreadcrumb.tsx +74 -0
- package/src/components/ModalDrawer.tsx +137 -0
- package/src/components/RadioField.tsx +80 -0
- package/src/components/RepeaterField.tsx +546 -0
- package/src/components/ResourceModalRenderer.tsx +144 -0
- package/src/components/RichEditorField.tsx +942 -0
- package/src/components/SectionField.tsx +242 -0
- package/src/components/SelectField.tsx +843 -0
- package/src/components/TabsField.test.tsx +151 -0
- package/src/components/TabsField.tsx +386 -0
- package/src/components/TagsInputField.tsx +411 -0
- package/src/components/TextInputField.tsx +91 -0
- package/src/components/TextareaField.tsx +110 -0
- package/src/components/ToggleField.tsx +126 -0
- package/src/components/ViewModal.tsx +353 -0
- package/src/components/blocks/BlockRenderer.tsx +56 -0
- package/src/components/blocks/FormBlockRenderer.tsx +160 -0
- package/src/components/blocks/TableBlockRenderer.tsx +33 -0
- package/src/components/blocks/TabsBlockRenderer.tsx +49 -0
- package/src/components/blocks/WidgetBlockRenderer.tsx +19 -0
- package/src/components/columns/CheckboxColumnComponent.tsx +38 -0
- package/src/components/columns/ColorColumnComponent.tsx +23 -0
- package/src/components/columns/CustomColumn.test.tsx +55 -0
- package/src/components/columns/DeeplinkWrapper.tsx +103 -0
- package/src/components/columns/IconColumnComponent.tsx +55 -0
- package/src/components/columns/ImageColumnComponent.tsx +220 -0
- package/src/components/columns/MediaColumnComponent.tsx +294 -0
- package/src/components/columns/SelectColumnComponent.tsx +49 -0
- package/src/components/columns/TagsColumnComponent.tsx +46 -0
- package/src/components/columns/TextColumnComponent.tsx +191 -0
- package/src/components/columns/TextInputColumnComponent.tsx +35 -0
- package/src/components/columns/ToggleColumnComponent.tsx +56 -0
- package/src/components/columns/VideoColumnComponent.tsx +236 -0
- package/src/components/columns/ViewColumnComponent.tsx +9 -0
- package/src/components/errors/ErrorBoundary.tsx +58 -0
- package/src/components/filters/CustomFilterComponent.tsx +130 -0
- package/src/components/filters/DateFilterComponent.tsx +272 -0
- package/src/components/filters/QueryBuilderFilterComponent.tsx +502 -0
- package/src/components/layout/Header.tsx +212 -0
- package/src/components/layout/PanelBrandMark.tsx +61 -0
- package/src/components/layout/Sidebar.tsx +283 -0
- package/src/components/modals/RelationCreateModal.tsx +107 -0
- package/src/components/modals/ResourceFormModal.test.tsx +119 -0
- package/src/components/modals/ResourceFormModal.tsx +128 -0
- package/src/components/modals/useResourceForm.ts +207 -0
- package/src/components/modals/view/RecordActions.tsx +69 -0
- package/src/components/modals/view/RecordDetails.tsx +60 -0
- package/src/components/modals/view/RelationPanel.tsx +76 -0
- package/src/components/modals/view/RelationTabs.tsx +145 -0
- package/src/components/modals/view/useRecordView.ts +134 -0
- package/src/components/pages/PageRenderer.tsx +173 -0
- package/src/components/table/ColumnTogglePopup.tsx +85 -0
- package/src/components/table/GridCard.tsx +155 -0
- package/src/components/table/GridView.tsx +138 -0
- package/src/components/table/LayoutToggle.tsx +24 -0
- package/src/components/table/TableActionsDropdown.tsx +114 -0
- package/src/components/table/TableBulkActions.tsx +65 -0
- package/src/components/table/TableHeader.tsx +96 -0
- package/src/components/table/TablePagination.tsx +169 -0
- package/src/components/table/TableRow.tsx +155 -0
- package/src/components/table/TableSearchBar.tsx +66 -0
- package/src/components/table/TableTabs.tsx +49 -0
- package/src/components/ui/Badge.tsx +30 -0
- package/src/components/ui/Button.test.tsx +78 -0
- package/src/components/ui/Button.tsx +102 -0
- package/src/components/ui/Card.tsx +23 -0
- package/src/components/ui/ConfirmDialog.tsx +112 -0
- package/src/components/ui/EmptyState.tsx +24 -0
- package/src/components/ui/ErrorAlert.tsx +37 -0
- package/src/components/ui/Input.tsx +48 -0
- package/src/components/ui/Label.tsx +15 -0
- package/src/components/ui/PillButton.tsx +72 -0
- package/src/components/ui/Select.tsx +33 -0
- package/src/components/ui/Spinner.tsx +39 -0
- package/src/components/ui/Toast.tsx +105 -0
- package/src/components/ui/index.ts +24 -0
- package/src/components/utils/HintDisplay.tsx +26 -0
- package/src/components/utils/Icon.tsx +36 -0
- package/src/components/utils/MediaPreviewModal.tsx +114 -0
- package/src/components/utils/ViewFieldWrapper.tsx +23 -0
- package/src/components/utils/layoutHelpers.ts +267 -0
- package/src/components/widgets/ChartWidget.tsx +247 -0
- package/src/components/widgets/StatsWidget.tsx +72 -0
- package/src/components/widgets/WidgetRenderer.tsx +108 -0
- package/src/components/widgets/WidgetShell.tsx +37 -0
- package/src/contexts/AuthChallengeRegistryContext.tsx +29 -0
- package/src/contexts/BlockRegistryContext.tsx +28 -0
- package/src/contexts/ColumnRegistryContext.tsx +38 -0
- package/src/contexts/FieldRegistryContext.tsx +56 -0
- package/src/contexts/PanelMetadataContext.tsx +60 -0
- package/src/contexts/PanelProviders.tsx +85 -0
- package/src/contexts/ResourceModalContext.tsx +137 -0
- package/src/contexts/SlotRegistryContext.tsx +35 -0
- package/src/contexts/TableRefreshContext.tsx +44 -0
- package/src/contexts/WidgetRegistryContext.tsx +34 -0
- package/src/contexts/createRegistryContext.tsx +29 -0
- package/src/hooks/useAfterStateUpdated.ts +70 -0
- package/src/hooks/useValidation.test.ts +59 -0
- package/src/hooks/useValidation.ts +95 -0
- package/src/i18n/I18nProvider.tsx +128 -0
- package/src/i18n/LocaleSwitcher.tsx +50 -0
- package/src/i18n/activeLocale.ts +39 -0
- package/src/i18n/buildClientI18n.ts +101 -0
- package/src/i18n/i18n.test.tsx +140 -0
- package/src/i18n/index.ts +12 -0
- package/src/i18n/locales/core/en.ts +274 -0
- package/src/i18n/locales/core/index.ts +5 -0
- package/src/i18n/locales/core/sq.ts +275 -0
- package/src/i18n/useFormatter.ts +42 -0
- package/src/i18n/useLocale.ts +16 -0
- package/src/i18n/useTranslation.ts +17 -0
- package/src/index.ts +244 -0
- package/src/pages/ResourceListPage.tsx +205 -0
- package/src/plugin.ts +110 -0
- package/src/runtime/conditions.test.ts +99 -0
- package/src/runtime/conditions.ts +148 -0
- package/src/runtime/formTraversal.ts +41 -0
- package/src/runtime/serializedFunctions.test.ts +59 -0
- package/src/runtime/serializedFunctions.ts +284 -0
- package/src/slots/Slot.test.tsx +89 -0
- package/src/slots/Slot.tsx +47 -0
- package/src/slots/SlotCluster.test.tsx +95 -0
- package/src/slots/SlotCluster.tsx +107 -0
- package/src/slots/index.ts +15 -0
- package/src/slots/mergeSlots.test.ts +71 -0
- package/src/slots/mergeSlots.ts +40 -0
- package/src/slots/slotNames.test.ts +21 -0
- package/src/slots/types.ts +119 -0
- package/src/styles.css +437 -0
- package/src/table/TableContext.tsx +41 -0
- package/src/table/TableRenderer.test.tsx +197 -0
- package/src/table/TableRenderer.tsx +390 -0
- package/src/table/components/FiltersPanel.tsx +193 -0
- package/src/table/components/TableToolbar.tsx +153 -0
- package/src/table/components/TableToolbarButton.tsx +14 -0
- package/src/table/components/TableView.tsx +106 -0
- package/src/table/defaultRowActions.ts +43 -0
- package/src/table/hooks/useColumnVisibility.test.ts +51 -0
- package/src/table/hooks/useColumnVisibility.ts +71 -0
- package/src/table/hooks/useEditableRows.test.ts +69 -0
- package/src/table/hooks/useEditableRows.ts +89 -0
- package/src/table/hooks/useTableActions.ts +393 -0
- package/src/table/hooks/useTableData.ts +89 -0
- package/src/table/hooks/useTableLayout.ts +45 -0
- package/src/table/hooks/useTableQuery.test.ts +116 -0
- package/src/table/hooks/useTableQuery.ts +172 -0
- package/src/test/mockFetch.ts +67 -0
- package/src/test/setup.ts +25 -0
- package/src/types/index.ts +228 -0
- package/src/utils/classNames.ts +10 -0
- package/src/utils/columnMediaDimensions.ts +45 -0
- package/src/utils/columnVisibilityStorage.ts +55 -0
- package/src/utils/fieldErrors.test.ts +35 -0
- package/src/utils/fieldErrors.ts +27 -0
- package/src/utils/formatValue.test.tsx +65 -0
- package/src/utils/formatValue.tsx +117 -0
- package/src/utils/layoutStorage.ts +52 -0
- package/src/utils/redirectHandler.ts +29 -0
- package/src/utils/tableFormatters.test.ts +54 -0
- package/src/utils/tableFormatters.ts +104 -0
- package/src/utils/widgetVisibilityStorage.ts +38 -0
- package/tailwind.config.js +9 -0
- package/vite.config.ts +17 -0
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useRef, useCallback } from 'react';
|
|
3
|
+
import { useFormContext } from 'react-hook-form';
|
|
4
|
+
import { getFieldError } from '../utils/fieldErrors';
|
|
5
|
+
import { useEditor, EditorContent } from '@tiptap/react';
|
|
6
|
+
import StarterKit from '@tiptap/starter-kit';
|
|
7
|
+
import Placeholder from '@tiptap/extension-placeholder';
|
|
8
|
+
import Link from '@tiptap/extension-link';
|
|
9
|
+
import Image from '@tiptap/extension-image';
|
|
10
|
+
import Underline from '@tiptap/extension-underline';
|
|
11
|
+
import Subscript from '@tiptap/extension-subscript';
|
|
12
|
+
import Superscript from '@tiptap/extension-superscript';
|
|
13
|
+
import TextAlign from '@tiptap/extension-text-align';
|
|
14
|
+
import Highlight from '@tiptap/extension-highlight';
|
|
15
|
+
import { Node, mergeAttributes } from '@tiptap/core';
|
|
16
|
+
import { HintDisplay } from './utils/HintDisplay';
|
|
17
|
+
import { ViewFieldWrapper } from './utils/ViewFieldWrapper';
|
|
18
|
+
import { useToast } from './ui/Toast';
|
|
19
|
+
import { authenticatedFetch } from '../api/authenticatedFetch';
|
|
20
|
+
import { useValidation } from '../hooks/useValidation';
|
|
21
|
+
import { translate } from '../i18n/activeLocale';
|
|
22
|
+
// Custom Video extension
|
|
23
|
+
const Video = Node.create({
|
|
24
|
+
name: 'video',
|
|
25
|
+
group: 'block',
|
|
26
|
+
atom: true,
|
|
27
|
+
addAttributes() {
|
|
28
|
+
return {
|
|
29
|
+
src: {
|
|
30
|
+
default: null,
|
|
31
|
+
},
|
|
32
|
+
controls: {
|
|
33
|
+
default: true,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
parseHTML() {
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
tag: 'video[src]',
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
},
|
|
44
|
+
renderHTML({ HTMLAttributes }) {
|
|
45
|
+
return ['video', mergeAttributes(HTMLAttributes, { controls: true, class: 'max-w-full' })];
|
|
46
|
+
},
|
|
47
|
+
addCommands() {
|
|
48
|
+
return {
|
|
49
|
+
setVideo: (options) => ({ commands }) => {
|
|
50
|
+
return commands.insertContent({
|
|
51
|
+
type: this.name,
|
|
52
|
+
attrs: options,
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
// Custom Audio extension
|
|
59
|
+
const Audio = Node.create({
|
|
60
|
+
name: 'audio',
|
|
61
|
+
group: 'block',
|
|
62
|
+
atom: true,
|
|
63
|
+
addAttributes() {
|
|
64
|
+
return {
|
|
65
|
+
src: {
|
|
66
|
+
default: null,
|
|
67
|
+
},
|
|
68
|
+
controls: {
|
|
69
|
+
default: true,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
parseHTML() {
|
|
74
|
+
return [
|
|
75
|
+
{
|
|
76
|
+
tag: 'audio[src]',
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
},
|
|
80
|
+
renderHTML({ HTMLAttributes }) {
|
|
81
|
+
return ['audio', mergeAttributes(HTMLAttributes, { controls: true, class: 'max-w-full' })];
|
|
82
|
+
},
|
|
83
|
+
addCommands() {
|
|
84
|
+
return {
|
|
85
|
+
setAudio: (options) => ({ commands }) => {
|
|
86
|
+
return commands.insertContent({
|
|
87
|
+
type: this.name,
|
|
88
|
+
attrs: options,
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
// Custom Embed extension for iframes (YouTube, websites, etc.)
|
|
95
|
+
const Embed = Node.create({
|
|
96
|
+
name: 'embed',
|
|
97
|
+
group: 'block',
|
|
98
|
+
atom: true,
|
|
99
|
+
addAttributes() {
|
|
100
|
+
return {
|
|
101
|
+
src: {
|
|
102
|
+
default: null,
|
|
103
|
+
},
|
|
104
|
+
width: {
|
|
105
|
+
default: '100%',
|
|
106
|
+
},
|
|
107
|
+
height: {
|
|
108
|
+
default: '400',
|
|
109
|
+
},
|
|
110
|
+
allow: {
|
|
111
|
+
default: 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture',
|
|
112
|
+
},
|
|
113
|
+
allowFullScreen: {
|
|
114
|
+
default: true,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
parseHTML() {
|
|
119
|
+
return [
|
|
120
|
+
{
|
|
121
|
+
tag: 'iframe[src]',
|
|
122
|
+
},
|
|
123
|
+
];
|
|
124
|
+
},
|
|
125
|
+
renderHTML({ HTMLAttributes }) {
|
|
126
|
+
return [
|
|
127
|
+
'iframe',
|
|
128
|
+
mergeAttributes(HTMLAttributes, {
|
|
129
|
+
class: 'max-w-full rounded',
|
|
130
|
+
frameborder: '0',
|
|
131
|
+
allowfullscreen: HTMLAttributes.allowFullScreen !== false,
|
|
132
|
+
}),
|
|
133
|
+
];
|
|
134
|
+
},
|
|
135
|
+
addCommands() {
|
|
136
|
+
return {
|
|
137
|
+
setEmbed: (options) => ({ commands }) => {
|
|
138
|
+
return commands.insertContent({
|
|
139
|
+
type: this.name,
|
|
140
|
+
attrs: {
|
|
141
|
+
src: options.src,
|
|
142
|
+
width: options.width || '100%',
|
|
143
|
+
height: options.height || '400',
|
|
144
|
+
allow: options.allow ||
|
|
145
|
+
'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture',
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
// Registry of available TipTap extensions
|
|
153
|
+
const AVAILABLE_EXTENSIONS = {
|
|
154
|
+
link: Link.configure({
|
|
155
|
+
openOnClick: false,
|
|
156
|
+
HTMLAttributes: {
|
|
157
|
+
class: 'text-accent underline hover:text-accent-hover',
|
|
158
|
+
},
|
|
159
|
+
}),
|
|
160
|
+
image: Image.configure({
|
|
161
|
+
inline: true,
|
|
162
|
+
allowBase64: false,
|
|
163
|
+
HTMLAttributes: {
|
|
164
|
+
class: 'max-w-full h-auto rounded',
|
|
165
|
+
},
|
|
166
|
+
}),
|
|
167
|
+
video: Video,
|
|
168
|
+
audio: Audio,
|
|
169
|
+
embed: Embed,
|
|
170
|
+
underline: Underline,
|
|
171
|
+
subscript: Subscript,
|
|
172
|
+
superscript: Superscript,
|
|
173
|
+
textAlign: TextAlign.configure({
|
|
174
|
+
types: ['heading', 'paragraph'],
|
|
175
|
+
}),
|
|
176
|
+
highlight: Highlight.configure({
|
|
177
|
+
multicolor: true,
|
|
178
|
+
}),
|
|
179
|
+
};
|
|
180
|
+
const ToolbarButton = ({ onClick, isActive = false, disabled = false, children, title, }) => (_jsx("button", { type: "button", onClick: onClick, disabled: disabled, title: title, className: `
|
|
181
|
+
p-2 rounded transition-colors
|
|
182
|
+
${isActive ? 'bg-accent-soft text-accent' : 'text-fg hover:bg-muted'}
|
|
183
|
+
${disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}
|
|
184
|
+
`, children: children }));
|
|
185
|
+
/**
|
|
186
|
+
* Convert File to base64 string
|
|
187
|
+
*/
|
|
188
|
+
const fileToBase64 = (file) => {
|
|
189
|
+
return new Promise((resolve, reject) => {
|
|
190
|
+
const reader = new FileReader();
|
|
191
|
+
reader.onload = () => {
|
|
192
|
+
const result = reader.result;
|
|
193
|
+
resolve(result.split(',')[1]);
|
|
194
|
+
};
|
|
195
|
+
reader.onerror = reject;
|
|
196
|
+
reader.readAsDataURL(file);
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
export function RichEditorField({ name, label, placeholder, helperText, hint, hintIcon, hintColor, disabled, required, toolbarButtons = [
|
|
200
|
+
'bold',
|
|
201
|
+
'italic',
|
|
202
|
+
'underline',
|
|
203
|
+
'strike',
|
|
204
|
+
'code',
|
|
205
|
+
'h1',
|
|
206
|
+
'h2',
|
|
207
|
+
'h3',
|
|
208
|
+
'bulletList',
|
|
209
|
+
'orderedList',
|
|
210
|
+
'blockquote',
|
|
211
|
+
'codeBlock',
|
|
212
|
+
'link',
|
|
213
|
+
'image',
|
|
214
|
+
'video',
|
|
215
|
+
'audio',
|
|
216
|
+
'embed',
|
|
217
|
+
'subscript',
|
|
218
|
+
'superscript',
|
|
219
|
+
'highlight',
|
|
220
|
+
'alignLeft',
|
|
221
|
+
'alignCenter',
|
|
222
|
+
'alignRight',
|
|
223
|
+
'undo',
|
|
224
|
+
'redo',
|
|
225
|
+
'htmlSource',
|
|
226
|
+
], extensions = ['link', 'underline', 'subscript', 'superscript', 'highlight', 'textAlign'], maxLength, fileAttachments, embeds, htmlSource, apiBaseUrl, resource, mode, value, validation, operation, }) {
|
|
227
|
+
// View mode: render formatted display
|
|
228
|
+
if (mode === 'view') {
|
|
229
|
+
const htmlContent = value || '';
|
|
230
|
+
return (_jsx(ViewFieldWrapper, { label: label, children: htmlContent ? (_jsx("div", { className: "prose prose-sm dark:prose-invert max-w-none text-fg", dangerouslySetInnerHTML: { __html: htmlContent } })) : (_jsx("span", { className: "text-fg-secondary", children: "-" })) }));
|
|
231
|
+
}
|
|
232
|
+
const { setValue, watch, register, formState: { errors: formErrors }, } = useFormContext();
|
|
233
|
+
const toast = useToast();
|
|
234
|
+
const currentValue = watch(name);
|
|
235
|
+
const imageInputRef = useRef(null);
|
|
236
|
+
const videoInputRef = useRef(null);
|
|
237
|
+
const audioInputRef = useRef(null);
|
|
238
|
+
const [isHtmlView, setIsHtmlView] = React.useState(false);
|
|
239
|
+
const [htmlSourceValue, setHtmlSourceValue] = React.useState('');
|
|
240
|
+
// Evaluate validation conditions with form context
|
|
241
|
+
const validationResult = useValidation(validation?.rules || [], operation, name);
|
|
242
|
+
const isRequired = validationResult.required !== undefined;
|
|
243
|
+
const fieldError = getFieldError(formErrors, name);
|
|
244
|
+
// Register field with React Hook Form for validation
|
|
245
|
+
React.useEffect(() => {
|
|
246
|
+
register(name, validationResult);
|
|
247
|
+
}, [register, name, validationResult]);
|
|
248
|
+
// Compute upload endpoint
|
|
249
|
+
const uploadEndpoint = React.useMemo(() => {
|
|
250
|
+
if (!apiBaseUrl || !resource)
|
|
251
|
+
return null;
|
|
252
|
+
return `${apiBaseUrl}/${resource}/media/upload`;
|
|
253
|
+
}, [apiBaseUrl, resource]);
|
|
254
|
+
// Build extensions array
|
|
255
|
+
const editorExtensions = React.useMemo(() => {
|
|
256
|
+
const baseExtensions = [
|
|
257
|
+
StarterKit,
|
|
258
|
+
Placeholder.configure({
|
|
259
|
+
placeholder: placeholder || translate('core:editor.start_typing'),
|
|
260
|
+
}),
|
|
261
|
+
];
|
|
262
|
+
// Add image extension if fileAttachments is enabled or if image is in extensions
|
|
263
|
+
if (fileAttachments || extensions.includes('image')) {
|
|
264
|
+
baseExtensions.push(AVAILABLE_EXTENSIONS.image);
|
|
265
|
+
}
|
|
266
|
+
// Add video extension if fileAttachments is enabled or if video is in extensions
|
|
267
|
+
if (fileAttachments || extensions.includes('video')) {
|
|
268
|
+
baseExtensions.push(AVAILABLE_EXTENSIONS.video);
|
|
269
|
+
}
|
|
270
|
+
// Add audio extension if fileAttachments is enabled or if audio is in extensions
|
|
271
|
+
if (fileAttachments || extensions.includes('audio')) {
|
|
272
|
+
baseExtensions.push(AVAILABLE_EXTENSIONS.audio);
|
|
273
|
+
}
|
|
274
|
+
// Add embed extension if embeds is enabled or if embed is in extensions
|
|
275
|
+
if (embeds || extensions.includes('embed')) {
|
|
276
|
+
baseExtensions.push(AVAILABLE_EXTENSIONS.embed);
|
|
277
|
+
}
|
|
278
|
+
// Add custom extensions
|
|
279
|
+
extensions.forEach(extName => {
|
|
280
|
+
if (AVAILABLE_EXTENSIONS[extName] && !['image', 'video', 'audio', 'embed'].includes(extName)) {
|
|
281
|
+
baseExtensions.push(AVAILABLE_EXTENSIONS[extName]);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
return baseExtensions;
|
|
285
|
+
}, [placeholder, extensions, fileAttachments, embeds]);
|
|
286
|
+
const editor = useEditor({
|
|
287
|
+
extensions: editorExtensions,
|
|
288
|
+
content: currentValue || '',
|
|
289
|
+
editable: !disabled,
|
|
290
|
+
onUpdate: ({ editor }) => {
|
|
291
|
+
const html = editor.getHTML();
|
|
292
|
+
// Trigger validation when content changes
|
|
293
|
+
setValue(name, html, { shouldValidate: true });
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
// Upload file function
|
|
297
|
+
const uploadFile = useCallback(async (file) => {
|
|
298
|
+
if (!uploadEndpoint) {
|
|
299
|
+
console.warn('No upload endpoint configured');
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
try {
|
|
303
|
+
const base64 = await fileToBase64(file);
|
|
304
|
+
const response = await authenticatedFetch(uploadEndpoint, {
|
|
305
|
+
method: 'POST',
|
|
306
|
+
headers: { 'Content-Type': 'application/json' },
|
|
307
|
+
body: JSON.stringify({
|
|
308
|
+
file: base64,
|
|
309
|
+
filename: file.name,
|
|
310
|
+
contentType: file.type,
|
|
311
|
+
fieldName: name,
|
|
312
|
+
isArray: false,
|
|
313
|
+
}),
|
|
314
|
+
}, apiBaseUrl);
|
|
315
|
+
if (!response.ok) {
|
|
316
|
+
const error = await response.json();
|
|
317
|
+
throw new Error(`Upload failed: ${error.message || response.statusText}`);
|
|
318
|
+
}
|
|
319
|
+
const result = await response.json();
|
|
320
|
+
return result.data || null;
|
|
321
|
+
}
|
|
322
|
+
catch (error) {
|
|
323
|
+
console.error('Upload error:', error);
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
}, [uploadEndpoint, name]);
|
|
327
|
+
// Handle media upload
|
|
328
|
+
const handleMediaUpload = useCallback(async (file, type) => {
|
|
329
|
+
if (!editor)
|
|
330
|
+
return;
|
|
331
|
+
const uploadResult = await uploadFile(file);
|
|
332
|
+
if (!uploadResult || !uploadResult.url) {
|
|
333
|
+
toast.error(translate('core:toast.upload_failed'));
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
// Insert media into editor based on type
|
|
337
|
+
if (type === 'image') {
|
|
338
|
+
editor.chain().focus().setImage({ src: uploadResult.url }).run();
|
|
339
|
+
}
|
|
340
|
+
else if (type === 'video') {
|
|
341
|
+
editor.chain().focus().setVideo({ src: uploadResult.url }).run();
|
|
342
|
+
}
|
|
343
|
+
else if (type === 'audio') {
|
|
344
|
+
editor.chain().focus().setAudio({ src: uploadResult.url }).run();
|
|
345
|
+
}
|
|
346
|
+
}, [editor, uploadFile]);
|
|
347
|
+
// Handle file input change
|
|
348
|
+
const handleFileInputChange = useCallback((e, type) => {
|
|
349
|
+
const file = e.target.files?.[0];
|
|
350
|
+
if (file) {
|
|
351
|
+
handleMediaUpload(file, type);
|
|
352
|
+
}
|
|
353
|
+
// Reset input so same file can be selected again
|
|
354
|
+
e.target.value = '';
|
|
355
|
+
}, [handleMediaUpload]);
|
|
356
|
+
React.useEffect(() => {
|
|
357
|
+
if (editor && currentValue !== editor.getHTML()) {
|
|
358
|
+
editor.commands.setContent(currentValue || '');
|
|
359
|
+
}
|
|
360
|
+
}, [currentValue, editor]);
|
|
361
|
+
// Sync HTML source value when switching to HTML view
|
|
362
|
+
React.useEffect(() => {
|
|
363
|
+
if (isHtmlView && editor) {
|
|
364
|
+
setHtmlSourceValue(editor.getHTML());
|
|
365
|
+
}
|
|
366
|
+
}, [isHtmlView, editor]);
|
|
367
|
+
// Handle HTML source view toggle
|
|
368
|
+
const handleToggleHtmlView = useCallback(() => {
|
|
369
|
+
if (!editor)
|
|
370
|
+
return;
|
|
371
|
+
if (isHtmlView) {
|
|
372
|
+
// Switching from HTML view to rich text view
|
|
373
|
+
// Parse HTML and update editor
|
|
374
|
+
try {
|
|
375
|
+
editor.commands.setContent(htmlSourceValue);
|
|
376
|
+
setValue(name, htmlSourceValue, { shouldValidate: true });
|
|
377
|
+
}
|
|
378
|
+
catch (error) {
|
|
379
|
+
console.error('Error parsing HTML:', error);
|
|
380
|
+
toast.error(translate('core:toast.invalid_html'));
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
setIsHtmlView(!isHtmlView);
|
|
384
|
+
}, [isHtmlView, editor, htmlSourceValue, name, setValue]);
|
|
385
|
+
const buttonActions = {
|
|
386
|
+
bold: {
|
|
387
|
+
action: () => editor?.chain().focus().toggleBold().run(),
|
|
388
|
+
icon: _jsx("strong", { children: "B" }),
|
|
389
|
+
title: translate('core:editor.bold'),
|
|
390
|
+
},
|
|
391
|
+
italic: {
|
|
392
|
+
action: () => editor?.chain().focus().toggleItalic().run(),
|
|
393
|
+
icon: _jsx("em", { children: "I" }),
|
|
394
|
+
title: translate('core:editor.italic'),
|
|
395
|
+
},
|
|
396
|
+
strike: {
|
|
397
|
+
action: () => editor?.chain().focus().toggleStrike().run(),
|
|
398
|
+
icon: _jsx("s", { children: "S" }),
|
|
399
|
+
title: translate('core:editor.strikethrough'),
|
|
400
|
+
},
|
|
401
|
+
code: {
|
|
402
|
+
action: () => editor?.chain().focus().toggleCode().run(),
|
|
403
|
+
icon: _jsx("code", { children: '</>' }),
|
|
404
|
+
title: translate('core:editor.code'),
|
|
405
|
+
},
|
|
406
|
+
h1: {
|
|
407
|
+
action: () => editor?.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
408
|
+
icon: _jsx("span", { className: "text-lg font-bold", children: "H1" }),
|
|
409
|
+
title: translate('core:editor.heading1'),
|
|
410
|
+
},
|
|
411
|
+
h2: {
|
|
412
|
+
action: () => editor?.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
413
|
+
icon: _jsx("span", { className: "text-base font-bold", children: "H2" }),
|
|
414
|
+
title: translate('core:editor.heading2'),
|
|
415
|
+
},
|
|
416
|
+
h3: {
|
|
417
|
+
action: () => editor?.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
418
|
+
icon: _jsx("span", { className: "text-sm font-bold", children: "H3" }),
|
|
419
|
+
title: translate('core:editor.heading3'),
|
|
420
|
+
},
|
|
421
|
+
bulletList: {
|
|
422
|
+
action: () => editor?.chain().focus().toggleBulletList().run(),
|
|
423
|
+
icon: (_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 12h16M4 18h16" }) })),
|
|
424
|
+
title: translate('core:editor.bullet_list'),
|
|
425
|
+
},
|
|
426
|
+
orderedList: {
|
|
427
|
+
action: () => editor?.chain().focus().toggleOrderedList().run(),
|
|
428
|
+
icon: (_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 4h18M3 12h18M3 20h18" }) })),
|
|
429
|
+
title: translate('core:editor.ordered_list'),
|
|
430
|
+
},
|
|
431
|
+
blockquote: {
|
|
432
|
+
action: () => editor?.chain().focus().toggleBlockquote().run(),
|
|
433
|
+
icon: _jsx("span", { children: "\"" }),
|
|
434
|
+
title: translate('core:editor.blockquote'),
|
|
435
|
+
},
|
|
436
|
+
codeBlock: {
|
|
437
|
+
action: () => editor?.chain().focus().toggleCodeBlock().run(),
|
|
438
|
+
icon: _jsx("code", { children: '{ }' }),
|
|
439
|
+
title: translate('core:editor.code_block'),
|
|
440
|
+
},
|
|
441
|
+
undo: {
|
|
442
|
+
action: () => editor?.chain().focus().undo().run(),
|
|
443
|
+
icon: (_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6" }) })),
|
|
444
|
+
title: translate('core:editor.undo'),
|
|
445
|
+
},
|
|
446
|
+
redo: {
|
|
447
|
+
action: () => editor?.chain().focus().redo().run(),
|
|
448
|
+
icon: (_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M21 10h-10a8 8 0 00-8 8v2m18-10l-6 6m6-6l-6-6" }) })),
|
|
449
|
+
title: translate('core:editor.redo'),
|
|
450
|
+
},
|
|
451
|
+
link: {
|
|
452
|
+
action: () => {
|
|
453
|
+
const url = window.prompt('Enter URL:');
|
|
454
|
+
if (url) {
|
|
455
|
+
editor?.chain().focus().setLink({ href: url }).run();
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
icon: (_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" }) })),
|
|
459
|
+
title: translate('core:editor.link'),
|
|
460
|
+
},
|
|
461
|
+
underline: {
|
|
462
|
+
action: () => editor?.chain().focus().toggleUnderline().run(),
|
|
463
|
+
icon: _jsx("u", { children: "U" }),
|
|
464
|
+
title: translate('core:editor.underline'),
|
|
465
|
+
},
|
|
466
|
+
subscript: {
|
|
467
|
+
action: () => editor?.chain().focus().toggleSubscript().run(),
|
|
468
|
+
icon: (_jsxs("span", { children: ["X", _jsx("sub", { className: "text-xs", children: "2" })] })),
|
|
469
|
+
title: translate('core:editor.subscript'),
|
|
470
|
+
},
|
|
471
|
+
superscript: {
|
|
472
|
+
action: () => editor?.chain().focus().toggleSuperscript().run(),
|
|
473
|
+
icon: (_jsxs("span", { children: ["X", _jsx("sup", { className: "text-xs", children: "2" })] })),
|
|
474
|
+
title: translate('core:editor.superscript'),
|
|
475
|
+
},
|
|
476
|
+
highlight: {
|
|
477
|
+
action: () => editor?.chain().focus().toggleHighlight().run(),
|
|
478
|
+
icon: (_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 21h10M12 16v5M5 3l14 14L5 3z" }) })),
|
|
479
|
+
title: translate('core:editor.highlight'),
|
|
480
|
+
},
|
|
481
|
+
alignLeft: {
|
|
482
|
+
action: () => editor?.chain().focus().setTextAlign('left').run(),
|
|
483
|
+
icon: (_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 12h10M4 18h16" }) })),
|
|
484
|
+
title: translate('core:editor.align_left'),
|
|
485
|
+
},
|
|
486
|
+
alignCenter: {
|
|
487
|
+
action: () => editor?.chain().focus().setTextAlign('center').run(),
|
|
488
|
+
icon: (_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M7 12h10M4 18h16" }) })),
|
|
489
|
+
title: translate('core:editor.align_center'),
|
|
490
|
+
},
|
|
491
|
+
alignRight: {
|
|
492
|
+
action: () => editor?.chain().focus().setTextAlign('right').run(),
|
|
493
|
+
icon: (_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M10 12h10M4 18h16" }) })),
|
|
494
|
+
title: translate('core:editor.align_right'),
|
|
495
|
+
},
|
|
496
|
+
image: {
|
|
497
|
+
action: () => {
|
|
498
|
+
if (fileAttachments && imageInputRef.current) {
|
|
499
|
+
imageInputRef.current.click();
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
icon: (_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) })),
|
|
503
|
+
title: translate('core:editor.insert_image'),
|
|
504
|
+
},
|
|
505
|
+
video: {
|
|
506
|
+
action: () => {
|
|
507
|
+
if (fileAttachments && videoInputRef.current) {
|
|
508
|
+
videoInputRef.current.click();
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
icon: (_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" }) })),
|
|
512
|
+
title: translate('core:editor.insert_video'),
|
|
513
|
+
},
|
|
514
|
+
audio: {
|
|
515
|
+
action: () => {
|
|
516
|
+
if (fileAttachments && audioInputRef.current) {
|
|
517
|
+
audioInputRef.current.click();
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
icon: (_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3" }) })),
|
|
521
|
+
title: translate('core:editor.insert_audio'),
|
|
522
|
+
},
|
|
523
|
+
embed: {
|
|
524
|
+
action: () => {
|
|
525
|
+
const url = window.prompt('Enter embed URL (YouTube, website, etc.):');
|
|
526
|
+
if (url) {
|
|
527
|
+
// Try to convert YouTube URL to embed format
|
|
528
|
+
let embedUrl = url;
|
|
529
|
+
const youtubeRegex = /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/;
|
|
530
|
+
const youtubeMatch = url.match(youtubeRegex);
|
|
531
|
+
if (youtubeMatch) {
|
|
532
|
+
embedUrl = `https://www.youtube.com/embed/${youtubeMatch[1]}`;
|
|
533
|
+
}
|
|
534
|
+
(editor?.chain().focus())
|
|
535
|
+
.setEmbed({
|
|
536
|
+
src: embedUrl,
|
|
537
|
+
width: '100%',
|
|
538
|
+
height: '400',
|
|
539
|
+
})
|
|
540
|
+
.run();
|
|
541
|
+
}
|
|
542
|
+
},
|
|
543
|
+
icon: (_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) })),
|
|
544
|
+
title: translate('core:editor.insert_embed'),
|
|
545
|
+
},
|
|
546
|
+
htmlSource: {
|
|
547
|
+
action: handleToggleHtmlView,
|
|
548
|
+
icon: (_jsxs("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [_jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }), _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 6l3 3-3 3M18 6l-3 3 3 3" })] })),
|
|
549
|
+
title: translate('core:editor.html_source'), // Title will be updated dynamically in render
|
|
550
|
+
},
|
|
551
|
+
};
|
|
552
|
+
return (_jsxs("div", { className: "space-y-2", children: [label && (_jsxs("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300", children: [label, isRequired && _jsx("span", { className: "text-red-500 dark:text-red-400 ml-1", children: "*" })] })), helperText && _jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: helperText }), _jsx(HintDisplay, { hint: hint, hintIcon: hintIcon, hintColor: hintColor }), fieldError && _jsx("p", { className: "text-sm text-red-600 dark:text-red-400", children: fieldError.message }), _jsxs("div", { className: "border border-border rounded-lg overflow-hidden", children: [_jsx("div", { className: "flex flex-wrap gap-1 p-2 bg-muted border-b border-border", children: toolbarButtons.map(button => {
|
|
553
|
+
const action = buttonActions[button];
|
|
554
|
+
if (!action)
|
|
555
|
+
return null;
|
|
556
|
+
let isActive = false;
|
|
557
|
+
if (editor) {
|
|
558
|
+
if (button === 'bold')
|
|
559
|
+
isActive = editor.isActive('bold');
|
|
560
|
+
else if (button === 'italic')
|
|
561
|
+
isActive = editor.isActive('italic');
|
|
562
|
+
else if (button === 'strike')
|
|
563
|
+
isActive = editor.isActive('strike');
|
|
564
|
+
else if (button === 'code')
|
|
565
|
+
isActive = editor.isActive('code');
|
|
566
|
+
else if (button === 'h1')
|
|
567
|
+
isActive = editor.isActive('heading', { level: 1 });
|
|
568
|
+
else if (button === 'h2')
|
|
569
|
+
isActive = editor.isActive('heading', { level: 2 });
|
|
570
|
+
else if (button === 'h3')
|
|
571
|
+
isActive = editor.isActive('heading', { level: 3 });
|
|
572
|
+
else if (button === 'bulletList')
|
|
573
|
+
isActive = editor.isActive('bulletList');
|
|
574
|
+
else if (button === 'orderedList')
|
|
575
|
+
isActive = editor.isActive('orderedList');
|
|
576
|
+
else if (button === 'blockquote')
|
|
577
|
+
isActive = editor.isActive('blockquote');
|
|
578
|
+
else if (button === 'codeBlock')
|
|
579
|
+
isActive = editor.isActive('codeBlock');
|
|
580
|
+
else if (button === 'link')
|
|
581
|
+
isActive = editor.isActive('link');
|
|
582
|
+
else if (button === 'image')
|
|
583
|
+
isActive = editor.isActive('image');
|
|
584
|
+
else if (button === 'video')
|
|
585
|
+
isActive = editor.isActive('video');
|
|
586
|
+
else if (button === 'audio')
|
|
587
|
+
isActive = editor.isActive('audio');
|
|
588
|
+
else if (button === 'embed')
|
|
589
|
+
isActive = editor.isActive('embed');
|
|
590
|
+
else if (button === 'underline')
|
|
591
|
+
isActive = editor.isActive('underline');
|
|
592
|
+
else if (button === 'subscript')
|
|
593
|
+
isActive = editor.isActive('subscript');
|
|
594
|
+
else if (button === 'superscript')
|
|
595
|
+
isActive = editor.isActive('superscript');
|
|
596
|
+
else if (button === 'highlight')
|
|
597
|
+
isActive = editor.isActive('highlight');
|
|
598
|
+
else if (button === 'alignLeft')
|
|
599
|
+
isActive = editor.isActive({ textAlign: 'left' });
|
|
600
|
+
else if (button === 'alignCenter')
|
|
601
|
+
isActive = editor.isActive({ textAlign: 'center' });
|
|
602
|
+
else if (button === 'alignRight')
|
|
603
|
+
isActive = editor.isActive({ textAlign: 'right' });
|
|
604
|
+
}
|
|
605
|
+
// Hide image/video/audio buttons if fileAttachments is disabled
|
|
606
|
+
if ((button === 'image' || button === 'video' || button === 'audio') && !fileAttachments) {
|
|
607
|
+
return null;
|
|
608
|
+
}
|
|
609
|
+
// Hide embed button if embeds is disabled
|
|
610
|
+
if (button === 'embed' && !embeds) {
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
613
|
+
// Hide HTML source button if htmlSource is disabled
|
|
614
|
+
if (button === 'htmlSource' && !htmlSource) {
|
|
615
|
+
return null;
|
|
616
|
+
}
|
|
617
|
+
// Update HTML source button active state and title
|
|
618
|
+
let buttonTitle = action.title;
|
|
619
|
+
if (button === 'htmlSource') {
|
|
620
|
+
isActive = isHtmlView;
|
|
621
|
+
buttonTitle = isHtmlView
|
|
622
|
+
? translate('core:editor.rich_text_view')
|
|
623
|
+
: translate('core:editor.html_source');
|
|
624
|
+
}
|
|
625
|
+
return (_jsx(ToolbarButton, { onClick: action.action, isActive: isActive, disabled: disabled ||
|
|
626
|
+
(fileAttachments &&
|
|
627
|
+
!uploadEndpoint &&
|
|
628
|
+
(button === 'image' || button === 'video' || button === 'audio')), title: buttonTitle, children: action.icon }, button));
|
|
629
|
+
}) }), fileAttachments && (_jsxs(_Fragment, { children: [_jsx("input", { ref: imageInputRef, type: "file", accept: "image/*", style: { display: 'none' }, onChange: e => handleFileInputChange(e, 'image') }), _jsx("input", { ref: videoInputRef, type: "file", accept: "video/*", style: { display: 'none' }, onChange: e => handleFileInputChange(e, 'video') }), _jsx("input", { ref: audioInputRef, type: "file", accept: "audio/*", style: { display: 'none' }, onChange: e => handleFileInputChange(e, 'audio') })] })), isHtmlView ? (_jsx("div", { className: "p-4 min-h-[200px] k-input", children: _jsx("textarea", { value: htmlSourceValue, onChange: e => setHtmlSourceValue(e.target.value), disabled: disabled, className: "w-full h-full min-h-[200px] font-mono text-sm k-input resize-none focus:outline-none", placeholder: translate('core:editor.html_placeholder') }) })) : (_jsx("div", { className: `
|
|
630
|
+
rich-editor-content p-4 min-h-[200px]
|
|
631
|
+
${disabled ? 'bg-muted cursor-not-allowed' : 'k-input'}
|
|
632
|
+
`, style: {
|
|
633
|
+
outline: 'none',
|
|
634
|
+
}, onDrop: e => {
|
|
635
|
+
if (!fileAttachments || !uploadEndpoint || disabled)
|
|
636
|
+
return;
|
|
637
|
+
e.preventDefault();
|
|
638
|
+
const files = Array.from(e.dataTransfer.files);
|
|
639
|
+
files.forEach(file => {
|
|
640
|
+
if (file.type.startsWith('image/')) {
|
|
641
|
+
handleMediaUpload(file, 'image');
|
|
642
|
+
}
|
|
643
|
+
else if (file.type.startsWith('video/')) {
|
|
644
|
+
handleMediaUpload(file, 'video');
|
|
645
|
+
}
|
|
646
|
+
else if (file.type.startsWith('audio/')) {
|
|
647
|
+
handleMediaUpload(file, 'audio');
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
}, onDragOver: e => {
|
|
651
|
+
if (fileAttachments && uploadEndpoint && !disabled) {
|
|
652
|
+
e.preventDefault();
|
|
653
|
+
}
|
|
654
|
+
}, children: _jsx(EditorContent, { editor: editor }) }))] }), maxLength && editor && (_jsxs("p", { className: "text-xs text-gray-500 dark:text-gray-400 text-right", children: [editor.storage.characterCount?.characters() || 0, " / ", maxLength] }))] }));
|
|
655
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FieldProps } from '../types';
|
|
3
|
+
export declare function SectionField({ heading, description, icon, collapsible, collapsed: initialCollapsed, compact, aside, mode, schema, columns, disabled, value, _recordData, operation, apiBaseUrl, resource, isLastSectionInParent, sectionDepth, }: FieldProps & {
|
|
4
|
+
_recordData?: any;
|
|
5
|
+
isLastSectionInParent?: boolean;
|
|
6
|
+
sectionDepth?: number;
|
|
7
|
+
apiBaseUrl?: string;
|
|
8
|
+
resource?: string;
|
|
9
|
+
}): React.JSX.Element;
|