@myunisoft/design-system 1.3.0 → 1.3.1-rev-157-9
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 +16 -0
- package/dist/assets/I18n/locales/fr.d.ts +16 -0
- package/dist/components/AnchoredPopper/index.d.ts +14 -0
- package/dist/components/DataGrid/components/toolbar/buttons/AddButton.d.ts +6 -0
- package/dist/components/DataGrid/components/toolbar/buttons/ExportButton.d.ts +9 -0
- package/dist/components/DataGrid/types/index.d.ts +428 -0
- package/dist/components/DocumentComposer/Treeview/CustomTreeItem.d.ts +1 -1
- package/dist/components/DocumentComposer/Treeview/hooks/useExpandOnDragHover.d.ts +6 -0
- package/dist/components/DocumentComposer/Treeview/slots/IconContainerSlot.d.ts +5 -2
- package/dist/components/DocumentComposer/Treeview/slots/LabelInputSlot.d.ts +3 -2
- package/dist/components/DocumentComposer/Treeview/slots/LabelSlot.d.ts +5 -2
- package/dist/components/DocumentComposer/Treeview/slots/index.d.ts +6 -3
- package/dist/components/DocumentComposer/Treeview/types.d.ts +1 -1
- package/dist/components/DocumentComposer/components/SectionEditorPanel.d.ts +7 -0
- package/dist/components/DocumentComposer/components/index.d.ts +1 -0
- package/dist/components/DocumentComposer/hooks/useDeleteConfirmation.d.ts +12 -0
- package/dist/components/DocumentComposer/hooks/useDragVisualFeedback.d.ts +1 -1
- package/dist/components/DocumentComposer/hooks/useTemporarySection.d.ts +7 -2
- package/dist/components/DocumentComposer/hooks/useUnsavedChangesGuard.d.ts +19 -0
- package/dist/components/DocumentComposer/index.d.ts +1 -1
- package/dist/components/DocumentComposer/types/index.d.ts +2 -0
- package/dist/components/DocumentComposer/types/props.d.ts +67 -0
- package/dist/components/DocumentComposer/types/section.d.ts +33 -0
- package/dist/components/DocumentComposer/utils/sectionHelpers.d.ts +0 -1
- package/dist/components/Export/index.d.ts +3 -0
- package/dist/components/Export/style/index.d.ts +9 -0
- package/dist/components/Export/types/index.d.ts +30 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -3
- package/dist/locale/index.d.ts +7 -0
- package/package.json +8 -10
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ItemPositionParams } from '../Treeview/types';
|
|
3
|
+
import type { DocumentSection, SectionContent } from './section';
|
|
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 DocumentComposerCustomProps = {
|
|
26
|
+
noSectionsPlaceholder?: string | ReactNode;
|
|
27
|
+
isLoadingSections?: boolean;
|
|
28
|
+
/** Defaults to `() => true` */
|
|
29
|
+
getSectionTitleChangePermission?: (section: DocumentSection) => boolean;
|
|
30
|
+
/** Defaults to `() => true` */
|
|
31
|
+
getSectionDeletePermission?: (section: DocumentSection) => boolean;
|
|
32
|
+
/** Defaults to `() => true` */
|
|
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;
|
|
41
|
+
/** Defaults to `() => true` */
|
|
42
|
+
getSectionCreatePermission?: (section: DocumentSection) => boolean;
|
|
43
|
+
/** Defaults to `() => true` */
|
|
44
|
+
getSectionVisibilityChangePermission?: (section: DocumentSection) => boolean;
|
|
45
|
+
hiddenSectionTooltip?: string;
|
|
46
|
+
visibleIconTooltip?: string;
|
|
47
|
+
hiddenIconTooltip?: string;
|
|
48
|
+
/** Return null for no icon */
|
|
49
|
+
renderSectionIcon?: (section: DocumentSection) => ReactNode;
|
|
50
|
+
sectionContent?: SectionContent;
|
|
51
|
+
isLoadingSectionContent?: boolean;
|
|
52
|
+
selectedSectionId?: string | null;
|
|
53
|
+
/** If not provided, deletion proceeds without confirmation */
|
|
54
|
+
renderDeleteConfirmation?: (props: DeleteConfirmationRenderProps) => ReactNode;
|
|
55
|
+
/** If not provided, navigation proceeds without confirmation (discards changes) */
|
|
56
|
+
renderUnsavedChangesConfirmation?: (props: UnsavedChangesRenderProps) => ReactNode;
|
|
57
|
+
};
|
|
58
|
+
export type DocumentComposerCallbacks = {
|
|
59
|
+
onSectionOrderChange?: (params: ItemPositionParams) => void;
|
|
60
|
+
onSectionTitleChange?: (sectionId: string, newTitle: string) => void;
|
|
61
|
+
onSectionDelete?: (sectionId: string) => void;
|
|
62
|
+
onSectionVisibilityChange?: (sectionId: string, visible: boolean) => void;
|
|
63
|
+
onSectionCreate?: (parentId: string | null, title: string) => string | Promise<string>;
|
|
64
|
+
onSectionSelect?: (sectionId: string | null) => void;
|
|
65
|
+
/** Used by unsaved changes modal "Save and quit" action */
|
|
66
|
+
onSectionContentSave?: () => Promise<void>;
|
|
67
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
};
|
|
@@ -7,4 +7,3 @@ export declare const isSectionVisible: (section: DocumentSection) => boolean;
|
|
|
7
7
|
export declare const getSectionChildren: (section: DocumentSection) => DocumentSection[] | undefined;
|
|
8
8
|
export declare const getSectionId: (section: DocumentSection) => string;
|
|
9
9
|
export declare const getSectionTitle: (section: DocumentSection) => string;
|
|
10
|
-
export declare const getSectionIcon: (section: DocumentSection) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { GridExportFormat } from "@mui/x-data-grid-pro";
|
|
2
|
+
/**
|
|
3
|
+
* Props for ExportContent component
|
|
4
|
+
*/
|
|
5
|
+
export interface ExportContentProps {
|
|
6
|
+
/**
|
|
7
|
+
* Available export formats
|
|
8
|
+
*/
|
|
9
|
+
exportFormats: GridExportFormat[];
|
|
10
|
+
/**
|
|
11
|
+
* Handler function called when export is triggered
|
|
12
|
+
* @param format - Selected export format
|
|
13
|
+
*/
|
|
14
|
+
onExport: (format: GridExportFormat) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Optional title for the export dialog
|
|
17
|
+
* @default 'Export'
|
|
18
|
+
*/
|
|
19
|
+
title?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional label for format selection
|
|
22
|
+
* @default 'Select format:'
|
|
23
|
+
*/
|
|
24
|
+
selectFormatLabel?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional label for the export button
|
|
27
|
+
* @default 'Export'
|
|
28
|
+
*/
|
|
29
|
+
exportButtonLabel?: string;
|
|
30
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ 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';
|
|
10
13
|
export * from './components/basics/Icon/';
|
|
11
14
|
export * from './components/basics/Icon/Icons-material';
|
|
12
15
|
export { default as Snackbar } from './components/basics/Snackbar';
|