@openg2p/registry-widgets 1.1.0-dev.4 → 1.1.0-dev.6

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":"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;AA0ClD,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,CAA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AAC;CACvC;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,wGAAwG;IACxG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAEpE,wHAAwH;IACxH,oBAAoB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrE,0JAA0J;IAC1J,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACpD;AAoFD;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,yMAa/B,sBAAsB,4CAwSxB,CAAC"}
package/dist/index.esm.js CHANGED
@@ -3848,6 +3848,52 @@ const sectionValidate = (section, currentSchemaData, dispatch) => {
3848
3848
  return isValid;
3849
3849
  };
3850
3850
 
3851
+ /** Table-style widgets that bind to an array path in the store / schema. */
3852
+ function isTableLikeWidget(widget) {
3853
+ const w = widget.widget;
3854
+ /** widget-type union in types omits legacy values like simple-table still used at runtime */
3855
+ const t = widget['widget-type'];
3856
+ return (w === 'table' ||
3857
+ w === 'dialog-table' ||
3858
+ w === 'simple-table' ||
3859
+ t === 'table' ||
3860
+ t === 'simple-table');
3861
+ }
3862
+ /**
3863
+ * Resolve `records` for section save payloads.
3864
+ * - Back-compat: path ending in `.records` (e.g. `regId.records`)
3865
+ * - Else: first array snapshot at a string `widget-data-path` on a table-like widget
3866
+ * (e.g. `household.members` for dialog-table)
3867
+ */
3868
+ function extractTableRecordsFromSnapshot(snapshot, sectionWidgets) {
3869
+ const convention = Object.entries(snapshot).find(([key, value]) => key.endsWith('.records') && Array.isArray(value));
3870
+ if (convention) {
3871
+ return convention[1];
3872
+ }
3873
+ const tablePaths = [];
3874
+ sectionWidgets.forEach((widget) => {
3875
+ if (!isTableLikeWidget(widget))
3876
+ return;
3877
+ const p = widget['widget-data-path'];
3878
+ if (typeof p === 'string' && p.length > 0) {
3879
+ tablePaths.push(p);
3880
+ }
3881
+ else if (p && typeof p === 'object') {
3882
+ Object.values(p).forEach((sub) => {
3883
+ if (typeof sub === 'string' && sub.length > 0)
3884
+ tablePaths.push(sub);
3885
+ });
3886
+ }
3887
+ });
3888
+ for (const path of tablePaths) {
3889
+ const val = snapshot[path];
3890
+ if (Array.isArray(val)) {
3891
+ return val;
3892
+ }
3893
+ }
3894
+ return [];
3895
+ }
3896
+
3851
3897
  /** Root class on readonly label/value rows; SectionRenderer scopes overflow/ellipsis rules here. */
3852
3898
  const READONLY_VALUE_ROW_ROOT_CLASSES = [
3853
3899
  'TextDisplayWidget',
@@ -4213,9 +4259,7 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
4213
4259
  const widgetPath = widget['widget-data-path'];
4214
4260
  if (!widgetPath)
4215
4261
  return;
4216
- if (widget['widget-type'] === 'table' ||
4217
- widget['widget-type'] === 'simple-table' ||
4218
- widget['widget'] === 'table') {
4262
+ if (isTableLikeWidget(widget)) {
4219
4263
  hasTable = true;
4220
4264
  }
4221
4265
  if (typeof widgetPath === 'object') {
@@ -4250,8 +4294,7 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
4250
4294
  },
4251
4295
  ];
4252
4296
  }
4253
- const tableEntry = Object.entries(snapshot).find(([key, value]) => key.endsWith('.records') && Array.isArray(value));
4254
- return tableEntry ? tableEntry[1] : [];
4297
+ return extractTableRecordsFromSnapshot(snapshot, widgets);
4255
4298
  };
4256
4299
  // Get original section (without namespace) for building snapshots
4257
4300
  // This ensures we use the original data paths when saving
