@contember/create 2.1.0-rc.3 → 2.2.0-alpha.10
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/CLAUDE.md +22 -0
- package/dist/development/run.cjs +7 -7
- package/dist/development/run.cjs.map +1 -1
- package/dist/development/run.js +8 -8
- package/dist/development/run.js.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs +28 -14
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.js +28 -14
- package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/development/src/lib/FileSystem.cjs +1 -2
- package/dist/development/src/lib/FileSystem.cjs.map +1 -1
- package/dist/development/src/lib/FileSystem.js +1 -2
- package/dist/development/src/lib/FileSystem.js.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.cjs +79 -67
- package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.js +72 -60
- package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/development/src/lib/packageManagerDetector.cjs +6 -6
- package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -1
- package/dist/development/src/lib/version.cjs +2 -2
- package/dist/development/src/lib/version.cjs.map +1 -1
- package/dist/development/src/lib/version.js.map +1 -1
- package/dist/development/src/paths.cjs +3 -3
- package/dist/development/src/paths.cjs.map +1 -1
- package/dist/production/run.cjs +7 -7
- package/dist/production/run.cjs.map +1 -1
- package/dist/production/run.js +8 -8
- package/dist/production/run.js.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs +28 -14
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.js +28 -14
- package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/production/src/lib/FileSystem.cjs +1 -2
- package/dist/production/src/lib/FileSystem.cjs.map +1 -1
- package/dist/production/src/lib/FileSystem.js +1 -2
- package/dist/production/src/lib/FileSystem.js.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.cjs +79 -67
- package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.js +72 -60
- package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/production/src/lib/packageManagerDetector.cjs +6 -6
- package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -1
- package/dist/production/src/lib/version.cjs +2 -2
- package/dist/production/src/lib/version.cjs.map +1 -1
- package/dist/production/src/lib/version.js.map +1 -1
- package/dist/production/src/paths.cjs +3 -3
- package/dist/production/src/paths.cjs.map +1 -1
- package/dist/types/commands/WorkspaceCreateCommand.d.ts +16 -4
- package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
- package/dist/types/commands/index.d.ts +1 -1
- package/dist/types/commands/index.d.ts.map +1 -1
- package/dist/types/lib/FileSystem.d.ts +3 -2
- package/dist/types/lib/FileSystem.d.ts.map +1 -1
- package/dist/types/lib/TemplateInstaller.d.ts +10 -2
- package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/resources/templates/default/README.md +3 -1
- package/resources/templates/default/admin/app/components/navigation.tsx +95 -8
- package/resources/templates/default/admin/app/pages/tenant.tsx +328 -77
- package/resources/templates/default/admin/entrypoint/components/login.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/magicLink.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/magicLinkSent.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/passwordReset.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/resetRequest.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/resetRequestSuccess.tsx +1 -1
- package/resources/templates/default/admin/lib/binding/binding.tsx +19 -4
- package/resources/templates/default/admin/lib/binding/delete.tsx +37 -3
- package/resources/templates/default/admin/lib/binding/hooks.tsx +65 -3
- package/resources/templates/default/admin/lib/binding/identity.tsx +17 -4
- package/resources/templates/default/admin/lib/binding/index.ts +5 -5
- package/resources/templates/default/admin/lib/binding/navigation-guard-dialog.tsx +15 -3
- package/resources/templates/default/admin/lib/binding/persist.tsx +27 -5
- package/resources/templates/default/admin/lib/block-repeater/block-repeater.tsx +15 -11
- package/resources/templates/default/admin/lib/block-repeater/index.ts +1 -1
- package/resources/templates/default/admin/lib/board/board.tsx +2 -2
- package/resources/templates/default/admin/lib/board/index.ts +1 -1
- package/resources/templates/default/admin/lib/buttons/back-button.tsx +22 -2
- package/resources/templates/default/admin/lib/buttons/index.ts +2 -2
- package/resources/templates/default/admin/lib/buttons/link-back-button.tsx +11 -2
- package/resources/templates/default/admin/lib/datagrid/cells.tsx +3 -3
- package/resources/templates/default/admin/lib/datagrid/column-header.tsx +4 -4
- package/resources/templates/default/admin/lib/datagrid/columns.tsx +28 -14
- package/resources/templates/default/admin/lib/datagrid/elements.tsx +2 -2
- package/resources/templates/default/admin/lib/datagrid/empty.tsx +1 -1
- package/resources/templates/default/admin/lib/datagrid/export.tsx +2 -2
- package/resources/templates/default/admin/lib/datagrid/filters/boolean.tsx +13 -13
- package/resources/templates/default/admin/lib/datagrid/filters/common.tsx +2 -2
- package/resources/templates/default/admin/lib/datagrid/filters/date.tsx +37 -16
- package/resources/templates/default/admin/lib/datagrid/filters/defined.tsx +13 -12
- package/resources/templates/default/admin/lib/datagrid/filters/enum.tsx +56 -22
- package/resources/templates/default/admin/lib/datagrid/filters/index.ts +7 -7
- package/resources/templates/default/admin/lib/datagrid/filters/mobile.tsx +18 -0
- package/resources/templates/default/admin/lib/datagrid/filters/number.tsx +10 -13
- package/resources/templates/default/admin/lib/datagrid/filters/relation.tsx +8 -8
- package/resources/templates/default/admin/lib/datagrid/filters/text.tsx +9 -9
- package/resources/templates/default/admin/lib/datagrid/grid.tsx +31 -23
- package/resources/templates/default/admin/lib/datagrid/index.ts +12 -12
- package/resources/templates/default/admin/lib/datagrid/labels.tsx +22 -4
- package/resources/templates/default/admin/lib/datagrid/layout-switcher.tsx +10 -4
- package/resources/templates/default/admin/lib/datagrid/loader.tsx +4 -4
- package/resources/templates/default/admin/lib/datagrid/pagination.tsx +16 -6
- package/resources/templates/default/admin/lib/datagrid/table.tsx +8 -6
- package/resources/templates/default/admin/lib/datagrid/tiles.tsx +6 -5
- package/resources/templates/default/admin/lib/datagrid/toolbar.tsx +15 -19
- package/resources/templates/default/admin/lib/datagrid/ui.tsx +3 -3
- package/resources/templates/default/admin/lib/dev/index.ts +2 -2
- package/resources/templates/default/admin/lib/dev/login-panel.tsx +12 -3
- package/resources/templates/default/admin/lib/dev/todo.tsx +12 -0
- package/resources/templates/default/admin/lib/dict.ts +0 -261
- package/resources/templates/default/admin/lib/dimensions/dimensions.tsx +85 -4
- package/resources/templates/default/admin/lib/dimensions/index.ts +1 -1
- package/resources/templates/default/admin/lib/editor/block-editor.tsx +72 -3
- package/resources/templates/default/admin/lib/editor/common/baseEditorPlugins.tsx +54 -11
- package/resources/templates/default/admin/lib/editor/common/buttons.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/editor-block-toolbar.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/HeadingRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/ListItemRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/OrderedListRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/TableElementRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/index.ts +6 -6
- package/resources/templates/default/admin/lib/editor/editor-block.tsx +54 -3
- package/resources/templates/default/admin/lib/editor/index.ts +6 -6
- package/resources/templates/default/admin/lib/editor/plugins.tsx +46 -2
- package/resources/templates/default/admin/lib/editor/rich-text-view.tsx +44 -0
- package/resources/templates/default/admin/lib/editor/rich-text.tsx +31 -3
- package/resources/templates/default/admin/lib/editor/sortable-block.tsx +34 -2
- package/resources/templates/default/admin/lib/errors/index.ts +1 -1
- package/resources/templates/default/admin/lib/errors/use-error-formatter.ts +22 -1
- package/resources/templates/default/admin/lib/field/formatted-field.tsx +16 -1
- package/resources/templates/default/admin/lib/field/index.ts +2 -1
- package/resources/templates/default/admin/lib/field/list-field.tsx +56 -0
- package/resources/templates/default/admin/lib/form/container.tsx +33 -3
- package/resources/templates/default/admin/lib/form/index.ts +6 -5
- package/resources/templates/default/admin/lib/form/inputs.tsx +105 -6
- package/resources/templates/default/admin/lib/form/labels.tsx +1 -1
- package/resources/templates/default/admin/lib/form/select.tsx +162 -5
- package/resources/templates/default/admin/lib/form/ui.tsx +2 -2
- package/resources/templates/default/admin/lib/form/upload-repeaters.tsx +159 -5
- package/resources/templates/default/admin/lib/form/upload.tsx +116 -3
- package/resources/templates/default/admin/lib/formatting/formatting.ts +106 -1
- package/resources/templates/default/admin/lib/formatting/index.ts +1 -1
- package/resources/templates/default/admin/lib/images/formatImageResizeUrl.ts +19 -0
- package/resources/templates/default/admin/lib/images/index.ts +1 -1
- package/resources/templates/default/admin/lib/index.ts +54 -0
- package/resources/templates/default/admin/lib/labels/index.ts +2 -2
- package/resources/templates/default/admin/lib/layout/index.ts +3 -3
- package/resources/templates/default/admin/lib/layout/layout-boxed.tsx +5 -5
- package/resources/templates/default/admin/lib/layout/layout.tsx +3 -3
- package/resources/templates/default/admin/lib/outdated-application-dialog/index.ts +1 -1
- package/resources/templates/default/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +2 -2
- package/resources/templates/default/admin/lib/repeater/index.ts +1 -1
- package/resources/templates/default/admin/lib/repeater/repeater.tsx +26 -9
- package/resources/templates/default/admin/lib/select/create-new.tsx +19 -3
- package/resources/templates/default/admin/lib/select/filter.tsx +8 -2
- package/resources/templates/default/admin/lib/select/highlight.tsx +16 -0
- package/resources/templates/default/admin/lib/select/index.ts +6 -6
- package/resources/templates/default/admin/lib/select/list.tsx +30 -6
- package/resources/templates/default/admin/lib/select/multi-select.tsx +41 -4
- package/resources/templates/default/admin/lib/select/select.tsx +44 -6
- package/resources/templates/default/admin/lib/select/sortable-select.tsx +15 -6
- package/resources/templates/default/admin/lib/select/ui.tsx +100 -4
- package/resources/templates/default/admin/lib/tenant/config/auth-policy-list.tsx +86 -0
- package/resources/templates/default/admin/lib/tenant/config/common.tsx +71 -0
- package/resources/templates/default/admin/lib/tenant/config/identity-provider-list.tsx +113 -0
- package/resources/templates/default/admin/lib/tenant/config/index.ts +5 -0
- package/resources/templates/default/admin/lib/tenant/config/mail-template-list.tsx +108 -0
- package/resources/templates/default/admin/lib/tenant/config/tenant-config-view.tsx +182 -0
- package/resources/templates/default/admin/lib/tenant/dict.ts +770 -0
- package/resources/templates/default/admin/lib/tenant/errors.ts +10 -0
- package/resources/templates/default/admin/lib/tenant/forms/add-project-member.tsx +57 -0
- package/resources/templates/default/admin/lib/tenant/forms/change-my-password.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/change-my-profile.tsx +40 -0
- package/resources/templates/default/admin/lib/tenant/forms/change-profile.tsx +55 -0
- package/resources/templates/default/admin/lib/tenant/forms/common.tsx +12 -5
- package/resources/templates/default/admin/lib/tenant/forms/confirm-email-change.tsx +38 -0
- package/resources/templates/default/admin/lib/tenant/forms/create-api-key.tsx +5 -5
- package/resources/templates/default/admin/lib/tenant/forms/create-global-api-key.tsx +69 -0
- package/resources/templates/default/admin/lib/tenant/forms/global-roles-control.tsx +113 -0
- package/resources/templates/default/admin/lib/tenant/forms/index.ts +23 -8
- package/resources/templates/default/admin/lib/tenant/forms/invite.tsx +46 -8
- package/resources/templates/default/admin/lib/tenant/forms/login.tsx +8 -14
- package/resources/templates/default/admin/lib/tenant/forms/memberships-control.tsx +7 -5
- package/resources/templates/default/admin/lib/tenant/forms/mfa-code-fields.tsx +81 -0
- package/resources/templates/default/admin/lib/tenant/forms/password-reset-request.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/password-reset.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin-init.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin.tsx +8 -14
- package/resources/templates/default/admin/lib/tenant/forms/request-email-verification.tsx +35 -0
- package/resources/templates/default/admin/lib/tenant/forms/set-person-password.tsx +58 -0
- package/resources/templates/default/admin/lib/tenant/forms/set-project-secret.tsx +59 -0
- package/resources/templates/default/admin/lib/tenant/forms/sign-up.tsx +73 -0
- package/resources/templates/default/admin/lib/tenant/forms/update-project-member.tsx +14 -5
- package/resources/templates/default/admin/lib/tenant/forms/verify-email.tsx +38 -0
- package/resources/templates/default/admin/lib/tenant/hooks/index.ts +2 -0
- package/resources/templates/default/admin/lib/tenant/hooks/useInvite.ts +41 -0
- package/resources/templates/default/admin/lib/tenant/hooks/useInviteUser.tsx +32 -3
- package/resources/templates/default/admin/lib/tenant/idp/identity-provider-connections.tsx +124 -0
- package/resources/templates/default/admin/lib/tenant/idp/index.ts +1 -0
- package/resources/templates/default/admin/lib/tenant/index.ts +10 -3
- package/resources/templates/default/admin/lib/tenant/listing/api-key-list.tsx +161 -23
- package/resources/templates/default/admin/lib/tenant/listing/auth-log-list.tsx +179 -0
- package/resources/templates/default/admin/lib/tenant/listing/global-api-key-list.tsx +149 -0
- package/resources/templates/default/admin/lib/tenant/listing/index.ts +11 -4
- package/resources/templates/default/admin/lib/tenant/listing/member-delete-dialog.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/listing/member-list.tsx +28 -19
- package/resources/templates/default/admin/lib/tenant/listing/mfa.tsx +29 -0
- package/resources/templates/default/admin/lib/tenant/listing/person-actions.tsx +179 -0
- package/resources/templates/default/admin/lib/tenant/listing/person-detail.tsx +141 -0
- package/resources/templates/default/admin/lib/tenant/listing/person-list.tsx +17 -6
- package/resources/templates/default/admin/lib/tenant/listing/persons-list.tsx +128 -0
- package/resources/templates/default/admin/lib/tenant/listing/project-secret-list.tsx +82 -0
- package/resources/templates/default/admin/lib/tenant/otp/backup-codes.tsx +81 -0
- package/resources/templates/default/admin/lib/tenant/otp/email-otp-setup.tsx +133 -0
- package/resources/templates/default/admin/lib/tenant/otp/index.ts +3 -1
- package/resources/templates/default/admin/lib/tenant/otp/otp-setup.tsx +6 -6
- package/resources/templates/default/admin/lib/tenant/security/index.ts +2 -0
- package/resources/templates/default/admin/lib/tenant/security/passwordless-toggle.tsx +63 -0
- package/resources/templates/default/admin/lib/tenant/security/session-list.tsx +143 -0
- package/resources/templates/default/admin/lib/toast/index.ts +2 -2
- package/resources/templates/default/admin/lib/toast/toast.tsx +3 -3
- package/resources/templates/default/admin/lib/ui/alert-dialog.tsx +114 -3
- package/resources/templates/default/admin/lib/ui/avatar.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/button.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/card.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/collapsible.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/dialog.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/dimension.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/divider.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/dropdown.tsx +3 -3
- package/resources/templates/default/admin/lib/ui/input.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/label.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/loader.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/menu.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/overlay.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/popover.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/progress.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/property-list.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/scroll-area.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/select.tsx +44 -2
- package/resources/templates/default/admin/lib/ui/separator.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/sheet.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/sidebar.tsx +8 -8
- package/resources/templates/default/admin/lib/ui/skeleton.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/sortable.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/switch.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/table.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/textarea.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/toggle-group.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/toggle.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/tooltip.tsx +2 -2
- package/resources/templates/default/admin/lib/upload/dropzone.tsx +20 -3
- package/resources/templates/default/admin/lib/upload/index.ts +3 -3
- package/resources/templates/default/admin/lib/upload/repeater.tsx +5 -1
- package/resources/templates/default/admin/lib/upload/ui.tsx +2 -2
- package/resources/templates/default/admin/lib/upload/upload-progress.tsx +6 -6
- package/resources/templates/default/admin/lib/upload/view.tsx +4 -4
- package/resources/templates/default/admin/lib/utils/cn.ts +18 -0
- package/resources/templates/default/admin/lib/utils/createComponentOpenHooks.tsx +33 -0
- package/resources/templates/default/admin/lib/utils/index.ts +2 -2
- package/resources/templates/default/admin/lib/utils/uic.tsx +59 -0
- package/resources/templates/default/admin/lib/utils/use-mobile.ts +19 -0
- package/resources/templates/default/admin/package.json +1 -0
- package/resources/templates/default/docker/object-storage/README.md +13 -0
- package/resources/templates/default/docker/object-storage/identities.json +13 -0
- package/resources/templates/default/docker-compose.yaml +29 -7
- package/resources/templates/default/scripts/assemble-ui-lib.mjs +132 -0
- package/resources/templates/default/scripts/update-ui-lib.sh +101 -185
- package/src/commands/WorkspaceCreateCommand.ts +45 -17
- package/src/commands/index.ts +1 -1
- package/src/lib/FileSystem.ts +2 -2
- package/src/lib/TemplateInstaller.ts +87 -69
- package/src/lib/version.ts +1 -1
- package/src/run.ts +11 -10
- package/tests/cases/unit/create-process.test.ts +66 -0
- package/tests/cases/unit/template-installer-cleanup.test.ts +150 -0
- package/tests/cases/unit/workspace-create.test.ts +81 -0
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { ReactNode, useEffect } from 'react'
|
|
2
2
|
import { AccessorTreeState, DataBindingProvider, useDataBindingEvent } from '@contember/interface'
|
|
3
|
-
import { Loader } from '
|
|
4
|
-
import { NavigationGuardDialog } from './navigation-guard-dialog'
|
|
5
|
-
import { usePersistErrorHandler } from './hooks'
|
|
6
|
-
import { ErrorBoundary } from '../errors/error-boundary'
|
|
3
|
+
import { Loader } from '~/lib'
|
|
4
|
+
import { NavigationGuardDialog } from './navigation-guard-dialog.js'
|
|
5
|
+
import { usePersistErrorHandler } from './hooks.js'
|
|
6
|
+
import { ErrorBoundary } from '../errors/error-boundary.js'
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* `Binding` component - Core data management wrapper for Contember applications
|
|
10
|
+
*
|
|
11
|
+
* ## Subcomponents
|
|
12
|
+
* - {@link NavigationGuardDialog}: Prevents accidental navigation with unsaved changes
|
|
13
|
+
*
|
|
14
|
+
* ## Example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Binding>
|
|
17
|
+
* <EntitySubTree entity="Project(id: $id)">
|
|
18
|
+
* <ArticleForm />
|
|
19
|
+
* </EntitySubTree>
|
|
20
|
+
* </Binding>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
8
23
|
export const Binding = ({ children }: {
|
|
9
24
|
children: ReactNode
|
|
10
25
|
}) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DeleteEntityTrigger, type RoutingLinkTarget, useRedirect } from '@contember/interface'
|
|
2
2
|
import type { FC, ReactElement } from 'react'
|
|
3
3
|
import * as React from 'react'
|
|
4
|
-
import { dict } from '
|
|
4
|
+
import { dict } from '~/lib'
|
|
5
5
|
import {
|
|
6
6
|
AlertDialog,
|
|
7
7
|
AlertDialogAction,
|
|
@@ -12,15 +12,49 @@ import {
|
|
|
12
12
|
AlertDialogHeader,
|
|
13
13
|
AlertDialogTitle,
|
|
14
14
|
AlertDialogTrigger,
|
|
15
|
-
} from '
|
|
16
|
-
import { Button } from '
|
|
15
|
+
} from '~/lib'
|
|
16
|
+
import { Button } from '~/lib'
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Props for {@link DeleteEntityDialog} component.
|
|
20
|
+
*/
|
|
18
21
|
export type DeleteEntityDialogProps = {
|
|
22
|
+
/** Element that opens the dialog */
|
|
19
23
|
trigger: ReactElement
|
|
24
|
+
/** Controls if deletion happens immediately (default: true) */
|
|
20
25
|
immediatePersist?: boolean
|
|
26
|
+
/** Routing target after successful deletion */
|
|
21
27
|
onSuccessRedirectTo?: RoutingLinkTarget
|
|
22
28
|
}
|
|
23
29
|
|
|
30
|
+
/**
|
|
31
|
+
* `DeleteEntityDialog` component - Confirmation dialog for entity deletion
|
|
32
|
+
*
|
|
33
|
+
* Provides a user-friendly confirmation flow before deleting entities while handling persistence and redirects
|
|
34
|
+
*
|
|
35
|
+
* ## Example: Basic usage
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <DeleteEntityDialog
|
|
38
|
+
* trigger={<Button>Delete User</Button>}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* ## Example: With delayed persistence
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <DeleteEntityDialog
|
|
45
|
+
* immediatePersist={false}
|
|
46
|
+
* trigger={<Button>Mark for Deletion</Button>}
|
|
47
|
+
* />
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* ## Example: With redirect
|
|
51
|
+
* ```tsx
|
|
52
|
+
* <DeleteEntityDialog
|
|
53
|
+
* onSuccessRedirectTo="users"
|
|
54
|
+
* trigger={<Button variant="destructive">Delete</Button>}
|
|
55
|
+
* />
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
24
58
|
export const DeleteEntityDialog: FC<DeleteEntityDialogProps> = ({ trigger, immediatePersist, onSuccessRedirectTo }) => {
|
|
25
59
|
const redirect = useRedirect()
|
|
26
60
|
const handlePersistSuccess = onSuccessRedirectTo ? () => redirect(onSuccessRedirectTo) : undefined
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
import { useCallback } from 'react'
|
|
2
|
-
import { dict } from '
|
|
3
|
-
import { ToastContent, useShowToast } from '
|
|
2
|
+
import { dict } from '~/lib'
|
|
3
|
+
import { ToastContent, useShowToast } from '~/lib'
|
|
4
4
|
import { ErrorPersistResult, SuccessfulPersistResult, usePersist } from '@contember/interface'
|
|
5
|
-
import { useErrorFormatter } from '../errors'
|
|
5
|
+
import { useErrorFormatter } from '../errors/index.js'
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* A hook `usePersistWithFeedback` that combines persistence with automatic feedback notifications. Triggers data persistence and shows success/error toasts.
|
|
9
|
+
*
|
|
10
|
+
* ## Returns
|
|
11
|
+
* A callback function that triggers persistence with feedback
|
|
12
|
+
*
|
|
13
|
+
* ## Example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const SaveButton = () => {
|
|
16
|
+
* const persistWithFeedback = usePersistWithFeedback()
|
|
17
|
+
*
|
|
18
|
+
* return (
|
|
19
|
+
* <button onClick={() => persistWithFeedback()}>
|
|
20
|
+
* Save changes
|
|
21
|
+
* </button>
|
|
22
|
+
* )
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
7
26
|
export const usePersistWithFeedback = () => {
|
|
8
27
|
const triggerPersist = usePersist()
|
|
9
28
|
const { onPersistSuccess } = usePersistFeedbackHandlers()
|
|
@@ -14,12 +33,42 @@ export const usePersistWithFeedback = () => {
|
|
|
14
33
|
}, [onPersistSuccess, triggerPersist])
|
|
15
34
|
}
|
|
16
35
|
|
|
36
|
+
/**
|
|
37
|
+
* A hook `usePersistFeedbackHandlers` that provides handlers for persistence feedback. Currently returns success handler. Used in {@link usePersistWithFeedback}.
|
|
38
|
+
*
|
|
39
|
+
* ## Returns
|
|
40
|
+
* Object containing persistence feedback handlers
|
|
41
|
+
*
|
|
42
|
+
* ## Example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* const { onPersistSuccess } = usePersistFeedbackHandlers()
|
|
45
|
+
*
|
|
46
|
+
* persistData().then(onPersistSuccess)
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
17
49
|
export const usePersistFeedbackHandlers = () => {
|
|
18
50
|
return {
|
|
19
51
|
onPersistSuccess: usePersistSuccessHandler(),
|
|
20
52
|
}
|
|
21
53
|
}
|
|
22
54
|
|
|
55
|
+
/**
|
|
56
|
+
* A hook `usePersistErrorHandler` that handles persistence errors by showing appropriate toast notifications.
|
|
57
|
+
*
|
|
58
|
+
* ## Returns
|
|
59
|
+
* Callback function to handle persistence errors
|
|
60
|
+
*
|
|
61
|
+
* ## Example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* const handleError = usePersistErrorHandler()
|
|
64
|
+
*
|
|
65
|
+
* try {
|
|
66
|
+
* await persist()
|
|
67
|
+
* } catch (error) {
|
|
68
|
+
* handleError(error)
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
23
72
|
export const usePersistErrorHandler = () => {
|
|
24
73
|
const showToast = useShowToast()
|
|
25
74
|
const errorFormatter = useErrorFormatter()
|
|
@@ -50,6 +99,19 @@ export const usePersistErrorHandler = () => {
|
|
|
50
99
|
}, [errorFormatter, showToast])
|
|
51
100
|
}
|
|
52
101
|
|
|
102
|
+
/**
|
|
103
|
+
* A hook `usePersistSuccessHandler` that handles successful persistence by showing appropriate toast notifications.
|
|
104
|
+
*
|
|
105
|
+
* ## Returns
|
|
106
|
+
* Callback function to handle successful persistence
|
|
107
|
+
*
|
|
108
|
+
* ## Example
|
|
109
|
+
* ```tsx
|
|
110
|
+
* const handleSuccess = usePersistSuccessHandler()
|
|
111
|
+
*
|
|
112
|
+
* persistData().then(result => handleSuccess(result))
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
53
115
|
export const usePersistSuccessHandler = () => {
|
|
54
116
|
const showToast = useShowToast()
|
|
55
117
|
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import { IdentityState, LogoutTrigger } from '@contember/react-identity'
|
|
2
|
-
import { Loader } from '
|
|
3
|
-
import { dict } from '
|
|
4
|
-
import { Button } from '
|
|
5
|
-
import { Card, CardContent } from '
|
|
2
|
+
import { Loader } from '~/lib'
|
|
3
|
+
import { dict } from '~/lib'
|
|
4
|
+
import { Button } from '~/lib'
|
|
5
|
+
import { Card, CardContent } from '~/lib'
|
|
6
6
|
import { CircleAlert } from 'lucide-react'
|
|
7
7
|
import { useEffect } from 'react'
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* `IdentityLoader` component manages the loading state of user identity and renders appropriate UI based on state.
|
|
11
|
+
*
|
|
12
|
+
* This component handles different identity states, such as loading, failure, and successful authentication,
|
|
13
|
+
* ensuring a smooth user experience.
|
|
14
|
+
*
|
|
15
|
+
* ## Example: Wrapping an authenticated component
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <IdentityLoader>
|
|
18
|
+
* <Dashboard />
|
|
19
|
+
* </IdentityLoader>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
9
22
|
export const IdentityLoader = ({ children }: {
|
|
10
23
|
children: React.ReactNode
|
|
11
24
|
}) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './binding'
|
|
2
|
-
export * from './delete'
|
|
3
|
-
export * from './hooks'
|
|
4
|
-
export * from './identity'
|
|
5
|
-
export * from './persist'
|
|
1
|
+
export * from './binding.js'
|
|
2
|
+
export * from './delete.js'
|
|
3
|
+
export * from './hooks.js'
|
|
4
|
+
export * from './identity.js'
|
|
5
|
+
export * from './persist.js'
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { useCallback, useState } from 'react'
|
|
2
|
-
import { AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogTitle } from '
|
|
2
|
+
import { AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogTitle } from '~/lib'
|
|
3
3
|
import { BlockNavigationOnDirtyStateResult, useBlockNavigationOnDirtyState } from '@contember/interface'
|
|
4
|
-
import { usePersistFeedbackHandlers } from './hooks'
|
|
5
|
-
import { Button } from '
|
|
4
|
+
import { usePersistFeedbackHandlers } from './hooks.js'
|
|
5
|
+
import { Button } from '~/lib'
|
|
6
6
|
import { SaveIcon } from 'lucide-react'
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* `NavigationGuardDialog` component prompts users with a confirmation dialog when attempting to navigate away
|
|
10
|
+
* from a page with unsaved changes.
|
|
11
|
+
*
|
|
12
|
+
* This component integrates with {@link useBlockNavigationOnDirtyState} to prevent accidental data loss.
|
|
13
|
+
* The user can choose to save, discard, or cancel the navigation attempt.
|
|
14
|
+
*
|
|
15
|
+
* ## Example: Basic Usage
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <NavigationGuardDialog />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
8
20
|
export const NavigationGuardDialog = () => {
|
|
9
21
|
const [resolver, setResolver] = useState<((value: BlockNavigationOnDirtyStateResult) => void) | null>(null)
|
|
10
22
|
|
|
@@ -1,15 +1,37 @@
|
|
|
1
1
|
import { PersistTrigger } from '@contember/interface'
|
|
2
2
|
import { ComponentProps, ReactNode } from 'react'
|
|
3
|
-
import { dict } from '
|
|
4
|
-
import { Button } from '
|
|
5
|
-
import { Loader } from '
|
|
6
|
-
import { usePersistSuccessHandler } from './hooks'
|
|
7
|
-
import { cn } from '
|
|
3
|
+
import { dict } from '~/lib'
|
|
4
|
+
import { Button } from '~/lib'
|
|
5
|
+
import { Loader } from '~/lib'
|
|
6
|
+
import { usePersistSuccessHandler } from './hooks.js'
|
|
7
|
+
import { cn } from '~/lib'
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Props for the {@link PersistButton} component.
|
|
11
|
+
*/
|
|
9
12
|
export interface PersistButtonProps extends ComponentProps<typeof Button> {
|
|
13
|
+
/**
|
|
14
|
+
* Custom button text (default: dictionary.persist.persistButton)
|
|
15
|
+
*/
|
|
10
16
|
label?: ReactNode
|
|
11
17
|
}
|
|
12
18
|
|
|
19
|
+
/**
|
|
20
|
+
* `PersistButton` is a button component that triggers a persistence action (saves unsaved data).
|
|
21
|
+
*
|
|
22
|
+
* ## Used hooks
|
|
23
|
+
* - {@link usePersistSuccessHandler}: Handles success feedback after persistence
|
|
24
|
+
*
|
|
25
|
+
* ## Example: Basic usage
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <PersistButton />
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* ## Example: Custom label
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <PersistButton label="Save Article" />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
13
35
|
export const PersistButton = ({ label, className, ...buttonProps }: PersistButtonProps) => {
|
|
14
36
|
return (
|
|
15
37
|
<PersistTrigger onPersistSuccess={usePersistSuccessHandler()}>
|
|
@@ -17,15 +17,15 @@ import {
|
|
|
17
17
|
import { createRequiredContext } from '@contember/react-utils'
|
|
18
18
|
import { GripVerticalIcon, PlusCircleIcon, TrashIcon } from 'lucide-react'
|
|
19
19
|
import { useCallback, useId, useState } from 'react'
|
|
20
|
-
import { usePersistSuccessHandler } from '../binding'
|
|
21
|
-
import { dict } from '
|
|
22
|
-
import { RepeaterDropIndicator, RepeaterRemoveItemButton } from '../repeater'
|
|
23
|
-
import { Button } from '
|
|
24
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '
|
|
25
|
-
import { Label } from '
|
|
26
|
-
import { Sheet, SheetClose, SheetContent, SheetFooter, SheetHeader, SheetTitle } from '
|
|
27
|
-
import { Switch } from '
|
|
28
|
-
import { uic } from '
|
|
20
|
+
import { usePersistSuccessHandler } from '../binding/index.js'
|
|
21
|
+
import { dict } from '~/lib'
|
|
22
|
+
import { RepeaterDropIndicator, RepeaterRemoveItemButton } from '../repeater/index.js'
|
|
23
|
+
import { Button } from '~/lib'
|
|
24
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '~/lib'
|
|
25
|
+
import { Label } from '~/lib'
|
|
26
|
+
import { Sheet, SheetClose, SheetContent, SheetFooter, SheetHeader, SheetTitle } from '~/lib'
|
|
27
|
+
import { Switch } from '~/lib'
|
|
28
|
+
import { uic } from '~/lib'
|
|
29
29
|
|
|
30
30
|
const BlockRepeaterItemsWrapperUI = uic('div', {
|
|
31
31
|
baseClass: 'rounded-sm border border-gray-300 px-4 py-8 flex flex-col',
|
|
@@ -49,13 +49,17 @@ const BlockRepeaterContentWrapperUI = uic('div', {
|
|
|
49
49
|
baseClass: 'flex flex-col gap-2',
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Props for {@link DefaultBlockRepeater} component.
|
|
54
|
+
*/
|
|
52
55
|
export type DefaultBlockRepeaterProps = BlockRepeaterProps
|
|
53
56
|
|
|
54
57
|
const [BlockRepeaterEditModeContext, useBlockRepeaterEditMode] = createRequiredContext<boolean>('BlockRepeaterEditMode')
|
|
55
58
|
|
|
56
59
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
60
|
+
* `DefaultBlockRepeater` component is a versatile and customizable block repeater shipped with a UI.
|
|
61
|
+
* It allows for the creation and management of repeatable content blocks within a form.
|
|
62
|
+
*
|
|
59
63
|
* Supports two modes of operation:
|
|
60
64
|
* - **Inline Edit Mode**: By providing only `children`, the blocks can be edited inline.
|
|
61
65
|
* - **Dual-Mode**: By providing both `form` and `children`, the component supports a dual-mode where blocks can be edited in a separate form view.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './block-repeater'
|
|
1
|
+
export * from './block-repeater.js'
|
|
@@ -14,8 +14,8 @@ import { Board, BoardColumn, BoardEachColumn, BoardEachItem, BoardItem, BoardNul
|
|
|
14
14
|
import { GripHorizontal, GripIcon } from 'lucide-react'
|
|
15
15
|
import { Component } from '@contember/interface'
|
|
16
16
|
import { ReactNode } from 'react'
|
|
17
|
-
import { uic } from '
|
|
18
|
-
import { DropIndicator } from '
|
|
17
|
+
import { uic } from '~/lib'
|
|
18
|
+
import { DropIndicator } from '~/lib'
|
|
19
19
|
|
|
20
20
|
export const BoardWrapperUI = uic('div', {
|
|
21
21
|
baseClass: 'flex gap-4 max-w-full overflow-x-auto -mx-2 px-2 pb-4',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './board'
|
|
1
|
+
export * from './board.js'
|
|
@@ -1,11 +1,31 @@
|
|
|
1
|
-
import { Button } from '
|
|
1
|
+
import { Button } from '~/lib'
|
|
2
2
|
import { ArrowLeftIcon } from 'lucide-react'
|
|
3
|
-
import { dict } from '
|
|
3
|
+
import { dict } from '~/lib'
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Props for the {@link BackButton} component.
|
|
7
|
+
*/
|
|
5
8
|
export type BackButtonProps = {
|
|
9
|
+
/**
|
|
10
|
+
* Optional custom button text (default: dictionary backButton.back value)
|
|
11
|
+
*/
|
|
6
12
|
label?: string
|
|
7
13
|
}
|
|
8
14
|
|
|
15
|
+
/**
|
|
16
|
+
* `BackButton` is a navigation button that returns the user to the previous page using the browser's history API.
|
|
17
|
+
* It provides a default label but allows customization via the `label` prop.
|
|
18
|
+
*
|
|
19
|
+
* ## Example: Basic usage
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <BackButton />
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* ## Example: Custom label
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <BackButton label="Return to list" />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
9
29
|
export const BackButton = ({ label }: BackButtonProps) => {
|
|
10
30
|
return (
|
|
11
31
|
<Button
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './back-button'
|
|
2
|
-
export * from './link-back-button'
|
|
1
|
+
export * from './back-button.js'
|
|
2
|
+
export * from './link-back-button.js'
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { ReactNode } from 'react'
|
|
2
|
-
import { AnchorButton } from '
|
|
2
|
+
import { AnchorButton } from '~/lib'
|
|
3
3
|
import { ArrowLeftIcon } from 'lucide-react'
|
|
4
4
|
import { Link, type RoutingLinkTarget } from '@contember/interface'
|
|
5
|
-
import { Slots } from '../layout'
|
|
5
|
+
import { Slots } from '../layout/index.js'
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* `LinkBackButton` is a navigational button that provides a back navigation link.
|
|
9
|
+
* It wraps the link inside a `Slots.Back` container and renders an `AnchorButton` with an arrow icon.
|
|
10
|
+
*
|
|
11
|
+
* ## Example: Basic usage
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <LinkBackButton to="articles">Back to Articles</LinkBackButton>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
7
16
|
export const LinkBackButton = ({ children, to }: {
|
|
8
17
|
children: ReactNode
|
|
9
18
|
to: RoutingLinkTarget
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { ReactNode } from 'react'
|
|
3
|
-
import { DataGridEnumFieldTooltip, DataGridHasManyTooltip, DataGridHasOneTooltip } from './filters'
|
|
4
|
-
import { DataGridTooltipLabel } from './ui'
|
|
3
|
+
import { DataGridEnumFieldTooltip, DataGridHasManyTooltip, DataGridHasOneTooltip } from './filters/index.js'
|
|
4
|
+
import { DataGridTooltipLabel } from './ui.js'
|
|
5
5
|
import {
|
|
6
6
|
Component,
|
|
7
7
|
Field,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
SugaredRelativeSingleEntity,
|
|
13
13
|
SugaredRelativeSingleField,
|
|
14
14
|
} from '@contember/interface'
|
|
15
|
-
import { useEnumOptionsFormatter } from '../labels'
|
|
15
|
+
import { useEnumOptionsFormatter } from '../labels/index.js'
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Props for {@link DataGridHasOneCell}.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { cn } from '
|
|
2
|
-
import { Button } from '
|
|
1
|
+
import { cn } from '~/lib'
|
|
2
|
+
import { Button } from '~/lib'
|
|
3
3
|
import { ReactNode } from 'react'
|
|
4
4
|
import { ArrowDownAZIcon, ArrowUpDownIcon, ArrowUpZaIcon, EyeOffIcon, FilterIcon } from 'lucide-react'
|
|
5
5
|
import { DataViewSortingSwitch, DataViewSortingTrigger, DataViewVisibilityTrigger, useDataViewFilter } from '@contember/react-dataview'
|
|
6
|
-
import { dict } from '
|
|
6
|
+
import { dict } from '~/lib'
|
|
7
7
|
import { Component } from '@contember/interface'
|
|
8
|
-
import { Popover, PopoverContent, PopoverTrigger } from '
|
|
8
|
+
import { Popover, PopoverContent, PopoverTrigger } from '~/lib'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Props for {@link DataGridColumnHeader}.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Component, Field, SugaredRelativeEntityList, SugaredRelativeSingleEntity } from '@contember/interface'
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
import { ReactNode } from 'react'
|
|
4
|
-
import { TableCell, TableHead } from '
|
|
5
|
-
import { DataGridColumnHeader } from './column-header'
|
|
4
|
+
import { TableCell, TableHead } from '~/lib'
|
|
5
|
+
import { DataGridColumnHeader } from './column-header.js'
|
|
6
6
|
import {
|
|
7
7
|
DataViewBooleanFilter,
|
|
8
8
|
DataViewDateFilter,
|
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
DataViewNumberFilter,
|
|
16
16
|
DataViewTextFilter,
|
|
17
17
|
} from '@contember/react-dataview'
|
|
18
|
-
import { formatBoolean, formatDate, formatDateTime, formatNumber } from '../formatting'
|
|
19
|
-
import { DataGridEnumCell, DataGridEnumListCell, DataGridHasManyCell, DataGridHasOneCell } from './cells'
|
|
20
|
-
import { cn } from '
|
|
18
|
+
import { formatBoolean, formatDate, formatDateTime, formatNumber } from '../formatting/index.js'
|
|
19
|
+
import { DataGridEnumCell, DataGridEnumListCell, DataGridHasManyCell, DataGridHasOneCell } from './cells.js'
|
|
20
|
+
import { cn } from '~/lib'
|
|
21
21
|
import {
|
|
22
22
|
DataGridBooleanFilterControls,
|
|
23
23
|
DataGridDateFilterControls,
|
|
@@ -27,20 +27,21 @@ import {
|
|
|
27
27
|
DataGridRelationFilterControls,
|
|
28
28
|
DataGridRelationFilteredItemsList,
|
|
29
29
|
DataGridTextFilterInner,
|
|
30
|
-
} from './filters'
|
|
30
|
+
} from './filters/index.js'
|
|
31
31
|
import { CheckIcon, XIcon } from 'lucide-react'
|
|
32
|
-
import { DataViewFieldLabel, DataViewHasManyLabel, DataViewHasOneLabel } from './labels'
|
|
33
|
-
import { DataGridColumnLeaf } from './column-leaf'
|
|
32
|
+
import { DataViewFieldLabel, DataViewHasManyLabel, DataViewHasOneLabel } from './labels.js'
|
|
33
|
+
import { DataGridColumnLeaf } from './column-leaf.js'
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* `DataGridActionColumn` renders a column with action buttons in a `DataGridTable`.
|
|
37
|
+
* It is typically used to provide interactive controls such as edit, delete, or custom actions.
|
|
37
38
|
*
|
|
38
|
-
* ## Example
|
|
39
|
+
* ## Example: Basic usage with a button
|
|
39
40
|
* ```tsx
|
|
40
41
|
* <DataGridTable>
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
42
|
+
* <DataGridActionColumn>
|
|
43
|
+
* <Button variant="outline">Click me</Button>
|
|
44
|
+
* </DataGridActionColumn>
|
|
44
45
|
* </DataGridTable>
|
|
45
46
|
* ```
|
|
46
47
|
*/
|
|
@@ -84,10 +85,18 @@ export type DataGridTextColumnProps = {
|
|
|
84
85
|
/**
|
|
85
86
|
* Renders a column with text content and column controls in a header. Should be used in a {@link DataGridTable}.
|
|
86
87
|
*
|
|
87
|
-
* ## Example
|
|
88
|
+
* ## Example: Basic Usage
|
|
88
89
|
* ```tsx
|
|
89
90
|
* <DataGridTable>
|
|
90
91
|
* <DataGridTextColumn field="title" />
|
|
92
|
+
* <DataGridTextColumn
|
|
93
|
+
* field="subtitle"
|
|
94
|
+
* format={it => (
|
|
95
|
+
* <span className="text-blue-500 flex items-center gap-2">
|
|
96
|
+
* {it}
|
|
97
|
+
* </span>
|
|
98
|
+
* )}
|
|
99
|
+
* />
|
|
91
100
|
* <DataGridTextColumn field="description" format={it => it.slice(0, 100)} />
|
|
92
101
|
* </DataGridTable>
|
|
93
102
|
* ```
|
|
@@ -140,6 +149,8 @@ export type DataGridBooleanColumnProps = {
|
|
|
140
149
|
* ```tsx
|
|
141
150
|
* <DataGridTable>
|
|
142
151
|
* <DataGridBooleanColumn field="isPublished" />
|
|
152
|
+
* <DataGridBooleanColumn field="isActive" format={it => it ? 'Hooray' : 'Oh noooo!'} />
|
|
153
|
+
* <DataGridBooleanColumn field="hasImage" format={it => it ? <CheckIcon /> : <XIcon />} />
|
|
143
154
|
* </DataGridTable>
|
|
144
155
|
* ```
|
|
145
156
|
*/
|
|
@@ -193,6 +204,9 @@ export type DataGridNumberColumnProps = {
|
|
|
193
204
|
* ```tsx
|
|
194
205
|
* <DataGridTable>
|
|
195
206
|
* <DataGridNumberColumn field="price" format={it => it.toFixed(2)} />
|
|
207
|
+
* <DataGridNumberColumn field="price" header="Price with currency">
|
|
208
|
+
* <Field field="price" /> <Field field="currency" />
|
|
209
|
+
* </DataGridNumberColumn>
|
|
196
210
|
* </DataGridTable>
|
|
197
211
|
* ```
|
|
198
212
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EyeIcon, EyeOffIcon } from 'lucide-react'
|
|
2
|
-
import { dict } from '
|
|
2
|
+
import { dict } from '~/lib'
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { DataViewElementData, DataViewVisibilityTrigger, useDataViewElements } from '@contember/react-dataview'
|
|
5
|
-
import { ScrollArea } from '
|
|
5
|
+
import { ScrollArea } from '~/lib'
|
|
6
6
|
import { Fragment } from 'react'
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Button } from '
|
|
1
|
+
import { Button } from '~/lib'
|
|
2
2
|
import { DownloadIcon } from 'lucide-react'
|
|
3
3
|
import { DataViewExportTrigger } from '@contember/react-dataview'
|
|
4
4
|
import * as React from 'react'
|
|
5
5
|
import { ReactNode, useMemo } from 'react'
|
|
6
|
-
import { dict } from '
|
|
6
|
+
import { dict } from '~/lib'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Button for exporting data grid to CSV.
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { ReactNode } from 'react'
|
|
3
3
|
import { DataViewBooleanFilter, DataViewBooleanFilterProps, DataViewBooleanFilterTrigger, DataViewNullFilterTrigger } from '@contember/react-dataview'
|
|
4
|
-
import { Popover, PopoverContent, PopoverTrigger } from '
|
|
5
|
-
import { DataGridActiveFilterUI, DataGridFilterSelectTriggerUI, DataGridSingleFilterUI } from '../ui'
|
|
6
|
-
import { DataGridNullFilter } from './common'
|
|
7
|
-
import { formatBoolean } from '../../formatting'
|
|
8
|
-
import { Button } from '
|
|
9
|
-
import { dict } from '
|
|
4
|
+
import { Popover, PopoverContent, PopoverTrigger } from '~/lib'
|
|
5
|
+
import { DataGridActiveFilterUI, DataGridFilterSelectTriggerUI, DataGridSingleFilterUI } from '../ui.js'
|
|
6
|
+
import { DataGridNullFilter } from './common.js'
|
|
7
|
+
import { formatBoolean } from '../../formatting/index.js'
|
|
8
|
+
import { Button } from '~/lib'
|
|
9
|
+
import { dict } from '~/lib'
|
|
10
10
|
import { Component } from '@contember/interface'
|
|
11
|
-
import { DataGridFilterMobileHiding } from './mobile'
|
|
12
|
-
import { DataViewFieldLabel } from '../labels'
|
|
11
|
+
import { DataGridFilterMobileHiding } from './mobile.js'
|
|
12
|
+
import { DataViewFieldLabel } from '../labels.js'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for {@link DataGridBooleanFilter}.
|
|
16
|
+
*
|
|
17
|
+
* Extends {@link DataViewBooleanFilterProps}, excluding the `children` prop.
|
|
16
18
|
*/
|
|
17
19
|
export type DataGridBooleanFilterProps =
|
|
18
20
|
& Omit<DataViewBooleanFilterProps, 'children'>
|
|
19
21
|
& {
|
|
22
|
+
/** Label for the filter UI */
|
|
20
23
|
label: ReactNode
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* ## Props {@link DataGridBooleanFilterProps}
|
|
27
|
-
* field, label, ?name
|
|
27
|
+
* `DataGridBooleanFilter` provides a boolean filter for `DataGrid` with a default UI.
|
|
28
28
|
*
|
|
29
29
|
* ## Example
|
|
30
30
|
* ```tsx
|
|
31
|
-
* <DataGridBooleanFilter field=
|
|
31
|
+
* <DataGridBooleanFilter field="locked" label="Locked" />
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
export const DataGridBooleanFilter = Component(({ label, ...props }: DataGridBooleanFilterProps) => (
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { useCallback } from 'react'
|
|
3
3
|
import { useDataViewFilterName, useDataViewNullFilter } from '@contember/react-dataview'
|
|
4
|
-
import { DataGridFilterSelectItemUI } from '../ui'
|
|
5
|
-
import { dict } from '
|
|
4
|
+
import { DataGridFilterSelectItemUI } from '../ui.js'
|
|
5
|
+
import { dict } from '~/lib'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|