@donotdev/ui 0.0.23 → 0.0.25
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/dist/crud/components/CrudCardLink.d.ts +1 -1
- package/dist/crud/components/CrudCardLink.d.ts.map +1 -1
- package/dist/crud/components/CrudCardLink.js +5 -1
- package/dist/crud/components/EntityCardList.d.ts +1 -1
- package/dist/crud/components/EntityCardList.d.ts.map +1 -1
- package/dist/crud/components/EntityCardList.js +5 -1
- package/dist/crud/components/EntityDisplayRenderer.d.ts +1 -1
- package/dist/crud/components/EntityDisplayRenderer.d.ts.map +1 -1
- package/dist/crud/components/EntityDisplayRenderer.js +5 -1
- package/dist/crud/components/EntityFormRenderer.d.ts +1 -1
- package/dist/crud/components/EntityFormRenderer.d.ts.map +1 -1
- package/dist/crud/components/EntityFormRenderer.js +6 -1
- package/dist/crud/components/EntityList.d.ts +1 -1
- package/dist/crud/components/EntityList.d.ts.map +1 -1
- package/dist/crud/components/EntityList.js +5 -1
- package/dist/crud/components/EntityRecommendations.d.ts.map +1 -1
- package/dist/crud/components/EntityRecommendations.js +5 -1
- package/dist/crud/components/EntityWorkflow.d.ts +2 -2
- package/dist/crud/components/EntityWorkflow.d.ts.map +1 -1
- package/dist/crud/components/EntityWorkflow.js +5 -1
- package/dist/crud/crudImports.d.ts +36 -0
- package/dist/crud/crudImports.d.ts.map +1 -0
- package/dist/crud/crudImports.js +39 -0
- package/dist/dndev-next.css +100 -169
- package/dist/dndev.css +108 -183
- package/dist/index.js +4 -4
- package/dist/styles/index.css +108 -183
- package/package.json +7 -11
|
@@ -12,6 +12,6 @@ import type { CrudCardProps } from '@donotdev/core';
|
|
|
12
12
|
* CrudCard with Link wrapping for web navigation.
|
|
13
13
|
* When detailHref is provided, wraps the card in a Link for a11y/SEO.
|
|
14
14
|
*/
|
|
15
|
-
export declare function CrudCard({ detailHref, onClick, ...rest }: CrudCardProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function CrudCard({ detailHref, onClick, ...rest }: CrudCardProps): import("react/jsx-runtime").JSX.Element | null;
|
|
16
16
|
export default CrudCard;
|
|
17
17
|
//# sourceMappingURL=CrudCardLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrudCardLink.d.ts","sourceRoot":"","sources":["../../../src/crud/components/CrudCardLink.tsx"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"CrudCardLink.d.ts","sourceRoot":"","sources":["../../../src/crud/components/CrudCardLink.tsx"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAQpD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,aAAa,kDAsBvE;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { CrudCard as BaseCrudCard } from '
|
|
3
|
+
import { isCrudModuleAvailable, CrudCard as BaseCrudCard, } from '../crudImports';
|
|
4
4
|
import { Link } from '../../routing';
|
|
5
5
|
/**
|
|
6
6
|
* CrudCard with Link wrapping for web navigation.
|
|
7
7
|
* When detailHref is provided, wraps the card in a Link for a11y/SEO.
|
|
8
8
|
*/
|
|
9
9
|
export function CrudCard({ detailHref, onClick, ...rest }) {
|
|
10
|
+
// Safe guard: isCrudModuleAvailable is a module-level constant (immutable after load).
|
|
11
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
12
|
+
if (!isCrudModuleAvailable)
|
|
13
|
+
return null;
|
|
10
14
|
// When detailHref is set, Link handles navigation — don't pass onClick to inner card
|
|
11
15
|
const card = (_jsx(BaseCrudCard, { ...rest, onClick: detailHref ? undefined : onClick }));
|
|
12
16
|
if (detailHref) {
|
|
@@ -12,5 +12,5 @@ export type { EntityCardListProps };
|
|
|
12
12
|
* - Auto-routing when handler not provided
|
|
13
13
|
*/
|
|
14
14
|
export declare function EntityCardList({ entity, basePath, onClick, cols, staleTime, // 30 minutes default cache
|
|
15
|
-
filter, hideFilters, resultLabel, tone, }: EntityCardListProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
filter, hideFilters, resultLabel, tone, }: EntityCardListProps): import("react/jsx-runtime").JSX.Element | null;
|
|
16
16
|
//# sourceMappingURL=EntityCardList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityCardList.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityCardList.tsx"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,mBAAmB,EAAgB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"EntityCardList.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityCardList.tsx"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,mBAAmB,EAAgB,MAAM,gBAAgB,CAAC;AAYxE,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAmB,EACnB,SAA0B,EAAE,2BAA2B;AACvD,MAAM,EACN,WAAmB,EACnB,WAAW,EACX,IAAI,GACL,EAAE,mBAAmB,kDA+LrB"}
|
|
@@ -17,7 +17,7 @@ import { Heart } from 'lucide-react';
|
|
|
17
17
|
import { useMemo, useCallback } from 'react';
|
|
18
18
|
import { Card, Grid, Stack, Text, Spinner, Section, Button, } from '@donotdev/components';
|
|
19
19
|
import { useTranslation, getListCardFieldNames } from '@donotdev/core';
|
|
20
|
-
import { useCrudCardList, EntityFilters, useEntityFavorites, useCrudFilters, } from '
|
|
20
|
+
import { isCrudModuleAvailable, useCrudCardList, EntityFilters, useEntityFavorites, useCrudFilters, } from '../crudImports';
|
|
21
21
|
import { CrudCard } from './CrudCardLink';
|
|
22
22
|
import { useNavigate } from '../../routing';
|
|
23
23
|
/**
|
|
@@ -33,6 +33,10 @@ import { useNavigate } from '../../routing';
|
|
|
33
33
|
*/
|
|
34
34
|
export function EntityCardList({ entity, basePath, onClick, cols = [1, 2, 3, 4], staleTime = 1000 * 60 * 30, // 30 minutes default cache
|
|
35
35
|
filter, hideFilters = false, resultLabel, tone, }) {
|
|
36
|
+
// Safe guard: isCrudModuleAvailable is a module-level constant (immutable after load).
|
|
37
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
38
|
+
if (!isCrudModuleAvailable)
|
|
39
|
+
return null;
|
|
36
40
|
const navigate = useNavigate();
|
|
37
41
|
const base = basePath ?? `/${entity.collection}`;
|
|
38
42
|
// useCrudCardList -> handles fetching + client-side filter/search/sort via `processed`
|
|
@@ -16,6 +16,6 @@ export type { EntityDisplayRendererProps };
|
|
|
16
16
|
* <EntityDisplayRenderer entity={carEntity} id={carId} />
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export declare function EntityDisplayRenderer<T extends EntityRecord = EntityRecord>({ entity, id, t, className, loadingMessage, notFoundMessage, viewerRole: viewerRoleProp, excludeFields, }: EntityDisplayRendererProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function EntityDisplayRenderer<T extends EntityRecord = EntityRecord>({ entity, id, t, className, loadingMessage, notFoundMessage, viewerRole: viewerRoleProp, excludeFields, }: EntityDisplayRendererProps<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
20
20
|
export default EntityDisplayRenderer;
|
|
21
21
|
//# sourceMappingURL=EntityDisplayRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityDisplayRenderer.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityDisplayRenderer.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"EntityDisplayRenderer.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityDisplayRenderer.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAS/E,YAAY,EAAE,0BAA0B,EAAE,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,EAAE,EAC3E,MAAM,EACN,EAAE,EACF,CAAC,EACD,SAAc,EACd,cAAc,EACd,eAAe,EACf,UAAU,EAAE,cAAc,EAC1B,aAAa,GACd,EAAE,0BAA0B,CAAC,CAAC,CAAC,kDA8M/B;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { useEffect, useState, useMemo } from 'react';
|
|
14
14
|
import { Stack, Spinner } from '@donotdev/components';
|
|
15
15
|
import { useTranslation, isFieldVisible } from '@donotdev/core';
|
|
16
|
-
import { useCrud, DisplayFieldRenderer } from '
|
|
16
|
+
import { isCrudModuleAvailable, useCrud, DisplayFieldRenderer, } from '../crudImports';
|
|
17
17
|
import { useAuthSafe } from '../../utils/useAuthSafe';
|
|
18
18
|
/**
|
|
19
19
|
* EntityDisplayRenderer - Automatically fetches and displays entity data
|
|
@@ -32,6 +32,10 @@ import { useAuthSafe } from '../../utils/useAuthSafe';
|
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
export function EntityDisplayRenderer({ entity, id, t, className = '', loadingMessage, notFoundMessage, viewerRole: viewerRoleProp, excludeFields, }) {
|
|
35
|
+
// Safe guard: isCrudModuleAvailable is a module-level constant (immutable after load).
|
|
36
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
37
|
+
if (!isCrudModuleAvailable)
|
|
38
|
+
return null;
|
|
35
39
|
// Auto-detect role from auth; prop overrides
|
|
36
40
|
const authRole = useAuthSafe('userRole');
|
|
37
41
|
const viewerRole = viewerRoleProp ?? authRole;
|
|
@@ -13,6 +13,6 @@ export type { EntityFormRendererProps };
|
|
|
13
13
|
* @since 0.0.1
|
|
14
14
|
* @author AMBROISE PARK Consulting
|
|
15
15
|
*/
|
|
16
|
-
export declare function EntityFormRenderer<T extends EntityRecord = EntityRecord>({ entity, onSubmit, t, className, submitText, loading, defaultValues, submitVariant, secondaryButtonText, secondaryButtonVariant, onSecondarySubmit, viewerRole: viewerRoleProp, operation, formId: externalFormId, cancelText, cancelPath, successPath, onCancel, warnOnUnsavedChanges, unsavedChangesMessage, hideVisibilityInfo, }: EntityFormRendererProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function EntityFormRenderer<T extends EntityRecord = EntityRecord>({ entity, onSubmit, t, className, submitText, loading, defaultValues, submitVariant, secondaryButtonText, secondaryButtonVariant, onSecondarySubmit, viewerRole: viewerRoleProp, operation, formId: externalFormId, cancelText, cancelPath, successPath, onCancel, warnOnUnsavedChanges, unsavedChangesMessage, hideVisibilityInfo, }: EntityFormRendererProps<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
17
17
|
export default EntityFormRenderer;
|
|
18
18
|
//# sourceMappingURL=EntityFormRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityFormRenderer.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityFormRenderer.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EACV,uBAAuB,EACvB,YAAY,EAEb,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"EntityFormRenderer.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityFormRenderer.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EACV,uBAAuB,EACvB,YAAY,EAEb,MAAM,gBAAgB,CAAC;AAgBxB,YAAY,EAAE,uBAAuB,EAAE,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,EAAE,EACxE,MAAM,EACN,QAAQ,EACR,CAAC,EACD,SAAc,EACd,UAAU,EACV,OAAe,EACf,aAAa,EACb,aAAyB,EACzB,mBAAmB,EACnB,sBAAkC,EAClC,iBAAiB,EACjB,UAAU,EAAE,cAAc,EAC1B,SAA6C,EAC7C,MAAM,EAAE,cAAc,EACtB,UAAU,EACV,UAAU,EACV,WAAW,EACX,QAAQ,EACR,oBAA2B,EAC3B,qBAAqB,EACrB,kBAA0B,GAC3B,EAAE,uBAAuB,CAAC,CAAC,CAAC,kDAgd5B;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -14,7 +14,7 @@ import { useEffect, useId, useMemo, useState } from 'react';
|
|
|
14
14
|
import { FormProvider } from 'react-hook-form';
|
|
15
15
|
import { Badge, Button, DropdownMenu, Grid, Stack, Spinner, } from '@donotdev/components';
|
|
16
16
|
import { hasRoleAccess, useTranslation } from '@donotdev/core';
|
|
17
|
-
import { DisplayFieldRenderer, FormFieldRenderer, UploadProvider, useEntityForm, useUnsavedChangesWarning, useFormStore, useFieldConditions, } from '
|
|
17
|
+
import { isCrudModuleAvailable, DisplayFieldRenderer, FormFieldRenderer, UploadProvider, useEntityForm, useUnsavedChangesWarning, useFormStore, useFieldConditions, } from '../crudImports';
|
|
18
18
|
import { useNavigate } from '../../routing';
|
|
19
19
|
import { useAuthSafe } from '../../utils/useAuthSafe';
|
|
20
20
|
/**
|
|
@@ -31,6 +31,11 @@ import { useAuthSafe } from '../../utils/useAuthSafe';
|
|
|
31
31
|
* @author AMBROISE PARK Consulting
|
|
32
32
|
*/
|
|
33
33
|
export function EntityFormRenderer({ entity, onSubmit, t, className = '', submitText, loading = false, defaultValues, submitVariant = 'primary', secondaryButtonText, secondaryButtonVariant = 'outline', onSecondarySubmit, viewerRole: viewerRoleProp, operation = defaultValues ? 'edit' : 'create', formId: externalFormId, cancelText, cancelPath, successPath, onCancel, warnOnUnsavedChanges = true, unsavedChangesMessage, hideVisibilityInfo = false, }) {
|
|
34
|
+
// Safe guard: isCrudModuleAvailable is a module-level constant (immutable after load).
|
|
35
|
+
// Hooks below are either ALL called or NONE — no Rules-of-Hooks violation at runtime.
|
|
36
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
37
|
+
if (!isCrudModuleAvailable)
|
|
38
|
+
return null;
|
|
34
39
|
const navigate = useNavigate();
|
|
35
40
|
// Auto-detect role from auth; prop overrides (e.g. View-As preview)
|
|
36
41
|
const authRole = useAuthSafe('userRole');
|
|
@@ -10,5 +10,5 @@ export type { EntityListProps };
|
|
|
10
10
|
* - Edit and Delete actions (admin only)
|
|
11
11
|
* - Auto-routing when handlers not provided
|
|
12
12
|
*/
|
|
13
|
-
export declare function EntityList({ entity, basePath, onClick, hideFilters, pagination, pageSize: pageSizeProp, queryOptions, exportable, }: EntityListProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function EntityList({ entity, basePath, onClick, hideFilters, pagination, pageSize: pageSizeProp, queryOptions, exportable, }: EntityListProps): import("react/jsx-runtime").JSX.Element | null;
|
|
14
14
|
//# sourceMappingURL=EntityList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityList.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityList.tsx"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"EntityList.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityList.tsx"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AActD,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,QAAQ,EACR,OAAO,EACP,WAAmB,EACnB,UAAmB,EACnB,QAAQ,EAAE,YAAY,EACtB,YAAY,EACZ,UAAiB,GAClB,EAAE,eAAe,kDAyRjB"}
|
|
@@ -17,7 +17,7 @@ import { RefreshCw, Plus, Trash2, Edit, Search } from 'lucide-react';
|
|
|
17
17
|
import { useMemo, useCallback, useState } from 'react';
|
|
18
18
|
import { DataTable, Button, Stack, ActionButton, Section, Input, } from '@donotdev/components';
|
|
19
19
|
import { useTranslation } from '@donotdev/core';
|
|
20
|
-
import { translateFieldLabel, useCrud, useCrudList, EntityFilters, formatValue, useReferenceResolver, } from '
|
|
20
|
+
import { isCrudModuleAvailable, translateFieldLabel, useCrud, useCrudList, EntityFilters, formatValue, useReferenceResolver, } from '../crudImports';
|
|
21
21
|
import { useNavigate } from '../../routing';
|
|
22
22
|
/**
|
|
23
23
|
* Entity List Component - Table view for admin/internal operations
|
|
@@ -30,6 +30,10 @@ import { useNavigate } from '../../routing';
|
|
|
30
30
|
* - Auto-routing when handlers not provided
|
|
31
31
|
*/
|
|
32
32
|
export function EntityList({ entity, basePath, onClick, hideFilters = false, pagination = 'auto', pageSize: pageSizeProp, queryOptions, exportable = true, }) {
|
|
33
|
+
// Safe guard: isCrudModuleAvailable is a module-level constant (immutable after load).
|
|
34
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
35
|
+
if (!isCrudModuleAvailable)
|
|
36
|
+
return null;
|
|
33
37
|
const navigate = useNavigate();
|
|
34
38
|
const base = basePath ?? `/${entity.collection}`;
|
|
35
39
|
// Pre-fetch referenced collections for display resolution
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityRecommendations.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityRecommendations.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAKjE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,IAAQ,EACR,SAAS,GACV,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"EntityRecommendations.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityRecommendations.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAKjE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,IAAQ,EACR,SAAS,GACV,EAAE,0BAA0B,kDA2B5B"}
|
|
@@ -11,7 +11,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
* @author AMBROISE PARK Consulting
|
|
12
12
|
*/
|
|
13
13
|
import { Section } from '@donotdev/components';
|
|
14
|
-
import { useCrudCardList } from '
|
|
14
|
+
import { isCrudModuleAvailable, useCrudCardList } from '../crudImports';
|
|
15
15
|
import { CrudCard } from './CrudCardLink';
|
|
16
16
|
/**
|
|
17
17
|
* Displays a grid of related entity cards.
|
|
@@ -31,6 +31,10 @@ import { CrudCard } from './CrudCardLink';
|
|
|
31
31
|
* />
|
|
32
32
|
*/
|
|
33
33
|
export function EntityRecommendations({ entity, queryOptions, title, basePath, cols = 3, className, }) {
|
|
34
|
+
// Safe guard: isCrudModuleAvailable is a module-level constant (immutable after load).
|
|
35
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
36
|
+
if (!isCrudModuleAvailable)
|
|
37
|
+
return null;
|
|
34
38
|
const { items, loading } = useCrudCardList(entity, {
|
|
35
39
|
queryOptions,
|
|
36
40
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { WorkflowConfig, EntityWorkflowReturn } from '@donotdev/crud';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
/** Props for EntityWorkflow */
|
|
4
4
|
export interface EntityWorkflowProps {
|
|
@@ -23,5 +23,5 @@ export interface EntityWorkflowProps {
|
|
|
23
23
|
* Default mode: auto-renders Stepper + form + navigation buttons.
|
|
24
24
|
* Custom mode: pass a render prop as children for full control.
|
|
25
25
|
*/
|
|
26
|
-
export declare function EntityWorkflow({ workflow: config, onComplete, onStepChange, defaultValues, viewerRole, children, className, }: EntityWorkflowProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare function EntityWorkflow({ workflow: config, onComplete, onStepChange, defaultValues, viewerRole, children, className, }: EntityWorkflowProps): import("react/jsx-runtime").JSX.Element | null;
|
|
27
27
|
//# sourceMappingURL=EntityWorkflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityWorkflow.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityWorkflow.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EntityWorkflow.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityWorkflow.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,cAAc,EAEd,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,+BAA+B;AAC/B,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,QAAQ,EAAE,cAAc,CAAC;IACzB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,iCAAiC;IACjC,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,8CAA8C;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,oBAAoB,KAAK,SAAS,CAAC;IACnD,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EACV,YAAY,EACZ,aAAa,EACb,UAAU,EACV,QAAQ,EACR,SAAS,GACV,EAAE,mBAAmB,kDA4FrB"}
|
|
@@ -23,7 +23,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
23
23
|
*/
|
|
24
24
|
import { Button, Stack, Stepper } from '@donotdev/components';
|
|
25
25
|
import { useTranslation } from '@donotdev/core';
|
|
26
|
-
import {
|
|
26
|
+
import { isCrudModuleAvailable, useEntityWorkflow } from '../crudImports';
|
|
27
27
|
import { EntityFormRenderer } from './EntityFormRenderer';
|
|
28
28
|
/**
|
|
29
29
|
* EntityWorkflow — renders a multi-step entity workflow.
|
|
@@ -32,6 +32,10 @@ import { EntityFormRenderer } from './EntityFormRenderer';
|
|
|
32
32
|
* Custom mode: pass a render prop as children for full control.
|
|
33
33
|
*/
|
|
34
34
|
export function EntityWorkflow({ workflow: config, onComplete, onStepChange, defaultValues, viewerRole, children, className, }) {
|
|
35
|
+
// Safe guard: isCrudModuleAvailable is a module-level constant (immutable after load).
|
|
36
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
37
|
+
if (!isCrudModuleAvailable)
|
|
38
|
+
return null;
|
|
35
39
|
const { t } = useTranslation('crud');
|
|
36
40
|
const wf = useEntityWorkflow(config, {
|
|
37
41
|
onComplete,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Safe import hub for @donotdev/crud
|
|
3
|
+
* @description Single module-level import using the proven `import * as` pattern.
|
|
4
|
+
* When crud is not installed, Vite aliases it to an empty module — all extractions
|
|
5
|
+
* resolve to `undefined`. This is immutable: the decision is made once at module load.
|
|
6
|
+
*
|
|
7
|
+
* Components import from here instead of directly from '@donotdev/crud'.
|
|
8
|
+
* Type-only imports (`import type`) can still go directly to '@donotdev/crud'.
|
|
9
|
+
*
|
|
10
|
+
* @see useCrudSafe.ts — same pattern, proven in production
|
|
11
|
+
* @version 0.0.1
|
|
12
|
+
* @since 0.0.25
|
|
13
|
+
* @author AMBROISE PARK Consulting
|
|
14
|
+
*/
|
|
15
|
+
import * as crudModule from '@donotdev/crud';
|
|
16
|
+
/** true when @donotdev/crud resolved with real exports */
|
|
17
|
+
export declare const isCrudModuleAvailable: boolean;
|
|
18
|
+
export declare const useEntityForm: typeof crudModule.useEntityForm;
|
|
19
|
+
export declare const useUnsavedChangesWarning: typeof crudModule.useUnsavedChangesWarning;
|
|
20
|
+
export declare const useFormStore: import("zustand").UseBoundStore<import("zustand").StoreApi<crudModule.FormStoreState & crudModule.FormStoreActions & import("@donotdev/stores").DoNotDevStore>>;
|
|
21
|
+
export declare const useFieldConditions: typeof crudModule.useFieldConditions;
|
|
22
|
+
export declare const useCrud: typeof crudModule.useCrud;
|
|
23
|
+
export declare const useCrudList: typeof crudModule.useCrudList;
|
|
24
|
+
export declare const useCrudCardList: typeof crudModule.useCrudCardList;
|
|
25
|
+
export declare const useEntityFavorites: typeof crudModule.useEntityFavorites;
|
|
26
|
+
export declare const useCrudFilters: typeof crudModule.useCrudFilters;
|
|
27
|
+
export declare const useEntityWorkflow: typeof crudModule.useEntityWorkflow;
|
|
28
|
+
export declare const useReferenceResolver: typeof crudModule.useReferenceResolver;
|
|
29
|
+
export declare const DisplayFieldRenderer: typeof crudModule.DisplayFieldRenderer;
|
|
30
|
+
export declare const FormFieldRenderer: typeof crudModule.FormFieldRenderer;
|
|
31
|
+
export declare const UploadProvider: typeof crudModule.UploadProvider;
|
|
32
|
+
export declare const EntityFilters: typeof crudModule.EntityFilters;
|
|
33
|
+
export declare const CrudCard: typeof crudModule.CrudCard;
|
|
34
|
+
export declare const translateFieldLabel: typeof crudModule.translateFieldLabel;
|
|
35
|
+
export declare const formatValue: typeof crudModule.formatValue;
|
|
36
|
+
//# sourceMappingURL=crudImports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crudImports.d.ts","sourceRoot":"","sources":["../../src/crud/crudImports.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,UAAU,MAAM,gBAAgB,CAAC;AAE7C,0DAA0D;AAC1D,eAAO,MAAM,qBAAqB,SACS,CAAC;AAG5C,eAAO,MAAM,aAAa,iCAA4B,CAAC;AACvD,eAAO,MAAM,wBAAwB,4CAAuC,CAAC;AAC7E,eAAO,MAAM,YAAY,iKAA2B,CAAC;AACrD,eAAO,MAAM,kBAAkB,sCAAiC,CAAC;AACjE,eAAO,MAAM,OAAO,2BAAsB,CAAC;AAC3C,eAAO,MAAM,WAAW,+BAA0B,CAAC;AACnD,eAAO,MAAM,eAAe,mCAA8B,CAAC;AAC3D,eAAO,MAAM,kBAAkB,sCAAiC,CAAC;AACjE,eAAO,MAAM,cAAc,kCAA6B,CAAC;AACzD,eAAO,MAAM,iBAAiB,qCAAgC,CAAC;AAC/D,eAAO,MAAM,oBAAoB,wCAAmC,CAAC;AAGrE,eAAO,MAAM,oBAAoB,wCAAmC,CAAC;AACrE,eAAO,MAAM,iBAAiB,qCAAgC,CAAC;AAC/D,eAAO,MAAM,cAAc,kCAA6B,CAAC;AACzD,eAAO,MAAM,aAAa,iCAA4B,CAAC;AACvD,eAAO,MAAM,QAAQ,4BAAuB,CAAC;AAG7C,eAAO,MAAM,mBAAmB,uCAAkC,CAAC;AACnE,eAAO,MAAM,WAAW,+BAA0B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// packages/ui/src/crud/crudImports.ts
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Safe import hub for @donotdev/crud
|
|
4
|
+
* @description Single module-level import using the proven `import * as` pattern.
|
|
5
|
+
* When crud is not installed, Vite aliases it to an empty module — all extractions
|
|
6
|
+
* resolve to `undefined`. This is immutable: the decision is made once at module load.
|
|
7
|
+
*
|
|
8
|
+
* Components import from here instead of directly from '@donotdev/crud'.
|
|
9
|
+
* Type-only imports (`import type`) can still go directly to '@donotdev/crud'.
|
|
10
|
+
*
|
|
11
|
+
* @see useCrudSafe.ts — same pattern, proven in production
|
|
12
|
+
* @version 0.0.1
|
|
13
|
+
* @since 0.0.25
|
|
14
|
+
* @author AMBROISE PARK Consulting
|
|
15
|
+
*/
|
|
16
|
+
import * as crudModule from '@donotdev/crud';
|
|
17
|
+
/** true when @donotdev/crud resolved with real exports */
|
|
18
|
+
export const isCrudModuleAvailable = typeof crudModule?.useCrud === 'function';
|
|
19
|
+
// --- Hooks ---
|
|
20
|
+
export const useEntityForm = crudModule?.useEntityForm;
|
|
21
|
+
export const useUnsavedChangesWarning = crudModule?.useUnsavedChangesWarning;
|
|
22
|
+
export const useFormStore = crudModule?.useFormStore;
|
|
23
|
+
export const useFieldConditions = crudModule?.useFieldConditions;
|
|
24
|
+
export const useCrud = crudModule?.useCrud;
|
|
25
|
+
export const useCrudList = crudModule?.useCrudList;
|
|
26
|
+
export const useCrudCardList = crudModule?.useCrudCardList;
|
|
27
|
+
export const useEntityFavorites = crudModule?.useEntityFavorites;
|
|
28
|
+
export const useCrudFilters = crudModule?.useCrudFilters;
|
|
29
|
+
export const useEntityWorkflow = crudModule?.useEntityWorkflow;
|
|
30
|
+
export const useReferenceResolver = crudModule?.useReferenceResolver;
|
|
31
|
+
// --- Components ---
|
|
32
|
+
export const DisplayFieldRenderer = crudModule?.DisplayFieldRenderer;
|
|
33
|
+
export const FormFieldRenderer = crudModule?.FormFieldRenderer;
|
|
34
|
+
export const UploadProvider = crudModule?.UploadProvider;
|
|
35
|
+
export const EntityFilters = crudModule?.EntityFilters;
|
|
36
|
+
export const CrudCard = crudModule?.CrudCard;
|
|
37
|
+
// --- Utils ---
|
|
38
|
+
export const translateFieldLabel = crudModule?.translateFieldLabel;
|
|
39
|
+
export const formatValue = crudModule?.formatValue;
|