react-table-edit 0.5.7 → 0.5.9

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.mts CHANGED
@@ -16,6 +16,33 @@ type IFColumnSelectTable = {
16
16
  maxWidth?: number;
17
17
  minWidth?: number;
18
18
  };
19
+ type Props = {
20
+ id?: string;
21
+ component?: any;
22
+ field?: string;
23
+ fieldValue?: string;
24
+ fieldLabel?: string;
25
+ onChange: any;
26
+ textAlign?: 'left' | 'right' | 'center';
27
+ placeholder?: string;
28
+ invalid?: any;
29
+ loadOptions?: any;
30
+ menuWidth?: number;
31
+ rowData?: any;
32
+ value: any;
33
+ onKeyDown?: any;
34
+ formatOptionLabel?: any;
35
+ handleAdd?: any;
36
+ options: any[];
37
+ isMulti?: boolean;
38
+ maxHeight?: number;
39
+ columns?: IFColumnSelectTable[];
40
+ decimalSeparator?: string;
41
+ thousandSeparator?: string;
42
+ isClearable?: boolean;
43
+ isDisabled?: boolean;
44
+ };
45
+ declare const SelectTable: react.ForwardRefExoticComponent<Props & react.RefAttributes<unknown>>;
19
46
 
20
47
  type ITextAlign = 'center' | 'left' | 'right';
21
48
  type IEditType = 'text' | 'numeric' | 'asyncSelect' | 'datetime' | 'selectMulti' | 'selectTree' | 'date' | 'select' | 'selectTable' | 'checkbox' | 'form' | 'color';
@@ -210,4 +237,4 @@ type IFDataProps = {
210
237
  };
211
238
  declare const TabsMenuComponent: ({ buttonWidth, tabParent, tabChild, resourceCodeParent, resources, resourceCode, windowSize, renderModal }: IFDataProps) => react_jsx_runtime.JSX.Element;
212
239
 
213
- export { type FromItemsField, type IColumnTable, type ICommandItem, type IFColumnSelectTable, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFTableEditButton, type IFTableEditPaging, type IFTableEditProps, type IFTableEditSearchSetting, type IFTableEditToolbar, type IFToolbarOptions, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, TabsMenuComponent, TableEdit as default, formartNumberic, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, objSymbolDecimal, objSymbolThousand, roundNumber, useOnClickOutside };
240
+ export { type FromItemsField, type IColumnTable, type ICommandItem, type IFColumnSelectTable, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFTableEditButton, type IFTableEditPaging, type IFTableEditProps, type IFTableEditSearchSetting, type IFTableEditToolbar, type IFToolbarOptions, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, SelectTable, TabsMenuComponent, TableEdit as default, formartNumberic, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, objSymbolDecimal, objSymbolThousand, roundNumber, useOnClickOutside };
package/dist/index.d.ts CHANGED
@@ -16,6 +16,33 @@ type IFColumnSelectTable = {
16
16
  maxWidth?: number;
17
17
  minWidth?: number;
18
18
  };
19
+ type Props = {
20
+ id?: string;
21
+ component?: any;
22
+ field?: string;
23
+ fieldValue?: string;
24
+ fieldLabel?: string;
25
+ onChange: any;
26
+ textAlign?: 'left' | 'right' | 'center';
27
+ placeholder?: string;
28
+ invalid?: any;
29
+ loadOptions?: any;
30
+ menuWidth?: number;
31
+ rowData?: any;
32
+ value: any;
33
+ onKeyDown?: any;
34
+ formatOptionLabel?: any;
35
+ handleAdd?: any;
36
+ options: any[];
37
+ isMulti?: boolean;
38
+ maxHeight?: number;
39
+ columns?: IFColumnSelectTable[];
40
+ decimalSeparator?: string;
41
+ thousandSeparator?: string;
42
+ isClearable?: boolean;
43
+ isDisabled?: boolean;
44
+ };
45
+ declare const SelectTable: react.ForwardRefExoticComponent<Props & react.RefAttributes<unknown>>;
19
46
 
20
47
  type ITextAlign = 'center' | 'left' | 'right';
21
48
  type IEditType = 'text' | 'numeric' | 'asyncSelect' | 'datetime' | 'selectMulti' | 'selectTree' | 'date' | 'select' | 'selectTable' | 'checkbox' | 'form' | 'color';
@@ -210,4 +237,4 @@ type IFDataProps = {
210
237
  };
