@oliasoft-open-source/react-ui-library 5.15.2 → 5.15.3-beta-2
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
|
@@ -1549,6 +1549,7 @@ export declare interface ITableImportExportConfig {
|
|
|
1549
1549
|
copyFromClipBoard?: boolean;
|
|
1550
1550
|
showDeleteOptions?: boolean;
|
|
1551
1551
|
showHelpOption?: boolean;
|
|
1552
|
+
showUploadFileOption?: boolean;
|
|
1552
1553
|
onDeleteRows?: (type: 'all') => void;
|
|
1553
1554
|
onImportComplete?: (data: IImportData) => void;
|
|
1554
1555
|
}
|
package/dist/index.js
CHANGED
|
@@ -5199,158 +5199,158 @@ var initialState = {
|
|
|
5199
5199
|
};
|
|
5200
5200
|
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n }) => {
|
|
5201
5201
|
var r, i, a, o;
|
|
5202
|
-
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,
|
|
5202
|
+
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({
|
|
5203
5203
|
config: e,
|
|
5204
|
-
state:
|
|
5205
|
-
setState:
|
|
5204
|
+
state: w,
|
|
5205
|
+
setState: T,
|
|
5206
5206
|
smartUploadConfig: t,
|
|
5207
|
-
startTransition:
|
|
5208
|
-
}), { readAndParseInput:
|
|
5209
|
-
useKeyboardEvent("Escape", () =>
|
|
5210
|
-
let
|
|
5211
|
-
{
|
|
5207
|
+
startTransition: L
|
|
5208
|
+
}), { readAndParseInput: z, updateState: B, closeModals: V, setModalVisibility: H, onFileChange: U, onClickQuickPasteFromClipBoard: W, onClickCopyClipboard: G, onSmartUploadResult: K, deleteAllRows: q } = R == null ? {} : R;
|
|
5209
|
+
useKeyboardEvent("Escape", () => V());
|
|
5210
|
+
let J = g ? [
|
|
5211
|
+
...b ? [{
|
|
5212
5212
|
type: "Option",
|
|
5213
|
-
label:
|
|
5213
|
+
label: P("uploadFile"),
|
|
5214
5214
|
upload: !0,
|
|
5215
5215
|
uploadType: ".csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
5216
|
-
onChange:
|
|
5216
|
+
onChange: U,
|
|
5217
5217
|
testId: `${n}-option-upload-file`
|
|
5218
|
-
},
|
|
5218
|
+
}] : [],
|
|
5219
5219
|
..._ ? [{
|
|
5220
5220
|
type: "Option",
|
|
5221
|
-
label:
|
|
5222
|
-
onClick:
|
|
5221
|
+
label: P("quickPasteFromClipboard"),
|
|
5222
|
+
onClick: W,
|
|
5223
5223
|
testId: `${n}-option-quick-paste-from-clipboard`
|
|
5224
5224
|
}] : [],
|
|
5225
5225
|
..._ ? [{
|
|
5226
5226
|
type: "Option",
|
|
5227
|
-
label:
|
|
5228
|
-
onClick: () =>
|
|
5227
|
+
label: P("pasteWithReview"),
|
|
5228
|
+
onClick: () => H("reviewPasteModal", !D),
|
|
5229
5229
|
testId: `${n}-paste-with-review`
|
|
5230
5230
|
}] : [],
|
|
5231
|
-
...
|
|
5231
|
+
...A && k && t ? [{
|
|
5232
5232
|
type: "Option",
|
|
5233
|
-
label:
|
|
5234
|
-
onClick: () =>
|
|
5233
|
+
label: P("smartUpload_smartUpload"),
|
|
5234
|
+
onClick: () => H("smartUploadModal", !E),
|
|
5235
5235
|
testId: `${n}-smart-upload`
|
|
5236
5236
|
}] : [],
|
|
5237
|
-
...applyModalHandlers((r =
|
|
5238
|
-
] : [],
|
|
5237
|
+
...applyModalHandlers((r = S == null ? void 0 : S.importOptions) == null ? [] : r, w, H)
|
|
5238
|
+
] : [], Y = [
|
|
5239
5239
|
{
|
|
5240
5240
|
type: "Option",
|
|
5241
|
-
label:
|
|
5241
|
+
label: P("downloadFile"),
|
|
5242
5242
|
onClick: async () => {
|
|
5243
|
-
let e = await
|
|
5243
|
+
let e = await F();
|
|
5244
5244
|
e && e && onClickDownLoad(e, d);
|
|
5245
5245
|
}
|
|
5246
5246
|
},
|
|
5247
5247
|
...p ? [{
|
|
5248
5248
|
type: "Option",
|
|
5249
|
-
label:
|
|
5250
|
-
onClick: () =>
|
|
5249
|
+
label: P("copyToClipboard"),
|
|
5250
|
+
onClick: () => G("dot")
|
|
5251
5251
|
}] : [{
|
|
5252
5252
|
type: "Menu",
|
|
5253
5253
|
testId: `${n}-menu-copy-to-clipboard`,
|
|
5254
5254
|
menu: {
|
|
5255
5255
|
trigger: "Text",
|
|
5256
|
-
label:
|
|
5256
|
+
label: P("copyToClipboard"),
|
|
5257
5257
|
sections: [{
|
|
5258
5258
|
type: "Option",
|
|
5259
|
-
label:
|
|
5260
|
-
onClick: () =>
|
|
5259
|
+
label: P("copyDecimalDot"),
|
|
5260
|
+
onClick: () => G("dot"),
|
|
5261
5261
|
testId: `${n}-option-copy-decimal-dot`
|
|
5262
5262
|
}, {
|
|
5263
5263
|
type: "Option",
|
|
5264
|
-
label:
|
|
5265
|
-
onClick: () =>
|
|
5264
|
+
label: P("copyDecimalComma"),
|
|
5265
|
+
onClick: () => G("comma")
|
|
5266
5266
|
}]
|
|
5267
5267
|
}
|
|
5268
5268
|
}],
|
|
5269
|
-
...applyModalHandlers((i =
|
|
5270
|
-
],
|
|
5269
|
+
...applyModalHandlers((i = S == null ? void 0 : S.exportOptions) == null ? [] : i, w, H)
|
|
5270
|
+
], X = v ? [{
|
|
5271
5271
|
type: "Option",
|
|
5272
|
-
label:
|
|
5273
|
-
onClick: () =>
|
|
5272
|
+
label: P("deleteAllRows"),
|
|
5273
|
+
onClick: () => q(),
|
|
5274
5274
|
testId: `${n}-delete-all-rows`
|
|
5275
|
-
}, ...applyModalHandlers((a =
|
|
5275
|
+
}, ...applyModalHandlers((a = S == null ? void 0 : S.deleteOptions) == null ? [] : a, w, H)] : [], ee = y ? [
|
|
5276
5276
|
{ type: "Divider" },
|
|
5277
5277
|
{
|
|
5278
5278
|
type: "Option",
|
|
5279
|
-
label:
|
|
5280
|
-
onClick: () =>
|
|
5279
|
+
label: P("help"),
|
|
5280
|
+
onClick: () => H("helpModal", !O)
|
|
5281
5281
|
},
|
|
5282
|
-
...applyModalHandlers((o =
|
|
5283
|
-
] : [],
|
|
5284
|
-
...
|
|
5285
|
-
section: [...
|
|
5282
|
+
...applyModalHandlers((o = S == null ? void 0 : S.helpOptions) == null ? [] : o, w, H)
|
|
5283
|
+
] : [], Z = [
|
|
5284
|
+
...J.length ? [{
|
|
5285
|
+
section: [...J, ...ee],
|
|
5286
5286
|
name: "import-options",
|
|
5287
5287
|
iconName: "import",
|
|
5288
|
-
tooltip:
|
|
5288
|
+
tooltip: P("import")
|
|
5289
5289
|
}] : [],
|
|
5290
|
-
...
|
|
5291
|
-
section:
|
|
5290
|
+
...Y.length ? [{
|
|
5291
|
+
section: Y,
|
|
5292
5292
|
name: "export-options",
|
|
5293
5293
|
iconName: "export",
|
|
5294
|
-
tooltip:
|
|
5294
|
+
tooltip: P("export")
|
|
5295
5295
|
}] : [],
|
|
5296
|
-
...
|
|
5297
|
-
section:
|
|
5296
|
+
...X.length ? [{
|
|
5297
|
+
section: X,
|
|
5298
5298
|
name: "delete-options",
|
|
5299
5299
|
iconName: "delete",
|
|
5300
|
-
tooltip:
|
|
5300
|
+
tooltip: P("deleteAllRows")
|
|
5301
5301
|
}] : []
|
|
5302
5302
|
];
|
|
5303
5303
|
return /* @__PURE__ */ jsxs("span", { children: [
|
|
5304
|
-
|
|
5304
|
+
I && /* @__PURE__ */ jsx(Spinner, {
|
|
5305
5305
|
small: !0,
|
|
5306
5306
|
dark: !0
|
|
5307
5307
|
}),
|
|
5308
|
-
|
|
5308
|
+
Z.map((e, t) => /* @__PURE__ */ jsx(MenuComponent, {
|
|
5309
5309
|
sections: e.section,
|
|
5310
5310
|
iconName: e.iconName,
|
|
5311
5311
|
tooltip: e.tooltip,
|
|
5312
5312
|
testId: `data-${e == null ? void 0 : e.name}-menu`
|
|
5313
5313
|
}, t)),
|
|
5314
|
-
|
|
5314
|
+
D && /* @__PURE__ */ jsx(PasteWithReviewModal, {
|
|
5315
5315
|
config: e,
|
|
5316
|
-
state:
|
|
5317
|
-
updateState:
|
|
5318
|
-
setModalVisibility:
|
|
5319
|
-
readAndParseInput:
|
|
5320
|
-
onCloseModal:
|
|
5316
|
+
state: w,
|
|
5317
|
+
updateState: B,
|
|
5318
|
+
setModalVisibility: H,
|
|
5319
|
+
readAndParseInput: z,
|
|
5320
|
+
onCloseModal: V,
|
|
5321
5321
|
validationRules: u,
|
|
5322
|
-
onCompleteImport:
|
|
5322
|
+
onCompleteImport: C,
|
|
5323
5323
|
prevalidationConfig: l,
|
|
5324
|
-
t:
|
|
5325
|
-
loading:
|
|
5326
|
-
startTransition:
|
|
5324
|
+
t: P,
|
|
5325
|
+
loading: I,
|
|
5326
|
+
startTransition: L,
|
|
5327
5327
|
testId: n
|
|
5328
5328
|
}),
|
|
5329
|
-
|
|
5330
|
-
visible:
|
|
5331
|
-
setModalVisibility:
|
|
5329
|
+
O && /* @__PURE__ */ jsx(HelpModal, {
|
|
5330
|
+
visible: O,
|
|
5331
|
+
setModalVisibility: H,
|
|
5332
5332
|
validationRules: u,
|
|
5333
|
-
t:
|
|
5333
|
+
t: P
|
|
5334
5334
|
}),
|
|
5335
|
-
|
|
5336
|
-
visible:
|
|
5337
|
-
prompt:
|
|
5338
|
-
onUpload:
|
|
5339
|
-
onCloseModal: () =>
|
|
5340
|
-
onComplete:
|
|
5341
|
-
onError:
|
|
5342
|
-
heading:
|
|
5343
|
-
dialogText:
|
|
5344
|
-
fileInputText:
|
|
5345
|
-
fileInputPlaceholder:
|
|
5346
|
-
uploadText:
|
|
5347
|
-
cancelText:
|
|
5335
|
+
k && t && /* @__PURE__ */ jsx(SmartUploadModal, {
|
|
5336
|
+
visible: E,
|
|
5337
|
+
prompt: A,
|
|
5338
|
+
onUpload: N,
|
|
5339
|
+
onCloseModal: () => V({ callback: j }),
|
|
5340
|
+
onComplete: K,
|
|
5341
|
+
onError: M,
|
|
5342
|
+
heading: P("smartUpload_smartUpload"),
|
|
5343
|
+
dialogText: P("smartUpload_description"),
|
|
5344
|
+
fileInputText: P("chooseFile"),
|
|
5345
|
+
fileInputPlaceholder: P("noFileSelected"),
|
|
5346
|
+
uploadText: P("uploadCapitalized"),
|
|
5347
|
+
cancelText: P("cancel"),
|
|
5348
5348
|
testId: n
|
|
5349
5349
|
}),
|
|
5350
5350
|
/* @__PURE__ */ jsx(ModalsRenderer, {
|
|
5351
|
-
modals:
|
|
5352
|
-
modalVisibility:
|
|
5353
|
-
onCloseModal:
|
|
5351
|
+
modals: x,
|
|
5352
|
+
modalVisibility: w == null ? void 0 : w.modalVisibility,
|
|
5353
|
+
onCloseModal: V,
|
|
5354
5354
|
testId: n
|
|
5355
5355
|
})
|
|
5356
5356
|
] });
|
|
@@ -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