UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

109 lines (108 loc) 3.42 kB
/** * DevExtreme (cjs/__internal/ui/gantt/ui.gantt.data.option.js) * Version: 25.2.5 * Build date: Fri Feb 20 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _m_data_helper = require("../../../__internal/data/m_data_helper"); var _component = require("../../../core/component"); class DataOption extends _component.Component { constructor(optionName, getLoadPanel, dataSourceChangedCallback) { super(); this._optionName = optionName; this._getLoadPanel = getLoadPanel; this._dataSourceChangedCallback = dataSourceChangedCallback } insert(data, callback, errorCallback) { this._showLoadPanel(); this._getStore().insert(data).done((response => { if (callback) { callback(response) } this._hideLoadPanel() })).fail((error => { if (errorCallback) { errorCallback(error) } this._hideLoadPanel() })) } update(key, data, callback, errorCallback) { this._showLoadPanel(); this._getStore().update(key, data).done(((data, key) => { if (callback) { callback(data, key) } this._hideLoadPanel() })).fail((error => { if (errorCallback) { errorCallback(error) } this._hideLoadPanel() })) } remove(key, callback, errorCallback) { this._showLoadPanel(); this._getStore().remove(key).done((key => { if (callback) { callback(key) } this._hideLoadPanel() })).fail((error => { if (errorCallback) { errorCallback(error) } this._hideLoadPanel() })) } _dataSourceChangedHandler(newItems, e) { this._dataSourceChangedCallback(this._optionName, newItems) } _dataSourceOptions() { return { paginate: false } } _dataSourceLoadingChangedHandler(isLoading) { if (isLoading && !this._dataSource.isLoaded()) { this._showLoadPanel() } else { this._hideLoadPanel() } } _showLoadPanel() { var _this$_getLoadPanel; null === (_this$_getLoadPanel = this._getLoadPanel()) || void 0 === _this$_getLoadPanel || _this$_getLoadPanel.show() } _hideLoadPanel() { var _this$_getLoadPanel2; null === (_this$_getLoadPanel2 = this._getLoadPanel()) || void 0 === _this$_getLoadPanel2 || _this$_getLoadPanel2.hide() } _getStore() { return this._dataSource.store() } _getItems() { return this._getStore()._array || this._dataSource.items() } _reloadDataSource() { return this._dataSource.load() } dispose() { this._disposeDataSource() } _optionChanged(args) { const { name: name } = args; name } } DataOption.include(_m_data_helper.DataHelperMixin); var _default = exports.default = DataOption;