@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 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, modals: b = [], dynamicOptions: x, onImportComplete: S } = e == null ? {} : e, [C, w] = useState(initialState), { modalVisibility: { smartUploadModal: T = !1, reviewPasteModal: E = !1, helpModal: D = !1 } } = C, { enabled: O, prompt: k = "", onClose: A, onError: j, service: M = () => Promise.resolve() } = t == null ? {} : t, N = useTranslationMap(f), P = useExportData(N, s, c), [F, I] = useTransition(), L = useDataImportActions({
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: C,
5155
- setState: w,
5154
+ state: w,
5155
+ setState: T,
5156
5156
  smartUploadConfig: t,
5157
- startTransition: I
5158
- }), { readAndParseInput: R, updateState: z, closeModals: B, setModalVisibility: V, onFileChange: H, onClickQuickPasteFromClipBoard: U, onClickCopyClipboard: W, onSmartUploadResult: G, deleteAllRows: K } = L == null ? {} : L;
5159
- useKeyboardEvent("Escape", () => B());
5160
- let q = g ? [
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: N("uploadFile"),
5163
+ label: P("uploadFile"),
5164
5164
  upload: !0,
5165
5165
  uploadType: ".csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
5166
- onChange: H,
5166
+ onChange: U,
5167
5167
  testId: `${n}-option-upload-file`
5168
- },
5168
+ }] : [],
5169
5169
  ..._ ? [{
5170
5170
  type: "Option",
5171
- label: N("quickPasteFromClipboard"),
5172
- onClick: U,
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: N("pasteWithReview"),
5178
- onClick: () => V("reviewPasteModal", !E),
5177
+ label: P("pasteWithReview"),
5178
+ onClick: () => H("reviewPasteModal", !D),
5179
5179
  testId: `${n}-paste-with-review`
5180
5180
  }] : [],
