@myunisoft/design-system 1.3.2 → 1.3.4-rev157
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/assets/I18n/locales/en.d.ts +5 -0
- package/dist/assets/I18n/locales/fr.d.ts +5 -0
- package/dist/components/DocumentComposer/Treeview/hooks/useExpandOnDragHover.d.ts +6 -0
- package/dist/components/DocumentComposer/Treeview/slots/IconContainerSlot.d.ts +2 -3
- package/dist/components/DocumentComposer/Treeview/slots/LabelInputSlot.d.ts +2 -2
- package/dist/components/DocumentComposer/Treeview/slots/LabelSlot.d.ts +2 -4
- package/dist/components/DocumentComposer/Treeview/slots/index.d.ts +6 -3
- package/dist/components/DocumentComposer/constants.d.ts +1 -0
- package/dist/components/DocumentComposer/hooks/useDragVisualFeedback.d.ts +1 -1
- package/dist/components/DocumentComposer/index.d.ts +67 -2
- package/dist/components/DocumentComposer/types/index.d.ts +33 -2
- package/dist/components/DocumentComposer/types/props.d.ts +7 -9
- package/dist/index.d.ts +1 -3
- package/dist/index.js +5 -5
- package/package.json +1 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { SxProps, Theme } from '@mui/material';
|
|
2
2
|
type IconContainerSlotProps = {
|
|
3
|
-
ownerState?: unknown;
|
|
4
3
|
children?: React.ReactNode;
|
|
5
4
|
sx?: SxProps<Theme>;
|
|
6
5
|
isDraggable?: boolean;
|
|
7
6
|
isVisible?: boolean;
|
|
8
7
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
8
|
+
declare const _default: import("react").MemoExoticComponent<({ children, sx, isDraggable, isVisible, ...rest }: IconContainerSlotProps) => import("react/jsx-runtime").JSX.Element>;
|
|
9
|
+
export default _default;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { InputHTMLAttributes } from 'react';
|
|
2
2
|
import type { RichTreeViewProApiRef } from '@mui/x-tree-view-pro';
|
|
3
|
-
|
|
3
|
+
declare const LabelInputSlot: import("react").ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & {
|
|
4
4
|
ownerState?: unknown;
|
|
5
5
|
itemId?: string;
|
|
6
6
|
isEditing?: boolean;
|
|
7
7
|
onTemporarySectionValidation?: (label: string) => void;
|
|
8
8
|
onTemporarySectionCancel?: () => void;
|
|
9
|
-
onItemLabelChange?: (itemId: string, newLabel: string) => void;
|
|
10
9
|
apiRef?: RichTreeViewProApiRef;
|
|
11
10
|
onEditingEnd?: () => void;
|
|
12
11
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
12
|
+
export default LabelInputSlot;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { SxProps, Theme } from '@mui/material';
|
|
2
2
|
type LabelSlotProps = {
|
|
3
|
-
ownerState?: unknown;
|
|
4
|
-
editable?: unknown;
|
|
5
3
|
children?: React.ReactNode;
|
|
6
4
|
sx?: SxProps<Theme>;
|
|
7
5
|
customIcon?: React.ReactNode;
|
|
@@ -16,5 +14,5 @@ type LabelSlotProps = {
|
|
|
16
14
|
visibleIconTooltip?: string;
|
|
17
15
|
hiddenIconTooltip?: string;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
|
-
export
|
|
17
|
+
declare const _default: import("react").MemoExoticComponent<({ children, sx, customIcon, hasMenu, itemId, isVisible, isTemporary, menuAnchorEl, onItemVisibilityChange, onMenuClick, hiddenSectionTooltip, visibleIconTooltip, hiddenIconTooltip, ...rest }: LabelSlotProps) => import("react/jsx-runtime").JSX.Element>;
|
|
18
|
+
export default _default;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import IconContainerSlot from './IconContainerSlot';
|
|
2
|
+
import LabelInputSlot from './LabelInputSlot';
|
|
3
|
+
import LabelSlot from './LabelSlot';
|
|
4
|
+
export { IconContainerSlot };
|
|
5
|
+
export { LabelInputSlot };
|
|
6
|
+
export { LabelSlot };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MUI_TREE_ITEM_ID_PATTERN: RegExp;
|
|
@@ -3,7 +3,7 @@ import type { DocumentSection } from '../types';
|
|
|
3
3
|
type UseDragVisualFeedbackParams = {
|
|
4
4
|
containerRef: RefObject<HTMLDivElement | null>;
|
|
5
5
|
getSectionById: (sectionId: string) => DocumentSection | null;
|
|
6
|
-
isValidDropTarget?: (draggedSection: DocumentSection, targetSection: DocumentSection | null, newIndex: number
|
|
6
|
+
isValidDropTarget?: (draggedSection: DocumentSection, targetSection: DocumentSection | null, newIndex: number) => boolean;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Provides visual feedback during drag-and-drop by graying out invalid drop targets.
|
|
@@ -1,6 +1,71 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { ItemPositionParams } from './Treeview/types';
|
|
3
|
+
import type { DocumentSection, SectionContent } from './types';
|
|
4
|
+
export type DeleteConfirmationRenderProps = {
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
onConfirm: () => void;
|
|
7
|
+
onCancel: () => void;
|
|
8
|
+
};
|
|
9
|
+
export type UnsavedChangesRenderProps = {
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
isSaving: boolean;
|
|
12
|
+
/** True if onSectionContentSave is provided */
|
|
13
|
+
canSave: boolean;
|
|
14
|
+
onSaveAndQuit: () => void;
|
|
15
|
+
onQuitWithoutSaving: () => void;
|
|
16
|
+
onCancel: () => void;
|
|
17
|
+
};
|
|
18
|
+
export type DocumentComposerLabels = {
|
|
19
|
+
createSection?: string;
|
|
20
|
+
rename?: string;
|
|
21
|
+
delete?: string;
|
|
22
|
+
createSubsection?: string;
|
|
23
|
+
hiddenItemTooltip?: string;
|
|
24
|
+
};
|
|
25
|
+
export type DocumentComposerCallbacks = {
|
|
26
|
+
onSectionOrderChange?: (params: ItemPositionParams) => void;
|
|
27
|
+
onSectionTitleChange?: (sectionId: string, newTitle: string) => void;
|
|
28
|
+
onSectionDelete?: (sectionId: string) => void;
|
|
29
|
+
onSectionVisibilityChange?: (sectionId: string, visible: boolean) => void;
|
|
30
|
+
onSectionCreate?: (parentId: string | null, title: string) => string | Promise<string>;
|
|
31
|
+
onSectionSelect?: (sectionId: string | null) => void;
|
|
32
|
+
/** Used by unsaved changes modal "Save and quit" action */
|
|
33
|
+
onSectionContentSave?: () => Promise<void>;
|
|
34
|
+
};
|
|
35
|
+
export type DocumentComposerCustomProps = {
|
|
36
|
+
noSectionsPlaceholder?: string | ReactNode;
|
|
37
|
+
isLoadingSections?: boolean;
|
|
38
|
+
/** Defaults to `() => true` */
|
|
39
|
+
getSectionTitleChangePermission?: (section: DocumentSection) => boolean;
|
|
40
|
+
/** Defaults to `() => true` */
|
|
41
|
+
getSectionDeletePermission?: (section: DocumentSection) => boolean;
|
|
42
|
+
/** Defaults to `() => true` */
|
|
43
|
+
getSectionOrderChangePermission?: (section: DocumentSection) => boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Called during drag to validate if the move to a new position is allowed.
|
|
46
|
+
* Use this for custom drop target restrictions (e.g., prevent dropping into archive sections).
|
|
47
|
+
* Defaults to `() => true`.
|
|
48
|
+
*/
|
|
49
|
+
canMoveSectionToNewPosition?: (params: ItemPositionParams) => boolean;
|
|
50
|
+
/** Defaults to `() => true` */
|
|
51
|
+
getSectionCreatePermission?: (section: DocumentSection) => boolean;
|
|
52
|
+
/** Defaults to `() => true` */
|
|
53
|
+
getSectionVisibilityChangePermission?: (section: DocumentSection) => boolean;
|
|
54
|
+
hiddenSectionTooltip?: string;
|
|
55
|
+
visibleIconTooltip?: string;
|
|
56
|
+
hiddenIconTooltip?: string;
|
|
57
|
+
/** Return null for no icon */
|
|
58
|
+
renderSectionIcon?: (section: DocumentSection) => ReactNode;
|
|
59
|
+
sectionContent?: SectionContent;
|
|
60
|
+
isLoadingSectionContent?: boolean;
|
|
61
|
+
selectedSectionId?: string | null;
|
|
62
|
+
/** If not provided, deletion proceeds without confirmation */
|
|
63
|
+
renderDeleteConfirmation?: (props: DeleteConfirmationRenderProps) => ReactNode;
|
|
64
|
+
/** If not provided, navigation proceeds without confirmation (discards changes) */
|
|
65
|
+
renderUnsavedChangesConfirmation?: (props: UnsavedChangesRenderProps) => ReactNode;
|
|
66
|
+
};
|
|
2
67
|
type DocumentComposerProps = {
|
|
3
68
|
sections?: DocumentSection[];
|
|
4
69
|
} & DocumentComposerCallbacks & DocumentComposerCustomProps;
|
|
5
|
-
declare const DocumentComposer: ({ sections, isLoadingSections, onSectionOrderChange, onSectionTitleChange, onSectionDelete, onSectionVisibilityChange, onSectionCreate, onSectionSelect, onSectionContentSave, noSectionsPlaceholder, getSectionTitleChangePermission, getSectionDeletePermission, getSectionOrderChangePermission, getSectionCreatePermission, getSectionVisibilityChangePermission, hiddenSectionTooltip, visibleIconTooltip, hiddenIconTooltip, renderSectionIcon,
|
|
70
|
+
declare const DocumentComposer: ({ sections, isLoadingSections, onSectionOrderChange, onSectionTitleChange, onSectionDelete, onSectionVisibilityChange, onSectionCreate, onSectionSelect, onSectionContentSave, noSectionsPlaceholder, getSectionTitleChangePermission, getSectionDeletePermission, getSectionOrderChangePermission, canMoveSectionToNewPosition, getSectionCreatePermission, getSectionVisibilityChangePermission, hiddenSectionTooltip, visibleIconTooltip, hiddenIconTooltip, renderSectionIcon, sectionContent, isLoadingSectionContent, selectedSectionId, renderDeleteConfirmation, renderUnsavedChangesConfirmation }: DocumentComposerProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
71
|
export default DocumentComposer;
|
|
@@ -1,2 +1,33 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export declare const CellFormat: {
|
|
2
|
+
readonly TEXT: "text";
|
|
3
|
+
readonly AMOUNT: "amount";
|
|
4
|
+
};
|
|
5
|
+
export type CellFormat = (typeof CellFormat)[keyof typeof CellFormat];
|
|
6
|
+
export type TableCell = {
|
|
7
|
+
value: string;
|
|
8
|
+
editable: boolean;
|
|
9
|
+
format: CellFormat;
|
|
10
|
+
};
|
|
11
|
+
export type TableRow = TableCell[];
|
|
12
|
+
export type TableValue = {
|
|
13
|
+
id: string;
|
|
14
|
+
headers: TableRow[];
|
|
15
|
+
rows: TableRow[];
|
|
16
|
+
footers: TableRow[];
|
|
17
|
+
};
|
|
18
|
+
export type TableContentBlock = {
|
|
19
|
+
type: 'table';
|
|
20
|
+
value: TableValue;
|
|
21
|
+
};
|
|
22
|
+
/** Extend this union as new content block types are added */
|
|
23
|
+
export type ContentBlock = TableContentBlock;
|
|
24
|
+
export type SectionContent = ContentBlock[];
|
|
25
|
+
export type DocumentSection = {
|
|
26
|
+
id: string;
|
|
27
|
+
title: string;
|
|
28
|
+
visible: boolean;
|
|
29
|
+
parentId: string | null;
|
|
30
|
+
type?: string;
|
|
31
|
+
hasTables?: boolean;
|
|
32
|
+
sections?: DocumentSection[] | null;
|
|
33
|
+
};
|
|
@@ -31,6 +31,13 @@ export type DocumentComposerCustomProps = {
|
|
|
31
31
|
getSectionDeletePermission?: (section: DocumentSection) => boolean;
|
|
32
32
|
/** Defaults to `() => true` */
|
|
33
33
|
getSectionOrderChangePermission?: (section: DocumentSection) => boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Custom validation for drag & drop positions.
|
|
36
|
+
* Called after basic permission checks pass.
|
|
37
|
+
* Use this to implement custom drop zone restrictions (e.g., only drop after certain sections).
|
|
38
|
+
* Defaults to `() => true`
|
|
39
|
+
*/
|
|
40
|
+
canMoveSectionToNewPosition?: (params: ItemPositionParams) => boolean;
|
|
34
41
|
/** Defaults to `() => true` */
|
|
35
42
|
getSectionCreatePermission?: (section: DocumentSection) => boolean;
|
|
36
43
|
/** Defaults to `() => true` */
|
|
@@ -40,15 +47,6 @@ export type DocumentComposerCustomProps = {
|
|
|
40
47
|
hiddenIconTooltip?: string;
|
|
41
48
|
/** Return null for no icon */
|
|
42
49
|
renderSectionIcon?: (section: DocumentSection) => ReactNode;
|
|
43
|
-
/**
|
|
44
|
-
* Determines valid drop targets during drag. Invalid targets are greyed out.
|
|
45
|
-
* `targetSection` is `null` when dropping at root level.
|
|
46
|
-
* `newIndex` is the position where the item would be inserted in the target's children.
|
|
47
|
-
* `isNesting` is `true` when the section is being moved to a new parent (dropped "on" a section),
|
|
48
|
-
* `false` when reordering within the same parent.
|
|
49
|
-
* Defaults to `() => true`.
|
|
50
|
-
*/
|
|
51
|
-
isValidDropTarget?: (draggedSection: DocumentSection, targetSection: DocumentSection | null, newIndex: number, isNesting: boolean) => boolean;
|
|
52
50
|
sectionContent?: SectionContent;
|
|
53
51
|
isLoadingSectionContent?: boolean;
|
|
54
52
|
selectedSectionId?: string | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,13 +7,11 @@ export { default as BackgroundLoader } from './components/BackgroundLoader';
|
|
|
7
7
|
export { default as BadgeAdd } from './components/BadgeAdd';
|
|
8
8
|
export { default as Checkbox } from './components/basics/Checkbox';
|
|
9
9
|
export { default as ExpandButton } from './components/basics/ExpandButton';
|
|
10
|
-
export { default as DocumentComposer } from './components/DocumentComposer';
|
|
11
|
-
export type { CellFormat, ContentBlock, DeleteConfirmationRenderProps, SectionContent, TableCell, TableContentBlock, TableRow, TableValue, UnsavedChangesRenderProps } from './components/DocumentComposer/types';
|
|
12
|
-
export { CellFormat as CellFormatEnum } from './components/DocumentComposer/types';
|
|
13
10
|
export * from './components/basics/Icon/';
|
|
14
11
|
export * from './components/basics/Icon/Icons-material';
|
|
15
12
|
export { default as Snackbar } from './components/basics/Snackbar';
|
|
16
13
|
export { default as DataGridDS } from './components/DataGrid';
|
|
14
|
+
export { default as DocumentComposer } from './components/DocumentComposer';
|
|
17
15
|
export { default as DraggableList } from './components/DraggableList';
|
|
18
16
|
export { default as FileDropper } from './components/FileDropper';
|
|
19
17
|
export { default as Modal } from './components/Modal';
|