@oliasoft-open-source/react-ui-library 4.15.3 → 4.15.4-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 CHANGED
@@ -502,6 +502,7 @@ declare interface IInputCell extends TCommonCell {
502
502
  warning?: string;
503
503
  disabled?: boolean;
504
504
  maxTooltipWidth?: TStringOrNumber;
505
+ selectOnFocus?: boolean;
505
506
  tooltip?: StringNumberOrNode;
506
507
  }
507
508
 
@@ -528,6 +529,7 @@ export declare interface IInputProps {
528
529
  onFocus?: (evt: FocusEvent_2<HTMLInputElement>) => void;
529
530
  onBlur?: (evt: FocusEvent_2<HTMLInputElement>) => void;
530
531
  onPaste?: default_2.ClipboardEventHandler<HTMLInputElement>;
532
+ selectOnFocus?: boolean;
531
533
  small?: boolean;
532
534
  placeholder?: string | null;
533
535
  tabIndex?: number;
@@ -907,6 +909,7 @@ declare interface INumberInputCell extends TCommonCell {
907
909
  enableCosmeticRounding: boolean;
908
910
  enableDisplayRounding: boolean;
909
911
  roundDisplayValue: (value: TStringOrNumber) => TStringOrNumber;
912
+ selectOnFocus?: boolean;
910
913
  }
911
914
 
912
915
  export declare interface INumberInputProps {
@@ -923,6 +926,7 @@ export declare interface INumberInputProps {
923
926
  onChange?: TChangeEventHandler;
924
927
  onFocus?: (evt: FocusEvent_2<HTMLInputElement>) => void;
925
928
  onBlur?: (evt: FocusEvent_2<HTMLInputElement>) => void;
929
+ selectOnFocus?: boolean;
926
930
  tabIndex?: number;
927
931
  testId?: string;
928
932
  tooltip?: TStringOrNumber | default_2.ReactNode;
@@ -1669,7 +1673,7 @@ export declare const Modal: ({ children, visible, centered, width, onEnter, onEs
1669
1673
 
1670
1674
  export declare const NativeSelect: ({ disabled, error, warning, tooltip, options, onChange, onFocus, onBlur, right, small, tabIndex, selectedOption, width, groupOrder, testId, isInTable, clearable, placeholder, hasNonExistentValue, maxTooltipWidth, borderRadius, }: INativeSelectProps) => JSX_2.Element;
1671
1675
 
1672
- export declare const NumberInput: ({ name, placeholder, disabled, error, left, small, width, value, onChange, onFocus, onBlur, tabIndex, testId, tooltip, warning, validationCallback, allowEmpty, isInTable, groupOrder, enableCosmeticRounding, enableDisplayRounding, roundDisplayValue, disableInternalErrorValidationMessages, }: INumberInputProps) => JSX_2.Element;
1676
+ export declare const NumberInput: ({ name, placeholder, disabled, error, left, small, width, value, onChange, onFocus, onBlur, selectOnFocus, tabIndex, testId, tooltip, warning, validationCallback, allowEmpty, isInTable, groupOrder, enableCosmeticRounding, enableDisplayRounding, roundDisplayValue, disableInternalErrorValidationMessages, }: INumberInputProps) => JSX_2.Element;
1673
1677
 
1674
1678
  export declare const OptionDropdown: ({ name, label, options, onChange, small, showHeader, maxHeight, }: IOptionDropdownProps) => ReactElement;
1675
1679
 
package/dist/index.js CHANGED
@@ -9082,6 +9082,7 @@ const Input$1 = forwardRef(
9082
9082
  },
9083
9083
  onPaste = () => {
9084
9084
  },
9085
+ selectOnFocus = false,
9085
9086
  name: name2 = void 0,
9086
9087
  type = "text",
9087
9088
  tabIndex = 0,
@@ -9110,6 +9111,12 @@ const Input$1 = forwardRef(
9110
9111
  return "";
9111
9112
  })();
9112
9113
  const width2 = propWidth || (size2 ? "auto" : "100%");
9114
+ const handleFocus = (e2) => {
9115
+ onFocus(e2);
9116
+ if (selectOnFocus) {
9117
+ e2.target.select();
9118
+ }
9119
+ };
9113
9120
  return /* @__PURE__ */ jsx("div", { style: { width: width2 }, className: order2, children: /* @__PURE__ */ jsx(
9114
9121
  Tooltip,
9115
9122
  {
@@ -9130,7 +9137,7 @@ const Input$1 = forwardRef(
9130
9137
  value: value ?? "",
9131
9138
  onChange,
9132
9139
  onKeyPress,
9133
- onFocus,
9140
+ onFocus: handleFocus,
9134
9141
  onBlur,
9135
9142
  onPaste,
9136
9143
  name: name2,
@@ -55635,6 +55642,7 @@ const InputCell = ({
55635
55642
  isInTable: true,
55636
55643
  maxTooltipWidth: cell2.maxTooltipWidth,
55637
55644
  right: columnAlignment === Align.RIGHT,
55645
+ selectOnFocus: cell2.selectOnFocus,
55638
55646
  testId,
55639
55647
  tabIndex: cell2.disabled ? -1 : 0,
55640
55648
  tooltip: cell2.tooltip,
@@ -55674,6 +55682,7 @@ const NumberInput = ({
55674
55682
  },
55675
55683
  onBlur = () => {
55676
55684
  },
55685
+ selectOnFocus = false,
55677
55686
  tabIndex = 0,
55678
55687
  testId,
55679
55688
  tooltip: tooltip2 = null,
@@ -55756,6 +55765,7 @@ const NumberInput = ({
55756
55765
  }
55757
55766
  };
55758
55767
  useEffect(() => {
55768
+ if (selectOnFocus) return;
55759
55769
  if (inputRef && (inputRef == null ? void 0 : inputRef.current) && enableDisplayRounding && focus2) {
55760
55770
  const textInput = inputRef.current;
55761
55771
  if (textInput) {
@@ -55801,6 +55811,7 @@ const NumberInput = ({
55801
55811
  width: width2,
55802
55812
  isInTable: isInTable2,
55803
55813
  groupOrder,
55814
+ selectOnFocus,
55804
55815
  tabIndex,
55805
55816
  tooltip: tooltip2,
55806
55817
  ref: inputRef
@@ -55832,6 +55843,7 @@ const NumberInputCell = ({
55832
55843
  disabled: cell2.disabled,
55833
55844
  isInTable: true,
55834
55845
  left: cell2.left ?? columnAlignment === Align.LEFT,
55846
+ selectOnFocus: cell2.selectOnFocus,
55835
55847
  tabIndex: cell2.disabled ? -1 : 0,
55836
55848
  testId,
55837
55849
  tooltip: cell2.tooltip,
@@ -70698,6 +70710,7 @@ const convertVisibleRows = ({
70698
70710
  enableCosmeticRounding,
70699
70711
  enableDisplayRounding,
70700
70712
  roundDisplayValue,
70713
+ selectOnFocus: true,
70701
70714
  onChange: (evt) => {
70702
70715
  const { value: value2 } = evt.target;
70703
70716
  const storageUnit2 = storageUnits[unitKey];