react-table-edit 1.5.27 → 1.5.28
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/select-table-tree/index.d.ts +9 -10
- package/dist/component/utils.d.ts +1 -0
- package/dist/index.d.ts +10 -10
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -20047,6 +20047,15 @@ const CheckRowMatch = (row, filters, keyword, searchKeys) => {
|
|
|
20047
20047
|
});
|
|
20048
20048
|
return isFilterMatch && isSearchMatch;
|
|
20049
20049
|
};
|
|
20050
|
+
const getMaxExpandedLevel = (items, fieldChildren = 'children', level = 0) => {
|
|
20051
|
+
let max = level;
|
|
20052
|
+
items.forEach((item) => {
|
|
20053
|
+
if (item[fieldChildren]?.length > 0) {
|
|
20054
|
+
max = Math.max(max, getMaxExpandedLevel(item[fieldChildren], fieldChildren, level + 1));
|
|
20055
|
+
}
|
|
20056
|
+
});
|
|
20057
|
+
return max;
|
|
20058
|
+
};
|
|
20050
20059
|
|
|
20051
20060
|
const defaultMaxHeight$1 = 250;
|
|
20052
20061
|
const SelectTable = forwardRef((props, ref) => {
|
|
@@ -20383,7 +20392,7 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20383
20392
|
setIndexFocus(indexRow);
|
|
20384
20393
|
}
|
|
20385
20394
|
e.stopPropagation();
|
|
20386
|
-
}, children: col.template ?
|
|
20395
|
+
}, 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));
|
|
20387
20396
|
})] }, `row-${indexRow}`));
|
|
20388
20397
|
});
|
|
20389
20398
|
const RenderTable = (props) => {
|
|
@@ -20440,7 +20449,7 @@ const SelectTable = forwardRef((props, ref) => {
|
|
|
20440
20449
|
inputRef?.current.focus();
|
|
20441
20450
|
e.preventDefault();
|
|
20442
20451
|
}
|
|
20443
|
-
}, children: jsxs("div", { className: "r-select-grid", children: [jsx("div", { className: classNames$1('r-select-gridtable', { 'no-header': noHeader || (columns?.length ?? 0) === 0 }), ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight$1 }, children: jsx(RenderTable, {}) }), jsxs("div", { className: classNames$1('r-select-footer', { 'd-none': !(showFooter === true || handleAdd) }), 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)"] }), footerComponent ? footerComponent() : null] })] }) })) }) })] }) }) }));
|
|
20452
|
+
}, children: jsxs("div", { className: "r-select-grid", children: [jsx("div", { className: classNames$1('r-select-gridtable', { 'no-header': noHeader || (columns?.length ?? 0) === 0 }), ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight$1 }, children: jsx(RenderTable, {}) }), jsxs("div", { className: classNames$1('r-select-footer', { 'd-none': !(showFooter === true || handleAdd || isMulti) }), 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] })] }) })) }) })] }) }) }));
|
|
20444
20453
|
});
|
|
20445
20454
|
|
|
20446
20455
|
const PagingComponent = ({ totalItem, gridRef, pageSize, currentPage, onChangePage, pageOptions, onChangePageSize }) => {
|
|
@@ -35835,7 +35844,7 @@ const SelectTableTree = forwardRef((props, ref) => {
|
|
|
35835
35844
|
let flag = false;
|
|
35836
35845
|
if (!key) {
|
|
35837
35846
|
if (e.code === 'F9') {
|
|
35838
|
-
handleAdd();
|
|
35847
|
+
handleAdd?.(e);
|
|
35839
35848
|
flag = true;
|
|
35840
35849
|
}
|
|
35841
35850
|
else if (e.code === 'Space') {
|
|
@@ -36021,7 +36030,7 @@ const SelectTableTree = forwardRef((props, ref) => {
|
|
|
36021
36030
|
setExpanded(true);
|
|
36022
36031
|
}
|
|
36023
36032
|
e.stopPropagation();
|
|
36024
|
-
}, fontSize: 18, className: classNames$1('me-50 r-icon-expand', { 'is-open': expanded }) })), 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) : col.type === 'numeric' && Number(row[col.field]) < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : valueDisplay }))] }, indexCol));
|
|
36033
|
+
}, fontSize: 18, className: classNames$1('me-50 r-icon-expand', { 'is-open': expanded }) })), 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)) : col.type === 'numeric' && Number(row[col.field]) < 0 ? (jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] })) : (valueDisplay) }))] }, indexCol));
|
|
36025
36034
|
})] }, `row-${indexRow}`), row[fieldChildren ?? 'children'] &&
|
|
36026
36035
|
row.expanded &&
|
|
36027
36036
|
row[fieldChildren ?? 'children'].map((child, indexChild) => {
|
|
@@ -36031,9 +36040,10 @@ const SelectTableTree = forwardRef((props, ref) => {
|
|
|
36031
36040
|
}
|
|
36032
36041
|
})] }));
|
|
36033
36042
|
});
|
|
36043
|
+
const maxExpandedLevel = getMaxExpandedLevel(options, fieldChildren, 0);
|
|
36034
36044
|
const RenderTable = (props) => {
|
|
36035
36045
|
let countDisplay = 0;
|
|
36036
|
-
return (jsxs(Fragment$1, { children: [jsxs("table", { style: { width: '100%' }, children: [!(noHeader && (columns?.length ?? 0) > 0) && (jsx("thead", { className: "r-select-gridheader", children: jsxs("tr", { className: "r-select-row", role: "row", children: [isMulti && (jsx("th", { className: classNames$1(`r-select-headercell checkbox-column`), style: { width:
|
|
36046
|
+
return (jsxs(Fragment$1, { children: [jsxs("table", { style: { width: '100%' }, children: [!(noHeader && (columns?.length ?? 0) > 0) && (jsx("thead", { className: "r-select-gridheader", children: jsxs("tr", { className: "r-select-row", role: "row", children: [isMulti && (jsx("th", { className: classNames$1(`r-select-headercell checkbox-column`), style: { width: 10 + maxExpandedLevel * 15, top: `0px` }, children: jsx("div", { style: { justifyContent: 'left' }, className: classNames$1('r-select-headercell-div'), children: jsx(Input$1, { checked: isSelectedAll, type: "checkbox", onClick: (e) => {
|
|
36037
36047
|
if (isMulti) {
|
|
36038
36048
|
if (isSelectedAll) {
|
|
36039
36049
|
onChange([]);
|
|
@@ -36077,7 +36087,7 @@ const SelectTableTree = forwardRef((props, ref) => {
|
|
|
36077
36087
|
e.preventDefault();
|
|
36078
36088
|
}, tag: "div", style: { width: '100%' }, 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(Fragment$1, { children: jsx("div", { className: classNames$1('select-value is-mutil', { 'd-none': searchTerm }), children: getSelectedRecords(options, value).map((ele, index) => {
|
|
36079
36089
|
return (jsxs("span", { children: [index === 0 ? '' : ', ', ele[fieldLabel ?? 'label']] }, index));
|
|
36080
|
-
}) }) })) : (
|
|
36090
|
+
}) }) })) : (jsxs("div", { className: classNames$1('select-value', { 'd-none': searchTerm }), children: [value ? (formatOptionLabel ? formatOptionLabel(value) : value[fieldLabel ?? 'label']) : '', " "] })), !((isMulti ? value?.length > 0 : value) || isDisabled || 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) => {
|
|
36081
36091
|
setSearchTerm(val.target.value);
|
|
36082
36092
|
}, onKeyDown: (e) => handleOnKeyDown(e) }) })] }), isClearable && value && !isDisabled && (jsx("div", { className: classNames$1('cursor-pointer icon-clear'), onClick: (e) => {
|
|
36083
36093
|
onChange(isMulti ? [] : undefined);
|
|
@@ -36092,7 +36102,7 @@ const SelectTableTree = forwardRef((props, ref) => {
|
|
|
36092
36102
|
inputRef?.current.focus();
|
|
36093
36103
|
e.preventDefault();
|
|
36094
36104
|
}
|
|
36095
|
-
}, children: jsxs("div", { className: "r-select-grid r-select-tree-grid", children: [jsx("div", { className: "r-select-gridtable ", ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight }, children: jsx(RenderTable, {}) }), jsxs("div", { className: classNames$1('r-select-footer', { 'd-none': !(showFooter === true || handleAdd || isMulti) }), 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 &&
|
|
36105
|
+
}, children: jsxs("div", { className: "r-select-grid r-select-tree-grid", children: [jsx("div", { className: "r-select-gridtable ", ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight }, children: jsx(RenderTable, {}) }), jsxs("div", { className: classNames$1('r-select-footer', { 'd-none': !(showFooter === true || handleAdd || isMulti) }), 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] })] }) })) }) })] }) }) }));
|
|
36096
36106
|
});
|
|
36097
36107
|
|
|
36098
36108
|
const RenderEditCellComponent = (props) => {
|
|
@@ -36216,7 +36226,7 @@ const RenderEditCellComponent = (props) => {
|
|
|
36216
36226
|
col.callback(val, indexRow, row);
|
|
36217
36227
|
}
|
|
36218
36228
|
handleDataChange(row, col, indexRow);
|
|
36219
|
-
}, fieldValue: col.selectSettings?.fieldValue, fieldLabel: col.selectSettings?.fieldLabel, component: gridRef, columns: col.selectSettings?.columns, isClearable: col.selectSettings?.isClearable ?? false, formatSetting: formatSetting, placeholder: t('Select'),
|
|
36229
|
+
}, fieldValue: col.selectSettings?.fieldValue, fieldLabel: col.selectSettings?.fieldLabel, component: gridRef, columns: col.selectSettings?.columns, isClearable: col.selectSettings?.isClearable ?? false, formatSetting: formatSetting, placeholder: t('Select'), 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', onOpenMenu: col.selectSettings?.onOpenMenu ? () => col.selectSettings?.onOpenMenu?.(row, col, indexRow) : undefined, onKeyDown: (e) => {
|
|
36220
36230
|
if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'NumpadEnter' || e.key === 'Enter' || e.key === 'Tab') {
|
|
36221
36231
|
handleKeyDown(e, row);
|
|
36222
36232
|
}
|
|
@@ -69159,5 +69169,5 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
69159
69169
|
} })] }));
|
|
69160
69170
|
};
|
|
69161
69171
|
|
|
69162
|
-
export { CheckRowMatch, ExportExcelComponent, FindNodeByPath, InputStyleComponent, ModalImportComponent, SelectTable, SelectTableTree, TableView, TabsMenuComponent, Wizard, calculateTableStructure, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, formatDateTime, generateUUID, isNullOrUndefined$1 as isNullOrUndefined, messageBoxConfirm, messageBoxConfirmAsync, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxConfirmAsync, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
|
|
69172
|
+
export { CheckRowMatch, ExportExcelComponent, FindNodeByPath, InputStyleComponent, ModalImportComponent, SelectTable, SelectTableTree, TableView, TabsMenuComponent, Wizard, calculateTableStructure, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, formatDateTime, generateUUID, getMaxExpandedLevel, isNullOrUndefined$1 as isNullOrUndefined, messageBoxConfirm, messageBoxConfirmAsync, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxConfirmAsync, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
|
|
69163
69173
|
//# sourceMappingURL=index.mjs.map
|