5181
- ...k && O && t ? [{
5181
+ ...A && k && t ? [{
5182
5182
  type: "Option",
5183
- label: N("smartUpload_smartUpload"),
5184
- onClick: () => V("smartUploadModal", !T),
5183
+ label: P("smartUpload_smartUpload"),
5184
+ onClick: () => H("smartUploadModal", !E),
5185
5185
  testId: `${n}-smart-upload`
5186
5186
  }] : [],
5187
- ...applyModalHandlers((r = x == null ? void 0 : x.importOptions) == null ? [] : r, C, V)
5188
- ] : [], J = [
5187
+ ...applyModalHandlers((r = S == null ? void 0 : S.importOptions) == null ? [] : r, w, H)
5188
+ ] : [], Y = [
5189
5189
  {
5190
5190
  type: "Option",
5191
- label: N("downloadFile"),
5191
+ label: P("downloadFile"),
5192
5192
  onClick: async () => {
5193
- let e = await P();
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: N("copyToClipboard"),
5200
- onClick: () => W("dot")
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: N("copyToClipboard"),
5206
+ label: P("copyToClipboard"),
5207
5207
  sections: [{
5208
5208
  type: "Option",
5209
- label: N("copyDecimalDot"),
5210
- onClick: () => W("dot"),
5209
+ label: P("copyDecimalDot"),
5210
+ onClick: () => G("dot"),
5211
5211
  testId: `${n}-option-copy-decimal-dot`
5212
5212
  }, {
5213
5213
  type: "Option",
5214
- label: N("copyDecimalComma"),
5215
- onClick: () => W("comma")
5214
+ label: P("copyDecimalComma"),
5215
+ onClick: () => G("comma")
5216
5216
  }]
5217
5217
  }
5218
5218
  }],
5219
- ...applyModalHandlers((i = x == null ? void 0 : x.exportOptions) == null ? [] : i, C, V)
5220
- ], Y = v ? [{
5219
+ ...applyModalHandlers((i = S == null ? void 0 : S.exportOptions) == null ? [] : i, w, H)
5220
+ ], X = v ? [{
5221
5221
  type: "Option",
5222
- label: N("deleteAllRows"),
5223
- onClick: () => K(),
5222
+ label: P("deleteAllRows"),
5223
+ onClick: () => q(),
5224
5224
  testId: `${n}-delete-all-rows`
5225
- }, ...applyModalHandlers((a = x == null ? void 0 : x.deleteOptions) == null ? [] : a, C, V)] : [], ee = y ? [
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: N("help"),
5230
- onClick: () => V("helpModal", !D)
5229
+ label: P("help"),
5230
+ onClick: () => H("helpModal", !O)
5231
5231
  },
5232
- ...applyModalHandlers((o = x == null ? void 0 : x.helpOptions) == null ? [] : o, C, V)
5233
- ] : [], te = [
5234
- ...q.length ? [{
5235
- section: [...q, ...ee],
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: N("import")
5238
+ tooltip: P("import")
5239
5239
  }] : [],
5240
- ...J.length ? [{
5241
- section: J,
5240
+ ...Y.length ? [{
5241
+ section: Y,
5242
5242
  name: "export-options",
5243
5243
  iconName: "export",
5244
- tooltip: N("export")
5244
+ tooltip: P("export")
5245
5245
  }] : [],
5246
- ...Y.length ? [{
5247
- section: Y,
5246
+ ...X.length ? [{
5247
+ section: X,
5248
5248
  name: "delete-options",
5249
5249
  iconName: "delete",
5250
- tooltip: N("deleteAllRows")
5250
+ tooltip: P("deleteAllRows")
5251
5251
  }] : []
5252
5252
  ];
5253
5253
  return /* @__PURE__ */ jsxs("span", { children: [
5254
- F && /* @__PURE__ */ jsx(Spinner, {
5254
+ I && /* @__PURE__ */ jsx(Spinner, {
5255
5255
  small: !0,
5256
5256
  dark: !0
5257
5257
  }),
5258
- te.map((e, t) => /* @__PURE__ */ jsx(MenuComponent, {
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
- E && /* @__PURE__ */ jsx(PasteWithReviewModal, {
5264
+ D && /* @__PURE__ */ jsx(PasteWithReviewModal, {
5265
5265
  config: e,
5266
- state: C,
5267
- updateState: z,
5268
- setModalVisibility: V,
5269
- readAndParseInput: R,
5270
- onCloseModal: B,
5266
+ state: w,
5267
+ updateState: B,
5268
+ setModalVisibility: H,
5269
+ readAndParseInput: z,
5270
+ onCloseModal: V,
5271
5271
  validationRules: u,
5272
- onCompleteImport: S,
5272
+ onCompleteImport: C,
5273
5273
  prevalidationConfig: l,
5274
- t: N,
5275
- loading: F,
5276
- startTransition: I,
5274
+ t: P,
5275
+ loading: I,
5276
+ startTransition: L,
5277
5277
  testId: n
5278
5278
  }),
5279
- D && /* @__PURE__ */ jsx(HelpModal, {
5280
- visible: D,
5281
- setModalVisibility: V,
5279
+ O && /* @__PURE__ */ jsx(HelpModal, {
5280
+ visible: O,
5281
+ setModalVisibility: H,
5282
5282
  validationRules: u,
5283
- t: N
5283
+ t: P
5284
5284
  }),
5285
- O && t && /* @__PURE__ */ jsx(SmartUploadModal, {
5286
- visible: T,
5287
- prompt: k,
5288
- onUpload: M,
5289
- onCloseModal: () => B({ callback: A }),
5290
- onComplete: G,
5291
- onError: j,
5292
- heading: N("smartUpload_smartUpload"),
5293
- dialogText: N("smartUpload_description"),
5294
- fileInputText: N("chooseFile"),
5295
- fileInputPlaceholder: N("noFileSelected"),
5296
- uploadText: N("uploadCapitalized"),
5297
- cancelText: N("cancel"),
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: b,
5302
- modalVisibility: C == null ? void 0 : C.modalVisibility,
5303
- onCloseModal: B,
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, ee] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), te = !!(O || n), X = C && C.find((e) => {
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
- }), ne = () => {
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
- }, re = (t) => {
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
- }, ie = (e, t) => {
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
- }), ee(C && X && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
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 Z = ne(), Q = label(K.unit) || K.unit || "", ae = p || !Z || Z && Z.length === 1, oe = getStringName(e), $, se = (t) => {
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 && (ee(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
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: X === t && Y === PredefinedOptionsMenuState.PREDEFINED
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
- $ = [...$, ...e];
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 ? X == null ? void 0 : X.label : ""
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: oe,
7181
+ name: ae,
7182
7182
  testId: x,
7183
7183
  disabled: n,
7184
7184
  placeholder: ce(t),
7185
7185
  value: K.value,
7186
- onChange: re,
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(oe, t),
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: te,
7197
+ disableInternalErrorValidationMessages: ee,
7198
7198
  small: o,
7199
7199
  selectOnFocus: P,
7200
7200
  tooltip: I
7201
- }, oe)
7201
+ }, ae)
7202
7202
  }),
7203
- Q && (ae || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
7203
+ $ && (ie || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
7204
7204
  groupOrder: ue,
7205
7205
  small: o,
7206
- children: Q
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: Q,
7214
+ label: $,
7215
7215
  trigger: "DropDownButton",
7216
7216
  small: o,
7217
- sections: Z.map(([e = "", t = "", n]) => {
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(), ie(e, t);
7224
+ n.stopPropagation(), re(e, t);
7225
7225
  },
7226
7226
  description: r,
7227
- selected: r === Q,
7227
+ selected: r === $,
7228
7228
  testId: `${x}-unit-${r}`
7229
7229
  };
7230
7230
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "5.14.0",
3
+ "version": "5.14.1-beta-1",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {