@myunisoft/design-system 1.3.0-rev157 → 1.3.0-rev157-2

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.
@@ -1,6 +1,6 @@
1
1
  import type { RichTreeViewProApiRef, TreeItemProps } from '@mui/x-tree-view-pro';
2
2
  import type { TreeviewProps } from './types';
3
- type TreeItemCallbacks<T extends Record<string, unknown>> = Pick<TreeviewProps<T>, 'isSectionItem' | 'isVisibleItem' | 'getIconItem' | 'hasItemMenu' | 'getMenuItems' | 'isSectionDraggable' | 'onItemVisibilityChange' | 'isTemporaryItem' | 'onTemporarySectionValidation' | 'onTemporarySectionCancel' | 'onItemLabelChange' | 'hiddenSectionTooltip' | 'visibleIconTooltip' | 'hiddenIconTooltip'> & {
3
+ type TreeItemCallbacks<T extends Record<string, unknown>> = Pick<TreeviewProps<T>, 'isSectionItem' | 'isVisibleItem' | 'getIconItem' | 'hasItemMenu' | 'getMenuItems' | 'isSectionDraggable' | 'onItemVisibilityChange' | 'temporaryItem' | 'isTemporaryItem' | 'onTemporarySectionValidation' | 'onTemporarySectionCancel' | 'onItemLabelChange' | 'hiddenSectionTooltip' | 'visibleIconTooltip' | 'hiddenIconTooltip'> & {
4
4
  apiRef: RichTreeViewProApiRef;
5
5
  onEditingChange?: (itemId: string | null) => void;
6
6
  };
@@ -3,7 +3,7 @@ import type { RichTreeViewProApiRef } from '@mui/x-tree-view-pro';
3
3
  export declare const LabelInputSlot: import("react").ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & {
4
4
  ownerState?: unknown;
5
5
  itemId?: string;
6
- isTemporary?: boolean;
6
+ isEditing?: boolean;
7
7
  onTemporarySectionValidation?: (label: string) => void;
8
8
  onTemporarySectionCancel?: () => void;
9
9
  onItemLabelChange?: (itemId: string, newLabel: string) => void;
@@ -2,6 +2,8 @@ import type { RichTreeViewProApiRef } from '@mui/x-tree-view-pro';
2
2
  import type { DocumentSection } from '../types';
3
3
  export type TemporarySection = Pick<DocumentSection, 'id' | 'parentId'> & {
4
4
  parentVisible: boolean;
5
+ /** When undefined = editing mode (input), when defined = optimistic mode (waiting for server) */
6
+ title?: string;
5
7
  };
6
8
  type UseTemporarySectionParams = {
7
9
  apiRef: RichTreeViewProApiRef;
@@ -12,14 +14,17 @@ type UseTemporarySectionParams = {
12
14
  /**
13
15
  * Flow:
14
16
  * 1. User triggers `create(parentId)` from context menu
15
- * 2. A temporary section appears in the tree in edit mode
17
+ * 2. A temporary section appears in the tree in edit mode (title = undefined)
16
18
  * 3. User types a title and presses Enter → `validate()` is called
19
+ * - The section transitions to optimistic mode (title = defined)
20
+ * - Server creation is called in background
17
21
  * 4. User presses Escape or leaves empty → `cancel()` is called
22
+ * 5. Server responds → temporary section is cleared, real section replaces it
18
23
  */
19
24
  export declare const useTemporarySection: ({ apiRef, getSectionById, onSectionCreate, scrollToBottom }: UseTemporarySectionParams) => {
20
25
  temporarySection: TemporarySection | null;
21
26
  create: (parentId?: string | null) => void;
22
- validate: (title: string) => Promise<void>;
27
+ validate: (title: string) => void;
23
28
  cancel: () => void;
24
29
  isTemporary: (sectionId: string) => boolean;
25
30
  };