devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
136 lines (135 loc) • 4.39 kB
JavaScript
/**
* DevExtreme (esm/__internal/grids/tree_list/module_widget_base.js)
* Version: 22.1.9
* Build date: Tue Apr 18 2023
*
* Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
import registerComponent from "../../../core/component_registrator";
import {
noop,
deferRender
} from "../../../core/utils/common";
import {
isFunction,
isDefined
} from "../../../core/utils/type";
import {
each
} from "../../../core/utils/iterator";
import {
extend
} from "../../../core/utils/extend";
import Widget from "../../../ui/widget/ui.widget";
import {
isMaterial
} from "../../../ui/themes";
import treeListCore from "./module_core";
import "./module_not_extended/column_headers";
import "./module_columns_controller";
import "./data_controller/module";
import "./module_not_extended/sorting";
import "./rows/module";
import "./module_not_extended/context_menu";
import "./module_not_extended/error_handling";
import "./module_grid_view";
import "./module_not_extended/header_panel";
const {
callModuleItemsMethod: callModuleItemsMethod
} = treeListCore;
const DATAGRID_ROW_SELECTOR = ".dx-row";
const TREELIST_CLASS = "dx-treelist";
treeListCore.registerModulesOrder(["stateStoring", "columns", "selection", "editorFactory", "columnChooser", "editingRowBased", "editingFormBased", "editingCellBased", "editing", "grouping", "masterDetail", "validating", "adaptivity", "data", "virtualScrolling", "columnHeaders", "filterRow", "headerPanel", "headerFilter", "sorting", "search", "rows", "pager", "columnsResizingReordering", "contextMenu", "keyboardNavigation", "errorHandling", "summary", "columnFixing", "export", "gridView"]);
const TreeList = Widget.inherit({
_activeStateUnit: ".dx-row",
_getDefaultOptions() {
const result = this.callBase();
each(treeListCore.modules, (function() {
if (isFunction(this.defaultOptions)) {
extend(true, result, this.defaultOptions())
}
}));
return result
},
_defaultOptionsRules() {
return this.callBase().concat([{
device: () => isMaterial(),
options: {
showRowLines: true,
showColumnLines: false,
headerFilter: {
height: 315
},
editing: {
useIcons: true
}
}
}])
},
_init() {
this.callBase();
treeListCore.processModules(this, treeListCore);
callModuleItemsMethod(this, "init")
},
_clean: noop,
_optionChanged(args) {
const that = this;
callModuleItemsMethod(that, "optionChanged", [args]);
if (!args.handled) {
that.callBase(args)
}
},
_dimensionChanged() {
this.updateDimensions(true)
},
_visibilityChanged(visible) {
if (visible) {
this.updateDimensions()
}
},
_initMarkup() {
this.callBase.apply(this, arguments);
this.$element().addClass("dx-treelist");
this.getView("gridView").render(this.$element())
},
_renderContentImpl() {
this.getView("gridView").update()
},
_renderContent() {
const that = this;
deferRender(() => {
that._renderContentImpl()
})
},
_dispose() {
this.callBase();
callModuleItemsMethod(this, "dispose")
},
isReady() {
return this.getController("data").isReady()
},
beginUpdate() {
this.callBase();
callModuleItemsMethod(this, "beginUpdate")
},
endUpdate() {
callModuleItemsMethod(this, "endUpdate");
this.callBase()
},
getController(name) {
return this._controllers[name]
},
getView(name) {
return this._views[name]
},
focus(element) {
this.callBase();
if (isDefined(element)) {
this.getController("keyboardNavigation").focus(element)
}
}
});
TreeList.registerModule = treeListCore.registerModule.bind(treeListCore);
registerComponent("dxTreeList", TreeList);
export default TreeList;