@oliasoft-open-source/react-ui-library 5.14.0 → 5.14.1-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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +102 -102
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1534,6 +1534,7 @@ export declare interface ITableImportExportConfig {
|
|
|
1534
1534
|
copyFromClipBoard?: boolean;
|
|
1535
1535
|
showDeleteOptions?: boolean;
|
|
1536
1536
|
showHelpOption?: boolean;
|
|
1537
|
+
showUploadFileOption?: boolean;
|
|
1537
1538
|
onDeleteRows?: (type: 'all') => void;
|
|
1538
1539
|
onImportComplete?: (data: IImportData) => void;
|
|
1539
1540
|
}
|
package/dist/index.js
CHANGED
|
@@ -5149,158 +5149,158 @@ var initialState = {
|
|
|
5149
5149
|
};
|
|
5150
5150
|
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n }) => {
|
|
5151
5151
|
var r, i, a, o;
|
|
5152
|
-
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,
|
|
5152
|
+
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({
|
|
5153
5153
|
config: e,
|
|
5154
|
-
state:
|
|
5155
|
-
setState:
|
|
5154
|
+
state: w,
|
|
5155
|
+
setState: T,
|
|
5156
5156
|
smartUploadConfig: t,
|
|
5157
|
-
startTransition:
|
|
5158
|
-
}), { readAndParseInput:
|
|
5159
|
-
useKeyboardEvent("Escape", () =>
|
|
5160
|
-
let
|
|
5161
|
-
{
|
|
5157
|
+
startTransition: L
|
|
5158
|
+
}), { readAndParseInput: z, updateState: B, closeModals: V, setModalVisibility: H, onFileChange: U, onClickQuickPasteFromClipBoard: W, onClickCopyClipboard: G, onSmartUploadResult: K, deleteAllRows: q } = R == null ? {} : R;
|
|
5159
|
+
useKeyboardEvent("Escape", () => V());
|
|
5160
|
+
let J = g ? [
|
|
5161
|
+
...b ? [{
|
|
5162
5162
|
type: "Option",
|
|
5163
|
-
label:
|
|
5163
|
+
label: P("uploadFile"),
|
|
5164
5164
|
upload: !0,
|
|
5165
5165
|
uploadType: ".csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
5166
|
-
onChange:
|
|
5166
|
+
onChange: U,
|
|
5167
5167
|
testId: `${n}-option-upload-file`
|
|
5168
|
-
},
|
|
5168
|
+
}] : [],
|
|
5169
5169
|
..._ ? [{
|
|
5170
5170
|
type: "Option",
|
|
5171
|
-
label:
|
|
5172
|
-
onClick:
|
|
5171
|
+
label: P("quickPasteFromClipboard"),
|
|
5172
|
+
onClick: W,
|
|
5173
5173
|
testId: `${n}-option-quick-paste-from-clipboard`
|
|
5174
5174
|
}] : [],
|
|
5175
5175
|
..._ ? [{
|
|
5176
5176
|
type: "Option",
|
|
5177
|
-
label:
|
|
5178
|
-
onClick: () =>
|
|
5177
|
+
label: P("pasteWithReview"),
|
|
5178
|
+
onClick: () => H("reviewPasteModal", !D),
|
|
5179
5179
|
testId: `${n}-paste-with-review`
|
|
5180
5180
|
}] : [],
|
|
5181
|
-
...
|
|
5181
|
+
...A && k && t ? [{
|
|
5182
5182
|
type: "Option",
|
|
5183
|
-
label:
|
|
5184
|
-
onClick: () =>
|
|
5183
|
+
label: P("smartUpload_smartUpload"),
|
|
5184
|
+
onClick: () => H("smartUploadModal", !E),
|
|
5185
5185
|
testId: `${n}-smart-upload`
|
|
5186
5186
|
}] : [],
|
|
5187
|
-
...applyModalHandlers((r =
|
|
5188
|
-
] : [],
|
|
5187
|
+
...applyModalHandlers((r = S == null ? void 0 : S.importOptions) == null ? [] : r, w, H)
|
|
5188
|
+
] : [], Y = [
|
|
5189
5189
|
{
|
|
5190
5190
|
type: "Option",
|
|
5191
|
-
label:
|
|
5191
|
+
label: P("downloadFile"),
|
|
5192
5192
|
onClick: async () => {
|
|
5193
|
-
let e = await
|
|
5193
|
+
let e = await F();
|
|
5194
5194
|
e && e && onClickDownLoad(e, d);
|
|
5195
5195
|
}
|
|
5196
5196
|
},
|
|
5197
5197
|
...p ? [{
|
|
5198
5198
|
type: "Option",
|
|
5199
|
-
label:
|
|
5200
|
-
onClick: () =>
|
|
5199
|
+
label: P("copyToClipboard"),
|
|
5200
|
+
onClick: () => G("dot")
|
|
5201
5201
|
}] : [{
|
|
5202
5202
|
type: "Menu",
|
|
5203
5203
|
testId: `${n}-menu-copy-to-clipboard`,
|
|
5204
5204
|
menu: {
|
|
5205
5205
|
trigger: "Text",
|
|
5206
|
-
label:
|
|
5206
|
+
label: P("copyToClipboard"),
|
|
5207
5207
|
sections: [{
|
|
5208
5208
|
type: "Option",
|
|
5209
|
-
label:
|
|
5210
|
-
onClick: () =>
|
|
5209
|
+
label: P("copyDecimalDot"),
|
|
5210
|
+
onClick: () => G("dot"),
|
|
5211
5211
|
testId: `${n}-option-copy-decimal-dot`
|
|
5212
5212
|
}, {
|
|
5213
5213
|
type: "Option",
|
|
5214
|
-
label:
|
|
5215
|
-
onClick: () =>
|
|
5214
|
+
label: P("copyDecimalComma"),
|
|
5215
|
+
onClick: () => G("comma")
|
|
5216
5216
|
}]
|
|
5217
5217
|
}
|
|
5218
5218
|
}],
|
|
5219
|
-
...applyModalHandlers((i =
|
|
5220
|
-
],
|
|
5219
|
+
...applyModalHandlers((i = S == null ? void 0 : S.exportOptions) == null ? [] : i, w, H)
|
|
5220
|
+
], X = v ? [{
|
|
5221
5221
|
type: "Option",
|
|
5222
|
-
label:
|
|
5223
|
-
onClick: () =>
|
|
5222
|
+
label: P("deleteAllRows"),
|
|
5223
|
+
onClick: () => q(),
|
|
5224
5224
|
testId: `${n}-delete-all-rows`
|
|
5225
|
-
}, ...applyModalHandlers((a =
|
|
5225
|
+
}, ...applyModalHandlers((a = S == null ? void 0 : S.deleteOptions) == null ? [] : a, w, H)] : [], ee = y ? [
|
|
5226
5226
|
{ type: "Divider" },
|
|
5227
5227
|
{
|
|
5228
5228
|
type: "Option",
|
|
5229
|
-
label:
|
|
5230
|
-
onClick: () =>
|
|
5229
|
+
label: P("help"),
|
|
5230
|
+
onClick: () => H("helpModal", !O)
|
|
5231
5231
|
},
|
|
5232
|
-
...applyModalHandlers((o =
|
|
5233
|
-
] : [],
|
|
5234
|
-
...
|
|
5235
|
-
section: [...
|
|
5232
|
+
...applyModalHandlers((o = S == null ? void 0 : S.helpOptions) == null ? [] : o, w, H)
|
|
5233
|
+
] : [], Z = [
|
|
5234
|
+
...J.length ? [{
|
|
5235
|
+
section: [...J, ...ee],
|
|
5236
5236
|
name: "import-options",
|
|
5237
5237
|
iconName: "import",
|
|
5238
|
-
tooltip:
|
|
5238
|
+
tooltip: P("import")
|
|
5239
5239
|
}] : [],
|
|
5240
|
-
...
|
|
5241
|
-
section:
|
|
5240
|
+
...Y.length ? [{
|
|
5241
|
+
section: Y,
|
|
5242
5242
|
name: "export-options",
|
|
5243
5243
|
iconName: "export",
|
|
5244
|
-
tooltip:
|
|
5244
|
+
tooltip: P("export")
|
|
5245
5245
|
}] : [],
|
|
5246
|
-
...
|
|
5247
|
-
section:
|
|
5246
|
+
...X.length ? [{
|
|
5247
|
+
section: X,
|
|
5248
5248
|
name: "delete-options",
|
|
5249
5249
|
iconName: "delete",
|
|
5250
|
-
tooltip:
|
|
5250
|
+
tooltip: P("deleteAllRows")
|
|
5251
5251
|
}] : []
|
|
5252
5252
|
];
|
|
5253
5253
|
return /* @__PURE__ */ jsxs("span", { children: [
|
|
5254
|
-
|
|
5254
|
+
I && /* @__PURE__ */ jsx(Spinner, {
|
|
5255
5255
|
small: !0,
|
|
5256
5256
|
dark: !0
|
|
5257
5257
|
}),
|
|
5258
|
-
|
|
5258
|
+
Z.map((e, t) => /* @__PURE__ */ jsx(MenuComponent, {
|
|
5259
5259
|
sections: e.section,
|
|
5260
5260
|
iconName: e.iconName,
|
|
5261
5261
|
tooltip: e.tooltip,
|
|
5262
5262
|
testId: `data-${e == null ? void 0 : e.name}-menu`
|
|
5263
5263
|
}, t)),
|
|
5264
|
-
|
|
5264
|
+
D && /* @__PURE__ */ jsx(PasteWithReviewModal, {
|
|
5265
5265
|
config: e,
|
|
5266
|
-
state:
|
|
5267
|
-
updateState:
|
|
5268
|
-
setModalVisibility:
|
|
5269
|
-
readAndParseInput:
|
|
5270
|
-
onCloseModal:
|
|
5266
|
+
state: w,
|
|
5267
|
+
updateState: B,
|
|
5268
|
+
setModalVisibility: H,
|
|
5269
|
+
readAndParseInput: z,
|
|
5270
|
+
onCloseModal: V,
|
|
5271
5271
|
validationRules: u,
|
|
5272
|
-
onCompleteImport:
|
|
5272
|
+
onCompleteImport: C,
|
|
5273
5273
|
prevalidationConfig: l,
|
|
5274
|
-
t:
|
|
5275
|
-
loading:
|
|
5276
|
-
startTransition:
|
|
5274
|
+
t: P,
|
|
5275
|
+
loading: I,
|
|
5276
|
+
startTransition: L,
|
|
5277
5277
|
testId: n
|
|
5278
5278
|
}),
|
|
5279
|
-
|
|
5280
|
-
visible:
|
|
5281
|
-
setModalVisibility:
|
|
5279
|
+
O && /* @__PURE__ */ jsx(HelpModal, {
|
|
5280
|
+
visible: O,
|
|
5281
|
+
setModalVisibility: H,
|
|
5282
5282
|
validationRules: u,
|
|
5283
|
-
t:
|
|
5283
|
+
t: P
|
|
5284
5284
|
}),
|
|
5285
|
-
|
|
5286
|
-
visible:
|
|
5287
|
-
prompt:
|
|
5288
|
-
onUpload:
|
|
5289
|
-
onCloseModal: () =>
|
|
5290
|
-
onComplete:
|
|
5291
|
-
onError:
|
|
5292
|
-
heading:
|
|
5293
|
-
dialogText:
|
|
5294
|
-
fileInputText:
|
|
5295
|
-
fileInputPlaceholder:
|
|
5296
|
-
uploadText:
|
|
5297
|
-
cancelText:
|
|
5285
|
+
k && t && /* @__PURE__ */ jsx(SmartUploadModal, {
|
|
5286
|
+
visible: E,
|
|
5287
|
+
prompt: A,
|
|
5288
|
+
onUpload: N,
|
|
5289
|
+
onCloseModal: () => V({ callback: j }),
|
|
5290
|
+
onComplete: K,
|
|
5291
|
+
onError: M,
|
|
5292
|
+
heading: P("smartUpload_smartUpload"),
|
|
5293
|
+
dialogText: P("smartUpload_description"),
|
|
5294
|
+
fileInputText: P("chooseFile"),
|
|
5295
|
+
fileInputPlaceholder: P("noFileSelected"),
|
|
5296
|
+
uploadText: P("uploadCapitalized"),
|
|
5297
|
+
cancelText: P("cancel"),
|
|
5298
5298
|
testId: n
|
|
5299
5299
|
}),
|
|
5300
5300
|
/* @__PURE__ */ jsx(ModalsRenderer, {
|
|
5301
|
-
modals:
|
|
5302
|
-
modalVisibility:
|
|
5303
|
-
onCloseModal:
|
|
5301
|
+
modals: x,
|
|
5302
|
+
modalVisibility: w == null ? void 0 : w.modalVisibility,
|
|
5303
|
+
onCloseModal: V,
|
|
5304
5304
|
testId: n
|
|
5305
5305
|
})
|
|
5306
5306
|
] });
|
|
@@ -7010,7 +7010,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7010
7010
|
} : {
|
|
7011
7011
|
value: G,
|
|
7012
7012
|
unit: U
|
|
7013
|
-
}), J = k || (K == null ? void 0 : K.value) === void 0, [Y,
|
|
7013
|
+
}), 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) => {
|
|
7014
7014
|
if (!(e != null && e.value)) return;
|
|
7015
7015
|
if (E) return E === e.valueKey;
|
|
7016
7016
|
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
|
|
@@ -7019,7 +7019,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7019
7019
|
toUnit: t
|
|
7020
7020
|
});
|
|
7021
7021
|
return withUnit(n, t) === e.value;
|
|
7022
|
-
}),
|
|
7022
|
+
}), te = () => {
|
|
7023
7023
|
var e;
|
|
7024
7024
|
let t = (e = l) == null ? "" : e, n = K.unit;
|
|
7025
7025
|
if (!checkConversion({
|
|
@@ -7035,7 +7035,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7035
7035
|
} catch {
|
|
7036
7036
|
return null;
|
|
7037
7037
|
}
|
|
7038
|
-
},
|
|
7038
|
+
}, ne = (t) => {
|
|
7039
7039
|
let n = getStringName(e), r = t.target, { value: i, selectionStart: a } = r, o = withUnit(i, (K == null ? void 0 : K.unit) || "");
|
|
7040
7040
|
h({ target: {
|
|
7041
7041
|
value: A ? withUnit(convertAndGetValue(o, B), B) : o,
|
|
@@ -7048,7 +7048,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7048
7048
|
}), R(() => {
|
|
7049
7049
|
r.selectionStart = a, r.selectionEnd = a;
|
|
7050
7050
|
});
|
|
7051
|
-
},
|
|
7051
|
+
}, re = (e, t) => {
|
|
7052
7052
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
7053
7053
|
value: e,
|
|
7054
7054
|
unit: t
|
|
@@ -7079,7 +7079,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7079
7079
|
e !== void 0 && q({
|
|
7080
7080
|
value: e,
|
|
7081
7081
|
unit: t
|
|
7082
|
-
}),
|
|
7082
|
+
}), X(C && Z && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
7083
7083
|
}
|
|
7084
7084
|
}, [
|
|
7085
7085
|
U,
|
|
@@ -7087,7 +7087,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7087
7087
|
i,
|
|
7088
7088
|
T
|
|
7089
7089
|
]);
|
|
7090
|
-
let
|
|
7090
|
+
let Q = te(), $ = label(K.unit) || K.unit || "", ie = p || !Q || Q && Q.length === 1, ae = getStringName(e), oe, se = (t) => {
|
|
7091
7091
|
let r = t != null && t.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
7092
7092
|
if (checkConversion({
|
|
7093
7093
|
value: r,
|
|
@@ -7107,7 +7107,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7107
7107
|
type: MenuType.OPTION,
|
|
7108
7108
|
inline: !0,
|
|
7109
7109
|
onClick: () => {
|
|
7110
|
-
validateNumber(i).valid && !n && (
|
|
7110
|
+
validateNumber(i).valid && !n && (X(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
|
|
7111
7111
|
value: r,
|
|
7112
7112
|
name: typeof e == "string" ? e : (e == null ? void 0 : e.fieldName) || "",
|
|
7113
7113
|
predefinedSelected: !0,
|
|
@@ -7119,10 +7119,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7119
7119
|
height: "0"
|
|
7120
7120
|
})] }),
|
|
7121
7121
|
description: o,
|
|
7122
|
-
selected:
|
|
7122
|
+
selected: Z === t && Y === PredefinedOptionsMenuState.PREDEFINED
|
|
7123
7123
|
};
|
|
7124
7124
|
};
|
|
7125
|
-
if (
|
|
7125
|
+
if (oe = [{
|
|
7126
7126
|
type: MenuType.OPTION,
|
|
7127
7127
|
inline: !0,
|
|
7128
7128
|
onClick: () => {
|
|
@@ -7135,7 +7135,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7135
7135
|
selected: Y === PredefinedOptionsMenuState.CUSTOM
|
|
7136
7136
|
}], C != null && C.length) {
|
|
7137
7137
|
let e = C.map(se);
|
|
7138
|
-
|
|
7138
|
+
oe = [...oe, ...e];
|
|
7139
7139
|
}
|
|
7140
7140
|
let ce = (e) => {
|
|
7141
7141
|
if (isValueWithUnit(e)) {
|
|
@@ -7171,39 +7171,39 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7171
7171
|
small: o
|
|
7172
7172
|
}),
|
|
7173
7173
|
small: o,
|
|
7174
|
-
sections:
|
|
7174
|
+
sections: oe
|
|
7175
7175
|
},
|
|
7176
|
-
tooltip: Y === PredefinedOptionsMenuState.PREDEFINED ?
|
|
7176
|
+
tooltip: Y === PredefinedOptionsMenuState.PREDEFINED ? Z == null ? void 0 : Z.label : ""
|
|
7177
7177
|
}),
|
|
7178
7178
|
/* @__PURE__ */ jsx("div", {
|
|
7179
7179
|
className: unit_input_module_default.inputWrapper,
|
|
7180
7180
|
children: /* @__PURE__ */ jsx(NumberInput, {
|
|
7181
|
-
name:
|
|
7181
|
+
name: ae,
|
|
7182
7182
|
testId: x,
|
|
7183
7183
|
disabled: n,
|
|
7184
7184
|
placeholder: ce(t),
|
|
7185
7185
|
value: K.value,
|
|
7186
|
-
onChange:
|
|
7186
|
+
onChange: ne,
|
|
7187
7187
|
onFocus: v,
|
|
7188
7188
|
error: i === null ? void 0 : i,
|
|
7189
7189
|
warning: S === null ? void 0 : S,
|
|
7190
7190
|
left: a,
|
|
7191
7191
|
allowEmpty: J,
|
|
7192
|
-
validationCallback: (e, t) => D(
|
|
7192
|
+
validationCallback: (e, t) => D(ae, t),
|
|
7193
7193
|
enableCosmeticRounding: j,
|
|
7194
7194
|
enableDisplayRounding: M,
|
|
7195
7195
|
roundDisplayValue: N,
|
|
7196
7196
|
groupOrder: le,
|
|
7197
|
-
disableInternalErrorValidationMessages:
|
|
7197
|
+
disableInternalErrorValidationMessages: ee,
|
|
7198
7198
|
small: o,
|
|
7199
7199
|
selectOnFocus: P,
|
|
7200
7200
|
tooltip: I
|
|
7201
|
-
},
|
|
7201
|
+
}, ae)
|
|
7202
7202
|
}),
|
|
7203
|
-
|
|
7203
|
+
$ && (ie || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
7204
7204
|
groupOrder: ue,
|
|
7205
7205
|
small: o,
|
|
7206
|
-
children:
|
|
7206
|
+
children: $
|
|
7207
7207
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
7208
7208
|
groupOrder: ue,
|
|
7209
7209
|
maxHeight: 380,
|
|
@@ -7211,20 +7211,20 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7211
7211
|
testId: x && `${x}-menu`,
|
|
7212
7212
|
tabIndex: -1,
|
|
7213
7213
|
menu: {
|
|
7214
|
-
label:
|
|
7214
|
+
label: $,
|
|
7215
7215
|
trigger: "DropDownButton",
|
|
7216
7216
|
small: o,
|
|
7217
|
-
sections:
|
|
7217
|
+
sections: Q.map(([e = "", t = "", n]) => {
|
|
7218
7218
|
let r = n || t || "", i = isValidNum(e) ? e : "";
|
|
7219
7219
|
return {
|
|
7220
7220
|
type: "Option",
|
|
7221
7221
|
label: j ? safeRoundNumbers(i) : i,
|
|
7222
7222
|
inline: !0,
|
|
7223
7223
|
onClick: (n) => {
|
|
7224
|
-
n.stopPropagation(),
|
|
7224
|
+
n.stopPropagation(), re(e, t);
|
|
7225
7225
|
},
|
|
7226
7226
|
description: r,
|
|
7227
|
-
selected: r ===
|
|
7227
|
+
selected: r === $,
|
|
7228
7228
|
testId: `${x}-unit-${r}`
|
|
7229
7229
|
};
|
|
7230
7230
|
})
|
package/package.json
CHANGED