Repository navigation
Conversation
| import { defaultOptions } from './const'; | ||
| import type { ColumnChooserItem, NodeInternal } from './types'; | ||
|
|
||
| const COLUMN_CHOOSER_CLASS = 'column-chooser'; |
There was a problem hiding this comment.
please, extract all class constants to a separate file and combine them into object variable, then use this variable in all modules that uses same variables - like we made in rows_view and other views
|
|
||
| const processItems = function (that: ColumnChooserView, chooserColumns) { | ||
| const items: any = []; | ||
| const processItems = ( |
There was a problem hiding this comment.
convert to method, please
| } | ||
|
|
||
| // @ts-expect-error the changed columns exist | ||
| const changedColumns: Column[] | undefined = columnIndices |
There was a problem hiding this comment.
can we replace this directive with guard? for example filtering result array so only defined values left?
then we can remove type definition and directive
| const needUpdate: boolean | undefined = hasItemsOptionNames | ||
| || (changes.changeTypes.columns && optionNames.all); |
There was a problem hiding this comment.
| const needUpdate: boolean | undefined = hasItemsOptionNames | |
| || (changes.changeTypes.columns && optionNames.all); | |
| const needUpdate = hasItemsOptionNames || !!(changes.changeTypes.columns && optionNames.all); |
| result.push(item); | ||
| }); | ||
| if (!$nodes) { | ||
| return $([]); |
There was a problem hiding this comment.
Lets use simpler version - it makes the same, but easier to read
| return $([]); | |
| return $(); |
| public isColumnChooserVisible(): boolean | undefined { | ||
| const popupContainer = this._popupContainer; | ||
|
|
||
| return popupContainer?.option('visible'); |
There was a problem hiding this comment.
what if this method returned a plain boolean? Then the !! in the ColumnChooserColumnHeadersExtender.allowDragging override can go away, and callers get a narrower type
| public isColumnChooserVisible(): boolean | undefined { | |
| const popupContainer = this._popupContainer; | |
| return popupContainer?.option('visible'); | |
| public isColumnChooserVisible(): boolean { | |
| const popupContainer = this._popupContainer; | |
| return Boolean(popupContainer?.option('visible')); |
| const isSelectMode = this.isSelectMode(); | ||
| const chooserColumns = this._columnsController.getChooserColumns(isSelectMode); | ||
| const $content = this._popupContainer?.$content(); | ||
| const $nodes = $content?.find('.dx-treeview-node'); |
There was a problem hiding this comment.
since the class constants are being reworked anyway: TreeView already exports NODE_CLASS from tree_view.base.ts, and grid code already imports from that module in header_filter/utils.ts. Maybe use .${NODE_CLASS} here instead of the hard-coded string?
No description provided.