211
238
  declare const TabsMenuComponent: ({ buttonWidth, tabParent, tabChild, resourceCodeParent, resources, resourceCode, windowSize, renderModal }: IFDataProps) => react_jsx_runtime.JSX.Element;
212
239
 
213
- export { type FromItemsField, type IColumnTable, type ICommandItem, type IFColumnSelectTable, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFTableEditButton, type IFTableEditPaging, type IFTableEditProps, type IFTableEditSearchSetting, type IFTableEditToolbar, type IFToolbarOptions, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, TabsMenuComponent, TableEdit as default, formartNumberic, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, objSymbolDecimal, objSymbolThousand, roundNumber, useOnClickOutside };
240
+ export { type FromItemsField, type IColumnTable, type ICommandItem, type IFColumnSelectTable, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFTableEditButton, type IFTableEditPaging, type IFTableEditProps, type IFTableEditSearchSetting, type IFTableEditToolbar, type IFToolbarOptions, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, SelectTable, TabsMenuComponent, TableEdit as default, formartNumberic, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, objSymbolDecimal, objSymbolThousand, roundNumber, useOnClickOutside };
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // index.ts
31
31
  var Table_edit_exports = {};
32
32
  __export(Table_edit_exports, {
33
+ SelectTable: () => SelectTable,
33
34
  TabsMenuComponent: () => TabsMenuComponent,
34
35
  default: () => Table_edit_default,
35
36
  formartNumberic: () => formartNumberic,
@@ -1599,6 +1600,8 @@ var SelectTable = (0, import_react13.forwardRef)((props, ref) => {
1599
1600
  handleAdd,
1600
1601
  isClearable,
1601
1602
  component,
1603
+ isDisabled,
1604
+ formatOptionLabel,
1602
1605
  isMulti
1603
1606
  } = props;
1604
1607
  const selectTableRef = (0, import_react13.useRef)();
@@ -1677,7 +1680,9 @@ var SelectTable = (0, import_react13.forwardRef)((props, ref) => {
1677
1680
  if (dropdownOpen) {
1678
1681
  closeMenu();
1679
1682
  } else {
1680
- setDropdownOpen(true);
1683
+ if (!isDisabled) {
1684
+ setDropdownOpen(true);
1685
+ }
1681
1686
  }
1682
1687
  };
1683
1688
  const listKeyUse = ["Escape", "Space", "Enter", "Tab", "NumpadEnter", "ArrowDown", "ArrowUp", "F9"];
@@ -1835,13 +1840,10 @@ var SelectTable = (0, import_react13.forwardRef)((props, ref) => {
1835
1840
  setOptionsLoad(void 0);
1836
1841
  }
1837
1842
  }, [searchTerm]);
1838
- const checkOverflow = (element) => {
1839
- return element && element.scrollWidth > element.clientWidth;
1840
- };
1841
1843
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1842
1844
  "div",
1843
1845
  {
1844
- className: "react-select-table",
1846
+ className: (0, import_classnames11.default)("react-select-table", { "is-invalid": invalid }),
1845
1847
  ref,
1846
1848
  id,
1847
1849
  children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { ref: selectTableRef, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
@@ -1870,7 +1872,7 @@ var SelectTable = (0, import_react13.forwardRef)((props, ref) => {
1870
1872
  ele[fieldLabel ?? "label"]
1871
1873
  ] }, index);
1872
1874
  }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: (0, import_classnames11.default)("select-value", { "d-none": searchTerm }), children: [
1873
- value ? value[fieldLabel ?? "label"] : "",
1875
+ value ? formatOptionLabel ? formatOptionLabel(value) : value[fieldLabel ?? "label"] : "",
1874
1876
  " "
1875
1877
  ] }) }),
