@oliasoft-open-source/react-ui-library 10.7.0-beta-9 → 10.7.0-beta-10
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.
- package/dist/index.js +44 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1117,6 +1117,12 @@ var Option$2 = ({ actions, label, url, onClick, description, icon, selected, clo
|
|
|
1117
1117
|
}
|
|
1118
1118
|
onClick === null || onClick === void 0 || onClick(evt);
|
|
1119
1119
|
};
|
|
1120
|
+
const handleClickCapture = (evt) => {
|
|
1121
|
+
if (disabled) {
|
|
1122
|
+
evt.preventDefault();
|
|
1123
|
+
evt.stopPropagation();
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1120
1126
|
const handleFileChange = (evt) => {
|
|
1121
1127
|
var _evt$target;
|
|
1122
1128
|
const { files } = (_evt$target = evt === null || evt === void 0 ? void 0 : evt.target) !== null && _evt$target !== void 0 ? _evt$target : {};
|
|
@@ -1141,6 +1147,7 @@ var Option$2 = ({ actions, label, url, onClick, description, icon, selected, clo
|
|
|
1141
1147
|
isDisabled: disabled,
|
|
1142
1148
|
shouldCloseOnSelect: upload ? false : closeOnOptionClick,
|
|
1143
1149
|
onClick: handleClick,
|
|
1150
|
+
onClickCapture: handleClickCapture,
|
|
1144
1151
|
"data-testid": testId,
|
|
1145
1152
|
children: [
|
|
1146
1153
|
icon ? /* @__PURE__ */ jsx("span", {
|
|
@@ -2681,6 +2688,25 @@ var Drawer = ({ background = "var(--color-background-raised)", fixed = false, op
|
|
|
2681
2688
|
})
|
|
2682
2689
|
});
|
|
2683
2690
|
};
|
|
2691
|
+
//#endregion
|
|
2692
|
+
//#region src/components/table/table-import-context.tsx
|
|
2693
|
+
var TableImportRevisionContext = createContext(0);
|
|
2694
|
+
var TableImportCompleteContext = createContext(null);
|
|
2695
|
+
var TableImportProvider = ({ children }) => {
|
|
2696
|
+
const [revision, setRevision] = useState(0);
|
|
2697
|
+
const onImportComplete = useCallback(() => {
|
|
2698
|
+
setRevision((previous) => {
|
|
2699
|
+
return previous + 1;
|
|
2700
|
+
});
|
|
2701
|
+
}, []);
|
|
2702
|
+
return /* @__PURE__ */ jsx(TableImportCompleteContext.Provider, {
|
|
2703
|
+
value: onImportComplete,
|
|
2704
|
+
children: /* @__PURE__ */ jsx(TableImportRevisionContext.Provider, {
|
|
2705
|
+
value: revision,
|
|
2706
|
+
children
|
|
2707
|
+
})
|
|
2708
|
+
});
|
|
2709
|
+
};
|
|
2684
2710
|
var input_group_module_default = {
|
|
2685
2711
|
inputGroup: "_inputGroup_q46ua_1",
|
|
2686
2712
|
isInTable: "_isInTable_q46ua_8"
|
|
@@ -6445,10 +6471,11 @@ var TableScrollWrapper = ({ table, children }) => {
|
|
|
6445
6471
|
};
|
|
6446
6472
|
//#endregion
|
|
6447
6473
|
//#region src/components/table/table.tsx
|
|
6448
|
-
var
|
|
6474
|
+
var TableContent = (props) => {
|
|
6449
6475
|
var _footer$pagination, _footer$pagination2, _footer$pagination3, _footer$pagination4, _defaultEmptyRow$cell;
|
|
6450
6476
|
const { onListReorder = () => {}, canListReorder = () => true, beforeRenderRow, table: propTable } = props;
|
|
6451
6477
|
const { columnWidths, footer, name, rows: propRows = [], actions, actionsRight, columnHeaderAlignments, columnAlignment, striped = true, testId, draggable, defaultEmptyRow = null, onAddRow = null, bordered = true, maxHeight, fixedWidth: width } = propTable;
|
|
6478
|
+
const importRevision = useContext(TableImportRevisionContext);
|
|
6452
6479
|
const tbodyRef = useRef(null);
|
|
6453
6480
|
const headers = get(props, "table.headers", []);
|
|
6454
6481
|
const columnCount = getColumnCount$1(propRows, headers);
|
|
@@ -6570,7 +6597,7 @@ var Table = (props) => {
|
|
|
6570
6597
|
dropDisabled
|
|
6571
6598
|
}, `1_${index}`);
|
|
6572
6599
|
})
|
|
6573
|
-
})]
|
|
6600
|
+
}, importRevision)]
|
|
6574
6601
|
})
|
|
6575
6602
|
})
|
|
6576
6603
|
}),
|
|
@@ -6582,6 +6609,9 @@ var Table = (props) => {
|
|
|
6582
6609
|
]
|
|
6583
6610
|
});
|
|
6584
6611
|
};
|
|
6612
|
+
var Table = (props) => {
|
|
6613
|
+
return /* @__PURE__ */ jsx(TableImportProvider, { children: /* @__PURE__ */ jsx(TableContent, { ...props }) });
|
|
6614
|
+
};
|
|
6585
6615
|
//#endregion
|
|
6586
6616
|
//#region src/components/data-import-export/constants.ts
|
|
6587
6617
|
var placeholder$1 = "blank";
|
|
@@ -6591,7 +6621,7 @@ var MAX_IMPORT_ROWS = 1e4;
|
|
|
6591
6621
|
var getUpdatedErrors = (existingErrors, rowLabel, fieldKey, error) => {
|
|
6592
6622
|
const prefix = `${rowLabel} → ${fieldKey}:`;
|
|
6593
6623
|
const withoutOld = existingErrors.filter((e) => !e.startsWith(prefix));
|
|
6594
|
-
const updatedErrors = error ? [...withoutOld, `${prefix} ${error}`] : withoutOld;
|
|
6624
|
+
const updatedErrors = isString(error) && error ? [...withoutOld, `${prefix} ${error}`] : withoutOld;
|
|
6595
6625
|
return {
|
|
6596
6626
|
updatedErrors,
|
|
6597
6627
|
isValid: updatedErrors.length === 0
|
|
@@ -6624,7 +6654,7 @@ var Table$1 = ({ validationRules, parsedResult, updateState, testId }) => {
|
|
|
6624
6654
|
const errorPrefix = `${`Row ${absoluteIdx + 1}`} → ${key}:`;
|
|
6625
6655
|
const validationError = validator(v);
|
|
6626
6656
|
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;
|
|
6627
|
-
const cellError = validationError || persistedError || null;
|
|
6657
|
+
const cellError = (isString(validationError) ? validationError : null) || persistedError || null;
|
|
6628
6658
|
return {
|
|
6629
6659
|
name: key,
|
|
6630
6660
|
value: v,
|
|
@@ -8080,8 +8110,16 @@ var TableImportExport = ({ config, smartUploadConfig, testId }) => {
|
|
|
8080
8110
|
const t = useTranslationMap(translations);
|
|
8081
8111
|
const resolveExportData = useExportData(t, exportData, beforeExportData);
|
|
8082
8112
|
const [isPending, startTransition] = useTransition();
|
|
8113
|
+
const notifyImported = useContext(TableImportCompleteContext);
|
|
8114
|
+
const completeImport = useCallback((data) => {
|
|
8115
|
+
onImportComplete === null || onImportComplete === void 0 || onImportComplete(data);
|
|
8116
|
+
notifyImported === null || notifyImported === void 0 || notifyImported();
|
|
8117
|
+
}, [onImportComplete, notifyImported]);
|
|
8083
8118
|
const dataImportActions = useDataImportActions({
|
|
8084
|
-
config
|
|
8119
|
+
config: {
|
|
8120
|
+
...config,
|
|
8121
|
+
onImportComplete: completeImport
|
|
8122
|
+
},
|
|
8085
8123
|
state,
|
|
8086
8124
|
setState,
|
|
8087
8125
|
smartUploadConfig,
|
|
@@ -8205,7 +8243,7 @@ var TableImportExport = ({ config, smartUploadConfig, testId }) => {
|
|
|
8205
8243
|
readAndParseInput,
|
|
8206
8244
|
onCloseModal: closeModals,
|
|
8207
8245
|
validationRules,
|
|
8208
|
-
onCompleteImport:
|
|
8246
|
+
onCompleteImport: completeImport,
|
|
8209
8247
|
prevalidationConfig,
|
|
8210
8248
|
t,
|
|
8211
8249
|
loading: isPending,
|
package/package.json
CHANGED