react-table-edit 1.2.1 → 1.2.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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +232 -227
- package/dist/index.mjs +228 -223
- package/package.json +53 -64
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/component/table/index.tsx
|
|
2
2
|
import { Fragment as Fragment20, forwardRef as forwardRef4, useEffect as useEffect9, useImperativeHandle, useRef as useRef4, useState as useState8 } from "react";
|
|
3
3
|
import { Button as Button6, DropdownMenu as DropdownMenu4, DropdownToggle as DropdownToggle4, Input as Input9, UncontrolledDropdown, UncontrolledTooltip as UncontrolledTooltip5 } from "reactstrap";
|
|
4
4
|
import classnames9 from "classnames";
|
|
5
5
|
import { useTranslation as useTranslation12 } from "react-i18next";
|
|
6
6
|
import { AlertCircle, Info as Info2, Settings } from "becoxy-icons";
|
|
7
7
|
|
|
8
|
-
//
|
|
8
|
+
// src/component/react-input/index.tsx
|
|
9
9
|
import { X } from "becoxy-icons";
|
|
10
10
|
import classNames from "classnames";
|
|
11
11
|
import { Fragment, useEffect, useState } from "react";
|
|
@@ -42,7 +42,7 @@ var ReactInput = (props) => {
|
|
|
42
42
|
};
|
|
43
43
|
var react_input_default = ReactInput;
|
|
44
44
|
|
|
45
|
-
//
|
|
45
|
+
// src/component/notifications.tsx
|
|
46
46
|
import { Fragment as Fragment2 } from "react";
|
|
47
47
|
import Swal from "sweetalert2";
|
|
48
48
|
import withReactContent from "sweetalert2-react-content";
|
|
@@ -179,7 +179,7 @@ var messageBoxConfirm2 = async (t, data, data2, message) => {
|
|
|
179
179
|
});
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
-
//
|
|
182
|
+
// src/component/utils.ts
|
|
183
183
|
import { useEffect as useEffect2 } from "react";
|
|
184
184
|
var useOnClickOutside = (ref, handler) => {
|
|
185
185
|
useEffect2(
|
|
@@ -305,10 +305,10 @@ var roundNumber = (num, fraction) => {
|
|
|
305
305
|
return result;
|
|
306
306
|
};
|
|
307
307
|
|
|
308
|
-
//
|
|
308
|
+
// src/component/table/index.tsx
|
|
309
309
|
import moment3 from "moment";
|
|
310
310
|
|
|
311
|
-
//
|
|
311
|
+
// src/component/edit-form/index.tsx
|
|
312
312
|
import { forwardRef as forwardRef2, useEffect as useEffect4, useRef as useRef2, useState as useState3 } from "react";
|
|
313
313
|
import {
|
|
314
314
|
DropdownItem as DropdownItem2,
|
|
@@ -325,7 +325,7 @@ import { yupResolver } from "@hookform/resolvers/yup";
|
|
|
325
325
|
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
326
326
|
import classNames2 from "classnames";
|
|
327
327
|
|
|
328
|
-
//
|
|
328
|
+
// src/component/input-text/index.tsx
|
|
329
329
|
import { Controller } from "react-hook-form";
|
|
330
330
|
import { Input as Input2, Label, FormFeedback } from "reactstrap";
|
|
331
331
|
import classnames from "classnames";
|
|
@@ -416,7 +416,7 @@ var TextInput = (props) => {
|
|
|
416
416
|
};
|
|
417
417
|
var input_text_default = TextInput;
|
|
418
418
|
|
|
419
|
-
//
|
|
419
|
+
// src/component/input-number/index.tsx
|
|
420
420
|
import { Controller as Controller2 } from "react-hook-form";
|
|
421
421
|
import { Input as Input3, Label as Label2, FormFeedback as FormFeedback2 } from "reactstrap";
|
|
422
422
|
import classnames2 from "classnames";
|
|
@@ -550,13 +550,13 @@ var NumberInput = (props) => {
|
|
|
550
550
|
};
|
|
551
551
|
var input_number_default = NumberInput;
|
|
552
552
|
|
|
553
|
-
//
|
|
553
|
+
// src/component/edit-form/select-table/index.tsx
|
|
554
554
|
import { Controller as Controller3 } from "react-hook-form";
|
|
555
555
|
import { FormFeedback as FormFeedback3, Label as Label3, UncontrolledTooltip as UncontrolledTooltip2 } from "reactstrap";
|
|
556
556
|
import classnames4 from "classnames";
|
|
557
557
|
import { Fragment as Fragment7 } from "react";
|
|
558
558
|
|
|
559
|
-
//
|
|
559
|
+
// src/component/select-table/index.tsx
|
|
560
560
|
import React, { forwardRef, Fragment as Fragment5, useEffect as useEffect3, useMemo, useRef, useState as useState2 } from "react";
|
|
561
561
|
import {
|
|
562
562
|
DropdownItem,
|
|
@@ -1134,7 +1134,7 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
1134
1134
|
);
|
|
1135
1135
|
});
|
|
1136
1136
|
|
|
1137
|
-
//
|
|
1137
|
+
// src/component/edit-form/select-table/index.tsx
|
|
1138
1138
|
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
1139
1139
|
import { Fragment as Fragment8, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1140
1140
|
var SelectTableBox = (props) => {
|
|
@@ -1251,7 +1251,7 @@ var SelectTableBox = (props) => {
|
|
|
1251
1251
|
};
|
|
1252
1252
|
var select_table_default = SelectTableBox;
|
|
1253
1253
|
|
|
1254
|
-
//
|
|
1254
|
+
// src/component/edit-form/index.tsx
|
|
1255
1255
|
import { Fragment as Fragment9, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1256
1256
|
var defaultWidth = 200;
|
|
1257
1257
|
var EditForm = forwardRef2((props, ref) => {
|
|
@@ -1587,12 +1587,12 @@ var EditForm = forwardRef2((props, ref) => {
|
|
|
1587
1587
|
});
|
|
1588
1588
|
var edit_form_default = EditForm;
|
|
1589
1589
|
|
|
1590
|
-
//
|
|
1590
|
+
// src/component/sidebar-setting-column/index.tsx
|
|
1591
1591
|
import { Fragment as Fragment11, useEffect as useEffect6, useState as useState5 } from "react";
|
|
1592
1592
|
import { Button as Button3, Input as Input6 } from "reactstrap";
|
|
1593
1593
|
import { useTranslation as useTranslation7 } from "react-i18next";
|
|
1594
1594
|
|
|
1595
|
-
//
|
|
1595
|
+
// src/component/modal-header/index.tsx
|
|
1596
1596
|
import { Edit, Info, Plus as Plus2, X as X2 } from "becoxy-icons";
|
|
1597
1597
|
import classNames3 from "classnames";
|
|
1598
1598
|
import { useTranslation as useTranslation6 } from "react-i18next";
|
|
@@ -1636,7 +1636,7 @@ var ModalHeader = (props) => {
|
|
|
1636
1636
|
};
|
|
1637
1637
|
var modal_header_default = ModalHeader;
|
|
1638
1638
|
|
|
1639
|
-
//
|
|
1639
|
+
// src/component/sidebar/index.tsx
|
|
1640
1640
|
import { ChevronLeft, ChevronRight } from "becoxy-icons";
|
|
1641
1641
|
import classNames4 from "classnames";
|
|
1642
1642
|
import { useEffect as useEffect5, useState as useState4 } from "react";
|
|
@@ -1740,7 +1740,7 @@ var Sidebar = (props) => {
|
|
|
1740
1740
|
};
|
|
1741
1741
|
var sidebar_default = Sidebar;
|
|
1742
1742
|
|
|
1743
|
-
//
|
|
1743
|
+
// src/component/sidebar-setting-column/index.tsx
|
|
1744
1744
|
import classnames5 from "classnames";
|
|
1745
1745
|
import { Fragment as Fragment12, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1746
1746
|
var SidebarSetColumn = (props) => {
|
|
@@ -1992,7 +1992,7 @@ var SidebarSetColumn = (props) => {
|
|
|
1992
1992
|
};
|
|
1993
1993
|
var sidebar_setting_column_default = SidebarSetColumn;
|
|
1994
1994
|
|
|
1995
|
-
//
|
|
1995
|
+
// src/component/table/paging/index.tsx
|
|
1996
1996
|
import { ChevronRight as ChevronRight2, ChevronLeft as ChevronLeft2, ChevronsLeft, ChevronsRight } from "becoxy-icons";
|
|
1997
1997
|
import classNames5 from "classnames";
|
|
1998
1998
|
import { Fragment as Fragment13, useEffect as useEffect7, useState as useState6 } from "react";
|
|
@@ -2078,7 +2078,7 @@ var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOpt
|
|
|
2078
2078
|
] }) });
|
|
2079
2079
|
};
|
|
2080
2080
|
|
|
2081
|
-
//
|
|
2081
|
+
// src/component/table/header.tsx
|
|
2082
2082
|
import { Fragment as Fragment14 } from "react";
|
|
2083
2083
|
import classnames6 from "classnames";
|
|
2084
2084
|
import { Input as Input7 } from "reactstrap";
|
|
@@ -2168,13 +2168,13 @@ var HeaderTableCol = (props) => {
|
|
|
2168
2168
|
};
|
|
2169
2169
|
var header_default = HeaderTableCol;
|
|
2170
2170
|
|
|
2171
|
-
//
|
|
2171
|
+
// src/component/table/command.tsx
|
|
2172
2172
|
import { Fragment as Fragment17 } from "react";
|
|
2173
2173
|
import classnames7 from "classnames";
|
|
2174
2174
|
import { Button as Button4, UncontrolledTooltip as UncontrolledTooltip3 } from "reactstrap";
|
|
2175
2175
|
import { useTranslation as useTranslation10 } from "react-i18next";
|
|
2176
2176
|
|
|
2177
|
-
//
|
|
2177
|
+
// src/component/icon/index.tsx
|
|
2178
2178
|
import * as Icon from "becoxy-icons";
|
|
2179
2179
|
import { Fragment as Fragment16 } from "react";
|
|
2180
2180
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
@@ -2189,7 +2189,7 @@ var IconCustom = (props) => {
|
|
|
2189
2189
|
};
|
|
2190
2190
|
var icon_default = IconCustom;
|
|
2191
2191
|
|
|
2192
|
-
//
|
|
2192
|
+
// src/component/table/command.tsx
|
|
2193
2193
|
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2194
2194
|
var CommandElement = (props) => {
|
|
2195
2195
|
const { commandItems, rowData, indexRow, handleCommandClick, indexFocus, setIndexFocus } = props;
|
|
@@ -2223,7 +2223,7 @@ var CommandElement = (props) => {
|
|
|
2223
2223
|
};
|
|
2224
2224
|
var command_default = CommandElement;
|
|
2225
2225
|
|
|
2226
|
-
//
|
|
2226
|
+
// src/component/select-table-tree/index.tsx
|
|
2227
2227
|
import React2, { forwardRef as forwardRef3, Fragment as Fragment18, useEffect as useEffect8, useMemo as useMemo2, useRef as useRef3, useState as useState7 } from "react";
|
|
2228
2228
|
import {
|
|
2229
2229
|
DropdownItem as DropdownItem3,
|
|
@@ -2792,7 +2792,7 @@ var SelectTableTree = forwardRef3((props, ref) => {
|
|
|
2792
2792
|
);
|
|
2793
2793
|
});
|
|
2794
2794
|
|
|
2795
|
-
//
|
|
2795
|
+
// src/component/table/index.tsx
|
|
2796
2796
|
import { NumericFormat } from "react-number-format";
|
|
2797
2797
|
import { Fragment as Fragment21, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2798
2798
|
var TableEdit = forwardRef4((props, ref) => {
|
|
@@ -3382,7 +3382,6 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3382
3382
|
const focusNewElement = (col, row, onLoad = false) => {
|
|
3383
3383
|
setTimeout(() => {
|
|
3384
3384
|
const element = document.getElementById(`${idTable}-col${col}-row${row}`);
|
|
3385
|
-
console.log(element);
|
|
3386
3385
|
if (element) {
|
|
3387
3386
|
if (element.className.includes("react-select") || element.className.includes("form-edit")) {
|
|
3388
3387
|
element.getElementsByTagName("input")[0]?.focus();
|
|
@@ -3765,92 +3764,163 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3765
3764
|
}
|
|
3766
3765
|
}
|
|
3767
3766
|
}, [selectedItem]);
|
|
3768
|
-
const
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
`col-${indexRow}-${indexCol}`
|
|
3785
|
-
) }) : col.field === "#" ? /* @__PURE__ */ jsx16(
|
|
3786
|
-
"td",
|
|
3787
|
-
{
|
|
3788
|
-
className: classnames9(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "r-active": isSelected && editDisable || indexFocus === indexRow }),
|
|
3789
|
-
tabIndex: Number(`${indexRow}${indexCol}`),
|
|
3790
|
-
style: {
|
|
3791
|
-
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
3792
|
-
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
3793
|
-
textAlign: "center"
|
|
3794
|
-
},
|
|
3795
|
-
onCopy: (e) => {
|
|
3796
|
-
if (!editDisable && (e.target.nodeName === "DIV" || e.target.nodeName === "TD")) {
|
|
3797
|
-
navigator.clipboard.writeText(JSON.stringify(row));
|
|
3798
|
-
notificationSuccess(t("CopySuccessful"));
|
|
3799
|
-
e.stopPropagation();
|
|
3800
|
-
}
|
|
3767
|
+
const renderContentCol = (col, row, indexRow, indexCol, isSelected) => {
|
|
3768
|
+
if (col.field === "command") {
|
|
3769
|
+
return col.visible !== false && /* @__PURE__ */ jsx16(
|
|
3770
|
+
"td",
|
|
3771
|
+
{
|
|
3772
|
+
className: classnames9(
|
|
3773
|
+
`r-rowcell p-0 fix-${col.fixedType}`,
|
|
3774
|
+
{ "cell-fixed": col.fixedType },
|
|
3775
|
+
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
3776
|
+
),
|
|
3777
|
+
style: {
|
|
3778
|
+
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
3779
|
+
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
3780
|
+
textAlign: col.textAlign ? col.textAlign : "left"
|
|
3781
|
+
},
|
|
3782
|
+
children: /* @__PURE__ */ jsx16("div", { className: "r-rowcell-div command", children: /* @__PURE__ */ jsx16(command_default, { commandItems: col.commandItems ?? [], handleCommandClick, indexRow, rowData: row, setIndexFocus, indexFocus }) })
|
|
3801
3783
|
},
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3784
|
+
`col-${indexRow}-${indexCol}`
|
|
3785
|
+
);
|
|
3786
|
+
} else if (col.field === "#") {
|
|
3787
|
+
return col.visible !== false && /* @__PURE__ */ jsx16(
|
|
3788
|
+
"td",
|
|
3789
|
+
{
|
|
3790
|
+
className: classnames9(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "r-active": isSelected && editDisable || indexFocus === indexRow }),
|
|
3791
|
+
tabIndex: Number(`${indexRow}${indexCol}`),
|
|
3792
|
+
style: {
|
|
3793
|
+
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
3794
|
+
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
3795
|
+
textAlign: "center"
|
|
3796
|
+
},
|
|
3797
|
+
onCopy: (e) => {
|
|
3798
|
+
if (!editDisable && (e.target.nodeName === "DIV" || e.target.nodeName === "TD")) {
|
|
3799
|
+
navigator.clipboard.writeText(JSON.stringify(row));
|
|
3800
|
+
notificationSuccess(t("CopySuccessful"));
|
|
3801
|
+
e.stopPropagation();
|
|
3802
|
+
}
|
|
3803
|
+
},
|
|
3804
|
+
onPaste: (e) => {
|
|
3805
|
+
if (!editDisable && (e.target.nodeName === "DIV" || e.target.nodeName === "TD")) {
|
|
3806
|
+
navigator.clipboard.readText().then((rs) => {
|
|
3807
|
+
dataSource[indexRow] = JSON.parse(rs);
|
|
3808
|
+
if (fieldKey) {
|
|
3809
|
+
dataSource[indexRow][fieldKey] = defaultValue[fieldKey];
|
|
3810
|
+
}
|
|
3811
|
+
changeDataSource(dataSource);
|
|
3812
|
+
notificationSuccess(t("PasteSuccessful"));
|
|
3813
|
+
}).catch((ex) => {
|
|
3814
|
+
alert(ex);
|
|
3815
|
+
});
|
|
3816
|
+
e.stopPropagation();
|
|
3817
|
+
}
|
|
3818
|
+
},
|
|
3819
|
+
onClick: (e) => {
|
|
3820
|
+
if (e.target.nodeName === "DIV" || e.target.nodeName === "TD") {
|
|
3821
|
+
if (!editDisable && indexRow != indexFocus) {
|
|
3822
|
+
setIndexFocus(indexRow);
|
|
3808
3823
|
}
|
|
3809
|
-
|
|
3810
|
-
notificationSuccess(t("PasteSuccessful"));
|
|
3811
|
-
}).catch((ex) => {
|
|
3812
|
-
alert(ex);
|
|
3813
|
-
});
|
|
3814
|
-
e.stopPropagation();
|
|
3815
|
-
}
|
|
3816
|
-
},
|
|
3817
|
-
onClick: (e) => {
|
|
3818
|
-
if (e.target.nodeName === "DIV" || e.target.nodeName === "TD") {
|
|
3819
|
-
if (!editDisable && indexRow != indexFocus) {
|
|
3820
|
-
setIndexFocus(indexRow);
|
|
3824
|
+
e.stopPropagation();
|
|
3821
3825
|
}
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
}
|
|
3826
|
+
},
|
|
3827
|
+
onKeyDown: (e) => {
|
|
3828
|
+
if (e.code === "KeyD" && e.ctrlKey == true && (!editDisable && !addDisable) && (e.target.nodeName === "DIV" || e.target.nodeName === "TD")) {
|
|
3829
|
+
handleDuplicate(row, indexRow);
|
|
3830
|
+
e.preventDefault();
|
|
3831
|
+
e.stopPropagation();
|
|
3832
|
+
}
|
|
3833
|
+
},
|
|
3834
|
+
children: /* @__PURE__ */ jsx16("div", { className: "r-rowcell-div", children: indexRow + 1 })
|
|
3831
3835
|
},
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3836
|
+
`col-${indexRow}-${indexCol}`
|
|
3837
|
+
);
|
|
3838
|
+
} else if (col.field === "checkbox") {
|
|
3839
|
+
return /* @__PURE__ */ jsx16(
|
|
3840
|
+
"td",
|
|
3841
|
+
{
|
|
3842
|
+
className: classnames9(
|
|
3843
|
+
`r-rowcell p-0 fix-${col.fixedType}`,
|
|
3844
|
+
{ "cell-fixed": col.fixedType },
|
|
3845
|
+
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
3846
|
+
),
|
|
3847
|
+
style: {
|
|
3848
|
+
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
3849
|
+
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
3850
|
+
textAlign: col.textAlign ? col.textAlign : "center"
|
|
3851
|
+
},
|
|
3852
|
+
children: /* @__PURE__ */ jsx16(
|
|
3853
|
+
"div",
|
|
3854
|
+
{
|
|
3855
|
+
className: "r-rowcell-div cursor-pointer",
|
|
3856
|
+
onClick: (e) => {
|
|
3857
|
+
if (selectEnable) {
|
|
3858
|
+
const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
|
|
3859
|
+
if (index > -1) {
|
|
3860
|
+
if (isMulti) {
|
|
3861
|
+
selectedRows?.splice(index, 1);
|
|
3862
|
+
setSelectedRows([...selectedRows]);
|
|
3863
|
+
} else {
|
|
3864
|
+
setSelectedRows([]);
|
|
3865
|
+
}
|
|
3866
|
+
} else {
|
|
3867
|
+
if (isMulti) {
|
|
3868
|
+
setSelectedRows([...selectedRows, row]);
|
|
3869
|
+
} else {
|
|
3870
|
+
setSelectedRows([row]);
|
|
3871
|
+
}
|
|
3872
|
+
}
|
|
3873
|
+
e.stopPropagation();
|
|
3874
|
+
}
|
|
3875
|
+
},
|
|
3876
|
+
children: /* @__PURE__ */ jsx16(
|
|
3877
|
+
Input9,
|
|
3878
|
+
{
|
|
3879
|
+
checked: isSelected,
|
|
3880
|
+
type: "checkbox",
|
|
3881
|
+
className: "cursor-pointer",
|
|
3882
|
+
onChange: () => {
|
|
3883
|
+
},
|
|
3884
|
+
style: { textAlign: col.textAlign ?? "center" }
|
|
3885
|
+
}
|
|
3886
|
+
)
|
|
3887
|
+
}
|
|
3888
|
+
)
|
|
3847
3889
|
},
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3890
|
+
`col-${indexRow}-${indexCol}`
|
|
3891
|
+
);
|
|
3892
|
+
} else {
|
|
3893
|
+
let value = row[col.field];
|
|
3894
|
+
if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
|
|
3895
|
+
value = formartNumberic(row[col.field], decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) ?? 0;
|
|
3896
|
+
} else if (col.editType === "date") {
|
|
3897
|
+
value = value ? moment3(value).format("DD/MM/yyyy") : "";
|
|
3898
|
+
} else if (col.editType === "datetime") {
|
|
3899
|
+
value = value ? moment3(value).format("DD/MM/yyyy HH:mm") : "";
|
|
3900
|
+
}
|
|
3901
|
+
const typeDis = !editDisable && (indexFocus === indexRow || col.editType === "checkbox") && (!col.disabledCondition || !col.disabledCondition(row)) ? col.editEnable ? 1 : col.template ? 2 : 3 : col.template ? 2 : 3;
|
|
3902
|
+
const errorMessage = typeDis === 1 || col.field === "" || !col.validate ? "" : col.validate(row[col.field], row);
|
|
3903
|
+
return /* @__PURE__ */ jsx16(Fragment20, { children: col.visible !== false && /* @__PURE__ */ jsx16(
|
|
3904
|
+
"td",
|
|
3905
|
+
{
|
|
3906
|
+
className: classnames9(
|
|
3907
|
+
`r-rowcell fix-${col.fixedType}`,
|
|
3908
|
+
{ "cell-fixed": col.fixedType },
|
|
3909
|
+
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
3910
|
+
),
|
|
3911
|
+
style: {
|
|
3912
|
+
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
3913
|
+
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
3914
|
+
padding: 0,
|
|
3915
|
+
textAlign: col.textAlign ? col.textAlign : "left"
|
|
3916
|
+
},
|
|
3917
|
+
onClick: (e) => {
|
|
3918
|
+
if (e.target.nodeName === "DIV" || e.target.nodeName === "TD") {
|
|
3919
|
+
if (!editDisable && indexRow != indexFocus) {
|
|
3920
|
+
setIndexFocus(indexRow);
|
|
3921
|
+
focusNewElement(indexCol + 1, indexRow + 1, true);
|
|
3922
|
+
}
|
|
3923
|
+
if (selectEnable && editDisable) {
|
|
3854
3924
|
const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
|
|
3855
3925
|
if (index > -1) {
|
|
3856
3926
|
if (isMulti) {
|
|
@@ -3866,116 +3936,51 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3866
3936
|
setSelectedRows([row]);
|
|
3867
3937
|
}
|
|
3868
3938
|
}
|
|
3869
|
-
e.stopPropagation();
|
|
3870
3939
|
}
|
|
3871
|
-
|
|
3872
|
-
children: /* @__PURE__ */ jsx16(
|
|
3873
|
-
Input9,
|
|
3874
|
-
{
|
|
3875
|
-
checked: isSelected,
|
|
3876
|
-
type: "checkbox",
|
|
3877
|
-
className: "cursor-pointer",
|
|
3878
|
-
onChange: () => {
|
|
3879
|
-
},
|
|
3880
|
-
style: { textAlign: col.textAlign ?? "center", marginTop: 6 }
|
|
3881
|
-
}
|
|
3882
|
-
)
|
|
3883
|
-
}
|
|
3884
|
-
)
|
|
3885
|
-
},
|
|
3886
|
-
`col-${indexRow}-${indexCol}`
|
|
3887
|
-
) : /* @__PURE__ */ jsx16(ContenComponent, { col, indexCol, indexRow, isSelected, row }) });
|
|
3888
|
-
};
|
|
3889
|
-
const ContenComponent = ({ col, indexCol, indexRow, isSelected, row }) => {
|
|
3890
|
-
let value = row[col.field];
|
|
3891
|
-
if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
|
|
3892
|
-
value = formartNumberic(row[col.field], decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) ?? 0;
|
|
3893
|
-
} else if (col.editType === "date") {
|
|
3894
|
-
value = value ? moment3(value).format("DD/MM/yyyy") : "";
|
|
3895
|
-
} else if (col.editType === "datetime") {
|
|
3896
|
-
value = value ? moment3(value).format("DD/MM/yyyy HH:mm") : "";
|
|
3897
|
-
}
|
|
3898
|
-
const typeDis = !editDisable && (indexFocus === indexRow || col.editType === "checkbox") && (!col.disabledCondition || !col.disabledCondition(row)) ? col.editEnable ? 1 : col.template ? 2 : 3 : col.template ? 2 : 3;
|
|
3899
|
-
const errorMessage = typeDis === 1 || col.field === "" || !col.validate ? "" : col.validate(row[col.field], row);
|
|
3900
|
-
return /* @__PURE__ */ jsx16(Fragment20, { children: col.visible !== false && /* @__PURE__ */ jsx16(
|
|
3901
|
-
"td",
|
|
3902
|
-
{
|
|
3903
|
-
className: classnames9(
|
|
3904
|
-
`r-rowcell fix-${col.fixedType}`,
|
|
3905
|
-
{ "cell-fixed": col.fixedType },
|
|
3906
|
-
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
3907
|
-
),
|
|
3908
|
-
style: {
|
|
3909
|
-
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
3910
|
-
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
3911
|
-
padding: 0,
|
|
3912
|
-
textAlign: col.textAlign ? col.textAlign : "left"
|
|
3913
|
-
},
|
|
3914
|
-
onClick: (e) => {
|
|
3915
|
-
if (e.target.nodeName === "DIV" || e.target.nodeName === "TD") {
|
|
3916
|
-
if (!editDisable && indexRow != indexFocus) {
|
|
3917
|
-
setIndexFocus(indexRow);
|
|
3918
|
-
focusNewElement(indexCol + 1, indexRow + 1, true);
|
|
3940
|
+
e.stopPropagation();
|
|
3919
3941
|
}
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3942
|
+
},
|
|
3943
|
+
children: /* @__PURE__ */ jsx16(
|
|
3944
|
+
"div",
|
|
3945
|
+
{
|
|
3946
|
+
className: classnames9("r-rowcell-div"),
|
|
3947
|
+
children: /* @__PURE__ */ jsxs15(
|
|
3948
|
+
"div",
|
|
3949
|
+
{
|
|
3950
|
+
id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
|
|
3951
|
+
className: classnames9("r-rowcell-content", { "r-is-invalid": errorMessage }),
|
|
3952
|
+
style: {
|
|
3953
|
+
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2,
|
|
3954
|
+
color: col.editType === "numeric" && Number(row[col.field]) < 0 ? "red" : ""
|
|
3955
|
+
},
|
|
3956
|
+
children: [
|
|
3957
|
+
typeDis === 1 && !refreshRow ? RenderEdit(row, col, indexCol, indexRow) : /* @__PURE__ */ jsx16("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
3958
|
+
/* @__PURE__ */ jsx16("span", { id: `error-${indexRow}-${indexCol}`, className: classnames9("cursor-pointer text-primary icon-table", { "d-none": !errorMessage }), children: /* @__PURE__ */ jsx16(AlertCircle, { fontSize: 15.5 }) }),
|
|
3959
|
+
!(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx16(UncontrolledTooltip5, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
3960
|
+
/* @__PURE__ */ jsx16(
|
|
3961
|
+
UncontrolledTooltip5,
|
|
3962
|
+
{
|
|
3963
|
+
target: `error-${indexRow}-${indexCol}`,
|
|
3964
|
+
className: "r-tooltip tooltip-error",
|
|
3965
|
+
children: errorMessage?.toString() ?? ""
|
|
3966
|
+
}
|
|
3967
|
+
)
|
|
3968
|
+
]
|
|
3934
3969
|
}
|
|
3935
|
-
|
|
3970
|
+
)
|
|
3936
3971
|
}
|
|
3937
|
-
|
|
3972
|
+
)
|
|
3938
3973
|
},
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
className: classnames9("r-rowcell-div"),
|
|
3943
|
-
children: /* @__PURE__ */ jsxs15(
|
|
3944
|
-
"div",
|
|
3945
|
-
{
|
|
3946
|
-
id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
|
|
3947
|
-
className: classnames9("r-rowcell-content", { "r-is-invalid": errorMessage }),
|
|
3948
|
-
style: {
|
|
3949
|
-
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2,
|
|
3950
|
-
color: col.editType === "numeric" && Number(row[col.field]) < 0 ? "red" : ""
|
|
3951
|
-
},
|
|
3952
|
-
children: [
|
|
3953
|
-
typeDis === 1 && !refreshRow ? RenderEdit(row, col, indexCol, indexRow) : /* @__PURE__ */ jsx16("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
3954
|
-
/* @__PURE__ */ jsx16("span", { id: `error-${indexRow}-${indexCol}`, className: classnames9("cursor-pointer text-primary icon-table", { "d-none": !errorMessage }), children: /* @__PURE__ */ jsx16(AlertCircle, { fontSize: 15.5 }) }),
|
|
3955
|
-
!(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx16(UncontrolledTooltip5, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
3956
|
-
/* @__PURE__ */ jsx16(
|
|
3957
|
-
UncontrolledTooltip5,
|
|
3958
|
-
{
|
|
3959
|
-
target: `error-${indexRow}-${indexCol}`,
|
|
3960
|
-
className: "r-tooltip tooltip-error",
|
|
3961
|
-
children: errorMessage?.toString() ?? ""
|
|
3962
|
-
}
|
|
3963
|
-
)
|
|
3964
|
-
]
|
|
3965
|
-
}
|
|
3966
|
-
)
|
|
3967
|
-
}
|
|
3968
|
-
)
|
|
3969
|
-
},
|
|
3970
|
-
`col-${indexRow}-${indexCol}`
|
|
3971
|
-
) }, indexCol);
|
|
3974
|
+
`col-${indexRow}-${indexCol}`
|
|
3975
|
+
) }, indexCol);
|
|
3976
|
+
}
|
|
3972
3977
|
};
|
|
3973
3978
|
const checkOverflow = (indexRow, indexCol) => {
|
|
3974
3979
|
const element = document.getElementById(`content-${idTable}-row${indexRow}col-${indexCol}`);
|
|
3975
3980
|
return element && element.scrollWidth > element.clientWidth;
|
|
3976
3981
|
};
|
|
3977
|
-
const
|
|
3978
|
-
return col.visible !== false
|
|
3982
|
+
const renderFooterCol = (col, indexCol) => {
|
|
3983
|
+
return /* @__PURE__ */ jsx16(Fragment20, { children: col.visible !== false && /* @__PURE__ */ jsx16(
|
|
3979
3984
|
"td",
|
|
3980
3985
|
{
|
|
3981
3986
|
className: classnames9(
|
|
@@ -3991,9 +3996,9 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
3991
3996
|
return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
|
|
3992
3997
|
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : "" })
|
|
3993
3998
|
}
|
|
3994
|
-
)
|
|
3999
|
+
) }, `summarycell-${indexCol}`);
|
|
3995
4000
|
};
|
|
3996
|
-
const
|
|
4001
|
+
const renderToolbarTop = () => {
|
|
3997
4002
|
return /* @__PURE__ */ jsx16("div", { id: "table_custom_top_toolbar", className: "r-toolbar r-toolbar-top", "aria-orientation": "horizontal", children: /* @__PURE__ */ jsxs15("div", { className: "r-toolbar-items", children: [
|
|
3998
4003
|
/* @__PURE__ */ jsx16("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
|
|
3999
4004
|
return item.align === "left" ? /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) : "";
|
|
@@ -4006,7 +4011,7 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
4006
4011
|
}) })
|
|
4007
4012
|
] }) });
|
|
4008
4013
|
};
|
|
4009
|
-
const
|
|
4014
|
+
const renderToolbarBottom = () => {
|
|
4010
4015
|
return /* @__PURE__ */ jsx16("div", { id: "table_custom_bottom_toolbar", className: "r-toolbar r-toolbar-bottom", role: "toolbar", "aria-disabled": "false", "aria-haspopup": "false", "aria-orientation": "horizontal", children: /* @__PURE__ */ jsxs15("div", { className: "r-toolbar-items", children: [
|
|
4011
4016
|
/* @__PURE__ */ jsxs15("div", { className: "r-toolbar-left", children: [
|
|
4012
4017
|
/* @__PURE__ */ jsx16("div", { className: classnames9("r-toolbar-item", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx16(Button6, { color: "success", outline: true, onClick: handleAdd, className: "d-flex", children: t("Add item") }) }),
|
|
@@ -4060,10 +4065,10 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
4060
4065
|
}
|
|
4061
4066
|
return false;
|
|
4062
4067
|
};
|
|
4063
|
-
const
|
|
4068
|
+
const renderData = () => {
|
|
4064
4069
|
totalCount = 0;
|
|
4065
4070
|
let countDisplay = -1;
|
|
4066
|
-
return
|
|
4071
|
+
return dataSource.map((row, indexRow) => {
|
|
4067
4072
|
const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
|
|
4068
4073
|
const flagSearch = !searchClient || checkSearch(searchSetting?.searchTerm !== void 0 ? searchSetting?.searchTerm : searchTerm, row, searchSetting?.keyField ?? []);
|
|
4069
4074
|
if (flagSearch) {
|
|
@@ -4076,14 +4081,14 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
4076
4081
|
{
|
|
4077
4082
|
className: classnames9("r-row", { "fisrt-row": countDisplay === 0 }),
|
|
4078
4083
|
children: contentColumns.map((col, indexCol) => {
|
|
4079
|
-
return
|
|
4084
|
+
return renderContentCol(col, row, indexRow, indexCol, isSelected);
|
|
4080
4085
|
})
|
|
4081
4086
|
},
|
|
4082
4087
|
`row-${indexRow}`
|
|
4083
4088
|
);
|
|
4084
4089
|
}
|
|
4085
4090
|
}
|
|
4086
|
-
})
|
|
4091
|
+
});
|
|
4087
4092
|
};
|
|
4088
4093
|
useEffect9(() => {
|
|
4089
4094
|
if (pagingClient && pagingSetting?.setCurrentPage && (searchSetting?.searchTerm !== void 0 ? searchSetting?.searchTerm : searchTerm)) {
|
|
@@ -4093,7 +4098,7 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
4093
4098
|
return /* @__PURE__ */ jsxs15(Fragment20, { children: [
|
|
4094
4099
|
/* @__PURE__ */ jsxs15("div", { className: "react-table-edit", children: [
|
|
4095
4100
|
/* @__PURE__ */ jsxs15("div", { className: "r-grid", ref: gridRef, children: [
|
|
4096
|
-
toolbarSetting?.showTopToolbar ? /* @__PURE__ */ jsx16(
|
|
4101
|
+
toolbarSetting?.showTopToolbar ? /* @__PURE__ */ jsx16(Fragment21, { children: renderToolbarTop() }) : /* @__PURE__ */ jsx16(Fragment21, {}),
|
|
4097
4102
|
/* @__PURE__ */ jsx16("div", { ref: tableElement, className: "r-gridtable", style: { height: `${height ? `${height}px` : "auto"}`, minHeight: `${minHeight ? `${minHeight}px` : ""}`, maxHeight: `${maxHeight ? `${maxHeight}px` : "400px"}` }, children: /* @__PURE__ */ jsxs15("table", { style: { width: "100%" }, children: [
|
|
4098
4103
|
/* @__PURE__ */ jsx16("thead", { className: "r-gridheader", children: headerColumns.map((element, indexParent) => {
|
|
4099
4104
|
return /* @__PURE__ */ jsx16("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
@@ -4117,12 +4122,12 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
4117
4122
|
);
|
|
4118
4123
|
}) }, `header-${-indexParent}`);
|
|
4119
4124
|
}) }),
|
|
4120
|
-
/* @__PURE__ */ jsx16("tbody", { className: "r-gridcontent", children:
|
|
4125
|
+
/* @__PURE__ */ jsx16("tbody", { className: "r-gridcontent", children: renderData() }),
|
|
4121
4126
|
/* @__PURE__ */ jsx16("tfoot", { className: "r-gridfoot", children: haveSum == true ? /* @__PURE__ */ jsx16("tr", { className: "r-row", children: contentColumns.map((col, index) => {
|
|
4122
|
-
return
|
|
4127
|
+
return renderFooterCol(col, index);
|
|
4123
4128
|
}) }) : /* @__PURE__ */ jsx16(Fragment21, {}) })
|
|
4124
4129
|
] }) }),
|
|
4125
|
-
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ jsx16(
|
|
4130
|
+
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ jsx16(Fragment21, { children: renderToolbarBottom() }) : /* @__PURE__ */ jsx16(Fragment21, {})
|
|
4126
4131
|
] }),
|
|
4127
4132
|
pagingSetting?.allowPaging ? /* @__PURE__ */ jsx16(
|
|
4128
4133
|
PagingComponent,
|
|
@@ -4151,7 +4156,7 @@ var TableEdit = forwardRef4((props, ref) => {
|
|
|
4151
4156
|
});
|
|
4152
4157
|
var table_default = TableEdit;
|
|
4153
4158
|
|
|
4154
|
-
//
|
|
4159
|
+
// src/component/tab-menu/index.tsx
|
|
4155
4160
|
import { ChevronLeft as ChevronLeft3, ChevronRight as ChevronRight4 } from "becoxy-icons";
|
|
4156
4161
|
import classNames6 from "classnames";
|
|
4157
4162
|
import { Fragment as Fragment22, useEffect as useEffect10, useState as useState9 } from "react";
|
|
@@ -4287,13 +4292,13 @@ var TabsMenuComponent = ({
|
|
|
4287
4292
|
] });
|
|
4288
4293
|
};
|
|
4289
4294
|
|
|
4290
|
-
//
|
|
4295
|
+
// src/component/input-style/index.tsx
|
|
4291
4296
|
import { Bold, Droplet, Italic, Type, Underline } from "becoxy-icons";
|
|
4292
4297
|
import { Button as Button7, Input as Input10 } from "reactstrap";
|
|
4293
4298
|
import classnames10 from "classnames";
|
|
4294
4299
|
import { Fragment as Fragment23 } from "react";
|
|
4295
4300
|
|
|
4296
|
-
//
|
|
4301
|
+
// src/component/input-style/fonts.ts
|
|
4297
4302
|
var OptionFont = [
|
|
4298
4303
|
{
|
|
4299
4304
|
value: 1,
|
|
@@ -5149,7 +5154,7 @@ var OptionFont = [
|
|
|
5149
5154
|
}
|
|
5150
5155
|
];
|
|
5151
5156
|
|
|
5152
|
-
//
|
|
5157
|
+
// src/component/input-style/index.tsx
|
|
5153
5158
|
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5154
5159
|
var InputStyleComponent = (props) => {
|
|
5155
5160
|
const {
|
|
@@ -5282,8 +5287,8 @@ var InputStyleComponent = (props) => {
|
|
|
5282
5287
|
] }) });
|
|
5283
5288
|
};
|
|
5284
5289
|
|
|
5285
|
-
// index.ts
|
|
5286
|
-
var
|
|
5290
|
+
// src/index.ts
|
|
5291
|
+
var src_default = table_default;
|
|
5287
5292
|
export {
|
|
5288
5293
|
InputStyleComponent,
|
|
5289
5294
|
SelectTable,
|
|
@@ -5291,7 +5296,7 @@ export {
|
|
|
5291
5296
|
TabsMenuComponent,
|
|
5292
5297
|
checkDecimalSeparator,
|
|
5293
5298
|
checkThousandSeparator,
|
|
5294
|
-
|
|
5299
|
+
src_default as default,
|
|
5295
5300
|
formartNumberic,
|
|
5296
5301
|
generateUUID,
|
|
5297
5302
|
isNullOrUndefined,
|