react-table-edit 0.9.1 → 0.9.3

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
@@ -19,6 +19,7 @@ type IFColumnSelectTable = {
19
19
  type Props = {
20
20
  id?: string;
21
21
  component?: any;
22
+ footerComponent?: any;
22
23
  fieldValue?: string;
23
24
  fieldLabel?: string;
24
25
  onChange: any;
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ type IFColumnSelectTable = {
19
19
  type Props = {
20
20
  id?: string;
21
21
  component?: any;
22
+ footerComponent?: any;
22
23
  fieldValue?: string;
23
24
  fieldLabel?: string;
24
25
  onChange: any;
package/dist/index.js CHANGED
@@ -607,6 +607,7 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
607
607
  noHeader,
608
608
  isDisabled,
609
609
  showFooter,
610
+ footerComponent,
610
611
  onPaste
611
612
  } = props;
612
613
  const selectTableRef = (0, import_react6.useRef)();
@@ -1122,11 +1123,14 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
1122
1123
  },
1123
1124
  children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "r-select-grid", children: [
1124
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, {}) }),
1125
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: (0, import_classnames4.default)("r-select-footer", { "d-none": !(showFooter === true || handleAdd) }), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_reactstrap4.Button, { outline: true, color: "primary", onClick: handleAdd, className: (0, import_classnames4.default)("r-btn-add d-flex align-items-center", { "d-none": !handleAdd }), children: [
1126
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_becoxy_icons2.Plus, { className: "me-50", fontSize: 16 }),
1127
- t("AddNew"),
1128
- " (F9)"
1129
- ] }) })
1126
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_classnames4.default)("r-select-footer", { "d-none": !(showFooter === true || handleAdd) }), children: [
1127
+ /* @__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
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_becoxy_icons2.Plus, { className: "me-50", fontSize: 16 }),
1129
+ t("AddNew"),
1130
+ " (F9)"
1131
+ ] }),
1132
+ footerComponent ? footerComponent() : null
1133
+ ] })
1130
1134
  ] })
1131
1135
  }
1132
1136
  ) })
@@ -2549,6 +2553,9 @@ var TableEdit = (0, import_react15.forwardRef)((props, ref) => {
2549
2553
  valueSelect = row[col.field];
2550
2554
  } else {
2551
2555
  valueSelect = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? optionsSelect?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
2556
+ if (!valueSelect && col.selectSettings?.defaultValue) {
2557
+ valueSelect = col.selectSettings?.defaultValue(row);
2558
+ }
2552
2559
  }
2553
2560
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2554
2561
  SelectTable,
package/dist/index.mjs CHANGED
@@ -571,6 +571,7 @@ var SelectTable = forwardRef((props, ref) => {
571
571
  noHeader,
572
572
  isDisabled,
573
573
  showFooter,
574
+ footerComponent,
574
575
  onPaste
575
576
  } = props;
576
577
  const selectTableRef = useRef();
@@ -1086,11 +1087,14 @@ var SelectTable = forwardRef((props, ref) => {
1086
1087
  },
1087
1088
  children: /* @__PURE__ */ jsxs5("div", { className: "r-select-grid", children: [
1088
1089
  /* @__PURE__ */ jsx5("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ jsx5(RenderTable, {}) }),
1089
- /* @__PURE__ */ jsx5("div", { className: classnames3("r-select-footer", { "d-none": !(showFooter === true || handleAdd) }), children: /* @__PURE__ */ jsxs5(Button, { outline: true, color: "primary", onClick: handleAdd, className: classnames3("r-btn-add d-flex align-items-center", { "d-none": !handleAdd }), children: [
1090
- /* @__PURE__ */ jsx5(Plus, { className: "me-50", fontSize: 16 }),
1091
- t("AddNew"),
1092
- " (F9)"
1093
- ] }) })
1090
+ /* @__PURE__ */ jsxs5("div", { className: classnames3("r-select-footer", { "d-none": !(showFooter === true || handleAdd) }), children: [
1091
+ /* @__PURE__ */ jsxs5(Button, { outline: true, color: "primary", onClick: handleAdd, className: classnames3("r-btn d-flex align-items-center", { "d-none": !handleAdd }), children: [
1092
+ /* @__PURE__ */ jsx5(Plus, { className: "me-50", fontSize: 16 }),
1093
+ t("AddNew"),
1094
+ " (F9)"
1095
+ ] }),
1096
+ footerComponent ? footerComponent() : null
1097
+ ] })
1094
1098
  ] })
1095
1099
  }
1096
1100
  ) })
@@ -2513,6 +2517,9 @@ var TableEdit = forwardRef3((props, ref) => {
2513
2517
  valueSelect = row[col.field];
2514
2518
  } else {
2515
2519
  valueSelect = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? optionsSelect?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
2520
+ if (!valueSelect && col.selectSettings?.defaultValue) {
2521
+ valueSelect = col.selectSettings?.defaultValue(row);
2522
+ }
2516
2523
  }
2517
2524
  return /* @__PURE__ */ jsx15(
2518
2525
  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.1",
4
+ "version": "0.9.3",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",