react-table-edit 1.5.42 → 1.5.43
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/component/table-view/content.d.ts +1 -0
- package/dist/component/table-view/index.d.ts +1 -0
- package/dist/component/table-view/table.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +249 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +249 -82
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -20246,7 +20246,7 @@ const TableElement$1 = React__default.memo((props) => {
|
|
|
20246
20246
|
|
|
20247
20247
|
const defaultMaxHeight$1 = 250;
|
|
20248
20248
|
const SelectTable = forwardRef((props, ref) => {
|
|
20249
|
-
const { id, menuWidth, width, invalid, placeholder, textAlign, options, columns, value, fieldValue, fieldLabel, maxHeight, isClearable, component, isMulti, noHeader, isDisabled, showFooter, formatSetting, allowCreate, onPaste, onChange, handleAdd, onKeyDown, onOpenMenu, loadOptions, onCloseMenu, footerComponent, formatOptionLabel, compareFunction } = props;
|
|
20249
|
+
const { id, menuWidth, width, invalid, placeholder, textAlign, options, columns, value, fieldValue, fieldLabel, maxHeight, isClearable, component, isMulti, noHeader, isDisabled, showFooter, formatSetting, allowCreate, onPaste, onChange, handleAdd, onKeyDown, onOpenMenu, loadOptions, onCloseMenu, footerComponent, formatOptionLabel, compareFunction, } = props;
|
|
20250
20250
|
const selectTableRef = useRef(null);
|
|
20251
20251
|
const selectMenuTableRef = useRef(null);
|
|
20252
20252
|
const inputRef = useRef(null);
|
|
@@ -20263,8 +20263,8 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20263
20263
|
{
|
|
20264
20264
|
headerText: 'Name',
|
|
20265
20265
|
field: fieldLabel ?? 'label',
|
|
20266
|
-
width: menuWidth
|
|
20267
|
-
}
|
|
20266
|
+
width: menuWidth,
|
|
20267
|
+
},
|
|
20268
20268
|
];
|
|
20269
20269
|
const closeMenu = () => {
|
|
20270
20270
|
setDropdownOpen(false);
|
|
@@ -20274,7 +20274,12 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20274
20274
|
};
|
|
20275
20275
|
const handChange = (val) => {
|
|
20276
20276
|
if (val && val.isCreated) {
|
|
20277
|
-
const newVal = {
|
|
20277
|
+
const newVal = {
|
|
20278
|
+
...val,
|
|
20279
|
+
[fieldLabel ?? 'label']: val.valueCreate,
|
|
20280
|
+
isCreated: undefined,
|
|
20281
|
+
isCreatedItem: true,
|
|
20282
|
+
};
|
|
20278
20283
|
options.unshift(newVal);
|
|
20279
20284
|
onChange(newVal);
|
|
20280
20285
|
return;
|
|
@@ -20283,7 +20288,9 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20283
20288
|
};
|
|
20284
20289
|
useEffect(() => {
|
|
20285
20290
|
if (dropdownOpen && value && !isMulti && selectMenuTableRef) {
|
|
20286
|
-
const index = currentOptions?.findIndex((row) =>
|
|
20291
|
+
const index = currentOptions?.findIndex((row) => compareFunction
|
|
20292
|
+
? compareFunction(row)
|
|
20293
|
+
: row[fieldValue ?? 'value'] === value[fieldValue ?? 'value']);
|
|
20287
20294
|
if (index >= 0) {
|
|
20288
20295
|
selectMenuTableRef.current.scrollTo({ top: (index - 1) * 30 });
|
|
20289
20296
|
}
|
|
@@ -20330,14 +20337,28 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20330
20337
|
}
|
|
20331
20338
|
}
|
|
20332
20339
|
};
|
|
20333
|
-
const listKeyUse = [
|
|
20340
|
+
const listKeyUse = [
|
|
20341
|
+
'Escape',
|
|
20342
|
+
'Space',
|
|
20343
|
+
'Enter',
|
|
20344
|
+
'Tab',
|
|
20345
|
+
'NumpadEnter',
|
|
20346
|
+
'ArrowDown',
|
|
20347
|
+
'ArrowUp',
|
|
20348
|
+
'F9',
|
|
20349
|
+
];
|
|
20334
20350
|
const handleOnKeyDown = (e) => {
|
|
20335
20351
|
let key = '';
|
|
20336
20352
|
if (onKeyDown &&
|
|
20337
20353
|
(!dropdownOpen ||
|
|
20338
20354
|
!listKeyUse.includes(e.code) ||
|
|
20339
|
-
((e.code === 'Enter' ||
|
|
20340
|
-
|
|
20355
|
+
((e.code === 'Enter' ||
|
|
20356
|
+
e.code === 'Tab' ||
|
|
20357
|
+
e.code === 'NumpadEnter' ||
|
|
20358
|
+
e.code === 'Space') &&
|
|
20359
|
+
!(currentOptions[indexFocus] || haveCreateNew)) ||
|
|
20360
|
+
((e.code === 'ArrowDown' || e.code === 'ArrowUp') &&
|
|
20361
|
+
currentOptions.length === 0) ||
|
|
20341
20362
|
(e.code === 'Escape' && !(isClearable && value && !isDisabled)))) {
|
|
20342
20363
|
key = onKeyDown(e);
|
|
20343
20364
|
}
|
|
@@ -20350,7 +20371,12 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20350
20371
|
else if (e.code === 'Space') {
|
|
20351
20372
|
let newItem;
|
|
20352
20373
|
if (haveCreateNew && indexFocus === 0) {
|
|
20353
|
-
newItem = {
|
|
20374
|
+
newItem = {
|
|
20375
|
+
valueCreate: searchTerm,
|
|
20376
|
+
[fieldValue ?? 'value']: searchTerm,
|
|
20377
|
+
[fieldLabel ?? 'label']: `${t('Create')} '${searchTerm}'`,
|
|
20378
|
+
isCreated: true,
|
|
20379
|
+
};
|
|
20354
20380
|
}
|
|
20355
20381
|
else {
|
|
20356
20382
|
newItem = currentOptions[indexFocus];
|
|
@@ -20371,10 +20397,17 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20371
20397
|
flag = true;
|
|
20372
20398
|
}
|
|
20373
20399
|
}
|
|
20374
|
-
else if (e.code === 'Enter' ||
|
|
20400
|
+
else if (e.code === 'Enter' ||
|
|
20401
|
+
e.code === 'Tab' ||
|
|
20402
|
+
e.code === 'NumpadEnter') {
|
|
20375
20403
|
let newItem;
|
|
20376
20404
|
if (haveCreateNew && indexFocus === 0) {
|
|
20377
|
-
newItem = {
|
|
20405
|
+
newItem = {
|
|
20406
|
+
valueCreate: searchTerm,
|
|
20407
|
+
[fieldValue ?? 'value']: searchTerm,
|
|
20408
|
+
[fieldLabel ?? 'label']: `${t('Create')} '${searchTerm}'`,
|
|
20409
|
+
isCreated: true,
|
|
20410
|
+
};
|
|
20378
20411
|
}
|
|
20379
20412
|
else {
|
|
20380
20413
|
newItem = currentOptions[indexFocus];
|
|
@@ -20392,7 +20425,10 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20392
20425
|
newIndex = indexFocus + 1;
|
|
20393
20426
|
}
|
|
20394
20427
|
else if (value) {
|
|
20395
|
-
newIndex =
|
|
20428
|
+
newIndex =
|
|
20429
|
+
currentOptions?.findIndex((row) => compareFunction
|
|
20430
|
+
? compareFunction(row)
|
|
20431
|
+
: row[fieldValue ?? 'value'] === value[fieldValue ?? 'value']) + 1;
|
|
20396
20432
|
}
|
|
20397
20433
|
if (newIndex < currentOptions.length) {
|
|
20398
20434
|
setIndexFocus(newIndex);
|
|
@@ -20416,7 +20452,10 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20416
20452
|
newIndex = indexFocus - 1;
|
|
20417
20453
|
}
|
|
20418
20454
|
else if (value) {
|
|
20419
|
-
newIndex =
|
|
20455
|
+
newIndex =
|
|
20456
|
+
currentOptions?.findIndex((row) => compareFunction
|
|
20457
|
+
? compareFunction(row)
|
|
20458
|
+
: row[fieldValue ?? 'value'] === value[fieldValue ?? 'value']) - 1;
|
|
20420
20459
|
}
|
|
20421
20460
|
if (newIndex >= 0) {
|
|
20422
20461
|
setIndexFocus(newIndex);
|
|
@@ -20449,7 +20488,11 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20449
20488
|
scrollToElement(selectMenuTableRef.current, selectMenuTableRef.current.scrollHeight);
|
|
20450
20489
|
}
|
|
20451
20490
|
else if (flag === 0 && rect.bottom + 30 > parentRect.bottom) {
|
|
20452
|
-
scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop -
|
|
20491
|
+
scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop -
|
|
20492
|
+
selectMenuTableRef.current.offsetTop -
|
|
20493
|
+
parentRect.height +
|
|
20494
|
+
rect.height +
|
|
20495
|
+
50);
|
|
20453
20496
|
}
|
|
20454
20497
|
else if (flag === 2 && rect.top < parentRect.top + 50) {
|
|
20455
20498
|
scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop - 65);
|
|
@@ -20463,7 +20506,7 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20463
20506
|
timeOutElement = setTimeout(() => {
|
|
20464
20507
|
elemment.scrollTo({
|
|
20465
20508
|
top,
|
|
20466
|
-
behavior: 'smooth'
|
|
20509
|
+
behavior: 'smooth',
|
|
20467
20510
|
});
|
|
20468
20511
|
}, 100);
|
|
20469
20512
|
};
|
|
@@ -20473,7 +20516,12 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20473
20516
|
}
|
|
20474
20517
|
for (let index = 0; index < columnsSearch.length; index++) {
|
|
20475
20518
|
const key = columnsSearch[index].field.trim();
|
|
20476
|
-
if (data[key] &&
|
|
20519
|
+
if (data[key] &&
|
|
20520
|
+
data[key]
|
|
20521
|
+
.toString()
|
|
20522
|
+
.trim()
|
|
20523
|
+
.toLowerCase()
|
|
20524
|
+
.includes(keyword.trim().toLowerCase())) {
|
|
20477
20525
|
return true;
|
|
20478
20526
|
}
|
|
20479
20527
|
}
|
|
@@ -20489,7 +20537,8 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20489
20537
|
if (!searchTerm) {
|
|
20490
20538
|
setOptionsLoad(undefined);
|
|
20491
20539
|
}
|
|
20492
|
-
else if (allowCreate &&
|
|
20540
|
+
else if (allowCreate &&
|
|
20541
|
+
!currentOptions?.find((x) => x[fieldLabel ?? 'label'] === searchTerm)) {
|
|
20493
20542
|
setHaveCreateNew(true);
|
|
20494
20543
|
return;
|
|
20495
20544
|
}
|
|
@@ -20501,9 +20550,24 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20501
20550
|
};
|
|
20502
20551
|
React__default.memo((props) => {
|
|
20503
20552
|
const { indexRow, row, isSelected, level = 0 } = props;
|
|
20504
|
-
return (jsxs("tr", { id: `row-select-table-${indexRow}`, style: { paddingLeft: 10 * level }, className: classNames$1('r-select-row', { 'last-row': indexRow === currentOptions.length - 1 }, { 'fisrt-row': indexRow === 0 }), children: [isMulti && (jsx("td", { className: classNames$1(`r-select-rowcell`, {
|
|
20553
|
+
return (jsxs("tr", { id: `row-select-table-${indexRow}`, style: { paddingLeft: 10 * level }, className: classNames$1('r-select-row', { 'last-row': indexRow === currentOptions.length - 1 }, { 'fisrt-row': indexRow === 0 }), children: [isMulti && (jsx("td", { className: classNames$1(`r-select-rowcell`, {
|
|
20554
|
+
'r-select-move': indexFocus === indexRow,
|
|
20555
|
+
'r-select-active': !isMulti &&
|
|
20556
|
+
value &&
|
|
20557
|
+
(compareFunction
|
|
20558
|
+
? compareFunction(row)
|
|
20559
|
+
: value[fieldValue ?? 'value'] ===
|
|
20560
|
+
row[fieldValue ?? 'value']),
|
|
20561
|
+
}), style: {
|
|
20562
|
+
width: 40,
|
|
20563
|
+
textAlign: 'center',
|
|
20564
|
+
padding: 0,
|
|
20565
|
+
paddingBottom: 6,
|
|
20566
|
+
}, onClick: (e) => {
|
|
20505
20567
|
if (isMulti) {
|
|
20506
|
-
const index = value?.findIndex((x) =>
|
|
20568
|
+
const index = value?.findIndex((x) => compareFunction
|
|
20569
|
+
? compareFunction(row)
|
|
20570
|
+
: x[fieldValue ?? 'value'] === row[fieldValue ?? 'value']);
|
|
20507
20571
|
if (index > -1) {
|
|
20508
20572
|
value?.splice(index, 1);
|
|
20509
20573
|
handChange([...value]);
|
|
@@ -20521,25 +20585,42 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20521
20585
|
}
|
|
20522
20586
|
}, children: jsx(Input$1, { checked: isSelected, type: "checkbox", className: "cursor-pointer", onChange: () => { }, style: { textAlign: 'center', marginTop: 6 } }) })), (columns ? columns : defaultColumns).map((col, indexCol) => {
|
|
20523
20587
|
let valueDisplay = row[col.field];
|
|
20524
|
-
if (col.type === 'numeric' ||
|
|
20525
|
-
|
|
20588
|
+
if (col.type === 'numeric' ||
|
|
20589
|
+
(col.typeCondition && col.typeCondition(row) === 'numeric')) {
|
|
20590
|
+
valueDisplay =
|
|
20591
|
+
formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? '.', formatSetting?.thousandSeparator ?? ',', col.fraction ?? 0, true, false) ?? 0;
|
|
20526
20592
|
}
|
|
20527
20593
|
else if (col.type === 'date') {
|
|
20528
|
-
valueDisplay = valueDisplay
|
|
20594
|
+
valueDisplay = valueDisplay
|
|
20595
|
+
? formatDateTime(valueDisplay, formatSetting?.dateFormat)
|
|
20596
|
+
: '';
|
|
20529
20597
|
}
|
|
20530
20598
|
else if (col.type === 'datetime') {
|
|
20531
|
-
valueDisplay = valueDisplay
|
|
20599
|
+
valueDisplay = valueDisplay
|
|
20600
|
+
? formatDateTime(valueDisplay, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm')
|
|
20601
|
+
: '';
|
|
20532
20602
|
}
|
|
20533
20603
|
return (jsxs(Fragment, { children: [col.visible !== false && (jsx("td", { id: `select-${id}-${indexRow}-${indexCol}`,
|
|
20534
20604
|
// ref={refRow}
|
|
20535
|
-
className: classNames$1(`r-select-rowcell`, {
|
|
20605
|
+
className: classNames$1(`r-select-rowcell`, {
|
|
20606
|
+
'r-select-move': indexFocus === indexRow,
|
|
20607
|
+
'r-select-active': !isMulti &&
|
|
20608
|
+
value &&
|
|
20609
|
+
(compareFunction
|
|
20610
|
+
? compareFunction(row)
|
|
20611
|
+
: value[fieldValue ?? 'value'] ===
|
|
20612
|
+
row[fieldValue ?? 'value']),
|
|
20613
|
+
}), style: {
|
|
20536
20614
|
minWidth: col.minWidth,
|
|
20537
20615
|
width: col.width,
|
|
20538
20616
|
maxWidth: col.maxWidth,
|
|
20539
|
-
textAlign: col.textAlign ? col.textAlign : 'left'
|
|
20617
|
+
textAlign: col.textAlign ? col.textAlign : 'left',
|
|
20540
20618
|
}, onClick: (e) => {
|
|
20541
20619
|
if (isMulti) {
|
|
20542
|
-
const index = value?.findIndex((x) =>
|
|
20620
|
+
const index = value?.findIndex((x) => compareFunction
|
|
20621
|
+
? compareFunction(row)
|
|
20622
|
+
: x[fieldValue ?? 'value'] ===
|
|
20623
|
+
row[fieldValue ?? 'value']);
|
|
20543
20624
|
if (index > -1) {
|
|
20544
20625
|
value?.splice(index, 1);
|
|
20545
20626
|
handChange([...value]);
|
|
@@ -20566,7 +20647,7 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20566
20647
|
setIndexFocus(indexRow);
|
|
20567
20648
|
}
|
|
20568
20649
|
e.stopPropagation();
|
|
20569
|
-
}, children: col.template ? col.template(row, indexRow) : col.type === 'numeric' && Number(row[col.field]) < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [
|
|
20650
|
+
}, children: col.template ? (col.template(row, indexRow)) : col.type === 'numeric' && Number(row[col.field]) < 0 ? (jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [' ', `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] })) : (valueDisplay) }, `col-${indexRow}-${indexCol}`)), checkOverflow(indexRow, indexCol) && (jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : valueDisplay }))] }, indexCol));
|
|
20570
20651
|
})] }, `row-${indexRow}`));
|
|
20571
20652
|
});
|
|
20572
20653
|
return (jsx("div", { className: classNames$1('react-select-table', { 'is-invalid': invalid }), ref: ref, id: id, children: jsx("div", { ref: selectTableRef, children: jsxs(Dropdown$1$1, { isOpen: dropdownOpen, toggle: () => { }, onMouseDown: (e) => e.preventDefault(), children: [jsxs(DropdownToggle$1, { onClick: (e) => {
|
|
@@ -20575,9 +20656,27 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20575
20656
|
handleOpenClose();
|
|
20576
20657
|
}
|
|
20577
20658
|
e.preventDefault();
|
|
20578
|
-
}, tag: "div", style: {
|
|
20579
|
-
|
|
20580
|
-
|
|
20659
|
+
}, tag: "div", style: {
|
|
20660
|
+
width: width
|
|
20661
|
+
? width
|
|
20662
|
+
: selectTableRef?.current?.clientWidth
|
|
20663
|
+
? selectTableRef?.current?.clientWidth
|
|
20664
|
+
: 'auto',
|
|
20665
|
+
}, className: classNames$1('select-table-control', { 'r-select-is-disabled': isDisabled }, { 'r-select-is-open': dropdownOpen }, { 'r-select-is-focus': isFocus }, { 'r-select-is-invalid': invalid }), children: [jsxs("div", { className: "select-table-container", children: [isMulti ? (jsx("div", { className: classNames$1('select-value is-mutil', {
|
|
20666
|
+
'd-none': searchTerm,
|
|
20667
|
+
}), children: value?.map((ele, index) => {
|
|
20668
|
+
return (jsxs("span", { children: [index === 0 ? '' : ', ', formatOptionLabel
|
|
20669
|
+
? formatOptionLabel(ele)
|
|
20670
|
+
: ele[fieldLabel ?? 'label']] }, index));
|
|
20671
|
+
}) })) : (jsxs("div", { className: classNames$1('select-value', {
|
|
20672
|
+
'd-none': searchTerm,
|
|
20673
|
+
}), children: [value
|
|
20674
|
+
? formatOptionLabel
|
|
20675
|
+
? formatOptionLabel(value)
|
|
20676
|
+
: value[fieldLabel ?? 'label']
|
|
20677
|
+
: '', ' '] })), !((isMulti ? value?.length > 0 : value) ||
|
|
20678
|
+
isDisabled ||
|
|
20679
|
+
searchTerm) && (jsx("div", { className: classNames$1('select-placeholder'), children: placeholder })), jsx("div", { className: "input-container", children: jsx("input", { style: { textAlign: textAlign ?? 'left' }, ref: inputRef, className: classNames$1('select-input'), readOnly: isDisabled, value: searchTerm, onPaste: (e) => onPaste && !dropdownOpen && onPaste(e), onChange: (val) => {
|
|
20581
20680
|
if (val.target.value) {
|
|
20582
20681
|
if (loadOptions && val.target.value) {
|
|
20583
20682
|
setIsLoading(true);
|
|
@@ -20599,13 +20698,23 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20599
20698
|
width: width ? width + 2 : 'min-content',
|
|
20600
20699
|
position: 'fixed',
|
|
20601
20700
|
borderRadius: 4,
|
|
20602
|
-
zIndex: 9999
|
|
20701
|
+
zIndex: 9999,
|
|
20603
20702
|
}, children: jsx(DropdownItem$1, { className: classNames$1('p-0 menu-select-table'), tag: "div", header: true, children: dropdownOpen && (jsx("div", { style: { backgroundColor: 'none' }, onMouseDown: (e) => {
|
|
20604
20703
|
if (!isDisabled) {
|
|
20605
20704
|
inputRef?.current.focus();
|
|
20606
20705
|
e.preventDefault();
|
|
20607
20706
|
}
|
|
20608
|
-
}, children: jsxs("div", { className: "r-select-grid", children: [jsx("div", { className: classNames$1('r-select-gridtable', {
|
|
20707
|
+
}, children: jsxs("div", { className: "r-select-grid", children: [jsx("div", { className: classNames$1('r-select-gridtable', {
|
|
20708
|
+
'no-header': noHeader || (columns?.length ?? 0) === 0,
|
|
20709
|
+
}), ref: selectMenuTableRef, style: {
|
|
20710
|
+
width: menuWidth,
|
|
20711
|
+
minWidth: selectTableRef?.current?.clientWidth,
|
|
20712
|
+
maxHeight: maxHeight ?? defaultMaxHeight$1,
|
|
20713
|
+
}, children: jsx(TableElement$1, { haveCreateNew: haveCreateNew, isLoading: isLoading, searchTerm: searchTerm, fieldLabel: fieldLabel, noHeader: noHeader, closeMenu: closeMenu, value: value, isMulti: isMulti, currentOptions: currentOptions, fieldValue: fieldValue, columns: columns, defaultColumns: defaultColumns, indexFocus: indexFocus, formatSetting: formatSetting, handChange: handChange, compareFunction: compareFunction, setIndexFocus: setIndexFocus, setSearchTerm: setSearchTerm }) }), jsxs("div", { className: classNames$1('r-select-footer', {
|
|
20714
|
+
'd-none': !(showFooter === true ||
|
|
20715
|
+
handleAdd ||
|
|
20716
|
+
isMulti),
|
|
20717
|
+
}), children: [jsxs(Button$1$1, { outline: true, color: "primary", onClick: () => handleAdd?.(), className: classNames$1('r-btn d-flex align-items-center', { 'd-none': !handleAdd }), children: [jsx(SvgPlus, { className: "me-50", fontSize: 16 }), t('AddNew'), " (F9)"] }), isMulti && (jsx("div", { className: "ms-50 text-primary h-100 d-flex align-items-center", children: t('countSelected', { item: value?.length ?? 0 }) })), footerComponent ? footerComponent() : null] })] }) })) }) })] }) }) }));
|
|
20609
20718
|
});
|
|
20610
20719
|
|
|
20611
20720
|
const PagingComponent = ({ totalItem, gridRef, pageSize, currentPage, onChangePage, pageOptions, onChangePageSize }) => {
|
|
@@ -68864,7 +68973,7 @@ const UnExpandAllIcon = ({ className, color = '#7F7F7F', size = 24, onClick, sty
|
|
|
68864
68973
|
};
|
|
68865
68974
|
|
|
68866
68975
|
const RenderContentCol = React__default.memo((props) => {
|
|
68867
|
-
const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, setSelectedRows, handleCloseContext, handleDoubleClick, fieldKey, isMulti } = props;
|
|
68976
|
+
const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, setSelectedRows, handleCloseContext, handleDoubleClick, handleCellClick, fieldKey, isMulti, } = props;
|
|
68868
68977
|
const cellId = `content-${idTable}-row${indexRow}col-${indexCol}`;
|
|
68869
68978
|
const checkOverflow = () => {
|
|
68870
68979
|
const element = document.getElementById(cellId);
|
|
@@ -68886,10 +68995,12 @@ const RenderContentCol = React__default.memo((props) => {
|
|
|
68886
68995
|
const RenderElement = () => {
|
|
68887
68996
|
if (col.field === '#' || col.type === '#') {
|
|
68888
68997
|
return (jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer text-center', {
|
|
68889
|
-
'r-active-cell': isSelected
|
|
68998
|
+
'r-active-cell': isSelected,
|
|
68890
68999
|
}), style: {
|
|
68891
|
-
fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType
|
|
68892
|
-
|
|
69000
|
+
fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType
|
|
69001
|
+
? 600
|
|
69002
|
+
: 400,
|
|
69003
|
+
fontStyle: row.haveItalicType ? 'italic' : 'normal',
|
|
68893
69004
|
}, onDoubleClick: (e) => {
|
|
68894
69005
|
e.preventDefault();
|
|
68895
69006
|
handleCloseContext();
|
|
@@ -68898,11 +69009,15 @@ const RenderContentCol = React__default.memo((props) => {
|
|
|
68898
69009
|
}
|
|
68899
69010
|
else if (col.type === 'checkbox' || col.field === 'checkbox') {
|
|
68900
69011
|
return (jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer', {
|
|
68901
|
-
'r-active-cell': isSelected
|
|
69012
|
+
'r-active-cell': isSelected,
|
|
68902
69013
|
}), style: {
|
|
68903
69014
|
display: 'flex',
|
|
68904
|
-
justifyContent: col.textAlign === 'center'
|
|
68905
|
-
|
|
69015
|
+
justifyContent: col.textAlign === 'center'
|
|
69016
|
+
? 'center'
|
|
69017
|
+
: col.textAlign === 'right'
|
|
69018
|
+
? 'flex-end'
|
|
69019
|
+
: 'flex-start',
|
|
69020
|
+
alignItems: 'center',
|
|
68906
69021
|
}, onClick: (e) => {
|
|
68907
69022
|
setSelectedRows(toggleSelect());
|
|
68908
69023
|
e.stopPropagation();
|
|
@@ -68912,8 +69027,12 @@ const RenderContentCol = React__default.memo((props) => {
|
|
|
68912
69027
|
let value = row[col.field];
|
|
68913
69028
|
// ✅ Format dữ liệu theo loại cột
|
|
68914
69029
|
if (col.type === 'numeric') {
|
|
68915
|
-
value =
|
|
68916
|
-
|
|
69030
|
+
value =
|
|
69031
|
+
formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
|
|
69032
|
+
if (!zeroVisiable &&
|
|
69033
|
+
!col.zeroVisiable &&
|
|
69034
|
+
!(row?.sortOrder < 0 || row?.sortOrder > 100000) &&
|
|
69035
|
+
(value === '0' || value === 0)) {
|
|
68917
69036
|
value = '';
|
|
68918
69037
|
}
|
|
68919
69038
|
}
|
|
@@ -68921,31 +69040,43 @@ const RenderContentCol = React__default.memo((props) => {
|
|
|
68921
69040
|
value = value ? formatDateTime(value, formatSetting?.dateFormat) : '';
|
|
68922
69041
|
}
|
|
68923
69042
|
else if (col.type === 'datetime') {
|
|
68924
|
-
value = value
|
|
69043
|
+
value = value
|
|
69044
|
+
? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm')
|
|
69045
|
+
: '';
|
|
68925
69046
|
}
|
|
68926
69047
|
if (col.template) {
|
|
68927
69048
|
value = col.template(row, indexRow) ?? '';
|
|
68928
69049
|
}
|
|
68929
69050
|
const isNegative = col.type === 'numeric' && Number(row[col.field]) < 0;
|
|
68930
|
-
const textColor = isNegative
|
|
68931
|
-
|
|
68932
|
-
|
|
68933
|
-
const
|
|
69051
|
+
const textColor = isNegative
|
|
69052
|
+
? (formatSetting?.colorNegative ?? 'red')
|
|
69053
|
+
: undefined;
|
|
69054
|
+
const prefix = isNegative ? (formatSetting?.prefixNegative ?? '-') : '';
|
|
69055
|
+
const suffix = isNegative ? (formatSetting?.suffixNegative ?? '') : '';
|
|
69056
|
+
const displayText = isNegative
|
|
69057
|
+
? `${prefix}${value}${suffix}`
|
|
69058
|
+
: (value ?? '');
|
|
68934
69059
|
return (jsxs("div", { className: classNames$1('r-rowcell-div cursor-pointer', {
|
|
68935
|
-
'r-active-cell': isSelected
|
|
69060
|
+
'r-active-cell': isSelected,
|
|
68936
69061
|
}), style: {
|
|
68937
|
-
fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType
|
|
68938
|
-
|
|
69062
|
+
fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType
|
|
69063
|
+
? 600
|
|
69064
|
+
: 400,
|
|
69065
|
+
fontStyle: row.haveItalicType ? 'italic' : 'normal',
|
|
68939
69066
|
}, children: [jsx("div", { className: "r-cell-text", style: {
|
|
68940
69067
|
display: 'flex',
|
|
68941
|
-
justifyContent: col.textAlign === 'center'
|
|
68942
|
-
|
|
69068
|
+
justifyContent: col.textAlign === 'center'
|
|
69069
|
+
? 'center'
|
|
69070
|
+
: col.textAlign === 'right'
|
|
69071
|
+
? 'flex-end'
|
|
69072
|
+
: 'flex-start',
|
|
69073
|
+
alignItems: 'center',
|
|
68943
69074
|
}, children: jsx("div", { id: cellId, style: {
|
|
68944
69075
|
color: textColor,
|
|
68945
69076
|
overflow: 'hidden',
|
|
68946
69077
|
textOverflow: 'ellipsis',
|
|
68947
69078
|
whiteSpace: 'pre',
|
|
68948
|
-
maxWidth: '100%'
|
|
69079
|
+
maxWidth: '100%',
|
|
68949
69080
|
}, children: displayText }) }), checkOverflow() && (jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: cellId, placement: "top", children: jsx("div", { style: { color: textColor }, onClick: (e) => {
|
|
68950
69081
|
e.stopPropagation();
|
|
68951
69082
|
e.preventDefault();
|
|
@@ -68954,15 +69085,21 @@ const RenderContentCol = React__default.memo((props) => {
|
|
|
68954
69085
|
};
|
|
68955
69086
|
const clickTimerRef = useRef(null);
|
|
68956
69087
|
return (jsx(Fragment$1, { children: col.visible !== false && col.isGroup !== true && (jsx("td", { className: classNames$1(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, {
|
|
68957
|
-
'fixed-last': (col.fixedType === 'left' &&
|
|
69088
|
+
'fixed-last': (col.fixedType === 'left' &&
|
|
69089
|
+
indexCol === lastObjWidthFixLeft) ||
|
|
69090
|
+
(col.fixedType === 'right' &&
|
|
69091
|
+
indexCol === fisrtObjWidthFixRight),
|
|
68958
69092
|
}, { 'r-active': isSelected }), style: {
|
|
68959
69093
|
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
68960
|
-
right: col.fixedType === 'right'
|
|
69094
|
+
right: col.fixedType === 'right'
|
|
69095
|
+
? objWidthFixRight[indexCol]
|
|
69096
|
+
: undefined,
|
|
68961
69097
|
}, onClick: (e) => {
|
|
68962
69098
|
const tag = e.target?.nodeName;
|
|
68963
69099
|
if (tag !== 'DIV' && tag !== 'TD') {
|
|
68964
69100
|
return;
|
|
68965
69101
|
}
|
|
69102
|
+
handleCellClick?.(row, col);
|
|
68966
69103
|
if (clickTimerRef.current) {
|
|
68967
69104
|
window.clearTimeout(clickTimerRef.current);
|
|
68968
69105
|
}
|
|
@@ -68990,7 +69127,7 @@ const RenderContentCol = React__default.memo((props) => {
|
|
|
68990
69127
|
});
|
|
68991
69128
|
|
|
68992
69129
|
const TableElement = React__default.memo((props) => {
|
|
68993
|
-
const { contentColumns, dataSource, fieldKey, filterBy, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, orderBy, selectedRows, setContentColumns, setSelectedRows, formatSetting, gridRef, idTable, headerColumns, objHeaderWidthFixLeft, objHeaderWidthFixRight, isMulti, querySetting, searchSetting, searchTerm, columnsAggregate, haveSum, expandsAll, zeroVisiable, setFilterBy, setOrderBy, setExpandsAll, handleDoubleClick, contextMenuItems, handleContextMenuClick, isLoading } = props;
|
|
69130
|
+
const { contentColumns, dataSource, fieldKey, filterBy, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, orderBy, selectedRows, setContentColumns, setSelectedRows, formatSetting, gridRef, idTable, headerColumns, objHeaderWidthFixLeft, objHeaderWidthFixRight, isMulti, querySetting, searchSetting, searchTerm, columnsAggregate, haveSum, expandsAll, zeroVisiable, setFilterBy, setOrderBy, setExpandsAll, handleDoubleClick, handleCellClick, contextMenuItems, handleContextMenuClick, isLoading, } = props;
|
|
68994
69131
|
const { t } = useTranslation();
|
|
68995
69132
|
const [context, setContext] = useState(null);
|
|
68996
69133
|
const virtualDivRef = useRef(null);
|
|
@@ -69036,7 +69173,10 @@ const TableElement = React__default.memo((props) => {
|
|
|
69036
69173
|
if (searchTerm) {
|
|
69037
69174
|
datas = datas.filter((row) => {
|
|
69038
69175
|
return searchSetting?.keyField?.some((key) => {
|
|
69039
|
-
return row[key]
|
|
69176
|
+
return row[key]
|
|
69177
|
+
?.toString()
|
|
69178
|
+
.toLowerCase()
|
|
69179
|
+
.includes(searchTerm.trim().toLowerCase());
|
|
69040
69180
|
});
|
|
69041
69181
|
});
|
|
69042
69182
|
}
|
|
@@ -69045,7 +69185,10 @@ const TableElement = React__default.memo((props) => {
|
|
|
69045
69185
|
return filterBy.every((filter) => {
|
|
69046
69186
|
const { key, value, ope } = filter;
|
|
69047
69187
|
const rowValue = row[key];
|
|
69048
|
-
if (rowValue === undefined ||
|
|
69188
|
+
if (rowValue === undefined ||
|
|
69189
|
+
rowValue === null ||
|
|
69190
|
+
value === undefined ||
|
|
69191
|
+
value === null) {
|
|
69049
69192
|
return false;
|
|
69050
69193
|
}
|
|
69051
69194
|
const valStr = String(rowValue).toLowerCase();
|
|
@@ -69111,56 +69254,72 @@ const TableElement = React__default.memo((props) => {
|
|
|
69111
69254
|
}
|
|
69112
69255
|
let value = row[col.field];
|
|
69113
69256
|
if (col.type === 'numeric') {
|
|
69114
|
-
value =
|
|
69257
|
+
value =
|
|
69258
|
+
formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
|
|
69115
69259
|
}
|
|
69116
69260
|
else if (col.type === 'date') {
|
|
69117
|
-
value = value
|
|
69261
|
+
value = value
|
|
69262
|
+
? formatDateTime(value, formatSetting?.dateFormat)
|
|
69263
|
+
: '';
|
|
69118
69264
|
}
|
|
69119
69265
|
else if (col.type === 'datetime') {
|
|
69120
|
-
value = value
|
|
69266
|
+
value = value
|
|
69267
|
+
? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm')
|
|
69268
|
+
: '';
|
|
69121
69269
|
}
|
|
69122
69270
|
if (col.template) {
|
|
69123
69271
|
value = col.template(row, indexRow) ?? '';
|
|
69124
69272
|
}
|
|
69125
69273
|
return (jsxs(Fragment$1, { children: [jsxs("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: [jsx("td", { className: "r-rowcell r-cell-group", colSpan: 3, children: jsxs("div", { className: "r-rowcell-div", children: [jsx(SvgChevronRight, { style: {
|
|
69126
69274
|
marginLeft: level * 20,
|
|
69127
|
-
transform: expand ? 'rotate(90deg)' : 'rotate(0deg)'
|
|
69275
|
+
transform: expand ? 'rotate(90deg)' : 'rotate(0deg)',
|
|
69128
69276
|
}, fontSize: 15, onClick: () => {
|
|
69129
69277
|
setExpand(!expand);
|
|
69130
69278
|
setExpandsAll(undefined);
|
|
69131
69279
|
row.expand = !expand;
|
|
69132
69280
|
} }), t(col.headerDisplay ?? col.headerText ?? ''), ": ", value, " (", row.children.length, ")"] }) }), contentColumns.map((colSum, indexCol) => {
|
|
69133
|
-
if (indexCol <= firstColSpan ||
|
|
69281
|
+
if (indexCol <= firstColSpan ||
|
|
69282
|
+
colSum.visible === false ||
|
|
69283
|
+
colSum.isGroup === true) {
|
|
69134
69284
|
return;
|
|
69135
69285
|
}
|
|
69136
69286
|
let sumValue = row[colSum.field];
|
|
69137
|
-
const haveSum = row[colSum.field] !== undefined &&
|
|
69138
|
-
|
|
69287
|
+
const haveSum = row[colSum.field] !== undefined &&
|
|
69288
|
+
row[colSum.field] !== null;
|
|
69289
|
+
if (!haveSum &&
|
|
69290
|
+
colSum.haveSum === true &&
|
|
69291
|
+
colSum.type === 'numeric') {
|
|
69139
69292
|
sumValue = row.children.reduce(function (accumulator, currentValue) {
|
|
69140
|
-
return Number(accumulator ?? 0) +
|
|
69293
|
+
return (Number(accumulator ?? 0) +
|
|
69294
|
+
Number(currentValue[colSum.field] ?? 0));
|
|
69141
69295
|
}, 0);
|
|
69142
69296
|
}
|
|
69143
69297
|
if (colSum.type === 'numeric') {
|
|
69144
69298
|
sumValue = formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', colSum.numericSettings?.fraction, true, false);
|
|
69145
|
-
if (!zeroVisiable &&
|
|
69299
|
+
if (!zeroVisiable &&
|
|
69300
|
+
!col.zeroVisiable &&
|
|
69301
|
+
(sumValue === '0' || sumValue === 0)) {
|
|
69146
69302
|
sumValue = '';
|
|
69147
69303
|
}
|
|
69148
69304
|
}
|
|
69149
69305
|
return (jsx("td", { className: "r-rowcell r-cell-sum-group", children: jsx("div", { className: "r-rowcell-div", style: {
|
|
69150
|
-
justifyContent: colSum.textAlign
|
|
69151
|
-
|
|
69152
|
-
|
|
69306
|
+
justifyContent: colSum.textAlign
|
|
69307
|
+
? colSum.textAlign
|
|
69308
|
+
: 'left',
|
|
69309
|
+
}, children: (haveSum || colSum.haveSum === true) &&
|
|
69310
|
+
Number(row[colSum.field] ?? '0') < 0 ? (jsxs("div", { style: {
|
|
69311
|
+
color: formatSetting?.colorNegative ?? 'red',
|
|
69153
69312
|
}, children: [' ', `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}`] })) : (sumValue) }) }, `group-sum-cell-${level}-${indexRow}-${indexCol}`));
|
|
69154
|
-
})] }), expand && jsx(RenderContent, { datas: row.children, level: level + 1 })] }, `row-${level}-${indexRow}`));
|
|
69313
|
+
})] }), expand && (jsx(RenderContent, { datas: row.children, level: level + 1 }))] }, `row-${level}-${indexRow}`));
|
|
69155
69314
|
}
|
|
69156
69315
|
else {
|
|
69157
69316
|
const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
|
|
69158
69317
|
return (jsx("tr", { id: `row-content-${indexRow}`, "aria-rowindex": indexRow + 1, role: "row", className: classNames$1('r-row', {
|
|
69159
|
-
'r-last-row': level === 0 && indexRow === viewData.length - 1
|
|
69318
|
+
'r-last-row': level === 0 && indexRow === viewData.length - 1,
|
|
69160
69319
|
}), onContextMenu: (e) => {
|
|
69161
69320
|
e.preventDefault();
|
|
69162
69321
|
handleContextMenu(e, row);
|
|
69163
|
-
}, children: contentColumns.map((column, indexCol) => (jsx(RenderContentCol, { idTable: idTable, col: column, fieldKey: fieldKey, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, isMulti: isMulti, selectedRows: selectedRows, setSelectedRows: setSelectedRows, formatSetting: formatSetting, indexCol: indexCol, indexRow: indexRow, isSelected: isSelected, row: row, zeroVisiable: zeroVisiable, handleCloseContext: handleCloseContext, handleDoubleClick: handleDoubleClick }, indexCol))) }, `row-content-${indexRow}`));
|
|
69322
|
+
}, children: contentColumns.map((column, indexCol) => (jsx(RenderContentCol, { idTable: idTable, col: column, fieldKey: fieldKey, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, isMulti: isMulti, selectedRows: selectedRows, setSelectedRows: setSelectedRows, formatSetting: formatSetting, indexCol: indexCol, indexRow: indexRow, isSelected: isSelected, row: row, zeroVisiable: zeroVisiable, handleCloseContext: handleCloseContext, handleDoubleClick: handleDoubleClick, handleCellClick: handleCellClick }, indexCol))) }, `row-content-${indexRow}`));
|
|
69164
69323
|
}
|
|
69165
69324
|
}) }));
|
|
69166
69325
|
});
|
|
@@ -69172,7 +69331,7 @@ const TableElement = React__default.memo((props) => {
|
|
|
69172
69331
|
x: e.clientX,
|
|
69173
69332
|
y: e.clientY,
|
|
69174
69333
|
row,
|
|
69175
|
-
show: true
|
|
69334
|
+
show: true,
|
|
69176
69335
|
});
|
|
69177
69336
|
}, 100);
|
|
69178
69337
|
};
|
|
@@ -69196,20 +69355,28 @@ const TableElement = React__default.memo((props) => {
|
|
|
69196
69355
|
let sumValue = item?.value;
|
|
69197
69356
|
if (!item && col.haveSum === true && col.type === 'numeric') {
|
|
69198
69357
|
sumValue = viewData.reduce(function (accumulator, currentValue) {
|
|
69199
|
-
return Number(accumulator ?? 0) +
|
|
69358
|
+
return (Number(accumulator ?? 0) +
|
|
69359
|
+
Number(currentValue[col.field] ?? 0));
|
|
69200
69360
|
}, 0);
|
|
69201
69361
|
}
|
|
69202
69362
|
if (col.type === 'numeric') {
|
|
69203
69363
|
sumValue = formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false);
|
|
69204
69364
|
}
|
|
69205
69365
|
return (jsx("td", { className: classNames$1(`p-0 px-50 r-footer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }), style: {
|
|
69206
|
-
left: col.fixedType === 'left'
|
|
69207
|
-
|
|
69208
|
-
|
|
69209
|
-
|
|
69210
|
-
|
|
69366
|
+
left: col.fixedType === 'left'
|
|
69367
|
+
? objWidthFixLeft[indexCol]
|
|
69368
|
+
: undefined,
|
|
69369
|
+
right: col.fixedType === 'right'
|
|
69370
|
+
? objWidthFixRight[indexCol]
|
|
69371
|
+
: undefined,
|
|
69372
|
+
textAlign: col.textAlign ? col.textAlign : 'left',
|
|
69373
|
+
}, children: jsx("div", { className: "r-footer-div", children: (item || col.haveSum === true) &&
|
|
69374
|
+
Number(item?.value ?? '0') < 0 ? (jsxs("div", { style: {
|
|
69375
|
+
color: formatSetting?.colorNegative ?? 'red',
|
|
69211
69376
|
}, children: [' ', `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}`] })) : (sumValue) }) }, `summarycell-${indexCol}`));
|
|
69212
|
-
}) })) })] }), jsx("div", { ref: virtualDivRef }), context &&
|
|
69377
|
+
}) })) })] }), jsx("div", { ref: virtualDivRef }), context &&
|
|
69378
|
+
(contextMenuItems?.length ?? 0) > 0 &&
|
|
69379
|
+
handleContextMenuClick && (jsx(Popover$1, { className: "r-context-popover", placement: "right-start", isOpen: context.show, target: virtualDivRef.current, toggle: handleCloseContext, fade: false, children: jsx(PopoverBody$1, { children: contextMenuItems?.map((item, index) => {
|
|
69213
69380
|
return (jsxs("div", { className: "r-context-item", onClick: () => {
|
|
69214
69381
|
handleCloseContext();
|
|
69215
69382
|
handleContextMenuClick?.(item, context.row);
|
|
@@ -69217,7 +69384,7 @@ const TableElement = React__default.memo((props) => {
|
|
|
69217
69384
|
}) }) })), (viewData.length ?? 0) === 0 && !isLoading && (jsxs("div", { className: "r-no-data", children: [jsx("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [jsx("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }), jsxs("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [jsx("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" }), jsx("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" })] })] }) }), t('No data available.')] }))] }));
|
|
69218
69385
|
});
|
|
69219
69386
|
|
|
69220
|
-
const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoading, formatSetting, querySetting, pagingSetting, searchSetting, columnsAggregate, toolbarSetting, selectedItem, setSelectedItem, handleSelect, saveSettingColumn, resetDefaultColumns, settingColumns, headerComponent, groupSetting, zeroVisiable, isMulti, handleDoubleClick, contextMenuItems, headerHeight, handleContextMenuClick, }) => {
|
|
69387
|
+
const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoading, formatSetting, querySetting, pagingSetting, searchSetting, columnsAggregate, toolbarSetting, selectedItem, setSelectedItem, handleSelect, saveSettingColumn, resetDefaultColumns, settingColumns, headerComponent, groupSetting, zeroVisiable, isMulti, handleDoubleClick, handleCellClick, contextMenuItems, headerHeight, handleContextMenuClick, }) => {
|
|
69221
69388
|
const { t } = useTranslation();
|
|
69222
69389
|
const gridRef = useRef(null);
|
|
69223
69390
|
const [openPopupSetupColumn, setOpenPopupSetupColumn] = useState(false);
|
|
@@ -69444,7 +69611,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
|
|
|
69444
69611
|
}), children: [jsxs("div", { className: "r-grid", children: [toolbarSetting?.showTopToolbar && (jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption, maximize: maximize, setMaximize: setMaximize })), headerComponent && headerComponent(), jsxs("div", { ref: gridRef, className: "r-gridtable", style: {
|
|
69445
69612
|
height: `${heightTable ? `${heightTable}px` : 'auto'}`,
|
|
69446
69613
|
position: 'relative',
|
|
69447
|
-
}, children: [jsx(TableElement, { idTable: idTable, gridRef: gridRef, isLoading: isLoading, dataSource: dataSource, objHeaderWidthFixLeft: objHeaderWidthFixLeft, objHeaderWidthFixRight: objHeaderWidthFixRight, fieldKey: fieldKey, lastObjWidthFixLeft: lastObjWidthFixLeft, fisrtObjWidthFixRight: fisrtObjWidthFixRight, selectedRows: selectedRows, isMulti: isMulti, filterBy: filterBy, orderBy: orderBy, formatSetting: formatSetting, contentColumns: contentColumns, headerColumns: headerColumns, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, searchTerm: searchTerm, searchSetting: searchSetting, columnsAggregate: columnsAggregate, haveSum: haveSum, expandsAll: expandsAll, zeroVisiable: zeroVisiable, contextMenuItems: contextMenuItems, handleContextMenuClick: handleContextMenuClick, setFilterBy: setFilterBy, setSelectedRows: setSelectedRows, setOrderBy: setOrderBy, handleDoubleClick: handleDoubleClick, querySetting: querySetting, setContentColumns: setContentColumns, setExpandsAll: setExpandsAll }), isLoading && (jsx("div", { className: "r-loading-overlay", children: jsxs("div", { className: "r-loading", children: [jsx(Spinner$1, { className: "me-1" }), t('Loading...')] }) }))] })] }), pagingSetting?.allowPaging && (jsx(PagingComponent, { gridRef: gridRef, onChangePage: onChangePage, pageSize: pagingSetting?.pageSize ?? 0, currentPage: pagingSetting?.currentPage ?? 0, pageOptions: pagingSetting?.pageOptions ?? [20, 30, 50, 100], totalItem: pagingSetting?.totalItem ?? 0, onChangePageSize: onChangePageSize })), jsx(SettingColumn, { gridRef: gridRef, handleSidebar: () => {
|
|
69614
|
+
}, children: [jsx(TableElement, { idTable: idTable, gridRef: gridRef, isLoading: isLoading, dataSource: dataSource, objHeaderWidthFixLeft: objHeaderWidthFixLeft, objHeaderWidthFixRight: objHeaderWidthFixRight, fieldKey: fieldKey, lastObjWidthFixLeft: lastObjWidthFixLeft, fisrtObjWidthFixRight: fisrtObjWidthFixRight, selectedRows: selectedRows, isMulti: isMulti, filterBy: filterBy, orderBy: orderBy, formatSetting: formatSetting, contentColumns: contentColumns, headerColumns: headerColumns, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, searchTerm: searchTerm, searchSetting: searchSetting, columnsAggregate: columnsAggregate, haveSum: haveSum, expandsAll: expandsAll, zeroVisiable: zeroVisiable, contextMenuItems: contextMenuItems, handleContextMenuClick: handleContextMenuClick, setFilterBy: setFilterBy, setSelectedRows: setSelectedRows, setOrderBy: setOrderBy, handleDoubleClick: handleDoubleClick, handleCellClick: handleCellClick, querySetting: querySetting, setContentColumns: setContentColumns, setExpandsAll: setExpandsAll }), isLoading && (jsx("div", { className: "r-loading-overlay", children: jsxs("div", { className: "r-loading", children: [jsx(Spinner$1, { className: "me-1" }), t('Loading...')] }) }))] })] }), pagingSetting?.allowPaging && (jsx(PagingComponent, { gridRef: gridRef, onChangePage: onChangePage, pageSize: pagingSetting?.pageSize ?? 0, currentPage: pagingSetting?.currentPage ?? 0, pageOptions: pagingSetting?.pageOptions ?? [20, 30, 50, 100], totalItem: pagingSetting?.totalItem ?? 0, onChangePageSize: onChangePageSize })), jsx(SettingColumn, { gridRef: gridRef, handleSidebar: () => {
|
|
69448
69615
|
setOpenPopupSetupColumn(!openPopupSetupColumn);
|
|
69449
69616
|
}, settingColumns: settingColumns, openSidebar: openPopupSetupColumn, column: [...contentColumns], resetDefaultColumns: resetDefaultColumns, setColumn: (newColumns) => {
|
|
69450
69617
|
if (saveSettingColumn) {
|