Skip to content

Commit 96fc93a

Browse files
refactor: fix editor event handlers
1 parent e24cbcf commit 96fc93a

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

src/DTableColumnIcon/index.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ const COLUMNS_ICON_CONFIG = {
3434
[CellType.DEPARTMENT_SINGLE_SELECT]: 'dtable-font dtable-icon-department-single-selection',
3535
};
3636

37-
const COLUMN_DISPLAY_TYPE_ICON_CONFIG = {
38-
[CellType.TEXT]: {
39-
[TEXT_DISPLAY_TYPE_MAP.PHONE]: 'telephone',
40-
}
41-
};
42-
4337
const DTableColumnIcon = ({ column, color, className, ariaHidden = false, getSvg }) => {
4438
const columnType = column?.type;
4539
if (!columnType) return null;
40+
41+
const COLUMN_DISPLAY_TYPE_ICON_CONFIG = {
42+
[CellType.TEXT]: {
43+
[TEXT_DISPLAY_TYPE_MAP.PHONE]: 'telephone',
44+
}
45+
};
46+
4647
const columnDisplayType = getColumnDisplayType(column);
4748
let symbol = null;
4849
let displayTypeIconConfig = COLUMN_DISPLAY_TYPE_ICON_CONFIG[columnType];

src/DTableFiltersPopover/widgets/filter-item.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,19 +215,17 @@ class FilterItem extends React.Component {
215215
};
216216

217217
onFilterTermCheckboxChanged = () => {
218-
const { filterColumn } = this.props;
219-
const value = this.checkboxEditor.getValue();
220-
const checked = value[filterColumn.key];
221-
this.onFilterTermChanged(checked);
218+
const value = this.checkboxEditor?.getValue();
219+
this.onFilterTermChanged(!!value);
222220
};
223221

224222
onFilterTermTextChanged = (value) => {
225223
this.onFilterTermChanged(value);
226224
};
227225

228226
onFilterTermNumberChanged = () => {
229-
const value = this.numberEditor.getValue();
230-
this.onFilterTermChanged(Object.values(value)[0]);
227+
const value = this.numberEditor?.getValue();
228+
this.onFilterTermChanged(value);
231229
};
232230

233231
onFilterTermDurationChanged = () => {
@@ -278,7 +276,7 @@ class FilterItem extends React.Component {
278276
column={filterColumn}
279277
value={filterTerm}
280278
className='dtable-ui-filter-item-checkbox'
281-
onChange={this.onFilterTermCheckboxChanged}
279+
onCommit={this.onFilterTermCheckboxChanged}
282280
readOnly={readOnly}
283281
/>
284282
</div>

src/NumberEditor/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ class NumberEditor extends React.Component {
5959
};
6060

6161
onBlur = () => {
62-
this.props.isInModal ? this.props.onCommit(this.getValue()) : this.props.onBlur();
62+
if (this.props.onCommit) {
63+
this.props.onCommit(this.getValue());
64+
} else if (this.props.onBlur) {
65+
this.props.onBlur();
66+
}
6367
};
6468

6569
setInputRef = (input) => {

0 commit comments

Comments
 (0)