react-table-edit 1.3.5 → 1.3.7

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.
@@ -82,10 +82,10 @@ export type IColumnTable = {
82
82
  formSettings?: ISettingFormElement;
83
83
  columns?: IColumnTable[];
84
84
  disablePaste?: boolean;
85
- validate?: (value: any, row: any) => boolean;
85
+ validate?: (value: any, row: any) => string | undefined;
86
86
  disabledCondition?: (row: any) => boolean;
87
87
  callback?: (value: any, indexRow: number) => void;
88
- template?: (row: any, indexRow: number) => JSX.Element | string | number;
88
+ template?: (row: any, indexRow: number) => JSX.Element | string | number | undefined;
89
89
  editTypeCondition?: (row: any) => string;
90
90
  onPaste?: (dataRow: any, dataPaste: any) => void;
91
91
  onPasteValidate?: (dataPaste: string, dataRow: any, rowIndex: number) => Promise<any>;
@@ -151,7 +151,7 @@ export type IFTableEditProps = {
151
151
  setSelectedItem?: Dispatch<SetStateAction<any>>;
152
152
  commandClick?: (data: any) => void;
153
153
  handleSelect?: (data: any) => void;
154
- setDataSource?: (data: any[]) => void;
154
+ setDataSource?: any;
155
155
  dataSourceChange?: (data: any[]) => void;
156
156
  rowChange?: (row: any, indexRow: number, field: string) => void;
157
157
  onDuplicate?: (newData: any, index: number) => void;
package/dist/index.d.ts CHANGED
@@ -150,10 +150,10 @@ type IColumnTable = {
150
150
  formSettings?: ISettingFormElement;
151
151
  columns?: IColumnTable[];
152
152
  disablePaste?: boolean;
153
- validate?: (value: any, row: any) => boolean;
153
+ validate?: (value: any, row: any) => string | undefined;
154
154
  disabledCondition?: (row: any) => boolean;
155
155
  callback?: (value: any, indexRow: number) => void;
156
- template?: (row: any, indexRow: number) => JSX.Element | string | number;
156
+ template?: (row: any, indexRow: number) => JSX.Element | string | number | undefined;
157
157
  editTypeCondition?: (row: any) => string;
158
158
  onPaste?: (dataRow: any, dataPaste: any) => void;
159
159
  onPasteValidate?: (dataPaste: string, dataRow: any, rowIndex: number) => Promise<any>;
@@ -219,7 +219,7 @@ type IFTableEditProps = {
219
219
  setSelectedItem?: Dispatch<SetStateAction<any>>;
220
220
  commandClick?: (data: any) => void;
221
221
  handleSelect?: (data: any) => void;
222
- setDataSource?: (data: any[]) => void;
222
+ setDataSource?: any;
223
223
  dataSourceChange?: (data: any[]) => void;
224
224
  rowChange?: (row: any, indexRow: number, field: string) => void;
225
225
  onDuplicate?: (newData: any, index: number) => void;
package/dist/index.js CHANGED
@@ -19191,7 +19191,7 @@ const checkDecimalSeparator = (thousandSeparator, decimalSeparator) => {
19191
19191
  }
19192
19192
  };
19193
19193
  const isNullOrUndefined$1 = (d) => {
19194
- if (d === null || d === undefined) {
19194
+ if (d === null || d === undefined || d === '') {
19195
19195
  return true;
19196
19196
  }
19197
19197
  return false;
@@ -42365,7 +42365,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
42365
42365
  col.callback(val, indexRow);
42366
42366
  }
42367
42367
  handleDataChange(row, col, indexRow);
42368
- }, fieldValue: col.selectSettings?.fieldValue, fieldLabel: col.selectSettings?.fieldLabel, component: gridRef, columns: col.selectSettings?.columns, isClearable: col.selectSettings?.isClearable ?? false, formatSetting: formatSetting, placeholder: t('Select'), loadOptions: col.selectSettings?.loadOptions, handleAdd: col.selectSettings?.handAddNew ? (e) => col.selectSettings?.handAddNew(e, indexRow, row) : undefined, isMulti: col.selectSettings?.isMulti, noHeader: col.selectSettings?.noHeader, showFooter: col.selectSettings?.showFooter, formatOptionLabel: col.selectSettings?.formatOptionLabel, footerComponent: col.selectSettings?.footerComponent, 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', allowCreate: col.selectSettings?.allowCreate, onKeyDown: (e) => {
42368
+ }, fieldValue: col.selectSettings?.fieldValue, fieldLabel: col.selectSettings?.fieldLabel, component: gridRef, columns: col.selectSettings?.columns, isClearable: col.selectSettings?.isClearable ?? false, formatSetting: formatSetting, placeholder: t('Select'), loadOptions: col.selectSettings?.loadOptions, handleAdd: col.selectSettings?.handAddNew ? (e) => col.selectSettings?.handAddNew(e, indexRow, row) : undefined, isMulti: col.selectSettings?.isMulti, noHeader: col.selectSettings?.noHeader, showFooter: col.selectSettings?.showFooter, formatOptionLabel: col.selectSettings?.formatOptionLabel, footerComponent: col.selectSettings?.footerComponent, invalid: (col.validate && !isNullOrUndefined$1(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', allowCreate: col.selectSettings?.allowCreate, onKeyDown: (e) => {
42369
42369
  if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) ;
42370
42370
  }, onOpenMenu: () => {
42371
42371
  if (col.selectSettings?.onOpenMenu) {
@@ -43104,7 +43104,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43104
43104
  }
43105
43105
  }, children: jsxRuntime.jsx("div", { className: classnames('r-rowcell-div'), children: jsxRuntime.jsxs("div", { id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : '', className: classnames('r-rowcell-content', { 'r-is-invalid': errorMessage }), style: {
43106
43106
  margin: typeDis === 1 ? 2 : !errorMessage ? '7px 9px' : 2
43107
- }, children: [typeDis === 1 && !refreshRow ? RenderEdit(row, col, indexCol, indexRow) : jsxRuntime.jsx("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? (col.template && col.template(row, indexRow)) : (col.editType === 'numeric' && Number(row[col.field]) < 0 ? jsxRuntime.jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) }), jsxRuntime.jsx("span", { id: `error-${indexRow}-${indexCol}`, className: classnames('cursor-pointer text-primary icon-table', { 'd-none': !errorMessage }), children: jsxRuntime.jsx(SvgAlertCircle, { fontSize: 15.5 }) }), (!(typeDis === 1 && !refreshRow)) && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? (col.template && col.template(row, indexRow)) : (col.editType === 'numeric' && Number(row[col.field]) < 0 ? jsxRuntime.jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) }), jsxRuntime.jsx(UncontrolledTooltip, { target: `error-${indexRow}-${indexCol}`, className: "r-tooltip tooltip-error", children: errorMessage?.toString() ?? '' })] }) }) }, `col-${indexRow}-${indexCol}`) }, indexCol));
43107
+ }, children: [typeDis === 1 && !refreshRow ? RenderEdit(row, col, indexCol, indexRow) : jsxRuntime.jsx("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? (col.template && col.template(row, indexRow)) ?? '' : (col.editType === 'numeric' && Number(row[col.field]) < 0 ? jsxRuntime.jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) }), jsxRuntime.jsx("span", { id: `error-${indexRow}-${indexCol}`, className: classnames('cursor-pointer text-primary icon-table', { 'd-none': !errorMessage }), children: jsxRuntime.jsx(SvgAlertCircle, { fontSize: 15.5 }) }), (!(typeDis === 1 && !refreshRow)) && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? (col.template && col.template(row, indexRow)) ?? '' : (col.editType === 'numeric' && Number(row[col.field]) < 0 ? jsxRuntime.jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) }), jsxRuntime.jsx(UncontrolledTooltip, { target: `error-${indexRow}-${indexCol}`, className: "r-tooltip tooltip-error", children: errorMessage?.toString() ?? '' })] }) }) }, `col-${indexRow}-${indexCol}`) }, indexCol));
43108
43108
  }
43109
43109
  };
43110
43110
  const renderFooterCol = (col, indexCol) => {