@@ -4961,10 +5004,7 @@ function buildSectionChanges(section, storeValues, namespace, options) {
4961
5004
  const widgetPath = widget['widget-data-path'];
4962
5005
  if (!widgetPath)
4963
5006
  return;
4964
- const widgetType = widget['widget-type'];
4965
- if (widgetType === 'table' ||
4966
- widgetType === 'simple-table' ||
4967
- widget.widget === 'table') {
5007
+ if (isTableLikeWidget(widget)) {
4968
5008
  hasTable = true;
4969
5009
  }
4970
5010
  if (typeof widgetPath === 'object') {
@@ -5002,8 +5042,7 @@ function buildSectionChanges(section, storeValues, namespace, options) {
5002
5042
  ];
5003
5043
  }
5004
5044
  else {
5005
- const tableEntry = Object.entries(snapshot).find(([key, value]) => key.endsWith('.records') && Array.isArray(value));
5006
- records = tableEntry ? tableEntry[1] : [];
5045
+ records = extractTableRecordsFromSnapshot(snapshot, sectionWidgets);
5007
5046
  }
5008
5047
  const files = [];
5009
5048
  const supportingDocs = section['section-supporting-documents'] || [];
@@ -5029,7 +5068,9 @@ const hasTableWidget = (panels) => {
5029
5068
  // Check widgets in this panel
5030
5069
  if (panel.widgets) {
5031
5070
  for (const widget of panel.widgets) {
5032
- if (widget.widget === 'table' || widget['widget-type'] === 'table') {
5071
+ if (widget.widget === 'table' ||
5072
+ widget.widget === 'dialog-table' ||
5073
+ widget['widget-type'] === 'table') {
5033
5074
  return true;
5034
5075
  }
5035
5076
  }
@@ -5051,7 +5092,9 @@ const getTableWidgetColumnSpan = (panels) => {
5051
5092
  // Check widgets in this panel
5052
5093
  if (panel.widgets) {
5053
5094
  for (const widget of panel.widgets) {
5054
- if (widget.widget === 'table' || widget['widget-type'] === 'table') {
5095
+ if (widget.widget === 'table' ||
5096
+ widget.widget === 'dialog-table' ||
5097
+ widget['widget-type'] === 'table') {
5055
5098
  // Return the widget's column span if specified, otherwise null
5056
5099
  return widget['widget-column-span'] || null;
5057
5100
  }
@@ -9188,6 +9231,8 @@ const SelectDisplayValue = ({ config, value }) => {
9188
9231
  const DialogTableWidget = ({ config }) => {
9189
9232
  const { value, error, touched, isEnabled, onChange, config: widgetConfig } = useBaseWidget({ config });
9190
9233
  const { translate, translateConfig } = useWidgetTranslation();
9234
+ const dispatch = useDispatch();
9235
+ const storeValues = useSelector((state) => state.widget?.values ?? {});
9191
9236
  const rows = Array.isArray(value) ? value : [];
9192
9237
  const columns = widgetConfig['widget-data-columns'] || [];
9193
9238
  const operations = widgetConfig['widget-data-operations'] || {};
@@ -9206,6 +9251,9 @@ const DialogTableWidget = ({ config }) => {
9206
9251
  const [dialogMode, setDialogMode] = useState('add');
9207
9252
  const [activeRowIndex, setActiveRowIndex] = useState(null);
9208
9253
  const [formData, setFormData] = useState({});
9254
+ /** Unique per dialog open so Redux widget ids don't reuse stale values across rows/add sessions */
9255
+ const dialogSessionRef = useRef(0);
9256
+ const [dialogSessionId, setDialogSessionId] = useState(0);
9209
9257
  const addDialogTitle = translateConfig(widgetConfig['widget-data-dialog-title-add']) ||
9210
9258
  translate('table.addRecordDialog') ||
9211
9259
  'Add record';
@@ -9220,13 +9268,32 @@ const DialogTableWidget = ({ config }) => {
9220
9268
  });
9221
9269
  return emptyRow;
9222
9270
  }, [columns]);
9271
+ const dialogFieldWidgetId = useCallback((columnKey) => `${widgetConfig['widget-id']}-dlg-${dialogSessionId}-${columnKey}`, [widgetConfig, dialogSessionId]);
9272
+ const resetDialogWidgets = useCallback((sessionId) => {
9273
+ if (sessionId <= 0)
9274
+ return;
9275
+ columns.forEach((col) => {
9276
+ const wid = `${widgetConfig['widget-id']}-dlg-${sessionId}-${col['column-key']}`;
9277
+ dispatch(resetWidget(wid));
9278
+ });
9279
+ }, [columns, widgetConfig, dispatch]);
9280
+ const beginDialogSession = useCallback(() => {
9281
+ dialogSessionRef.current += 1;
9282
+ const nextSession = dialogSessionRef.current;
9283
+ setDialogSessionId(nextSession);
9284
+ return nextSession;
9285
+ }, []);
9223
9286
  const openAddDialog = useCallback(() => {
9287
+ resetDialogWidgets(dialogSessionId);
9288
+ beginDialogSession();
9224
9289
  setDialogMode('add');
9225
9290
  setActiveRowIndex(null);
9226
9291
  setFormData(buildEmptyRow());
9227
9292
  setDialogOpen(true);
9228
- }, [buildEmptyRow]);
9293
+ }, [buildEmptyRow, beginDialogSession, resetDialogWidgets, dialogSessionId]);
9229
9294
  const openEditDialog = useCallback((rowIndex) => {
9295
+ resetDialogWidgets(dialogSessionId);
9296
+ beginDialogSession();
9230
9297
  const row = rows[rowIndex] || {};
9231
9298
  const nextFormData = buildEmptyRow();
9232
9299
  columns.forEach((col) => {
@@ -9238,18 +9305,33 @@ const DialogTableWidget = ({ config }) => {
9238
9305
  setActiveRowIndex(rowIndex);
9239
9306
  setFormData(nextFormData);
9240
9307
  setDialogOpen(true);
9241
- }, [rows, columns, buildEmptyRow]);
9308
+ }, [rows, columns, buildEmptyRow, resetDialogWidgets, dialogSessionId, beginDialogSession]);
9242
9309
  const closeDialog = useCallback(() => {
9310
+ const sessionToClear = dialogSessionId;
9243
9311
  setDialogOpen(false);
9244
9312
  setActiveRowIndex(null);
9245
9313
  setFormData({});
9246
- }, []);
9314
+ resetDialogWidgets(sessionToClear);
9315
+ setDialogSessionId(0);
9316
+ }, [dialogSessionId, resetDialogWidgets]);
9247
9317
  const updateField = useCallback((columnKey, newValue) => {
9248
9318
  setFormData((prev) => ({ ...prev, [columnKey]: newValue }));
9249
9319
  }, []);
9320
+ const collectMergedRowPayload = useCallback(() => {
9321
+ const merged = { ...formData };
9322
+ columns.forEach((col) => {
9323
+ const k = col['column-key'];
9324
+ const wid = dialogFieldWidgetId(k);
9325
+ const fromStore = storeValues[wid];
9326
+ if (fromStore !== undefined)
9327
+ merged[k] = fromStore;
9328
+ });
9329
+ return merged;
9330
+ }, [formData, columns, storeValues, dialogFieldWidgetId]);
9250
9331
  const saveDialog = useCallback(() => {
9332
+ const payload = collectMergedRowPayload();
9251
9333
  if (dialogMode === 'add') {
9252
- const savedRow = { ...formData, edit_action: 'ADD' };
9334
+ const savedRow = { ...payload, edit_action: 'ADD' };
9253
9335
  onChange([...rows, savedRow]);
9254
9336
  closeDialog();
9255
9337
  return;
@@ -9259,11 +9341,11 @@ const DialogTableWidget = ({ config }) => {
9259
9341
  const currentRow = newRows[activeRowIndex] || {};
9260
9342
  const wasDeleted = currentRow.edit_action === 'DELETE';
9261
9343
  const editAction = wasDeleted ? 'UPDATE' : (currentRow.edit_action ?? 'UPDATE');
9262
- newRows[activeRowIndex] = { ...currentRow, ...formData, edit_action: editAction };
9344
+ newRows[activeRowIndex] = { ...currentRow, ...payload, edit_action: editAction };
9263
9345
  onChange(newRows);
9264
9346
  closeDialog();
9265
9347
  }
9266
- }, [dialogMode, formData, onChange, rows, closeDialog, activeRowIndex]);
9348
+ }, [collectMergedRowPayload, dialogMode, onChange, rows, closeDialog, activeRowIndex]);
9267
9349
  const deleteRow = useCallback((rowIndex) => {
9268
9350
  const newRows = rows.filter((_, i) => i !== rowIndex);
9269
9351
  onChange(newRows);
@@ -9351,7 +9433,8 @@ const DialogTableWidget = ({ config }) => {
9351
9433
  }, "aria-label": "Close", children: "\u00D7" })] }), jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", style: { maxHeight: '70vh', overflow: 'auto' }, children: columns.map((col) => {
9352
9434
  const key = col['column-key'];
9353
9435
  const widgetType = col.widget || 'text';
9354
- const cellWidgetId = `${widgetConfig['widget-id']}-dialog-${dialogMode}-${key}`;
9436
+ const cellWidgetId = dialogFieldWidgetId(key);
9437
+ const initialValue = formData[key] ?? col['widget-data-default'] ?? '';
9355
9438
  const fieldConfig = {
9356
9439
  ...col,
9357
9440
  widget: widgetType,
@@ -9360,10 +9443,10 @@ const DialogTableWidget = ({ config }) => {
9360
9443
  'widget-label': col['widget-label'],
9361
9444
  'widget-readonly': isReadonly || col['widget-readonly'] === true,
9362
9445
  'widget-data-path': undefined,
9363
- 'widget-data-default': formData[key] ?? col['widget-data-default'] ?? '',
9446
+ 'widget-data-default': initialValue,
9364
9447
  };
9365
- return (jsxRuntimeExports.jsx("div", { className: "min-w-0", children: jsxRuntimeExports.jsx(WidgetRenderer, { config: fieldConfig, schemaData: { [cellWidgetId]: formData[key] ?? col['widget-data-default'] ?? '' }, onValueChange: (_widgetId, newValue) => updateField(key, newValue) }) }, key));
9366
- }) }), jsxRuntimeExports.jsxs("div", { className: "flex justify-end gap-3 mt-6", children: [jsxRuntimeExports.jsx("button", { type: "button", onClick: closeDialog, className: "px-4 py-2 text-sm font-medium", style: {
9448
+ return (jsxRuntimeExports.jsx("div", { className: "min-w-0", children: jsxRuntimeExports.jsx(WidgetRenderer, { config: fieldConfig, schemaData: { [cellWidgetId]: initialValue }, onValueChange: (_widgetId, newValue) => updateField(key, newValue) }) }, `${dialogSessionId}-${key}`));
9449
+ }) }, `dialog-fields-${dialogSessionId}`), jsxRuntimeExports.jsxs("div", { className: "flex justify-end gap-3 mt-6", children: [jsxRuntimeExports.jsx("button", { type: "button", onClick: closeDialog, className: "px-4 py-2 text-sm font-medium", style: {
9367
9450
  borderRadius: 'var(--owt-btn-border-radius, 10px)',
9368
9451
  border: '1px solid var(--owt-btn-secondary-border, #C4C4C4)',
9369
9452
  backgroundColor: 'var(--owt-btn-secondary-bg, #FFFFFF)',
@@ -10535,7 +10618,7 @@ const IdAuthenticationWidget = ({ config, schemaData: propSchemaData }) => {
10535
10618
  return dataPath;
10536
10619
  }, [dataPath]);
10537
10620
  const authConfig = config['widget-auth-config'];
10538
- const registerId = resolveValueFromSources(paths.registerId, values, schemaData);
10621
+ const registerId = authConfig?.registerId ?? undefined;
10539
10622
  const internalRecordId = resolveValueFromSources(paths.internalRecordId, values, schemaData);
10540
10623
  const initiatedByStaffId = resolveValueFromSources(paths.initiatedByStaffId, values, schemaData);
10541
10624
  const providerId = authConfig?.providerId;
@@ -10631,12 +10714,18 @@ const IdAuthenticationWidget = ({ config, schemaData: propSchemaData }) => {
10631
10714
  if (!url && canCallAuthApi) {
10632
10715
  setAuthActionLoading(true);
10633
10716
  try {
10634
- const resp = await dataSourceRequestHandler(authConfig.service, authConfig.authenticateEndpoint, authConfig.authenticateMethod || 'POST', {
10717
+ const basePayload = {
10635
10718
  register_id: registerId,
10636
10719
  internal_record_id: internalRecordId,
10637
- provider_id: authConfig.providerId,
10720
+ provider_id: providerId,
10638
10721
  initiated_by_staff_id: initiatedByStaffId,
10639
- });
10722
+ };
10723
+ const wrap = authConfig.wrapRequestPayload !== false;
10724
+ const payloadKey = authConfig.requestPayloadKey || 'request_payload';
10725
+ const requestParams = wrap ? { [payloadKey]: basePayload } : basePayload;
10726
+ // eslint-disable-next-line no-console
10727
+ console.log('[IdAuthenticationWidget] authenticate_registrant params', requestParams);
10728
+ const resp = await dataSourceRequestHandler(authConfig.service, authConfig.authenticateEndpoint, authConfig.authenticateMethod || 'POST', requestParams);
10640
10729
  const payload = unwrapPayload(resp);
10641
10730
  const authUrl = pickAuthorizationUrl(payload, authConfig.authorizationUrlKey);
10642
10731
  url = authUrl || null;