@openg2p/registry-widgets 1.1.4-dev.3 → 1.1.4-dev.4

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.
@@ -0,0 +1,7 @@
1
+ export interface FilePreviewModalProps {
2
+ file: File | string | null;
3
+ isOpen: boolean;
4
+ onClose: () => void;
5
+ }
6
+ export declare const FilePreviewModal: ({ file, isOpen, onClose, }: FilePreviewModalProps) => import("react/jsx-runtime").JSX.Element | null;
7
+ //# sourceMappingURL=FilePreviewModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilePreviewModal.d.ts","sourceRoot":"","sources":["../../src/components/FilePreviewModal.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAkCD,eAAO,MAAM,gBAAgB,GAAI,4BAI9B,qBAAqB,mDA0JvB,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { SectionConfig } from '../types';
2
+ import { UseBaseWidgetOptions } from '../hooks/useBaseWidget';
3
+ import { SectionMode } from './SectionsContainer';
4
+ export interface SectionChanges {
5
+ section_id?: string;
6
+ section_register_id?: string;
7
+ records: unknown[];
8
+ files?: unknown[];
9
+ image?: File | null;
10
+ }
11
+ export interface SectionRendererProps {
12
+ section: SectionConfig;
13
+ dataSourceRequestHandler?: UseBaseWidgetOptions['dataSourceRequestHandler'];
14
+ schemaData?: UseBaseWidgetOptions['schemaData'];
15
+ onValueChange?: UseBaseWidgetOptions['onValueChange'];
16
+ gridColumnSpan?: number;
17
+ onSectionSave?: (changes: SectionChanges) => Promise<void> | void;
18
+ hideEditButton?: boolean;
19
+ mode?: SectionMode;
20
+ namespace?: string;
21
+ changeRequestType?: 'new' | 'old';
22
+ showChangeRequestLabel?: boolean;
23
+ dbSectionId?: string;
24
+ sectionRegisterId?: string;
25
+ /** Called when the section's dirty (has unsaved changes) status changes. Only fires while in edit mode. */
26
+ onSectionDirtyChange?: (sectionId: string, isDirty: boolean) => void;
27
+ /** IntakeForm mode: 0-based index of this section within the form */
28
+ sectionIndex?: number;
29
+ /** IntakeForm mode: total number of sections in the form */
30
+ sectionCount?: number;
31
+ /** IntakeForm mode: index of the currently expanded section (null = all collapsed) */
32
+ expandedSectionIndex?: number | null;
33
+ /** IntakeForm mode: called when user requests to expand a section (e.g. clicks accordion header) */
34
+ onExpandSection?: (index: number) => void;
35
+ /** IntakeForm mode: called when section save completes successfully (collapse current, expand next) */
36
+ onSectionSaveSuccess?: (index: number) => void;
37
+ /** IntakeForm mode: called when user clicks Previous (collapse current, expand previous) */
38
+ onPreviousSection?: (index: number) => void;
39
+ /** IntakeForm mode: when true or undefined, sections are editable; when false, sections are readonly */
40
+ isDraft?: boolean;
41
+ /**
42
+ * IntakeForm mode: when true the accordion header is clickable so the user can open/close this
43
+ * section freely. False (default) locks the header — navigation is only via Next/Previous.
44
+ * SectionsContainer sets this to true for every visited section plus the one immediately after.
45
+ */
46
+ isAccessible?: boolean;
47
+ /** RegistryView: called when this section enters or exits edit mode. Used by SectionsContainer to enforce single-edit. */
48
+ onEditModeChange?: (sectionId: string, editing: boolean) => void;
49
+ /** RegistryView: when true, forces this section out of edit mode (another section took over). */
50
+ forceExitEdit?: boolean;
51
+ }
52
+ /**
53
+ * Renders a section with its panels
54
+ *
55
+ * Layout behavior:
56
+ * - Section width is based on max 3 panels (or more on high resolution)
57
+ * - Panels wrap when they exceed available width
58
+ * - Sections can sit side-by-side if there's space
59
+ */
60
+ export declare const SectionRenderer: ({ section, dataSourceRequestHandler: propDataSourceRequestHandler, schemaData, onValueChange, gridColumnSpan, onSectionSave, hideEditButton, mode, namespace, changeRequestType, showChangeRequestLabel, dbSectionId, sectionRegisterId, onSectionDirtyChange, sectionIndex, sectionCount, expandedSectionIndex, onExpandSection, onSectionSaveSuccess, onPreviousSection, isDraft, isAccessible, onEditModeChange, forceExitEdit, }: SectionRendererProps) => import("react/jsx-runtime").JSX.Element;
61
+ //# sourceMappingURL=SectionRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SectionRenderer.d.ts","sourceRoot":"","sources":["../../src/components/SectionRenderer.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAyC,MAAM,UAAU,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAQ9D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAuDlD,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,aAAa,CAAC;IACvB,wBAAwB,CAAC,EAAE,oBAAoB,CAAC,0BAA0B,CAAC,CAAC;IAC5E,UAAU,CAAC,EAAE,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAChD,aAAa,CAAC,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAC;IACtD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAClE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAClC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAGjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,2GAA2G;IAC3G,oBAAoB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAErE,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,oGAAoG;IACpG,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,uGAAuG;IACvG,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,4FAA4F;IAC5F,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,wGAAwG;IACxG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,0HAA0H;IAC1H,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACjE,iGAAiG;IACjG,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAGD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,saAyB7B,oBAAoB,4CAqlDtB,CAAC"}
@@ -7,6 +7,7 @@ export interface SectionsFormHandle {
7
7
  getFormData(): Record<string, unknown>;
8
8
  validateAndGetData(): Promise<SectionChanges[]>;
9
9
  getStructuredData(): SectionChanges[];
10
+ hasUnsavedChanges(): boolean;
10
11
  }
