react-table-edit 1.4.10 → 1.4.12
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/edit-form/index.d.ts +1 -1
- package/dist/component/table/button-handle.d.ts +3 -3
- package/dist/component/table/header.d.ts +2 -1
- package/dist/index.js +134 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +134 -76
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -23033,12 +23033,13 @@ const SelectTableBox$1 = (props) => {
|
|
|
23033
23033
|
|
|
23034
23034
|
const defaultWidth = 200;
|
|
23035
23035
|
const EditForm = forwardRef((props, ref) => {
|
|
23036
|
-
const { id, field, displayValue, menuHeight, menuWidth, rowData, invalid, onChange, onChangeField, onKeyDown, defaultValues, placeholder, textAlign, schema, onFormOpen, onFormSubmit, footerTemplate, minWidth, onPaste, openOnFocus, isClearable, labelSize = 'label-small' } = props;
|
|
23036
|
+
const { id, field, displayValue, menuHeight, menuWidth, rowData, invalid, onChange, onChangeField, onKeyDown, defaultValues, placeholder, textAlign, schema, onFormOpen, onFormSubmit, footerTemplate, template, minWidth, onPaste, openOnFocus, isClearable, indexRow, labelSize = 'label-small' } = props;
|
|
23037
23037
|
const { innerWidth } = window;
|
|
23038
23038
|
const inputRef = useRef(null);
|
|
23039
23039
|
const editFormRef = useRef(null);
|
|
23040
23040
|
const buttonRef = useRef(null);
|
|
23041
23041
|
const [dropdownOpen, setDropdownOpen] = useState(false);
|
|
23042
|
+
const [isFocus, setIsFocus] = useState(false);
|
|
23042
23043
|
const [itemsField, setItemsField] = useState([]);
|
|
23043
23044
|
const { t } = useTranslation();
|
|
23044
23045
|
useOnClickOutside(editFormRef, () => {
|
|
@@ -23080,6 +23081,7 @@ const EditForm = forwardRef((props, ref) => {
|
|
|
23080
23081
|
else {
|
|
23081
23082
|
setDropdownOpen(true);
|
|
23082
23083
|
}
|
|
23084
|
+
inputRef?.current.focus();
|
|
23083
23085
|
};
|
|
23084
23086
|
const handleOnSubmit = (val) => {
|
|
23085
23087
|
closeMenu();
|
|
@@ -23193,7 +23195,26 @@ const EditForm = forwardRef((props, ref) => {
|
|
|
23193
23195
|
}
|
|
23194
23196
|
}) }));
|
|
23195
23197
|
};
|
|
23196
|
-
|
|
23198
|
+
useEffect(() => {
|
|
23199
|
+
if (inputRef) {
|
|
23200
|
+
inputRef.current.addEventListener('blur', function () {
|
|
23201
|
+
setIsFocus(false);
|
|
23202
|
+
});
|
|
23203
|
+
inputRef.current.addEventListener('focus', function () {
|
|
23204
|
+
if (!isFocus) {
|
|
23205
|
+
setIsFocus(true);
|
|
23206
|
+
}
|
|
23207
|
+
});
|
|
23208
|
+
}
|
|
23209
|
+
}, [inputRef]);
|
|
23210
|
+
return (jsx("div", { className: "form-edit", ref: ref, id: id, children: jsx("div", { ref: editFormRef, children: jsxs(Dropdown$1, { isOpen: dropdownOpen, toggle: () => { }, children: [jsx(DropdownToggle$1, { tag: 'div', children: jsxs("div", { className: classnames('display-value', { 'r-is-focus': isFocus || dropdownOpen }, { 'is-invalid': invalid }), onClick: handleOnClick, children: [template?.(rowData, indexRow) ?? displayValue, jsx(Input$1, { style: {
|
|
23211
|
+
width: template ? 0 : '100%',
|
|
23212
|
+
height: template ? 0 : 28,
|
|
23213
|
+
lineHeight: template ? 0 : 19,
|
|
23214
|
+
padding: template ? 0 : 'auto',
|
|
23215
|
+
backgroundColor: '#FFF',
|
|
23216
|
+
textAlign: textAlign ?? 'left'
|
|
23217
|
+
}, placeholder: placeholder, innerRef: inputRef, onKeyDown: (e) => handleOnKeyDown(e), onPaste: (e) => onPaste && onPaste(e), readOnly: true })] }) }), jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown p-0', style: {
|
|
23197
23218
|
minWidth: minWidth ? minWidth : defaultWidth,
|
|
23198
23219
|
width: menuWidth ? menuWidth : 'min-content',
|
|
23199
23220
|
maxWidth: innerWidth > 1280 ? 1280 : innerWidth,
|
|
@@ -41687,7 +41708,7 @@ var css_248z$1 = ".react-resizable {\n position: relative;\n}\n.react-resizable
|
|
|
41687
41708
|
styleInject(css_248z$1);
|
|
41688
41709
|
|
|
41689
41710
|
const HeaderTableCol = (props) => {
|
|
41690
|
-
const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent,
|
|
41711
|
+
const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objWidthFixLeft, objWidthFixRight, totalCount, selectedRows, column, setColumn, isMulti } = props;
|
|
41691
41712
|
const { t } = useTranslation();
|
|
41692
41713
|
const handleResize = (e, { size }) => {
|
|
41693
41714
|
// Update the column width here
|
|
@@ -41695,16 +41716,22 @@ const HeaderTableCol = (props) => {
|
|
|
41695
41716
|
if (size.width > 50) {
|
|
41696
41717
|
const newColumns = [...column];
|
|
41697
41718
|
newColumns[indexCol].width = size.width;
|
|
41719
|
+
if ((column[indexCol]?.maxWidth ?? 0) < size.width) {
|
|
41720
|
+
newColumns[indexCol].maxWidth = size.width;
|
|
41721
|
+
}
|
|
41722
|
+
if ((column[indexCol]?.minWidth ?? 0) > size.width) {
|
|
41723
|
+
newColumns[indexCol].minWidth = size.width;
|
|
41724
|
+
}
|
|
41698
41725
|
setColumn(newColumns);
|
|
41699
41726
|
}
|
|
41700
41727
|
};
|
|
41701
41728
|
return (jsx(Fragment, { children: col.visible !== false && (jsx(Resizable, { className: "r-resize", width: typeof col.width === 'number' ? col.width : Number((col.width ?? "").replaceAll(new RegExp(`[^0-9]`, "g"), '')), height: 0, onResize: handleResize, draggableOpts: { enableUserSelectHack: false }, children: jsx("th", { rowSpan: col.rowspan !== 1 ? col.rowspan : undefined, colSpan: col.columns?.filter(x => x.visible !== false)?.length ?? 1, className: classnames(`r-headercell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }), style: {
|
|
41702
41729
|
top: `${indexParent * 42}px`,
|
|
41703
|
-
left: col.fixedType === 'left' ?
|
|
41704
|
-
right: col.fixedType === 'right' ?
|
|
41730
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[col.index ?? 0] : undefined,
|
|
41731
|
+
right: col.fixedType === 'right' ? objWidthFixRight[col.index ?? 0] : undefined,
|
|
41705
41732
|
width: col.width ? typeof col.width === 'number' ? col.width : col.width?.includes('px') || col.width?.includes('%') ? col.width : `${col.width}px` : 'auto',
|
|
41706
|
-
minWidth: col.width ? typeof col.
|
|
41707
|
-
maxWidth: col.width ? typeof col.
|
|
41733
|
+
minWidth: col.fixedType ? col.width : col.minWidth ? typeof col.minWidth === 'number' ? col.minWidth : col.minWidth?.includes('px') || col.minWidth?.includes('%') ? col.minWidth : `${col.minWidth}px` : 'auto',
|
|
41734
|
+
maxWidth: col.fixedType ? col.width : col.maxWidth ? typeof col.maxWidth === 'number' ? col.maxWidth : col.maxWidth?.includes('px') || col.maxWidth?.includes('%') ? col.maxWidth : `${col.maxWidth}px` : 'auto'
|
|
41708
41735
|
}, children: jsxs("div", { style: { justifyContent: col.textAlign ?? 'left' }, className: classnames('r-headercell-div'), children: [col.field === 'checkbox' && (jsx(Input$1, { checked: totalCount > 0 && selectedRows?.length >= totalCount, type: "checkbox", className: classnames('cursor-pointer', { 'd-none': !isMulti }), style: { textAlign: col.textAlign ?? 'left', marginTop: 6 }, onChange: (e) => {
|
|
41709
41736
|
if (selectEnable) {
|
|
41710
41737
|
if (e.target.checked) {
|
|
@@ -42108,11 +42135,11 @@ const RenderToolbarTop = ({ toolbarTopOption }) => {
|
|
|
42108
42135
|
|
|
42109
42136
|
const handleAdd = (dataSource, tableElement, columnFistEdit,
|
|
42110
42137
|
/*eslint-disable*/
|
|
42111
|
-
changeDataSource, pagingSetting, setIndexFocus, focusNewElement
|
|
42138
|
+
changeDataSource, pagingSetting, setIndexFocus, focusNewElement,
|
|
42112
42139
|
/*eslint-enable*/
|
|
42113
|
-
) => {
|
|
42140
|
+
numberOfRows) => {
|
|
42114
42141
|
const lengthData = dataSource.length;
|
|
42115
|
-
changeDataSource(dataSource,
|
|
42142
|
+
changeDataSource(dataSource, numberOfRows ?? 1);
|
|
42116
42143
|
if (pagingSetting?.setCurrentPage) {
|
|
42117
42144
|
pagingSetting?.setCurrentPage(Math.floor(lengthData / (pagingSetting?.pageSize ?? 0)) + 1);
|
|
42118
42145
|
}
|
|
@@ -42196,14 +42223,14 @@ editDisable, addDisable, toolbarSetting, buttonSetting) => {
|
|
|
42196
42223
|
messageBoxConfirmDelete(t, () => {
|
|
42197
42224
|
if (!editDisable && !addDisable) {
|
|
42198
42225
|
setIndexFocus(-1);
|
|
42199
|
-
changeDataSource([]
|
|
42226
|
+
changeDataSource([]);
|
|
42200
42227
|
}
|
|
42201
42228
|
}, '');
|
|
42202
42229
|
}
|
|
42203
42230
|
};
|
|
42204
42231
|
|
|
42205
42232
|
const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleInsertAfter, handleDeleteAll, setOpenPopupSetupColumn, indexFocus, editDisable, addDisable, buttonSetting, toolbarSetting, headerColumns, t }) => {
|
|
42206
|
-
return (jsx("div", { id: "table_custom_bottom_toolbar", className: "r-toolbar r-toolbar-bottom", role: "toolbar", "aria-disabled": "false", "aria-haspopup": "false", "aria-orientation": "horizontal", children: jsxs("div", { className: "r-toolbar-items", children: [jsxs("div", { className: "r-toolbar-left", children: [
|
|
42233
|
+
return (jsx("div", { id: "table_custom_bottom_toolbar", className: "r-toolbar r-toolbar-bottom", role: "toolbar", "aria-disabled": "false", "aria-haspopup": "false", "aria-orientation": "horizontal", children: jsxs("div", { className: "r-toolbar-items", children: [jsxs("div", { className: "r-toolbar-left", children: [jsxs("div", { className: classnames('r-toolbar-item d-flex', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: [jsx(Button$1, { color: 'success', outline: true, onClick: () => handleAdd(1), className: 'd-flex', children: t('Add item') }), jsxs(UncontrolledDropdown, { className: 'nav-item', children: [jsx(DropdownToggle$1, { tag: 'div', className: 'me-0 d-flex', children: jsx(Button$1, { type: 'button', color: 'success', outline: true, style: { marginLeft: -1 }, className: 'px-25', children: jsx("svg", { fill: '#28c76f', height: "15", width: "20", viewBox: "0 0 20 20", children: jsx("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" }) }) }) }), jsxs(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown p-0', style: { width: 60 }, children: [jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(10), children: " 10 " }), jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(20), children: " 20 " }), jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(30), children: " 30 " }), jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(40), children: " 40 " }), jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(50), children: " 50 " })] })] })] }), (indexFocus ?? -1) > -1 ? jsxs(Fragment$1, { children: [jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'success', outline: true, onClick: () => { handleDuplicate(); }, className: 'd-flex', children: t('Duplicate') }) }), jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.insertBeforeDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'success', outline: true, onClick: handleInsertBefore, className: 'd-flex', children: t('Insert item before') }) }), jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.insertAfterDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'success', outline: true, onClick: handleInsertAfter, className: 'd-flex', children: t('Insert item after') }) })] }) : jsx(Fragment$1, { children: " " }), jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || buttonSetting?.deleteAllDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'primary', outline: true, onClick: handleDeleteAll, className: 'd-flex', children: t('Delete all item') }) }), toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
42207
42234
|
return ((item.align === 'left') ? jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`) : '');
|
|
42208
42235
|
})] }), jsx("div", { className: "r-toolbar-center", children: toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
42209
42236
|
return ((item.align === 'center') ? jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : '');
|
|
@@ -42431,9 +42458,9 @@ const EditFormInline = forwardRef((props, ref) => {
|
|
|
42431
42458
|
onFormOpen(rowData, itemsField, setItemsField);
|
|
42432
42459
|
}
|
|
42433
42460
|
setOnFocus(true);
|
|
42434
|
-
}, onKeyDown: e => formKeyDown(e, handleSubmit), children: template ? template(rowData, indexRow) : displayValue }), jsx("div", { className: `form__edit ${onFocus ? 'active' : ''}`, onKeyDown: e => handleOnKeyDown(), children: itemsField.map((item, index) => {
|
|
42461
|
+
}, onKeyDown: e => formKeyDown(e, handleSubmit), children: template ? template(rowData, indexRow) : displayValue }), onFocus && jsx("div", { className: `form__edit ${onFocus ? 'active' : ''}`, style: { width: (itemsField?.length ?? 0) * 95 }, onKeyDown: e => handleOnKeyDown(), children: itemsField.map((item, index) => {
|
|
42435
42462
|
if (item.type === 'numeric') {
|
|
42436
|
-
return (jsx("div", { className: "form__element", onKeyDown: e => formItemKeyDown(e, index), children: jsx(NumberInput, { id: `form-element-${field}-${index}`, control: control, name: item.name, label: item.label ? item.label : '', labelSize: `${labelSize}`, errors: errors[item.name], disabled: item.disabled, min: item.min, max: item.max, inLine: false, fractionCurrency: item.fraction, callback: () => { elementChange(item.name); } }, index) }, index));
|
|
42463
|
+
return (jsx("div", { style: { minWidth: 90 }, className: "form__element", onKeyDown: e => formItemKeyDown(e, index), children: jsx(NumberInput, { id: `form-element-${field}-${index}`, control: control, name: item.name, label: item.label ? item.label : '', labelSize: `${labelSize}`, errors: errors[item.name], disabled: item.disabled, min: item.min, max: item.max, inLine: false, fractionCurrency: item.fraction, callback: () => { elementChange(item.name); } }, index) }, index));
|
|
42437
42464
|
}
|
|
42438
42465
|
else if (item.type === 'text') {
|
|
42439
42466
|
return (jsx("div", { className: "form__element", onKeyDown: e => formItemKeyDown(e, index), children: jsx(TextInput, { id: `form-element-${field}-${index}`, control: control, name: item.name, label: item.label ? item.label : '', labelSize: `${labelSize}`, inLine: false, errors: errors[item.name], disabled: item.disabled, callback: () => { elementChange(item.name); } }, index) }, index));
|
|
@@ -42460,7 +42487,10 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42460
42487
|
const [levelCol, setLevelCol] = useState(0);
|
|
42461
42488
|
const [columnFistEdit, setColumnFistEdit] = useState(0);
|
|
42462
42489
|
const [columnLastEdit, setColumnlastEdit] = useState(0);
|
|
42463
|
-
const [
|
|
42490
|
+
const [objWidthFixRight, setObjWidthFixRight] = useState({});
|
|
42491
|
+
const [objWidthFixLeft, setObjWidthFixLeft] = useState({});
|
|
42492
|
+
const [lastObjWidthFixLeft, setLastObjWidthFixLeft] = useState(0);
|
|
42493
|
+
const [fisrtObjWidthFixRight, setFisrtObjWidthFixRight] = useState(0);
|
|
42464
42494
|
const [openPopupSetupColumn, setOpenPopupSetupColumn] = useState(false);
|
|
42465
42495
|
const [searchTerm, setSearchTerm] = useState('');
|
|
42466
42496
|
const tableElement = useRef(null);
|
|
@@ -42487,12 +42517,14 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42487
42517
|
headerColumns[0][index].fixedType = item.fixedType;
|
|
42488
42518
|
}
|
|
42489
42519
|
if (item.fixedType === 'left' && item.visible !== false) {
|
|
42490
|
-
|
|
42520
|
+
setLastObjWidthFixLeft(index);
|
|
42521
|
+
objWidthFixLeft[index] = letfWidthFix;
|
|
42491
42522
|
letfWidthFix += Number(item.width ?? 40);
|
|
42492
42523
|
}
|
|
42493
42524
|
const lasColumn = contentColumns[contentColumns.length - 1 - index];
|
|
42494
42525
|
if (lasColumn.fixedType === 'right' && lasColumn.visible !== false) {
|
|
42495
|
-
|
|
42526
|
+
setFisrtObjWidthFixRight(contentColumns.length - 1 - index);
|
|
42527
|
+
objWidthFixRight[contentColumns.length - 1 - index] = rightWidthFix;
|
|
42496
42528
|
rightWidthFix += Number(lasColumn.width ?? 40);
|
|
42497
42529
|
}
|
|
42498
42530
|
if (item.editEnable && (item.visible !== false) && (!item.disabledCondition)) {
|
|
@@ -42505,7 +42537,8 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42505
42537
|
if (levelCol === 1) {
|
|
42506
42538
|
setHeaderColumns([...headerColumns]);
|
|
42507
42539
|
}
|
|
42508
|
-
|
|
42540
|
+
setObjWidthFixLeft(objWidthFixLeft);
|
|
42541
|
+
setObjWidthFixRight(objWidthFixRight);
|
|
42509
42542
|
setColumnFistEdit(indexFirst + 1);
|
|
42510
42543
|
setColumnlastEdit(indexlast + 1);
|
|
42511
42544
|
}, [contentColumns]);
|
|
@@ -42620,7 +42653,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42620
42653
|
else {
|
|
42621
42654
|
toolbarTopOption = [...defaultToolbarOption];
|
|
42622
42655
|
}
|
|
42623
|
-
const
|
|
42656
|
+
const RenderEditCell = (row, col, indexCol, indexRow) => {
|
|
42624
42657
|
/*eslint-disable */
|
|
42625
42658
|
switch (col?.editTypeCondition ? col?.editTypeCondition(row) : col.editType) {
|
|
42626
42659
|
case 'date':
|
|
@@ -42731,31 +42764,29 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42731
42764
|
else {
|
|
42732
42765
|
valueSelectTree = (!isNullOrUndefined$1(row[col.field]) && row[col.field] !== '') ? findItemInTree(optionsSelectTree, row[col.field]) : '';
|
|
42733
42766
|
}
|
|
42734
|
-
return (jsx(
|
|
42767
|
+
return (jsx(SelectTableTree, { id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`, value: valueSelectTree, options: optionsSelectTree, onChange: (val) => {
|
|
42768
|
+
if (col.selectSettings?.isMulti) {
|
|
42769
|
+
row[col.field] = !isNullOrUndefined$1(val) ? val : [];
|
|
42770
|
+
}
|
|
42771
|
+
else {
|
|
42772
|
+
row[col.field] = !isNullOrUndefined$1(val) ? val[col.selectSettings?.fieldValue ?? 'value'] : undefined;
|
|
42773
|
+
}
|
|
42774
|
+
if (col.callback) {
|
|
42775
|
+
col.callback(val, indexRow, row);
|
|
42776
|
+
}
|
|
42777
|
+
handleDataChange(row, col, indexRow);
|
|
42778
|
+
}, fieldValue: col.selectSettings?.fieldValue, fieldLabel: col.selectSettings?.fieldLabel, component: gridRef, columns: col.selectSettings?.columns, isClearable: col.selectSettings?.isClearable ?? false, formatSetting: formatSetting, placeholder: t('Select'), onOpenMenu: () => {
|
|
42779
|
+
if (col.selectSettings?.onOpenMenu) {
|
|
42780
|
+
col.selectSettings?.onOpenMenu(row, col, indexRow);
|
|
42781
|
+
}
|
|
42782
|
+
}, loadOptions: col.selectSettings?.loadOptions, handleAdd: col.selectSettings?.handAddNew ? (e) => col.selectSettings?.handAddNew(e, indexRow, row) : undefined, fieldChildren: col.selectSettings?.fieldChild ?? 'children', selectChilds: col.selectSettings?.selectChilds, showFooter: col.selectSettings?.showFooter, formatOptionLabel: col.selectSettings?.formatOptionLabel, footerComponent: col.selectSettings?.footerComponent, width: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : undefined, isMulti: col.selectSettings?.isMulti, noHeader: col.selectSettings?.noHeader, invalid: col.validate && col.validate(row[col.field], row), maxHeight: col.selectSettings?.heightPopup ? Number(col.selectSettings?.heightPopup) : undefined, menuWidth: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : undefined, textAlign: col.textAlign ?? 'left', onKeyDown: (e) => {
|
|
42735
42783
|
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) ;
|
|
42736
|
-
},
|
|
42737
|
-
|
|
42738
|
-
|
|
42739
|
-
|
|
42740
|
-
|
|
42741
|
-
|
|
42742
|
-
}
|
|
42743
|
-
if (col.callback) {
|
|
42744
|
-
col.callback(val, indexRow, row);
|
|
42745
|
-
}
|
|
42746
|
-
handleDataChange(row, col, indexRow);
|
|
42747
|
-
}, fieldValue: col.selectSettings?.fieldValue, fieldLabel: col.selectSettings?.fieldLabel, component: gridRef, columns: col.selectSettings?.columns, isClearable: col.selectSettings?.isClearable ?? false, formatSetting: formatSetting, placeholder: t('Select'), onOpenMenu: () => {
|
|
42748
|
-
if (col.selectSettings?.onOpenMenu) {
|
|
42749
|
-
col.selectSettings?.onOpenMenu(row, col, indexRow);
|
|
42750
|
-
}
|
|
42751
|
-
}, loadOptions: col.selectSettings?.loadOptions, handleAdd: col.selectSettings?.handAddNew ? (e) => col.selectSettings?.handAddNew(e, indexRow, row) : undefined, fieldChildren: col.selectSettings?.fieldChild ?? 'children', selectChilds: col.selectSettings?.selectChilds, showFooter: col.selectSettings?.showFooter, formatOptionLabel: col.selectSettings?.formatOptionLabel, footerComponent: col.selectSettings?.footerComponent, width: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : undefined, isMulti: col.selectSettings?.isMulti, noHeader: col.selectSettings?.noHeader, invalid: col.validate && col.validate(row[col.field], row), maxHeight: col.selectSettings?.heightPopup ? Number(col.selectSettings?.heightPopup) : undefined, menuWidth: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : undefined, textAlign: col.textAlign ?? 'left', onKeyDown: (e) => {
|
|
42752
|
-
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) ;
|
|
42753
|
-
}, onPaste: (e) => {
|
|
42754
|
-
if (toolbarSetting?.showBottomToolbar && !editDisable && !addDisable && !col.disablePaste) {
|
|
42755
|
-
pasteDataFromExcel(indexRow, indexCol, e);
|
|
42756
|
-
e.preventDefault();
|
|
42757
|
-
}
|
|
42758
|
-
} }) }));
|
|
42784
|
+
}, onPaste: (e) => {
|
|
42785
|
+
if (toolbarSetting?.showBottomToolbar && !editDisable && !addDisable && !col.disablePaste) {
|
|
42786
|
+
pasteDataFromExcel(indexRow, indexCol, e);
|
|
42787
|
+
e.preventDefault();
|
|
42788
|
+
}
|
|
42789
|
+
} }));
|
|
42759
42790
|
case 'checkbox':
|
|
42760
42791
|
return (jsx(Input$1, { checked: row[col.field], id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`, type: "checkbox", className: "input-checkbox cursor-pointer", style: { textAlign: col.textAlign ?? 'left', marginTop: 6 }, onChange: (val) => {
|
|
42761
42792
|
row[col.field] = val.currentTarget.checked;
|
|
@@ -42820,7 +42851,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42820
42851
|
return (jsx(EditForm, { id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`, ...col.formSettings, field: col.field, displayValue: col.formSettings?.displayValue ? col.formSettings?.displayValue(row) : '', placeholder: col.placeholder ? t(col.placeholder) : '', rowData: row, indexRow: indexRow, onChange: (val) => {
|
|
42821
42852
|
Object.assign(row, val);
|
|
42822
42853
|
handleDataChange(row, col, indexRow);
|
|
42823
|
-
}, invalid: col.validate && col.validate(row[col.field], row), textAlign: col.textAlign, onKeyDown: (e) => {
|
|
42854
|
+
}, invalid: col.validate && col.validate(row[col.field], row), textAlign: col.textAlign, template: col.template, onKeyDown: (e) => {
|
|
42824
42855
|
return checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
42825
42856
|
}, onPaste: (e) => {
|
|
42826
42857
|
if (toolbarSetting?.showBottomToolbar && !editDisable && !addDisable && !col.disablePaste) {
|
|
@@ -42896,7 +42927,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42896
42927
|
};
|
|
42897
42928
|
//Thêm dòng mới
|
|
42898
42929
|
const moveIndexRowToNewPage = () => {
|
|
42899
|
-
changeDataSource(dataSource,
|
|
42930
|
+
changeDataSource(dataSource, 1);
|
|
42900
42931
|
if (pagingClient && pagingSetting?.setCurrentPage && (totalCount % (pagingSetting?.pageSize ?? 0)) === 0) {
|
|
42901
42932
|
pagingSetting?.setCurrentPage((pagingSetting?.currentPage ?? 0) + 1);
|
|
42902
42933
|
}
|
|
@@ -42963,13 +42994,13 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42963
42994
|
}, 50);
|
|
42964
42995
|
});
|
|
42965
42996
|
const getColumn = (col, index) => {
|
|
42966
|
-
const column = contentColumns
|
|
42997
|
+
const column = contentColumns[col + index];
|
|
42967
42998
|
if (column) {
|
|
42968
42999
|
return { ...column };
|
|
42969
43000
|
}
|
|
42970
43001
|
return undefined;
|
|
42971
43002
|
};
|
|
42972
|
-
const pasteDataFromExcel = async (currenRowIndex,
|
|
43003
|
+
const pasteDataFromExcel = async (currenRowIndex, indexCol, e) => {
|
|
42973
43004
|
const clipboard = (e.clipboardData || window.Clipboard).getData('text');
|
|
42974
43005
|
const rowsClipboard = clipboard.trimEnd().split('\n');
|
|
42975
43006
|
setIndexFocus(-1);
|
|
@@ -42985,7 +43016,8 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42985
43016
|
stringData.push(element.trimEnd().split('\t')[index].toString().trim());
|
|
42986
43017
|
}
|
|
42987
43018
|
});
|
|
42988
|
-
const column = getColumn(
|
|
43019
|
+
const column = getColumn(indexCol, index);
|
|
43020
|
+
console.log(column);
|
|
42989
43021
|
if (column) {
|
|
42990
43022
|
if ((!column.disabledCondition || !column.disabledCondition(dataSource[currenRowIndex + 0])) && column.editEnable && column.onPasteValidate) {
|
|
42991
43023
|
const rs = await column.onPasteValidate(stringData.join(','), currenRowIndex + 0, dataSource[currenRowIndex + 0]);
|
|
@@ -43062,8 +43094,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43062
43094
|
}
|
|
43063
43095
|
}
|
|
43064
43096
|
else if (column.editType === 'select') {
|
|
43065
|
-
|
|
43066
|
-
if (rs) {
|
|
43097
|
+
if (column.selectSettings?.allowCreate) {
|
|
43067
43098
|
if (column.onPaste) {
|
|
43068
43099
|
dataRow[column.field] = column.onPaste(dataRow, stringData);
|
|
43069
43100
|
}
|
|
@@ -43071,11 +43102,25 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43071
43102
|
dataRow[column.field] = stringData;
|
|
43072
43103
|
}
|
|
43073
43104
|
if (column.callback) {
|
|
43074
|
-
column.callback(
|
|
43105
|
+
column.callback(stringData, currenRowIndex + indexRow);
|
|
43075
43106
|
}
|
|
43076
43107
|
}
|
|
43077
43108
|
else {
|
|
43078
|
-
|
|
43109
|
+
const rs = ((column.selectSettings?.optionsField ? item[column.selectSettings?.optionsField] : column.selectSettings?.options) ?? []).find((item) => item[column.selectSettings?.fieldValue ?? 'value'] === stringData);
|
|
43110
|
+
if (rs) {
|
|
43111
|
+
if (column.onPaste) {
|
|
43112
|
+
dataRow[column.field] = column.onPaste(dataRow, stringData);
|
|
43113
|
+
}
|
|
43114
|
+
else {
|
|
43115
|
+
dataRow[column.field] = stringData;
|
|
43116
|
+
}
|
|
43117
|
+
if (column.callback) {
|
|
43118
|
+
column.callback(rs, currenRowIndex + indexRow);
|
|
43119
|
+
}
|
|
43120
|
+
}
|
|
43121
|
+
else {
|
|
43122
|
+
notificationError(t('PasteExcelNotExist', { index: (currenRowIndex + indexRow + 1), field: t(column.headerText ?? ''), value: stringData }));
|
|
43123
|
+
}
|
|
43079
43124
|
}
|
|
43080
43125
|
}
|
|
43081
43126
|
else {
|
|
@@ -43100,7 +43145,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43100
43145
|
}
|
|
43101
43146
|
changeDataSource(dataSource);
|
|
43102
43147
|
};
|
|
43103
|
-
const changeDataSource = (data,
|
|
43148
|
+
const changeDataSource = (data, numberOfRows) => {
|
|
43104
43149
|
if (!editDisable && setDataSource) {
|
|
43105
43150
|
if ((searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm)) {
|
|
43106
43151
|
if (searchSetting?.setSearchTerm) {
|
|
@@ -43110,8 +43155,10 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43110
43155
|
setSearchTerm('');
|
|
43111
43156
|
}
|
|
43112
43157
|
}
|
|
43113
|
-
if (
|
|
43114
|
-
|
|
43158
|
+
if (numberOfRows && !addDisable) {
|
|
43159
|
+
for (let index = 0; index < numberOfRows; index++) {
|
|
43160
|
+
data.push(defaultValue ? { ...defaultValue, [fieldKey]: disableAutoKey ? undefined : generateUUID() } : {});
|
|
43161
|
+
}
|
|
43115
43162
|
setDataSource([...data]);
|
|
43116
43163
|
}
|
|
43117
43164
|
else {
|
|
@@ -43167,16 +43214,16 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43167
43214
|
}, [selectedItem]);
|
|
43168
43215
|
const renderContentCol = (col, row, indexRow, indexCol, isSelected) => {
|
|
43169
43216
|
if (col.field === 'command') {
|
|
43170
|
-
return (col.visible !== false && jsx("td", { className: classnames(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43171
|
-
left: col.fixedType === 'left' ?
|
|
43172
|
-
right: col.fixedType === 'right' ?
|
|
43217
|
+
return (col.visible !== false && jsx("td", { className: classnames(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'cell-fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43218
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43219
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43173
43220
|
textAlign: col.textAlign ? col.textAlign : 'left',
|
|
43174
43221
|
}, children: jsx("div", { className: "r-rowcell-div command", children: jsx(CommandElement, { commandItems: col.commandItems ?? [], handleCommandClick: handleCommandClick, indexRow: indexRow, rowData: row, setIndexFocus: setIndexFocus, indexFocus: indexFocus }) }) }, `col-${indexRow}-${indexCol}`));
|
|
43175
43222
|
}
|
|
43176
43223
|
else if (col.field === '#') {
|
|
43177
|
-
return (col.visible !== false && jsx("td", { className: classnames(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), tabIndex: Number(`${indexRow}${indexCol}`), style: {
|
|
43178
|
-
left: col.fixedType === 'left' ?
|
|
43179
|
-
right: col.fixedType === 'right' ?
|
|
43224
|
+
return (col.visible !== false && jsx("td", { className: classnames(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'cell-fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), tabIndex: Number(`${indexRow}${indexCol}`), style: {
|
|
43225
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43226
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43180
43227
|
textAlign: 'center',
|
|
43181
43228
|
}, onCopy: (e) => {
|
|
43182
43229
|
if (!editDisable && (e.target.nodeName === 'DIV' || e.target.nodeName === 'TD')) {
|
|
@@ -43212,11 +43259,10 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43212
43259
|
}, children: jsx("div", { className: "r-rowcell-div", children: indexRow + 1 }) }, `col-${indexRow}-${indexCol}`));
|
|
43213
43260
|
}
|
|
43214
43261
|
else if (col.field === 'checkbox') {
|
|
43215
|
-
return (jsx("td", { className: classnames(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43216
|
-
left: col.fixedType === 'left' ?
|
|
43217
|
-
right: col.fixedType === 'right' ?
|
|
43218
|
-
|
|
43219
|
-
}, children: jsx("div", { className: "r-rowcell-div cursor-pointer", onClick: (e) => {
|
|
43262
|
+
return (jsx("td", { className: classnames(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'cell-fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43263
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43264
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43265
|
+
}, children: jsx("div", { className: "r-rowcell-div cursor-pointer", style: { alignItems: 'center' }, onClick: (e) => {
|
|
43220
43266
|
if (selectEnable) {
|
|
43221
43267
|
const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
|
|
43222
43268
|
if (index > -1) {
|
|
@@ -43238,7 +43284,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43238
43284
|
}
|
|
43239
43285
|
e.stopPropagation();
|
|
43240
43286
|
}
|
|
43241
|
-
}, children: jsx(Input$1, { checked: isSelected, type: "checkbox", className: "cursor-pointer",
|
|
43287
|
+
}, children: jsx(Input$1, { checked: isSelected, type: "checkbox", className: "cursor-pointer", style: { textAlign: col.textAlign ?? 'center' } }) }) }, `col-${indexRow}-${indexCol}`));
|
|
43242
43288
|
}
|
|
43243
43289
|
else {
|
|
43244
43290
|
let value = row[col.field];
|
|
@@ -43253,9 +43299,9 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43253
43299
|
}
|
|
43254
43300
|
const typeDis = !editDisable && (indexFocus === indexRow || col.editType === 'checkbox') && (!col.disabledCondition || !col.disabledCondition(row)) ? (col.editEnable ? 1 : (col.template ? 2 : 3)) : (col.template ? 2 : 3);
|
|
43255
43301
|
const errorMessage = typeDis === 1 || col.field === '' || !col.validate ? '' : col.validate(row[col.field], row);
|
|
43256
|
-
return (jsx(Fragment, { children: col.visible !== false && jsx("td", { className: classnames(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43257
|
-
left: col.fixedType === 'left' ?
|
|
43258
|
-
right: col.fixedType === 'right' ?
|
|
43302
|
+
return (jsx(Fragment, { children: col.visible !== false && jsx("td", { className: classnames(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'cell-fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43303
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43304
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43259
43305
|
}, onClick: (e) => {
|
|
43260
43306
|
if (e.target.nodeName === 'DIV' || e.target.nodeName === 'TD') {
|
|
43261
43307
|
if (!editDisable && indexRow != indexFocus) {
|
|
@@ -43286,14 +43332,26 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43286
43332
|
}
|
|
43287
43333
|
}, children: jsx("div", { className: classnames('r-rowcell-div'), children: jsxs("div", { id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : '', className: classnames('r-rowcell-content', { 'r-is-invalid': errorMessage }), style: {
|
|
43288
43334
|
textAlign: col.textAlign ? col.textAlign : 'left'
|
|
43289
|
-
}, children: [typeDis === 1 && !refreshRow
|
|
43335
|
+
}, children: [typeDis === 1 && !refreshRow && jsx(Fragment$1, { children: RenderEditCell(row, col, indexCol, indexRow) }), (typeDis !== 1 || refreshRow) && RenderContentCell(row, col, indexCol, indexRow, typeDis, value), jsx("span", { id: `error-${indexRow}-${indexCol}`, className: classnames('cursor-pointer text-primary icon-table', { 'd-none': !errorMessage }), children: jsx(SvgAlertCircle, { fontSize: 15.5 }) }), jsx(UncontrolledTooltip, { target: `error-${indexRow}-${indexCol}`, className: "r-tooltip tooltip-error", children: errorMessage?.toString() ?? '' })] }) }) }, `col-${indexRow}-${indexCol}`) }, indexCol));
|
|
43336
|
+
}
|
|
43337
|
+
};
|
|
43338
|
+
const RenderContentCell = (row, col, indexCol, indexRow, typeDis, value) => {
|
|
43339
|
+
if (typeDis === 2) {
|
|
43340
|
+
const value = col.template?.(row, indexRow) ?? '';
|
|
43341
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
43342
|
+
return (jsxs(Fragment$1, { children: [jsx("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: value }), (!refreshRow && typeDis !== 2) && jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: (col.editType === 'numeric' && Number(row[col.field]) < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) })] }));
|
|
43343
|
+
}
|
|
43344
|
+
else {
|
|
43345
|
+
return value;
|
|
43346
|
+
}
|
|
43290
43347
|
}
|
|
43348
|
+
return (jsxs(Fragment$1, { children: [jsx("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: (col.editType === 'numeric' && Number(row[col.field]) < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) }), (!(typeDis === 1 && !refreshRow) && typeDis !== 2) && jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: (col.editType === 'numeric' && Number(row[col.field]) < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) })] }));
|
|
43291
43349
|
};
|
|
43292
43350
|
const renderFooterCol = (col, indexCol) => {
|
|
43293
43351
|
const sumValue = (col.haveSum === true && col.editType === "numeric") ? dataSource.reduce(function (accumulator, currentValue) { return (Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0)); }, 0) : 0;
|
|
43294
43352
|
return (jsx(Fragment, { children: (col.visible !== false) && jsx("td", { className: classnames(`p-0 px-50 r-footer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }), style: {
|
|
43295
|
-
left: col.fixedType === 'left' ?
|
|
43296
|
-
right: col.fixedType === 'right' ?
|
|
43353
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43354
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43297
43355
|
textAlign: col.textAlign ? col.textAlign : 'left'
|
|
43298
43356
|
}, children: jsxs("div", { className: "r-footer-div", children: [col.haveSum === true && col.editType === "numeric" && (Number(sumValue) >= 0) && jsx(Fragment$1, { children: formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) }), col.haveSum === true && col.editType === "numeric" && (Number(sumValue) < 0) && jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false)}${formatSetting?.suffixNegative ?? ''}`] })] }) }) }, `summarycell-${indexCol}`));
|
|
43299
43357
|
};
|
|
@@ -43326,12 +43384,12 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43326
43384
|
}, [searchTerm, searchSetting?.searchTerm]);
|
|
43327
43385
|
return (jsxs(Fragment, { children: [jsxs("div", { className: "react-table-edit", children: [jsxs("div", { className: 'r-grid', ref: gridRef, children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsx("div", { ref: tableElement, className: "r-gridtable", style: { height: `${height ? `${height}px` : 'auto'}`, minHeight: `${minHeight ? `${minHeight}px` : ''}`, maxHeight: `${maxHeight ? `${maxHeight}px` : '400px'}` }, children: jsxs("table", { style: { width: '100%' }, children: [jsx("thead", { className: 'r-gridheader', children: headerColumns.map((element, indexParent) => {
|
|
43328
43386
|
return (jsx("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
43329
|
-
return (jsx(HeaderTableCol, { col: col, dataSource: dataSource, indexCol: index, indexParent: indexParent, isMulti: isMulti ?? false,
|
|
43387
|
+
return (jsx(HeaderTableCol, { col: col, dataSource: dataSource, indexCol: index, indexParent: indexParent, isMulti: isMulti ?? false, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, column: contentColumns, setColumn: setContentColumns, totalCount: totalCount }, `header-${indexParent}-${index}`));
|
|
43330
43388
|
}) }, `header-${-indexParent}`));
|
|
43331
43389
|
}) }), jsx("tbody", { className: 'r-gridcontent', children: renderData() }), jsx("tfoot", { className: "r-gridfoot", children: haveSum == true ? jsx("tr", { className: 'r-row', children: contentColumns.map((col, index) => {
|
|
43332
43390
|
return (renderFooterCol(col, index));
|
|
43333
|
-
}) }) : jsx(Fragment$1, {}) })] }) }), toolbarSetting?.showBottomToolbar && jsx(ToolbarBottom, { handleAdd: () => {
|
|
43334
|
-
handleAdd(dataSource, tableElement.current, columnFistEdit, changeDataSource, pagingSetting, setIndexFocus, focusNewElement);
|
|
43391
|
+
}) }) : jsx(Fragment$1, {}) })] }) }), toolbarSetting?.showBottomToolbar && jsx(ToolbarBottom, { handleAdd: (numberOfRows) => {
|
|
43392
|
+
handleAdd(dataSource, tableElement.current, columnFistEdit, changeDataSource, pagingSetting, setIndexFocus, focusNewElement, numberOfRows);
|
|
43335
43393
|
}, handleDuplicate: () => {
|
|
43336
43394
|
handleDuplicate(dataSource, indexFocus, fieldKey, defaultValue, fieldUniKey, changeDataSource, tableElement, totalCount, toolbarSetting, buttonSetting, editDisable, addDisable, onDuplicate);
|
|
43337
43395
|
}, handleInsertAfter: () => {
|