react-table-edit 1.5.29 → 1.5.30
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/type/index.d.ts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +38 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -19948,7 +19948,7 @@ const calculateTableStructure = (columns, settingColumns, groupColumns) => {
|
|
|
19948
19948
|
cell.numericSettings = { fraction: setting.fraction };
|
|
19949
19949
|
}
|
|
19950
19950
|
}
|
|
19951
|
-
cell.headerDisplay = setting.headerText || cell.headerText;
|
|
19951
|
+
cell.headerDisplay = setting.headerText || (cell.headerDisplay ?? cell.headerText);
|
|
19952
19952
|
}
|
|
19953
19953
|
else {
|
|
19954
19954
|
if (cell.columns?.length) {
|
|
@@ -20538,19 +20538,6 @@ const ReactInput = (props) => {
|
|
|
20538
20538
|
}), value: value, onChange: (val) => setValue(val.target.value) }), value ? jsx(SvgX, { className: 'input__clear-icon', onClick: handelClear, strokeWidth: 3, fontSize: 16 }) : ''] }));
|
|
20539
20539
|
};
|
|
20540
20540
|
|
|
20541
|
-
const RenderToolbarTop = ({ toolbarTopOption }) => {
|
|
20542
|
-
return (jsx("div", { id: "table_custom_top_toolbar", className: "r-toolbar r-toolbar-top", "aria-orientation": "horizontal", children: jsxs("div", { className: "r-toolbar-items", children: [jsx("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
|
|
20543
|
-
return item.align === 'left' ? jsx(ToolBarElement, { item: item, index: index }) : '';
|
|
20544
|
-
}) }), jsx("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
|
|
20545
|
-
return item.align === 'center' ? jsx(ToolBarElement, { item: item, index: index }) : '';
|
|
20546
|
-
}) }), jsx("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
|
|
20547
|
-
return item.align === 'right' ? jsx(ToolBarElement, { item: item, index: index }) : '';
|
|
20548
|
-
}) })] }) }));
|
|
20549
|
-
};
|
|
20550
|
-
const ToolBarElement = ({ item, index }) => {
|
|
20551
|
-
return (jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template?.() }, `toolbar-top-${index}`));
|
|
20552
|
-
};
|
|
20553
|
-
|
|
20554
20541
|
const handleAdd = (dataSource, containerRef, indexFirstEdit,
|
|
20555
20542
|
/*eslint-disable*/
|
|
20556
20543
|
changeDataSource, handleFocusCell,
|
|
@@ -38753,7 +38740,10 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
38753
38740
|
const newDate = new Date(viewDateFrom);
|
|
38754
38741
|
newDate.setFullYear(newYear);
|
|
38755
38742
|
setViewDateFrom(newDate);
|
|
38756
|
-
}, value: {
|
|
38743
|
+
}, value: {
|
|
38744
|
+
value: viewDateFrom.getFullYear(),
|
|
38745
|
+
label: viewDateFrom.getFullYear()
|
|
38746
|
+
} }) })] }), jsx(SvgChevronRight, { cursor: 'pointer', fontSize: 22, onClick: () => {
|
|
38757
38747
|
const newDate = new Date(viewDateFrom);
|
|
38758
38748
|
newDate.setMonth(viewDateFrom.getMonth() + 1);
|
|
38759
38749
|
setViewDateFrom(newDate);
|
|
@@ -38765,6 +38755,8 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
38765
38755
|
inRange: 'rdp-in-range',
|
|
38766
38756
|
rangeStart: 'rdp-selected',
|
|
38767
38757
|
rangeEnd: 'rdp-selected'
|
|
38758
|
+
}, formatters: {
|
|
38759
|
+
formatWeekdayName: (day) => [t('Su'), t('Mo'), t('Tu'), t('We'), t('Th'), t('Fr'), t('Sa')][day.getDay() === 0 ? 6 : day.getDay() - 1]
|
|
38768
38760
|
} })] }), jsxs("div", { children: [jsxs("div", { className: "select-month-year", children: [jsx(SvgChevronLeft, { cursor: 'pointer', fontSize: 22, onClick: () => {
|
|
38769
38761
|
const newDate = new Date(viewDateTo);
|
|
38770
38762
|
newDate.setMonth(viewDateTo.getMonth() - 1);
|
|
@@ -38779,7 +38771,10 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
38779
38771
|
const newDate = new Date(viewDateTo);
|
|
38780
38772
|
newDate.setFullYear(newYear);
|
|
38781
38773
|
setViewDateTo(newDate);
|
|
38782
|
-
}, value: {
|
|
38774
|
+
}, value: {
|
|
38775
|
+
value: viewDateTo.getFullYear(),
|
|
38776
|
+
label: viewDateTo.getFullYear()
|
|
38777
|
+
} }) })] }), jsx(SvgChevronRight, { cursor: 'pointer', fontSize: 22, onClick: () => {
|
|
38783
38778
|
const newDate = new Date(viewDateTo);
|
|
38784
38779
|
newDate.setMonth(viewDateTo.getMonth() + 1);
|
|
38785
38780
|
setViewDateTo(newDate);
|
|
@@ -38791,6 +38786,8 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
38791
38786
|
inRange: 'rdp-in-range',
|
|
38792
38787
|
rangeStart: 'rdp-selected',
|
|
38793
38788
|
rangeEnd: 'rdp-selected'
|
|
38789
|
+
}, formatters: {
|
|
38790
|
+
formatWeekdayName: (day) => [t('Su'), t('Mo'), t('Tu'), t('We'), t('Th'), t('Fr'), t('Sa')][day.getDay() === 0 ? 6 : day.getDay() - 1]
|
|
38794
38791
|
} })] })] }), jsxs("div", { className: "d-flex border-top ms-50", style: { gap: 20, paddingTop: 10 }, children: [jsx("div", { className: "btn-today", onClick: () => {
|
|
38795
38792
|
handleSelect(today, today);
|
|
38796
38793
|
setOpen(false);
|
|
@@ -38995,7 +38992,7 @@ const HeaderTableCol = (props) => {
|
|
|
38995
38992
|
top: `${indexParent * 42}px`,
|
|
38996
38993
|
left: col.fixedType === 'left' ? objHeaderWidthFixLeft[`${indexParent}-${indexCol ?? 0}`] : undefined,
|
|
38997
38994
|
right: col.fixedType === 'right' ? objHeaderWidthFixRight[`${indexParent}-${indexCol ?? 0}`] : undefined
|
|
38998
|
-
}, children: jsxs("div", { style: { justifyContent: 'space-between' }, onClick: () => {
|
|
38995
|
+
}, children: jsxs("div", { style: { justifyContent: col.textAlign === 'center' ? 'center' : 'space-between' }, onClick: () => {
|
|
38999
38996
|
if (!allowSorting || col.columns?.length) {
|
|
39000
38997
|
return;
|
|
39001
38998
|
}
|
|
@@ -39802,6 +39799,19 @@ const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleI
|
|
|
39802
39799
|
}), jsx("div", { className: classNames$1('r-toolbar-item me-25'), "aria-disabled": "false", children: jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsx("div", { className: classNames$1('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxs(UncontrolledDropdown, { className: "dropdown-user nav-item", children: [jsx(DropdownToggle$1, { tag: "div", color: "primary", onClick: (e) => e.preventDefault(), children: jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsx(DropdownMenu$1, { className: "formula-dropdown icon-dropdown", children: jsxs("ul", { className: "mb-0 pe-50", children: [jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\u00E2n b\u1EA3n" }), jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\u00E9p h\u00E0ng" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\u00E1n h\u00E0ng" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl ho\u1EB7c Alt + Shift + \u2193 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng d\u01B0\u1EDBi" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl ho\u1EB7c Alt + Shift + \u2191 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng tr\u00EAn" })] }) })] }) })] })] }) }));
|
|
39803
39800
|
};
|
|
39804
39801
|
|
|
39802
|
+
const RenderToolbarTop = ({ toolbarTopOption }) => {
|
|
39803
|
+
return (jsx("div", { id: "table_custom_top_toolbar", className: "r-toolbar r-toolbar-top", "aria-orientation": "horizontal", children: jsxs("div", { className: "r-toolbar-items", children: [jsx("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
|
|
39804
|
+
return item.align === 'left' ? jsx(ToolBarElement, { item: item, index: index }) : '';
|
|
39805
|
+
}) }), jsx("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
|
|
39806
|
+
return item.align === 'center' ? jsx(ToolBarElement, { item: item, index: index }) : '';
|
|
39807
|
+
}) }), jsx("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
|
|
39808
|
+
return item.align === 'right' ? jsx(ToolBarElement, { item: item, index: index }) : '';
|
|
39809
|
+
}) })] }) }));
|
|
39810
|
+
};
|
|
39811
|
+
const ToolBarElement = ({ item, index }) => {
|
|
39812
|
+
return (jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template?.() }, `toolbar-top-${index}`));
|
|
39813
|
+
};
|
|
39814
|
+
|
|
39805
39815
|
const TableEdit = forwardRef((props, ref) => {
|
|
39806
39816
|
const { t } = useTranslation();
|
|
39807
39817
|
const { idTable, dataSource, columns, setDataSource, height = 400, rowHeight = 31.3, defaultValue, toolbarSetting, searchSetting, selectedItem, selectEnable, editDisable, addDisable, buttonSetting, formatSetting, haveSum, isMulti, disableAutoKey, commandClick, dataSourceChange, rowChange, setSelectedItem, handleSelect, onDuplicate, saveSettingColumn, allowFiltering = true, allowSorting, settingColumns, optionsFilter, pagingSetting, resetDefaultColumns } = props;
|
|
@@ -68673,8 +68683,10 @@ const RenderContentCol = (props) => {
|
|
|
68673
68683
|
return element && element.scrollWidth > element.clientWidth;
|
|
68674
68684
|
};
|
|
68675
68685
|
const RenderElement = () => {
|
|
68676
|
-
if (col.type === 'checkbox'
|
|
68677
|
-
return (jsx("div", { className: "r-rowcell-div cursor-pointer", style: { alignItems: 'center' }, onClick: (e) => {
|
|
68686
|
+
if (col.type === 'checkbox' || col.field === 'checkbox') {
|
|
68687
|
+
return (jsx("div", { className: "r-rowcell-div cursor-pointer", style: { display: 'flex', justifyContent: col.textAlign === 'center' ? 'center' : col.textAlign === 'right' ? 'flex-end' : 'flex-start', alignItems: 'center' }, onClick: (e) => {
|
|
68688
|
+
console.log(isMulti);
|
|
68689
|
+
console.log(selectEnable);
|
|
68678
68690
|
if (selectEnable) {
|
|
68679
68691
|
const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
|
|
68680
68692
|
if (index > -1) {
|
|
@@ -68722,7 +68734,8 @@ const RenderContentCol = (props) => {
|
|
|
68722
68734
|
const suffix = isNegative ? formatSetting?.suffixNegative ?? '' : '';
|
|
68723
68735
|
const displayText = isNegative ? `${prefix}${value}${suffix}` : value ?? '';
|
|
68724
68736
|
return (jsxs("div", { className: classNames$1('r-rowcell-div'), style: {
|
|
68725
|
-
fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 ? 600 : 400
|
|
68737
|
+
fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType ? 600 : 400,
|
|
68738
|
+
fontStyle: row.haveItalicType ? 'italic' : 'normal'
|
|
68726
68739
|
}, children: [jsx("div", { className: "r-cell-text", style: {
|
|
68727
68740
|
display: 'flex',
|
|
68728
68741
|
justifyContent: col.textAlign === 'center' ? 'center' : col.textAlign === 'right' ? 'flex-end' : 'flex-start',
|
|
@@ -68798,7 +68811,6 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
68798
68811
|
setContentColumns(rs.flat);
|
|
68799
68812
|
return rs;
|
|
68800
68813
|
}, [columns, settingColumns, groupSetting?.groupColumns]);
|
|
68801
|
-
const optionGroupColumns = useMemo(() => contentColumns.map((x) => ({ ...x, headerDisplay: t(x.headerText) })), [contentColumns]);
|
|
68802
68814
|
const firstColSpan = useMemo(() => {
|
|
68803
68815
|
let count = 0;
|
|
68804
68816
|
let index = 3;
|
|
@@ -68898,7 +68910,7 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
68898
68910
|
return (jsx("div", { className: "me-50 r-search", children: jsx(ReactInput, { style: { width: '230px' }, value: searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm, setSearchTerm: searchSetting?.setSearchTerm ? searchSetting?.setSearchTerm : setSearchTerm, placeholder: t('Search'), onKeyPress: handleKeyPress }) }));
|
|
68899
68911
|
};
|
|
68900
68912
|
const groupbtnTemplate = () => {
|
|
68901
|
-
return (jsxs(UncontrolledDropdown, { children: [jsx(DropdownToggle$1, { tag: "div", id: "group-dropdown-toggle", style: { position: 'relative' }, onClick: (e) => e.preventDefault(), children: jsx(GroupIcon, { color: "#7F7F7F", size: 24 }) }), jsxs(DropdownMenu$1, { className: "formula-dropdown icon-dropdown p-1", children: [jsx("div", { className: "mb-1", style: { fontSize: 16, fontWeight: 500 }, children: "Nh\u00F3m d\u1EEF li\u1EC7u theo c\u1ED9t" }), jsxs("div", { className: 'form-group', children: [jsx(Label$1, { id: `label-group-1`, style: { fontWeight: 500, fontSize: 13 }, children: "M\u1EE9c 1" }), jsx("div", { className: "form-input", children: jsx(SelectTable, { options:
|
|
68913
|
+
return (jsxs(UncontrolledDropdown, { children: [jsx(DropdownToggle$1, { tag: "div", id: "group-dropdown-toggle", style: { position: 'relative' }, onClick: (e) => e.preventDefault(), children: jsx(GroupIcon, { color: "#7F7F7F", size: 24 }) }), jsxs(DropdownMenu$1, { className: "formula-dropdown icon-dropdown p-1", children: [jsx("div", { className: "mb-1", style: { fontSize: 16, fontWeight: 500 }, children: "Nh\u00F3m d\u1EEF li\u1EC7u theo c\u1ED9t" }), jsxs("div", { className: 'form-group', children: [jsx(Label$1, { id: `label-group-1`, style: { fontWeight: 500, fontSize: 13 }, children: "M\u1EE9c 1" }), jsx("div", { className: "form-input", children: jsx(SelectTable, { options: contentColumns, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[0] ? { headerText: t(contentColumns.find((x) => x.field === groupColumns[0])?.headerText ?? contentColumns.find((x) => x.field === groupColumns[0])?.headerText) } : undefined, onChange: (val) => {
|
|
68902
68914
|
if (val) {
|
|
68903
68915
|
groupColumns[0] = val.field;
|
|
68904
68916
|
}
|
|
@@ -68906,7 +68918,7 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
68906
68918
|
groupColumns.pop();
|
|
68907
68919
|
}
|
|
68908
68920
|
setGroupColumns([...groupColumns]);
|
|
68909
|
-
}, isClearable: groupColumns?.length === 1 }) })] }), jsxs("div", { className: 'form-group', children: [jsx(Label$1, { id: `label-group-2`, style: { fontWeight: 500, fontSize: 13 }, children: "M\u1EE9c 2" }), jsx("div", { className: "form-input", children: jsx(SelectTable, { options:
|
|
68921
|
+
}, isClearable: groupColumns?.length === 1 }) })] }), jsxs("div", { className: 'form-group', children: [jsx(Label$1, { id: `label-group-2`, style: { fontWeight: 500, fontSize: 13 }, children: "M\u1EE9c 2" }), jsx("div", { className: "form-input", children: jsx(SelectTable, { options: contentColumns, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[1] ? { headerText: t(contentColumns.find((x) => x.field === groupColumns[1])?.headerText ?? contentColumns.find((x) => x.field === groupColumns[1])?.headerText) } : undefined, onChange: (val) => {
|
|
68910
68922
|
if (val) {
|
|
68911
68923
|
groupColumns[1] = val.field;
|
|
68912
68924
|
}
|
|
@@ -68914,7 +68926,7 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
68914
68926
|
groupColumns.pop();
|
|
68915
68927
|
}
|
|
68916
68928
|
setGroupColumns([...groupColumns]);
|
|
68917
|
-
}, isClearable: groupColumns?.length === 2 }) })] }), jsxs("div", { className: 'form-group', children: [jsx(Label$1, { id: `label-group-3`, style: { fontWeight: 500, fontSize: 13 }, children: "M\u1EE9c 3" }), jsx("div", { className: "form-input", children: jsx(SelectTable, { options:
|
|
68929
|
+
}, isClearable: groupColumns?.length === 2 }) })] }), jsxs("div", { className: 'form-group', children: [jsx(Label$1, { id: `label-group-3`, style: { fontWeight: 500, fontSize: 13 }, children: "M\u1EE9c 3" }), jsx("div", { className: "form-input", children: jsx(SelectTable, { options: contentColumns, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[2] ? { headerText: t(contentColumns.find((x) => x.field === groupColumns[2])?.headerText ?? contentColumns.find((x) => x.field === groupColumns[2])?.headerText) } : undefined, onChange: (val) => {
|
|
68918
68930
|
if (groupSetting) {
|
|
68919
68931
|
if (val) {
|
|
68920
68932
|
groupColumns[2] = val.field;
|
|
@@ -69067,7 +69079,7 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
69067
69079
|
sumValue = '';
|
|
69068
69080
|
}
|
|
69069
69081
|
}
|
|
69070
|
-
return (jsx("td", { className: "r-rowcell r-cell-sum-group", children: jsx("div", { className: "r-rowcell-div", style: { justifyContent: colSum.textAlign ? colSum.textAlign : 'left' }, children: (haveSum || colSum.haveSum === true) && Number(sumValue) < 0 ?
|
|
69082
|
+
return (jsx("td", { className: "r-rowcell r-cell-sum-group", children: jsx("div", { className: "r-rowcell-div", style: { justifyContent: colSum.textAlign ? colSum.textAlign : 'left' }, children: (haveSum || colSum.haveSum === true) && Number(sumValue) < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}`] }) : sumValue }) }, `group-sum-cell-${level}-${indexRow}-${indexCol}`));
|
|
69071
69083
|
})] }), expand && jsx(RenderContent, { datas: row.children, level: level + 1 })] }, `row-${level}-${indexRow}`));
|
|
69072
69084
|
}
|
|
69073
69085
|
else {
|
|
@@ -69136,7 +69148,7 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
69136
69148
|
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
69137
69149
|
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
69138
69150
|
textAlign: col.textAlign ? col.textAlign : 'left'
|
|
69139
|
-
}, children: jsx("div", { className: "r-footer-div", children: (item || col.haveSum === true) && Number(sumValue) < 0 ?
|
|
69151
|
+
}, children: jsx("div", { className: "r-footer-div", children: (item || col.haveSum === true) && Number(sumValue) < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}`] }) : sumValue }) }, `summarycell-${indexCol}`));
|
|
69140
69152
|
}) })) })] }), jsx("div", { ref: virtualDivRef }), context && (contextMenuItems?.length ?? 0) > 0 && 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) => {
|
|
69141
69153
|
return (jsxs("div", { className: "r-context-item", onClick: () => {
|
|
69142
69154
|
handleCloseContext();
|