react-table-edit 1.5.25 → 1.5.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -39765,7 +39765,7 @@ const SettingColumn = React__default.memo((props) => {
39765
39765
  ];
39766
39766
  return (jsx(SelectTable, { component: gridRef, options: optionsFix, textAlign: 'left', isClearable: true, onChange: (val) => {
39767
39767
  if (dataSource) {
39768
- dataSource[index].fixedType = val?.value ?? null;
39768
+ dataSource[index].fixedType = val?.value;
39769
39769
  setDataSource([...dataSource]);
39770
39770
  }
39771
39771
  }, value: item.fixedType ? optionsFix.find((x) => x.value === item.fixedType) : undefined }));
@@ -39792,10 +39792,9 @@ const SettingColumn = React__default.memo((props) => {
39792
39792
  }
39793
39793
  } }));
39794
39794
  };
39795
- const RowSetting = React__default.memo(({ item, index }) => {
39796
- return (jsxs("div", { className: "r-setting-row", children: [jsx("div", { className: "r-setting-cell", style: { width: 30 }, children: jsx(SvgDragDrop, { fontSize: 12, className: "drag-icon cursor-move" }) }), jsx("div", { className: "r-setting-cell", style: { width: 200 }, children: t(item.headerText ?? '') }), jsx("div", { className: "r-setting-cell", style: { flex: 1 }, children: jsx(HeaderDisplayTemplate, { item: item, index: index }) }), jsx("div", { className: "r-setting-cell", style: { width: 80, textAlign: 'center' }, children: jsx(VisibleTemplate, { item: item, index: index }) }), jsx("div", { className: "r-setting-cell", style: { width: 100 }, children: jsx(FixColumnTemplate, { item: item, index: index }) }), jsx("div", { className: "r-setting-cell", style: { width: 110 }, children: jsx(WidthColumnTemplate, { item: item, index: index }) })] }));
39797
- });
39798
- return (jsxs(Sidebar, { open: openSidebar, toggleSidebar: handleCancel, width: 900, children: [jsx(ModalHeader, { typeModal: 'Edit', handleModal: handleCancel, title: 'Column setup' }), jsxs("div", { className: "r-setting-container", children: [jsxs("div", { style: { fontWeight: 700, color: '#000' }, className: "r-setting-row r-setting-header me-75", children: [jsx("span", { className: "r-setting-cell", style: { width: 30 } }), jsx("span", { className: "r-setting-cell", style: { width: 200 }, children: t('Column name') }), jsx("span", { className: "r-setting-cell", style: { flex: 1 }, children: t('Column name display') }), jsx("span", { className: "r-setting-cell", style: { width: 80, textAlign: 'center' }, children: t('Display') }), jsx("span", { className: "r-setting-cell", style: { width: 100 }, children: t('Fix the column') }), jsx("span", { className: "r-setting-cell", style: { width: 110 }, children: t('Column width(px)') })] }), jsx("div", { className: "r-setting-content", style: { height: windowSize.innerHeight - 140 }, children: jsx(dist.exports.ReactSortable, { tag: "div", list: dataSource, handle: ".drag-icon", setList: (newState) => setDataSource(newState), filter: "input,textarea,select", preventOnFilter: false, children: dataSource.map((item, index) => (jsx(RowSetting, { item: item, index: index }, index))) }) })] }), jsxs("div", { style: { boxShadow: '0 4px 24px 0 rgb(34 41 47 / 10%)' }, className: "d-flex justify-content-between align-items-center w-100 py-75 px-1", children: [jsx("div", { children: settingColumns?.updatedDate && (jsxs("p", { children: [jsxs("strong", { children: [t('Update date'), ": "] }), " ", jsx("span", { children: settingColumns.updatedDate ? formatDateTime(settingColumns.updatedDate, 'DD/MM/yyyy HH:mm') : '' }), jsxs("strong", { className: "ms-2", children: [t('Editor'), ": "] }), " ", jsx("span", { children: settingColumns.updatedByName })] })) }), jsxs("div", { children: [resetDefaultColumns && (jsx(Button$1$1, { color: "primary", onClick: () => messageBoxConfirm(t, handleResetColumns, {}, 'Do you want to reset the default settings?'), className: "me-1", children: t('Reset') })), jsx(Button$1$1, { color: "primary", onClick: handleSubmit, className: "me-1", children: t('Confirm') }), jsx(Button$1$1, { color: "secondary", onClick: handleCancel, outline: true, children: t('Close') })] })] })] }));
39795
+ return (jsxs(Sidebar, { open: openSidebar, toggleSidebar: handleCancel, width: 900, children: [jsx(ModalHeader, { typeModal: 'Edit', handleModal: handleCancel, title: 'Column setup' }), jsxs("div", { className: "r-setting-container", children: [jsxs("div", { style: { fontWeight: 700, color: '#000' }, className: "r-setting-row r-setting-header me-75", children: [jsx("span", { className: "r-setting-cell", style: { width: 30 } }), jsx("span", { className: "r-setting-cell", style: { width: 200 }, children: t('Column name') }), jsx("span", { className: "r-setting-cell", style: { flex: 1 }, children: t('Column name display') }), jsx("span", { className: "r-setting-cell", style: { width: 80, textAlign: 'center' }, children: t('Display') }), jsx("span", { className: "r-setting-cell", style: { width: 100 }, children: t('Fix the column') }), jsx("span", { className: "r-setting-cell", style: { width: 110 }, children: t('Column width(px)') })] }), jsx("div", { className: "r-setting-content", style: { height: windowSize.innerHeight - 140 }, children: jsx(dist.exports.ReactSortable, { tag: "div", list: dataSource, handle: ".drag-icon", setList: (newState) => setDataSource(newState), children: dataSource.map((item, index) => {
39796
+ return (jsxs("div", { className: "r-setting-row", children: [jsx("div", { className: "r-setting-cell", style: { width: 30 }, children: jsx(SvgDragDrop, { fontSize: 12, className: "drag-icon cursor-move" }) }), jsx("div", { className: "r-setting-cell", style: { width: 200 }, children: t(item.headerText ?? '') }), jsx("div", { className: "r-setting-cell", style: { flex: 1 }, children: jsx(HeaderDisplayTemplate, { item: item, index: index }) }), jsx("div", { className: "r-setting-cell", style: { width: 80, textAlign: 'center' }, children: jsx(VisibleTemplate, { item: item, index: index }) }), jsx("div", { className: "r-setting-cell", style: { width: 100 }, children: jsx(FixColumnTemplate, { item: item, index: index }) }), jsx("div", { className: "r-setting-cell", style: { width: 110 }, children: jsx(WidthColumnTemplate, { item: item, index: index }) })] }));
39797
+ }) }) })] }), jsxs("div", { style: { boxShadow: '0 4px 24px 0 rgb(34 41 47 / 10%)' }, className: "d-flex justify-content-between align-items-center w-100 py-75 px-1", children: [jsx("div", { children: settingColumns?.updatedDate && (jsxs("p", { children: [jsxs("strong", { children: [t('Update date'), ": "] }), " ", jsx("span", { children: settingColumns.updatedDate ? formatDateTime(settingColumns.updatedDate, 'DD/MM/yyyy HH:mm') : '' }), jsxs("strong", { className: "ms-2", children: [t('Editor'), ": "] }), " ", jsx("span", { children: settingColumns.updatedByName })] })) }), jsxs("div", { children: [resetDefaultColumns && (jsx(Button$1$1, { color: "primary", onClick: () => messageBoxConfirm(t, handleResetColumns, {}, 'Do you want to reset the default settings?'), className: "me-1", children: t('Reset') })), jsx(Button$1$1, { color: "primary", onClick: handleSubmit, className: "me-1", children: t('Confirm') }), jsx(Button$1$1, { color: "secondary", onClick: handleCancel, outline: true, children: t('Close') })] })] })] }));
39799
39798
  });
