@oliasoft-open-source/react-ui-library 10.6.4-beta-1 → 10.6.5-beta-1

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.
Files changed (2) hide show
  1. package/dist/index.js +37 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2678,6 +2678,25 @@ var Drawer = ({ background = "var(--color-background-raised)", fixed = false, op
2678
2678
  })
2679
2679
  });
2680
2680
  };
2681
+ //#endregion
2682
+ //#region src/components/table/table-import-context.tsx
2683
+ var TableImportRevisionContext = createContext(0);
2684
+ var TableImportCompleteContext = createContext(null);
2685
+ var TableImportProvider = ({ children }) => {
2686
+ const [revision, setRevision] = useState(0);
2687
+ const onImportComplete = useCallback(() => {
2688
+ setRevision((previous) => {
2689
+ return previous + 1;
2690
+ });
2691
+ }, []);
2692
+ return /* @__PURE__ */ jsx(TableImportCompleteContext.Provider, {
2693
+ value: onImportComplete,
2694
+ children: /* @__PURE__ */ jsx(TableImportRevisionContext.Provider, {
2695
+ value: revision,
2696
+ children
2697
+ })
2698
+ });
2699
+ };
2681
2700
  var input_group_module_default = {
2682
2701
  inputGroup: "_inputGroup_q46ua_1",
2683
2702
  isInTable: "_isInTable_q46ua_8"
@@ -6404,10 +6423,11 @@ var TableScrollWrapper = ({ table, children }) => {
6404
6423
  };
6405
6424
  //#endregion
6406
6425
  //#region src/components/table/table.tsx
6407
- var Table = (props) => {
6426
+ var TableContent = (props) => {
6408
6427
  var _footer$pagination, _footer$pagination2, _footer$pagination3, _footer$pagination4, _defaultEmptyRow$cell;
6409
6428
  const { onListReorder = () => {}, canListReorder = () => true, beforeRenderRow, table: propTable } = props;
6410
6429
  const { columnWidths, footer, name, rows: propRows = [], actions, actionsRight, columnHeaderAlignments, columnAlignment, striped = true, testId, draggable, defaultEmptyRow = null, onAddRow = null, bordered = true, maxHeight, fixedWidth: width } = propTable;
6430
+ const importRevision = useContext(TableImportRevisionContext);
6411
6431
  const tbodyRef = useRef(null);
6412
6432
  const headers = get(props, "table.headers", []);
6413
6433
  const columnCount = getColumnCount$1(propRows, headers);
@@ -6529,7 +6549,7 @@ var Table = (props) => {
6529
6549
  dropDisabled
6530
6550
  }, `1_${index}`);
6531
6551
  })
6532
- })]
6552
+ }, importRevision)]
6533
6553
  })
6534
6554
  })
6535
6555
  }),
@@ -6541,6 +6561,9 @@ var Table = (props) => {
6541
6561
  ]
6542
6562
  });
6543
6563
  };
6564
+ var Table = (props) => {
6565
+ return /* @__PURE__ */ jsx(TableImportProvider, { children: /* @__PURE__ */ jsx(TableContent, { ...props }) });
6566
+ };
6544
6567
  //#endregion
6545
6568
  //#region src/components/data-import-export/constants.ts
6546
6569
  var placeholder$1 = "blank";
@@ -6550,7 +6573,7 @@ var MAX_IMPORT_ROWS = 1e4;
6550
6573
  var getUpdatedErrors = (existingErrors, rowLabel, fieldKey, error) => {
6551
6574
  const prefix = `${rowLabel} → ${fieldKey}:`;
6552
6575
  const withoutOld = existingErrors.filter((e) => !e.startsWith(prefix));
6553
- const updatedErrors = error ? [...withoutOld, `${prefix} ${error}`] : withoutOld;
6576
+ const updatedErrors = isString(error) && error ? [...withoutOld, `${prefix} ${error}`] : withoutOld;
6554
6577
  return {
6555
6578
  updatedErrors,
6556
6579
  isValid: updatedErrors.length === 0
@@ -6583,7 +6606,7 @@ var Table$1 = ({ validationRules, parsedResult, updateState, testId }) => {
6583
6606
  const errorPrefix = `${`Row ${absoluteIdx + 1}`} → ${key}:`;
6584
6607
  const validationError = validator(v);
6585
6608
  const persistedError = (_parsedResult$errors$ = parsedResult === null || parsedResult === void 0 || (_parsedResult$errors = parsedResult.errors) === null || _parsedResult$errors === void 0 ? void 0 : _parsedResult$errors.find((e) => e.startsWith(errorPrefix))) !== null && _parsedResult$errors$ !== void 0 ? _parsedResult$errors$ : null;
6586
- const cellError = validationError || persistedError || null;
6609
+ const cellError = (isString(validationError) ? validationError : null) || persistedError || null;
6587
6610
  return {
6588
6611
  name: key,
6589
6612
  value: v,
@@ -8039,8 +8062,16 @@ var TableImportExport = ({ config, smartUploadConfig, testId }) => {
8039
8062
  const t = useTranslationMap(translations);
8040
8063
  const resolveExportData = useExportData(t, exportData, beforeExportData);
8041
8064
  const [isPending, startTransition] = useTransition();
8065
+ const notifyImported = useContext(TableImportCompleteContext);
8066
+ const completeImport = useCallback((data) => {
8067
+ onImportComplete === null || onImportComplete === void 0 || onImportComplete(data);
8068
+ notifyImported === null || notifyImported === void 0 || notifyImported();
8069
+ }, [onImportComplete, notifyImported]);
8042
8070
  const dataImportActions = useDataImportActions({
8043
- config,
8071
+ config: {
8072
+ ...config,
8073
+ onImportComplete: completeImport
8074
+ },
8044
8075
  state,
8045
8076
  setState,
8046
8077
  smartUploadConfig,
@@ -8164,7 +8195,7 @@ var TableImportExport = ({ config, smartUploadConfig, testId }) => {
8164
8195
  readAndParseInput,
8165
8196
  onCloseModal: closeModals,
8166
8197
  validationRules,
8167
- onCompleteImport: onImportComplete,
8198
+ onCompleteImport: completeImport,
8168
8199
  prevalidationConfig,
8169
8200
  t,
8170
8201
  loading: isPending,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "10.6.4-beta-1",
3
+ "version": "10.6.5-beta-1",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {