react-table-edit 0.3.0 → 0.3.2
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 +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +54 -29
- package/dist/index.mjs +46 -28
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -152,4 +152,21 @@ declare const notificationError: (param: string) => string;
|
|
|
152
152
|
declare const notificationSuccess: (param: string) => string;
|
|
153
153
|
declare const messageBoxConfirm2: (t: TFunction<"translation", undefined>, data: any, data2: any, message: string) => Promise<boolean>;
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
declare const useOnClickOutside: (ref: any, handler: any) => void;
|
|
156
|
+
declare const isNullOrUndefined: (d: any) => boolean;
|
|
157
|
+
declare const generateUUID: () => string;
|
|
158
|
+
/**
|
|
159
|
+
* format chuỗi kí tự số
|
|
160
|
+
* @param str chuỗi số cần format
|
|
161
|
+
* @param decimalSeparator kí tự thập phân
|
|
162
|
+
* @param thousandSeparator kí tự phân cách hàng nghìn
|
|
163
|
+
* @param fraction số kí tự thập phân
|
|
164
|
+
* @param isDone đã nhập xong
|
|
165
|
+
* @returns
|
|
166
|
+
*/
|
|
167
|
+
declare const objSymbolDecimal: any;
|
|
168
|
+
declare const objSymbolThousand: any;
|
|
169
|
+
declare const formartNumberic: (str: string | number, decimalSeparator: string, thousandSeparator: string, fraction?: number, isDone?: boolean) => string;
|
|
170
|
+
declare const roundNumber: (num: number, fraction: number) => number;
|
|
171
|
+
|
|
172
|
+
export { type FromItemsField, type IColumnTable, type ICommandItem, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFTableEditProps, type IFToolbarOptions, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, TableEdit as default, formartNumberic, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, objSymbolDecimal, objSymbolThousand, roundNumber, useOnClickOutside };
|
package/dist/index.d.ts
CHANGED
|
@@ -152,4 +152,21 @@ declare const notificationError: (param: string) => string;
|
|
|
152
152
|
declare const notificationSuccess: (param: string) => string;
|
|
153
153
|
declare const messageBoxConfirm2: (t: TFunction<"translation", undefined>, data: any, data2: any, message: string) => Promise<boolean>;
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
declare const useOnClickOutside: (ref: any, handler: any) => void;
|
|
156
|
+
declare const isNullOrUndefined: (d: any) => boolean;
|
|
157
|
+
declare const generateUUID: () => string;
|
|
158
|
+
/**
|
|
159
|
+
* format chuỗi kí tự số
|
|
160
|
+
* @param str chuỗi số cần format
|
|
161
|
+
* @param decimalSeparator kí tự thập phân
|
|
162
|
+
* @param thousandSeparator kí tự phân cách hàng nghìn
|
|
163
|
+
* @param fraction số kí tự thập phân
|
|
164
|
+
* @param isDone đã nhập xong
|
|
165
|
+
* @returns
|
|
166
|
+
*/
|
|
167
|
+
declare const objSymbolDecimal: any;
|
|
168
|
+
declare const objSymbolThousand: any;
|
|
169
|
+
declare const formartNumberic: (str: string | number, decimalSeparator: string, thousandSeparator: string, fraction?: number, isDone?: boolean) => string;
|
|
170
|
+
declare const roundNumber: (num: number, fraction: number) => number;
|
|
171
|
+
|
|
172
|
+
export { type FromItemsField, type IColumnTable, type ICommandItem, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFTableEditProps, type IFToolbarOptions, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, TableEdit as default, formartNumberic, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, objSymbolDecimal, objSymbolThousand, roundNumber, useOnClickOutside };
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var Table_edit_exports = {};
|
|
32
32
|
__export(Table_edit_exports, {
|
|
33
33
|
default: () => Table_edit_default,
|
|
34
|
+
formartNumberic: () => formartNumberic,
|
|
35
|
+
generateUUID: () => generateUUID,
|
|
36
|
+
isNullOrUndefined: () => isNullOrUndefined,
|
|
34
37
|
messageBoxConfirm: () => messageBoxConfirm,
|
|
35
38
|
messageBoxConfirm2: () => messageBoxConfirm2,
|
|
36
39
|
messageBoxConfirmDelete: () => messageBoxConfirmDelete,
|
|
@@ -38,7 +41,11 @@ __export(Table_edit_exports, {
|
|
|
38
41
|
messageHtmlBoxConfirm: () => messageHtmlBoxConfirm,
|
|
39
42
|
messageHtmlBoxError: () => messageHtmlBoxError,
|
|
40
43
|
notificationError: () => notificationError,
|
|
41
|
-
notificationSuccess: () => notificationSuccess
|
|
44
|
+
notificationSuccess: () => notificationSuccess,
|
|
45
|
+
objSymbolDecimal: () => objSymbolDecimal,
|
|
46
|
+
objSymbolThousand: () => objSymbolThousand,
|
|
47
|
+
roundNumber: () => roundNumber,
|
|
48
|
+
useOnClickOutside: () => useOnClickOutside
|
|
42
49
|
});
|
|
43
50
|
module.exports = __toCommonJS(Table_edit_exports);
|
|
44
51
|
|
|
@@ -269,6 +276,8 @@ var generateUUID = () => {
|
|
|
269
276
|
return (c === "x" ? r : 3).toString(16);
|
|
270
277
|
});
|
|
271
278
|
};
|
|
279
|
+
var objSymbolDecimal = { 0: ",", 1: "." };
|
|
280
|
+
var objSymbolThousand = { 1: ",", 0: "." };
|
|
272
281
|
var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10, isDone) => {
|
|
273
282
|
if (isDone) {
|
|
274
283
|
str = roundNumber(Number(str), fraction);
|
|
@@ -281,6 +290,12 @@ var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10,
|
|
|
281
290
|
if (arr[0].length < 3) {
|
|
282
291
|
return flag ? `${arr[0]}${decimalSeparator}${arr[1]?.substring(0, fraction) ?? ""}` : arr[0];
|
|
283
292
|
} else {
|
|
293
|
+
let flagNegative = false;
|
|
294
|
+
if (arr[0][0] === "-") {
|
|
295
|
+
flagNegative = true;
|
|
296
|
+
arr[0] = arr[0].substring(1, arr[0].length);
|
|
297
|
+
console.log(arr[0].substring(1, arr[0].length));
|
|
298
|
+
}
|
|
284
299
|
let count = 0;
|
|
285
300
|
for (let i = arr[0].length - 2; i >= 0; i--) {
|
|
286
301
|
if ((arr[0].length - i - count) % 3 === 0 && i > 0) {
|
|
@@ -294,6 +309,9 @@ var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10,
|
|
|
294
309
|
if (isDone) {
|
|
295
310
|
flag = (arr[1]?.substring(0, fraction) ?? "") !== "";
|
|
296
311
|
}
|
|
312
|
+
if (flagNegative) {
|
|
313
|
+
arr[0] = "-".concat(arr[0]);
|
|
314
|
+
}
|
|
297
315
|
return flag ? `${arr[0]}${decimalSeparator}${arr[1]?.substring(0, fraction) ?? ""}` : arr[0];
|
|
298
316
|
}
|
|
299
317
|
} else {
|
|
@@ -1561,28 +1579,30 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
1561
1579
|
(0, import_react12.useEffect)(() => {
|
|
1562
1580
|
const arrHeaderColumns = [];
|
|
1563
1581
|
const arrContentColumns = [];
|
|
1564
|
-
let
|
|
1582
|
+
let headerLevelRow = 0;
|
|
1565
1583
|
if (levelCol) {
|
|
1566
|
-
|
|
1584
|
+
headerLevelRow = levelCol;
|
|
1567
1585
|
} else {
|
|
1568
|
-
|
|
1569
|
-
setLevelCol(
|
|
1586
|
+
headerLevelRow = stretchColumn(columns, 0);
|
|
1587
|
+
setLevelCol(headerLevelRow);
|
|
1570
1588
|
}
|
|
1571
|
-
for (let i = 0; i <
|
|
1589
|
+
for (let i = 0; i < headerLevelRow; i++) {
|
|
1572
1590
|
arrHeaderColumns.push([]);
|
|
1573
1591
|
}
|
|
1574
|
-
|
|
1592
|
+
console.log(headerLevelRow);
|
|
1593
|
+
getNestedChildren(columns, arrHeaderColumns, arrContentColumns, 0, headerLevelRow);
|
|
1575
1594
|
setHeaderColumns(arrHeaderColumns);
|
|
1595
|
+
console.log(arrHeaderColumns);
|
|
1576
1596
|
setContentColumns(arrContentColumns);
|
|
1577
|
-
}, [
|
|
1578
|
-
const getNestedChildren = (array, arrHeaderColumns, arrContentColumns, level,
|
|
1579
|
-
array.forEach((item) => {
|
|
1580
|
-
const ele = { ...item, visible: item.invisibleDisable ? item.visible : contentColumns[
|
|
1597
|
+
}, []);
|
|
1598
|
+
const getNestedChildren = (array, arrHeaderColumns, arrContentColumns, level, maxLevelRow) => {
|
|
1599
|
+
array.forEach((item, index) => {
|
|
1600
|
+
const ele = { ...item, visible: item.invisibleDisable ? item.visible : contentColumns[index]?.visible ?? item.visible, rowspan: 1, index: 0 };
|
|
1581
1601
|
if (item.columns && item.columns?.length > 0) {
|
|
1582
|
-
const countLevel = getNestedChildren(item.columns, arrHeaderColumns, arrContentColumns, level + 1,
|
|
1583
|
-
arrHeaderColumns[
|
|
1602
|
+
const countLevel = getNestedChildren(item.columns, arrHeaderColumns, arrContentColumns, level + 1, maxLevelRow);
|
|
1603
|
+
arrHeaderColumns[maxLevelRow - 1 - countLevel].push(ele);
|
|
1584
1604
|
} else {
|
|
1585
|
-
ele.rowspan =
|
|
1605
|
+
ele.rowspan = maxLevelRow - level;
|
|
1586
1606
|
ele.index = arrContentColumns.length;
|
|
1587
1607
|
arrHeaderColumns[level].push(ele);
|
|
1588
1608
|
arrContentColumns.push(ele);
|
|
@@ -1590,11 +1610,11 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
1590
1610
|
});
|
|
1591
1611
|
return level;
|
|
1592
1612
|
};
|
|
1593
|
-
const stretchColumn = (subColumns,
|
|
1594
|
-
let count =
|
|
1613
|
+
const stretchColumn = (subColumns, headerLevelRow) => {
|
|
1614
|
+
let count = headerLevelRow + 1;
|
|
1595
1615
|
subColumns.map((item) => {
|
|
1596
1616
|
if (item.columns && item.columns.length > 0) {
|
|
1597
|
-
const newCount = stretchColumn(item.columns,
|
|
1617
|
+
const newCount = stretchColumn(item.columns, headerLevelRow + 1);
|
|
1598
1618
|
if (newCount > count) {
|
|
1599
1619
|
count = newCount;
|
|
1600
1620
|
}
|
|
@@ -2592,7 +2612,8 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
2592
2612
|
id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
|
|
2593
2613
|
className: (0, import_classnames10.default)("r-rowcell-content", { "r-is-invalid": errorMessage }),
|
|
2594
2614
|
style: {
|
|
2595
|
-
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2
|
|
2615
|
+
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2,
|
|
2616
|
+
color: col.editType === "numeric" && Number(row[col.field]) < 0 ? "red" : ""
|
|
2596
2617
|
},
|
|
2597
2618
|
children: [
|
|
2598
2619
|
typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : !col.haveToolTip ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -2634,7 +2655,7 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
2634
2655
|
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2635
2656
|
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2636
2657
|
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
2637
|
-
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") :
|
|
2658
|
+
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto",
|
|
2638
2659
|
maxWidth: col.maxWidth
|
|
2639
2660
|
},
|
|
2640
2661
|
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -2642,8 +2663,7 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
2642
2663
|
{
|
|
2643
2664
|
style: {
|
|
2644
2665
|
height: `${(col.rowspan ?? 1) * 42}px`,
|
|
2645
|
-
justifyContent: col.textAlign ?? "left"
|
|
2646
|
-
textAlign: col.textAlign ?? "left"
|
|
2666
|
+
justifyContent: col.textAlign ?? "left"
|
|
2647
2667
|
},
|
|
2648
2668
|
className: (0, import_classnames10.default)("r-headercell-div"),
|
|
2649
2669
|
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -2698,8 +2718,7 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
2698
2718
|
title: t(col.headerText ?? ""),
|
|
2699
2719
|
style: {
|
|
2700
2720
|
height: `${(col.rowspan ?? 1) * 42}px`,
|
|
2701
|
-
justifyContent: col.textAlign ?? "left"
|
|
2702
|
-
textAlign: col.textAlign ?? "left"
|
|
2721
|
+
justifyContent: col.textAlign ?? "left"
|
|
2703
2722
|
},
|
|
2704
2723
|
className: "r-headercell-div",
|
|
2705
2724
|
children: t(col.headerText ?? "")
|
|
@@ -2725,7 +2744,7 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
2725
2744
|
),
|
|
2726
2745
|
style: {
|
|
2727
2746
|
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
2728
|
-
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") :
|
|
2747
|
+
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto",
|
|
2729
2748
|
top: `${indexParent * 42}px`,
|
|
2730
2749
|
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2731
2750
|
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
|
|
@@ -2738,8 +2757,7 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
2738
2757
|
title: t(col.headerText ?? ""),
|
|
2739
2758
|
style: {
|
|
2740
2759
|
height: `${(col.rowspan ?? 1) * 42}px`,
|
|
2741
|
-
justifyContent: col.textAlign ?? "left"
|
|
2742
|
-
textAlign: col.textAlign ?? "left"
|
|
2760
|
+
justifyContent: col.textAlign ?? "left"
|
|
2743
2761
|
},
|
|
2744
2762
|
className: "r-headercell-div",
|
|
2745
2763
|
children: t(col.headerText ?? "")
|
|
@@ -2763,8 +2781,8 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
2763
2781
|
style: {
|
|
2764
2782
|
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
2765
2783
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
2766
|
-
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") :
|
|
2767
|
-
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") :
|
|
2784
|
+
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto",
|
|
2785
|
+
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto",
|
|
2768
2786
|
maxWidth: col.maxWidth,
|
|
2769
2787
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2770
2788
|
},
|
|
@@ -2885,6 +2903,9 @@ var table_default = TableEdit;
|
|
|
2885
2903
|
var Table_edit_default = table_default;
|
|
2886
2904
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2887
2905
|
0 && (module.exports = {
|
|
2906
|
+
formartNumberic,
|
|
2907
|
+
generateUUID,
|
|
2908
|
+
isNullOrUndefined,
|
|
2888
2909
|
messageBoxConfirm,
|
|
2889
2910
|
messageBoxConfirm2,
|
|
2890
2911
|
messageBoxConfirmDelete,
|
|
@@ -2892,5 +2913,9 @@ var Table_edit_default = table_default;
|
|
|
2892
2913
|
messageHtmlBoxConfirm,
|
|
2893
2914
|
messageHtmlBoxError,
|
|
2894
2915
|
notificationError,
|
|
2895
|
-
notificationSuccess
|
|
2916
|
+
notificationSuccess,
|
|
2917
|
+
objSymbolDecimal,
|
|
2918
|
+
objSymbolThousand,
|
|
2919
|
+
roundNumber,
|
|
2920
|
+
useOnClickOutside
|
|
2896
2921
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -225,6 +225,8 @@ var generateUUID = () => {
|
|
|
225
225
|
return (c === "x" ? r : 3).toString(16);
|
|
226
226
|
});
|
|
227
227
|
};
|
|
228
|
+
var objSymbolDecimal = { 0: ",", 1: "." };
|
|
229
|
+
var objSymbolThousand = { 1: ",", 0: "." };
|
|
228
230
|
var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10, isDone) => {
|
|
229
231
|
if (isDone) {
|
|
230
232
|
str = roundNumber(Number(str), fraction);
|
|
@@ -237,6 +239,12 @@ var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10,
|
|
|
237
239
|
if (arr[0].length < 3) {
|
|
238
240
|
return flag ? `${arr[0]}${decimalSeparator}${arr[1]?.substring(0, fraction) ?? ""}` : arr[0];
|
|
239
241
|
} else {
|
|
242
|
+
let flagNegative = false;
|
|
243
|
+
if (arr[0][0] === "-") {
|
|
244
|
+
flagNegative = true;
|
|
245
|
+
arr[0] = arr[0].substring(1, arr[0].length);
|
|
246
|
+
console.log(arr[0].substring(1, arr[0].length));
|
|
247
|
+
}
|
|
240
248
|
let count = 0;
|
|
241
249
|
for (let i = arr[0].length - 2; i >= 0; i--) {
|
|
242
250
|
if ((arr[0].length - i - count) % 3 === 0 && i > 0) {
|
|
@@ -250,6 +258,9 @@ var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10,
|
|
|
250
258
|
if (isDone) {
|
|
251
259
|
flag = (arr[1]?.substring(0, fraction) ?? "") !== "";
|
|
252
260
|
}
|
|
261
|
+
if (flagNegative) {
|
|
262
|
+
arr[0] = "-".concat(arr[0]);
|
|
263
|
+
}
|
|
253
264
|
return flag ? `${arr[0]}${decimalSeparator}${arr[1]?.substring(0, fraction) ?? ""}` : arr[0];
|
|
254
265
|
}
|
|
255
266
|
} else {
|
|
@@ -1527,28 +1538,30 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1527
1538
|
useEffect5(() => {
|
|
1528
1539
|
const arrHeaderColumns = [];
|
|
1529
1540
|
const arrContentColumns = [];
|
|
1530
|
-
let
|
|
1541
|
+
let headerLevelRow = 0;
|
|
1531
1542
|
if (levelCol) {
|
|
1532
|
-
|
|
1543
|
+
headerLevelRow = levelCol;
|
|
1533
1544
|
} else {
|
|
1534
|
-
|
|
1535
|
-
setLevelCol(
|
|
1545
|
+
headerLevelRow = stretchColumn(columns, 0);
|
|
1546
|
+
setLevelCol(headerLevelRow);
|
|
1536
1547
|
}
|
|
1537
|
-
for (let i = 0; i <
|
|
1548
|
+
for (let i = 0; i < headerLevelRow; i++) {
|
|
1538
1549
|
arrHeaderColumns.push([]);
|
|
1539
1550
|
}
|
|
1540
|
-
|
|
1551
|
+
console.log(headerLevelRow);
|
|
1552
|
+
getNestedChildren(columns, arrHeaderColumns, arrContentColumns, 0, headerLevelRow);
|
|
1541
1553
|
setHeaderColumns(arrHeaderColumns);
|
|
1554
|
+
console.log(arrHeaderColumns);
|
|
1542
1555
|
setContentColumns(arrContentColumns);
|
|
1543
|
-
}, [
|
|
1544
|
-
const getNestedChildren = (array, arrHeaderColumns, arrContentColumns, level,
|
|
1545
|
-
array.forEach((item) => {
|
|
1546
|
-
const ele = { ...item, visible: item.invisibleDisable ? item.visible : contentColumns[
|
|
1556
|
+
}, []);
|
|
1557
|
+
const getNestedChildren = (array, arrHeaderColumns, arrContentColumns, level, maxLevelRow) => {
|
|
1558
|
+
array.forEach((item, index) => {
|
|
1559
|
+
const ele = { ...item, visible: item.invisibleDisable ? item.visible : contentColumns[index]?.visible ?? item.visible, rowspan: 1, index: 0 };
|
|
1547
1560
|
if (item.columns && item.columns?.length > 0) {
|
|
1548
|
-
const countLevel = getNestedChildren(item.columns, arrHeaderColumns, arrContentColumns, level + 1,
|
|
1549
|
-
arrHeaderColumns[
|
|
1561
|
+
const countLevel = getNestedChildren(item.columns, arrHeaderColumns, arrContentColumns, level + 1, maxLevelRow);
|
|
1562
|
+
arrHeaderColumns[maxLevelRow - 1 - countLevel].push(ele);
|
|
1550
1563
|
} else {
|
|
1551
|
-
ele.rowspan =
|
|
1564
|
+
ele.rowspan = maxLevelRow - level;
|
|
1552
1565
|
ele.index = arrContentColumns.length;
|
|
1553
1566
|
arrHeaderColumns[level].push(ele);
|
|
1554
1567
|
arrContentColumns.push(ele);
|
|
@@ -1556,11 +1569,11 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1556
1569
|
});
|
|
1557
1570
|
return level;
|
|
1558
1571
|
};
|
|
1559
|
-
const stretchColumn = (subColumns,
|
|
1560
|
-
let count =
|
|
1572
|
+
const stretchColumn = (subColumns, headerLevelRow) => {
|
|
1573
|
+
let count = headerLevelRow + 1;
|
|
1561
1574
|
subColumns.map((item) => {
|
|
1562
1575
|
if (item.columns && item.columns.length > 0) {
|
|
1563
|
-
const newCount = stretchColumn(item.columns,
|
|
1576
|
+
const newCount = stretchColumn(item.columns, headerLevelRow + 1);
|
|
1564
1577
|
if (newCount > count) {
|
|
1565
1578
|
count = newCount;
|
|
1566
1579
|
}
|
|
@@ -2558,7 +2571,8 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2558
2571
|
id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
|
|
2559
2572
|
className: classnames6("r-rowcell-content", { "r-is-invalid": errorMessage }),
|
|
2560
2573
|
style: {
|
|
2561
|
-
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2
|
|
2574
|
+
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2,
|
|
2575
|
+
color: col.editType === "numeric" && Number(row[col.field]) < 0 ? "red" : ""
|
|
2562
2576
|
},
|
|
2563
2577
|
children: [
|
|
2564
2578
|
typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : !col.haveToolTip ? /* @__PURE__ */ jsx12("div", { className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }) : /* @__PURE__ */ jsx12(
|
|
@@ -2600,7 +2614,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2600
2614
|
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2601
2615
|
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2602
2616
|
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
2603
|
-
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") :
|
|
2617
|
+
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto",
|
|
2604
2618
|
maxWidth: col.maxWidth
|
|
2605
2619
|
},
|
|
2606
2620
|
children: /* @__PURE__ */ jsx12(
|
|
@@ -2608,8 +2622,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2608
2622
|
{
|
|
2609
2623
|
style: {
|
|
2610
2624
|
height: `${(col.rowspan ?? 1) * 42}px`,
|
|
2611
|
-
justifyContent: col.textAlign ?? "left"
|
|
2612
|
-
textAlign: col.textAlign ?? "left"
|
|
2625
|
+
justifyContent: col.textAlign ?? "left"
|
|
2613
2626
|
},
|
|
2614
2627
|
className: classnames6("r-headercell-div"),
|
|
2615
2628
|
children: /* @__PURE__ */ jsx12(
|
|
@@ -2664,8 +2677,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2664
2677
|
title: t(col.headerText ?? ""),
|
|
2665
2678
|
style: {
|
|
2666
2679
|
height: `${(col.rowspan ?? 1) * 42}px`,
|
|
2667
|
-
justifyContent: col.textAlign ?? "left"
|
|
2668
|
-
textAlign: col.textAlign ?? "left"
|
|
2680
|
+
justifyContent: col.textAlign ?? "left"
|
|
2669
2681
|
},
|
|
2670
2682
|
className: "r-headercell-div",
|
|
2671
2683
|
children: t(col.headerText ?? "")
|
|
@@ -2691,7 +2703,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2691
2703
|
),
|
|
2692
2704
|
style: {
|
|
2693
2705
|
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
2694
|
-
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") :
|
|
2706
|
+
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto",
|
|
2695
2707
|
top: `${indexParent * 42}px`,
|
|
2696
2708
|
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
2697
2709
|
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
|
|
@@ -2704,8 +2716,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2704
2716
|
title: t(col.headerText ?? ""),
|
|
2705
2717
|
style: {
|
|
2706
2718
|
height: `${(col.rowspan ?? 1) * 42}px`,
|
|
2707
|
-
justifyContent: col.textAlign ?? "left"
|
|
2708
|
-
textAlign: col.textAlign ?? "left"
|
|
2719
|
+
justifyContent: col.textAlign ?? "left"
|
|
2709
2720
|
},
|
|
2710
2721
|
className: "r-headercell-div",
|
|
2711
2722
|
children: t(col.headerText ?? "")
|
|
@@ -2729,8 +2740,8 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2729
2740
|
style: {
|
|
2730
2741
|
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
2731
2742
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
2732
|
-
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") :
|
|
2733
|
-
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") :
|
|
2743
|
+
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto",
|
|
2744
|
+
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto",
|
|
2734
2745
|
maxWidth: col.maxWidth,
|
|
2735
2746
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2736
2747
|
},
|
|
@@ -2851,6 +2862,9 @@ var table_default = TableEdit;
|
|
|
2851
2862
|
var Table_edit_default = table_default;
|
|
2852
2863
|
export {
|
|
2853
2864
|
Table_edit_default as default,
|
|
2865
|
+
formartNumberic,
|
|
2866
|
+
generateUUID,
|
|
2867
|
+
isNullOrUndefined,
|
|
2854
2868
|
messageBoxConfirm,
|
|
2855
2869
|
messageBoxConfirm2,
|
|
2856
2870
|
messageBoxConfirmDelete,
|
|
@@ -2858,5 +2872,9 @@ export {
|
|
|
2858
2872
|
messageHtmlBoxConfirm,
|
|
2859
2873
|
messageHtmlBoxError,
|
|
2860
2874
|
notificationError,
|
|
2861
|
-
notificationSuccess
|
|
2875
|
+
notificationSuccess,
|
|
2876
|
+
objSymbolDecimal,
|
|
2877
|
+
objSymbolThousand,
|
|
2878
|
+
roundNumber,
|
|
2879
|
+
useOnClickOutside
|
|
2862
2880
|
};
|