1876
1878
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: (0, import_classnames11.default)("select-placeholder", { "d-none": (isMulti ? value?.length > 0 : value) || searchTerm }), children: placeholder }),
@@ -1925,7 +1927,7 @@ var SelectTable = (0, import_react13.forwardRef)((props, ref) => {
1925
1927
  e.preventDefault();
1926
1928
  },
1927
1929
  children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "r-select-grid", children: [
1928
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { style: { width: "100%" }, children: [
1930
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { style: { width: "100%" }, children: [
1929
1931
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { className: "r-select-gridheader", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("tr", { className: "r-select-row", role: "row", children: [
1930
1932
  isMulti && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { className: (0, import_classnames11.default)(`r-select-headercell`), style: { width: 40, top: `0px` }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1931
1933
  "div",
@@ -1960,7 +1962,6 @@ var SelectTable = (0, import_react13.forwardRef)((props, ref) => {
1960
1962
  ] }) }),
1961
1963
  (optionsLoad ? optionsLoad : options).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tbody", { className: "r-select-gridcontent", children: (optionsLoad ? optionsLoad : options)?.map((row, indexRow) => {
1962
1964
  if (loadOptions || checkSearch(searchTerm, row, columns ? columns : defaultColumns)) {
1963
- const refRow = (0, import_react13.useRef)(null);
1964
1965
  const isSelected = isMulti && value?.some((x) => x[fieldValue ?? "value"] === row[fieldValue ?? "value"]);
1965
1966
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1966
1967
  "tr",
@@ -2012,52 +2013,48 @@ var SelectTable = (0, import_react13.forwardRef)((props, ref) => {
2012
2013
  } else if (col.type === "datetime") {
2013
2014
  valueDisplay = valueDisplay ? (0, import_moment.default)(valueDisplay).format("DD/MM/yyyy HH:mm") : "";
2014
2015
  }
2015
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react13.Fragment, { children: [
2016
- col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2017
- "td",
2018
- {
2019
- id: `content-select-${indexRow}-${indexCol}`,
2020
- ref: refRow,
2021
- className: (0, import_classnames11.default)(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
2022
- style: {
2023
- minWidth: col.minWidth,
2024
- width: col.width,
2025
- maxWidth: col.maxWidth,
2026
- textAlign: col.textAlign ? col.textAlign : "left"
2027
- },
2028
- onClick: (e) => {
2029
- if (isMulti) {
2030
- const index = value?.findIndex((x) => x[fieldValue ?? "value"] === row[fieldValue ?? "value"]);
2031
- if (index > -1) {
2032
- value?.splice(index, 1);
2016
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react13.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2017
+ "td",
2018
+ {
2019
+ id: `content-select-${indexRow}-${indexCol}`,
2020
+ className: (0, import_classnames11.default)(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
2021
+ style: {
2022
+ minWidth: col.minWidth,
2023
+ width: col.width,
2024
+ maxWidth: col.maxWidth,
2025
+ textAlign: col.textAlign ? col.textAlign : "left"
2026
+ },
2027
+ onClick: (e) => {
2028
+ if (isMulti) {
2029
+ const index = value?.findIndex((x) => x[fieldValue ?? "value"] === row[fieldValue ?? "value"]);
2030
+ if (index > -1) {
2031
+ value?.splice(index, 1);
2032
+ onChange(value);
2033
+ } else {
2034
+ if (value) {
2035
+ value?.push(row);
2033
2036
  onChange(value);
2034
2037
  } else {
2035
- if (value) {
2036
- value?.push(row);
2037
- onChange(value);
2038
- } else {
2039
- onChange([row]);
2040
- }
2038
+ onChange([row]);
2041
2039
  }
2042
- } else {
2043
- onChange(row);
2044
- closeMenu();
2045
2040
  }
2046
- e.preventDefault();
2047
- e.stopPropagation();
2048
- },
2049
- onMouseMove: (e) => {
2050
- if (indexRow !== indexFocus) {
2051
- setIndexFocus(indexRow);
2052
- }
2053
- e.stopPropagation();
2054
- },
2055
- children: col.template ? col.template(row, indexRow) : valueDisplay
2041
+ } else {
2042
+ onChange(row);
2043
+ closeMenu();
2044
+ }
2045
+ e.preventDefault();
2046
+ e.stopPropagation();
2056
2047
  },
2057
- `col-${indexRow}-${indexCol}`
2058
- ),
2059
- checkOverflow(refRow.current) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_reactstrap8.UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-select-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : valueDisplay })
2060
- ] }, indexCol);
2048
+ onMouseMove: (e) => {
2049
+ if (indexRow !== indexFocus) {
2050
+ setIndexFocus(indexRow);
2051
+ }
2052
+ e.stopPropagation();
2053
+ },
2054
+ children: col.template ? col.template(row, indexRow) : valueDisplay
2055
+ },
2056
+ `col-${indexRow}-${indexCol}`
2057
+ ) }, indexCol);
2061
2058
  })
2062
2059
  ]
2063
2060
  },
@@ -2082,7 +2079,6 @@ var SelectTable = (0, import_react13.forwardRef)((props, ref) => {
2082
2079
  }
2083
2080
  );
2084
2081
  });
2085
- var select_table_default = SelectTable;
2086
2082
 
2087
2083
  // test-app/src/component/table/index.tsx
2088
2084
  var import_jsx_runtime14 = require("react/jsx-runtime");
@@ -2475,7 +2471,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
2475
2471
  valueSelectTable = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? optionsSelectTable?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
2476
2472
  }
2477
2473
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2478
- select_table_default,
2474
+ SelectTable,
2479
2475
  {
2480
2476
  id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
2481
2477
  value: valueSelectTable,
@@ -3733,6 +3729,7 @@ var TabsMenuComponent = ({
3733
3729
  var Table_edit_default = table_default;
3734
3730
  // Annotate the CommonJS export names for ESM import in node:
3735
3731
  0 && (module.exports = {
3732
+ SelectTable,
3736
3733
  TabsMenuComponent,
3737
3734
  formartNumberic,
3738
3735
  generateUUID,
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // test-app/src/component/table/index.tsx
2
2
  import { Fragment as Fragment15, forwardRef as forwardRef3, useEffect as useEffect8, useImperativeHandle, useRef as useRef3, useState as useState7 } from "react";
3
- import { Button as Button4, DropdownMenu as DropdownMenu3, DropdownToggle as DropdownToggle3, Input as Input7, UncontrolledDropdown, UncontrolledTooltip as UncontrolledTooltip2 } from "reactstrap";
3
+ import { Button as Button4, DropdownMenu as DropdownMenu3, DropdownToggle as DropdownToggle3, Input as Input7, UncontrolledDropdown, UncontrolledTooltip } from "reactstrap";
4
4
  import classnames7 from "classnames";
5
5
  import { useTranslation as useTranslation10 } from "react-i18next";
6
6
  import Select3 from "react-select";
@@ -1535,7 +1535,6 @@ import {
1535
1535
  DropdownToggle as DropdownToggle2,
1536
1536
  Dropdown as Dropdown2,
1537
1537
  Button as Button3,
1538
- UncontrolledTooltip,
1539
1538
  Input as Input6
1540
1539
  } from "reactstrap";
1541
1540
  import { useTranslation as useTranslation9 } from "react-i18next";
@@ -1565,6 +1564,8 @@ var SelectTable = forwardRef2((props, ref) => {
1565
1564
  handleAdd,
1566
1565
  isClearable,
1567
1566
  component,
1567
+ isDisabled,
1568
+ formatOptionLabel,
1568
1569
  isMulti
1569
1570
  } = props;
1570
1571
  const selectTableRef = useRef2();
@@ -1643,7 +1644,9 @@ var SelectTable = forwardRef2((props, ref) => {
1643
1644
  if (dropdownOpen) {
1644
1645
  closeMenu();
1645
1646
  } else {
1646
- setDropdownOpen(true);
1647
+ if (!isDisabled) {
1648
+ setDropdownOpen(true);
1649
+ }
1647
1650
  }
1648
1651
  };
1649
1652
  const listKeyUse = ["Escape", "Space", "Enter", "Tab", "NumpadEnter", "ArrowDown", "ArrowUp", "F9"];
@@ -1801,13 +1804,10 @@ var SelectTable = forwardRef2((props, ref) => {
1801
1804
  setOptionsLoad(void 0);
1802
1805
  }
1803
1806
  }, [searchTerm]);
1804
- const checkOverflow = (element) => {
1805
- return element && element.scrollWidth > element.clientWidth;
1806
- };
1807
1807
  return /* @__PURE__ */ jsx13(
1808
1808
  "div",
1809
1809
  {
1810
- className: "react-select-table",
1810
+ className: classnames6("react-select-table", { "is-invalid": invalid }),
1811
1811
  ref,
1812
1812
  id,
1813
1813
  children: /* @__PURE__ */ jsx13("div", { ref: selectTableRef, children: /* @__PURE__ */ jsxs12(
@@ -1836,7 +1836,7 @@ var SelectTable = forwardRef2((props, ref) => {
1836
1836
  ele[fieldLabel ?? "label"]
1837
1837
  ] }, index);
1838
1838
  }) }) }) : /* @__PURE__ */ jsx13(Fragment14, { children: /* @__PURE__ */ jsxs12("div", { className: classnames6("select-value", { "d-none": searchTerm }), children: [
1839
- value ? value[fieldLabel ?? "label"] : "",
1839
+ value ? formatOptionLabel ? formatOptionLabel(value) : value[fieldLabel ?? "label"] : "",
1840
1840
  " "
1841
1841
  ] }) }),
1842
1842
  /* @__PURE__ */ jsx13("div", { className: classnames6("select-placeholder", { "d-none": (isMulti ? value?.length > 0 : value) || searchTerm }), children: placeholder }),
@@ -1891,7 +1891,7 @@ var SelectTable = forwardRef2((props, ref) => {
1891
1891
  e.preventDefault();
1892
1892
  },
1893
1893
  children: /* @__PURE__ */ jsxs12("div", { className: "r-select-grid", children: [
1894
- /* @__PURE__ */ jsx13("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ jsxs12("table", { style: { width: "100%" }, children: [
1894
+ /* @__PURE__ */ jsx13("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ jsxs12("table", { style: { width: "100%" }, children: [
1895
1895
  /* @__PURE__ */ jsx13("thead", { className: "r-select-gridheader", children: /* @__PURE__ */ jsxs12("tr", { className: "r-select-row", role: "row", children: [
1896
1896
  isMulti && /* @__PURE__ */ jsx13("th", { className: classnames6(`r-select-headercell`), style: { width: 40, top: `0px` }, children: /* @__PURE__ */ jsx13(
1897
1897
  "div",
@@ -1926,7 +1926,6 @@ var SelectTable = forwardRef2((props, ref) => {
1926
1926
  ] }) }),
1927
1927
  (optionsLoad ? optionsLoad : options).length > 0 ? /* @__PURE__ */ jsx13(Fragment14, { children: /* @__PURE__ */ jsx13("tbody", { className: "r-select-gridcontent", children: (optionsLoad ? optionsLoad : options)?.map((row, indexRow) => {
1928
1928
  if (loadOptions || checkSearch(searchTerm, row, columns ? columns : defaultColumns)) {
1929
- const refRow = useRef2(null);
1930
1929
  const isSelected = isMulti && value?.some((x) => x[fieldValue ?? "value"] === row[fieldValue ?? "value"]);
1931
1930
  return /* @__PURE__ */ jsxs12(
1932
1931
  "tr",
@@ -1978,52 +1977,48 @@ var SelectTable = forwardRef2((props, ref) => {
1978
1977
  } else if (col.type === "datetime") {
1979
1978
  valueDisplay = valueDisplay ? moment(valueDisplay).format("DD/MM/yyyy HH:mm") : "";
1980
1979
  }
1981
- return /* @__PURE__ */ jsxs12(Fragment13, { children: [
1982
- col.visible !== false && /* @__PURE__ */ jsx13(
1983
- "td",
1984
- {
1985
- id: `content-select-${indexRow}-${indexCol}`,
1986
- ref: refRow,
1987
- className: classnames6(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
1988
- style: {
1989
- minWidth: col.minWidth,
1990
- width: col.width,
1991
- maxWidth: col.maxWidth,
1992
- textAlign: col.textAlign ? col.textAlign : "left"
1993
- },
1994
- onClick: (e) => {
1995
- if (isMulti) {
1996
- const index = value?.findIndex((x) => x[fieldValue ?? "value"] === row[fieldValue ?? "value"]);
1997
- if (index > -1) {
1998
- value?.splice(index, 1);
1980
+ return /* @__PURE__ */ jsx13(Fragment13, { children: col.visible !== false && /* @__PURE__ */ jsx13(
1981
+ "td",
1982
+ {
1983
+ id: `content-select-${indexRow}-${indexCol}`,
1984
+ className: classnames6(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
1985
+ style: {
1986
+ minWidth: col.minWidth,
1987
+ width: col.width,
1988
+ maxWidth: col.maxWidth,
1989
+ textAlign: col.textAlign ? col.textAlign : "left"
1990
+ },
1991
+ onClick: (e) => {
1992
+ if (isMulti) {
1993
+ const index = value?.findIndex((x) => x[fieldValue ?? "value"] === row[fieldValue ?? "value"]);
1994
+ if (index > -1) {
1995
+ value?.splice(index, 1);
1996
+ onChange(value);
1997
+ } else {
1998
+ if (value) {
1999
+ value?.push(row);
1999
2000
  onChange(value);
2000
2001
  } else {
2001
- if (value) {
2002
- value?.push(row);
2003
- onChange(value);
2004
- } else {
2005
- onChange([row]);
2006
- }
2002
+ onChange([row]);
2007
2003
  }
2008
- } else {
2009
- onChange(row);
2010
- closeMenu();
2011
2004
  }
2012
- e.preventDefault();
2013
- e.stopPropagation();
2014
- },
2015
- onMouseMove: (e) => {
2016
- if (indexRow !== indexFocus) {
2017
- setIndexFocus(indexRow);
2018
- }
2019
- e.stopPropagation();
2020
- },
2021
- children: col.template ? col.template(row, indexRow) : valueDisplay
2005
+ } else {
2006
+ onChange(row);
2007
+ closeMenu();
2008
+ }
2009
+ e.preventDefault();
2010
+ e.stopPropagation();
2022
2011
  },
2023
- `col-${indexRow}-${indexCol}`
2024
- ),
2025
- checkOverflow(refRow.current) && /* @__PURE__ */ jsx13(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-select-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : valueDisplay })
2026
- ] }, indexCol);
2012
+ onMouseMove: (e) => {
2013
+ if (indexRow !== indexFocus) {
2014
+ setIndexFocus(indexRow);
2015
+ }
2016
+ e.stopPropagation();
2017
+ },
2018
+ children: col.template ? col.template(row, indexRow) : valueDisplay
2019
+ },
2020
+ `col-${indexRow}-${indexCol}`
2021
+ ) }, indexCol);
2027
2022
  })
2028
2023
  ]
2029
2024
  },
@@ -2048,7 +2043,6 @@ var SelectTable = forwardRef2((props, ref) => {
2048
2043
  }
2049
2044
  );
2050
2045
  });
2051
- var select_table_default = SelectTable;
2052
2046
 
2053
2047
  // test-app/src/component/table/index.tsx
2054
2048
  import { Fragment as Fragment16, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
@@ -2441,7 +2435,7 @@ var TableEdit = forwardRef3((props, ref) => {
2441
2435
  valueSelectTable = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? optionsSelectTable?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
2442
2436
  }
2443
2437
  return /* @__PURE__ */ jsx14(
2444
- select_table_default,
2438
+ SelectTable,
2445
2439
  {
2446
2440
  id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
2447
2441
  value: valueSelectTable,
@@ -2759,7 +2753,7 @@ var TableEdit = forwardRef3((props, ref) => {
2759
2753
  },
2760
2754
  children: [
2761
2755
  item.icon && /* @__PURE__ */ jsx14(icon_default, { iconName: item.icon, size: 16 }),
2762
- /* @__PURE__ */ jsx14(UncontrolledTooltip2, { className: "r-tooltip", target: `command-item-${i}`, place: "top", children: t(item.tooltip ?? "") })
2756
+ /* @__PURE__ */ jsx14(UncontrolledTooltip, { className: "r-tooltip", target: `command-item-${i}`, place: "top", children: t(item.tooltip ?? "") })
2763
2757
  ]
2764
2758
  },
2765
2759
  `command-${index}`
@@ -3258,9 +3252,9 @@ var TableEdit = forwardRef3((props, ref) => {
3258
3252
  children: [
3259
3253
  typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : /* @__PURE__ */ jsx14("div", { id: `content-${idTable}-${indexRow}-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }),
3260
3254
  /* @__PURE__ */ jsx14("span", { id: `error-${indexRow}-${indexCol}`, className: classnames7("cursor-pointer text-primary icon-table", { "d-none": !errorMessage }), children: /* @__PURE__ */ jsx14(AlertCircle, { fontSize: 15.5 }) }),
3261
- !(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx14(UncontrolledTooltip2, { className: "r-tooltip", autohide: false, target: `content-${idTable}-${indexRow}-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : value }),
3255
+ !(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx14(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-${indexRow}-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : value }),
3262
3256
  /* @__PURE__ */ jsx14(
3263
- UncontrolledTooltip2,
3257
+ UncontrolledTooltip,
3264
3258
  {
3265
3259
  target: `error-${indexRow}-${indexCol}`,
3266
3260
  className: "r-tooltip tooltip-error",
@@ -3698,6 +3692,7 @@ var TabsMenuComponent = ({
3698
3692
  // index.ts
3699
3693
  var Table_edit_default = table_default;
3700
3694
  export {
3695
+ SelectTable,
3701
3696
  TabsMenuComponent,
3702
3697
  Table_edit_default as default,
3703
3698
  formartNumberic,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-table-edit",
3
3
  "license": "MIT",
4
- "version": "0.5.7",
4
+ "version": "0.5.9",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",