39800
39799
 
39801
39800
  const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleInsertAfter, handleDeleteAll, setOpenPopupSetupColumn, focusRow, editDisable, addDisable, buttonSetting, toolbarSetting }) => {
@@ -40216,6 +40215,18 @@ const TableEdit = forwardRef((props, ref) => {
40216
40215
  const toggleSidebar = useCallback(() => {
40217
40216
  setOpenPopupSetupColumn((prev) => !prev);
40218
40217
  }, []);
40218
+ const handleSetColumn = useCallback((newColumns) => {
40219
+ if (saveSettingColumn) {
40220
+ saveSettingColumn(newColumns.map((x, index) => ({
40221
+ field: x.field,
40222
+ headerText: x.headerDisplay,
40223
+ visible: x.visible,
40224
+ fixedType: x.fixedType,
40225
+ width: x.width,
40226
+ sortOrder: index + 1
40227
+ })));
40228
+ }
40229
+ }, [saveSettingColumn]);
40219
40230
  return (jsx(Fragment, { children: jsxs("div", { className: "r-table-edit", children: [jsxs("div", { className: "r-grid", ref: gridRef, children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsx(TableComponent, { idTable: idTable, height: height, dataSource: dataSource, contentColumns: contentColumns, headerColumns: headerColumns, selectedRows: selectedRows, setSelectedRows: setSelectedRows, selectedCell: selectedCell, startCell: startCell, editCell: editCell, gridRef: gridRef, objHeaderWidthFixLeft: objHeaderWidthFixLeft, objHeaderWidthFixRight: objHeaderWidthFixRight, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, fisrtObjWidthFixRight: fisrtObjWidthFixRight, totalCount: totalCount, isMulti: isMulti, selectEnable: selectEnable, editDisable: editDisable, addDisable: addDisable, defaultValue: defaultValue, fieldKey: fieldKey, fieldUniKey: fieldUniKey, formatSetting: formatSetting, toolbarSetting: toolbarSetting, buttonSetting: buttonSetting, containerRef: containerRef, optionsFilter: optionsFilter, allowFiltering: allowFiltering, allowSorting: allowSorting, searchSetting: searchSetting, searchTerm: searchTerm, haveSum: haveSum, isCopying: isCopying, typeDragging: typeDragging, visibleContentColumns: visibleContentColumns, rowHeight: rowHeight, changeDataSource: changeDataSource, handleCommandClick: handleCommandClick, handleKeyDown: handleKeyDown, handeCopyCell: handeCopyCell, onDuplicate: onDuplicate, setSelectedCell: setSelectedCell, setStartCell: setStartCell, focusEditElementCell: focusEditElementCell, rowChange: rowChange, filterBy: filterBy, setFilterBy: setFilterBy, orderBy: orderBy, setOrderBy: setOrderBy, searchClient: searchClient, handleDataChange: handleDataChange, handleDuplicate: () => {
40220
40231
  handleDuplicate(dataSource, startCell.row, fieldKey, defaultValue, fieldUniKey, changeDataSource, containerRef, totalCount, toolbarSetting, buttonSetting, editDisable, addDisable, onDuplicate);
40221
40232
  }, setContentColumns: (newColumns) => {
@@ -40239,11 +40250,7 @@ const TableEdit = forwardRef((props, ref) => {
40239
40250
  handleInsertBefore(dataSource, startCell.row, defaultValue, changeDataSource, toolbarSetting, buttonSetting, editDisable, addDisable);
40240
40251
  }, handleDeleteAll: () => {
40241
40252
  handleDeleteAll(t, messageBoxConfirmDelete, handleFocusCell, changeDataSource, editDisable, addDisable, toolbarSetting, buttonSetting);
40242
- }, setOpenPopupSetupColumn: setOpenPopupSetupColumn, focusRow: startCell.row, editDisable: editDisable, addDisable: addDisable, buttonSetting: buttonSetting, toolbarSetting: toolbarSetting, headerColumns: headerColumns }))] }), 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: toggleSidebar, settingColumns: settingColumns, openSidebar: openPopupSetupColumn, column: contentColumns, resetDefaultColumns: resetDefaultColumns, setColumn: (newColumns) => {
40243
- if (saveSettingColumn) {
40244
- saveSettingColumn(newColumns.map((x, index) => ({ field: x.field, headerText: x.headerDisplay, visible: x.visible, fixedType: x.fixedType, width: x.width, sortOrder: index + 1 })));
40245
- }
40246
- } })] }) }));
40253
+ }, setOpenPopupSetupColumn: setOpenPopupSetupColumn, focusRow: startCell.row, editDisable: editDisable, addDisable: addDisable, buttonSetting: buttonSetting, toolbarSetting: toolbarSetting, headerColumns: headerColumns }))] }), 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: toggleSidebar, settingColumns: settingColumns, openSidebar: openPopupSetupColumn, column: contentColumns, resetDefaultColumns: resetDefaultColumns, setColumn: handleSetColumn })] }) }));
40247
40254
  });
40248
40255
 
40249
40256
  const OptionFont = [