react-table-edit 0.6.7 → 0.6.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 +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +378 -341
- package/dist/index.mjs +337 -300
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28,11 +28,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var Table_Edit_exports = {};
|
|
32
|
+
__export(Table_Edit_exports, {
|
|
33
33
|
SelectTable: () => SelectTable,
|
|
34
34
|
TabsMenuComponent: () => TabsMenuComponent,
|
|
35
|
-
default: () =>
|
|
35
|
+
default: () => Table_Edit_default,
|
|
36
36
|
formartNumberic: () => formartNumberic,
|
|
37
37
|
generateUUID: () => generateUUID,
|
|
38
38
|
isNullOrUndefined: () => isNullOrUndefined,
|
|
@@ -49,13 +49,13 @@ __export(Table_edit_exports, {
|
|
|
49
49
|
roundNumber: () => roundNumber,
|
|
50
50
|
useOnClickOutside: () => useOnClickOutside
|
|
51
51
|
});
|
|
52
|
-
module.exports = __toCommonJS(
|
|
52
|
+
module.exports = __toCommonJS(Table_Edit_exports);
|
|
53
53
|
|
|
54
54
|
// test-app/src/component/table/index.tsx
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
var
|
|
58
|
-
var
|
|
55
|
+
var import_react16 = require("react");
|
|
56
|
+
var import_reactstrap11 = require("reactstrap");
|
|
57
|
+
var import_classnames14 = __toESM(require("classnames"));
|
|
58
|
+
var import_react_i18next12 = require("react-i18next");
|
|
59
59
|
var import_react_select3 = __toESM(require("react-select"));
|
|
60
60
|
var import_async = __toESM(require("react-select/async"));
|
|
61
61
|
var import_becoxy_icons6 = require("becoxy-icons");
|
|
@@ -764,6 +764,7 @@ var EditForm = (0, import_react9.forwardRef)((props, ref) => {
|
|
|
764
764
|
onFormSubmit,
|
|
765
765
|
footerTemplate,
|
|
766
766
|
minWidth,
|
|
767
|
+
onPaste,
|
|
767
768
|
openOnFocus,
|
|
768
769
|
labelSize = "label-small"
|
|
769
770
|
} = props;
|
|
@@ -799,6 +800,11 @@ var EditForm = (0, import_react9.forwardRef)((props, ref) => {
|
|
|
799
800
|
if (onFormOpen && itemsField.length === 0) {
|
|
800
801
|
onFormOpen(rowData, itemsField, setItemsField);
|
|
801
802
|
}
|
|
803
|
+
if (openOnFocus) {
|
|
804
|
+
setTimeout(() => {
|
|
805
|
+
focusElement(`form-element-${field}-0`, true);
|
|
806
|
+
}, 100);
|
|
807
|
+
}
|
|
802
808
|
}
|
|
803
809
|
}, [dropdownOpen]);
|
|
804
810
|
(0, import_react9.useEffect)(() => {
|
|
@@ -810,9 +816,7 @@ var EditForm = (0, import_react9.forwardRef)((props, ref) => {
|
|
|
810
816
|
}, [dropdownOpen, itemsField]);
|
|
811
817
|
const handleOnClick = () => {
|
|
812
818
|
if (dropdownOpen) {
|
|
813
|
-
|
|
814
|
-
closeMenu();
|
|
815
|
-
}
|
|
819
|
+
closeMenu();
|
|
816
820
|
} else {
|
|
817
821
|
setDropdownOpen(true);
|
|
818
822
|
}
|
|
@@ -871,16 +875,6 @@ var EditForm = (0, import_react9.forwardRef)((props, ref) => {
|
|
|
871
875
|
e.preventDefault();
|
|
872
876
|
}
|
|
873
877
|
};
|
|
874
|
-
const handleOnFocus = () => {
|
|
875
|
-
if (openOnFocus) {
|
|
876
|
-
setDropdownOpen(true);
|
|
877
|
-
if (field) {
|
|
878
|
-
setTimeout(() => {
|
|
879
|
-
focusElement(`form-element-${field}-0`, true);
|
|
880
|
-
}, 100);
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
};
|
|
884
878
|
const formKeyDown = (e, handSubmit) => {
|
|
885
879
|
if (e.code === "Enter") {
|
|
886
880
|
handSubmit();
|
|
@@ -1016,11 +1010,12 @@ var EditForm = (0, import_react9.forwardRef)((props, ref) => {
|
|
|
1016
1010
|
style: { backgroundColor: "#FFF", textAlign: textAlign ?? "left" },
|
|
1017
1011
|
placeholder,
|
|
1018
1012
|
innerRef: inputRef,
|
|
1019
|
-
className: (0, import_classnames6.default)("input-display
|
|
1013
|
+
className: (0, import_classnames6.default)("input-display input-numeric"),
|
|
1014
|
+
invalid,
|
|
1020
1015
|
value: displayValue,
|
|
1021
|
-
onFocus: handleOnFocus,
|
|
1022
1016
|
onClick: handleOnClick,
|
|
1023
1017
|
onKeyDown: (e) => handleOnKeyDown(e),
|
|
1018
|
+
onPaste: (e) => onPaste && onPaste(e),
|
|
1024
1019
|
readOnly: true
|
|
1025
1020
|
}
|
|
1026
1021
|
) }),
|
|
@@ -1603,7 +1598,8 @@ var SelectTable = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1603
1598
|
formatOptionLabel,
|
|
1604
1599
|
isMulti,
|
|
1605
1600
|
isDisabled,
|
|
1606
|
-
showFooter
|
|
1601
|
+
showFooter,
|
|
1602
|
+
onPaste
|
|
1607
1603
|
} = props;
|
|
1608
1604
|
const selectTableRef = (0, import_react13.useRef)();
|
|
1609
1605
|
const selectMenuTableRef = (0, import_react13.useRef)();
|
|
@@ -2046,7 +2042,6 @@ var SelectTable = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2046
2042
|
handleOpenClose();
|
|
2047
2043
|
}
|
|
2048
2044
|
},
|
|
2049
|
-
tabIndex: 0,
|
|
2050
2045
|
tag: "div",
|
|
2051
2046
|
className: (0, import_classnames11.default)("select-table-control", { "r-select-is-disabled": isDisabled }, { "r-select-is-open": dropdownOpen }, { "r-select-is-focus": isFocus }, { "r-select-is-invalid": invalid }),
|
|
2052
2047
|
children: [
|
|
@@ -2072,6 +2067,7 @@ var SelectTable = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2072
2067
|
className: (0, import_classnames11.default)("select-input"),
|
|
2073
2068
|
readOnly: isDisabled,
|
|
2074
2069
|
value: searchTerm,
|
|
2070
|
+
onPaste: (e) => onPaste && !dropdownOpen && onPaste(e),
|
|
2075
2071
|
onChange: (val) => {
|
|
2076
2072
|
if (!isMulti && loadOptions && val.target.value) {
|
|
2077
2073
|
setIsLoading(true);
|
|
@@ -2142,10 +2138,117 @@ var SelectTable = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
2142
2138
|
);
|
|
2143
2139
|
});
|
|
2144
2140
|
|
|
2145
|
-
// test-app/src/component/table/
|
|
2141
|
+
// test-app/src/component/table/header.tsx
|
|
2142
|
+
var import_react14 = require("react");
|
|
2143
|
+
var import_classnames12 = __toESM(require("classnames"));
|
|
2144
|
+
var import_reactstrap9 = require("reactstrap");
|
|
2145
|
+
var import_react_i18next10 = require("react-i18next");
|
|
2146
2146
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2147
|
-
var
|
|
2147
|
+
var HeaderTableCol = (props) => {
|
|
2148
|
+
const {
|
|
2149
|
+
selectEnable,
|
|
2150
|
+
dataSource,
|
|
2151
|
+
setSelectedRows,
|
|
2152
|
+
col,
|
|
2153
|
+
indexCol,
|
|
2154
|
+
indexParent,
|
|
2155
|
+
objWidthFix,
|
|
2156
|
+
totalCount,
|
|
2157
|
+
selectedRows,
|
|
2158
|
+
isMulti
|
|
2159
|
+
} = props;
|
|
2148
2160
|
const { t } = (0, import_react_i18next10.useTranslation)();
|
|
2161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react14.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2162
|
+
"th",
|
|
2163
|
+
{
|
|
2164
|
+
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
2165
|
+
colSpan: col.columns?.length ?? 1,
|
|
2166
|
+
className: (0, import_classnames12.default)(`r-headercell fix-${col.fixedType}`, { "cell-fixed": col.fixedType }),
|
|
2167
|
+
style: {
|
|
2168
|
+
top: `${indexParent * 42}px`,
|
|
2169
|
+
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2170
|
+
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2171
|
+
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
2172
|
+
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
2173
|
+
maxWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width
|
|
2174
|
+
},
|
|
2175
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2176
|
+
"div",
|
|
2177
|
+
{
|
|
2178
|
+
style: { justifyContent: col.textAlign ?? "left" },
|
|
2179
|
+
className: (0, import_classnames12.default)("r-headercell-div"),
|
|
2180
|
+
children: [
|
|
2181
|
+
col.field === "checkbox" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2182
|
+
import_reactstrap9.Input,
|
|
2183
|
+
{
|
|
2184
|
+
checked: totalCount > 0 && selectedRows?.length >= totalCount,
|
|
2185
|
+
type: "checkbox",
|
|
2186
|
+
className: (0, import_classnames12.default)("cursor-pointer", { "d-none": !isMulti }),
|
|
2187
|
+
style: { textAlign: col.textAlign ?? "left", marginTop: 6 },
|
|
2188
|
+
onChange: (e) => {
|
|
2189
|
+
if (selectEnable) {
|
|
2190
|
+
if (e.target.checked) {
|
|
2191
|
+
setSelectedRows(dataSource.map((item) => {
|
|
2192
|
+
return item;
|
|
2193
|
+
}));
|
|
2194
|
+
} else {
|
|
2195
|
+
setSelectedRows([]);
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
),
|
|
2201
|
+
col.field !== "checkbox" && t(col.headerText ?? "")
|
|
2202
|
+
]
|
|
2203
|
+
}
|
|
2204
|
+
)
|
|
2205
|
+
}
|
|
2206
|
+
) }, `header-${indexCol}`);
|
|
2207
|
+
};
|
|
2208
|
+
var header_default = HeaderTableCol;
|
|
2209
|
+
|
|
2210
|
+
// test-app/src/component/table/command.tsx
|
|
2211
|
+
var import_react15 = require("react");
|
|
2212
|
+
var import_classnames13 = __toESM(require("classnames"));
|
|
2213
|
+
var import_reactstrap10 = require("reactstrap");
|
|
2214
|
+
var import_react_i18next11 = require("react-i18next");
|
|
2215
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2216
|
+
var CommandElement = (props) => {
|
|
2217
|
+
const { commandItems, rowData, indexRow, handleCommandClick, indexFocus, setIndexFocus } = props;
|
|
2218
|
+
const { t } = (0, import_react_i18next11.useTranslation)();
|
|
2219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react15.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "d-flex align-items-center", style: { columnGap: 10 }, children: commandItems.map((item, index) => {
|
|
2220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2221
|
+
import_reactstrap10.Button,
|
|
2222
|
+
{
|
|
2223
|
+
id: `command-item-${indexRow}-${index}`,
|
|
2224
|
+
tabIndex: -1,
|
|
2225
|
+
style: { padding: "5px", minWidth: 45, height: "100%" },
|
|
2226
|
+
className: (0, import_classnames13.default)("command-item", {
|
|
2227
|
+
"btn-icon": item.tooltip === ""
|
|
2228
|
+
}),
|
|
2229
|
+
color: item.color ? item.color : "#000",
|
|
2230
|
+
onClick: (e) => {
|
|
2231
|
+
handleCommandClick(item.id, rowData, indexRow);
|
|
2232
|
+
if (indexRow === indexFocus) {
|
|
2233
|
+
setIndexFocus(void 0);
|
|
2234
|
+
}
|
|
2235
|
+
e.preventDefault();
|
|
2236
|
+
},
|
|
2237
|
+
children: [
|
|
2238
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(icon_default, { iconName: item.icon, size: 16 }),
|
|
2239
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_reactstrap10.UncontrolledTooltip, { className: "r-tooltip", target: `command-item-${indexRow}-${index}`, place: "top", children: t(item.tooltip ?? "") })
|
|
2240
|
+
]
|
|
2241
|
+
},
|
|
2242
|
+
`command-${index}`
|
|
2243
|
+
);
|
|
2244
|
+
}) }) });
|
|
2245
|
+
};
|
|
2246
|
+
var command_default = CommandElement;
|
|
2247
|
+
|
|
2248
|
+
// test-app/src/component/table/index.tsx
|
|
2249
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2250
|
+
var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
2251
|
+
const { t } = (0, import_react_i18next12.useTranslation)();
|
|
2149
2252
|
const {
|
|
2150
2253
|
idTable,
|
|
2151
2254
|
dataSource,
|
|
@@ -2173,36 +2276,36 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2173
2276
|
handleSelect,
|
|
2174
2277
|
isMulti
|
|
2175
2278
|
} = props;
|
|
2176
|
-
(0,
|
|
2279
|
+
(0, import_react16.useImperativeHandle)(ref, () => {
|
|
2177
2280
|
return {
|
|
2178
2281
|
refeshFocusRow: handleRefeshRow
|
|
2179
2282
|
};
|
|
2180
2283
|
});
|
|
2181
|
-
const [refreshRow, setRefreshRow] = (0,
|
|
2182
|
-
const [indexFocus, setIndexFocus] = (0,
|
|
2183
|
-
const [selectedRows, setSelectedRows] = (0,
|
|
2184
|
-
const [headerColumns, setHeaderColumns] = (0,
|
|
2185
|
-
const [contentColumns, setContentColumns] = (0,
|
|
2186
|
-
const [levelCol, setLevelCol] = (0,
|
|
2187
|
-
const [columnFistEdit, setColumnFistEdit] = (0,
|
|
2188
|
-
const [columnLastEdit, setColumnlastEdit] = (0,
|
|
2189
|
-
const [objWidthFix, setObjWidthFix] = (0,
|
|
2190
|
-
const [openPopupTree, setOpenPopupTree] = (0,
|
|
2191
|
-
const [openPopupSetupColumn, setOpenPopupSetupColumn] = (0,
|
|
2192
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
2193
|
-
const tableElement = (0,
|
|
2194
|
-
const gridRef = (0,
|
|
2284
|
+
const [refreshRow, setRefreshRow] = (0, import_react16.useState)(false);
|
|
2285
|
+
const [indexFocus, setIndexFocus] = (0, import_react16.useState)();
|
|
2286
|
+
const [selectedRows, setSelectedRows] = (0, import_react16.useState)([]);
|
|
2287
|
+
const [headerColumns, setHeaderColumns] = (0, import_react16.useState)([[]]);
|
|
2288
|
+
const [contentColumns, setContentColumns] = (0, import_react16.useState)([]);
|
|
2289
|
+
const [levelCol, setLevelCol] = (0, import_react16.useState)(0);
|
|
2290
|
+
const [columnFistEdit, setColumnFistEdit] = (0, import_react16.useState)(0);
|
|
2291
|
+
const [columnLastEdit, setColumnlastEdit] = (0, import_react16.useState)(0);
|
|
2292
|
+
const [objWidthFix, setObjWidthFix] = (0, import_react16.useState)({});
|
|
2293
|
+
const [openPopupTree, setOpenPopupTree] = (0, import_react16.useState)(false);
|
|
2294
|
+
const [openPopupSetupColumn, setOpenPopupSetupColumn] = (0, import_react16.useState)(false);
|
|
2295
|
+
const [searchTerm, setSearchTerm] = (0, import_react16.useState)("");
|
|
2296
|
+
const tableElement = (0, import_react16.useRef)(null);
|
|
2297
|
+
const gridRef = (0, import_react16.useRef)();
|
|
2195
2298
|
let totalCount = dataSource.length;
|
|
2196
2299
|
const pagingClient = pagingSetting?.allowPaging && (pagingSetting?.pagingClient || !(editDisable || addDisable));
|
|
2197
2300
|
const searchClient = searchSetting?.searchEnable && (searchSetting?.searchClient || !(editDisable || addDisable));
|
|
2198
2301
|
const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? "id";
|
|
2199
2302
|
const fieldUniKey = columns.filter((item) => item.isUnikey === true)?.map((item) => item.field);
|
|
2200
|
-
(0,
|
|
2303
|
+
(0, import_react16.useEffect)(() => {
|
|
2201
2304
|
if (pagingClient && pagingSetting.setCurrentPage && Math.ceil(totalCount / (pagingSetting?.pageSize ?? 1)) < (pagingSetting.currentPage ?? 1)) {
|
|
2202
2305
|
pagingSetting.setCurrentPage(1);
|
|
2203
2306
|
}
|
|
2204
2307
|
}, [dataSource]);
|
|
2205
|
-
(0,
|
|
2308
|
+
(0, import_react16.useEffect)(() => {
|
|
2206
2309
|
let indexFirst = -1;
|
|
2207
2310
|
let indexlast = -1;
|
|
2208
2311
|
let letfWidthFix = 0;
|
|
@@ -2235,7 +2338,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2235
2338
|
setColumnFistEdit(indexFirst + 1);
|
|
2236
2339
|
setColumnlastEdit(indexlast + 1);
|
|
2237
2340
|
}, [contentColumns]);
|
|
2238
|
-
(0,
|
|
2341
|
+
(0, import_react16.useEffect)(() => {
|
|
2239
2342
|
const arrHeaderColumns = [];
|
|
2240
2343
|
const arrContentColumns = [];
|
|
2241
2344
|
let headerLevelRow = 0;
|
|
@@ -2252,7 +2355,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2252
2355
|
setHeaderColumns(arrHeaderColumns);
|
|
2253
2356
|
setContentColumns(arrContentColumns);
|
|
2254
2357
|
}, [columns]);
|
|
2255
|
-
(0,
|
|
2358
|
+
(0, import_react16.useEffect)(() => {
|
|
2256
2359
|
const arrHeaderColumns = [];
|
|
2257
2360
|
const arrContentColumns = [];
|
|
2258
2361
|
let headerLevelRow = 0;
|
|
@@ -2363,7 +2466,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2363
2466
|
}
|
|
2364
2467
|
};
|
|
2365
2468
|
const searchTemplate = () => {
|
|
2366
|
-
return /* @__PURE__ */ (0,
|
|
2469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react16.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "me-50 r-search", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2367
2470
|
react_input_default,
|
|
2368
2471
|
{
|
|
2369
2472
|
style: { width: "230px" },
|
|
@@ -2384,8 +2487,8 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2384
2487
|
const renderEdit = (row, col, indexRow, indexCol) => {
|
|
2385
2488
|
switch (col?.editTypeCondition ? col?.editTypeCondition(row) : col.editType) {
|
|
2386
2489
|
case "date":
|
|
2387
|
-
return /* @__PURE__ */ (0,
|
|
2388
|
-
|
|
2490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2491
|
+
import_reactstrap11.Input,
|
|
2389
2492
|
{
|
|
2390
2493
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2391
2494
|
style: { textAlign: col.textAlign, height: 29 },
|
|
@@ -2397,7 +2500,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2397
2500
|
}
|
|
2398
2501
|
handleDataChange(row, col, indexRow);
|
|
2399
2502
|
},
|
|
2400
|
-
className: (0,
|
|
2503
|
+
className: (0, import_classnames14.default)("border-0 rounded-0", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2401
2504
|
type: "date",
|
|
2402
2505
|
max: "9999-12-31",
|
|
2403
2506
|
onKeyDown: (e) => {
|
|
@@ -2407,8 +2510,8 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2407
2510
|
}
|
|
2408
2511
|
);
|
|
2409
2512
|
case "datetime":
|
|
2410
|
-
return /* @__PURE__ */ (0,
|
|
2411
|
-
|
|
2513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2514
|
+
import_reactstrap11.Input,
|
|
2412
2515
|
{
|
|
2413
2516
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2414
2517
|
style: { textAlign: col.textAlign, height: 29 },
|
|
@@ -2420,7 +2523,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2420
2523
|
}
|
|
2421
2524
|
handleDataChange(row, col, indexRow);
|
|
2422
2525
|
},
|
|
2423
|
-
className: (0,
|
|
2526
|
+
className: (0, import_classnames14.default)("border-0 rounded-0", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2424
2527
|
type: "datetime-local",
|
|
2425
2528
|
max: "9999-12-31T23:59",
|
|
2426
2529
|
onKeyDown: (e) => {
|
|
@@ -2440,8 +2543,8 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2440
2543
|
if (!valueAsyncSelect && col.selectSettings?.defaultValue) {
|
|
2441
2544
|
valueAsyncSelect = col.selectSettings?.defaultValue(row);
|
|
2442
2545
|
}
|
|
2443
|
-
return /* @__PURE__ */ (0,
|
|
2444
|
-
/* @__PURE__ */ (0,
|
|
2546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: (0, import_classnames14.default)("d-flex select-group", { "is-invalid": col.validate && col.validate(row[col.field], row) }), children: [
|
|
2547
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2445
2548
|
import_async.default,
|
|
2446
2549
|
{
|
|
2447
2550
|
menuPosition: "fixed",
|
|
@@ -2460,14 +2563,14 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2460
2563
|
placeholder: t("Select"),
|
|
2461
2564
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2462
2565
|
loadOptions: col.selectSettings?.loadOptions,
|
|
2463
|
-
className: (0,
|
|
2566
|
+
className: (0, import_classnames14.default)("react-select"),
|
|
2464
2567
|
onKeyDown: (e) => {
|
|
2465
2568
|
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
2466
2569
|
}
|
|
2467
2570
|
}
|
|
2468
2571
|
}
|
|
2469
2572
|
),
|
|
2470
|
-
/* @__PURE__ */ (0,
|
|
2573
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2471
2574
|
"span",
|
|
2472
2575
|
{
|
|
2473
2576
|
onClick: () => {
|
|
@@ -2475,8 +2578,8 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2475
2578
|
col.selectSettings?.handAddNew("right");
|
|
2476
2579
|
}
|
|
2477
2580
|
},
|
|
2478
|
-
className: (0,
|
|
2479
|
-
children: /* @__PURE__ */ (0,
|
|
2581
|
+
className: (0, import_classnames14.default)("input-group-text", { "d-none": !col.selectSettings?.iconGroup }),
|
|
2582
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(icon_default, { iconName: col.selectSettings?.iconGroup ?? "", size: 16 })
|
|
2480
2583
|
}
|
|
2481
2584
|
)
|
|
2482
2585
|
] });
|
|
@@ -2493,7 +2596,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2493
2596
|
} else {
|
|
2494
2597
|
valueSelect = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? options?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
|
|
2495
2598
|
}
|
|
2496
|
-
return /* @__PURE__ */ (0,
|
|
2599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2497
2600
|
import_react_select3.default,
|
|
2498
2601
|
{
|
|
2499
2602
|
menuPosition: "fixed",
|
|
@@ -2512,7 +2615,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2512
2615
|
isClearable: col.selectSettings?.isClearable ?? false,
|
|
2513
2616
|
classNamePrefix: col.selectSettings?.widthPopup ? `select-${col.selectSettings?.widthPopup}` : "select",
|
|
2514
2617
|
placeholder: t("Select"),
|
|
2515
|
-
className: (0,
|
|
2618
|
+
className: (0, import_classnames14.default)("react-select", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2516
2619
|
onKeyDown: (e) => {
|
|
2517
2620
|
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
2518
2621
|
}
|
|
@@ -2532,7 +2635,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2532
2635
|
} else {
|
|
2533
2636
|
valueSelectTable = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? optionsSelectTable?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
|
|
2534
2637
|
}
|
|
2535
|
-
return /* @__PURE__ */ (0,
|
|
2638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2536
2639
|
SelectTable,
|
|
2537
2640
|
{
|
|
2538
2641
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2564,6 +2667,12 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2564
2667
|
onKeyDown: (e) => {
|
|
2565
2668
|
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
2566
2669
|
}
|
|
2670
|
+
},
|
|
2671
|
+
onPaste: (e) => {
|
|
2672
|
+
if (toolbarSetting?.showBottomToolbar && !editDisable && !addDisable) {
|
|
2673
|
+
pasteDataFromExcel(indexRow, indexCol, e);
|
|
2674
|
+
e.preventDefault();
|
|
2675
|
+
}
|
|
2567
2676
|
}
|
|
2568
2677
|
}
|
|
2569
2678
|
);
|
|
@@ -2582,14 +2691,14 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2582
2691
|
}
|
|
2583
2692
|
}
|
|
2584
2693
|
};
|
|
2585
|
-
return /* @__PURE__ */ (0,
|
|
2694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2586
2695
|
"div",
|
|
2587
2696
|
{
|
|
2588
2697
|
onKeyDown: (e) => {
|
|
2589
2698
|
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
2590
2699
|
}
|
|
2591
2700
|
},
|
|
2592
|
-
children: /* @__PURE__ */ (0,
|
|
2701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2593
2702
|
import_ej2_react_dropdowns.DropDownTreeComponent,
|
|
2594
2703
|
{
|
|
2595
2704
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2600,7 +2709,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2600
2709
|
parentValue: "parentId",
|
|
2601
2710
|
child: "children"
|
|
2602
2711
|
},
|
|
2603
|
-
className: (0,
|
|
2712
|
+
className: (0, import_classnames14.default)("select-tree", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2604
2713
|
allowFiltering: false,
|
|
2605
2714
|
value: valueSelectTree,
|
|
2606
2715
|
popupHeight: 250,
|
|
@@ -2628,8 +2737,8 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2628
2737
|
}
|
|
2629
2738
|
);
|
|
2630
2739
|
case "checkbox":
|
|
2631
|
-
return /* @__PURE__ */ (0,
|
|
2632
|
-
|
|
2740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2741
|
+
import_reactstrap11.Input,
|
|
2633
2742
|
{
|
|
2634
2743
|
checked: row[col.field],
|
|
2635
2744
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2651,13 +2760,13 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2651
2760
|
);
|
|
2652
2761
|
case "numeric":
|
|
2653
2762
|
let valueCurrency = row[col.field];
|
|
2654
|
-
return /* @__PURE__ */ (0,
|
|
2655
|
-
|
|
2763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2764
|
+
import_reactstrap11.Input,
|
|
2656
2765
|
{
|
|
2657
2766
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2658
2767
|
style: { textAlign: col.textAlign, height: 29 },
|
|
2659
2768
|
defaultValue: formartNumberic(valueCurrency, decimalSeparator, thousandSeparator, col.numericSettings?.fraction),
|
|
2660
|
-
className: (0,
|
|
2769
|
+
className: (0, import_classnames14.default)("border-0 rounded-0 input-numeric", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2661
2770
|
onChange: (val) => {
|
|
2662
2771
|
let newVal = "";
|
|
2663
2772
|
const flag = val.target?.value.startsWith("-");
|
|
@@ -2734,15 +2843,15 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2734
2843
|
},
|
|
2735
2844
|
onPaste: (e) => {
|
|
2736
2845
|
if (toolbarSetting?.showBottomToolbar && !editDisable && !addDisable) {
|
|
2737
|
-
pasteDataFromExcel(indexRow, indexCol);
|
|
2846
|
+
pasteDataFromExcel(indexRow, indexCol, e);
|
|
2738
2847
|
e.preventDefault();
|
|
2739
2848
|
}
|
|
2740
2849
|
}
|
|
2741
2850
|
}
|
|
2742
2851
|
);
|
|
2743
2852
|
case "color":
|
|
2744
|
-
return /* @__PURE__ */ (0,
|
|
2745
|
-
|
|
2853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2854
|
+
import_reactstrap11.Input,
|
|
2746
2855
|
{
|
|
2747
2856
|
type: "color",
|
|
2748
2857
|
value: row[col.field],
|
|
@@ -2764,7 +2873,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2764
2873
|
`col-${indexRow}-${indexCol}`
|
|
2765
2874
|
) });
|
|
2766
2875
|
case "form":
|
|
2767
|
-
return /* @__PURE__ */ (0,
|
|
2876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2768
2877
|
edit_form_default,
|
|
2769
2878
|
{
|
|
2770
2879
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2782,17 +2891,23 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2782
2891
|
textAlign: col.textAlign,
|
|
2783
2892
|
onKeyDown: (e) => {
|
|
2784
2893
|
return checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
2894
|
+
},
|
|
2895
|
+
onPaste: (e) => {
|
|
2896
|
+
if (toolbarSetting?.showBottomToolbar && !editDisable && !addDisable) {
|
|
2897
|
+
pasteDataFromExcel(indexRow, indexCol, e);
|
|
2898
|
+
e.preventDefault();
|
|
2899
|
+
}
|
|
2785
2900
|
}
|
|
2786
2901
|
}
|
|
2787
2902
|
);
|
|
2788
2903
|
default:
|
|
2789
|
-
return /* @__PURE__ */ (0,
|
|
2790
|
-
|
|
2904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2905
|
+
import_reactstrap11.Input,
|
|
2791
2906
|
{
|
|
2792
2907
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2793
2908
|
style: { textAlign: col.textAlign, height: 29 },
|
|
2794
2909
|
defaultValue: isNullOrUndefined(row[col.field]) ? "" : row[col.field],
|
|
2795
|
-
className: (0,
|
|
2910
|
+
className: (0, import_classnames14.default)("border-0 rounded-0 input-element", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2796
2911
|
onBlur: (val) => {
|
|
2797
2912
|
if (row[col.field] != val.target?.value) {
|
|
2798
2913
|
row[col.field] = val.target?.value;
|
|
@@ -2816,7 +2931,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2816
2931
|
},
|
|
2817
2932
|
onPaste: (e) => {
|
|
2818
2933
|
if (toolbarSetting?.showBottomToolbar && !editDisable && !addDisable) {
|
|
2819
|
-
pasteDataFromExcel(indexRow, indexCol);
|
|
2934
|
+
pasteDataFromExcel(indexRow, indexCol, e);
|
|
2820
2935
|
e.preventDefault();
|
|
2821
2936
|
}
|
|
2822
2937
|
}
|
|
@@ -2829,34 +2944,6 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
2829
2944
|
commandClick({ id, rowData, index });
|
|
2830
2945
|
}
|
|
2831
2946
|
};
|
|
2832
|
-
const renderCommand = (commandItems, rowData, i) => {
|
|
2833
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react14.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "d-flex align-items-center", style: { columnGap: 10 }, children: commandItems.map((item, index) => {
|
|
2834
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2835
|
-
import_reactstrap9.Button,
|
|
2836
|
-
{
|
|
2837
|
-
id: `command-item-${i}`,
|
|
2838
|
-
tabIndex: -1,
|
|
2839
|
-
style: { padding: "5px", minWidth: 45, height: "100%" },
|
|
2840
|
-
className: (0, import_classnames12.default)("command-item", {
|
|
2841
|
-
"btn-icon": item.tooltip === ""
|
|
2842
|
-
}),
|
|
2843
|
-
color: item.color ? item.color : "#000",
|
|
2844
|
-
onClick: (e) => {
|
|
2845
|
-
handleCommandClick(item.id, rowData, i);
|
|
2846
|
-
if (i === indexFocus) {
|
|
2847
|
-
setIndexFocus(void 0);
|
|
2848
|
-
}
|
|
2849
|
-
e.preventDefault();
|
|
2850
|
-
},
|
|
2851
|
-
children: [
|
|
2852
|
-
item.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(icon_default, { iconName: item.icon, size: 16 }),
|
|
2853
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_reactstrap9.UncontrolledTooltip, { className: "r-tooltip", target: `command-item-${i}`, place: "top", children: t(item.tooltip ?? "") })
|
|
2854
|
-
]
|
|
2855
|
-
},
|
|
2856
|
-
`command-${index}`
|
|
2857
|
-
);
|
|
2858
|
-
}) }) });
|
|
2859
|
-
};
|
|
2860
2947
|
const focusNewElement = (col, row, onLoad = false) => {
|
|
2861
2948
|
setTimeout(() => {
|
|
2862
2949
|
const element = document.getElementById(`${idTable}-col${col}-row${row}`);
|
|
@@ -3069,25 +3156,82 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3069
3156
|
changeDataSource([], false);
|
|
3070
3157
|
}
|
|
3071
3158
|
};
|
|
3072
|
-
const
|
|
3073
|
-
const
|
|
3159
|
+
const getColumn = (col, index) => {
|
|
3160
|
+
const column = contentColumns[col + index];
|
|
3161
|
+
if (column) {
|
|
3162
|
+
if (column.visible !== false) {
|
|
3163
|
+
return column;
|
|
3164
|
+
} else {
|
|
3165
|
+
return getColumn(col, index + 1);
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
return void 0;
|
|
3169
|
+
};
|
|
3170
|
+
const pasteDataFromExcel = async (row, col, e) => {
|
|
3171
|
+
const clipboard = (e.clipboardData || window.Clipboard).getData("text");
|
|
3074
3172
|
const arrayRow = clipboard.trimEnd().split("\n");
|
|
3075
|
-
|
|
3173
|
+
setIndexFocus(void 0);
|
|
3174
|
+
for (let indexRow = 0; indexRow < arrayRow.length; indexRow++) {
|
|
3175
|
+
const item = arrayRow[indexRow];
|
|
3076
3176
|
const arrayCol = item.trimEnd().split(" ");
|
|
3077
3177
|
let dataRow = dataSource[row + indexRow];
|
|
3078
3178
|
if (!dataRow) {
|
|
3079
3179
|
dataRow = { ...defaultValue };
|
|
3080
3180
|
dataSource.push(dataRow);
|
|
3081
3181
|
}
|
|
3082
|
-
arrayCol.
|
|
3083
|
-
const
|
|
3084
|
-
|
|
3085
|
-
|
|
3182
|
+
for (let index = 0; index < arrayCol.length; index++) {
|
|
3183
|
+
const stringData = arrayCol[index];
|
|
3184
|
+
const column = getColumn(col, index);
|
|
3185
|
+
if (column) {
|
|
3186
|
+
if ((!column.disabledCondition || !column.disabledCondition(row)) && column.editEnable) {
|
|
3187
|
+
if (column.onPaste) {
|
|
3188
|
+
const rs = await column.onPaste(stringData, indexRow, row);
|
|
3189
|
+
if (rs) {
|
|
3190
|
+
dataRow = rs.dataRow;
|
|
3191
|
+
dataRow[column.field] = stringData;
|
|
3192
|
+
if (column.callback) {
|
|
3193
|
+
column.callback(rs.value, indexRow);
|
|
3194
|
+
}
|
|
3195
|
+
} else {
|
|
3196
|
+
notificationError(t("PasteExcelNotExist", { index: row + indexRow + 1, field: t(column.headerText ?? ""), value: stringData }));
|
|
3197
|
+
}
|
|
3198
|
+
} else {
|
|
3199
|
+
if (column.editType === "date") {
|
|
3200
|
+
const date = new Date(stringData);
|
|
3201
|
+
if (!isNaN(date.getTime())) {
|
|
3202
|
+
dataRow[column.field] = date;
|
|
3203
|
+
} else {
|
|
3204
|
+
notificationError(t("PasteExcelIncorrectFormat", { index: row + indexRow + 1, field: t(column.headerText ?? ""), value: stringData }));
|
|
3205
|
+
}
|
|
3206
|
+
} else if (column.editType === "numeric") {
|
|
3207
|
+
const number = Number(stringData);
|
|
3208
|
+
if (!isNaN(number)) {
|
|
3209
|
+
dataRow[column.field] = number;
|
|
3210
|
+
} else {
|
|
3211
|
+
notificationError(t("PasteExcelIncorrectFormat", { index: row + indexRow + 1, field: t(column.headerText ?? ""), value: stringData }));
|
|
3212
|
+
}
|
|
3213
|
+
} else if (column.editType?.includes("select") && !column.selectSettings?.loadOptions) {
|
|
3214
|
+
let optionSelect = [];
|
|
3215
|
+
if (column.selectSettings?.optionsField) {
|
|
3216
|
+
optionSelect = dataRow[column.selectSettings?.optionsField] ? dataRow[column.selectSettings?.optionsField] : [];
|
|
3217
|
+
} else {
|
|
3218
|
+
optionSelect = column.selectSettings?.options ? column.selectSettings?.validateOption ? column.selectSettings?.options.filter((item2) => column.selectSettings?.validateOption(item2, row)) : column.selectSettings?.options : [];
|
|
3219
|
+
}
|
|
3220
|
+
let valueAsyncSelect = !isNullOrUndefined(dataRow[column.field]) && dataRow[column.field] !== "" ? optionSelect?.find((val) => val[column.selectSettings?.fieldValue ?? "value"] === dataRow[column.field]) : void 0;
|
|
3221
|
+
if (valueAsyncSelect) {
|
|
3222
|
+
dataRow[column.field] = stringData;
|
|
3223
|
+
} else {
|
|
3224
|
+
notificationError(t("PasteExcelNotExist", { index: row + indexRow + 1, field: t(column.headerText ?? ""), value: stringData }));
|
|
3225
|
+
}
|
|
3226
|
+
} else {
|
|
3227
|
+
dataRow[column.field] = stringData;
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3086
3231
|
}
|
|
3087
|
-
}
|
|
3232
|
+
}
|
|
3088
3233
|
rowChange(dataRow, row + indexRow, "");
|
|
3089
|
-
}
|
|
3090
|
-
handleRefeshRow();
|
|
3234
|
+
}
|
|
3091
3235
|
changeDataSource(dataSource);
|
|
3092
3236
|
};
|
|
3093
3237
|
const changeDataSource = (data, haveNew = false) => {
|
|
@@ -3107,7 +3251,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3107
3251
|
}
|
|
3108
3252
|
}
|
|
3109
3253
|
};
|
|
3110
|
-
(0,
|
|
3254
|
+
(0, import_react16.useEffect)(() => {
|
|
3111
3255
|
setIndexFocus(-1);
|
|
3112
3256
|
if (setSelectedItem) {
|
|
3113
3257
|
if (isMulti) {
|
|
@@ -3134,7 +3278,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3134
3278
|
}
|
|
3135
3279
|
}
|
|
3136
3280
|
}, [selectedRows]);
|
|
3137
|
-
(0,
|
|
3281
|
+
(0, import_react16.useEffect)(() => {
|
|
3138
3282
|
if (!isMulti) {
|
|
3139
3283
|
if (dataSource && selectedItem && selectedItem[fieldKey]) {
|
|
3140
3284
|
if (selectedRows?.length === 0 || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
|
|
@@ -3151,10 +3295,10 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3151
3295
|
}, [selectedItem]);
|
|
3152
3296
|
const renderContentCol = (col, row, indexRow, indexCol, isSelected) => {
|
|
3153
3297
|
if (col.field === "command") {
|
|
3154
|
-
return col.visible !== false && /* @__PURE__ */ (0,
|
|
3298
|
+
return col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3155
3299
|
"td",
|
|
3156
3300
|
{
|
|
3157
|
-
className: (0,
|
|
3301
|
+
className: (0, import_classnames14.default)(
|
|
3158
3302
|
`r-rowcell p-0 fix-${col.fixedType}`,
|
|
3159
3303
|
{ "cell-fixed": col.fixedType },
|
|
3160
3304
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -3164,15 +3308,15 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3164
3308
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
3165
3309
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
3166
3310
|
},
|
|
3167
|
-
children: /* @__PURE__ */ (0,
|
|
3311
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "r-rowcell-div ", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(command_default, { commandItems: col.commandItems ?? [], handleCommandClick, indexRow, rowData: row, setIndexFocus, indexFocus }) })
|
|
3168
3312
|
},
|
|
3169
3313
|
`col-${indexRow}-${indexCol}`
|
|
3170
3314
|
);
|
|
3171
3315
|
} else if (col.field === "#") {
|
|
3172
|
-
return col.visible !== false && /* @__PURE__ */ (0,
|
|
3316
|
+
return col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3173
3317
|
"td",
|
|
3174
3318
|
{
|
|
3175
|
-
className: (0,
|
|
3319
|
+
className: (0, import_classnames14.default)(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "r-active": isSelected && editDisable || indexFocus === indexRow }),
|
|
3176
3320
|
tabIndex: Number(`${indexRow}${indexCol}`),
|
|
3177
3321
|
style: {
|
|
3178
3322
|
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
@@ -3216,15 +3360,15 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3216
3360
|
e.stopPropagation();
|
|
3217
3361
|
}
|
|
3218
3362
|
},
|
|
3219
|
-
children: /* @__PURE__ */ (0,
|
|
3363
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "r-rowcell-div pt-50", children: indexRow + 1 })
|
|
3220
3364
|
},
|
|
3221
3365
|
`col-${indexRow}-${indexCol}`
|
|
3222
3366
|
);
|
|
3223
3367
|
} else if (col.field === "checkbox") {
|
|
3224
|
-
return /* @__PURE__ */ (0,
|
|
3368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3225
3369
|
"td",
|
|
3226
3370
|
{
|
|
3227
|
-
className: (0,
|
|
3371
|
+
className: (0, import_classnames14.default)(
|
|
3228
3372
|
`r-rowcell p-0 fix-${col.fixedType}`,
|
|
3229
3373
|
{ "cell-fixed": col.fixedType },
|
|
3230
3374
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -3234,7 +3378,7 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3234
3378
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
3235
3379
|
textAlign: col.textAlign ? col.textAlign : "center"
|
|
3236
3380
|
},
|
|
3237
|
-
children: /* @__PURE__ */ (0,
|
|
3381
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3238
3382
|
"div",
|
|
3239
3383
|
{
|
|
3240
3384
|
className: "r-rowcell-div cursor-pointer",
|
|
@@ -3258,8 +3402,8 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3258
3402
|
e.stopPropagation();
|
|
3259
3403
|
}
|
|
3260
3404
|
},
|
|
3261
|
-
children: /* @__PURE__ */ (0,
|
|
3262
|
-
|
|
3405
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3406
|
+
import_reactstrap11.Input,
|
|
3263
3407
|
{
|
|
3264
3408
|
checked: isSelected,
|
|
3265
3409
|
type: "checkbox",
|
|
@@ -3285,10 +3429,10 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3285
3429
|
}
|
|
3286
3430
|
const typeDis = !editDisable && (indexFocus === indexRow || col.editType === "checkbox") && (!col.disabledCondition || !col.disabledCondition(row)) ? col.editEnable ? 1 : col.template ? 2 : 3 : col.template ? 2 : 3;
|
|
3287
3431
|
const errorMessage = typeDis === 1 || col.field === "" || !col.validate ? "" : col.validate(row[col.field], row);
|
|
3288
|
-
return /* @__PURE__ */ (0,
|
|
3432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react16.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3289
3433
|
"td",
|
|
3290
3434
|
{
|
|
3291
|
-
className: (0,
|
|
3435
|
+
className: (0, import_classnames14.default)(
|
|
3292
3436
|
`r-rowcell fix-${col.fixedType}`,
|
|
3293
3437
|
{ "cell-fixed": col.fixedType },
|
|
3294
3438
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -3330,28 +3474,28 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3330
3474
|
e.stopPropagation();
|
|
3331
3475
|
}
|
|
3332
3476
|
},
|
|
3333
|
-
children: /* @__PURE__ */ (0,
|
|
3477
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3334
3478
|
"div",
|
|
3335
3479
|
{
|
|
3336
|
-
className: (0,
|
|
3480
|
+
className: (0, import_classnames14.default)("r-rowcell-div"),
|
|
3337
3481
|
style: {
|
|
3338
3482
|
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width
|
|
3339
3483
|
},
|
|
3340
|
-
children: /* @__PURE__ */ (0,
|
|
3484
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3341
3485
|
"div",
|
|
3342
3486
|
{
|
|
3343
3487
|
id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
|
|
3344
|
-
className: (0,
|
|
3488
|
+
className: (0, import_classnames14.default)("r-rowcell-content", { "r-is-invalid": errorMessage }),
|
|
3345
3489
|
style: {
|
|
3346
3490
|
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2,
|
|
3347
3491
|
color: col.editType === "numeric" && Number(row[col.field]) < 0 ? "red" : ""
|
|
3348
3492
|
},
|
|
3349
3493
|
children: [
|
|
3350
|
-
typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : /* @__PURE__ */ (0,
|
|
3351
|
-
/* @__PURE__ */ (0,
|
|
3352
|
-
!(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ (0,
|
|
3353
|
-
/* @__PURE__ */ (0,
|
|
3354
|
-
|
|
3494
|
+
typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
3495
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { id: `error-${indexRow}-${indexCol}`, className: (0, import_classnames14.default)("cursor-pointer text-primary icon-table", { "d-none": !errorMessage }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_becoxy_icons6.AlertCircle, { fontSize: 15.5 }) }),
|
|
3496
|
+
!(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_reactstrap11.UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3498
|
+
import_reactstrap11.UncontrolledTooltip,
|
|
3355
3499
|
{
|
|
3356
3500
|
target: `error-${indexRow}-${indexCol}`,
|
|
3357
3501
|
className: "r-tooltip tooltip-error",
|
|
@@ -3372,132 +3516,11 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3372
3516
|
const element = document.getElementById(`content-${idTable}-row${indexRow}col-${indexCol}`);
|
|
3373
3517
|
return element && element.scrollWidth > element.clientWidth;
|
|
3374
3518
|
};
|
|
3375
|
-
const renderHeaderCol = (col, indexCol, indexParent) => {
|
|
3376
|
-
if (col.field === "checkbox") {
|
|
3377
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react14.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3378
|
-
"th",
|
|
3379
|
-
{
|
|
3380
|
-
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
3381
|
-
colSpan: col.columns?.length ?? 1,
|
|
3382
|
-
className: (0, import_classnames12.default)(
|
|
3383
|
-
`r-headercell fix-${col.fixedType}`,
|
|
3384
|
-
{ "cell-fixed": col.fixedType }
|
|
3385
|
-
),
|
|
3386
|
-
style: {
|
|
3387
|
-
top: `${indexParent * 42}px`,
|
|
3388
|
-
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
3389
|
-
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
|
|
3390
|
-
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
3391
|
-
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
3392
|
-
maxWidth: col.maxWidth
|
|
3393
|
-
},
|
|
3394
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3395
|
-
"div",
|
|
3396
|
-
{
|
|
3397
|
-
style: { justifyContent: col.textAlign ?? "left" },
|
|
3398
|
-
className: (0, import_classnames12.default)("r-headercell-div"),
|
|
3399
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3400
|
-
import_reactstrap9.Input,
|
|
3401
|
-
{
|
|
3402
|
-
checked: totalCount > 0 && selectedRows?.length >= totalCount,
|
|
3403
|
-
type: "checkbox",
|
|
3404
|
-
className: (0, import_classnames12.default)("cursor-pointer", { "d-none": !isMulti }),
|
|
3405
|
-
style: { textAlign: col.textAlign ?? "left", marginTop: 6 },
|
|
3406
|
-
onChange: (e) => {
|
|
3407
|
-
if (selectEnable) {
|
|
3408
|
-
if (e.target.checked) {
|
|
3409
|
-
setSelectedRows(dataSource.map((item) => {
|
|
3410
|
-
return item;
|
|
3411
|
-
}));
|
|
3412
|
-
} else {
|
|
3413
|
-
setSelectedRows([]);
|
|
3414
|
-
}
|
|
3415
|
-
}
|
|
3416
|
-
}
|
|
3417
|
-
}
|
|
3418
|
-
)
|
|
3419
|
-
}
|
|
3420
|
-
)
|
|
3421
|
-
}
|
|
3422
|
-
) }, `header-${indexCol}`);
|
|
3423
|
-
} else if (col.field === "#") {
|
|
3424
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3425
|
-
import_react14.Fragment,
|
|
3426
|
-
{
|
|
3427
|
-
children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3428
|
-
"th",
|
|
3429
|
-
{
|
|
3430
|
-
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
3431
|
-
colSpan: col.columns?.length ?? 1,
|
|
3432
|
-
className: (0, import_classnames12.default)(
|
|
3433
|
-
`r-headercell fix-${col.fixedType}`,
|
|
3434
|
-
{ "cell-fixed": col.fixedType }
|
|
3435
|
-
),
|
|
3436
|
-
style: {
|
|
3437
|
-
width: 40,
|
|
3438
|
-
minWidth: 40,
|
|
3439
|
-
maxWidth: 40,
|
|
3440
|
-
top: `${indexParent * 42}px`,
|
|
3441
|
-
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
3442
|
-
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0
|
|
3443
|
-
},
|
|
3444
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3445
|
-
"div",
|
|
3446
|
-
{
|
|
3447
|
-
title: t(col.headerText ?? ""),
|
|
3448
|
-
style: { justifyContent: col.textAlign ?? "left" },
|
|
3449
|
-
className: "r-headercell-div",
|
|
3450
|
-
children: t(col.headerText ?? "")
|
|
3451
|
-
}
|
|
3452
|
-
)
|
|
3453
|
-
}
|
|
3454
|
-
)
|
|
3455
|
-
},
|
|
3456
|
-
`header-${indexCol}`
|
|
3457
|
-
);
|
|
3458
|
-
} else {
|
|
3459
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3460
|
-
import_react14.Fragment,
|
|
3461
|
-
{
|
|
3462
|
-
children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3463
|
-
"th",
|
|
3464
|
-
{
|
|
3465
|
-
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
3466
|
-
colSpan: col.columns?.length ?? 1,
|
|
3467
|
-
className: (0, import_classnames12.default)(
|
|
3468
|
-
`r-headercell fix-${col.fixedType}`,
|
|
3469
|
-
{ "cell-fixed": col.fixedType }
|
|
3470
|
-
),
|
|
3471
|
-
style: {
|
|
3472
|
-
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
3473
|
-
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
3474
|
-
top: `${indexParent * 42}px`,
|
|
3475
|
-
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
3476
|
-
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
|
|
3477
|
-
maxWidth: col.maxWidth
|
|
3478
|
-
},
|
|
3479
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3480
|
-
"div",
|
|
3481
|
-
{
|
|
3482
|
-
role: "textbox",
|
|
3483
|
-
title: t(col.headerText ?? ""),
|
|
3484
|
-
style: { justifyContent: col.textAlign ?? "left" },
|
|
3485
|
-
className: "r-headercell-div",
|
|
3486
|
-
children: t(col.headerText ?? "")
|
|
3487
|
-
}
|
|
3488
|
-
)
|
|
3489
|
-
}
|
|
3490
|
-
)
|
|
3491
|
-
},
|
|
3492
|
-
`header-${indexCol}`
|
|
3493
|
-
);
|
|
3494
|
-
}
|
|
3495
|
-
};
|
|
3496
3519
|
const renderFooterCol = (col, indexCol) => {
|
|
3497
|
-
return /* @__PURE__ */ (0,
|
|
3520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react16.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3498
3521
|
"td",
|
|
3499
3522
|
{
|
|
3500
|
-
className: (0,
|
|
3523
|
+
className: (0, import_classnames14.default)(
|
|
3501
3524
|
`p-0 px-50 r-footer fix-${col.fixedType}`,
|
|
3502
3525
|
{ "cell-fixed": col.fixedType }
|
|
3503
3526
|
),
|
|
@@ -3509,56 +3532,56 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3509
3532
|
maxWidth: col.maxWidth,
|
|
3510
3533
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
3511
3534
|
},
|
|
3512
|
-
children: /* @__PURE__ */ (0,
|
|
3535
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "r-footer-div", children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource.reduce(function(accumulator, currentValue) {
|
|
3513
3536
|
return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
|
|
3514
3537
|
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : "" })
|
|
3515
3538
|
}
|
|
3516
3539
|
) }, `summarycell-${indexCol}`);
|
|
3517
3540
|
};
|
|
3518
3541
|
const renderToolbarTop = () => {
|
|
3519
|
-
return /* @__PURE__ */ (0,
|
|
3520
|
-
/* @__PURE__ */ (0,
|
|
3521
|
-
return item.align === "left" ? /* @__PURE__ */ (0,
|
|
3542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id: "table_custom_top_toolbar", className: "r-toolbar r-toolbar-top", "aria-orientation": "horizontal", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "r-toolbar-items", children: [
|
|
3543
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
|
|
3544
|
+
return item.align === "left" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) : "";
|
|
3522
3545
|
}) }),
|
|
3523
|
-
/* @__PURE__ */ (0,
|
|
3524
|
-
return item.align === "center" ? /* @__PURE__ */ (0,
|
|
3546
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
|
|
3547
|
+
return item.align === "center" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-center-${index}`) : "";
|
|
3525
3548
|
}) }),
|
|
3526
|
-
/* @__PURE__ */ (0,
|
|
3527
|
-
return item.align === "right" ? /* @__PURE__ */ (0,
|
|
3549
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
|
|
3550
|
+
return item.align === "right" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-right-${index}`) : "";
|
|
3528
3551
|
}) })
|
|
3529
3552
|
] }) });
|
|
3530
3553
|
};
|
|
3531
3554
|
const renderToolbarBottom = () => {
|
|
3532
|
-
return /* @__PURE__ */ (0,
|
|
3533
|
-
/* @__PURE__ */ (0,
|
|
3534
|
-
/* @__PURE__ */ (0,
|
|
3535
|
-
(indexFocus ?? -1) > -1 ? /* @__PURE__ */ (0,
|
|
3536
|
-
/* @__PURE__ */ (0,
|
|
3555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "r-toolbar-items", children: [
|
|
3556
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "r-toolbar-left", children: [
|
|
3557
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: (0, import_classnames14.default)("r-toolbar-item", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_reactstrap11.Button, { color: "success", outline: true, onClick: handleAdd, className: "d-flex", children: t("Add item") }) }),
|
|
3558
|
+
(indexFocus ?? -1) > -1 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3559
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: (0, import_classnames14.default)("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_reactstrap11.Button, { color: "success", outline: true, onClick: () => {
|
|
3537
3560
|
handleDuplicate(dataSource[indexFocus ?? -1], indexFocus ?? -1);
|
|
3538
3561
|
}, className: "d-flex", children: t("Duplicate") }) }),
|
|
3539
|
-
/* @__PURE__ */ (0,
|
|
3540
|
-
/* @__PURE__ */ (0,
|
|
3541
|
-
] }) : /* @__PURE__ */ (0,
|
|
3542
|
-
/* @__PURE__ */ (0,
|
|
3562
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: (0, import_classnames14.default)("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertBeforeDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_reactstrap11.Button, { color: "success", outline: true, onClick: handleInsertBefore, className: "d-flex", children: t("Insert item before") }) }),
|
|
3563
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: (0, import_classnames14.default)("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertAfterDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_reactstrap11.Button, { color: "success", outline: true, onClick: handleInsertAfter, className: "d-flex", children: t("Insert item after") }) })
|
|
3564
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: " " }),
|
|
3565
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: (0, import_classnames14.default)("r-toolbar-item", { "d-none": editDisable || buttonSetting?.deleteAllDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_reactstrap11.Button, { color: "primary", outline: true, onClick: handleDeleteAll, className: "d-flex", children: t("Delete all item") }) }),
|
|
3543
3566
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
3544
|
-
return item.align === "left" ? /* @__PURE__ */ (0,
|
|
3567
|
+
return item.align === "left" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`) : "";
|
|
3545
3568
|
})
|
|
3546
3569
|
] }),
|
|
3547
|
-
/* @__PURE__ */ (0,
|
|
3548
|
-
return item.align === "center" ? /* @__PURE__ */ (0,
|
|
3570
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "r-toolbar-center", children: toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
3571
|
+
return item.align === "center" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : "";
|
|
3549
3572
|
}) }),
|
|
3550
|
-
/* @__PURE__ */ (0,
|
|
3573
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "r-toolbar-right", children: [
|
|
3551
3574
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
3552
|
-
return item.align === "right" ? /* @__PURE__ */ (0,
|
|
3575
|
+
return item.align === "right" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : "";
|
|
3553
3576
|
}),
|
|
3554
|
-
/* @__PURE__ */ (0,
|
|
3555
|
-
/* @__PURE__ */ (0,
|
|
3556
|
-
/* @__PURE__ */ (0,
|
|
3557
|
-
/* @__PURE__ */ (0,
|
|
3558
|
-
/* @__PURE__ */ (0,
|
|
3559
|
-
/* @__PURE__ */ (0,
|
|
3560
|
-
/* @__PURE__ */ (0,
|
|
3561
|
-
/* @__PURE__ */ (0,
|
|
3577
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: (0, import_classnames14.default)("r-toolbar-item me-25", { "d-none": headerColumns.length > 1 }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_becoxy_icons6.Settings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }),
|
|
3578
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: (0, import_classnames14.default)("r-toolbar-item me-25", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_reactstrap11.UncontrolledDropdown, { className: "dropdown-user nav-item", children: [
|
|
3579
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_reactstrap11.DropdownToggle, { href: "/", tag: "a", color: "info", onClick: (e) => e.preventDefault(), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_becoxy_icons6.Info, { className: "cursor-pointer" }) }),
|
|
3580
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_reactstrap11.DropdownMenu, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "d-flex flex-column p-50 py-25", children: [
|
|
3581
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\xE0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\xE0ng v\xE0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\xE2n b\u1EA3n" }),
|
|
3582
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontSize: 13 }, children: "Ch\u1ECDn \xF4 v\xE0 Ctrl + V \u0111\u1EC3 d\xE1n th\xF4ng tin t\u1EEB excel" }),
|
|
3583
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\xE0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\xE0ng v\xE0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\xE9p h\xE0ng" }),
|
|
3584
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\xE0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\xE0ng v\xE0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\xE1n h\xE0ng" })
|
|
3562
3585
|
] }) })
|
|
3563
3586
|
] }) })
|
|
3564
3587
|
] })
|
|
@@ -3587,10 +3610,10 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3587
3610
|
const flagDisplay = !pagingClient || totalCount > (pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0) - 1) && totalCount <= (pagingSetting.pageSize ?? 0) * (pagingSetting.currentPage ?? 0);
|
|
3588
3611
|
if (flagDisplay) {
|
|
3589
3612
|
countDisplay++;
|
|
3590
|
-
return /* @__PURE__ */ (0,
|
|
3613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3591
3614
|
"tr",
|
|
3592
3615
|
{
|
|
3593
|
-
className: (0,
|
|
3616
|
+
className: (0, import_classnames14.default)("r-row", { "fisrt-row": countDisplay === 0 }),
|
|
3594
3617
|
children: contentColumns.map((col, indexCol) => {
|
|
3595
3618
|
return renderContentCol(col, row, indexRow, indexCol, isSelected);
|
|
3596
3619
|
})
|
|
@@ -3601,29 +3624,43 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3601
3624
|
}
|
|
3602
3625
|
});
|
|
3603
3626
|
};
|
|
3604
|
-
(0,
|
|
3627
|
+
(0, import_react16.useEffect)(() => {
|
|
3605
3628
|
if (pagingClient && pagingSetting?.setCurrentPage && (searchSetting?.searchTerm !== void 0 ? searchSetting?.searchTerm : searchTerm)) {
|
|
3606
3629
|
pagingSetting?.setCurrentPage(1);
|
|
3607
3630
|
}
|
|
3608
3631
|
}, [searchTerm, searchSetting?.searchTerm]);
|
|
3609
|
-
return /* @__PURE__ */ (0,
|
|
3610
|
-
/* @__PURE__ */ (0,
|
|
3611
|
-
/* @__PURE__ */ (0,
|
|
3612
|
-
toolbarSetting?.showTopToolbar ? /* @__PURE__ */ (0,
|
|
3613
|
-
/* @__PURE__ */ (0,
|
|
3614
|
-
/* @__PURE__ */ (0,
|
|
3615
|
-
return /* @__PURE__ */ (0,
|
|
3616
|
-
return
|
|
3632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react16.Fragment, { children: [
|
|
3633
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "react-table-edit", children: [
|
|
3634
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "r-grid", ref: gridRef, children: [
|
|
3635
|
+
toolbarSetting?.showTopToolbar ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: renderToolbarTop() }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, {}),
|
|
3636
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref: tableElement, className: "r-gridtable", style: { height: `${height ? `${height}px` : "auto"}`, minHeight: `${minHeight ? `${minHeight}px` : ""}`, maxHeight: `${maxHeight ? `${maxHeight}px` : "400px"}` }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("table", { style: { width: "100%" }, children: [
|
|
3637
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("thead", { className: "r-gridheader", children: headerColumns.map((element, indexParent) => {
|
|
3638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
3639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3640
|
+
header_default,
|
|
3641
|
+
{
|
|
3642
|
+
col,
|
|
3643
|
+
dataSource,
|
|
3644
|
+
indexCol: index,
|
|
3645
|
+
indexParent,
|
|
3646
|
+
isMulti: isMulti ?? false,
|
|
3647
|
+
objWidthFix,
|
|
3648
|
+
selectEnable: selectEnable ?? false,
|
|
3649
|
+
selectedRows,
|
|
3650
|
+
setSelectedRows,
|
|
3651
|
+
totalCount
|
|
3652
|
+
}
|
|
3653
|
+
);
|
|
3617
3654
|
}) }, indexParent);
|
|
3618
3655
|
}) }),
|
|
3619
|
-
/* @__PURE__ */ (0,
|
|
3620
|
-
/* @__PURE__ */ (0,
|
|
3656
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tbody", { className: "r-gridcontent", children: renderData() }),
|
|
3657
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tfoot", { className: "r-gridfoot", children: haveSum == true ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tr", { className: "r-row", children: contentColumns.map((col, index) => {
|
|
3621
3658
|
return renderFooterCol(col, index);
|
|
3622
|
-
}) }) : /* @__PURE__ */ (0,
|
|
3659
|
+
}) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, {}) })
|
|
3623
3660
|
] }) }),
|
|
3624
|
-
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ (0,
|
|
3661
|
+
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: renderToolbarBottom() }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, {})
|
|
3625
3662
|
] }),
|
|
3626
|
-
pagingSetting?.allowPaging ? /* @__PURE__ */ (0,
|
|
3663
|
+
pagingSetting?.allowPaging ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3627
3664
|
PagingComponent,
|
|
3628
3665
|
{
|
|
3629
3666
|
onChangePage,
|
|
@@ -3633,9 +3670,9 @@ var TableEdit = (0, import_react14.forwardRef)((props, ref) => {
|
|
|
3633
3670
|
totalItem: pagingClient ? totalCount : pagingSetting?.totalItem ?? 0,
|
|
3634
3671
|
onChangePageSize
|
|
3635
3672
|
}
|
|
3636
|
-
) : /* @__PURE__ */ (0,
|
|
3673
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, {})
|
|
3637
3674
|
] }),
|
|
3638
|
-
/* @__PURE__ */ (0,
|
|
3675
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3639
3676
|
sidebar_setting_column_default,
|
|
3640
3677
|
{
|
|
3641
3678
|
handleSidebar: () => {
|
|
@@ -3652,11 +3689,11 @@ var table_default = TableEdit;
|
|
|
3652
3689
|
|
|
3653
3690
|
// test-app/src/component/tab-menu/index.tsx
|
|
3654
3691
|
var import_becoxy_icons7 = require("becoxy-icons");
|
|
3655
|
-
var
|
|
3656
|
-
var
|
|
3692
|
+
var import_classnames15 = __toESM(require("classnames"));
|
|
3693
|
+
var import_react17 = require("react");
|
|
3657
3694
|
var import_react_router_dom = require("react-router-dom");
|
|
3658
|
-
var
|
|
3659
|
-
var
|
|
3695
|
+
var import_reactstrap12 = require("reactstrap");
|
|
3696
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3660
3697
|
var TabsMenuComponent = ({
|
|
3661
3698
|
buttonWidth,
|
|
3662
3699
|
tabParent,
|
|
@@ -3668,14 +3705,14 @@ var TabsMenuComponent = ({
|
|
|
3668
3705
|
renderModal
|
|
3669
3706
|
}) => {
|
|
3670
3707
|
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
3671
|
-
const [dataMenu, setDataMenu] = (0,
|
|
3672
|
-
const [openMenu, setOpenMenu] = (0,
|
|
3673
|
-
const [url, setUrl] = (0,
|
|
3674
|
-
const [contentWidth, setContentWidth] = (0,
|
|
3675
|
-
const [componentWidth, setComponentWidth] = (0,
|
|
3676
|
-
const [scrollPosition, setScrollPosition] = (0,
|
|
3677
|
-
const [dataItem, setDataItem] = (0,
|
|
3678
|
-
const [openModal, setOpenModal] = (0,
|
|
3708
|
+
const [dataMenu, setDataMenu] = (0, import_react17.useState)([]);
|
|
3709
|
+
const [openMenu, setOpenMenu] = (0, import_react17.useState)(false);
|
|
3710
|
+
const [url, setUrl] = (0, import_react17.useState)("");
|
|
3711
|
+
const [contentWidth, setContentWidth] = (0, import_react17.useState)(0);
|
|
3712
|
+
const [componentWidth, setComponentWidth] = (0, import_react17.useState)(0);
|
|
3713
|
+
const [scrollPosition, setScrollPosition] = (0, import_react17.useState)(0);
|
|
3714
|
+
const [dataItem, setDataItem] = (0, import_react17.useState)([]);
|
|
3715
|
+
const [openModal, setOpenModal] = (0, import_react17.useState)({});
|
|
3679
3716
|
const handleWindowResize = () => {
|
|
3680
3717
|
const tabEle = document.getElementById(`tab-component-${resourceCode}`);
|
|
3681
3718
|
const tabContent = document.getElementById(`content-component-${resourceCode}`);
|
|
@@ -3684,7 +3721,7 @@ var TabsMenuComponent = ({
|
|
|
3684
3721
|
setContentWidth(tabContent?.offsetWidth ?? 0);
|
|
3685
3722
|
}
|
|
3686
3723
|
};
|
|
3687
|
-
(0,
|
|
3724
|
+
(0, import_react17.useEffect)(() => {
|
|
3688
3725
|
setUrl(window.location.pathname);
|
|
3689
3726
|
window.addEventListener("resize", handleWindowResize);
|
|
3690
3727
|
setTimeout(() => {
|
|
@@ -3700,7 +3737,7 @@ var TabsMenuComponent = ({
|
|
|
3700
3737
|
window.removeEventListener("resize", handleWindowResize);
|
|
3701
3738
|
};
|
|
3702
3739
|
}, []);
|
|
3703
|
-
(0,
|
|
3740
|
+
(0, import_react17.useEffect)(() => {
|
|
3704
3741
|
const item = resources?.find((x) => x.code === (resourceCodeParent ? resourceCodeParent : resourceCode));
|
|
3705
3742
|
if (item) {
|
|
3706
3743
|
if (resourceCodeParent) {
|
|
@@ -3731,23 +3768,23 @@ var TabsMenuComponent = ({
|
|
|
3731
3768
|
const handleModal = (name) => {
|
|
3732
3769
|
setOpenModal((old) => ({ ...old, [name]: !(openModal[name] ?? false) }));
|
|
3733
3770
|
};
|
|
3734
|
-
return /* @__PURE__ */ (0,
|
|
3771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react17.Fragment, { children: [
|
|
3735
3772
|
renderModal ? renderModal({ handleModal, windowSize, openModal, setDataItem, dataItem }) : "",
|
|
3736
|
-
/* @__PURE__ */ (0,
|
|
3737
|
-
/* @__PURE__ */ (0,
|
|
3773
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: (0, import_classnames15.default)("tab-custom", { "tab-parent": tabParent }, { "tab-child": tabChild }), style: { width: `calc(100% - ${buttonWidth ?? 100}px` }, children: [
|
|
3774
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3738
3775
|
"div",
|
|
3739
3776
|
{
|
|
3740
3777
|
onClick: () => handleScroll(-200),
|
|
3741
|
-
className: (0,
|
|
3742
|
-
children: /* @__PURE__ */ (0,
|
|
3778
|
+
className: (0, import_classnames15.default)("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3779
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_becoxy_icons7.ChevronLeft, {})
|
|
3743
3780
|
}
|
|
3744
3781
|
),
|
|
3745
|
-
/* @__PURE__ */ (0,
|
|
3782
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { id: `tab-component-${resourceCode}`, className: "tab-component", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { id: `content-component-${resourceCode}`, children: dataMenu.map((item) => {
|
|
3746
3783
|
if (item?.resAttributes?.IS_MENU === "1") {
|
|
3747
|
-
return /* @__PURE__ */ (0,
|
|
3748
|
-
/* @__PURE__ */ (0,
|
|
3749
|
-
/* @__PURE__ */ (0,
|
|
3750
|
-
|
|
3784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_reactstrap12.UncontrolledDropdown, { className: "tab-custom-item", isOpen: openMenu, toggle: toggleMenu, direction: "down", style: { backgroundColor: openMenu ? "#e0e0e0" : "" }, children: [
|
|
3785
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_reactstrap12.DropdownToggle, { color: "#00000", style: { border: "none", boxShadow: "none", margin: 0, padding: 0 }, className: "background-none", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: item.name }) }),
|
|
3786
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_reactstrap12.DropdownMenu, { container: document.body, end: true, style: { width: 300 }, children: item?.children?.map((x) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3787
|
+
import_reactstrap12.DropdownItem,
|
|
3751
3788
|
{
|
|
3752
3789
|
style: { borderRadius: "5px", margin: "0 0.5rem", width: "95%" },
|
|
3753
3790
|
onClick: () => {
|
|
@@ -3763,23 +3800,23 @@ var TabsMenuComponent = ({
|
|
|
3763
3800
|
)) })
|
|
3764
3801
|
] }, item.code);
|
|
3765
3802
|
} else {
|
|
3766
|
-
return /* @__PURE__ */ (0,
|
|
3803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3767
3804
|
import_react_router_dom.Link,
|
|
3768
3805
|
{
|
|
3769
3806
|
to: item.url,
|
|
3770
|
-
className: (0,
|
|
3807
|
+
className: (0, import_classnames15.default)("tab-custom-item", { active: item.url === url || tabParent && url?.split("/").length > 3 && item.url.startsWith(url.substring(0, url.lastIndexOf("/"))) }),
|
|
3771
3808
|
children: item.name
|
|
3772
3809
|
},
|
|
3773
3810
|
item.code
|
|
3774
3811
|
);
|
|
3775
3812
|
}
|
|
3776
3813
|
}) }) }),
|
|
3777
|
-
/* @__PURE__ */ (0,
|
|
3814
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3778
3815
|
"div",
|
|
3779
3816
|
{
|
|
3780
3817
|
onClick: () => handleScroll(200),
|
|
3781
|
-
className: (0,
|
|
3782
|
-
children: /* @__PURE__ */ (0,
|
|
3818
|
+
className: (0, import_classnames15.default)("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3819
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_becoxy_icons7.ChevronRight, {})
|
|
3783
3820
|
}
|
|
3784
3821
|
)
|
|
3785
3822
|
] })
|
|
@@ -3787,7 +3824,7 @@ var TabsMenuComponent = ({
|
|
|
3787
3824
|
};
|
|
3788
3825
|
|
|
3789
3826
|
// index.ts
|
|
3790
|
-
var
|
|
3827
|
+
var Table_Edit_default = table_default;
|
|
3791
3828
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3792
3829
|
0 && (module.exports = {
|
|
3793
3830
|
SelectTable,
|