11
12
  export interface SectionsContainerProps {
12
13
  sections: SectionConfig[];
@@ -1 +1 @@
1
- {"version":3,"file":"SectionsContainer.d.ts","sourceRoot":"","sources":["../../src/components/SectionsContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,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ler } from '../types';
2
+ export interface UseGeoWidgetCascadeOptions {
3
+ config: BaseWidgetConfig;
4
+ dataSourceRequestHandler?: DataSourceRequestHandler;
5
+ values: Record<string, any>;
6
+ }
7
+ /**
8
+ * Hook for geo widget cascade functionality
9
+ * Handles geo hierarchy building and cascade behavior
10
+ */
11
+ export declare const useGeoWidgetCascade: (options: UseGeoWidgetCascadeOptions) => void;
12
+ //# sourceMappingURL=useGeoWidgetCascade.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGeoWidgetCascade.d.ts","sourceRoot":"","sources":["../../src/hooks/useGeoWidgetCascade.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAmBtE,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,gBAAgB,CAAC;IACzB,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;IACpD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B;AAGD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,0BAA0B,SAwMtE,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Custom hook for widget translations
3
+ * Provides translation function with widget-specific namespace and fallback support
4
+ */
5
+ export declare const useWidgetTranslation: () => {
6
+ t: (keyOrString: string | undefined | null, options?: {
7
+ defaultValue?: string;
8
+ [key: string]: any;
9
+ }) => string;
10
+ translate: (keyOrString: string | undefined | null, options?: {
11
+ defaultValue?: string;
12
+ [key: string]: any;
13
+ }) => string;
14
+ translateConfig: (value: string | undefined | null, fallback?: string) => string;
15
+ };
16
+ //# sourceMappingURL=useWidgetTranslation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWidgetTranslation.d.ts","sourceRoot":"","sources":["../../src/hooks/useWidgetTranslation.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,oBAAoB;qBAoBhB,MAAM,GAAG,SAAS,GAAG,IAAI,YAC5B;QACR,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,KACA,MAAM;6BALM,MAAM,GAAG,SAAS,GAAG,IAAI,YAC5B;QACR,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,KACA,MAAM;6BA0BA,MAAM,GAAG,SAAS,GAAG,IAAI,aACrB,MAAM,KAChB,MAAM;CAqDV,CAAC"}
@@ -0,0 +1,21 @@
1
+ import i18n from 'i18next';
2
+ /**
3
+ * Initialize i18n for the widget library
4
+ * Can be customized by passing custom resources or configuration
5
+ *
6
+ * If no resources are provided, it will attempt to automatically load translations
7
+ * from the consuming project's locale directory.
8
+ *
9
+ * If options are provided and the default instance is already initialized,
10
+ * creates a new i18n instance to avoid reinitialization issues.
11
+ */
12
+ export declare const initI18n: (options?: {
13
+ resources?: Record<string, any>;
14
+ lng?: string;
15
+ fallbackLng?: string;
16
+ debug?: boolean;
17
+ loadPath?: string | string[];
18
+ autoLoad?: boolean;
19
+ }) => Promise<import("i18next").i18n>;
20
+ export default i18n;
21
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/i18n/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AA6C3B;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,GAAU,UAAU;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,oCAuEA,CAAC;AAwBF,eAAe,IAAI,CAAC"}
package/dist/index.d.ts CHANGED
@@ -497,6 +497,7 @@ interface SectionsFormHandle {
497
497
  getFormData(): Record<string, unknown>;
498
498
  validateAndGetData(): Promise<SectionChanges[]>;
499
499
  getStructuredData(): SectionChanges[];
500
+ hasUnsavedChanges(): boolean;
500
501
  }
501
502
  interface SectionsContainerProps {
502
503
  sections: SectionConfig[];
package/dist/index.esm.js CHANGED
@@ -4271,6 +4271,7 @@ const SectionsContainer = ({ sections, dataSourceRequestHandler: propDataSourceR
4271
4271
  }
4272
4272
  return results;
4273
4273
  },
4274
+ hasUnsavedChanges: () => Object.values(sectionDirtyMapRef.current).some(Boolean),
4274
4275
  };
4275
4276
  }, [store, dispatch, safeSections]);
4276
4277
  useEffect(() => {