react-table-edit 0.9.2 → 0.9.4

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.js CHANGED
@@ -659,7 +659,6 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
659
659
  (0, import_react6.useEffect)(() => {
660
660
  if (inputRef && !isDisabled) {
661
661
  inputRef.current.addEventListener("blur", function() {
662
- setDropdownOpen(false);
663
662
  setSearchTerm("");
664
663
  setIsFocus(false);
665
664
  });
@@ -1122,7 +1121,7 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
1122
1121
  }
1123
1122
  },
1124
1123
  children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "r-select-grid", children: [
1125
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RenderTable, {}) }),
1124
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RenderTable, {}) }),
1126
1125
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_classnames4.default)("r-select-footer", { "d-none": !(showFooter === true || handleAdd) }), children: [
1127
1126
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_reactstrap4.Button, { outline: true, color: "primary", onClick: handleAdd, className: (0, import_classnames4.default)("r-btn d-flex align-items-center", { "d-none": !handleAdd }), children: [
1128
1127
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_becoxy_icons2.Plus, { className: "me-50", fontSize: 16 }),
@@ -2553,6 +2552,9 @@ var TableEdit = (0, import_react15.forwardRef)((props, ref) => {
2553
2552
  valueSelect = row[col.field];
2554
2553
  } else {
2555
2554
  valueSelect = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? optionsSelect?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
2555
+ if (!valueSelect && col.selectSettings?.defaultValue) {
2556
+ valueSelect = col.selectSettings?.defaultValue(row);
2557
+ }
2556
2558
  }
2557
2559
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2558
2560
  SelectTable,
package/dist/index.mjs CHANGED
@@ -623,7 +623,6 @@ var SelectTable = forwardRef((props, ref) => {
623
623
  useEffect3(() => {
624
624
  if (inputRef && !isDisabled) {
625
625
  inputRef.current.addEventListener("blur", function() {
626
- setDropdownOpen(false);
627
626
  setSearchTerm("");
628
627
  setIsFocus(false);
629
628
  });
@@ -1086,7 +1085,7 @@ var SelectTable = forwardRef((props, ref) => {
1086
1085
  }
1087
1086
  },
1088
1087
  children: /* @__PURE__ */ jsxs5("div", { className: "r-select-grid", children: [
1089
- /* @__PURE__ */ jsx5("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ jsx5(RenderTable, {}) }),
1088
+ /* @__PURE__ */ jsx5("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ jsx5(RenderTable, {}) }),
1090
1089
  /* @__PURE__ */ jsxs5("div", { className: classnames3("r-select-footer", { "d-none": !(showFooter === true || handleAdd) }), children: [
1091
1090
  /* @__PURE__ */ jsxs5(Button, { outline: true, color: "primary", onClick: handleAdd, className: classnames3("r-btn d-flex align-items-center", { "d-none": !handleAdd }), children: [
1092
1091
  /* @__PURE__ */ jsx5(Plus, { className: "me-50", fontSize: 16 }),
@@ -2517,6 +2516,9 @@ var TableEdit = forwardRef3((props, ref) => {
2517
2516
  valueSelect = row[col.field];
2518
2517
  } else {
2519
2518
  valueSelect = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? optionsSelect?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
2519
+ if (!valueSelect && col.selectSettings?.defaultValue) {
2520
+ valueSelect = col.selectSettings?.defaultValue(row);
2521
+ }
2520
2522
  }
2521
2523
  return /* @__PURE__ */ jsx15(
2522
2524
  SelectTable,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-table-edit",
3
3
  "license": "MIT",
4
- "version": "0.9.2",
4
+ "version": "0.9.4",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",