@oliasoft-open-source/react-ui-library 5.16.0 → 5.16.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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +102 -102
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1550,6 +1550,7 @@ export declare interface ITableImportExportConfig {
|
|
|
1550
1550
|
copyFromClipBoard?: boolean;
|
|
1551
1551
|
showDeleteOptions?: boolean;
|
|
1552
1552
|
showHelpOption?: boolean;
|
|
1553
|
+
showUploadFileOption?: boolean;
|
|
1553
1554
|
onDeleteRows?: (type: 'all') => void;
|
|
1554
1555
|
onImportComplete?: (data: IImportData) => void;
|
|
1555
1556
|
}
|
package/dist/index.js
CHANGED
|
@@ -5200,158 +5200,158 @@ var initialState = {
|
|
|
5200
5200
|
};
|
|
5201
5201
|
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n }) => {
|
|
5202
5202
|
var r, i, a, o;
|
|
5203
|
-
let { exportData: s, beforeExportData: c, prevalidationConfig: l, validationRules: u, title: d, translations: f, textOnly: p = !1, showImportOptions: g = !0, copyFromClipBoard: _ = !0, showDeleteOptions: v = !0, showHelpOption: y = !0,
|
|
5203
|
+
let { exportData: s, beforeExportData: c, prevalidationConfig: l, validationRules: u, title: d, translations: f, textOnly: p = !1, showImportOptions: g = !0, copyFromClipBoard: _ = !0, showDeleteOptions: v = !0, showHelpOption: y = !0, showUploadFileOption: b = !0, modals: x = [], dynamicOptions: S, onImportComplete: C } = e == null ? {} : e, [w, T] = useState(initialState), { modalVisibility: { smartUploadModal: E = !1, reviewPasteModal: D = !1, helpModal: O = !1 } } = w, { enabled: k, prompt: A = "", onClose: j, onError: M, service: N = () => Promise.resolve() } = t == null ? {} : t, P = useTranslationMap(f), F = useExportData(P, s, c), [I, L] = useTransition(), R = useDataImportActions({
|
|
5204
5204
|
config: e,
|
|
5205
|
-
state:
|
|
5206
|
-
setState:
|
|
5205
|
+
state: w,
|
|
5206
|
+
setState: T,
|
|
5207
5207
|
smartUploadConfig: t,
|
|
5208
|
-
startTransition:
|
|
5209
|
-
}), { readAndParseInput:
|
|
5210
|
-
useKeyboardEvent("Escape", () =>
|
|
5211
|
-
let
|
|
5212
|
-
{
|
|
5208
|
+
startTransition: L
|
|
5209
|
+
}), { readAndParseInput: z, updateState: B, closeModals: V, setModalVisibility: H, onFileChange: U, onClickQuickPasteFromClipBoard: W, onClickCopyClipboard: G, onSmartUploadResult: K, deleteAllRows: q } = R == null ? {} : R;
|
|
5210
|
+
useKeyboardEvent("Escape", () => V());
|
|
5211
|
+
let J = g ? [
|
|
5212
|
+
...b ? [{
|
|
5213
5213
|
type: "Option",
|
|
5214
|
-
label:
|
|
5214
|
+
label: P("uploadFile"),
|
|
5215
5215
|
upload: !0,
|
|
5216
5216
|
uploadType: ".csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
5217
|
-
onChange:
|
|
5217
|
+
onChange: U,
|
|
5218
5218
|
testId: `${n}-option-upload-file`
|
|
5219
|
-
},
|
|
5219
|
+
}] : [],
|
|
5220
5220
|
..._ ? [{
|
|
5221
5221
|
type: "Option",
|
|
5222
|
-
label:
|
|
5223
|
-
onClick:
|
|
5222
|
+
label: P("quickPasteFromClipboard"),
|
|
5223
|
+
onClick: W,
|
|
5224
5224
|
testId: `${n}-option-quick-paste-from-clipboard`
|
|
5225
5225
|
}] : [],
|
|
5226
5226
|
..._ ? [{
|
|
5227
5227
|
type: "Option",
|
|
5228
|
-
label:
|
|
5229
|
-
onClick: () =>
|
|
5228
|
+
label: P("pasteWithReview"),
|
|
5229
|
+
onClick: () => H("reviewPasteModal", !D),
|
|
5230
5230
|
testId: `${n}-paste-with-review`
|
|
5231
5231
|
}] : [],
|
|
5232
|
-
...
|
|
5232
|
+
...A && k && t ? [{
|
|
5233
5233
|
type: "Option",
|
|
5234
|
-
label:
|
|
5235
|
-
onClick: () =>
|
|
5234
|
+
label: P("smartUpload_smartUpload"),
|
|
5235
|
+
onClick: () => H("smartUploadModal", !E),
|
|
5236
5236
|
testId: `${n}-smart-upload`
|
|
5237
5237
|
}] : [],
|
|
5238
|
-
...applyModalHandlers((r =
|
|
5239
|
-
] : [],
|
|
5238
|
+
...applyModalHandlers((r = S == null ? void 0 : S.importOptions) == null ? [] : r, w, H)
|
|
5239
|
+
] : [], Y = [
|
|
5240
5240
|
{
|
|
5241
5241
|
type: "Option",
|
|
5242
|
-
label:
|
|
5242
|
+
label: P("downloadFile"),
|
|
5243
5243
|
onClick: async () => {
|
|
5244
|
-
let e = await
|
|
5244
|
+
let e = await F();
|
|
5245
5245
|
e && e && onClickDownLoad(e, d);
|
|
5246
5246
|
}
|
|
5247
5247
|
},
|
|
5248
5248
|
...p ? [{
|
|
5249
5249
|
type: "Option",
|
|
5250
|
-
label:
|
|
5251
|
-
onClick: () =>
|
|
5250
|
+
label: P("copyToClipboard"),
|
|
5251
|
+
onClick: () => G("dot")
|
|
5252
5252
|
}] : [{
|
|
5253
5253
|
type: "Menu",
|
|
5254
5254
|
testId: `${n}-menu-copy-to-clipboard`,
|
|
5255
5255
|
menu: {
|
|
5256
5256
|
trigger: "Text",
|
|
5257
|
-
label:
|
|
5257
|
+
label: P("copyToClipboard"),
|
|
5258
5258
|
sections: [{
|
|
5259
5259
|
type: "Option",
|
|
5260
|
-
label:
|
|
5261
|
-
onClick: () =>
|
|
5260
|
+
label: P("copyDecimalDot"),
|
|
5261
|
+
onClick: () => G("dot"),
|
|
5262
5262
|
testId: `${n}-option-copy-decimal-dot`
|
|
5263
5263
|
}, {
|
|
5264
5264
|
type: "Option",
|
|
5265
|
-
label:
|
|
5266
|
-
onClick: () =>
|
|
5265
|
+
label: P("copyDecimalComma"),
|
|
5266
|
+
onClick: () => G("comma")
|
|
5267
5267
|
}]
|
|
5268
5268
|
}
|
|
5269
5269
|
}],
|
|
5270
|
-
...applyModalHandlers((i =
|
|
5271
|
-
],
|
|
5270
|
+
...applyModalHandlers((i = S == null ? void 0 : S.exportOptions) == null ? [] : i, w, H)
|
|
5271
|
+
], X = v ? [{
|
|
5272
5272
|
type: "Option",
|
|
5273
|
-
label:
|
|
5274
|
-
onClick: () =>
|
|
5273
|
+
label: P("deleteAllRows"),
|
|
5274
|
+
onClick: () => q(),
|
|
5275
5275
|
testId: `${n}-delete-all-rows`
|
|
5276
|
-
}, ...applyModalHandlers((a =
|
|
5276
|
+
}, ...applyModalHandlers((a = S == null ? void 0 : S.deleteOptions) == null ? [] : a, w, H)] : [], ee = y ? [
|
|
5277
5277
|
{ type: "Divider" },
|
|
5278
5278
|
{
|
|
5279
5279
|
type: "Option",
|
|
5280
|
-
label:
|
|
5281
|
-
onClick: () =>
|
|
5280
|
+
label: P("help"),
|
|
5281
|
+
onClick: () => H("helpModal", !O)
|
|
5282
5282
|
},
|
|
5283
|
-
...applyModalHandlers((o =
|
|
5284
|
-
] : [],
|
|
5285
|
-
...
|
|
5286
|
-
section: [...
|
|
5283
|
+
...applyModalHandlers((o = S == null ? void 0 : S.helpOptions) == null ? [] : o, w, H)
|
|
5284
|
+
] : [], Z = [
|
|
5285
|
+
...J.length ? [{
|
|
5286
|
+
section: [...J, ...ee],
|
|
5287
5287
|
name: "import-options",
|
|
5288
5288
|
iconName: "import",
|
|
5289
|
-
tooltip:
|
|
5289
|
+
tooltip: P("import")
|
|
5290
5290
|
}] : [],
|
|
5291
|
-
...
|
|
5292
|
-
section:
|
|
5291
|
+
...Y.length ? [{
|
|
5292
|
+
section: Y,
|
|
5293
5293
|
name: "export-options",
|
|
5294
5294
|
iconName: "export",
|
|
5295
|
-
tooltip:
|
|
5295
|
+
tooltip: P("export")
|
|
5296
5296
|
}] : [],
|
|
5297
|
-
...
|
|
5298
|
-
section:
|
|
5297
|
+
...X.length ? [{
|
|
5298
|
+
section: X,
|
|
5299
5299
|
name: "delete-options",
|
|
5300
5300
|
iconName: "delete",
|
|
5301
|
-
tooltip:
|
|
5301
|
+
tooltip: P("deleteAllRows")
|
|
5302
5302
|
}] : []
|
|
5303
5303
|
];
|
|
5304
5304
|
return /* @__PURE__ */ jsxs("span", { children: [
|
|
5305
|
-
|
|
5305
|
+
I && /* @__PURE__ */ jsx(Spinner, {
|
|
5306
5306
|
small: !0,
|
|
5307
5307
|
dark: !0
|
|
5308
5308
|
}),
|
|
5309
|
-
|
|
5309
|
+
Z.map((e, t) => /* @__PURE__ */ jsx(MenuComponent, {
|
|
5310
5310
|
sections: e.section,
|
|
5311
5311
|
iconName: e.iconName,
|
|
5312
5312
|
tooltip: e.tooltip,
|
|
5313
5313
|
testId: `data-${e == null ? void 0 : e.name}-menu`
|
|
5314
5314
|
}, t)),
|
|
5315
|
-
|
|
5315
|
+
D && /* @__PURE__ */ jsx(PasteWithReviewModal, {
|
|
5316
5316
|
config: e,
|
|
5317
|
-
state:
|
|
5318
|
-
updateState:
|
|
5319
|
-
setModalVisibility:
|
|
5320
|
-
readAndParseInput:
|
|
5321
|
-
onCloseModal:
|
|
5317
|
+
state: w,
|
|
5318
|
+
updateState: B,
|
|
5319
|
+
setModalVisibility: H,
|
|
5320
|
+
readAndParseInput: z,
|
|
5321
|
+
onCloseModal: V,
|
|
5322
5322
|
validationRules: u,
|
|
5323
|
-
onCompleteImport:
|
|
5323
|
+
onCompleteImport: C,
|
|
5324
5324
|
prevalidationConfig: l,
|
|
5325
|
-
t:
|
|
5326
|
-
loading:
|
|
5327
|
-
startTransition:
|
|
5325
|
+
t: P,
|
|
5326
|
+
loading: I,
|
|
5327
|
+
startTransition: L,
|
|
5328
5328
|
testId: n
|
|
5329
5329
|
}),
|
|
5330
|
-
|
|
5331
|
-
visible:
|
|
5332
|
-
setModalVisibility:
|
|
5330
|
+
O && /* @__PURE__ */ jsx(HelpModal, {
|
|
5331
|
+
visible: O,
|
|
5332
|
+
setModalVisibility: H,
|
|
5333
5333
|
validationRules: u,
|
|
5334
|
-
t:
|
|
5334
|
+
t: P
|
|
5335
5335
|
}),
|
|
5336
|
-
|
|
5337
|
-
visible:
|
|
5338
|
-
prompt:
|
|
5339
|
-
onUpload:
|
|
5340
|
-
onCloseModal: () =>
|
|
5341
|
-
onComplete:
|
|
5342
|
-
onError:
|
|
5343
|
-
heading:
|
|
5344
|
-
dialogText:
|
|
5345
|
-
fileInputText:
|
|
5346
|
-
fileInputPlaceholder:
|
|
5347
|
-
uploadText:
|
|
5348
|
-
cancelText:
|
|
5336
|
+
k && t && /* @__PURE__ */ jsx(SmartUploadModal, {
|
|
5337
|
+
visible: E,
|
|
5338
|
+
prompt: A,
|
|
5339
|
+
onUpload: N,
|
|
5340
|
+
onCloseModal: () => V({ callback: j }),
|
|
5341
|
+
onComplete: K,
|
|
5342
|
+
onError: M,
|
|
5343
|
+
heading: P("smartUpload_smartUpload"),
|
|
5344
|
+
dialogText: P("smartUpload_description"),
|
|
5345
|
+
fileInputText: P("chooseFile"),
|
|
5346
|
+
fileInputPlaceholder: P("noFileSelected"),
|
|
5347
|
+
uploadText: P("uploadCapitalized"),
|
|
5348
|
+
cancelText: P("cancel"),
|
|
5349
5349
|
testId: n
|
|
5350
5350
|
}),
|
|
5351
5351
|
/* @__PURE__ */ jsx(ModalsRenderer, {
|
|
5352
|
-
modals:
|
|
5353
|
-
modalVisibility:
|
|
5354
|
-
onCloseModal:
|
|
5352
|
+
modals: x,
|
|
5353
|
+
modalVisibility: w == null ? void 0 : w.modalVisibility,
|
|
5354
|
+
onCloseModal: V,
|
|
5355
5355
|
testId: n
|
|
5356
5356
|
})
|
|
5357
5357
|
] });
|
|
@@ -7061,7 +7061,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7061
7061
|
} : {
|
|
7062
7062
|
value: G,
|
|
7063
7063
|
unit: U
|
|
7064
|
-
}), J = k || (K == null ? void 0 : K.value) === void 0, [Y,
|
|
7064
|
+
}), J = k || (K == null ? void 0 : K.value) === void 0, [Y, X] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), ee = !!(O || n), Z = C && C.find((e) => {
|
|
7065
7065
|
if (!(e != null && e.value)) return;
|
|
7066
7066
|
if (E) return E === e.valueKey;
|
|
7067
7067
|
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
|
|
@@ -7070,7 +7070,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7070
7070
|
toUnit: t
|
|
7071
7071
|
});
|
|
7072
7072
|
return withUnit(n, t) === e.value;
|
|
7073
|
-
}),
|
|
7073
|
+
}), te = () => {
|
|
7074
7074
|
var e;
|
|
7075
7075
|
let t = (e = l) == null ? "" : e, n = K.unit;
|
|
7076
7076
|
if (!checkConversion({
|
|
@@ -7086,7 +7086,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7086
7086
|
} catch {
|
|
7087
7087
|
return null;
|
|
7088
7088
|
}
|
|
7089
|
-
},
|
|
7089
|
+
}, ne = (t) => {
|
|
7090
7090
|
let n = getStringName(e), r = t.target, { value: i, selectionStart: a } = r, o = withUnit(i, (K == null ? void 0 : K.unit) || "");
|
|
7091
7091
|
h({ target: {
|
|
7092
7092
|
value: A ? withUnit(convertAndGetValue(o, B), B) : o,
|
|
@@ -7099,7 +7099,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7099
7099
|
}), R(() => {
|
|
7100
7100
|
r.selectionStart = a, r.selectionEnd = a;
|
|
7101
7101
|
});
|
|
7102
|
-
},
|
|
7102
|
+
}, re = (e, t) => {
|
|
7103
7103
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
7104
7104
|
value: e,
|
|
7105
7105
|
unit: t
|
|
@@ -7130,7 +7130,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7130
7130
|
e !== void 0 && q({
|
|
7131
7131
|
value: e,
|
|
7132
7132
|
unit: t
|
|
7133
|
-
}),
|
|
7133
|
+
}), X(C && Z && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
7134
7134
|
}
|
|
7135
7135
|
}, [
|
|
7136
7136
|
U,
|
|
@@ -7138,7 +7138,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7138
7138
|
i,
|
|
7139
7139
|
T
|
|
7140
7140
|
]);
|
|
7141
|
-
let
|
|
7141
|
+
let Q = te(), $ = label(K.unit) || K.unit || "", ie = p || !Q || Q && Q.length === 1, ae = getStringName(e), oe, se = (t) => {
|
|
7142
7142
|
let r = t != null && t.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
7143
7143
|
if (checkConversion({
|
|
7144
7144
|
value: r,
|
|
@@ -7158,7 +7158,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7158
7158
|
type: MenuType.OPTION,
|
|
7159
7159
|
inline: !0,
|
|
7160
7160
|
onClick: () => {
|
|
7161
|
-
validateNumber(i).valid && !n && (
|
|
7161
|
+
validateNumber(i).valid && !n && (X(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
|
|
7162
7162
|
value: r,
|
|
7163
7163
|
name: typeof e == "string" ? e : (e == null ? void 0 : e.fieldName) || "",
|
|
7164
7164
|
predefinedSelected: !0,
|
|
@@ -7170,10 +7170,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7170
7170
|
height: "0"
|
|
7171
7171
|
})] }),
|
|
7172
7172
|
description: o,
|
|
7173
|
-
selected:
|
|
7173
|
+
selected: Z === t && Y === PredefinedOptionsMenuState.PREDEFINED
|
|
7174
7174
|
};
|
|
7175
7175
|
};
|
|
7176
|
-
if (
|
|
7176
|
+
if (oe = [{
|
|
7177
7177
|
type: MenuType.OPTION,
|
|
7178
7178
|
inline: !0,
|
|
7179
7179
|
onClick: () => {
|
|
@@ -7186,7 +7186,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7186
7186
|
selected: Y === PredefinedOptionsMenuState.CUSTOM
|
|
7187
7187
|
}], C != null && C.length) {
|
|
7188
7188
|
let e = C.map(se);
|
|
7189
|
-
|
|
7189
|
+
oe = [...oe, ...e];
|
|
7190
7190
|
}
|
|
7191
7191
|
let ce = (e) => {
|
|
7192
7192
|
if (isValueWithUnit(e)) {
|
|
@@ -7222,39 +7222,39 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7222
7222
|
small: o
|
|
7223
7223
|
}),
|
|
7224
7224
|
small: o,
|
|
7225
|
-
sections:
|
|
7225
|
+
sections: oe
|
|
7226
7226
|
},
|
|
7227
|
-
tooltip: Y === PredefinedOptionsMenuState.PREDEFINED ?
|
|
7227
|
+
tooltip: Y === PredefinedOptionsMenuState.PREDEFINED ? Z == null ? void 0 : Z.label : ""
|
|
7228
7228
|
}),
|
|
7229
7229
|
/* @__PURE__ */ jsx("div", {
|
|
7230
7230
|
className: unit_input_module_default.inputWrapper,
|
|
7231
7231
|
children: /* @__PURE__ */ jsx(NumberInput, {
|
|
7232
|
-
name:
|
|
7232
|
+
name: ae,
|
|
7233
7233
|
testId: x,
|
|
7234
7234
|
disabled: n,
|
|
7235
7235
|
placeholder: ce(t),
|
|
7236
7236
|
value: K.value,
|
|
7237
|
-
onChange:
|
|
7237
|
+
onChange: ne,
|
|
7238
7238
|
onFocus: v,
|
|
7239
7239
|
error: i === null ? void 0 : i,
|
|
7240
7240
|
warning: S === null ? void 0 : S,
|
|
7241
7241
|
left: a,
|
|
7242
7242
|
allowEmpty: J,
|
|
7243
|
-
validationCallback: (e, t) => D(
|
|
7243
|
+
validationCallback: (e, t) => D(ae, t),
|
|
7244
7244
|
enableCosmeticRounding: j,
|
|
7245
7245
|
enableDisplayRounding: M,
|
|
7246
7246
|
roundDisplayValue: N,
|
|
7247
7247
|
groupOrder: le,
|
|
7248
|
-
disableInternalErrorValidationMessages:
|
|
7248
|
+
disableInternalErrorValidationMessages: ee,
|
|
7249
7249
|
small: o,
|
|
7250
7250
|
selectOnFocus: P,
|
|
7251
7251
|
tooltip: I
|
|
7252
|
-
},
|
|
7252
|
+
}, ae)
|
|
7253
7253
|
}),
|
|
7254
|
-
|
|
7254
|
+
$ && (ie || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
7255
7255
|
groupOrder: ue,
|
|
7256
7256
|
small: o,
|
|
7257
|
-
children:
|
|
7257
|
+
children: $
|
|
7258
7258
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
7259
7259
|
groupOrder: ue,
|
|
7260
7260
|
maxHeight: 380,
|
|
@@ -7262,20 +7262,20 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7262
7262
|
testId: x && `${x}-menu`,
|
|
7263
7263
|
tabIndex: -1,
|
|
7264
7264
|
menu: {
|
|
7265
|
-
label:
|
|
7265
|
+
label: $,
|
|
7266
7266
|
trigger: "DropDownButton",
|
|
7267
7267
|
small: o,
|
|
7268
|
-
sections:
|
|
7268
|
+
sections: Q.map(([e = "", t = "", n]) => {
|
|
7269
7269
|
let r = n || t || "", i = isValidNum(e) ? e : "";
|
|
7270
7270
|
return {
|
|
7271
7271
|
type: "Option",
|
|
7272
7272
|
label: j ? safeRoundNumbers(i) : i,
|
|
7273
7273
|
inline: !0,
|
|
7274
7274
|
onClick: (n) => {
|
|
7275
|
-
n.stopPropagation(),
|
|
7275
|
+
n.stopPropagation(), re(e, t);
|
|
7276
7276
|
},
|
|
7277
7277
|
description: r,
|
|
7278
|
-
selected: r ===
|
|
7278
|
+
selected: r === $,
|
|
7279
7279
|
testId: `${x}-unit-${r}`
|
|
7280
7280
|
};
|
|
7281
7281
|
})
|
package/package.json
CHANGED