es-grid-template 1.8.64 → 1.8.66
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/es/grid-component/TempTable.d.ts +2 -2
- package/es/grid-component/TempTable.js +5 -5
- package/es/grid-component/hooks/index.js +0 -1
- package/es/grid-component/hooks/useLazyKVMap.d.ts +1 -1
- package/es/grid-component/hooks/useLazyKVMap.js +0 -4
- package/es/grid-component/hooks/utils.d.ts +1 -8
- package/es/grid-component/hooks/utils.js +176 -144
- package/es/grid-component/index.d.ts +1 -1
- package/es/grid-component/index.js +0 -4
- package/es/grid-component/styles.scss +1394 -1394
- package/es/grid-component/type.d.ts +0 -407
- package/es/grid-component/type.js +490 -1
- package/es/table-component/type.d.ts +10 -0
- package/es/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.js +4 -3
- package/es/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/es/table-virtuoso/InternalTable.js +391 -0
- package/es/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/es/table-virtuoso/body/TableBodyCell.js +457 -0
- package/es/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/es/table-virtuoso/body/TableBodyRow.js +112 -0
- package/es/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
- package/es/table-virtuoso/footer/TableFooterCell.js +54 -0
- package/es/table-virtuoso/header/TableHeadCell.d.ts +14 -0
- package/es/table-virtuoso/header/TableHeadCell.js +265 -0
- package/es/table-virtuoso/header/renderFilter.d.ts +20 -0
- package/es/table-virtuoso/header/renderFilter.js +289 -0
- package/es/table-virtuoso/hook/constant.d.ts +73 -0
- package/es/table-virtuoso/hook/constant.js +240 -0
- package/es/table-virtuoso/hook/convert.d.ts +1 -0
- package/es/table-virtuoso/hook/convert.js +28 -0
- package/es/table-virtuoso/hook/useColumns.d.ts +28 -0
- package/es/table-virtuoso/hook/useColumns.js +302 -0
- package/es/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
- package/es/table-virtuoso/hook/useFilterOperator.js +33 -0
- package/es/table-virtuoso/hook/utils.d.ts +159 -0
- package/es/table-virtuoso/hook/utils.js +2263 -0
- package/es/table-virtuoso/index.d.ts +2 -0
- package/es/table-virtuoso/index.js +2 -0
- package/es/table-virtuoso/style.d.ts +22 -0
- package/es/table-virtuoso/style.js +12 -0
- package/es/table-virtuoso/style.scss +1441 -0
- package/es/table-virtuoso/table/Grid.d.ts +37 -0
- package/es/table-virtuoso/table/Grid.js +298 -0
- package/es/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/es/table-virtuoso/table/TableContainer.js +292 -0
- package/es/table-virtuoso/table/TableWrapper.d.ts +22 -0
- package/es/table-virtuoso/table/TableWrapper.js +161 -0
- package/es/table-virtuoso/type.d.ts +0 -0
- package/es/table-virtuoso/type.js +785 -0
- package/es/table-virtuoso/useContext.d.ts +97 -0
- package/es/table-virtuoso/useContext.js +21 -0
- package/lib/grid-component/TempTable.d.ts +2 -2
- package/lib/grid-component/TempTable.js +5 -7
- package/lib/grid-component/hooks/useLazyKVMap.d.ts +1 -1
- package/lib/grid-component/hooks/useLazyKVMap.js +0 -3
- package/lib/grid-component/hooks/utils.d.ts +1 -8
- package/lib/grid-component/hooks/utils.js +179 -152
- package/lib/grid-component/index.d.ts +1 -1
- package/lib/grid-component/index.js +0 -3
- package/lib/grid-component/styles.scss +1394 -1394
- package/lib/grid-component/type.d.ts +0 -407
- package/lib/grid-component/type.js +490 -4
- package/lib/table-component/type.d.ts +10 -0
- package/lib/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.js +4 -3
- package/lib/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/lib/table-virtuoso/InternalTable.js +400 -0
- package/lib/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBodyCell.js +464 -0
- package/lib/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/lib/table-virtuoso/body/TableBodyRow.js +119 -0
- package/lib/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
- package/lib/table-virtuoso/footer/TableFooterCell.js +63 -0
- package/lib/table-virtuoso/header/TableHeadCell.d.ts +14 -0
- package/lib/table-virtuoso/header/TableHeadCell.js +274 -0
- package/lib/table-virtuoso/header/renderFilter.d.ts +20 -0
- package/lib/table-virtuoso/header/renderFilter.js +299 -0
- package/lib/table-virtuoso/hook/constant.d.ts +73 -0
- package/lib/table-virtuoso/hook/constant.js +247 -0
- package/lib/table-virtuoso/hook/convert.d.ts +1 -0
- package/lib/table-virtuoso/hook/convert.js +34 -0
- package/lib/table-virtuoso/hook/useColumns.d.ts +28 -0
- package/lib/table-virtuoso/hook/useColumns.js +315 -0
- package/lib/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
- package/lib/table-virtuoso/hook/useFilterOperator.js +40 -0
- package/lib/table-virtuoso/hook/utils.d.ts +159 -0
- package/lib/table-virtuoso/hook/utils.js +2389 -0
- package/lib/table-virtuoso/index.d.ts +2 -0
- package/lib/table-virtuoso/index.js +9 -0
- package/lib/table-virtuoso/style.d.ts +22 -0
- package/lib/table-virtuoso/style.js +19 -0
- package/lib/table-virtuoso/style.scss +1441 -0
- package/lib/table-virtuoso/table/Grid.d.ts +37 -0
- package/lib/table-virtuoso/table/Grid.js +307 -0
- package/lib/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/lib/table-virtuoso/table/TableContainer.js +300 -0
- package/lib/table-virtuoso/table/TableWrapper.d.ts +22 -0
- package/lib/table-virtuoso/table/TableWrapper.js +166 -0
- package/lib/table-virtuoso/type.d.ts +0 -0
- package/lib/table-virtuoso/type.js +786 -0
- package/lib/table-virtuoso/useContext.d.ts +97 -0
- package/lib/table-virtuoso/useContext.js +27 -0
- package/package.json +2 -1
- package/es/grid-component/AdvanceFilter.d.ts +0 -14
- package/es/grid-component/AdvanceFilter.js +0 -454
- package/es/grid-component/CheckboxFilter.d.ts +0 -20
- package/es/grid-component/CheckboxFilter.js +0 -244
- package/es/grid-component/CheckboxFilter2.d.ts +0 -20
- package/es/grid-component/CheckboxFilter2.js +0 -244
- package/es/grid-component/ColumnsChoose.d.ts +0 -10
- package/es/grid-component/ColumnsChoose.js +0 -230
- package/es/grid-component/Command.d.ts +0 -8
- package/es/grid-component/Command.js +0 -80
- package/es/grid-component/ContextMenu.d.ts +0 -20
- package/es/grid-component/ContextMenu.js +0 -130
- package/es/grid-component/ConvertColumnTable.d.ts +0 -7
- package/es/grid-component/ConvertColumnTable.js +0 -144
- package/es/grid-component/EditForm/EditForm.d.ts +0 -27
- package/es/grid-component/EditForm/EditForm.js +0 -394
- package/es/grid-component/EditForm/index.d.ts +0 -1
- package/es/grid-component/EditForm/index.js +0 -1
- package/es/grid-component/EditableCell.d.ts +0 -20
- package/es/grid-component/EditableCell.js +0 -1030
- package/es/grid-component/FilterSearch.d.ts +0 -12
- package/es/grid-component/FilterSearch.js +0 -33
- package/es/grid-component/GridStyle.d.ts +0 -8
- package/es/grid-component/GridStyle.js +0 -5
- package/es/grid-component/InternalTable.js +0 -1170
- package/es/grid-component/TableGrid.d.ts +0 -21
- package/es/grid-component/TableGrid.js +0 -493
- package/es/grid-component/async-select/index.d.ts +0 -11
- package/es/grid-component/async-select/index.js +0 -38
- package/es/grid-component/async-table-select/index.d.ts +0 -11
- package/es/grid-component/async-table-select/index.js +0 -40
- package/es/grid-component/checkbox-control/index.d.ts +0 -13
- package/es/grid-component/checkbox-control/index.js +0 -40
- package/es/grid-component/hooks/columns/index.d.ts +0 -10
- package/es/grid-component/hooks/columns/index.js +0 -503
- package/es/grid-component/hooks/content/ControlCheckbox.d.ts +0 -13
- package/es/grid-component/hooks/content/ControlCheckbox.js +0 -87
- package/es/grid-component/hooks/content/HeaderContent.d.ts +0 -14
- package/es/grid-component/hooks/content/HeaderContent.js +0 -44
- package/es/grid-component/hooks/content/TooltipContent.d.ts +0 -13
- package/es/grid-component/hooks/content/TooltipContent.js +0 -74
- package/es/grid-component/hooks/useColumns.d.ts +0 -19
- package/es/grid-component/hooks/useColumns.js +0 -317
- package/es/grid-component/number/index.d.ts +0 -10
- package/es/grid-component/number/index.js +0 -39
- package/es/grid-component/number-range/index.d.ts +0 -11
- package/es/grid-component/number-range/index.js +0 -63
- package/es/grid-component/table/Grid.d.ts +0 -23
- package/es/grid-component/table/Grid.js +0 -49
- package/es/grid-component/table/GridEdit.d.ts +0 -23
- package/es/grid-component/table/GridEdit.js +0 -2726
- package/es/grid-component/table/Group.d.ts +0 -21
- package/es/grid-component/table/Group.js +0 -195
- package/es/grid-component/table/InfiniteTable.d.ts +0 -23
- package/es/grid-component/table/InfiniteTable.js +0 -101
- package/es/grid-component/useContext.d.ts +0 -34
- package/es/grid-component/useContext.js +0 -8
- package/lib/grid-component/AdvanceFilter.d.ts +0 -14
- package/lib/grid-component/AdvanceFilter.js +0 -463
- package/lib/grid-component/CheckboxFilter.d.ts +0 -20
- package/lib/grid-component/CheckboxFilter.js +0 -253
- package/lib/grid-component/CheckboxFilter2.d.ts +0 -20
- package/lib/grid-component/CheckboxFilter2.js +0 -253
- package/lib/grid-component/ColumnsChoose.d.ts +0 -10
- package/lib/grid-component/ColumnsChoose.js +0 -240
- package/lib/grid-component/Command.d.ts +0 -8
- package/lib/grid-component/Command.js +0 -88
- package/lib/grid-component/ContextMenu.d.ts +0 -20
- package/lib/grid-component/ContextMenu.js +0 -140
- package/lib/grid-component/ConvertColumnTable.d.ts +0 -7
- package/lib/grid-component/ConvertColumnTable.js +0 -153
- package/lib/grid-component/EditForm/EditForm.d.ts +0 -27
- package/lib/grid-component/EditForm/EditForm.js +0 -404
- package/lib/grid-component/EditForm/index.d.ts +0 -1
- package/lib/grid-component/EditForm/index.js +0 -16
- package/lib/grid-component/EditableCell.d.ts +0 -20
- package/lib/grid-component/EditableCell.js +0 -1032
- package/lib/grid-component/FilterSearch.d.ts +0 -12
- package/lib/grid-component/FilterSearch.js +0 -42
- package/lib/grid-component/GridStyle.d.ts +0 -8
- package/lib/grid-component/GridStyle.js +0 -12
- package/lib/grid-component/InternalTable.js +0 -1178
- package/lib/grid-component/TableGrid.d.ts +0 -21
- package/lib/grid-component/TableGrid.js +0 -493
- package/lib/grid-component/async-select/index.d.ts +0 -11
- package/lib/grid-component/async-select/index.js +0 -47
- package/lib/grid-component/async-table-select/index.d.ts +0 -11
- package/lib/grid-component/async-table-select/index.js +0 -49
- package/lib/grid-component/checkbox-control/index.d.ts +0 -13
- package/lib/grid-component/checkbox-control/index.js +0 -48
- package/lib/grid-component/hooks/columns/index.d.ts +0 -10
- package/lib/grid-component/hooks/columns/index.js +0 -518
- package/lib/grid-component/hooks/content/ControlCheckbox.d.ts +0 -13
- package/lib/grid-component/hooks/content/ControlCheckbox.js +0 -95
- package/lib/grid-component/hooks/content/HeaderContent.d.ts +0 -14
- package/lib/grid-component/hooks/content/HeaderContent.js +0 -53
- package/lib/grid-component/hooks/content/TooltipContent.d.ts +0 -13
- package/lib/grid-component/hooks/content/TooltipContent.js +0 -81
- package/lib/grid-component/hooks/useColumns.d.ts +0 -19
- package/lib/grid-component/hooks/useColumns.js +0 -328
- package/lib/grid-component/number/index.d.ts +0 -10
- package/lib/grid-component/number/index.js +0 -47
- package/lib/grid-component/number-range/index.d.ts +0 -11
- package/lib/grid-component/number-range/index.js +0 -71
- package/lib/grid-component/table/Grid.d.ts +0 -23
- package/lib/grid-component/table/Grid.js +0 -58
- package/lib/grid-component/table/GridEdit.d.ts +0 -23
- package/lib/grid-component/table/GridEdit.js +0 -2723
- package/lib/grid-component/table/Group.d.ts +0 -21
- package/lib/grid-component/table/Group.js +0 -204
- package/lib/grid-component/table/InfiniteTable.d.ts +0 -23
- package/lib/grid-component/table/InfiniteTable.js +0 -109
- package/lib/grid-component/useContext.d.ts +0 -34
- package/lib/grid-component/useContext.js +0 -13
- /package/es/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.d.ts +0 -0
- /package/es/{grid-component → table-virtuoso}/ColumnsGroup/index.d.ts +0 -0
- /package/es/{grid-component → table-virtuoso}/ColumnsGroup/index.js +0 -0
- /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.d.ts +0 -0
- /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/index.d.ts +0 -0
- /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/index.js +0 -0
|
@@ -1,1030 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React, { useContext } from "react";
|
|
3
|
-
import { Button, ColorPicker, DatePicker, Divider, Input, TimePicker, Row, Col } from "antd";
|
|
4
|
-
import { checkDecimalSeparator, checkThousandSeparator, checkFieldKey, convertArrayWithIndent, convertDateToDayjs,
|
|
5
|
-
// convertDayjsToDate,
|
|
6
|
-
convertLabelToTitle,
|
|
7
|
-
// customWeekStartEndFormat,
|
|
8
|
-
getDatepickerFormat, getTemplate, isDisable, isEmpty, isNullOrUndefined, customWeekStartEndFormat, convertDayjsToDate, parseBooleanToValue, isColor, genPresets, getFormat
|
|
9
|
-
// isEditable,
|
|
10
|
-
// convertDayjsToDate
|
|
11
|
-
} from "./hooks";
|
|
12
|
-
// import moment from "moment";
|
|
13
|
-
// import dayjs from "dayjs";
|
|
14
|
-
// import {TreeSelect} from "antd";
|
|
15
|
-
import classNames from "classnames";
|
|
16
|
-
import { NumericFormat } from "react-numeric-component";
|
|
17
|
-
import { TableContext } from "./useContext";
|
|
18
|
-
import dayjs from "dayjs";
|
|
19
|
-
import moment from "moment";
|
|
20
|
-
import { Controller } from "react-hook-form";
|
|
21
|
-
import { Checkbox, Select, TreeSelect } from "rc-master-ui";
|
|
22
|
-
import { AsyncSelect } from "./async-select";
|
|
23
|
-
import { AsyncTableSelect } from "./async-table-select";
|
|
24
|
-
import { cyan, green, red, blue } from '@ant-design/colors';
|
|
25
|
-
import { EditForm } from "./EditForm";
|
|
26
|
-
|
|
27
|
-
// import moment from "moment";
|
|
28
|
-
|
|
29
|
-
const {
|
|
30
|
-
SHOW_PARENT
|
|
31
|
-
} = TreeSelect;
|
|
32
|
-
const {
|
|
33
|
-
TextArea
|
|
34
|
-
} = Input;
|
|
35
|
-
const filterTreeNode = (input, treeNode) => {
|
|
36
|
-
const {
|
|
37
|
-
title,
|
|
38
|
-
value
|
|
39
|
-
} = treeNode;
|
|
40
|
-
if (typeof title === "string" || typeof title === 'number') {
|
|
41
|
-
return title.toString().toLowerCase().includes(input.toLowerCase()) || value.toLowerCase().includes(input.toLowerCase());
|
|
42
|
-
}
|
|
43
|
-
return value.toLowerCase().includes(input.toLowerCase());
|
|
44
|
-
};
|
|
45
|
-
const EditableCell = props => {
|
|
46
|
-
const {
|
|
47
|
-
t,
|
|
48
|
-
editing,
|
|
49
|
-
dataIndex,
|
|
50
|
-
// title,
|
|
51
|
-
editType,
|
|
52
|
-
record,
|
|
53
|
-
index,
|
|
54
|
-
children,
|
|
55
|
-
column,
|
|
56
|
-
indexRow,
|
|
57
|
-
indexCol,
|
|
58
|
-
cellEditing,
|
|
59
|
-
// errors,
|
|
60
|
-
...restProps
|
|
61
|
-
} = props;
|
|
62
|
-
const {
|
|
63
|
-
format,
|
|
64
|
-
control,
|
|
65
|
-
getValues,
|
|
66
|
-
handleCellChange,
|
|
67
|
-
getRowKey,
|
|
68
|
-
errors,
|
|
69
|
-
id
|
|
70
|
-
} = useContext(TableContext);
|
|
71
|
-
const datePickerRef = React.useRef(null);
|
|
72
|
-
const dateTimePickerRef = React.useRef(null);
|
|
73
|
-
// const timePickerRef = React.useRef(null);
|
|
74
|
-
|
|
75
|
-
const colFormat = typeof column?.format === 'function' ? column?.format(record) : column?.format;
|
|
76
|
-
const cellFormat = getFormat(colFormat, format);
|
|
77
|
-
const inputNode = (value, onChange) => {
|
|
78
|
-
const dateFormat = getDatepickerFormat(editType, cellFormat);
|
|
79
|
-
const date = !isEmpty(value) ? convertDateToDayjs(new Date(value), dateFormat) : null;
|
|
80
|
-
const maxDate = convertDateToDayjs(column.maxDate, dateFormat) ?? undefined;
|
|
81
|
-
const minDate = convertDateToDayjs(column.minDate, dateFormat) ?? undefined;
|
|
82
|
-
const {
|
|
83
|
-
fieldValue,
|
|
84
|
-
columns: selectColumns,
|
|
85
|
-
isMulti,
|
|
86
|
-
selectMode,
|
|
87
|
-
menuWidth,
|
|
88
|
-
fieldNames,
|
|
89
|
-
toolbarItems,
|
|
90
|
-
filterOption,
|
|
91
|
-
inputKey,
|
|
92
|
-
toolbarClick,
|
|
93
|
-
loadOptions,
|
|
94
|
-
validateOption,
|
|
95
|
-
options: propsOptions
|
|
96
|
-
} = column.editSelectSettings || {};
|
|
97
|
-
const isInvalid = column.field ? errors[column.field] : false;
|
|
98
|
-
|
|
99
|
-
// const message = errors && column.field && errors[column.field] ? errors[column.field].message : ''
|
|
100
|
-
const message = isInvalid?.message;
|
|
101
|
-
const keySelect = checkFieldKey(column?.editSelectSettings?.fieldKey);
|
|
102
|
-
const selectOptions = typeof propsOptions === 'function' ? propsOptions(record, column.dataIndex) : propsOptions;
|
|
103
|
-
const options = validateOption ? validateOption(record, column.dataIndex) : selectOptions ?? [];
|
|
104
|
-
const optionsTree = validateOption ? convertArrayWithIndent(validateOption(record, column.dataIndex)) : selectOptions ? convertArrayWithIndent(selectOptions) : [];
|
|
105
|
-
|
|
106
|
-
// const currt = flatColumns2()
|
|
107
|
-
|
|
108
|
-
switch (editType) {
|
|
109
|
-
case 'date':
|
|
110
|
-
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
111
|
-
ref: datePickerRef,
|
|
112
|
-
format: {
|
|
113
|
-
format: dateFormat,
|
|
114
|
-
type: 'mask'
|
|
115
|
-
}
|
|
116
|
-
// locale={buddhistLocale}
|
|
117
|
-
,
|
|
118
|
-
style: {
|
|
119
|
-
width: '100%',
|
|
120
|
-
height: '100%'
|
|
121
|
-
}
|
|
122
|
-
// value={date}
|
|
123
|
-
,
|
|
124
|
-
defaultValue: date
|
|
125
|
-
// preserveInvalidOnBlur
|
|
126
|
-
,
|
|
127
|
-
|
|
128
|
-
onBlur: () => {
|
|
129
|
-
const formState = getValues();
|
|
130
|
-
const itemState = getValues(dataIndex);
|
|
131
|
-
// @ts-ignore
|
|
132
|
-
const prevState = record[dataIndex];
|
|
133
|
-
const newState = itemState;
|
|
134
|
-
const key = getRowKey?.(record, index);
|
|
135
|
-
if (newState !== prevState) {
|
|
136
|
-
handleCellChange?.({
|
|
137
|
-
key: key,
|
|
138
|
-
field: column.field ?? column.dataIndex,
|
|
139
|
-
record: formState,
|
|
140
|
-
prevState,
|
|
141
|
-
newState,
|
|
142
|
-
option: newState,
|
|
143
|
-
indexCol,
|
|
144
|
-
indexRow,
|
|
145
|
-
type: 'blur'
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
150
|
-
disabled: isDisable(column, record) ?? false,
|
|
151
|
-
maxDate: maxDate,
|
|
152
|
-
minDate: minDate,
|
|
153
|
-
onChange: (newDate, dateString) => {
|
|
154
|
-
const newDateValue = dateString ? moment(convertDayjsToDate(dateString, dateFormat)).format() : null;
|
|
155
|
-
onChange(newDateValue);
|
|
156
|
-
setTimeout(() => {
|
|
157
|
-
// @ts-ignore
|
|
158
|
-
datePickerRef.current?.focus();
|
|
159
|
-
}, 0);
|
|
160
|
-
},
|
|
161
|
-
popupClassName: 'be-popup-container',
|
|
162
|
-
status: isInvalid ? 'error' : undefined,
|
|
163
|
-
"data-tooltip-content": message,
|
|
164
|
-
"data-tooltip-id": `${id}-tooltip-form-error`
|
|
165
|
-
});
|
|
166
|
-
case 'datetime':
|
|
167
|
-
return /*#__PURE__*/React.createElement(DatePicker
|
|
168
|
-
// id={`col${indexCol}-record${indexRow}`}
|
|
169
|
-
, {
|
|
170
|
-
ref: dateTimePickerRef,
|
|
171
|
-
format: {
|
|
172
|
-
format: dateFormat,
|
|
173
|
-
type: 'mask'
|
|
174
|
-
}
|
|
175
|
-
// locale={buddhistLocale}
|
|
176
|
-
,
|
|
177
|
-
style: {
|
|
178
|
-
width: '100%',
|
|
179
|
-
height: '100%'
|
|
180
|
-
},
|
|
181
|
-
showTime: true
|
|
182
|
-
// value={date}
|
|
183
|
-
,
|
|
184
|
-
defaultValue: date,
|
|
185
|
-
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
186
|
-
disabled: isDisable(column, record) ?? false,
|
|
187
|
-
maxDate: maxDate,
|
|
188
|
-
minDate: minDate,
|
|
189
|
-
onChange: (newDate, dateString) => {
|
|
190
|
-
const newDateValue = dateString ? moment(convertDayjsToDate(dateString, dateFormat)).format() : null;
|
|
191
|
-
onChange(newDateValue);
|
|
192
|
-
setTimeout(() => {
|
|
193
|
-
// @ts-ignore
|
|
194
|
-
dateTimePickerRef.current?.focus();
|
|
195
|
-
}, 0);
|
|
196
|
-
},
|
|
197
|
-
onBlur: () => {
|
|
198
|
-
const formState = getValues();
|
|
199
|
-
const itemState = getValues(dataIndex);
|
|
200
|
-
// @ts-ignore
|
|
201
|
-
const prevState = record[dataIndex];
|
|
202
|
-
const newState = itemState;
|
|
203
|
-
const key = getRowKey?.(record, index);
|
|
204
|
-
if (prevState !== newState) {
|
|
205
|
-
handleCellChange?.({
|
|
206
|
-
key: key,
|
|
207
|
-
field: column.field ?? column.dataIndex,
|
|
208
|
-
record: formState,
|
|
209
|
-
prevState,
|
|
210
|
-
newState,
|
|
211
|
-
option: newState,
|
|
212
|
-
indexCol,
|
|
213
|
-
indexRow,
|
|
214
|
-
type: 'blur'
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
popupClassName: 'be-popup-container',
|
|
219
|
-
status: isInvalid ? 'error' : undefined,
|
|
220
|
-
"data-tooltip-content": message,
|
|
221
|
-
"data-tooltip-id": `${id}-tooltip-form-error`
|
|
222
|
-
});
|
|
223
|
-
case 'month':
|
|
224
|
-
case 'quarter':
|
|
225
|
-
case 'year':
|
|
226
|
-
const pickerFormat = getDatepickerFormat(editType, cellFormat);
|
|
227
|
-
const maxDateValue1 = !isEmpty(column.maxDate) ? dayjs(column.maxDate, pickerFormat) : undefined;
|
|
228
|
-
const minDateValue1 = !isEmpty(column.minDate) ? dayjs(column.minDate, pickerFormat) : undefined;
|
|
229
|
-
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
230
|
-
id: `col${indexCol}-record${indexRow}`,
|
|
231
|
-
format: {
|
|
232
|
-
format: pickerFormat,
|
|
233
|
-
type: 'mask'
|
|
234
|
-
},
|
|
235
|
-
style: {
|
|
236
|
-
width: '100%',
|
|
237
|
-
height: '100%'
|
|
238
|
-
},
|
|
239
|
-
picker: editType,
|
|
240
|
-
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
241
|
-
disabled: isDisable(column, record) ?? false,
|
|
242
|
-
maxDate: maxDateValue1,
|
|
243
|
-
minDate: minDateValue1,
|
|
244
|
-
popupClassName: 'be-popup-container',
|
|
245
|
-
status: isInvalid ? 'error' : undefined,
|
|
246
|
-
"data-tooltip-content": message,
|
|
247
|
-
"data-tooltip-id": `${id}-tooltip-form-error`
|
|
248
|
-
});
|
|
249
|
-
case 'week':
|
|
250
|
-
const weekFormat = getDatepickerFormat(editType, cellFormat);
|
|
251
|
-
const maxWeekValue = !isEmpty(column.maxDate) ? dayjs(column.maxDate, weekFormat) : undefined;
|
|
252
|
-
const minWeekValue = !isEmpty(column.minDate) ? dayjs(column.minDate, weekFormat) : undefined;
|
|
253
|
-
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
254
|
-
format: val => customWeekStartEndFormat(val, weekFormat),
|
|
255
|
-
style: {
|
|
256
|
-
width: '100%',
|
|
257
|
-
height: '100%'
|
|
258
|
-
},
|
|
259
|
-
picker: editType,
|
|
260
|
-
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
261
|
-
disabled: isDisable(column, record) ?? false,
|
|
262
|
-
maxDate: maxWeekValue,
|
|
263
|
-
minDate: minWeekValue,
|
|
264
|
-
popupClassName: 'be-popup-container',
|
|
265
|
-
status: isInvalid ? 'error' : undefined,
|
|
266
|
-
"data-tooltip-content": message,
|
|
267
|
-
"data-tooltip-id": `${id}-tooltip-form-error`
|
|
268
|
-
});
|
|
269
|
-
case 'time':
|
|
270
|
-
const timeFormat = getDatepickerFormat(editType, cellFormat);
|
|
271
|
-
const maxTimeValue = !isEmpty(column.maxTime) ? dayjs(column.maxTime).format(timeFormat) : null;
|
|
272
|
-
const minTimeValue = !isEmpty(column.minTime) ? dayjs(column.minTime).format(timeFormat) : null;
|
|
273
|
-
|
|
274
|
-
// @ts-ignore
|
|
275
|
-
// const timeValue = !isEmpty(record[column.dataIndex]) ? dayjs(record[column.dataIndex], timeFormat) : null
|
|
276
|
-
const maxTime = maxTimeValue ? dayjs(maxTimeValue, timeFormat) : undefined;
|
|
277
|
-
const minTime = minTimeValue ? dayjs(minTimeValue, timeFormat) : undefined;
|
|
278
|
-
return /*#__PURE__*/React.createElement(TimePicker, {
|
|
279
|
-
format: {
|
|
280
|
-
format: timeFormat,
|
|
281
|
-
type: 'mask'
|
|
282
|
-
},
|
|
283
|
-
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
284
|
-
maxDate: maxTime,
|
|
285
|
-
minDate: minTime,
|
|
286
|
-
disabled: isDisable(column, record) ?? false,
|
|
287
|
-
style: {
|
|
288
|
-
width: '100%',
|
|
289
|
-
height: '100%'
|
|
290
|
-
},
|
|
291
|
-
popupClassName: 'be-popup-container',
|
|
292
|
-
status: isInvalid ? 'error' : undefined,
|
|
293
|
-
"data-tooltip-content": message,
|
|
294
|
-
"data-tooltip-id": `${id}-tooltip-form-error`
|
|
295
|
-
});
|
|
296
|
-
case 'selectTable':
|
|
297
|
-
const rr = selectColumns ?? [];
|
|
298
|
-
const columnsTable = rr.map(colSelect => {
|
|
299
|
-
return {
|
|
300
|
-
title: colSelect.headerTemplate ? colSelect.headerTemplate : t ? t(colSelect.headerText) : colSelect.headerText,
|
|
301
|
-
dataIndex: colSelect.field ?? colSelect.dataIndex,
|
|
302
|
-
key: colSelect.dataIndex,
|
|
303
|
-
render: colSelect.template ? (text, recd, ind) => /*#__PURE__*/React.createElement(React.Fragment, null, colSelect.template?.({
|
|
304
|
-
value: text,
|
|
305
|
-
rowData: recd,
|
|
306
|
-
column: colSelect,
|
|
307
|
-
field: colSelect.field,
|
|
308
|
-
index: ind,
|
|
309
|
-
[colSelect.field]: text
|
|
310
|
-
})) : undefined,
|
|
311
|
-
width: colSelect.width,
|
|
312
|
-
ellipsis: true,
|
|
313
|
-
align: colSelect.textAlign
|
|
314
|
-
};
|
|
315
|
-
});
|
|
316
|
-
let valueSelectTable = value;
|
|
317
|
-
if (fieldValue) {
|
|
318
|
-
// @ts-ignore
|
|
319
|
-
valueSelectTable = record[fieldValue] ?? value;
|
|
320
|
-
}
|
|
321
|
-
if (isMulti || selectMode === 'checkbox') {
|
|
322
|
-
// @ts-ignore
|
|
323
|
-
valueSelectTable = !isNullOrUndefined(record[column.dataIndex]) && Array.isArray(record[column.dataIndex]) && record[column.dataIndex]?.length > 0 ? options.filter(val => record[column.dataIndex]?.includes(val[keySelect])) : undefined;
|
|
324
|
-
}
|
|
325
|
-
return /*#__PURE__*/React.createElement(AsyncTableSelect
|
|
326
|
-
// id={`col${indexCol}-record${indexRow}`}
|
|
327
|
-
, {
|
|
328
|
-
columns: columnsTable,
|
|
329
|
-
options: options,
|
|
330
|
-
defaultOptions: options,
|
|
331
|
-
value: valueSelectTable,
|
|
332
|
-
rowData: record,
|
|
333
|
-
onChange: (val, option) => {
|
|
334
|
-
onChange(val ?? '');
|
|
335
|
-
const formState = getValues();
|
|
336
|
-
// const itemState = getValues(dataIndex)
|
|
337
|
-
// @ts-ignore
|
|
338
|
-
const prevState = record[dataIndex];
|
|
339
|
-
const newState = val;
|
|
340
|
-
handleCellChange?.({
|
|
341
|
-
key: getRowKey?.(record, index),
|
|
342
|
-
field: column.field ?? column.dataIndex,
|
|
343
|
-
record: formState,
|
|
344
|
-
prevState,
|
|
345
|
-
newState,
|
|
346
|
-
option: option,
|
|
347
|
-
indexCol,
|
|
348
|
-
indexRow,
|
|
349
|
-
type: 'blur'
|
|
350
|
-
});
|
|
351
|
-
},
|
|
352
|
-
showSearch: true,
|
|
353
|
-
mode: isMulti || selectMode === 'checkbox' ? 'multiple' : undefined,
|
|
354
|
-
valueSelectAble: true,
|
|
355
|
-
selectMode: selectMode,
|
|
356
|
-
style: {
|
|
357
|
-
width: '100%',
|
|
358
|
-
height: '100%'
|
|
359
|
-
},
|
|
360
|
-
defaultOpen: column.field === cellEditing?.column.field
|
|
361
|
-
// autoFocus={true}
|
|
362
|
-
,
|
|
363
|
-
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
364
|
-
allowClear: column.isClearable ?? false,
|
|
365
|
-
maxTagCount: 'responsive',
|
|
366
|
-
rowKey: keySelect,
|
|
367
|
-
popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined,
|
|
368
|
-
optionFilterProp: "label",
|
|
369
|
-
popupClassName: 'be-popup-container',
|
|
370
|
-
loadOptions: loadOptions,
|
|
371
|
-
status: isInvalid ? 'error' : undefined,
|
|
372
|
-
dropdownRender: menu => {
|
|
373
|
-
if (toolbarItems && toolbarItems.length > 0) {
|
|
374
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, menu, /*#__PURE__*/React.createElement(Divider, {
|
|
375
|
-
style: {
|
|
376
|
-
margin: '8px 0'
|
|
377
|
-
}
|
|
378
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
379
|
-
className: 'toolbar-control d-flex justify-content-end'
|
|
380
|
-
}, toolbarItems.map(it => {
|
|
381
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
382
|
-
key: it.key,
|
|
383
|
-
className: 'toolbar-item',
|
|
384
|
-
onClick: () => toolbarClick?.({
|
|
385
|
-
item: it,
|
|
386
|
-
column
|
|
387
|
-
})
|
|
388
|
-
}, it.template ? getTemplate(it.template) : /*#__PURE__*/React.createElement(Button, {
|
|
389
|
-
className: "toolbar-item-btn"
|
|
390
|
-
}, it.icon && getTemplate(it.icon), it.title));
|
|
391
|
-
})));
|
|
392
|
-
} else {
|
|
393
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, " ", menu);
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
filterOption: filterOption,
|
|
397
|
-
fieldNames: fieldNames ? fieldNames : {
|
|
398
|
-
value: keySelect,
|
|
399
|
-
label: inputKey ?? 'label'
|
|
400
|
-
},
|
|
401
|
-
onBlur: event => {
|
|
402
|
-
if (event.inputValue && column?.editSelectSettings?.searchTextAsValue && isMulti !== true) {
|
|
403
|
-
const val = event.inputValue;
|
|
404
|
-
onChange(val ?? '');
|
|
405
|
-
const formState = getValues();
|
|
406
|
-
// const itemState = getValues(dataIndex)
|
|
407
|
-
// @ts-ignore
|
|
408
|
-
const prevState = record[dataIndex];
|
|
409
|
-
const newState = val;
|
|
410
|
-
handleCellChange?.({
|
|
411
|
-
key: getRowKey?.(record, index),
|
|
412
|
-
field: column.field ?? column.dataIndex,
|
|
413
|
-
record: formState,
|
|
414
|
-
prevState,
|
|
415
|
-
newState,
|
|
416
|
-
option: {
|
|
417
|
-
value: val,
|
|
418
|
-
label: val,
|
|
419
|
-
searchTextAsValue: true
|
|
420
|
-
},
|
|
421
|
-
indexCol,
|
|
422
|
-
indexRow,
|
|
423
|
-
type: 'blur'
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
},
|
|
427
|
-
"data-tooltip-content": message,
|
|
428
|
-
"data-tooltip-id": `${id}-tooltip-form-error`
|
|
429
|
-
});
|
|
430
|
-
case 'select':
|
|
431
|
-
let valueSelect = value;
|
|
432
|
-
if (fieldValue) {
|
|
433
|
-
// @ts-ignore
|
|
434
|
-
valueSelect = record[fieldValue] ?? value;
|
|
435
|
-
}
|
|
436
|
-
if (isMulti || selectMode === 'checkbox') {
|
|
437
|
-
// @ts-ignore
|
|
438
|
-
valueSelect = !isNullOrUndefined(record[column.dataIndex]) && Array.isArray(record[column.dataIndex]) && record[column.dataIndex]?.length > 0 ? options.filter(val => record[column.dataIndex]?.includes(val[keySelect])) : undefined;
|
|
439
|
-
}
|
|
440
|
-
return /*#__PURE__*/React.createElement(Select, {
|
|
441
|
-
options: options,
|
|
442
|
-
value: valueSelect,
|
|
443
|
-
onChange: (val, option) => {
|
|
444
|
-
onChange(val ?? '');
|
|
445
|
-
const formState = getValues();
|
|
446
|
-
// const itemState = getValues(dataIndex)
|
|
447
|
-
// @ts-ignore
|
|
448
|
-
const prevState = record[dataIndex];
|
|
449
|
-
const newState = val;
|
|
450
|
-
handleCellChange?.({
|
|
451
|
-
key: getRowKey?.(record, index),
|
|
452
|
-
field: column.field ?? column.dataIndex,
|
|
453
|
-
record: formState,
|
|
454
|
-
prevState,
|
|
455
|
-
newState,
|
|
456
|
-
option: option,
|
|
457
|
-
indexCol,
|
|
458
|
-
indexRow,
|
|
459
|
-
type: 'blur'
|
|
460
|
-
});
|
|
461
|
-
},
|
|
462
|
-
showSearch: true,
|
|
463
|
-
mode: isMulti || selectMode === 'checkbox' ? 'multiple' : undefined,
|
|
464
|
-
valueSelectAble: true,
|
|
465
|
-
defaultOpen: column.field === cellEditing?.column.field
|
|
466
|
-
// autoFocus={true}
|
|
467
|
-
,
|
|
468
|
-
|
|
469
|
-
style: {
|
|
470
|
-
width: '100%',
|
|
471
|
-
height: '100%'
|
|
472
|
-
},
|
|
473
|
-
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
474
|
-
allowClear: column.isClearable ?? false,
|
|
475
|
-
maxTagCount: 'responsive',
|
|
476
|
-
popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined,
|
|
477
|
-
optionFilterProp: "label",
|
|
478
|
-
popupClassName: 'be-popup-container',
|
|
479
|
-
status: isInvalid ? 'error' : undefined,
|
|
480
|
-
filterOption: filterOption,
|
|
481
|
-
fieldNames: fieldNames ? fieldNames : {
|
|
482
|
-
value: keySelect,
|
|
483
|
-
label: inputKey ?? 'label'
|
|
484
|
-
},
|
|
485
|
-
onBlur: event => {
|
|
486
|
-
if (event.inputValue && column?.editSelectSettings?.searchTextAsValue && isMulti !== true) {
|
|
487
|
-
const val = event.inputValue;
|
|
488
|
-
onChange(val ?? '');
|
|
489
|
-
const formState = getValues();
|
|
490
|
-
// const itemState = getValues(dataIndex)
|
|
491
|
-
// @ts-ignore
|
|
492
|
-
const prevState = record[dataIndex];
|
|
493
|
-
const newState = val;
|
|
494
|
-
handleCellChange?.({
|
|
495
|
-
key: getRowKey?.(record, index),
|
|
496
|
-
field: column.field ?? column.dataIndex,
|
|
497
|
-
record: formState,
|
|
498
|
-
prevState,
|
|
499
|
-
newState,
|
|
500
|
-
option: {
|
|
501
|
-
value: val,
|
|
502
|
-
label: val,
|
|
503
|
-
searchTextAsValue: true
|
|
504
|
-
},
|
|
505
|
-
indexCol,
|
|
506
|
-
indexRow,
|
|
507
|
-
type: 'blur'
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
},
|
|
511
|
-
"data-tooltip-content": message,
|
|
512
|
-
"data-tooltip-id": `${id}-tooltip-form-error`
|
|
513
|
-
});
|
|
514
|
-
case 'asyncSelect':
|
|
515
|
-
let valueAsyncSelect = value;
|
|
516
|
-
if (fieldValue) {
|
|
517
|
-
// @ts-ignore
|
|
518
|
-
valueAsyncSelect = record[fieldValue] ?? value;
|
|
519
|
-
}
|
|
520
|
-
if (isMulti || selectMode === 'checkbox') {
|
|
521
|
-
// @ts-ignore
|
|
522
|
-
valueAsyncSelect = !isNullOrUndefined(record[column.dataIndex]) && Array.isArray(record[column.dataIndex]) && record[column.dataIndex]?.length > 0 ? options.filter(val => record[column.dataIndex]?.includes(val[keySelect])) : undefined;
|
|
523
|
-
}
|
|
524
|
-
return /*#__PURE__*/React.createElement(AsyncSelect, {
|
|
525
|
-
options: options,
|
|
526
|
-
defaultOptions: options,
|
|
527
|
-
value: valueAsyncSelect,
|
|
528
|
-
onChange: (val, option) => {
|
|
529
|
-
onChange(val ?? '');
|
|
530
|
-
const formState = getValues();
|
|
531
|
-
// const itemState = getValues(dataIndex)
|
|
532
|
-
// @ts-ignore
|
|
533
|
-
const prevState = record[dataIndex];
|
|
534
|
-
const newState = val;
|
|
535
|
-
handleCellChange?.({
|
|
536
|
-
key: getRowKey?.(record, index),
|
|
537
|
-
field: column.field ?? column.dataIndex,
|
|
538
|
-
record: formState,
|
|
539
|
-
prevState,
|
|
540
|
-
newState,
|
|
541
|
-
option: option,
|
|
542
|
-
indexCol,
|
|
543
|
-
indexRow,
|
|
544
|
-
type: 'blur'
|
|
545
|
-
});
|
|
546
|
-
},
|
|
547
|
-
showSearch: true,
|
|
548
|
-
defaultOpen: column.field === cellEditing?.column.field
|
|
549
|
-
// autoFocus={true}
|
|
550
|
-
,
|
|
551
|
-
mode: isMulti || selectMode === 'checkbox' ? 'multiple' : undefined,
|
|
552
|
-
valueSelectAble: true,
|
|
553
|
-
style: {
|
|
554
|
-
width: '100%',
|
|
555
|
-
height: '100%'
|
|
556
|
-
},
|
|
557
|
-
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
558
|
-
allowClear: column.isClearable ?? false,
|
|
559
|
-
maxTagCount: 'responsive',
|
|
560
|
-
popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined,
|
|
561
|
-
optionFilterProp: "label",
|
|
562
|
-
popupClassName: 'be-popup-container',
|
|
563
|
-
loadOptions: loadOptions,
|
|
564
|
-
status: isInvalid ? 'error' : undefined
|
|
565
|
-
// dropdownRender={(menu) => {
|
|
566
|
-
// if (toolbarItems && toolbarItems.length > 0) {
|
|
567
|
-
// return (
|
|
568
|
-
// <>
|
|
569
|
-
// {menu}
|
|
570
|
-
// <Divider style={{margin: '8px 0'}}/>
|
|
571
|
-
//
|
|
572
|
-
// <div
|
|
573
|
-
// className={'toolbar-control d-flex justify-content-end'}
|
|
574
|
-
// >
|
|
575
|
-
// {toolbarItems.map((it) => {
|
|
576
|
-
// return (
|
|
577
|
-
// <div
|
|
578
|
-
// key={it.key}
|
|
579
|
-
// className={'toolbar-item'}
|
|
580
|
-
// onClick={() => toolbarClick?.({item: it, column})}
|
|
581
|
-
// >
|
|
582
|
-
// {it.template ? getTemplate(it.template) : (
|
|
583
|
-
// <Button className='toolbar-item-btn'>
|
|
584
|
-
//
|
|
585
|
-
// {it.icon && getTemplate(it.icon)}
|
|
586
|
-
// {it.title}
|
|
587
|
-
// </Button>
|
|
588
|
-
// )}
|
|
589
|
-
//
|
|
590
|
-
// </div>
|
|
591
|
-
// )
|
|
592
|
-
// })}
|
|
593
|
-
//
|
|
594
|
-
// </div>
|
|
595
|
-
// </>
|
|
596
|
-
// )
|
|
597
|
-
// } else {
|
|
598
|
-
// return <> {menu}</>
|
|
599
|
-
// }
|
|
600
|
-
//
|
|
601
|
-
// }}
|
|
602
|
-
,
|
|
603
|
-
filterOption: filterOption,
|
|
604
|
-
fieldNames: fieldNames ? fieldNames : {
|
|
605
|
-
value: keySelect,
|
|
606
|
-
label: inputKey ?? 'label'
|
|
607
|
-
},
|
|
608
|
-
onBlur: event => {
|
|
609
|
-
if (event.inputValue && column?.editSelectSettings?.searchTextAsValue && isMulti !== true) {
|
|
610
|
-
const val = event.inputValue;
|
|
611
|
-
onChange(val ?? '');
|
|
612
|
-
const formState = getValues();
|
|
613
|
-
// const itemState = getValues(dataIndex)
|
|
614
|
-
// @ts-ignore
|
|
615
|
-
const prevState = record[dataIndex];
|
|
616
|
-
const newState = val;
|
|
617
|
-
handleCellChange?.({
|
|
618
|
-
key: getRowKey?.(record, index),
|
|
619
|
-
field: column.field ?? column.dataIndex,
|
|
620
|
-
record: formState,
|
|
621
|
-
prevState,
|
|
622
|
-
newState,
|
|
623
|
-
option: {
|
|
624
|
-
value: val,
|
|
625
|
-
label: val,
|
|
626
|
-
searchTextAsValue: true
|
|
627
|
-
},
|
|
628
|
-
indexCol,
|
|
629
|
-
indexRow,
|
|
630
|
-
type: 'blur'
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
},
|
|
634
|
-
"data-tooltip-content": message,
|
|
635
|
-
"data-tooltip-id": `${id}-tooltip-form-error`
|
|
636
|
-
});
|
|
637
|
-
case 'treeSelect':
|
|
638
|
-
// let valueTreeSelect
|
|
639
|
-
|
|
640
|
-
const newTreeData = convertLabelToTitle(optionsTree);
|
|
641
|
-
// @ts-ignore
|
|
642
|
-
// const valueTreeSelect = column?.editSelectSettings?.isMulti ? (Array.isArray(record[column.dataIndex]) ? record[column.dataIndex] : []) : record[column.dataIndex]
|
|
643
|
-
|
|
644
|
-
let valueTreeSelect = value;
|
|
645
|
-
if (fieldValue) {
|
|
646
|
-
// @ts-ignore
|
|
647
|
-
valueTreeSelect = record[fieldValue] ?? value;
|
|
648
|
-
}
|
|
649
|
-
if (isMulti || selectMode === 'checkbox') {
|
|
650
|
-
// @ts-ignore
|
|
651
|
-
valueTreeSelect = !isNullOrUndefined(record[column.dataIndex]) && Array.isArray(record[column.dataIndex]) && record[column.dataIndex]?.length > 0 ? options.filter(val => record[column.dataIndex]?.includes(val[keySelect])) : undefined;
|
|
652
|
-
}
|
|
653
|
-
return /*#__PURE__*/React.createElement(TreeSelect, {
|
|
654
|
-
id: `col${indexCol}-record${indexRow}`,
|
|
655
|
-
className: 'be-tree-select',
|
|
656
|
-
style: {
|
|
657
|
-
width: '100%',
|
|
658
|
-
height: '100%'
|
|
659
|
-
},
|
|
660
|
-
value: valueTreeSelect,
|
|
661
|
-
dropdownStyle: {
|
|
662
|
-
maxHeight: 400,
|
|
663
|
-
overflow: 'auto'
|
|
664
|
-
},
|
|
665
|
-
treeData: newTreeData,
|
|
666
|
-
placeholder: t ? t(column.placeholder ?? 'Select') : column.placeholder ?? 'Select',
|
|
667
|
-
treeDefaultExpandAll: true,
|
|
668
|
-
defaultOpen: column.field === cellEditing?.column.field
|
|
669
|
-
// autoFocus={true}
|
|
670
|
-
,
|
|
671
|
-
virtual: true,
|
|
672
|
-
allowClear: true,
|
|
673
|
-
showSearch: true
|
|
674
|
-
// maxTagTextLength={column?.editSelectSettings?.showItems}
|
|
675
|
-
,
|
|
676
|
-
maxTagCount: column?.editSelectSettings?.showItems,
|
|
677
|
-
maxTagPlaceholder: 2,
|
|
678
|
-
treeTitleRender: column?.editSelectSettings?.formatOptionLabel,
|
|
679
|
-
showCheckedStrategy: SHOW_PARENT,
|
|
680
|
-
multiple: column?.editSelectSettings?.selectMode === 'checkbox' || column?.editSelectSettings?.isMulti
|
|
681
|
-
// fieldNames={{label: inputKey ? inputKey : 'title', value: keySelect, children: 'children'}}
|
|
682
|
-
,
|
|
683
|
-
treeCheckable: column?.editSelectSettings?.selectMode === 'checkbox',
|
|
684
|
-
filterTreeNode: filterTreeNode,
|
|
685
|
-
popupMatchSelectWidth: menuWidth ? menuWidth + 10 : undefined,
|
|
686
|
-
onSelect: (val, option) => {
|
|
687
|
-
onChange(val ?? '');
|
|
688
|
-
const formState = getValues();
|
|
689
|
-
// const itemState = getValues(dataIndex)
|
|
690
|
-
// @ts-ignore
|
|
691
|
-
const prevState = record[dataIndex];
|
|
692
|
-
const newState = val;
|
|
693
|
-
handleCellChange?.({
|
|
694
|
-
key: getRowKey?.(record, index),
|
|
695
|
-
field: column.field ?? column.dataIndex,
|
|
696
|
-
record: formState,
|
|
697
|
-
prevState,
|
|
698
|
-
newState,
|
|
699
|
-
option: option,
|
|
700
|
-
indexCol,
|
|
701
|
-
indexRow,
|
|
702
|
-
type: 'blur'
|
|
703
|
-
});
|
|
704
|
-
},
|
|
705
|
-
popupClassName: 'be-popup-container',
|
|
706
|
-
status: isInvalid ? 'error' : undefined,
|
|
707
|
-
"data-tooltip-content": message,
|
|
708
|
-
"data-tooltip-id": `${id}-tooltip-form-error`
|
|
709
|
-
});
|
|
710
|
-
case 'checkbox':
|
|
711
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
712
|
-
style: {
|
|
713
|
-
display: 'flex',
|
|
714
|
-
alignItems: 'center',
|
|
715
|
-
justifyContent: column.align ?? 'center',
|
|
716
|
-
paddingInline: 5,
|
|
717
|
-
height: '100%',
|
|
718
|
-
width: '100%'
|
|
719
|
-
}
|
|
720
|
-
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
721
|
-
checked: Boolean(value)
|
|
722
|
-
// style={{ textAlign: column.align ?? 'left' }}
|
|
723
|
-
,
|
|
724
|
-
onChange: val => {
|
|
725
|
-
const newVal = typeof value === "number" ? parseBooleanToValue(val.target.checked, typeof value) : val.target.checked;
|
|
726
|
-
onChange(newVal);
|
|
727
|
-
const key = getRowKey?.(record, index);
|
|
728
|
-
const formState = getValues();
|
|
729
|
-
handleCellChange?.({
|
|
730
|
-
key: key,
|
|
731
|
-
record: formState,
|
|
732
|
-
option: value,
|
|
733
|
-
prevState: value,
|
|
734
|
-
newState: newVal,
|
|
735
|
-
field: column.field ?? column.dataIndex,
|
|
736
|
-
indexCol,
|
|
737
|
-
indexRow,
|
|
738
|
-
type: 'blur'
|
|
739
|
-
});
|
|
740
|
-
},
|
|
741
|
-
disabled: isDisable(column, record) ?? false
|
|
742
|
-
}));
|
|
743
|
-
case 'form':
|
|
744
|
-
const valueForm = value;
|
|
745
|
-
return /*#__PURE__*/React.createElement(EditForm, {
|
|
746
|
-
rowData: record,
|
|
747
|
-
column: column,
|
|
748
|
-
t: t,
|
|
749
|
-
id: `col${indexCol}-record${indexRow}`,
|
|
750
|
-
value: valueForm
|
|
751
|
-
// fieldKey={'name'}
|
|
752
|
-
,
|
|
753
|
-
fieldKey: column.editFromSettings?.fieldKey
|
|
754
|
-
// recordData={record}
|
|
755
|
-
,
|
|
756
|
-
indexRow: indexRow,
|
|
757
|
-
cellFocus: column.field === cellEditing?.column.field,
|
|
758
|
-
onChange: val => {
|
|
759
|
-
const formState = getValues();
|
|
760
|
-
|
|
761
|
-
// @ts-ignore
|
|
762
|
-
const prevState = record[dataIndex];
|
|
763
|
-
const newState = val;
|
|
764
|
-
handleCellChange?.({
|
|
765
|
-
key: getRowKey?.(record, index),
|
|
766
|
-
field: column.field ?? column.dataIndex,
|
|
767
|
-
record: {
|
|
768
|
-
...formState,
|
|
769
|
-
[column.field ?? '']: val
|
|
770
|
-
},
|
|
771
|
-
prevState,
|
|
772
|
-
newState,
|
|
773
|
-
option: val,
|
|
774
|
-
indexCol,
|
|
775
|
-
indexRow,
|
|
776
|
-
type: 'blur'
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
// cellEditing={cellEditing}
|
|
780
|
-
|
|
781
|
-
// menuPortalTarget={tableContainerRef}
|
|
782
|
-
// classNamePrefix={column.classElement ?? 'select'}
|
|
783
|
-
,
|
|
784
|
-
placeholder: t ? t(column.placeholder ? column.placeholder : '') : column.placeholder ? column.placeholder : '',
|
|
785
|
-
menuWidth: column.editFromSettings?.menuWidth,
|
|
786
|
-
menuHeight: column.editFromSettings?.menuHeight
|
|
787
|
-
});
|
|
788
|
-
|
|
789
|
-
// case 'file':
|
|
790
|
-
// const valueFile = record[column.dataIndex]
|
|
791
|
-
// return (
|
|
792
|
-
//
|
|
793
|
-
//
|
|
794
|
-
// <InputFile
|
|
795
|
-
// value={valueFile}
|
|
796
|
-
// uploading={column.uploading}
|
|
797
|
-
// allowedExtensions={column.allowedExtensions}
|
|
798
|
-
// asyncUploadSettings={column.asyncUploadSettings}
|
|
799
|
-
// disable={isDisable(col, record)}
|
|
800
|
-
// onChange={(val: string) => {
|
|
801
|
-
//
|
|
802
|
-
// const newValue = Array.isArray(val) ? val.map((it: any) => it) : val
|
|
803
|
-
// const newrecordData = {
|
|
804
|
-
// ...record,
|
|
805
|
-
// [column.dataIndex]: newValue
|
|
806
|
-
// }
|
|
807
|
-
// handleCellChange(val, newValue, newrecordData, col, indexRow, indexCol)
|
|
808
|
-
// }}
|
|
809
|
-
//
|
|
810
|
-
//
|
|
811
|
-
// />
|
|
812
|
-
//
|
|
813
|
-
//
|
|
814
|
-
// )
|
|
815
|
-
|
|
816
|
-
case 'color':
|
|
817
|
-
const color = isColor(value) ? value : '#ffffff';
|
|
818
|
-
const presets = genPresets({
|
|
819
|
-
blue,
|
|
820
|
-
red,
|
|
821
|
-
green,
|
|
822
|
-
cyan
|
|
823
|
-
});
|
|
824
|
-
return /*#__PURE__*/React.createElement(ColorPicker, {
|
|
825
|
-
value: color,
|
|
826
|
-
allowClear: column.isClearable ?? true,
|
|
827
|
-
onChangeComplete: valueColor => {
|
|
828
|
-
onChange(`#${valueColor.toHex()}`);
|
|
829
|
-
const key = getRowKey?.(record, index);
|
|
830
|
-
const formState = getValues();
|
|
831
|
-
handleCellChange?.({
|
|
832
|
-
key: key,
|
|
833
|
-
field: column.field ?? column.dataIndex,
|
|
834
|
-
option: `#${valueColor.toHex()}`,
|
|
835
|
-
record: formState,
|
|
836
|
-
prevState: value,
|
|
837
|
-
newState: `#${valueColor.toHex()}`,
|
|
838
|
-
indexCol,
|
|
839
|
-
indexRow,
|
|
840
|
-
type: 'blur'
|
|
841
|
-
});
|
|
842
|
-
},
|
|
843
|
-
presets: presets,
|
|
844
|
-
panelRender: (_, {
|
|
845
|
-
components: {
|
|
846
|
-
Picker,
|
|
847
|
-
Presets
|
|
848
|
-
}
|
|
849
|
-
}) => /*#__PURE__*/React.createElement(Row, {
|
|
850
|
-
justify: "space-between",
|
|
851
|
-
wrap: false,
|
|
852
|
-
className: "custom-panel be-popup-container"
|
|
853
|
-
}, /*#__PURE__*/React.createElement(Col, {
|
|
854
|
-
span: 12
|
|
855
|
-
}, /*#__PURE__*/React.createElement(Presets, null)), /*#__PURE__*/React.createElement(Divider, {
|
|
856
|
-
type: "vertical",
|
|
857
|
-
style: {
|
|
858
|
-
height: 'auto'
|
|
859
|
-
}
|
|
860
|
-
}), /*#__PURE__*/React.createElement(Col, {
|
|
861
|
-
flex: "auto"
|
|
862
|
-
}, /*#__PURE__*/React.createElement(Picker, null)))
|
|
863
|
-
});
|
|
864
|
-
|
|
865
|
-
// case 'image':
|
|
866
|
-
// let image = record[column.dataIndex]
|
|
867
|
-
// return (
|
|
868
|
-
// <ImageUpload
|
|
869
|
-
// id={`col${indexCol}-record${indexRow}`}
|
|
870
|
-
// defaultImage={image}
|
|
871
|
-
// width={column.width}
|
|
872
|
-
// height={38}
|
|
873
|
-
// onKeyDown={(val: any, path: string) => {
|
|
874
|
-
// const checkKey = checkKeyDown(val, col, indexRow + 1, indexCol + 1)
|
|
875
|
-
// if (checkKey === 'ArrecordDown' || checkKey === 'ArrecordUp' || checkKey === 'Enter') {
|
|
876
|
-
// let newVal = ''
|
|
877
|
-
// if (newVal != record[column.dataIndex]) {
|
|
878
|
-
// record[column.dataIndex] = path
|
|
879
|
-
// // handleDataChange(path, record, col, indexRow, indexCol)
|
|
880
|
-
// handleCellChange(path, record, col, indexRow, indexCol)
|
|
881
|
-
// }
|
|
882
|
-
// }
|
|
883
|
-
// }}
|
|
884
|
-
// />
|
|
885
|
-
// )
|
|
886
|
-
|
|
887
|
-
case 'numeric':
|
|
888
|
-
const thousandSeparator = cellFormat?.thousandSeparator;
|
|
889
|
-
const decimalSeparator = cellFormat?.decimalSeparator;
|
|
890
|
-
|
|
891
|
-
// let floatValue = value
|
|
892
|
-
|
|
893
|
-
const numericFormatProps = {
|
|
894
|
-
value,
|
|
895
|
-
thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
|
|
896
|
-
decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
|
|
897
|
-
decimalScale: cellFormat?.decimalScale ?? undefined,
|
|
898
|
-
fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false,
|
|
899
|
-
allowNegative: cellFormat?.allowNegative ?? true,
|
|
900
|
-
prefix: cellFormat?.prefix ?? undefined,
|
|
901
|
-
suffix: cellFormat?.suffix ?? undefined
|
|
902
|
-
};
|
|
903
|
-
return /*#__PURE__*/React.createElement(NumericFormat, _extends({
|
|
904
|
-
id: `col${indexCol}-record${indexRow}`
|
|
905
|
-
// value={value ? numericFormatter(value.toString(), numericFormatProps) : ''}
|
|
906
|
-
// value={value}
|
|
907
|
-
}, numericFormatProps, {
|
|
908
|
-
min: column.min,
|
|
909
|
-
max: column.max,
|
|
910
|
-
customInput: Input
|
|
911
|
-
// valueIsNumericString={true}
|
|
912
|
-
,
|
|
913
|
-
placeholder: t ? t(column.placeholder ?? 'Enter') : column.placeholder ?? 'Enter',
|
|
914
|
-
autoComplete: 'off',
|
|
915
|
-
className: classNames('be-cell-editing rounded-0 input-element', {
|
|
916
|
-
'is-invalid': isInvalid,
|
|
917
|
-
'be-cell-edit-align-center': column.align === 'center',
|
|
918
|
-
'be-cell-edit-align-left': column.align === 'left',
|
|
919
|
-
'be-cell-edit-align-right': !column.align || column.align === 'right'
|
|
920
|
-
}),
|
|
921
|
-
onValueChange: values => {
|
|
922
|
-
onChange(values?.floatValue || 0);
|
|
923
|
-
},
|
|
924
|
-
onBlur: () => {
|
|
925
|
-
const formState = getValues();
|
|
926
|
-
const itemState = getValues(dataIndex);
|
|
927
|
-
|
|
928
|
-
// @ts-ignore
|
|
929
|
-
const prevState = record[dataIndex];
|
|
930
|
-
const newState = value;
|
|
931
|
-
const key = getRowKey?.(record, index);
|
|
932
|
-
// @ts-ignore
|
|
933
|
-
if (itemState !== record[dataIndex]) {
|
|
934
|
-
handleCellChange?.({
|
|
935
|
-
key: key,
|
|
936
|
-
field: column.field ?? column.dataIndex,
|
|
937
|
-
option: newState,
|
|
938
|
-
record: formState,
|
|
939
|
-
prevState,
|
|
940
|
-
newState,
|
|
941
|
-
indexCol,
|
|
942
|
-
indexRow,
|
|
943
|
-
type: 'blur'
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
},
|
|
947
|
-
"data-tooltip-content": message,
|
|
948
|
-
"data-tooltip-id": `${id}-tooltip-form-error`
|
|
949
|
-
}));
|
|
950
|
-
default:
|
|
951
|
-
return /*#__PURE__*/React.createElement(TextArea, {
|
|
952
|
-
id: `col${indexCol}-record${indexRow}`,
|
|
953
|
-
style: {
|
|
954
|
-
textAlign: column.align,
|
|
955
|
-
resize: 'none',
|
|
956
|
-
height: '100%'
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
// @ts-ignore
|
|
960
|
-
// value={!isNullOrUndefined(record[column.dataIndex]) ? record[column.dataIndex] : ''}
|
|
961
|
-
,
|
|
962
|
-
disabled: isDisable(column, record) ?? false,
|
|
963
|
-
className: classNames('be-cell-editing rounded-0 input-element'),
|
|
964
|
-
placeholder: t ? t(column.placeholder ?? 'Enter') : column.placeholder ?? 'Enter',
|
|
965
|
-
value: !isNullOrUndefined(value) ? value : '',
|
|
966
|
-
onBlur: () => {
|
|
967
|
-
const formState = getValues();
|
|
968
|
-
// const itemState = getValues(dataIndex)
|
|
969
|
-
// @ts-ignore
|
|
970
|
-
const prevState = record[dataIndex];
|
|
971
|
-
const newState = value;
|
|
972
|
-
const key = getRowKey?.(record, index);
|
|
973
|
-
// @ts-ignore
|
|
974
|
-
if (newState !== prevState) {
|
|
975
|
-
handleCellChange?.({
|
|
976
|
-
key: key,
|
|
977
|
-
record: formState,
|
|
978
|
-
option: value,
|
|
979
|
-
prevState,
|
|
980
|
-
newState,
|
|
981
|
-
field: column.field ?? column.dataIndex,
|
|
982
|
-
indexCol,
|
|
983
|
-
indexRow,
|
|
984
|
-
type: 'blur'
|
|
985
|
-
});
|
|
986
|
-
}
|
|
987
|
-
},
|
|
988
|
-
onPressEnter: () => {
|
|
989
|
-
const key = getRowKey?.(record, index);
|
|
990
|
-
const formState = getValues();
|
|
991
|
-
const newState = getValues(dataIndex);
|
|
992
|
-
// @ts-ignore
|
|
993
|
-
const prevState = record[dataIndex];
|
|
994
|
-
// @ts-ignore
|
|
995
|
-
// if (itemState !== record[dataIndex]) {
|
|
996
|
-
|
|
997
|
-
handleCellChange?.({
|
|
998
|
-
key: key,
|
|
999
|
-
newState,
|
|
1000
|
-
prevState,
|
|
1001
|
-
record: formState,
|
|
1002
|
-
indexCol,
|
|
1003
|
-
indexRow,
|
|
1004
|
-
type: 'enter'
|
|
1005
|
-
});
|
|
1006
|
-
// }
|
|
1007
|
-
},
|
|
1008
|
-
onChange: onChange,
|
|
1009
|
-
status: isInvalid ? 'error' : undefined,
|
|
1010
|
-
"data-tooltip-content": message,
|
|
1011
|
-
"data-tooltip-id": `${id}-tooltip-form-error`,
|
|
1012
|
-
autoSize: {
|
|
1013
|
-
minRows: 1,
|
|
1014
|
-
maxRows: 1
|
|
1015
|
-
}
|
|
1016
|
-
});
|
|
1017
|
-
}
|
|
1018
|
-
};
|
|
1019
|
-
return /*#__PURE__*/React.createElement("div", restProps, editing ? /*#__PURE__*/React.createElement(Controller, {
|
|
1020
|
-
name: dataIndex,
|
|
1021
|
-
control: control,
|
|
1022
|
-
render: ({
|
|
1023
|
-
field: {
|
|
1024
|
-
value,
|
|
1025
|
-
onChange
|
|
1026
|
-
}
|
|
1027
|
-
}) => inputNode(value, onChange)
|
|
1028
|
-
}) : children);
|
|
1029
|
-
};
|
|
1030
|
-
export default EditableCell;
|