react-table-edit 0.9.7 → 0.9.8
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 +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +834 -235
- package/dist/index.mjs +835 -228
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// test-app/src/component/table/index.tsx
|
|
2
|
-
import { Fragment as
|
|
3
|
-
import { Button as
|
|
4
|
-
import
|
|
5
|
-
import { useTranslation as
|
|
2
|
+
import { Fragment as Fragment19, forwardRef as forwardRef4, useEffect as useEffect9, useImperativeHandle, useRef as useRef4, useState as useState8 } from "react";
|
|
3
|
+
import { Button as Button6, DropdownMenu as DropdownMenu4, DropdownToggle as DropdownToggle4, Input as Input9, UncontrolledDropdown, UncontrolledTooltip as UncontrolledTooltip5 } from "reactstrap";
|
|
4
|
+
import classnames9 from "classnames";
|
|
5
|
+
import { useTranslation as useTranslation12 } from "react-i18next";
|
|
6
6
|
import { AlertCircle, Info as Info2, Settings } from "becoxy-icons";
|
|
7
7
|
|
|
8
8
|
// test-app/src/component/react-input/index.tsx
|
|
@@ -276,7 +276,7 @@ var roundNumber = (num, fraction) => {
|
|
|
276
276
|
};
|
|
277
277
|
|
|
278
278
|
// test-app/src/component/table/index.tsx
|
|
279
|
-
import
|
|
279
|
+
import moment3 from "moment";
|
|
280
280
|
|
|
281
281
|
// test-app/src/component/edit-form/index.tsx
|
|
282
282
|
import { forwardRef as forwardRef2, useEffect as useEffect4, useRef as useRef2, useState as useState3 } from "react";
|
|
@@ -527,7 +527,7 @@ import classnames4 from "classnames";
|
|
|
527
527
|
import { Fragment as Fragment7 } from "react";
|
|
528
528
|
|
|
529
529
|
// test-app/src/component/select-table/index.tsx
|
|
530
|
-
import { forwardRef, Fragment as Fragment5, useEffect as useEffect3, useMemo, useRef, useState as useState2 } from "react";
|
|
530
|
+
import React, { forwardRef, Fragment as Fragment5, useEffect as useEffect3, useMemo, useRef, useState as useState2 } from "react";
|
|
531
531
|
import {
|
|
532
532
|
DropdownItem,
|
|
533
533
|
DropdownMenu,
|
|
@@ -655,9 +655,6 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
655
655
|
let key = "";
|
|
656
656
|
if (onKeyDown && (!dropdownOpen || !listKeyUse.includes(e.code) || (e.code === "Enter" || e.code === "Tab" || e.code === "NumpadEnter" || e.code === "Space") && !(optionsLoad ? optionsLoad : options)[indexFocus] || (e.code === "ArrowDown" || e.code === "ArrowUp") && (optionsLoad?.length ?? 0) === 0 && options.length === 0 || e.code === "Escape" && !(isClearable && value && !isDisabled))) {
|
|
657
657
|
key = onKeyDown(e);
|
|
658
|
-
if (key === "ArrowRight" || key === "ArrowLeft") {
|
|
659
|
-
closeMenu();
|
|
660
|
-
}
|
|
661
658
|
}
|
|
662
659
|
let flag = false;
|
|
663
660
|
if (!key) {
|
|
@@ -821,7 +818,7 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
821
818
|
const element = document.getElementById(`select-${id}-${indexRow}-${indexCol}`);
|
|
822
819
|
return element && element.scrollWidth > element.clientWidth;
|
|
823
820
|
};
|
|
824
|
-
const RenderElement = (props2) => {
|
|
821
|
+
const RenderElement = React.memo((props2) => {
|
|
825
822
|
const { indexRow, row, isSelected, level = 0 } = props2;
|
|
826
823
|
return /* @__PURE__ */ jsxs5(
|
|
827
824
|
"tr",
|
|
@@ -840,13 +837,11 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
840
837
|
const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
|
|
841
838
|
if (index > -1) {
|
|
842
839
|
value?.splice(index, 1);
|
|
843
|
-
|
|
844
|
-
onChange(valueArr);
|
|
840
|
+
onChange([...value]);
|
|
845
841
|
} else {
|
|
846
842
|
if (value) {
|
|
847
843
|
value?.push(row[fieldValue ?? "value"]);
|
|
848
|
-
|
|
849
|
-
onChange(valueArr);
|
|
844
|
+
onChange([...value]);
|
|
850
845
|
} else {
|
|
851
846
|
onChange([row[fieldValue ?? "value"]]);
|
|
852
847
|
}
|
|
@@ -893,13 +888,11 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
893
888
|
const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
|
|
894
889
|
if (index > -1) {
|
|
895
890
|
value?.splice(index, 1);
|
|
896
|
-
|
|
897
|
-
onChange(valueArr);
|
|
891
|
+
onChange([...value]);
|
|
898
892
|
} else {
|
|
899
893
|
if (value) {
|
|
900
894
|
value?.push(row[fieldValue ?? "value"]);
|
|
901
|
-
|
|
902
|
-
onChange(valueArr);
|
|
895
|
+
onChange([...value]);
|
|
903
896
|
} else {
|
|
904
897
|
onChange([row[fieldValue ?? "value"]]);
|
|
905
898
|
}
|
|
@@ -929,7 +922,7 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
929
922
|
},
|
|
930
923
|
`row-${indexRow}`
|
|
931
924
|
);
|
|
932
|
-
};
|
|
925
|
+
});
|
|
933
926
|
const RenderTable = (props2) => {
|
|
934
927
|
const {} = props2;
|
|
935
928
|
let countDisplay = 0;
|
|
@@ -951,7 +944,7 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
951
944
|
if (isSelectedAll) {
|
|
952
945
|
onChange([]);
|
|
953
946
|
} else {
|
|
954
|
-
onChange([...optionsLoad ? optionsLoad : options]);
|
|
947
|
+
onChange([...(optionsLoad ? optionsLoad : options).map((x) => x[fieldValue ?? "value"])]);
|
|
955
948
|
}
|
|
956
949
|
e.stopPropagation();
|
|
957
950
|
}
|
|
@@ -1973,9 +1966,6 @@ var SidebarSetColumn = (props) => {
|
|
|
1973
1966
|
};
|
|
1974
1967
|
var sidebar_setting_column_default = SidebarSetColumn;
|
|
1975
1968
|
|
|
1976
|
-
// test-app/src/component/table/index.tsx
|
|
1977
|
-
import { DropDownTreeComponent } from "@syncfusion/ej2-react-dropdowns";
|
|
1978
|
-
|
|
1979
1969
|
// test-app/src/component/table/paging/index.tsx
|
|
1980
1970
|
import { ChevronRight as ChevronRight2, ChevronLeft as ChevronLeft2, ChevronsLeft, ChevronsRight } from "becoxy-icons";
|
|
1981
1971
|
import classNames5 from "classnames";
|
|
@@ -2207,10 +2197,595 @@ var CommandElement = (props) => {
|
|
|
2207
2197
|
};
|
|
2208
2198
|
var command_default = CommandElement;
|
|
2209
2199
|
|
|
2210
|
-
// test-app/src/component/table/index.tsx
|
|
2200
|
+
// test-app/src/component/select-table-tree/index.tsx
|
|
2201
|
+
import React2, { forwardRef as forwardRef3, Fragment as Fragment17, useEffect as useEffect8, useMemo as useMemo2, useRef as useRef3, useState as useState7 } from "react";
|
|
2202
|
+
import {
|
|
2203
|
+
DropdownItem as DropdownItem3,
|
|
2204
|
+
DropdownMenu as DropdownMenu3,
|
|
2205
|
+
DropdownToggle as DropdownToggle3,
|
|
2206
|
+
Dropdown as Dropdown3,
|
|
2207
|
+
Button as Button5,
|
|
2208
|
+
Input as Input8,
|
|
2209
|
+
UncontrolledTooltip as UncontrolledTooltip4
|
|
2210
|
+
} from "reactstrap";
|
|
2211
|
+
import { useTranslation as useTranslation11 } from "react-i18next";
|
|
2212
|
+
import classnames8 from "classnames";
|
|
2213
|
+
import moment2 from "moment";
|
|
2214
|
+
import { ChevronRight as ChevronRight3, Plus as Plus3 } from "becoxy-icons";
|
|
2211
2215
|
import { Fragment as Fragment18, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2212
|
-
var
|
|
2216
|
+
var defaultMaxHeight2 = 250;
|
|
2217
|
+
var SelectTableTree = forwardRef3((props, ref) => {
|
|
2218
|
+
const {
|
|
2219
|
+
id,
|
|
2220
|
+
menuWidth,
|
|
2221
|
+
width,
|
|
2222
|
+
invalid,
|
|
2223
|
+
onKeyDown,
|
|
2224
|
+
placeholder,
|
|
2225
|
+
textAlign,
|
|
2226
|
+
options,
|
|
2227
|
+
columns,
|
|
2228
|
+
decimalSeparator,
|
|
2229
|
+
thousandSeparator,
|
|
2230
|
+
onChange,
|
|
2231
|
+
value,
|
|
2232
|
+
fieldValue,
|
|
2233
|
+
fieldLabel,
|
|
2234
|
+
fieldChildren,
|
|
2235
|
+
maxHeight,
|
|
2236
|
+
handleAdd,
|
|
2237
|
+
isClearable,
|
|
2238
|
+
component,
|
|
2239
|
+
formatOptionLabel,
|
|
2240
|
+
isMulti,
|
|
2241
|
+
noHeader,
|
|
2242
|
+
isDisabled,
|
|
2243
|
+
showFooter,
|
|
2244
|
+
selectChilds,
|
|
2245
|
+
footerComponent,
|
|
2246
|
+
onPaste
|
|
2247
|
+
} = props;
|
|
2248
|
+
const selectTableRef = useRef3();
|
|
2249
|
+
const selectMenuTableRef = useRef3();
|
|
2250
|
+
const inputRef = useRef3();
|
|
2251
|
+
const [dropdownOpen, setDropdownOpen] = useState7(false);
|
|
2252
|
+
const [isFocus, setIsFocus] = useState7(false);
|
|
2253
|
+
const [searchTerm, setSearchTerm] = useState7("");
|
|
2213
2254
|
const { t } = useTranslation11();
|
|
2255
|
+
const areAllItemsSelected = (value2, options2, fieldValue2) => {
|
|
2256
|
+
const checkAllSelected = (nodes) => {
|
|
2257
|
+
return nodes.every((node) => {
|
|
2258
|
+
const isSelected = value2.includes(node[fieldValue2]);
|
|
2259
|
+
const childrenSelected = node.children ? checkAllSelected(node.children) : true;
|
|
2260
|
+
return isSelected && childrenSelected;
|
|
2261
|
+
});
|
|
2262
|
+
};
|
|
2263
|
+
return checkAllSelected(options2);
|
|
2264
|
+
};
|
|
2265
|
+
const isSelectedAll = useMemo2(() => {
|
|
2266
|
+
return isMulti === true && options.length > 0 && areAllItemsSelected(value, options, fieldValue ?? "value");
|
|
2267
|
+
}, [options, value]);
|
|
2268
|
+
const defaultColumns = noHeader ? [
|
|
2269
|
+
{
|
|
2270
|
+
headerText: "Name",
|
|
2271
|
+
field: fieldLabel ?? "label",
|
|
2272
|
+
width: menuWidth
|
|
2273
|
+
}
|
|
2274
|
+
] : [
|
|
2275
|
+
{
|
|
2276
|
+
field: "key",
|
|
2277
|
+
headerText: "Code",
|
|
2278
|
+
width: 100,
|
|
2279
|
+
maxWidth: 120,
|
|
2280
|
+
minWidth: 80
|
|
2281
|
+
},
|
|
2282
|
+
{
|
|
2283
|
+
headerText: "Name",
|
|
2284
|
+
field: "label",
|
|
2285
|
+
width: 150,
|
|
2286
|
+
maxWidth: 200,
|
|
2287
|
+
minWidth: 250
|
|
2288
|
+
}
|
|
2289
|
+
];
|
|
2290
|
+
const closeMenu = () => {
|
|
2291
|
+
setDropdownOpen(false);
|
|
2292
|
+
};
|
|
2293
|
+
useEffect8(() => {
|
|
2294
|
+
if (dropdownOpen && value && !isMulti && selectMenuTableRef) {
|
|
2295
|
+
const index = options?.findIndex((e) => e[fieldValue ?? "value"] === value[fieldValue ?? "value"]);
|
|
2296
|
+
if (index >= 0) {
|
|
2297
|
+
selectMenuTableRef.current.scrollTo({ top: (index - 1) * 30 });
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
}, [dropdownOpen]);
|
|
2301
|
+
useEffect8(() => {
|
|
2302
|
+
if (inputRef && !isDisabled) {
|
|
2303
|
+
inputRef.current.addEventListener("blur", function() {
|
|
2304
|
+
setDropdownOpen(false);
|
|
2305
|
+
setSearchTerm("");
|
|
2306
|
+
setIsFocus(false);
|
|
2307
|
+
});
|
|
2308
|
+
inputRef.current.addEventListener("focus", function() {
|
|
2309
|
+
if (!isFocus) {
|
|
2310
|
+
setIsFocus(true);
|
|
2311
|
+
}
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
}, [inputRef]);
|
|
2315
|
+
useEffect8(() => {
|
|
2316
|
+
if (searchTerm && !dropdownOpen) {
|
|
2317
|
+
setDropdownOpen(true);
|
|
2318
|
+
}
|
|
2319
|
+
}, [searchTerm]);
|
|
2320
|
+
const handleOpenClose = () => {
|
|
2321
|
+
setSearchTerm("");
|
|
2322
|
+
if (dropdownOpen) {
|
|
2323
|
+
closeMenu();
|
|
2324
|
+
} else {
|
|
2325
|
+
if (!isDisabled) {
|
|
2326
|
+
setDropdownOpen(true);
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
};
|
|
2330
|
+
const listKeyUse = ["Escape", "Space", "F9"];
|
|
2331
|
+
const handleOnKeyDown = (e) => {
|
|
2332
|
+
let key = "";
|
|
2333
|
+
if (onKeyDown && (!dropdownOpen || !listKeyUse.includes(e.code) || e.code === "Escape" && !(isClearable && value && !isDisabled))) {
|
|
2334
|
+
key = onKeyDown(e);
|
|
2335
|
+
}
|
|
2336
|
+
let flag = false;
|
|
2337
|
+
if (!key) {
|
|
2338
|
+
if (e.code === "F9") {
|
|
2339
|
+
handleAdd();
|
|
2340
|
+
flag = true;
|
|
2341
|
+
} else if (e.code === "Space") {
|
|
2342
|
+
if (!searchTerm) {
|
|
2343
|
+
handleOpenClose();
|
|
2344
|
+
flag = true;
|
|
2345
|
+
}
|
|
2346
|
+
} else if (e.code === "Escape") {
|
|
2347
|
+
if (dropdownOpen && isClearable && value && !isDisabled) {
|
|
2348
|
+
onChange(void 0);
|
|
2349
|
+
handleOpenClose();
|
|
2350
|
+
flag = true;
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
if (flag) {
|
|
2355
|
+
e.stopPropagation();
|
|
2356
|
+
e.preventDefault();
|
|
2357
|
+
}
|
|
2358
|
+
};
|
|
2359
|
+
const renderHeaderCol = (col, indexCol) => {
|
|
2360
|
+
return /* @__PURE__ */ jsx15(Fragment17, { children: col.visible !== false && /* @__PURE__ */ jsx15(
|
|
2361
|
+
"th",
|
|
2362
|
+
{
|
|
2363
|
+
className: classnames8(`r-select-headercell fix-${col.fixedType}`, { "cell-fixed": col.fixedType }),
|
|
2364
|
+
style: {
|
|
2365
|
+
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
2366
|
+
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
2367
|
+
maxWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
2368
|
+
top: `${0 * 35}px`
|
|
2369
|
+
},
|
|
2370
|
+
children: /* @__PURE__ */ jsx15(
|
|
2371
|
+
"div",
|
|
2372
|
+
{
|
|
2373
|
+
role: "textbox",
|
|
2374
|
+
title: t(col.headerText ?? ""),
|
|
2375
|
+
style: {
|
|
2376
|
+
height: `${1 * 35}px`,
|
|
2377
|
+
justifyContent: col.textAlign ?? "left"
|
|
2378
|
+
},
|
|
2379
|
+
className: "r-select-headercell-div",
|
|
2380
|
+
children: t(col.headerText ?? "")
|
|
2381
|
+
}
|
|
2382
|
+
)
|
|
2383
|
+
}
|
|
2384
|
+
) }, `header-select-${indexCol}`);
|
|
2385
|
+
};
|
|
2386
|
+
const checkSearch = (keyword, data, columnsSearch) => {
|
|
2387
|
+
if (!keyword || columnsSearch.length === 0) {
|
|
2388
|
+
return true;
|
|
2389
|
+
}
|
|
2390
|
+
for (let index = 0; index < columnsSearch.length; index++) {
|
|
2391
|
+
const key = columnsSearch[index].field.trim();
|
|
2392
|
+
if (data[key] && data[key].toString().trim().toLowerCase().includes(keyword.trim().toLowerCase())) {
|
|
2393
|
+
return true;
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
if (data[fieldChildren ?? "children"]) {
|
|
2397
|
+
return data[fieldChildren ?? "children"].some((child) => checkSearch(keyword, child, columnsSearch));
|
|
2398
|
+
}
|
|
2399
|
+
return false;
|
|
2400
|
+
};
|
|
2401
|
+
const checkOverflow = (indexRow, indexCol) => {
|
|
2402
|
+
const element = document.getElementById(`select-${id}-${indexRow}-${indexCol}`);
|
|
2403
|
+
return element && element.scrollWidth > element.clientWidth;
|
|
2404
|
+
};
|
|
2405
|
+
const getSelectAll = (tree, checkValue = false) => {
|
|
2406
|
+
const selects = [];
|
|
2407
|
+
const traverse = (items) => {
|
|
2408
|
+
items.forEach((item) => {
|
|
2409
|
+
if (item[fieldValue ?? "value"] && !(checkValue && value?.includes(item[fieldValue ?? "value"]))) {
|
|
2410
|
+
selects.push(item[fieldValue ?? "value"]);
|
|
2411
|
+
}
|
|
2412
|
+
if (item[fieldChildren ?? "children"] && item[fieldChildren ?? "children"].length > 0) {
|
|
2413
|
+
traverse(item[fieldChildren ?? "children"]);
|
|
2414
|
+
}
|
|
2415
|
+
});
|
|
2416
|
+
};
|
|
2417
|
+
traverse(tree);
|
|
2418
|
+
return selects;
|
|
2419
|
+
};
|
|
2420
|
+
const RenderElement = React2.memo((props2) => {
|
|
2421
|
+
const { indexRow, row, isSelected, level = 0 } = props2;
|
|
2422
|
+
const [expanded, setExpanded] = useState7(row.expanded);
|
|
2423
|
+
return /* @__PURE__ */ jsxs14(Fragment18, { children: [
|
|
2424
|
+
/* @__PURE__ */ jsxs14(
|
|
2425
|
+
"tr",
|
|
2426
|
+
{
|
|
2427
|
+
id: `row-select-table-${indexRow}`,
|
|
2428
|
+
className: classnames8("r-select-row", { "fisrt-row": indexRow === 0 && level === 0 }),
|
|
2429
|
+
children: [
|
|
2430
|
+
isMulti && /* @__PURE__ */ jsxs14(
|
|
2431
|
+
"td",
|
|
2432
|
+
{
|
|
2433
|
+
className: classnames8(`r-select-rowcell`, { "r-select-active": !isMulti && value && isSelected }),
|
|
2434
|
+
style: {
|
|
2435
|
+
textAlign: "center",
|
|
2436
|
+
paddingLeft: level * 15 + (row[fieldChildren ?? "children"].length > 0 ? 0 : 10)
|
|
2437
|
+
},
|
|
2438
|
+
onClick: (e) => {
|
|
2439
|
+
if (isMulti) {
|
|
2440
|
+
const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
|
|
2441
|
+
if (index > -1) {
|
|
2442
|
+
if (!selectChilds) {
|
|
2443
|
+
value?.splice(index, 1);
|
|
2444
|
+
} else {
|
|
2445
|
+
value?.splice(index, 1);
|
|
2446
|
+
getSelectAll(row[fieldChildren ?? "children"]).forEach((x) => {
|
|
2447
|
+
const index2 = value?.findIndex((y) => y === x);
|
|
2448
|
+
if (index2 > -1) {
|
|
2449
|
+
value?.splice(index2, 1);
|
|
2450
|
+
}
|
|
2451
|
+
});
|
|
2452
|
+
}
|
|
2453
|
+
onChange([...value]);
|
|
2454
|
+
} else {
|
|
2455
|
+
if (value) {
|
|
2456
|
+
if (!selectChilds) {
|
|
2457
|
+
onChange([...value, row[fieldValue ?? "value"]]);
|
|
2458
|
+
} else {
|
|
2459
|
+
onChange([...value, row[fieldValue ?? "value"], ...getSelectAll(row[fieldChildren ?? "children"], true)]);
|
|
2460
|
+
}
|
|
2461
|
+
} else {
|
|
2462
|
+
onChange([row[fieldValue ?? "value"]]);
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
e.stopPropagation();
|
|
2466
|
+
}
|
|
2467
|
+
},
|
|
2468
|
+
children: [
|
|
2469
|
+
row[fieldChildren ?? "children"].length > 0 && /* @__PURE__ */ jsx15(
|
|
2470
|
+
ChevronRight3,
|
|
2471
|
+
{
|
|
2472
|
+
onClick: (e) => {
|
|
2473
|
+
if (expanded) {
|
|
2474
|
+
row.expanded = false;
|
|
2475
|
+
setExpanded(false);
|
|
2476
|
+
} else {
|
|
2477
|
+
row.expanded = true;
|
|
2478
|
+
setExpanded(true);
|
|
2479
|
+
}
|
|
2480
|
+
e.stopPropagation();
|
|
2481
|
+
},
|
|
2482
|
+
fontSize: 18,
|
|
2483
|
+
className: classnames8("me-50 pb-0 r-icon-expand", { "is-open": expanded })
|
|
2484
|
+
}
|
|
2485
|
+
),
|
|
2486
|
+
/* @__PURE__ */ jsx15(
|
|
2487
|
+
Input8,
|
|
2488
|
+
{
|
|
2489
|
+
checked: isSelected,
|
|
2490
|
+
type: "checkbox",
|
|
2491
|
+
className: "cursor-pointer",
|
|
2492
|
+
onChange: () => {
|
|
2493
|
+
},
|
|
2494
|
+
style: { textAlign: "center" }
|
|
2495
|
+
}
|
|
2496
|
+
)
|
|
2497
|
+
]
|
|
2498
|
+
}
|
|
2499
|
+
),
|
|
2500
|
+
(columns ? columns : defaultColumns).map((col, indexCol) => {
|
|
2501
|
+
let valueDisplay = row[col.field];
|
|
2502
|
+
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
2503
|
+
valueDisplay = formartNumberic(row[col.field], decimalSeparator ?? ".", thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
2504
|
+
} else if (col.type === "date") {
|
|
2505
|
+
valueDisplay = valueDisplay ? moment2(valueDisplay).format("DD/MM/yyyy") : "";
|
|
2506
|
+
} else if (col.type === "datetime") {
|
|
2507
|
+
valueDisplay = valueDisplay ? moment2(valueDisplay).format("DD/MM/yyyy HH:mm") : "";
|
|
2508
|
+
}
|
|
2509
|
+
return /* @__PURE__ */ jsxs14(Fragment17, { children: [
|
|
2510
|
+
col.visible !== false && /* @__PURE__ */ jsxs14(
|
|
2511
|
+
"td",
|
|
2512
|
+
{
|
|
2513
|
+
id: `select-${id}-${indexRow}-${indexCol}`,
|
|
2514
|
+
className: classnames8(`r-select-rowcell`, { "r-select-active": !isMulti && value && isSelected }),
|
|
2515
|
+
style: {
|
|
2516
|
+
paddingLeft: 9 + (indexCol === 0 && !isMulti ? level * 10 + (row[fieldChildren ?? "children"].length > 0 ? 0 : 15) : 0),
|
|
2517
|
+
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2518
|
+
},
|
|
2519
|
+
onClick: (e) => {
|
|
2520
|
+
if (isMulti) {
|
|
2521
|
+
const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
|
|
2522
|
+
if (index > -1) {
|
|
2523
|
+
if (!selectChilds) {
|
|
2524
|
+
value?.splice(index, 1);
|
|
2525
|
+
} else {
|
|
2526
|
+
value?.splice(index, 1);
|
|
2527
|
+
getSelectAll(row[fieldChildren ?? "children"]).forEach((x) => {
|
|
2528
|
+
const index2 = value?.findIndex((y) => y === x);
|
|
2529
|
+
if (index2 > -1) {
|
|
2530
|
+
value?.splice(index2, 1);
|
|
2531
|
+
}
|
|
2532
|
+
});
|
|
2533
|
+
}
|
|
2534
|
+
onChange([...value]);
|
|
2535
|
+
} else {
|
|
2536
|
+
if (value) {
|
|
2537
|
+
if (!selectChilds) {
|
|
2538
|
+
onChange([...value, row[fieldValue ?? "value"]]);
|
|
2539
|
+
} else {
|
|
2540
|
+
onChange([...value, row[fieldValue ?? "value"], ...getSelectAll(row[fieldChildren ?? "children"], true)]);
|
|
2541
|
+
}
|
|
2542
|
+
} else {
|
|
2543
|
+
onChange([row[fieldValue ?? "value"]]);
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
e.stopPropagation();
|
|
2547
|
+
} else {
|
|
2548
|
+
onChange(row);
|
|
2549
|
+
setSearchTerm("");
|
|
2550
|
+
closeMenu();
|
|
2551
|
+
}
|
|
2552
|
+
e.preventDefault();
|
|
2553
|
+
e.stopPropagation();
|
|
2554
|
+
},
|
|
2555
|
+
children: [
|
|
2556
|
+
!isMulti && indexCol === 0 && row[fieldChildren ?? "children"].length > 0 && /* @__PURE__ */ jsx15(
|
|
2557
|
+
ChevronRight3,
|
|
2558
|
+
{
|
|
2559
|
+
onClick: (e) => {
|
|
2560
|
+
if (expanded) {
|
|
2561
|
+
row.expanded = false;
|
|
2562
|
+
setExpanded(false);
|
|
2563
|
+
} else {
|
|
2564
|
+
row.expanded = true;
|
|
2565
|
+
setExpanded(true);
|
|
2566
|
+
}
|
|
2567
|
+
e.stopPropagation();
|
|
2568
|
+
},
|
|
2569
|
+
fontSize: 18,
|
|
2570
|
+
className: classnames8("me-50 r-icon-expand", { "is-open": expanded })
|
|
2571
|
+
}
|
|
2572
|
+
),
|
|
2573
|
+
col.template ? col.template(row, indexRow) : valueDisplay
|
|
2574
|
+
]
|
|
2575
|
+
},
|
|
2576
|
+
`col-${indexRow}-${indexCol}`
|
|
2577
|
+
),
|
|
2578
|
+
checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx15(UncontrolledTooltip4, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : valueDisplay })
|
|
2579
|
+
] }, indexCol);
|
|
2580
|
+
})
|
|
2581
|
+
]
|
|
2582
|
+
},
|
|
2583
|
+
`row-${indexRow}`
|
|
2584
|
+
),
|
|
2585
|
+
row[fieldChildren ?? "children"] && row.expanded && row[fieldChildren ?? "children"].map((child, indexChild) => {
|
|
2586
|
+
if (checkSearch(searchTerm, child, columns ? columns : defaultColumns)) {
|
|
2587
|
+
const isSelectedChild = isMulti ? value?.some((x) => x === child[fieldValue ?? "value"]) : value[fieldValue ?? "value"] === child[fieldValue ?? "value"];
|
|
2588
|
+
return /* @__PURE__ */ jsx15(RenderElement, { isSelected: isSelectedChild, indexRow: indexChild, row: child, level: level + 1 }, `select-table-${indexRow}-${indexChild}`);
|
|
2589
|
+
}
|
|
2590
|
+
})
|
|
2591
|
+
] });
|
|
2592
|
+
});
|
|
2593
|
+
const RenderTable = (props2) => {
|
|
2594
|
+
const {} = props2;
|
|
2595
|
+
let countDisplay = 0;
|
|
2596
|
+
return /* @__PURE__ */ jsxs14(Fragment18, { children: [
|
|
2597
|
+
/* @__PURE__ */ jsxs14("table", { style: { width: "100%" }, children: [
|
|
2598
|
+
!noHeader && /* @__PURE__ */ jsx15("thead", { className: "r-select-gridheader", children: /* @__PURE__ */ jsxs14("tr", { className: "r-select-row", role: "row", children: [
|
|
2599
|
+
isMulti && /* @__PURE__ */ jsx15(
|
|
2600
|
+
"th",
|
|
2601
|
+
{
|
|
2602
|
+
className: classnames8(`r-select-headercell checkbox-column`),
|
|
2603
|
+
style: { width: 40, minWidth: 40, maxWidth: 100, top: `0px` },
|
|
2604
|
+
children: /* @__PURE__ */ jsx15(
|
|
2605
|
+
"div",
|
|
2606
|
+
{
|
|
2607
|
+
style: { justifyContent: "center" },
|
|
2608
|
+
className: classnames8("r-select-headercell-div"),
|
|
2609
|
+
children: /* @__PURE__ */ jsx15(
|
|
2610
|
+
Input8,
|
|
2611
|
+
{
|
|
2612
|
+
checked: isSelectedAll,
|
|
2613
|
+
type: "checkbox",
|
|
2614
|
+
onClick: (e) => {
|
|
2615
|
+
if (isMulti) {
|
|
2616
|
+
if (isSelectedAll) {
|
|
2617
|
+
onChange([]);
|
|
2618
|
+
} else {
|
|
2619
|
+
onChange(getSelectAll(options));
|
|
2620
|
+
}
|
|
2621
|
+
e.stopPropagation();
|
|
2622
|
+
}
|
|
2623
|
+
},
|
|
2624
|
+
readOnly: true,
|
|
2625
|
+
className: classnames8("cursor-pointer", { "d-none": !isMulti }),
|
|
2626
|
+
style: { textAlign: "center", marginTop: 6 }
|
|
2627
|
+
}
|
|
2628
|
+
)
|
|
2629
|
+
}
|
|
2630
|
+
)
|
|
2631
|
+
}
|
|
2632
|
+
),
|
|
2633
|
+
!noHeader && (columns ? columns : defaultColumns).map((col, index) => {
|
|
2634
|
+
return renderHeaderCol(col, index);
|
|
2635
|
+
})
|
|
2636
|
+
] }) }),
|
|
2637
|
+
options.length > 0 && /* @__PURE__ */ jsx15(Fragment18, { children: /* @__PURE__ */ jsx15("tbody", { className: "r-select-gridcontent", children: options?.map((row, indexRow) => {
|
|
2638
|
+
if (checkSearch(searchTerm, row, columns ? columns : defaultColumns)) {
|
|
2639
|
+
const isSelected = isMulti ? value?.some((x) => x === row[fieldValue ?? "value"]) : value[fieldValue ?? "value"] === row[fieldValue ?? "value"];
|
|
2640
|
+
countDisplay++;
|
|
2641
|
+
return /* @__PURE__ */ jsx15(RenderElement, { isSelected, indexRow, row }, `select-table-${indexRow}`);
|
|
2642
|
+
}
|
|
2643
|
+
}) }) })
|
|
2644
|
+
] }),
|
|
2645
|
+
countDisplay === 0 && /* @__PURE__ */ jsxs14("div", { className: "r-no-data", children: [
|
|
2646
|
+
/* @__PURE__ */ jsx15("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxs14("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [
|
|
2647
|
+
/* @__PURE__ */ jsx15("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }),
|
|
2648
|
+
/* @__PURE__ */ jsxs14("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [
|
|
2649
|
+
/* @__PURE__ */ jsx15("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }),
|
|
2650
|
+
/* @__PURE__ */ jsx15("path", { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", fill: "#fafafa" })
|
|
2651
|
+
] })
|
|
2652
|
+
] }) }),
|
|
2653
|
+
t("No data available.")
|
|
2654
|
+
] })
|
|
2655
|
+
] });
|
|
2656
|
+
};
|
|
2657
|
+
const getSelectedRecords = (tree, value2) => {
|
|
2658
|
+
const records = [];
|
|
2659
|
+
const traverse = (nodes) => {
|
|
2660
|
+
nodes.forEach((node) => {
|
|
2661
|
+
if (value2.includes(node[fieldValue ?? "value"])) {
|
|
2662
|
+
records.push(node);
|
|
2663
|
+
}
|
|
2664
|
+
if (node.children && node.children.length > 0) {
|
|
2665
|
+
traverse(node.children);
|
|
2666
|
+
}
|
|
2667
|
+
});
|
|
2668
|
+
};
|
|
2669
|
+
traverse(tree);
|
|
2670
|
+
return records;
|
|
2671
|
+
};
|
|
2672
|
+
return /* @__PURE__ */ jsx15(
|
|
2673
|
+
"div",
|
|
2674
|
+
{
|
|
2675
|
+
className: classnames8("react-select-table", { "is-invalid": invalid }),
|
|
2676
|
+
ref,
|
|
2677
|
+
id,
|
|
2678
|
+
children: /* @__PURE__ */ jsx15("div", { ref: selectTableRef, children: /* @__PURE__ */ jsxs14(
|
|
2679
|
+
Dropdown3,
|
|
2680
|
+
{
|
|
2681
|
+
isOpen: dropdownOpen,
|
|
2682
|
+
toggle: () => {
|
|
2683
|
+
},
|
|
2684
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
2685
|
+
children: [
|
|
2686
|
+
/* @__PURE__ */ jsxs14(
|
|
2687
|
+
DropdownToggle3,
|
|
2688
|
+
{
|
|
2689
|
+
onClick: (e) => {
|
|
2690
|
+
if (!isDisabled) {
|
|
2691
|
+
inputRef?.current.focus();
|
|
2692
|
+
handleOpenClose();
|
|
2693
|
+
}
|
|
2694
|
+
e.preventDefault();
|
|
2695
|
+
},
|
|
2696
|
+
tag: "div",
|
|
2697
|
+
style: { width: width ? width : "100%" },
|
|
2698
|
+
className: classnames8("select-table-control", { "r-select-is-disabled": isDisabled }, { "r-select-is-open": dropdownOpen }, { "r-select-is-focus": isFocus }, { "r-select-is-invalid": invalid }),
|
|
2699
|
+
children: [
|
|
2700
|
+
/* @__PURE__ */ jsxs14("div", { className: "select-table-container", children: [
|
|
2701
|
+
isMulti ? /* @__PURE__ */ jsx15(Fragment18, { children: /* @__PURE__ */ jsx15("div", { className: classnames8("select-value is-mutil", { "d-none": searchTerm }), children: getSelectedRecords(options, value).map((ele, index) => {
|
|
2702
|
+
return /* @__PURE__ */ jsxs14("span", { children: [
|
|
2703
|
+
index === 0 ? "" : ", ",
|
|
2704
|
+
ele[fieldLabel ?? "label"]
|
|
2705
|
+
] }, index);
|
|
2706
|
+
}) }) }) : /* @__PURE__ */ jsx15(Fragment18, { children: /* @__PURE__ */ jsxs14("div", { className: classnames8("select-value", { "d-none": searchTerm }), children: [
|
|
2707
|
+
value ? formatOptionLabel ? formatOptionLabel(value) : value[fieldLabel ?? "label"] : "",
|
|
2708
|
+
" "
|
|
2709
|
+
] }) }),
|
|
2710
|
+
!((isMulti ? value?.length > 0 : value) || isDisabled || searchTerm) && /* @__PURE__ */ jsx15("div", { className: classnames8("select-placeholder"), children: placeholder }),
|
|
2711
|
+
/* @__PURE__ */ jsx15("div", { className: "input-container", children: /* @__PURE__ */ jsx15(
|
|
2712
|
+
"input",
|
|
2713
|
+
{
|
|
2714
|
+
style: { textAlign: textAlign ?? "left" },
|
|
2715
|
+
ref: inputRef,
|
|
2716
|
+
className: classnames8("select-input"),
|
|
2717
|
+
readOnly: isDisabled,
|
|
2718
|
+
value: searchTerm,
|
|
2719
|
+
onPaste: (e) => onPaste && !dropdownOpen && onPaste(e),
|
|
2720
|
+
onChange: (val) => {
|
|
2721
|
+
setSearchTerm(val.target.value);
|
|
2722
|
+
},
|
|
2723
|
+
onKeyDown: (e) => handleOnKeyDown(e)
|
|
2724
|
+
}
|
|
2725
|
+
) })
|
|
2726
|
+
] }),
|
|
2727
|
+
isClearable && value && !isDisabled && /* @__PURE__ */ jsx15(
|
|
2728
|
+
"div",
|
|
2729
|
+
{
|
|
2730
|
+
className: classnames8("cursor-pointer"),
|
|
2731
|
+
onClick: (e) => {
|
|
2732
|
+
onChange(isMulti ? [] : void 0);
|
|
2733
|
+
e.stopPropagation();
|
|
2734
|
+
},
|
|
2735
|
+
children: /* @__PURE__ */ jsx15("svg", { height: "20", width: "20", color: "#c4c4c4", viewBox: "0 0 20 20", "aria-hidden": "true", focusable: "false", className: "css-tj5bde-Svg", children: /* @__PURE__ */ jsx15("path", { d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z" }) })
|
|
2736
|
+
}
|
|
2737
|
+
),
|
|
2738
|
+
!isDisabled && /* @__PURE__ */ jsx15("div", { className: "select-table-indicator", onMouseDown: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx15("svg", { height: "20", width: "20", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx15("path", { d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z" }) }) })
|
|
2739
|
+
]
|
|
2740
|
+
}
|
|
2741
|
+
),
|
|
2742
|
+
/* @__PURE__ */ jsx15(
|
|
2743
|
+
DropdownMenu3,
|
|
2744
|
+
{
|
|
2745
|
+
container: component,
|
|
2746
|
+
className: "formula-dropdown icon-dropdown p-0",
|
|
2747
|
+
style: {
|
|
2748
|
+
width: "min-content",
|
|
2749
|
+
position: "fixed",
|
|
2750
|
+
borderRadius: 3,
|
|
2751
|
+
zIndex: 9999
|
|
2752
|
+
},
|
|
2753
|
+
children: /* @__PURE__ */ jsx15(DropdownItem3, { className: classnames8("p-0 menu-select-table"), style: { borderRadius: "6px" }, tag: "div", header: true, children: dropdownOpen && /* @__PURE__ */ jsx15(
|
|
2754
|
+
"div",
|
|
2755
|
+
{
|
|
2756
|
+
onMouseDown: (e) => {
|
|
2757
|
+
if (!isDisabled) {
|
|
2758
|
+
inputRef?.current.focus();
|
|
2759
|
+
e.preventDefault();
|
|
2760
|
+
}
|
|
2761
|
+
},
|
|
2762
|
+
children: /* @__PURE__ */ jsxs14("div", { className: "r-select-grid", children: [
|
|
2763
|
+
/* @__PURE__ */ jsx15("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight2 }, children: /* @__PURE__ */ jsx15(RenderTable, {}) }),
|
|
2764
|
+
/* @__PURE__ */ jsxs14("div", { className: classnames8("r-select-footer", { "d-none": !(showFooter === true || handleAdd || isMulti) }), children: [
|
|
2765
|
+
/* @__PURE__ */ jsxs14(Button5, { outline: true, color: "primary", onClick: handleAdd, className: classnames8("r-btn d-flex align-items-center", { "d-none": !handleAdd }), children: [
|
|
2766
|
+
/* @__PURE__ */ jsx15(Plus3, { className: "me-50", fontSize: 16 }),
|
|
2767
|
+
t("AddNew"),
|
|
2768
|
+
" (F9)"
|
|
2769
|
+
] }),
|
|
2770
|
+
isMulti && /* @__PURE__ */ jsx15("div", { className: "ms-50 text-primary h-100 d-flex align-items-center", onClick: handleAdd, children: t("countSelected", { item: value?.length ?? 0 }) }),
|
|
2771
|
+
footerComponent ? footerComponent() : null
|
|
2772
|
+
] })
|
|
2773
|
+
] })
|
|
2774
|
+
}
|
|
2775
|
+
) })
|
|
2776
|
+
}
|
|
2777
|
+
)
|
|
2778
|
+
]
|
|
2779
|
+
}
|
|
2780
|
+
) })
|
|
2781
|
+
}
|
|
2782
|
+
);
|
|
2783
|
+
});
|
|
2784
|
+
|
|
2785
|
+
// test-app/src/component/table/index.tsx
|
|
2786
|
+
import { Fragment as Fragment20, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2787
|
+
var TableEdit = forwardRef4((props, ref) => {
|
|
2788
|
+
const { t } = useTranslation12();
|
|
2214
2789
|
const {
|
|
2215
2790
|
idTable,
|
|
2216
2791
|
dataSource,
|
|
@@ -2243,31 +2818,30 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2243
2818
|
refeshFocusRow: handleRefeshRow
|
|
2244
2819
|
};
|
|
2245
2820
|
});
|
|
2246
|
-
const [refreshRow, setRefreshRow] =
|
|
2247
|
-
const [indexFocus, setIndexFocus] =
|
|
2248
|
-
const [selectedRows, setSelectedRows] =
|
|
2249
|
-
const [headerColumns, setHeaderColumns] =
|
|
2250
|
-
const [contentColumns, setContentColumns] =
|
|
2251
|
-
const [levelCol, setLevelCol] =
|
|
2252
|
-
const [columnFistEdit, setColumnFistEdit] =
|
|
2253
|
-
const [columnLastEdit, setColumnlastEdit] =
|
|
2254
|
-
const [objWidthFix, setObjWidthFix] =
|
|
2255
|
-
const [
|
|
2256
|
-
const [
|
|
2257
|
-
const
|
|
2258
|
-
const
|
|
2259
|
-
const gridRef = useRef3();
|
|
2821
|
+
const [refreshRow, setRefreshRow] = useState8(false);
|
|
2822
|
+
const [indexFocus, setIndexFocus] = useState8();
|
|
2823
|
+
const [selectedRows, setSelectedRows] = useState8([]);
|
|
2824
|
+
const [headerColumns, setHeaderColumns] = useState8([[]]);
|
|
2825
|
+
const [contentColumns, setContentColumns] = useState8([]);
|
|
2826
|
+
const [levelCol, setLevelCol] = useState8(0);
|
|
2827
|
+
const [columnFistEdit, setColumnFistEdit] = useState8(0);
|
|
2828
|
+
const [columnLastEdit, setColumnlastEdit] = useState8(0);
|
|
2829
|
+
const [objWidthFix, setObjWidthFix] = useState8({});
|
|
2830
|
+
const [openPopupSetupColumn, setOpenPopupSetupColumn] = useState8(false);
|
|
2831
|
+
const [searchTerm, setSearchTerm] = useState8("");
|
|
2832
|
+
const tableElement = useRef4(null);
|
|
2833
|
+
const gridRef = useRef4();
|
|
2260
2834
|
let totalCount = dataSource.length;
|
|
2261
2835
|
const pagingClient = pagingSetting?.allowPaging && (pagingSetting?.pagingClient || !(editDisable || addDisable));
|
|
2262
2836
|
const searchClient = searchSetting?.searchEnable && (searchSetting?.searchClient || !(editDisable || addDisable));
|
|
2263
2837
|
const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? "id";
|
|
2264
2838
|
const fieldUniKey = columns.filter((item) => item.isUnikey === true)?.map((item) => item.field);
|
|
2265
|
-
|
|
2839
|
+
useEffect9(() => {
|
|
2266
2840
|
if (pagingClient && pagingSetting.setCurrentPage && Math.ceil(totalCount / (pagingSetting?.pageSize ?? 1)) < (pagingSetting.currentPage ?? 1)) {
|
|
2267
2841
|
pagingSetting.setCurrentPage(1);
|
|
2268
2842
|
}
|
|
2269
2843
|
}, [dataSource]);
|
|
2270
|
-
|
|
2844
|
+
useEffect9(() => {
|
|
2271
2845
|
let indexFirst = -1;
|
|
2272
2846
|
let indexlast = -1;
|
|
2273
2847
|
let letfWidthFix = 0;
|
|
@@ -2301,7 +2875,7 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2301
2875
|
setColumnFistEdit(indexFirst + 1);
|
|
2302
2876
|
setColumnlastEdit(indexlast + 1);
|
|
2303
2877
|
}, [contentColumns]);
|
|
2304
|
-
|
|
2878
|
+
useEffect9(() => {
|
|
2305
2879
|
const arrHeaderColumns = [];
|
|
2306
2880
|
const arrContentColumns = [];
|
|
2307
2881
|
let headerLevelRow = 0;
|
|
@@ -2318,7 +2892,7 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2318
2892
|
setHeaderColumns(arrHeaderColumns);
|
|
2319
2893
|
setContentColumns(arrContentColumns);
|
|
2320
2894
|
}, [columns]);
|
|
2321
|
-
|
|
2895
|
+
useEffect9(() => {
|
|
2322
2896
|
const arrHeaderColumns = [];
|
|
2323
2897
|
const arrContentColumns = [];
|
|
2324
2898
|
let headerLevelRow = 0;
|
|
@@ -2435,7 +3009,7 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2435
3009
|
}
|
|
2436
3010
|
};
|
|
2437
3011
|
const searchTemplate = () => {
|
|
2438
|
-
return /* @__PURE__ */
|
|
3012
|
+
return /* @__PURE__ */ jsx16(Fragment19, { children: /* @__PURE__ */ jsx16("div", { className: "me-50 r-search", children: /* @__PURE__ */ jsx16(
|
|
2439
3013
|
react_input_default,
|
|
2440
3014
|
{
|
|
2441
3015
|
style: { width: "230px" },
|
|
@@ -2456,12 +3030,12 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2456
3030
|
const renderEdit = (row, col, indexRow, indexCol) => {
|
|
2457
3031
|
switch (col?.editTypeCondition ? col?.editTypeCondition(row) : col.editType) {
|
|
2458
3032
|
case "date":
|
|
2459
|
-
return /* @__PURE__ */
|
|
2460
|
-
|
|
3033
|
+
return /* @__PURE__ */ jsx16(
|
|
3034
|
+
Input9,
|
|
2461
3035
|
{
|
|
2462
3036
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2463
3037
|
style: { textAlign: col.textAlign, height: 29 },
|
|
2464
|
-
value: row[col.field] ?
|
|
3038
|
+
value: row[col.field] ? moment3(row[col.field]).format("yyyy-MM-DD") : row[col.field],
|
|
2465
3039
|
onChange: (val) => {
|
|
2466
3040
|
row[col.field] = val.target.value;
|
|
2467
3041
|
if (col.callback) {
|
|
@@ -2469,7 +3043,7 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2469
3043
|
}
|
|
2470
3044
|
handleDataChange(row, col, indexRow);
|
|
2471
3045
|
},
|
|
2472
|
-
className:
|
|
3046
|
+
className: classnames9("border-0 rounded-0 r-date-input", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2473
3047
|
type: "date",
|
|
2474
3048
|
max: "9999-12-31",
|
|
2475
3049
|
onKeyDown: (e) => {
|
|
@@ -2485,12 +3059,12 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2485
3059
|
}
|
|
2486
3060
|
);
|
|
2487
3061
|
case "datetime":
|
|
2488
|
-
return /* @__PURE__ */
|
|
2489
|
-
|
|
3062
|
+
return /* @__PURE__ */ jsx16(
|
|
3063
|
+
Input9,
|
|
2490
3064
|
{
|
|
2491
3065
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2492
3066
|
style: { textAlign: col.textAlign, height: 29 },
|
|
2493
|
-
value: row[col.field] ?
|
|
3067
|
+
value: row[col.field] ? moment3(row[col.field]).format("yyyy-MM-DD HH:MM") : row[col.field],
|
|
2494
3068
|
onChange: (val) => {
|
|
2495
3069
|
row[col.field] = val.target.value;
|
|
2496
3070
|
if (col.callback) {
|
|
@@ -2498,7 +3072,7 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2498
3072
|
}
|
|
2499
3073
|
handleDataChange(row, col, indexRow);
|
|
2500
3074
|
},
|
|
2501
|
-
className:
|
|
3075
|
+
className: classnames9("border-0 rounded-0 r-date-input", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2502
3076
|
type: "datetime-local",
|
|
2503
3077
|
max: "9999-12-31T23:59",
|
|
2504
3078
|
onKeyDown: (e) => {
|
|
@@ -2529,7 +3103,7 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2529
3103
|
valueSelect = col.selectSettings?.defaultValue(row);
|
|
2530
3104
|
}
|
|
2531
3105
|
}
|
|
2532
|
-
return /* @__PURE__ */
|
|
3106
|
+
return /* @__PURE__ */ jsx16(
|
|
2533
3107
|
SelectTable,
|
|
2534
3108
|
{
|
|
2535
3109
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2537,7 +3111,11 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2537
3111
|
options: optionsSelect,
|
|
2538
3112
|
rowData: row,
|
|
2539
3113
|
onChange: (val) => {
|
|
2540
|
-
|
|
3114
|
+
if (isMulti) {
|
|
3115
|
+
row[col.field] = !isNullOrUndefined(val) ? val : [];
|
|
3116
|
+
} else {
|
|
3117
|
+
row[col.field] = !isNullOrUndefined(val) ? val[col.selectSettings?.fieldValue ?? "value"] : void 0;
|
|
3118
|
+
}
|
|
2541
3119
|
if (col.callback) {
|
|
2542
3120
|
col.callback(val, indexRow);
|
|
2543
3121
|
}
|
|
@@ -2555,6 +3133,10 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2555
3133
|
handleAdd: col.selectSettings?.handAddNew,
|
|
2556
3134
|
isMulti: col.selectSettings?.isMulti,
|
|
2557
3135
|
noHeader: col.selectSettings?.noHeader,
|
|
3136
|
+
showFooter: col.selectSettings?.showFooter,
|
|
3137
|
+
formatOptionLabel: col.selectSettings?.formatOptionLabel,
|
|
3138
|
+
footerComponent: col.selectSettings?.footerComponent,
|
|
3139
|
+
width: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : void 0,
|
|
2558
3140
|
invalid: col.validate && col.validate(row[col.field], row),
|
|
2559
3141
|
maxHeight: col.selectSettings?.heightPopup ? Number(col.selectSettings?.heightPopup) : void 0,
|
|
2560
3142
|
menuWidth: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : void 0,
|
|
@@ -2572,68 +3154,95 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2572
3154
|
}
|
|
2573
3155
|
);
|
|
2574
3156
|
case "selectTree":
|
|
2575
|
-
let valueSelectTree = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? [row[col.field]] : [];
|
|
2576
3157
|
const findItemInTree = (items, value) => {
|
|
2577
3158
|
for (let index = 0; index < items.length; index++) {
|
|
2578
3159
|
const item = items[index];
|
|
2579
3160
|
if (item[col.selectSettings?.fieldValue ? col.selectSettings?.fieldValue : "value"] === value) {
|
|
2580
3161
|
return { ...item };
|
|
2581
|
-
} else if (item["children"]?.length > 0) {
|
|
2582
|
-
const itemFilter = findItemInTree(item["children"], value);
|
|
3162
|
+
} else if (item[col.selectSettings?.fieldChild ?? "children"]?.length > 0) {
|
|
3163
|
+
const itemFilter = findItemInTree(item[col.selectSettings?.fieldChild ?? "children"], value);
|
|
2583
3164
|
if (itemFilter) {
|
|
2584
3165
|
return itemFilter;
|
|
2585
3166
|
}
|
|
2586
3167
|
}
|
|
2587
3168
|
}
|
|
2588
3169
|
};
|
|
2589
|
-
|
|
3170
|
+
let valueSelectTree;
|
|
3171
|
+
let optionsSelectTree = [];
|
|
3172
|
+
if (col.selectSettings?.optionsField) {
|
|
3173
|
+
optionsSelectTree = row[col.selectSettings?.optionsField] ? row[col.selectSettings?.optionsField] : [];
|
|
3174
|
+
} else {
|
|
3175
|
+
optionsSelectTree = col.selectSettings?.options ? col.selectSettings?.validateOption ? col.selectSettings?.options.filter((item) => col.selectSettings?.validateOption(item, row)) : col.selectSettings?.options : [];
|
|
3176
|
+
}
|
|
3177
|
+
if (col.selectSettings?.isMulti) {
|
|
3178
|
+
valueSelectTree = row[col.field];
|
|
3179
|
+
} else {
|
|
3180
|
+
valueSelectTree = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? findItemInTree(optionsSelectTree, row[col.field]) : "";
|
|
3181
|
+
}
|
|
3182
|
+
return /* @__PURE__ */ jsx16(
|
|
2590
3183
|
"div",
|
|
2591
3184
|
{
|
|
2592
3185
|
onKeyDown: (e) => {
|
|
2593
3186
|
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
2594
3187
|
}
|
|
2595
3188
|
},
|
|
2596
|
-
children: /* @__PURE__ */
|
|
2597
|
-
|
|
3189
|
+
children: /* @__PURE__ */ jsx16(
|
|
3190
|
+
SelectTableTree,
|
|
2598
3191
|
{
|
|
2599
3192
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2600
|
-
fields: {
|
|
2601
|
-
dataSource: col.selectSettings?.options,
|
|
2602
|
-
value: col.selectSettings?.fieldValue ? col.selectSettings?.fieldValue : "value",
|
|
2603
|
-
text: "label",
|
|
2604
|
-
parentValue: "parentId",
|
|
2605
|
-
child: "children"
|
|
2606
|
-
},
|
|
2607
|
-
className: classnames8("select-tree", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2608
|
-
allowFiltering: false,
|
|
2609
3193
|
value: valueSelectTree,
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
}
|
|
2621
|
-
handleDataChange(row, col, indexRow);
|
|
3194
|
+
options: optionsSelectTree,
|
|
3195
|
+
rowData: row,
|
|
3196
|
+
onChange: (val) => {
|
|
3197
|
+
if (isMulti) {
|
|
3198
|
+
row[col.field] = !isNullOrUndefined(val) ? val : [];
|
|
3199
|
+
} else {
|
|
3200
|
+
row[col.field] = !isNullOrUndefined(val) ? val[col.selectSettings?.fieldValue ?? "value"] : void 0;
|
|
3201
|
+
}
|
|
3202
|
+
if (col.callback) {
|
|
3203
|
+
col.callback(val, indexRow);
|
|
2622
3204
|
}
|
|
3205
|
+
handleDataChange(row, col, indexRow);
|
|
2623
3206
|
},
|
|
2624
|
-
|
|
2625
|
-
|
|
3207
|
+
fieldValue: col.selectSettings?.fieldValue,
|
|
3208
|
+
fieldLabel: col.selectSettings?.fieldLabel,
|
|
3209
|
+
component: tableElement,
|
|
3210
|
+
columns: col.selectSettings?.columns,
|
|
3211
|
+
isClearable: col.selectSettings?.isClearable ?? false,
|
|
3212
|
+
decimalSeparator,
|
|
3213
|
+
thousandSeparator,
|
|
3214
|
+
placeholder: t("Select"),
|
|
3215
|
+
loadOptions: col.selectSettings?.loadOptions,
|
|
3216
|
+
handleAdd: col.selectSettings?.handAddNew,
|
|
3217
|
+
fieldChildren: col.selectSettings?.fieldChild ?? "children",
|
|
3218
|
+
selectChilds: col.selectSettings?.selectChilds,
|
|
3219
|
+
showFooter: col.selectSettings?.showFooter,
|
|
3220
|
+
formatOptionLabel: col.selectSettings?.formatOptionLabel,
|
|
3221
|
+
footerComponent: col.selectSettings?.footerComponent,
|
|
3222
|
+
width: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : void 0,
|
|
3223
|
+
isMulti: col.selectSettings?.isMulti,
|
|
3224
|
+
noHeader: col.selectSettings?.noHeader,
|
|
3225
|
+
invalid: col.validate && col.validate(row[col.field], row),
|
|
3226
|
+
maxHeight: col.selectSettings?.heightPopup ? Number(col.selectSettings?.heightPopup) : void 0,
|
|
3227
|
+
menuWidth: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : void 0,
|
|
3228
|
+
textAlign: col.textAlign ?? "left",
|
|
3229
|
+
onKeyDown: (e) => {
|
|
3230
|
+
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
3231
|
+
}
|
|
2626
3232
|
},
|
|
2627
|
-
|
|
2628
|
-
|
|
3233
|
+
onPaste: (e) => {
|
|
3234
|
+
if (toolbarSetting?.showBottomToolbar && !editDisable && !addDisable) {
|
|
3235
|
+
pasteDataFromExcel(indexRow, indexCol, e);
|
|
3236
|
+
e.preventDefault();
|
|
3237
|
+
}
|
|
2629
3238
|
}
|
|
2630
3239
|
}
|
|
2631
3240
|
)
|
|
2632
3241
|
}
|
|
2633
3242
|
);
|
|
2634
3243
|
case "checkbox":
|
|
2635
|
-
return /* @__PURE__ */
|
|
2636
|
-
|
|
3244
|
+
return /* @__PURE__ */ jsx16(
|
|
3245
|
+
Input9,
|
|
2637
3246
|
{
|
|
2638
3247
|
checked: row[col.field],
|
|
2639
3248
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2655,13 +3264,13 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2655
3264
|
);
|
|
2656
3265
|
case "numeric":
|
|
2657
3266
|
let valueCurrency = row[col.field];
|
|
2658
|
-
return /* @__PURE__ */
|
|
2659
|
-
|
|
3267
|
+
return /* @__PURE__ */ jsx16(
|
|
3268
|
+
Input9,
|
|
2660
3269
|
{
|
|
2661
3270
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2662
3271
|
style: { textAlign: col.textAlign, height: 29 },
|
|
2663
3272
|
defaultValue: formartNumberic(valueCurrency, decimalSeparator, thousandSeparator, col.numericSettings?.fraction),
|
|
2664
|
-
className:
|
|
3273
|
+
className: classnames9("border-0 rounded-0 input-numeric", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2665
3274
|
onChange: (val) => {
|
|
2666
3275
|
let newVal = "";
|
|
2667
3276
|
const flag = val.target?.value.startsWith("-");
|
|
@@ -2745,8 +3354,8 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2745
3354
|
}
|
|
2746
3355
|
);
|
|
2747
3356
|
case "color":
|
|
2748
|
-
return /* @__PURE__ */
|
|
2749
|
-
|
|
3357
|
+
return /* @__PURE__ */ jsx16("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */ jsx16(
|
|
3358
|
+
Input9,
|
|
2750
3359
|
{
|
|
2751
3360
|
type: "color",
|
|
2752
3361
|
value: row[col.field],
|
|
@@ -2768,7 +3377,7 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2768
3377
|
`col-${indexRow}-${indexCol}`
|
|
2769
3378
|
) });
|
|
2770
3379
|
case "form":
|
|
2771
|
-
return /* @__PURE__ */
|
|
3380
|
+
return /* @__PURE__ */ jsx16(
|
|
2772
3381
|
edit_form_default,
|
|
2773
3382
|
{
|
|
2774
3383
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2796,13 +3405,13 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2796
3405
|
}
|
|
2797
3406
|
);
|
|
2798
3407
|
default:
|
|
2799
|
-
return /* @__PURE__ */
|
|
2800
|
-
|
|
3408
|
+
return /* @__PURE__ */ jsx16(
|
|
3409
|
+
Input9,
|
|
2801
3410
|
{
|
|
2802
3411
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2803
3412
|
style: { textAlign: col.textAlign, height: 29 },
|
|
2804
3413
|
defaultValue: isNullOrUndefined(row[col.field]) ? "" : row[col.field],
|
|
2805
|
-
className:
|
|
3414
|
+
className: classnames9("border-0 rounded-0 input-element", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2806
3415
|
onBlur: (val) => {
|
|
2807
3416
|
if (row[col.field] != val.target?.value) {
|
|
2808
3417
|
row[col.field] = val.target?.value;
|
|
@@ -2984,11 +3593,9 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2984
3593
|
}
|
|
2985
3594
|
};
|
|
2986
3595
|
useOnClickOutside(gridRef, () => {
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
}, 50);
|
|
2991
|
-
}
|
|
3596
|
+
setTimeout(() => {
|
|
3597
|
+
setIndexFocus(-1);
|
|
3598
|
+
}, 50);
|
|
2992
3599
|
});
|
|
2993
3600
|
const handleAdd = () => {
|
|
2994
3601
|
const lengthData = dataSource.length;
|
|
@@ -3184,7 +3791,7 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3184
3791
|
}
|
|
3185
3792
|
}
|
|
3186
3793
|
};
|
|
3187
|
-
|
|
3794
|
+
useEffect9(() => {
|
|
3188
3795
|
setIndexFocus(-1);
|
|
3189
3796
|
if (setSelectedItem) {
|
|
3190
3797
|
if (isMulti) {
|
|
@@ -3211,7 +3818,7 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3211
3818
|
}
|
|
3212
3819
|
}
|
|
3213
3820
|
}, [selectedRows]);
|
|
3214
|
-
|
|
3821
|
+
useEffect9(() => {
|
|
3215
3822
|
if (!isMulti) {
|
|
3216
3823
|
if (dataSource && selectedItem && selectedItem[fieldKey]) {
|
|
3217
3824
|
if (selectedRows?.length === 0 || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
|
|
@@ -3228,10 +3835,10 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3228
3835
|
}, [selectedItem]);
|
|
3229
3836
|
const renderContentCol = (col, row, indexRow, indexCol, isSelected) => {
|
|
3230
3837
|
if (col.field === "command") {
|
|
3231
|
-
return col.visible !== false && /* @__PURE__ */
|
|
3838
|
+
return col.visible !== false && /* @__PURE__ */ jsx16(
|
|
3232
3839
|
"td",
|
|
3233
3840
|
{
|
|
3234
|
-
className:
|
|
3841
|
+
className: classnames9(
|
|
3235
3842
|
`r-rowcell p-0 fix-${col.fixedType}`,
|
|
3236
3843
|
{ "cell-fixed": col.fixedType },
|
|
3237
3844
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -3241,15 +3848,15 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3241
3848
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
3242
3849
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
3243
3850
|
},
|
|
3244
|
-
children: /* @__PURE__ */
|
|
3851
|
+
children: /* @__PURE__ */ jsx16("div", { className: "r-rowcell-div ", children: /* @__PURE__ */ jsx16(command_default, { commandItems: col.commandItems ?? [], handleCommandClick, indexRow, rowData: row, setIndexFocus, indexFocus }) })
|
|
3245
3852
|
},
|
|
3246
3853
|
`col-${indexRow}-${indexCol}`
|
|
3247
3854
|
);
|
|
3248
3855
|
} else if (col.field === "#") {
|
|
3249
|
-
return col.visible !== false && /* @__PURE__ */
|
|
3856
|
+
return col.visible !== false && /* @__PURE__ */ jsx16(
|
|
3250
3857
|
"td",
|
|
3251
3858
|
{
|
|
3252
|
-
className:
|
|
3859
|
+
className: classnames9(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "r-active": isSelected && editDisable || indexFocus === indexRow }),
|
|
3253
3860
|
tabIndex: Number(`${indexRow}${indexCol}`),
|
|
3254
3861
|
style: {
|
|
3255
3862
|
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
@@ -3293,15 +3900,15 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3293
3900
|
e.stopPropagation();
|
|
3294
3901
|
}
|
|
3295
3902
|
},
|
|
3296
|
-
children: /* @__PURE__ */
|
|
3903
|
+
children: /* @__PURE__ */ jsx16("div", { className: "r-rowcell-div pt-50", children: indexRow + 1 })
|
|
3297
3904
|
},
|
|
3298
3905
|
`col-${indexRow}-${indexCol}`
|
|
3299
3906
|
);
|
|
3300
3907
|
} else if (col.field === "checkbox") {
|
|
3301
|
-
return /* @__PURE__ */
|
|
3908
|
+
return /* @__PURE__ */ jsx16(
|
|
3302
3909
|
"td",
|
|
3303
3910
|
{
|
|
3304
|
-
className:
|
|
3911
|
+
className: classnames9(
|
|
3305
3912
|
`r-rowcell p-0 fix-${col.fixedType}`,
|
|
3306
3913
|
{ "cell-fixed": col.fixedType },
|
|
3307
3914
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -3311,7 +3918,7 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3311
3918
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
3312
3919
|
textAlign: col.textAlign ? col.textAlign : "center"
|
|
3313
3920
|
},
|
|
3314
|
-
children: /* @__PURE__ */
|
|
3921
|
+
children: /* @__PURE__ */ jsx16(
|
|
3315
3922
|
"div",
|
|
3316
3923
|
{
|
|
3317
3924
|
className: "r-rowcell-div cursor-pointer",
|
|
@@ -3335,8 +3942,8 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3335
3942
|
e.stopPropagation();
|
|
3336
3943
|
}
|
|
3337
3944
|
},
|
|
3338
|
-
children: /* @__PURE__ */
|
|
3339
|
-
|
|
3945
|
+
children: /* @__PURE__ */ jsx16(
|
|
3946
|
+
Input9,
|
|
3340
3947
|
{
|
|
3341
3948
|
checked: isSelected,
|
|
3342
3949
|
type: "checkbox",
|
|
@@ -3356,16 +3963,16 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3356
3963
|
if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
|
|
3357
3964
|
value = formartNumberic(row[col.field], decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) ?? 0;
|
|
3358
3965
|
} else if (col.editType === "date") {
|
|
3359
|
-
value = value ?
|
|
3966
|
+
value = value ? moment3(value).format("DD/MM/yyyy") : "";
|
|
3360
3967
|
} else if (col.editType === "datetime") {
|
|
3361
|
-
value = value ?
|
|
3968
|
+
value = value ? moment3(value).format("DD/MM/yyyy HH:mm") : "";
|
|
3362
3969
|
}
|
|
3363
3970
|
const typeDis = !editDisable && (indexFocus === indexRow || col.editType === "checkbox") && (!col.disabledCondition || !col.disabledCondition(row)) ? col.editEnable ? 1 : col.template ? 2 : 3 : col.template ? 2 : 3;
|
|
3364
3971
|
const errorMessage = typeDis === 1 || col.field === "" || !col.validate ? "" : col.validate(row[col.field], row);
|
|
3365
|
-
return /* @__PURE__ */
|
|
3972
|
+
return /* @__PURE__ */ jsx16(Fragment19, { children: col.visible !== false && /* @__PURE__ */ jsx16(
|
|
3366
3973
|
"td",
|
|
3367
3974
|
{
|
|
3368
|
-
className:
|
|
3975
|
+
className: classnames9(
|
|
3369
3976
|
`r-rowcell fix-${col.fixedType}`,
|
|
3370
3977
|
{ "cell-fixed": col.fixedType },
|
|
3371
3978
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -3407,25 +4014,25 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3407
4014
|
e.stopPropagation();
|
|
3408
4015
|
}
|
|
3409
4016
|
},
|
|
3410
|
-
children: /* @__PURE__ */
|
|
4017
|
+
children: /* @__PURE__ */ jsx16(
|
|
3411
4018
|
"div",
|
|
3412
4019
|
{
|
|
3413
|
-
className:
|
|
3414
|
-
children: /* @__PURE__ */
|
|
4020
|
+
className: classnames9("r-rowcell-div"),
|
|
4021
|
+
children: /* @__PURE__ */ jsxs15(
|
|
3415
4022
|
"div",
|
|
3416
4023
|
{
|
|
3417
4024
|
id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
|
|
3418
|
-
className:
|
|
4025
|
+
className: classnames9("r-rowcell-content", { "r-is-invalid": errorMessage }),
|
|
3419
4026
|
style: {
|
|
3420
4027
|
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2,
|
|
3421
4028
|
color: col.editType === "numeric" && Number(row[col.field]) < 0 ? "red" : ""
|
|
3422
4029
|
},
|
|
3423
4030
|
children: [
|
|
3424
|
-
typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : /* @__PURE__ */
|
|
3425
|
-
/* @__PURE__ */
|
|
3426
|
-
!(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */
|
|
3427
|
-
/* @__PURE__ */
|
|
3428
|
-
|
|
4031
|
+
typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : /* @__PURE__ */ jsx16("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
4032
|
+
/* @__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 }) }),
|
|
4033
|
+
!(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 }),
|
|
4034
|
+
/* @__PURE__ */ jsx16(
|
|
4035
|
+
UncontrolledTooltip5,
|
|
3429
4036
|
{
|
|
3430
4037
|
target: `error-${indexRow}-${indexCol}`,
|
|
3431
4038
|
className: "r-tooltip tooltip-error",
|
|
@@ -3447,10 +4054,10 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3447
4054
|
return element && element.scrollWidth > element.clientWidth;
|
|
3448
4055
|
};
|
|
3449
4056
|
const renderFooterCol = (col, indexCol) => {
|
|
3450
|
-
return /* @__PURE__ */
|
|
4057
|
+
return /* @__PURE__ */ jsx16(Fragment19, { children: col.visible !== false && /* @__PURE__ */ jsx16(
|
|
3451
4058
|
"td",
|
|
3452
4059
|
{
|
|
3453
|
-
className:
|
|
4060
|
+
className: classnames9(
|
|
3454
4061
|
`p-0 px-50 r-footer fix-${col.fixedType}`,
|
|
3455
4062
|
{ "cell-fixed": col.fixedType }
|
|
3456
4063
|
),
|
|
@@ -3459,56 +4066,56 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3459
4066
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
3460
4067
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
3461
4068
|
},
|
|
3462
|
-
children: /* @__PURE__ */
|
|
4069
|
+
children: /* @__PURE__ */ jsx16("div", { className: "r-footer-div", children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource.reduce(function(accumulator, currentValue) {
|
|
3463
4070
|
return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
|
|
3464
4071
|
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : "" })
|
|
3465
4072
|
}
|
|
3466
4073
|
) }, `summarycell-${indexCol}`);
|
|
3467
4074
|
};
|
|
3468
4075
|
const renderToolbarTop = () => {
|
|
3469
|
-
return /* @__PURE__ */
|
|
3470
|
-
/* @__PURE__ */
|
|
3471
|
-
return item.align === "left" ? /* @__PURE__ */
|
|
4076
|
+
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: [
|
|
4077
|
+
/* @__PURE__ */ jsx16("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
|
|
4078
|
+
return item.align === "left" ? /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) : "";
|
|
3472
4079
|
}) }),
|
|
3473
|
-
/* @__PURE__ */
|
|
3474
|
-
return item.align === "center" ? /* @__PURE__ */
|
|
4080
|
+
/* @__PURE__ */ jsx16("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
|
|
4081
|
+
return item.align === "center" ? /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-center-${index}`) : "";
|
|
3475
4082
|
}) }),
|
|
3476
|
-
/* @__PURE__ */
|
|
3477
|
-
return item.align === "right" ? /* @__PURE__ */
|
|
4083
|
+
/* @__PURE__ */ jsx16("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
|
|
4084
|
+
return item.align === "right" ? /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-right-${index}`) : "";
|
|
3478
4085
|
}) })
|
|
3479
4086
|
] }) });
|
|
3480
4087
|
};
|
|
3481
4088
|
const renderToolbarBottom = () => {
|
|
3482
|
-
return /* @__PURE__ */
|
|
3483
|
-
/* @__PURE__ */
|
|
3484
|
-
/* @__PURE__ */
|
|
3485
|
-
(indexFocus ?? -1) > -1 ? /* @__PURE__ */
|
|
3486
|
-
/* @__PURE__ */
|
|
4089
|
+
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: [
|
|
4090
|
+
/* @__PURE__ */ jsxs15("div", { className: "r-toolbar-left", children: [
|
|
4091
|
+
/* @__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") }) }),
|
|
4092
|
+
(indexFocus ?? -1) > -1 ? /* @__PURE__ */ jsxs15(Fragment20, { children: [
|
|
4093
|
+
/* @__PURE__ */ jsx16("div", { className: classnames9("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx16(Button6, { color: "success", outline: true, onClick: () => {
|
|
3487
4094
|
handleDuplicate(dataSource[indexFocus ?? -1], indexFocus ?? -1);
|
|
3488
4095
|
}, className: "d-flex", children: t("Duplicate") }) }),
|
|
3489
|
-
/* @__PURE__ */
|
|
3490
|
-
/* @__PURE__ */
|
|
3491
|
-
] }) : /* @__PURE__ */
|
|
3492
|
-
/* @__PURE__ */
|
|
4096
|
+
/* @__PURE__ */ jsx16("div", { className: classnames9("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertBeforeDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx16(Button6, { color: "success", outline: true, onClick: handleInsertBefore, className: "d-flex", children: t("Insert item before") }) }),
|
|
4097
|
+
/* @__PURE__ */ jsx16("div", { className: classnames9("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertAfterDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx16(Button6, { color: "success", outline: true, onClick: handleInsertAfter, className: "d-flex", children: t("Insert item after") }) })
|
|
4098
|
+
] }) : /* @__PURE__ */ jsx16(Fragment20, { children: " " }),
|
|
4099
|
+
/* @__PURE__ */ jsx16("div", { className: classnames9("r-toolbar-item", { "d-none": editDisable || buttonSetting?.deleteAllDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx16(Button6, { color: "primary", outline: true, onClick: handleDeleteAll, className: "d-flex", children: t("Delete all item") }) }),
|
|
3493
4100
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
3494
|
-
return item.align === "left" ? /* @__PURE__ */
|
|
4101
|
+
return item.align === "left" ? /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`) : "";
|
|
3495
4102
|
})
|
|
3496
4103
|
] }),
|
|
3497
|
-
/* @__PURE__ */
|
|
3498
|
-
return item.align === "center" ? /* @__PURE__ */
|
|
4104
|
+
/* @__PURE__ */ jsx16("div", { className: "r-toolbar-center", children: toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
4105
|
+
return item.align === "center" ? /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : "";
|
|
3499
4106
|
}) }),
|
|
3500
|
-
/* @__PURE__ */
|
|
4107
|
+
/* @__PURE__ */ jsxs15("div", { className: "r-toolbar-right", children: [
|
|
3501
4108
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
3502
|
-
return item.align === "right" ? /* @__PURE__ */
|
|
4109
|
+
return item.align === "right" ? /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : "";
|
|
3503
4110
|
}),
|
|
3504
|
-
/* @__PURE__ */
|
|
3505
|
-
/* @__PURE__ */
|
|
3506
|
-
/* @__PURE__ */
|
|
3507
|
-
/* @__PURE__ */
|
|
3508
|
-
/* @__PURE__ */
|
|
3509
|
-
/* @__PURE__ */
|
|
3510
|
-
/* @__PURE__ */
|
|
3511
|
-
/* @__PURE__ */
|
|
4111
|
+
/* @__PURE__ */ jsx16("div", { className: classnames9("r-toolbar-item me-25", { "d-none": headerColumns.length > 1 }), "aria-disabled": "false", children: /* @__PURE__ */ jsx16(Settings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }),
|
|
4112
|
+
/* @__PURE__ */ jsx16("div", { className: classnames9("r-toolbar-item me-25", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsxs15(UncontrolledDropdown, { className: "dropdown-user nav-item", children: [
|
|
4113
|
+
/* @__PURE__ */ jsx16(DropdownToggle4, { href: "/", tag: "a", color: "info", onClick: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx16(Info2, { className: "cursor-pointer" }) }),
|
|
4114
|
+
/* @__PURE__ */ jsx16(DropdownMenu4, { children: /* @__PURE__ */ jsxs15("div", { className: "d-flex flex-column p-50 py-25", children: [
|
|
4115
|
+
/* @__PURE__ */ jsx16("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" }),
|
|
4116
|
+
/* @__PURE__ */ jsx16("div", { style: { fontSize: 13 }, children: "Ch\u1ECDn \xF4 v\xE0 Ctrl + V \u0111\u1EC3 d\xE1n th\xF4ng tin t\u1EEB excel" }),
|
|
4117
|
+
/* @__PURE__ */ jsx16("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" }),
|
|
4118
|
+
/* @__PURE__ */ jsx16("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" })
|
|
3512
4119
|
] }) })
|
|
3513
4120
|
] }) })
|
|
3514
4121
|
] })
|
|
@@ -3537,10 +4144,10 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3537
4144
|
const flagDisplay = !pagingClient || totalCount > (pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0) - 1) && totalCount <= (pagingSetting.pageSize ?? 0) * (pagingSetting.currentPage ?? 0);
|
|
3538
4145
|
if (flagDisplay) {
|
|
3539
4146
|
countDisplay++;
|
|
3540
|
-
return /* @__PURE__ */
|
|
4147
|
+
return /* @__PURE__ */ jsx16(
|
|
3541
4148
|
"tr",
|
|
3542
4149
|
{
|
|
3543
|
-
className:
|
|
4150
|
+
className: classnames9("r-row", { "fisrt-row": countDisplay === 0 }),
|
|
3544
4151
|
children: contentColumns.map((col, indexCol) => {
|
|
3545
4152
|
return renderContentCol(col, row, indexRow, indexCol, isSelected);
|
|
3546
4153
|
})
|
|
@@ -3551,19 +4158,19 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3551
4158
|
}
|
|
3552
4159
|
});
|
|
3553
4160
|
};
|
|
3554
|
-
|
|
4161
|
+
useEffect9(() => {
|
|
3555
4162
|
if (pagingClient && pagingSetting?.setCurrentPage && (searchSetting?.searchTerm !== void 0 ? searchSetting?.searchTerm : searchTerm)) {
|
|
3556
4163
|
pagingSetting?.setCurrentPage(1);
|
|
3557
4164
|
}
|
|
3558
4165
|
}, [searchTerm, searchSetting?.searchTerm]);
|
|
3559
|
-
return /* @__PURE__ */
|
|
3560
|
-
/* @__PURE__ */
|
|
3561
|
-
/* @__PURE__ */
|
|
3562
|
-
toolbarSetting?.showTopToolbar ? /* @__PURE__ */
|
|
3563
|
-
/* @__PURE__ */
|
|
3564
|
-
/* @__PURE__ */
|
|
3565
|
-
return /* @__PURE__ */
|
|
3566
|
-
return /* @__PURE__ */
|
|
4166
|
+
return /* @__PURE__ */ jsxs15(Fragment19, { children: [
|
|
4167
|
+
/* @__PURE__ */ jsxs15("div", { className: "react-table-edit", children: [
|
|
4168
|
+
/* @__PURE__ */ jsxs15("div", { className: "r-grid", ref: gridRef, children: [
|
|
4169
|
+
toolbarSetting?.showTopToolbar ? /* @__PURE__ */ jsx16(Fragment20, { children: renderToolbarTop() }) : /* @__PURE__ */ jsx16(Fragment20, {}),
|
|
4170
|
+
/* @__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: [
|
|
4171
|
+
/* @__PURE__ */ jsx16("thead", { className: "r-gridheader", children: headerColumns.map((element, indexParent) => {
|
|
4172
|
+
return /* @__PURE__ */ jsx16("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
4173
|
+
return /* @__PURE__ */ jsx16(
|
|
3567
4174
|
header_default,
|
|
3568
4175
|
{
|
|
3569
4176
|
col,
|
|
@@ -3583,14 +4190,14 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3583
4190
|
);
|
|
3584
4191
|
}) }, `header-${-indexParent}`);
|
|
3585
4192
|
}) }),
|
|
3586
|
-
/* @__PURE__ */
|
|
3587
|
-
/* @__PURE__ */
|
|
4193
|
+
/* @__PURE__ */ jsx16("tbody", { className: "r-gridcontent", children: renderData() }),
|
|
4194
|
+
/* @__PURE__ */ jsx16("tfoot", { className: "r-gridfoot", children: haveSum == true ? /* @__PURE__ */ jsx16("tr", { className: "r-row", children: contentColumns.map((col, index) => {
|
|
3588
4195
|
return renderFooterCol(col, index);
|
|
3589
|
-
}) }) : /* @__PURE__ */
|
|
4196
|
+
}) }) : /* @__PURE__ */ jsx16(Fragment20, {}) })
|
|
3590
4197
|
] }) }),
|
|
3591
|
-
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */
|
|
4198
|
+
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ jsx16(Fragment20, { children: renderToolbarBottom() }) : /* @__PURE__ */ jsx16(Fragment20, {})
|
|
3592
4199
|
] }),
|
|
3593
|
-
pagingSetting?.allowPaging ? /* @__PURE__ */
|
|
4200
|
+
pagingSetting?.allowPaging ? /* @__PURE__ */ jsx16(
|
|
3594
4201
|
PagingComponent,
|
|
3595
4202
|
{
|
|
3596
4203
|
onChangePage,
|
|
@@ -3600,9 +4207,9 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3600
4207
|
totalItem: pagingClient ? totalCount : pagingSetting?.totalItem ?? 0,
|
|
3601
4208
|
onChangePageSize
|
|
3602
4209
|
}
|
|
3603
|
-
) : /* @__PURE__ */
|
|
4210
|
+
) : /* @__PURE__ */ jsx16(Fragment20, {})
|
|
3604
4211
|
] }),
|
|
3605
|
-
/* @__PURE__ */
|
|
4212
|
+
/* @__PURE__ */ jsx16(
|
|
3606
4213
|
sidebar_setting_column_default,
|
|
3607
4214
|
{
|
|
3608
4215
|
handleSidebar: () => {
|
|
@@ -3618,12 +4225,12 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
3618
4225
|
var table_default = TableEdit;
|
|
3619
4226
|
|
|
3620
4227
|
// test-app/src/component/tab-menu/index.tsx
|
|
3621
|
-
import { ChevronLeft as ChevronLeft3, ChevronRight as
|
|
4228
|
+
import { ChevronLeft as ChevronLeft3, ChevronRight as ChevronRight4 } from "becoxy-icons";
|
|
3622
4229
|
import classNames6 from "classnames";
|
|
3623
|
-
import { Fragment as
|
|
4230
|
+
import { Fragment as Fragment21, useEffect as useEffect10, useState as useState9 } from "react";
|
|
3624
4231
|
import { Link, useNavigate } from "react-router-dom";
|
|
3625
|
-
import { DropdownItem as
|
|
3626
|
-
import { jsx as
|
|
4232
|
+
import { DropdownItem as DropdownItem4, DropdownMenu as DropdownMenu5, DropdownToggle as DropdownToggle5, UncontrolledDropdown as UncontrolledDropdown2 } from "reactstrap";
|
|
4233
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3627
4234
|
var TabsMenuComponent = ({
|
|
3628
4235
|
buttonWidth,
|
|
3629
4236
|
tabParent,
|
|
@@ -3635,14 +4242,14 @@ var TabsMenuComponent = ({
|
|
|
3635
4242
|
renderModal
|
|
3636
4243
|
}) => {
|
|
3637
4244
|
const navigate = useNavigate();
|
|
3638
|
-
const [dataMenu, setDataMenu] =
|
|
3639
|
-
const [openMenu, setOpenMenu] =
|
|
3640
|
-
const [url, setUrl] =
|
|
3641
|
-
const [contentWidth, setContentWidth] =
|
|
3642
|
-
const [componentWidth, setComponentWidth] =
|
|
3643
|
-
const [scrollPosition, setScrollPosition] =
|
|
3644
|
-
const [dataItem, setDataItem] =
|
|
3645
|
-
const [openModal, setOpenModal] =
|
|
4245
|
+
const [dataMenu, setDataMenu] = useState9([]);
|
|
4246
|
+
const [openMenu, setOpenMenu] = useState9(false);
|
|
4247
|
+
const [url, setUrl] = useState9("");
|
|
4248
|
+
const [contentWidth, setContentWidth] = useState9(0);
|
|
4249
|
+
const [componentWidth, setComponentWidth] = useState9(0);
|
|
4250
|
+
const [scrollPosition, setScrollPosition] = useState9(0);
|
|
4251
|
+
const [dataItem, setDataItem] = useState9([]);
|
|
4252
|
+
const [openModal, setOpenModal] = useState9({});
|
|
3646
4253
|
const handleWindowResize = () => {
|
|
3647
4254
|
const tabEle = document.getElementById(`tab-component-${resourceCode}`);
|
|
3648
4255
|
const tabContent = document.getElementById(`content-component-${resourceCode}`);
|
|
@@ -3651,7 +4258,7 @@ var TabsMenuComponent = ({
|
|
|
3651
4258
|
setContentWidth(tabContent?.offsetWidth ?? 0);
|
|
3652
4259
|
}
|
|
3653
4260
|
};
|
|
3654
|
-
|
|
4261
|
+
useEffect10(() => {
|
|
3655
4262
|
setUrl(window.location.pathname);
|
|
3656
4263
|
window.addEventListener("resize", handleWindowResize);
|
|
3657
4264
|
setTimeout(() => {
|
|
@@ -3667,7 +4274,7 @@ var TabsMenuComponent = ({
|
|
|
3667
4274
|
window.removeEventListener("resize", handleWindowResize);
|
|
3668
4275
|
};
|
|
3669
4276
|
}, []);
|
|
3670
|
-
|
|
4277
|
+
useEffect10(() => {
|
|
3671
4278
|
const item = resources?.find((x) => x.code === (resourceCodeParent ? resourceCodeParent : resourceCode));
|
|
3672
4279
|
if (item) {
|
|
3673
4280
|
if (resourceCodeParent) {
|
|
@@ -3698,23 +4305,23 @@ var TabsMenuComponent = ({
|
|
|
3698
4305
|
const handleModal = (name) => {
|
|
3699
4306
|
setOpenModal((old) => ({ ...old, [name]: !(openModal[name] ?? false) }));
|
|
3700
4307
|
};
|
|
3701
|
-
return /* @__PURE__ */
|
|
4308
|
+
return /* @__PURE__ */ jsxs16(Fragment21, { children: [
|
|
3702
4309
|
renderModal ? renderModal({ handleModal, windowSize, openModal, setDataItem, dataItem }) : "",
|
|
3703
|
-
/* @__PURE__ */
|
|
3704
|
-
/* @__PURE__ */
|
|
4310
|
+
/* @__PURE__ */ jsxs16("div", { className: classNames6("tab-custom", { "tab-parent": tabParent }, { "tab-child": tabChild }), style: { width: `calc(100% - ${buttonWidth ?? 100}px` }, children: [
|
|
4311
|
+
/* @__PURE__ */ jsx17(
|
|
3705
4312
|
"div",
|
|
3706
4313
|
{
|
|
3707
4314
|
onClick: () => handleScroll(-200),
|
|
3708
4315
|
className: classNames6("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3709
|
-
children: /* @__PURE__ */
|
|
4316
|
+
children: /* @__PURE__ */ jsx17(ChevronLeft3, {})
|
|
3710
4317
|
}
|
|
3711
4318
|
),
|
|
3712
|
-
/* @__PURE__ */
|
|
4319
|
+
/* @__PURE__ */ jsx17("div", { id: `tab-component-${resourceCode}`, className: "tab-component", children: /* @__PURE__ */ jsx17("div", { id: `content-component-${resourceCode}`, children: dataMenu.map((item) => {
|
|
3713
4320
|
if (item?.resAttributes?.IS_MENU === "1") {
|
|
3714
|
-
return /* @__PURE__ */
|
|
3715
|
-
/* @__PURE__ */
|
|
3716
|
-
/* @__PURE__ */
|
|
3717
|
-
|
|
4321
|
+
return /* @__PURE__ */ jsxs16(UncontrolledDropdown2, { className: "tab-custom-item", isOpen: openMenu, toggle: toggleMenu, direction: "down", style: { backgroundColor: openMenu ? "#e0e0e0" : "" }, children: [
|
|
4322
|
+
/* @__PURE__ */ jsx17(DropdownToggle5, { color: "#00000", style: { border: "none", boxShadow: "none", margin: 0, padding: 0 }, className: "background-none", children: /* @__PURE__ */ jsx17("div", { children: item.name }) }),
|
|
4323
|
+
/* @__PURE__ */ jsx17(DropdownMenu5, { container: document.body, end: true, style: { width: 300 }, children: item?.children?.map((x) => /* @__PURE__ */ jsx17(
|
|
4324
|
+
DropdownItem4,
|
|
3718
4325
|
{
|
|
3719
4326
|
style: { borderRadius: "5px", margin: "0 0.5rem", width: "95%" },
|
|
3720
4327
|
onClick: () => {
|
|
@@ -3730,7 +4337,7 @@ var TabsMenuComponent = ({
|
|
|
3730
4337
|
)) })
|
|
3731
4338
|
] }, item.code);
|
|
3732
4339
|
} else {
|
|
3733
|
-
return /* @__PURE__ */
|
|
4340
|
+
return /* @__PURE__ */ jsx17(
|
|
3734
4341
|
Link,
|
|
3735
4342
|
{
|
|
3736
4343
|
to: item.url,
|
|
@@ -3741,12 +4348,12 @@ var TabsMenuComponent = ({
|
|
|
3741
4348
|
);
|
|
3742
4349
|
}
|
|
3743
4350
|
}) }) }),
|
|
3744
|
-
/* @__PURE__ */
|
|
4351
|
+
/* @__PURE__ */ jsx17(
|
|
3745
4352
|
"div",
|
|
3746
4353
|
{
|
|
3747
4354
|
onClick: () => handleScroll(200),
|
|
3748
4355
|
className: classNames6("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3749
|
-
children: /* @__PURE__ */
|
|
4356
|
+
children: /* @__PURE__ */ jsx17(ChevronRight4, {})
|
|
3750
4357
|
}
|
|
3751
4358
|
)
|
|
3752
4359
|
] })
|
|
@@ -3755,9 +4362,9 @@ var TabsMenuComponent = ({
|
|
|
3755
4362
|
|
|
3756
4363
|
// test-app/src/component/input-style/index.tsx
|
|
3757
4364
|
import { Bold, Droplet, Italic, Type, Underline } from "becoxy-icons";
|
|
3758
|
-
import { Button as
|
|
3759
|
-
import
|
|
3760
|
-
import { Fragment as
|
|
4365
|
+
import { Button as Button7, Input as Input10 } from "reactstrap";
|
|
4366
|
+
import classnames10 from "classnames";
|
|
4367
|
+
import { Fragment as Fragment22 } from "react";
|
|
3761
4368
|
|
|
3762
4369
|
// test-app/src/component/input-style/fonts.ts
|
|
3763
4370
|
var OptionFont = [
|
|
@@ -4616,7 +5223,7 @@ var OptionFont = [
|
|
|
4616
5223
|
];
|
|
4617
5224
|
|
|
4618
5225
|
// test-app/src/component/input-style/index.tsx
|
|
4619
|
-
import { jsx as
|
|
5226
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4620
5227
|
var InputStyleComponent = (props) => {
|
|
4621
5228
|
const {
|
|
4622
5229
|
value,
|
|
@@ -4630,8 +5237,8 @@ var InputStyleComponent = (props) => {
|
|
|
4630
5237
|
disabledItalic,
|
|
4631
5238
|
disabledUnderline
|
|
4632
5239
|
} = props;
|
|
4633
|
-
return /* @__PURE__ */
|
|
4634
|
-
/* @__PURE__ */
|
|
5240
|
+
return /* @__PURE__ */ jsx18(Fragment22, { children: /* @__PURE__ */ jsxs17("div", { className: "d-flex align-items-center", children: [
|
|
5241
|
+
/* @__PURE__ */ jsx18(
|
|
4635
5242
|
SelectTable,
|
|
4636
5243
|
{
|
|
4637
5244
|
options: OptionFont,
|
|
@@ -4647,12 +5254,12 @@ var InputStyleComponent = (props) => {
|
|
|
4647
5254
|
field: "label",
|
|
4648
5255
|
headerText: "",
|
|
4649
5256
|
template: (row) => {
|
|
4650
|
-
return /* @__PURE__ */
|
|
5257
|
+
return /* @__PURE__ */ jsx18("div", { style: { fontFamily: row.label }, children: row.label });
|
|
4651
5258
|
}
|
|
4652
5259
|
}
|
|
4653
5260
|
],
|
|
4654
5261
|
formatOptionLabel: (props2) => {
|
|
4655
|
-
return /* @__PURE__ */
|
|
5262
|
+
return /* @__PURE__ */ jsx18("p", { style: {
|
|
4656
5263
|
paddingLeft: 3,
|
|
4657
5264
|
borderRadius: 2,
|
|
4658
5265
|
fontFamily: value.fontFamily,
|
|
@@ -4665,7 +5272,7 @@ var InputStyleComponent = (props) => {
|
|
|
4665
5272
|
}
|
|
4666
5273
|
}
|
|
4667
5274
|
),
|
|
4668
|
-
/* @__PURE__ */
|
|
5275
|
+
/* @__PURE__ */ jsx18("div", { className: classnames10("ms-25", { "d-none": disabledFontSize }), style: { width: 60 }, children: /* @__PURE__ */ jsx18(
|
|
4669
5276
|
SelectTable,
|
|
4670
5277
|
{
|
|
4671
5278
|
options: Array.from({ length: 100 }, (_, i) => ({ value: i + 1, label: i + 1 })),
|
|
@@ -4677,45 +5284,45 @@ var InputStyleComponent = (props) => {
|
|
|
4677
5284
|
}
|
|
4678
5285
|
}
|
|
4679
5286
|
) }),
|
|
4680
|
-
/* @__PURE__ */
|
|
5287
|
+
/* @__PURE__ */ jsx18(
|
|
4681
5288
|
"div",
|
|
4682
5289
|
{
|
|
4683
|
-
className:
|
|
5290
|
+
className: classnames10("btn-input-style", { "active-custom": value.bold }, { "d-none": disabledBold }),
|
|
4684
5291
|
onClick: () => {
|
|
4685
5292
|
if (!disabled) {
|
|
4686
5293
|
onChange({ ...value, bold: !value.bold });
|
|
4687
5294
|
}
|
|
4688
5295
|
},
|
|
4689
|
-
children: /* @__PURE__ */
|
|
5296
|
+
children: /* @__PURE__ */ jsx18(Bold, { fontSize: 18 })
|
|
4690
5297
|
}
|
|
4691
5298
|
),
|
|
4692
|
-
/* @__PURE__ */
|
|
5299
|
+
/* @__PURE__ */ jsx18(
|
|
4693
5300
|
"div",
|
|
4694
5301
|
{
|
|
4695
|
-
className:
|
|
5302
|
+
className: classnames10("btn-input-style", { "active-custom": value.italic }, { "d-none": disabledItalic }),
|
|
4696
5303
|
onClick: () => {
|
|
4697
5304
|
if (!disabled) {
|
|
4698
5305
|
onChange({ ...value, italic: !value.italic });
|
|
4699
5306
|
}
|
|
4700
5307
|
},
|
|
4701
|
-
children: /* @__PURE__ */
|
|
5308
|
+
children: /* @__PURE__ */ jsx18(Italic, { fontSize: 18 })
|
|
4702
5309
|
}
|
|
4703
5310
|
),
|
|
4704
|
-
/* @__PURE__ */
|
|
5311
|
+
/* @__PURE__ */ jsx18(
|
|
4705
5312
|
"div",
|
|
4706
5313
|
{
|
|
4707
|
-
className:
|
|
5314
|
+
className: classnames10("btn-input-style", { "active-custom": value.underline }, { "d-none": disabledUnderline }),
|
|
4708
5315
|
onClick: () => {
|
|
4709
5316
|
if (!disabled) {
|
|
4710
5317
|
onChange({ ...value, underline: !value.underline });
|
|
4711
5318
|
}
|
|
4712
5319
|
},
|
|
4713
|
-
children: /* @__PURE__ */
|
|
5320
|
+
children: /* @__PURE__ */ jsx18(Underline, { fontSize: 18 })
|
|
4714
5321
|
}
|
|
4715
5322
|
),
|
|
4716
|
-
/* @__PURE__ */
|
|
4717
|
-
/* @__PURE__ */
|
|
4718
|
-
/* @__PURE__ */
|
|
5323
|
+
/* @__PURE__ */ jsxs17(Button7, { tag: "label", color: "none", className: classnames10("btn-input-style", { "d-none": disabledColor }), children: [
|
|
5324
|
+
/* @__PURE__ */ jsx18(Type, { stroke: value.color ?? "#000000", fontSize: 18 }),
|
|
5325
|
+
/* @__PURE__ */ jsx18(
|
|
4719
5326
|
"input",
|
|
4720
5327
|
{
|
|
4721
5328
|
type: "color",
|
|
@@ -4729,10 +5336,10 @@ var InputStyleComponent = (props) => {
|
|
|
4729
5336
|
}
|
|
4730
5337
|
)
|
|
4731
5338
|
] }),
|
|
4732
|
-
/* @__PURE__ */
|
|
4733
|
-
/* @__PURE__ */
|
|
4734
|
-
/* @__PURE__ */
|
|
4735
|
-
|
|
5339
|
+
/* @__PURE__ */ jsxs17(Button7, { tag: "label", color: "none", className: classnames10("btn-input-style", { "d-none": disabledBackgroundColor }), children: [
|
|
5340
|
+
/* @__PURE__ */ jsx18(Droplet, { fill: value.backgroundColor ?? "#ffffff", fontSize: 18 }),
|
|
5341
|
+
/* @__PURE__ */ jsx18(
|
|
5342
|
+
Input10,
|
|
4736
5343
|
{
|
|
4737
5344
|
id: "backgroundColor",
|
|
4738
5345
|
type: "color",
|