@oliasoft-open-source/react-ui-library 5.17.0-beta-10 → 5.17.0-beta-12
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
|
@@ -1556,6 +1556,7 @@ export declare interface ITableImportExportConfig {
|
|
|
1556
1556
|
copyFromClipBoard?: boolean;
|
|
1557
1557
|
showDeleteOptions?: boolean;
|
|
1558
1558
|
showHelpOption?: boolean;
|
|
1559
|
+
showUploadFileOption?: boolean;
|
|
1559
1560
|
onDeleteRows?: (type: 'all') => void;
|
|
1560
1561
|
onImportComplete?: (data: IImportData) => void;
|
|
1561
1562
|
}
|
package/dist/index.js
CHANGED
|
@@ -5202,158 +5202,158 @@ var initialState = {
|
|
|
5202
5202
|
};
|
|
5203
5203
|
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n }) => {
|
|
5204
5204
|
var r, i, a, o;
|
|
5205
|
-
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,
|
|
5205
|
+
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({
|
|
5206
5206
|
config: e,
|
|
5207
|
-
state:
|
|
5208
|
-
setState:
|
|
5207
|
+
state: w,
|
|
5208
|
+
setState: T,
|
|
5209
5209
|
smartUploadConfig: t,
|
|
5210
|
-
startTransition:
|
|
5211
|
-
}), { readAndParseInput:
|
|
5212
|
-
useKeyboardEvent("Escape", () =>
|
|
5213
|
-
let
|
|
5214
|
-
{
|
|
5210
|
+
startTransition: L
|
|
5211
|
+
}), { readAndParseInput: z, updateState: B, closeModals: V, setModalVisibility: H, onFileChange: U, onClickQuickPasteFromClipBoard: W, onClickCopyClipboard: G, onSmartUploadResult: K, deleteAllRows: q } = R == null ? {} : R;
|
|
5212
|
+
useKeyboardEvent("Escape", () => V());
|
|
5213
|
+
let J = g ? [
|
|
5214
|
+
...b ? [{
|
|
5215
5215
|
type: "Option",
|
|
5216
|
-
label:
|
|
5216
|
+
label: P("uploadFile"),
|
|
5217
5217
|
upload: !0,
|
|
5218
5218
|
uploadType: ".csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
5219
|
-
onChange:
|
|
5219
|
+
onChange: U,
|
|
5220
5220
|
testId: `${n}-option-upload-file`
|
|
5221
|
-
},
|
|
5221
|
+
}] : [],
|
|
5222
5222
|
..._ ? [{
|
|
5223
5223
|
type: "Option",
|
|
5224
|
-
label:
|
|
5225
|
-
onClick:
|
|
5224
|
+
label: P("quickPasteFromClipboard"),
|
|
5225
|
+
onClick: W,
|
|
5226
5226
|
testId: `${n}-option-quick-paste-from-clipboard`
|
|
5227
5227
|
}] : [],
|
|
5228
5228
|
..._ ? [{
|
|
5229
5229
|
type: "Option",
|
|
5230
|
-
label:
|
|
5231
|
-
onClick: () =>
|
|
5230
|
+
label: P("pasteWithReview"),
|
|
5231
|
+
onClick: () => H("reviewPasteModal", !D),
|
|
5232
5232
|
testId: `${n}-paste-with-review`
|
|
5233
5233
|
}] : [],
|
|
5234
|
-
...
|
|
5234
|
+
...A && k && t ? [{
|
|
5235
5235
|
type: "Option",
|
|
5236
|
-
label:
|
|
5237
|
-
onClick: () =>
|
|
5236
|
+
label: P("smartUpload_smartUpload"),
|
|
5237
|
+
onClick: () => H("smartUploadModal", !E),
|
|
5238
5238
|
testId: `${n}-smart-upload`
|
|
5239
5239
|
}] : [],
|
|
5240
|
-
...applyModalHandlers((r =
|
|
5241
|
-
] : [],
|
|
5240
|
+
...applyModalHandlers((r = S == null ? void 0 : S.importOptions) == null ? [] : r, w, H)
|
|
5241
|
+
] : [], Y = [
|
|
5242
5242
|
{
|
|
5243
5243
|
type: "Option",
|
|
5244
|
-
label:
|
|
5244
|
+
label: P("downloadFile"),
|
|
5245
5245
|
onClick: async () => {
|
|
5246
|
-
let e = await
|
|
5246
|
+
let e = await F();
|
|
5247
5247
|
e && e && onClickDownLoad(e, d);
|
|
5248
5248
|
}
|
|
5249
5249
|
},
|
|
5250
5250
|
...p ? [{
|
|
5251
5251
|
type: "Option",
|
|
5252
|
-
label:
|
|
5253
|
-
onClick: () =>
|
|
5252
|
+
label: P("copyToClipboard"),
|
|
5253
|
+
onClick: () => G("dot")
|
|
5254
5254
|
}] : [{
|
|
5255
5255
|
type: "Menu",
|
|
5256
5256
|
testId: `${n}-menu-copy-to-clipboard`,
|
|
5257
5257
|
menu: {
|
|
5258
5258
|
trigger: "Text",
|
|
5259
|
-
label:
|
|
5259
|
+
label: P("copyToClipboard"),
|
|
5260
5260
|
sections: [{
|
|
5261
5261
|
type: "Option",
|
|
5262
|
-
label:
|
|
5263
|
-
onClick: () =>
|
|
5262
|
+
label: P("copyDecimalDot"),
|
|
5263
|
+
onClick: () => G("dot"),
|
|
5264
5264
|
testId: `${n}-option-copy-decimal-dot`
|
|
5265
5265
|
}, {
|
|
5266
5266
|
type: "Option",
|
|
5267
|
-
label:
|
|
5268
|
-
onClick: () =>
|
|
5267
|
+
label: P("copyDecimalComma"),
|
|
5268
|
+
onClick: () => G("comma")
|
|
5269
5269
|
}]
|
|
5270
5270
|
}
|
|
5271
5271
|
}],
|
|
5272
|
-
...applyModalHandlers((i =
|
|
5273
|
-
],
|
|
5272
|
+
...applyModalHandlers((i = S == null ? void 0 : S.exportOptions) == null ? [] : i, w, H)
|
|
5273
|
+
], X = v ? [{
|
|
5274
5274
|
type: "Option",
|
|
5275
|
-
label:
|
|
5276
|
-
onClick: () =>
|
|
5275
|
+
label: P("deleteAllRows"),
|
|
5276
|
+
onClick: () => q(),
|
|
5277
5277
|
testId: `${n}-delete-all-rows`
|
|
5278
|
-
}, ...applyModalHandlers((a =
|
|
5278
|
+
}, ...applyModalHandlers((a = S == null ? void 0 : S.deleteOptions) == null ? [] : a, w, H)] : [], ee = y ? [
|
|
5279
5279
|
{ type: "Divider" },
|
|
5280
5280
|
{
|
|
5281
5281
|
type: "Option",
|
|
5282
|
-
label:
|
|
5283
|
-
onClick: () =>
|
|
5282
|
+
label: P("help"),
|
|
5283
|
+
onClick: () => H("helpModal", !O)
|
|
5284
5284
|
},
|
|
5285
|
-
...applyModalHandlers((o =
|
|
5286
|
-
] : [],
|
|
5287
|
-
...
|
|
5288
|
-
section: [...
|
|
5285
|
+
...applyModalHandlers((o = S == null ? void 0 : S.helpOptions) == null ? [] : o, w, H)
|
|
5286
|
+
] : [], Z = [
|
|
5287
|
+
...J.length ? [{
|
|
5288
|
+
section: [...J, ...ee],
|
|
5289
5289
|
name: "import-options",
|
|
5290
5290
|
iconName: "import",
|
|
5291
|
-
tooltip:
|
|
5291
|
+
tooltip: P("import")
|
|
5292
5292
|
}] : [],
|
|
5293
|
-
...
|
|
5294
|
-
section:
|
|
5293
|
+
...Y.length ? [{
|
|
5294
|
+
section: Y,
|
|
5295
5295
|
name: "export-options",
|
|
5296
5296
|
iconName: "export",
|
|
5297
|
-
tooltip:
|
|
5297
|
+
tooltip: P("export")
|
|
5298
5298
|
}] : [],
|
|
5299
|
-
...
|
|
5300
|
-
section:
|
|
5299
|
+
...X.length ? [{
|
|
5300
|
+
section: X,
|
|
5301
5301
|
name: "delete-options",
|
|
5302
5302
|
iconName: "delete",
|
|
5303
|
-
tooltip:
|
|
5303
|
+
tooltip: P("deleteAllRows")
|
|
5304
5304
|
}] : []
|
|
5305
5305
|
];
|
|
5306
5306
|
return /* @__PURE__ */ jsxs("span", { children: [
|
|
5307
|
-
|
|
5307
|
+
I && /* @__PURE__ */ jsx(Spinner, {
|
|
5308
5308
|
small: !0,
|
|
5309
5309
|
dark: !0
|
|
5310
5310
|
}),
|
|
5311
|
-
|
|
5311
|
+
Z.map((e, t) => /* @__PURE__ */ jsx(MenuComponent, {
|
|
5312
5312
|
sections: e.section,
|
|
5313
5313
|
iconName: e.iconName,
|
|
5314
5314
|
tooltip: e.tooltip,
|
|
5315
5315
|
testId: `data-${e == null ? void 0 : e.name}-menu`
|
|
5316
5316
|
}, t)),
|
|
5317
|
-
|
|
5317
|
+
D && /* @__PURE__ */ jsx(PasteWithReviewModal, {
|
|
5318
5318
|
config: e,
|
|
5319
|
-
state:
|
|
5320
|
-
updateState:
|
|
5321
|
-
setModalVisibility:
|
|
5322
|
-
readAndParseInput:
|
|
5323
|
-
onCloseModal:
|
|
5319
|
+
state: w,
|
|
5320
|
+
updateState: B,
|
|
5321
|
+
setModalVisibility: H,
|
|
5322
|
+
readAndParseInput: z,
|
|
5323
|
+
onCloseModal: V,
|
|
5324
5324
|
validationRules: u,
|
|
5325
|
-
onCompleteImport:
|
|
5325
|
+
onCompleteImport: C,
|
|
5326
5326
|
prevalidationConfig: l,
|
|
5327
|
-
t:
|
|
5328
|
-
loading:
|
|
5329
|
-
startTransition:
|
|
5327
|
+
t: P,
|
|
5328
|
+
loading: I,
|
|
5329
|
+
startTransition: L,
|
|
5330
5330
|
testId: n
|
|
5331
5331
|
}),
|
|
5332
|
-
|
|
5333
|
-
visible:
|
|
5334
|
-
setModalVisibility:
|
|
5332
|
+
O && /* @__PURE__ */ jsx(HelpModal, {
|
|
5333
|
+
visible: O,
|
|
5334
|
+
setModalVisibility: H,
|
|
5335
5335
|
validationRules: u,
|
|
5336
|
-
t:
|
|
5336
|
+
t: P
|
|
5337
5337
|
}),
|
|
5338
|
-
|
|
5339
|
-
visible:
|
|
5340
|
-
prompt:
|
|
5341
|
-
onUpload:
|
|
5342
|
-
onCloseModal: () =>
|
|
5343
|
-
onComplete:
|
|
5344
|
-
onError:
|
|
5345
|
-
heading:
|
|
5346
|
-
dialogText:
|
|
5347
|
-
fileInputText:
|
|
5348
|
-
fileInputPlaceholder:
|
|
5349
|
-
uploadText:
|
|
5350
|
-
cancelText:
|
|
5338
|
+
k && t && /* @__PURE__ */ jsx(SmartUploadModal, {
|
|
5339
|
+
visible: E,
|
|
5340
|
+
prompt: A,
|
|
5341
|
+
onUpload: N,
|
|
5342
|
+
onCloseModal: () => V({ callback: j }),
|
|
5343
|
+
onComplete: K,
|
|
5344
|
+
onError: M,
|
|
5345
|
+
heading: P("smartUpload_smartUpload"),
|
|
5346
|
+
dialogText: P("smartUpload_description"),
|
|
5347
|
+
fileInputText: P("chooseFile"),
|
|
5348
|
+
fileInputPlaceholder: P("noFileSelected"),
|
|
5349
|
+
uploadText: P("uploadCapitalized"),
|
|
5350
|
+
cancelText: P("cancel"),
|
|
5351
5351
|
testId: n
|
|
5352
5352
|
}),
|
|
5353
5353
|
/* @__PURE__ */ jsx(ModalsRenderer, {
|
|
5354
|
-
modals:
|
|
5355
|
-
modalVisibility:
|
|
5356
|
-
onCloseModal:
|
|
5354
|
+
modals: x,
|
|
5355
|
+
modalVisibility: w == null ? void 0 : w.modalVisibility,
|
|
5356
|
+
onCloseModal: V,
|
|
5357
5357
|
testId: n
|
|
5358
5358
|
})
|
|
5359
5359
|
] });
|
|
@@ -7076,7 +7076,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7076
7076
|
} : {
|
|
7077
7077
|
value: G,
|
|
7078
7078
|
unit: U
|
|
7079
|
-
}), J = k || (K == null ? void 0 : K.value) === void 0, [Y,
|
|
7079
|
+
}), 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) => {
|
|
7080
7080
|
if (!(e != null && e.value)) return;
|
|
7081
7081
|
if (E) return E === e.valueKey;
|
|
7082
7082
|
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
|
|
@@ -7085,7 +7085,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7085
7085
|
toUnit: t
|
|
7086
7086
|
});
|
|
7087
7087
|
return withUnit(n, t) === e.value;
|
|
7088
|
-
}),
|
|
7088
|
+
}), te = () => {
|
|
7089
7089
|
var e;
|
|
7090
7090
|
let t = (e = l) == null ? "" : e, n = K.unit;
|
|
7091
7091
|
if (!checkConversion({
|
|
@@ -7101,7 +7101,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7101
7101
|
} catch {
|
|
7102
7102
|
return null;
|
|
7103
7103
|
}
|
|
7104
|
-
},
|
|
7104
|
+
}, ne = (t) => {
|
|
7105
7105
|
let n = getStringName(e), r = t.target, { value: i, selectionStart: a } = r, o = withUnit(i, (K == null ? void 0 : K.unit) || "");
|
|
7106
7106
|
h({ target: {
|
|
7107
7107
|
value: A ? withUnit(convertAndGetValue(o, B), B) : o,
|
|
@@ -7114,7 +7114,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7114
7114
|
}), R(() => {
|
|
7115
7115
|
r.selectionStart = a, r.selectionEnd = a;
|
|
7116
7116
|
});
|
|
7117
|
-
},
|
|
7117
|
+
}, re = (e, t) => {
|
|
7118
7118
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
7119
7119
|
value: e,
|
|
7120
7120
|
unit: t
|
|
@@ -7145,7 +7145,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7145
7145
|
e !== void 0 && q({
|
|
7146
7146
|
value: e,
|
|
7147
7147
|
unit: t
|
|
7148
|
-
}),
|
|
7148
|
+
}), X(C && Z && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
7149
7149
|
}
|
|
7150
7150
|
}, [
|
|
7151
7151
|
U,
|
|
@@ -7153,7 +7153,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7153
7153
|
i,
|
|
7154
7154
|
T
|
|
7155
7155
|
]);
|
|
7156
|
-
let
|
|
7156
|
+
let Q = te(), $ = label(K.unit) || K.unit || "", ie = p || !Q || Q && Q.length === 1, ae = getStringName(e), oe, se = (t) => {
|
|
7157
7157
|
let r = t != null && t.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
7158
7158
|
if (checkConversion({
|
|
7159
7159
|
value: r,
|
|
@@ -7173,7 +7173,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7173
7173
|
type: MenuType.OPTION,
|
|
7174
7174
|
inline: !0,
|
|
7175
7175
|
onClick: () => {
|
|
7176
|
-
validateNumber(i).valid && !n && (
|
|
7176
|
+
validateNumber(i).valid && !n && (X(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
|
|
7177
7177
|
value: r,
|
|
7178
7178
|
name: typeof e == "string" ? e : (e == null ? void 0 : e.fieldName) || "",
|
|
7179
7179
|
predefinedSelected: !0,
|
|
@@ -7185,10 +7185,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7185
7185
|
height: "0"
|
|
7186
7186
|
})] }),
|
|
7187
7187
|
description: o,
|
|
7188
|
-
selected:
|
|
7188
|
+
selected: Z === t && Y === PredefinedOptionsMenuState.PREDEFINED
|
|
7189
7189
|
};
|
|
7190
7190
|
};
|
|
7191
|
-
if (
|
|
7191
|
+
if (oe = [{
|
|
7192
7192
|
type: MenuType.OPTION,
|
|
7193
7193
|
inline: !0,
|
|
7194
7194
|
onClick: () => {
|
|
@@ -7201,7 +7201,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7201
7201
|
selected: Y === PredefinedOptionsMenuState.CUSTOM
|
|
7202
7202
|
}], C != null && C.length) {
|
|
7203
7203
|
let e = C.map(se);
|
|
7204
|
-
|
|
7204
|
+
oe = [...oe, ...e];
|
|
7205
7205
|
}
|
|
7206
7206
|
let ce = (e) => {
|
|
7207
7207
|
if (isValueWithUnit(e)) {
|
|
@@ -7237,39 +7237,39 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7237
7237
|
small: o
|
|
7238
7238
|
}),
|
|
7239
7239
|
small: o,
|
|
7240
|
-
sections:
|
|
7240
|
+
sections: oe
|
|
7241
7241
|
},
|
|
7242
|
-
tooltip: Y === PredefinedOptionsMenuState.PREDEFINED ?
|
|
7242
|
+
tooltip: Y === PredefinedOptionsMenuState.PREDEFINED ? Z == null ? void 0 : Z.label : ""
|
|
7243
7243
|
}),
|
|
7244
7244
|
/* @__PURE__ */ jsx("div", {
|
|
7245
7245
|
className: unit_input_module_default.inputWrapper,
|
|
7246
7246
|
children: /* @__PURE__ */ jsx(NumberInput, {
|
|
7247
|
-
name:
|
|
7247
|
+
name: ae,
|
|
7248
7248
|
testId: x,
|
|
7249
7249
|
disabled: n,
|
|
7250
7250
|
placeholder: ce(t),
|
|
7251
7251
|
value: K.value,
|
|
7252
|
-
onChange:
|
|
7252
|
+
onChange: ne,
|
|
7253
7253
|
onFocus: v,
|
|
7254
7254
|
error: i === null ? void 0 : i,
|
|
7255
7255
|
warning: S === null ? void 0 : S,
|
|
7256
7256
|
left: a,
|
|
7257
7257
|
allowEmpty: J,
|
|
7258
|
-
validationCallback: (e, t) => D(
|
|
7258
|
+
validationCallback: (e, t) => D(ae, t),
|
|
7259
7259
|
enableCosmeticRounding: j,
|
|
7260
7260
|
enableDisplayRounding: M,
|
|
7261
7261
|
roundDisplayValue: N,
|
|
7262
7262
|
groupOrder: le,
|
|
7263
|
-
disableInternalErrorValidationMessages:
|
|
7263
|
+
disableInternalErrorValidationMessages: ee,
|
|
7264
7264
|
small: o,
|
|
7265
7265
|
selectOnFocus: P,
|
|
7266
7266
|
tooltip: I
|
|
7267
|
-
},
|
|
7267
|
+
}, ae)
|
|
7268
7268
|
}),
|
|
7269
|
-
|
|
7269
|
+
$ && (ie || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
7270
7270
|
groupOrder: ue,
|
|
7271
7271
|
small: o,
|
|
7272
|
-
children:
|
|
7272
|
+
children: $
|
|
7273
7273
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
7274
7274
|
groupOrder: ue,
|
|
7275
7275
|
maxHeight: 380,
|
|
@@ -7277,20 +7277,20 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7277
7277
|
testId: x && `${x}-menu`,
|
|
7278
7278
|
tabIndex: -1,
|
|
7279
7279
|
menu: {
|
|
7280
|
-
label:
|
|
7280
|
+
label: $,
|
|
7281
7281
|
trigger: "DropDownButton",
|
|
7282
7282
|
small: o,
|
|
7283
|
-
sections:
|
|
7283
|
+
sections: Q.map(([e = "", t = "", n]) => {
|
|
7284
7284
|
let r = n || t || "", i = isValidNum(e) ? e : "";
|
|
7285
7285
|
return {
|
|
7286
7286
|
type: "Option",
|
|
7287
7287
|
label: j ? safeRoundNumbers(i) : i,
|
|
7288
7288
|
inline: !0,
|
|
7289
7289
|
onClick: (n) => {
|
|
7290
|
-
n.stopPropagation(),
|
|
7290
|
+
n.stopPropagation(), re(e, t);
|
|
7291
7291
|
},
|
|
7292
7292
|
description: r,
|
|
7293
|
-
selected: r ===
|
|
7293
|
+
selected: r === $,
|
|
7294
7294
|
testId: `${x}-unit-${r}`
|
|
7295
7295
|
};
|
|
7296
7296
|
})
|
package/package.json
CHANGED