@openg2p/registry-widgets 1.1.6-dev.1 → 1.1.6-dev.3

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 +1 @@
1
- {"version":3,"file":"useCrViewData.d.ts","sourceRoot":"","sources":["../../../../src/components/SectionRenderer/hooks/useCrViewData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,eAAO,MAAM,aAAa,GACxB,MAAM,WAAW,EACjB,mBAAmB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,aAAa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;QAaM,CAAC"}
1
+ {"version":3,"file":"useCrViewData.d.ts","sourceRoot":"","sources":["../../../../src/components/SectionRenderer/hooks/useCrViewData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,eAAO,MAAM,aAAa,GACxB,MAAM,WAAW,EACjB,mBAAmB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,aAAa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;QAkBM,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,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAmB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA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AAM,mBAAmB,CAAC;AAKpE,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,QAAQ,GAAG,YAAY,CAAC;AAEnE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,kBAAkB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAChD,iBAAiB,IAAI,cAAc,EAAE,CAAC;IACtC,iBAAiB,IAAI,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;IACpD,UAAU,CAAC,EAAE,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAChD,aAAa,CAAC,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAC;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,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,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrE,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACpD;AAOD,eAAO,MAAM,iBAAiB,GAAI,8LAY/B,sBAAsB,4CA6QxB,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
@@ -3049,11 +3049,15 @@ const useCrViewData = (mode, currentSchemaData, storeValues) => useMemo(() => {
3049
3049
  return null;
3050
3050
  const dataSource = { ...storeValues, ...currentSchemaData };
3051
3051
  const recordPath = Object.keys(dataSource)[0];
3052
+ const records = dataSource[recordPath]?.records;
3053
+ const auditPath = Array.isArray(records) && records.length > 0
3054
+ ? `${recordPath}.records.${records.length - 1}`
3055
+ : recordPath;
3052
3056
  return {
3053
- createdBy: getValueByPath(dataSource, `${recordPath}.created_by`),
3054
- createdDate: getValueByPath(dataSource, `${recordPath}.created_at`),
3055
- approvedBy: getValueByPath(dataSource, `${recordPath}.last_approved_by`),
3056
- approvedDate: getValueByPath(dataSource, `${recordPath}.last_approved_at`),
3057
+ createdBy: getValueByPath(dataSource, `${auditPath}.created_by`),
3058
+ createdDate: getValueByPath(dataSource, `${auditPath}.created_at`),
3059
+ approvedBy: getValueByPath(dataSource, `${auditPath}.last_approved_by`),
3060
+ approvedDate: getValueByPath(dataSource, `${auditPath}.last_approved_at`),
3057
3061
  };
3058
3062
  }, [mode, currentSchemaData, storeValues]);
3059
3063
 
@@ -4271,6 +4275,7 @@ const SectionsContainer = ({ sections, dataSourceRequestHandler: propDataSourceR
4271
4275
  }
4272
4276
  return results;
4273
4277
  },
4278
+ hasUnsavedChanges: () => Object.values(sectionDirtyMapRef.current).some(Boolean),
4274
4279
  };
4275
4280
  }, [store, dispatch, safeSections]);
4276
4281
  useEffect(() => {