react-table-edit 1.4.9 → 1.4.10
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-inline/index.d.ts +36 -0
- package/dist/component/edit-form-inline/select-table/index.d.ts +32 -0
- package/dist/component/type/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +143 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +143 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ClipboardEvent, Dispatch, JSX, SetStateAction } from "react";
|
|
2
|
+
import { UseFormGetValues, UseFormSetValue } from "react-hook-form";
|
|
3
|
+
import { InferType } from "yup";
|
|
4
|
+
export type FromItemsField = {
|
|
5
|
+
name: string;
|
|
6
|
+
label: string;
|
|
7
|
+
type: 'text' | 'numeric' | 'select' | 'selectCreatable';
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
fraction?: number;
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
options?: any[];
|
|
13
|
+
};
|
|
14
|
+
type Props = {
|
|
15
|
+
id?: string;
|
|
16
|
+
field?: string;
|
|
17
|
+
displayValue: string;
|
|
18
|
+
textAlign?: 'left' | 'right' | 'center';
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
invalid?: any;
|
|
21
|
+
rowData: any;
|
|
22
|
+
indexRow: any;
|
|
23
|
+
onKeyDown?: any;
|
|
24
|
+
defaultValues?: any;
|
|
25
|
+
schema?: InferType<any>;
|
|
26
|
+
onFormOpen?: (rowData: any, itemsField: FromItemsField[], setItemsField: Dispatch<SetStateAction<FromItemsField[]>>) => void;
|
|
27
|
+
footerTemplate?: (rowData: any) => JSX.Element;
|
|
28
|
+
template?: (row: any, indexRow: number) => any;
|
|
29
|
+
onChangeField?: (rowData: any, field: string, setValue: UseFormSetValue<any>, getValues: UseFormGetValues<any>) => void;
|
|
30
|
+
onChange: (rowData: any) => void;
|
|
31
|
+
onPaste?: (e: ClipboardEvent<HTMLInputElement>) => void;
|
|
32
|
+
isClearable?: boolean;
|
|
33
|
+
labelSize?: 'label-small' | 'label-medium' | 'label-large';
|
|
34
|
+
};
|
|
35
|
+
declare const EditFormInline: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<unknown>>;
|
|
36
|
+
export default EditFormInline;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { IFColumnSelectTable } from "../../select-table";
|
|
2
|
+
interface ISelectTableBox {
|
|
3
|
+
id?: string;
|
|
4
|
+
name: string;
|
|
5
|
+
control: any;
|
|
6
|
+
defaultValue?: any;
|
|
7
|
+
isMulti?: boolean;
|
|
8
|
+
isLabel?: boolean;
|
|
9
|
+
inLine?: boolean;
|
|
10
|
+
labelComponent?: any;
|
|
11
|
+
options: any[];
|
|
12
|
+
loadOptions?: any;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
label?: any;
|
|
16
|
+
labelSize?: any;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
errors?: any;
|
|
19
|
+
cssClass?: string;
|
|
20
|
+
callback?: any;
|
|
21
|
+
confirmHandle?: any;
|
|
22
|
+
columns?: IFColumnSelectTable[];
|
|
23
|
+
handleAddNew?: any;
|
|
24
|
+
fieldLabel?: string;
|
|
25
|
+
fieldValue?: string;
|
|
26
|
+
isClearable?: boolean;
|
|
27
|
+
noHeader?: boolean;
|
|
28
|
+
desciptionLabel?: string;
|
|
29
|
+
classLabel?: string;
|
|
30
|
+
}
|
|
31
|
+
declare const SelectTableBox: (props: ISelectTableBox) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export default SelectTableBox;
|
|
@@ -3,7 +3,7 @@ import { IFColumnSelectTable } from "../select-table";
|
|
|
3
3
|
import { FromItemsField } from "../edit-form";
|
|
4
4
|
import { UseFormGetValues, UseFormReset, UseFormSetValue } from "react-hook-form";
|
|
5
5
|
type ITextAlign = 'center' | 'left' | 'right';
|
|
6
|
-
type IEditType = 'text' | 'numeric' | 'datetime' | 'selectTree' | 'date' | 'select' | 'checkbox' | 'form' | 'color';
|
|
6
|
+
type IEditType = 'text' | 'numeric' | 'datetime' | 'selectTree' | 'date' | 'select' | 'checkbox' | 'form' | 'formInline' | 'color';
|
|
7
7
|
export type ICommandItem = {
|
|
8
8
|
id: string;
|
|
9
9
|
color?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ type FromItemsField = {
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
type ITextAlign = 'center' | 'left' | 'right';
|
|
74
|
-
type IEditType = 'text' | 'numeric' | 'datetime' | 'selectTree' | 'date' | 'select' | 'checkbox' | 'form' | 'color';
|
|
74
|
+
type IEditType = 'text' | 'numeric' | 'datetime' | 'selectTree' | 'date' | 'select' | 'checkbox' | 'form' | 'formInline' | 'color';
|
|
75
75
|
type ICommandItem = {
|
|
76
76
|
id: string;
|
|
77
77
|
color?: string;
|
package/dist/index.js
CHANGED
|
@@ -23016,7 +23016,7 @@ const SelectTable = React$5.forwardRef((props, ref) => {
|
|
|
23016
23016
|
}, children: jsxRuntime.jsxs("div", { className: 'r-select-grid', children: [jsxRuntime.jsx("div", { className: classnames('r-select-gridtable', { 'no-header': noHeader || (columns?.length ?? 0) === 0 }), ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight$1 }, children: jsxRuntime.jsx(RenderTable, {}) }), jsxRuntime.jsxs("div", { className: classnames('r-select-footer', { 'd-none': !(showFooter === true || handleAdd) }), children: [jsxRuntime.jsxs(Button$1, { outline: true, color: "primary", onClick: () => handleAdd?.(), className: classnames('r-btn d-flex align-items-center', { 'd-none': !handleAdd }), children: [jsxRuntime.jsx(SvgPlus, { className: "me-50", fontSize: 16 }), t('AddNew'), " (F9)"] }), footerComponent ? footerComponent() : null] })] }) }) }) })] }) }) }));
|
|
23017
23017
|
});
|
|
23018
23018
|
|
|
23019
|
-
const SelectTableBox = (props) => {
|
|
23019
|
+
const SelectTableBox$1 = (props) => {
|
|
23020
23020
|
const { isMulti, isLabel, confirmHandle, id, fieldValue, fieldLabel, labelComponent, options, loadOptions, control, placeholder, disabled, name, label, labelSize, required, errors, inLine, callback, desciptionLabel, classLabel, isClearable, defaultValue, handleAddNew, columns, ...rest } = props;
|
|
23021
23021
|
const handChange = ({ onChange, val }) => {
|
|
23022
23022
|
onChange((!isNullOrUndefined$1(val) && isMulti) ? val.map((item) => item.value) : ((!isNullOrUndefined$1(val) && !isMulti) ? (fieldValue ? val[fieldValue] : val?.value) : undefined));
|
|
@@ -23217,7 +23217,7 @@ const EditForm = React$5.forwardRef((props, ref) => {
|
|
|
23217
23217
|
return (jsxRuntime.jsx(Col$1, { xl: 12, onKeyDown: e => formItemKeyDown(e, index), children: jsxRuntime.jsx(TextInput, { id: `form-element-${field}-${index}`, control: control, name: item.name, label: item.label ? item.label : '', labelSize: `text-left ${labelSize}`, errors: errors[item.name], disabled: item.disabled, callback: () => { elementChange(item.name); } }, index) }, index));
|
|
23218
23218
|
}
|
|
23219
23219
|
else if (item.type === 'select') {
|
|
23220
|
-
return (jsxRuntime.jsx(Col$1, { xl: 12, onKeyDown: e => formItemKeyDown(e, index), children: jsxRuntime.jsx(SelectTableBox, { id: `form-element-${field}-${index}`, options: item.options ?? [], control: control, name: item.name, label: item.label ? item.label : '', labelSize: `text-left ${labelSize}`, errors: errors[item.name], disabled: item.disabled, callback: () => { elementChange(item.name); } }, index) }, index));
|
|
23220
|
+
return (jsxRuntime.jsx(Col$1, { xl: 12, onKeyDown: e => formItemKeyDown(e, index), children: jsxRuntime.jsx(SelectTableBox$1, { id: `form-element-${field}-${index}`, options: item.options ?? [], control: control, name: item.name, label: item.label ? item.label : '', labelSize: `text-left ${labelSize}`, errors: errors[item.name], disabled: item.disabled, callback: () => { elementChange(item.name); } }, index) }, index));
|
|
23221
23221
|
}
|
|
23222
23222
|
}) }));
|
|
23223
23223
|
};
|
|
@@ -42347,6 +42347,131 @@ const handleCtrlD = (e, params) => {
|
|
|
42347
42347
|
}
|
|
42348
42348
|
};
|
|
42349
42349
|
|
|
42350
|
+
const SelectTableBox = (props) => {
|
|
42351
|
+
const { isMulti, isLabel, confirmHandle, id, fieldValue, fieldLabel, labelComponent, options, loadOptions, control, placeholder, disabled, name, label, labelSize, required, errors, inLine, callback, desciptionLabel, classLabel, isClearable, defaultValue, handleAddNew, columns, ...rest } = props;
|
|
42352
|
+
const handChange = ({ onChange, val }) => {
|
|
42353
|
+
onChange((!isNullOrUndefined$1(val) && isMulti) ? val.map((item) => item.value) : ((!isNullOrUndefined$1(val) && !isMulti) ? (fieldValue ? val[fieldValue] : val?.value) : undefined));
|
|
42354
|
+
if (callback) {
|
|
42355
|
+
callback(val);
|
|
42356
|
+
}
|
|
42357
|
+
};
|
|
42358
|
+
const renderLabel = (props) => {
|
|
42359
|
+
const { t } = reactI18next.useTranslation();
|
|
42360
|
+
const { isLabel, desciptionLabel, id, classLabel, name, label, required } = props;
|
|
42361
|
+
return (jsxRuntime.jsxs(React$5.Fragment, { children: [isLabel === false ? '' : jsxRuntime.jsxs(Label$1, { id: `label-${id}`, className: classLabel, for: name, children: [t(label ? label : ''), " ", required ? jsxRuntime.jsx("span", { className: "text-danger", children: "*" }) : ''] }), (!isNullOrUndefined$1(desciptionLabel) && desciptionLabel !== '') ?? jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(UncontrolledTooltip, { target: `label-${id}`, children: t(desciptionLabel ?? '') }) })] }));
|
|
42362
|
+
};
|
|
42363
|
+
return (jsxRuntime.jsx(React$5.Fragment, { children: jsxRuntime.jsxs("div", { className: classnames(inLine === false ? 'form-group ' : 'form-row-inline d-flex', 'align', {
|
|
42364
|
+
[labelSize ? labelSize : '']: labelSize,
|
|
42365
|
+
'form-row-inline-error': errors
|
|
42366
|
+
}), children: [renderLabel({ isLabel, desciptionLabel, classLabel, name, label, required, id: id ?? '' }), jsxRuntime.jsxs("div", { className: classnames('form-input-content', { 'hidden-label': isLabel === false }), children: [jsxRuntime.jsx(Controller, { name: name, control: control, render: ({ field: { value, onChange } }) => {
|
|
42367
|
+
return (jsxRuntime.jsx(SelectTable, { ...rest, id: id, value: (isMulti ? value?.length > 0 : value) ? (!isMulti ? (options.find((val) => val[fieldValue ?? 'value'] === value) ?? (defaultValue ?? '')) : value) : (isMulti ? [] : undefined),
|
|
42368
|
+
// Giá trị của SelectTable, nếu isMulti là true và value có độ dài lớn hơn 0, hoặc nếu isMulti là false và value có giá trị,
|
|
42369
|
+
// thì tìm giá trị tương ứng trong options hoặc sử dụng defaultValue. Nếu không, sử dụng giá trị mặc định tùy thuộc vào isMulti.
|
|
42370
|
+
onChange: (val) => {
|
|
42371
|
+
if (isMulti || (fieldValue && val ? val[fieldValue] : val?.value) !== value) { // Kiểm tra nếu giá trị mới khác với giá trị hiện tại
|
|
42372
|
+
if (confirmHandle) { // Nếu có hàm confirmHandle
|
|
42373
|
+
confirmHandle(handChange, onChange, val); // Gọi hàm confirmHandle với các tham số tương ứng
|
|
42374
|
+
}
|
|
42375
|
+
else {
|
|
42376
|
+
if (isMulti) {
|
|
42377
|
+
onChange(!isNullOrUndefined$1(val) ? val.map((item) => item[fieldValue ?? 'value']) : []);
|
|
42378
|
+
}
|
|
42379
|
+
else {
|
|
42380
|
+
onChange(!isNullOrUndefined$1(val) ? val[fieldValue ?? 'value'] : undefined);
|
|
42381
|
+
}
|
|
42382
|
+
// Nếu giá trị mới không null hoặc undefined và isMulti là true, thì lấy mảng các giá trị.
|
|
42383
|
+
// Nếu isMulti là false, lấy giá trị mới hoặc giá trị của fieldValue.
|
|
42384
|
+
if (callback) { // Nếu có hàm callback
|
|
42385
|
+
callback(val); // Gọi hàm callback với giá trị mới
|
|
42386
|
+
}
|
|
42387
|
+
}
|
|
42388
|
+
}
|
|
42389
|
+
}, handleAdd: handleAddNew, isClearable: isClearable, isMulti: isMulti, placeholder: placeholder, invalid: errors, loadOptions: loadOptions, options: options, isDisabled: disabled, columns: columns, fieldValue: fieldValue, fieldLabel: fieldLabel, formatOptionLabel: labelComponent ? labelComponent : undefined }));
|
|
42390
|
+
} }), errors && jsxRuntime.jsx(FormFeedback$1, { children: errors?.message })] })] }) }));
|
|
42391
|
+
};
|
|
42392
|
+
|
|
42393
|
+
const EditFormInline = React$5.forwardRef((props, ref) => {
|
|
42394
|
+
const { id, field, rowData, onChange, onChangeField, onKeyDown, defaultValues, schema, indexRow, template, displayValue, onFormOpen, labelSize = 'label-small' } = props;
|
|
42395
|
+
React$5.useRef(null);
|
|
42396
|
+
React$5.useRef(null);
|
|
42397
|
+
const [itemsField, setItemsField] = React$5.useState([]);
|
|
42398
|
+
const [onFocus, setOnFocus] = React$5.useState(false);
|
|
42399
|
+
reactI18next.useTranslation();
|
|
42400
|
+
const { control, handleSubmit, getValues, reset, setValue, formState: { errors } } = useForm({
|
|
42401
|
+
mode: 'onChange',
|
|
42402
|
+
defaultValues,
|
|
42403
|
+
resolver: o(schema)
|
|
42404
|
+
});
|
|
42405
|
+
const focusElement = (id, focus) => {
|
|
42406
|
+
const element = document.getElementById(id);
|
|
42407
|
+
if (element) {
|
|
42408
|
+
if (element.className.includes('react-select')) {
|
|
42409
|
+
element.getElementsByTagName('input')[0]?.focus();
|
|
42410
|
+
}
|
|
42411
|
+
else {
|
|
42412
|
+
element.focus();
|
|
42413
|
+
if (focus) {
|
|
42414
|
+
element.setSelectionRange(0, element.innerText.length - 1);
|
|
42415
|
+
}
|
|
42416
|
+
}
|
|
42417
|
+
}
|
|
42418
|
+
};
|
|
42419
|
+
const handleOnKeyDown = (e) => {
|
|
42420
|
+
};
|
|
42421
|
+
const formKeyDown = (e, handSubmit) => {
|
|
42422
|
+
if (e.code === 'Enter') {
|
|
42423
|
+
handSubmit();
|
|
42424
|
+
e.preventDefault();
|
|
42425
|
+
e.stopPropagation();
|
|
42426
|
+
}
|
|
42427
|
+
};
|
|
42428
|
+
const formItemKeyDown = (e, index) => {
|
|
42429
|
+
if (e.code === 'ArrowRight' && index < itemsField.length - 1) {
|
|
42430
|
+
focusElement(`form-element-${field}-${index + 1}`);
|
|
42431
|
+
e.preventDefault();
|
|
42432
|
+
e.stopPropagation();
|
|
42433
|
+
}
|
|
42434
|
+
else if (e.code === 'ArrowLeft' && index > 0) {
|
|
42435
|
+
focusElement(`form-element-${field}-${index - 1}`);
|
|
42436
|
+
e.preventDefault();
|
|
42437
|
+
e.stopPropagation();
|
|
42438
|
+
}
|
|
42439
|
+
};
|
|
42440
|
+
const elementChange = (field) => {
|
|
42441
|
+
if (onChangeField) {
|
|
42442
|
+
onChangeField(rowData, field, setValue, getValues);
|
|
42443
|
+
const rs = getValues();
|
|
42444
|
+
if (rs) {
|
|
42445
|
+
onChange(rs);
|
|
42446
|
+
}
|
|
42447
|
+
}
|
|
42448
|
+
};
|
|
42449
|
+
React$5.useEffect(() => {
|
|
42450
|
+
if (onFocus && itemsField.length > 0) {
|
|
42451
|
+
itemsField.forEach((ele) => {
|
|
42452
|
+
setValue(ele.name, (rowData[ele.name] ?? ""));
|
|
42453
|
+
});
|
|
42454
|
+
focusElement(`form-element-${field}-${0}`);
|
|
42455
|
+
}
|
|
42456
|
+
}, [onFocus, itemsField]);
|
|
42457
|
+
return (jsxRuntime.jsxs("div", { className: "form-edit-inline", ref: ref, id: id, children: [!onFocus && jsxRuntime.jsx("div", { className: "form__display", onClick: () => {
|
|
42458
|
+
if (onFormOpen && itemsField.length === 0) {
|
|
42459
|
+
onFormOpen(rowData, itemsField, setItemsField);
|
|
42460
|
+
}
|
|
42461
|
+
setOnFocus(true);
|
|
42462
|
+
}, onKeyDown: e => formKeyDown(e, handleSubmit), children: template ? template(rowData, indexRow) : displayValue }), jsxRuntime.jsx("div", { className: `form__edit ${onFocus ? 'active' : ''}`, onKeyDown: e => handleOnKeyDown(), children: itemsField.map((item, index) => {
|
|
42463
|
+
if (item.type === 'numeric') {
|
|
42464
|
+
return (jsxRuntime.jsx("div", { className: "form__element", onKeyDown: e => formItemKeyDown(e, index), children: jsxRuntime.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));
|
|
42465
|
+
}
|
|
42466
|
+
else if (item.type === 'text') {
|
|
42467
|
+
return (jsxRuntime.jsx("div", { className: "form__element", onKeyDown: e => formItemKeyDown(e, index), children: jsxRuntime.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));
|
|
42468
|
+
}
|
|
42469
|
+
else if (item.type === 'select') {
|
|
42470
|
+
return (jsxRuntime.jsx("div", { className: "form__element", onKeyDown: e => formItemKeyDown(e, index), children: jsxRuntime.jsx(SelectTableBox, { id: `form-element-${field}-${index}`, options: item.options ?? [], 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));
|
|
42471
|
+
}
|
|
42472
|
+
}) })] }));
|
|
42473
|
+
});
|
|
42474
|
+
|
|
42350
42475
|
const TableEdit = React$5.forwardRef((props, ref) => {
|
|
42351
42476
|
const { t } = reactI18next.useTranslation();
|
|
42352
42477
|
const { idTable, dataSource, columns, commandClick, dataSourceChange, rowChange, pagingSetting, setDataSource, height, maxHeight, minHeight, defaultValue, toolbarSetting, searchSetting, setSelectedItem, selectedItem, selectEnable, editDisable, addDisable, buttonSetting, formatSetting, handleSelect, haveSum, isMulti, disableAutoKey, onDuplicate } = props;
|
|
@@ -42731,6 +42856,18 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
42731
42856
|
e.preventDefault();
|
|
42732
42857
|
}
|
|
42733
42858
|
} }));
|
|
42859
|
+
case 'formInline':
|
|
42860
|
+
return (jsxRuntime.jsx(EditFormInline, { 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) => {
|
|
42861
|
+
Object.assign(row, val);
|
|
42862
|
+
handleDataChange(row, col, indexRow);
|
|
42863
|
+
}, invalid: col.validate && col.validate(row[col.field], row), textAlign: col.textAlign, template: col.template, onKeyDown: (e) => {
|
|
42864
|
+
return checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
42865
|
+
}, onPaste: (e) => {
|
|
42866
|
+
if (toolbarSetting?.showBottomToolbar && !editDisable && !addDisable && !col.disablePaste) {
|
|
42867
|
+
pasteDataFromExcel(indexRow, indexCol, e);
|
|
42868
|
+
e.preventDefault();
|
|
42869
|
+
}
|
|
42870
|
+
} }));
|
|
42734
42871
|
default:
|
|
42735
42872
|
return (jsxRuntime.jsx(Input$1, { id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`, style: { textAlign: col.textAlign, height: 29 }, value: isNullOrUndefined$1(row[col.field]) ? '' : row[col.field], className: classnames('border-0 rounded-0 input-element', { 'is-invalid': col.validate && col.validate(row[col.field], row) }), onChange: (val) => {
|
|
42736
42873
|
if (row[col.field] != val.target?.value) {
|
|
@@ -43146,9 +43283,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43146
43283
|
const errorMessage = typeDis === 1 || col.field === '' || !col.validate ? '' : col.validate(row[col.field], row);
|
|
43147
43284
|
return (jsxRuntime.jsx(React$5.Fragment, { children: col.visible !== false && jsxRuntime.jsx("td", { className: classnames(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43148
43285
|
left: col.fixedType === 'left' ? objWidthFix[indexCol] : undefined,
|
|
43149
|
-
right: col.fixedType === 'right' ? objWidthFix[indexCol] : undefined
|
|
43150
|
-
padding: 0,
|
|
43151
|
-
textAlign: col.textAlign ? col.textAlign : 'left'
|
|
43286
|
+
right: col.fixedType === 'right' ? objWidthFix[indexCol] : undefined
|
|
43152
43287
|
}, onClick: (e) => {
|
|
43153
43288
|
if (e.target.nodeName === 'DIV' || e.target.nodeName === 'TD') {
|
|
43154
43289
|
if (!editDisable && indexRow != indexFocus) {
|
|
@@ -43178,8 +43313,8 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43178
43313
|
e.stopPropagation();
|
|
43179
43314
|
}
|
|
43180
43315
|
}, 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: {
|
|
43181
|
-
|
|
43182
|
-
}, children: [typeDis === 1 && !refreshRow ? RenderEdit(row, col, indexCol, indexRow) : jsxRuntime.jsx("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children:
|
|
43316
|
+
textAlign: col.textAlign ? col.textAlign : 'left'
|
|
43317
|
+
}, children: [typeDis === 1 && !refreshRow ? RenderEdit(row, col, indexCol, indexRow) : jsxRuntime.jsx(jsxRuntime.Fragment, { children: typeDis === 2 ? (col.template && col.template(row, indexRow)) ?? '' : jsxRuntime.jsx("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: (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) && typeDis !== 2) && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: (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));
|
|
43183
43318
|
}
|
|
43184
43319
|
};
|
|
43185
43320
|
const renderFooterCol = (col, indexCol) => {
|
|
@@ -64970,7 +65105,7 @@ const TabSelectFileImportExcel = (props) => {
|
|
|
64970
65105
|
getSheetsExcel(e.target.files[0], setValue, setOptionSheetName);
|
|
64971
65106
|
}, hidden: true, accept: '.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel' })] })] }) : jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: 'fs-4 bolder', children: t('Drag and drop files here') }), jsxRuntime.jsx("div", { className: 'my-50', children: t('or') }), jsxRuntime.jsxs(Button$1, { tag: Label$1, outline: true, className: 'me-75', size: 'md', color: 'primary', children: [jsxRuntime.jsx(SvgArrowLeftCircle, { fontSize: 18, className: 'me-50' }), t('Select file'), jsxRuntime.jsx(Input$1, { type: 'file', onChange: (e) => {
|
|
64972
65107
|
getSheetsExcel(e.target.files[0], setValue, setOptionSheetName);
|
|
64973
|
-
}, hidden: true, accept: '.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel' })] }), jsxRuntime.jsx("div", { className: 'mt-1', children: t('Accepts .xls, .xlsx, .csv files') })] }) }), jsxRuntime.jsxs(Row$1, { className: `${getValues('file') ? '' : 'd-none'} m-0 gy-1`, children: [jsxRuntime.jsx(Col$1, { lg: 6, md: 12, xs: 12, children: jsxRuntime.jsx(SelectTableBox, { labelSize: "d-flex form-row-inline label-medium", control: control, name: "sheetId", label: t("Sheet name"), required: true, errors: errors.sheetId, placeholder: t("Select"), options: optionSheetName }) }), jsxRuntime.jsx(Col$1, { lg: 6, md: 12, xs: 12, children: jsxRuntime.jsx(NumberInput, { control: control, name: "headerRow", labelSize: "d-flex form-row-inline label-medium", label: t("Header row"), errors: errors.headerRow }) })] })] }));
|
|
65108
|
+
}, hidden: true, accept: '.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel' })] }), jsxRuntime.jsx("div", { className: 'mt-1', children: t('Accepts .xls, .xlsx, .csv files') })] }) }), jsxRuntime.jsxs(Row$1, { className: `${getValues('file') ? '' : 'd-none'} m-0 gy-1`, children: [jsxRuntime.jsx(Col$1, { lg: 6, md: 12, xs: 12, children: jsxRuntime.jsx(SelectTableBox$1, { labelSize: "d-flex form-row-inline label-medium", control: control, name: "sheetId", label: t("Sheet name"), required: true, errors: errors.sheetId, placeholder: t("Select"), options: optionSheetName }) }), jsxRuntime.jsx(Col$1, { lg: 6, md: 12, xs: 12, children: jsxRuntime.jsx(NumberInput, { control: control, name: "headerRow", labelSize: "d-flex form-row-inline label-medium", label: t("Header row"), errors: errors.headerRow }) })] })] }));
|
|
64974
65109
|
};
|
|
64975
65110
|
|
|
64976
65111
|
const TabMergeImportExcel = (props) => {
|