react-table-edit 1.2.8 → 1.2.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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -3
- package/dist/index.mjs +13 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -635,11 +635,13 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
635
635
|
showFooter,
|
|
636
636
|
footerComponent,
|
|
637
637
|
formatSetting,
|
|
638
|
+
allowCreate,
|
|
638
639
|
onPaste
|
|
639
640
|
} = props;
|
|
640
641
|
const selectTableRef = (0, import_react6.useRef)();
|
|
641
642
|
const selectMenuTableRef = (0, import_react6.useRef)();
|
|
642
643
|
const inputRef = (0, import_react6.useRef)();
|
|
644
|
+
const [haveCreate, setHaveCreate] = (0, import_react6.useState)(false);
|
|
643
645
|
const [dropdownOpen, setDropdownOpen] = (0, import_react6.useState)(false);
|
|
644
646
|
const [indexFocus, setIndexFocus] = (0, import_react6.useState)(-1);
|
|
645
647
|
const [isFocus, setIsFocus] = (0, import_react6.useState)(false);
|
|
@@ -857,6 +859,13 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
857
859
|
setIsLoading(false);
|
|
858
860
|
setOptionsLoad(rs);
|
|
859
861
|
};
|
|
862
|
+
(0, import_react6.useEffect)(() => {
|
|
863
|
+
if (optionsLoad?.length === 0) {
|
|
864
|
+
setHaveCreate(allowCreate ?? false);
|
|
865
|
+
} else {
|
|
866
|
+
setHaveCreate(false);
|
|
867
|
+
}
|
|
868
|
+
}, [optionsLoad]);
|
|
860
869
|
(0, import_react6.useEffect)(() => {
|
|
861
870
|
if (!searchTerm) {
|
|
862
871
|
setOptionsLoad(void 0);
|
|
@@ -1015,7 +1024,8 @@ var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
1015
1024
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RenderElement, { isSelected: isSelected ?? false, indexRow, row }, `select-table-${indexRow}`);
|
|
1016
1025
|
}) }) })
|
|
1017
1026
|
] }),
|
|
1018
|
-
((optionsLoad ? optionsLoad : options)?.length ?? 0) === 0 &&
|
|
1027
|
+
((optionsLoad ? optionsLoad : options)?.length ?? 0) === 0 && haveCreate && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "r-no-data", children: `Create "${searchTerm}"` }),
|
|
1028
|
+
((optionsLoad ? optionsLoad : options)?.length ?? 0) === 0 && !haveCreate && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "r-no-data", children: [
|
|
1019
1029
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [
|
|
1020
1030
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }),
|
|
1021
1031
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [
|
|
@@ -2802,8 +2812,8 @@ var SelectTableTree = (0, import_react15.forwardRef)((props, ref) => {
|
|
|
2802
2812
|
e.preventDefault();
|
|
2803
2813
|
}
|
|
2804
2814
|
},
|
|
2805
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "r-select-grid", children: [
|
|
2806
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight2 }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RenderTable, {}) }),
|
|
2815
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "r-select-grid r-select-tree-grid", children: [
|
|
2816
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-select-gridtable ", ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight2 }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RenderTable, {}) }),
|
|
2807
2817
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: (0, import_classnames13.default)("r-select-footer", { "d-none": !(showFooter === true || handleAdd || isMulti) }), children: [
|
|
2808
2818
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_reactstrap10.Button, { outline: true, color: "primary", onClick: handleAdd, className: (0, import_classnames13.default)("r-btn d-flex align-items-center", { "d-none": !handleAdd }), children: [
|
|
2809
2819
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_becoxy_icons6.Plus, { className: "me-50", fontSize: 16 }),
|
package/dist/index.mjs
CHANGED
|
@@ -598,11 +598,13 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
598
598
|
showFooter,
|
|
599
599
|
footerComponent,
|
|
600
600
|
formatSetting,
|
|
601
|
+
allowCreate,
|
|
601
602
|
onPaste
|
|
602
603
|
} = props;
|
|
603
604
|
const selectTableRef = useRef();
|
|
604
605
|
const selectMenuTableRef = useRef();
|
|
605
606
|
const inputRef = useRef();
|
|
607
|
+
const [haveCreate, setHaveCreate] = useState2(false);
|
|
606
608
|
const [dropdownOpen, setDropdownOpen] = useState2(false);
|
|
607
609
|
const [indexFocus, setIndexFocus] = useState2(-1);
|
|
608
610
|
const [isFocus, setIsFocus] = useState2(false);
|
|
@@ -820,6 +822,13 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
820
822
|
setIsLoading(false);
|
|
821
823
|
setOptionsLoad(rs);
|
|
822
824
|
};
|
|
825
|
+
useEffect3(() => {
|
|
826
|
+
if (optionsLoad?.length === 0) {
|
|
827
|
+
setHaveCreate(allowCreate ?? false);
|
|
828
|
+
} else {
|
|
829
|
+
setHaveCreate(false);
|
|
830
|
+
}
|
|
831
|
+
}, [optionsLoad]);
|
|
823
832
|
useEffect3(() => {
|
|
824
833
|
if (!searchTerm) {
|
|
825
834
|
setOptionsLoad(void 0);
|
|
@@ -978,7 +987,8 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
978
987
|
return /* @__PURE__ */ jsx5(RenderElement, { isSelected: isSelected ?? false, indexRow, row }, `select-table-${indexRow}`);
|
|
979
988
|
}) }) })
|
|
980
989
|
] }),
|
|
981
|
-
((optionsLoad ? optionsLoad : options)?.length ?? 0) === 0 &&
|
|
990
|
+
((optionsLoad ? optionsLoad : options)?.length ?? 0) === 0 && haveCreate && /* @__PURE__ */ jsx5("div", { className: "r-no-data", children: `Create "${searchTerm}"` }),
|
|
991
|
+
((optionsLoad ? optionsLoad : options)?.length ?? 0) === 0 && !haveCreate && !isLoading && /* @__PURE__ */ jsxs5("div", { className: "r-no-data", children: [
|
|
982
992
|
/* @__PURE__ */ jsx5("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxs5("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [
|
|
983
993
|
/* @__PURE__ */ jsx5("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }),
|
|
984
994
|
/* @__PURE__ */ jsxs5("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [
|
|
@@ -2773,8 +2783,8 @@ var SelectTableTree = forwardRef3((props, ref) => {
|
|
|
2773
2783
|
e.preventDefault();
|
|
2774
2784
|
}
|
|
2775
2785
|
},
|
|
2776
|
-
children: /* @__PURE__ */ jsxs14("div", { className: "r-select-grid", children: [
|
|
2777
|
-
/* @__PURE__ */ jsx15("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight2 }, children: /* @__PURE__ */ jsx15(RenderTable, {}) }),
|
|
2786
|
+
children: /* @__PURE__ */ jsxs14("div", { className: "r-select-grid r-select-tree-grid", children: [
|
|
2787
|
+
/* @__PURE__ */ jsx15("div", { className: "r-select-gridtable ", ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight2 }, children: /* @__PURE__ */ jsx15(RenderTable, {}) }),
|
|
2778
2788
|
/* @__PURE__ */ jsxs14("div", { className: classnames8("r-select-footer", { "d-none": !(showFooter === true || handleAdd || isMulti) }), children: [
|
|
2779
2789
|
/* @__PURE__ */ jsxs14(Button5, { outline: true, color: "primary", onClick: handleAdd, className: classnames8("r-btn d-flex align-items-center", { "d-none": !handleAdd }), children: [
|
|
2780
2790
|
/* @__PURE__ */ jsx15(Plus3, { className: "me-50", fontSize: 16 }),
|