UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

54 lines (52 loc) 2.1 kB
/** * DevExtreme (cjs/__internal/integration/jquery/component_registrator.js) * Version: 25.2.7 * Build date: Tue May 05 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ "use strict"; var _m_component_registrator_callbacks = require("../../core/m_component_registrator_callbacks"); var _m_errors = _interopRequireDefault(require("../../core/m_errors")); var _jquery = _interopRequireDefault(require("jquery")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e } } if (_jquery.default) { const registerJQueryComponent = function(name, componentClass) { _jquery.default.fn[name] = function(options) { const isMemberInvoke = "string" === typeof options; let result; if (isMemberInvoke) { const memberName = options; const memberArgs = [].slice.call(arguments).slice(1); this.each(function() { const instance = componentClass.getInstance(this); if (!instance) { throw _m_errors.default.Error("E0009", name) } const member = instance[memberName]; const memberValue = member.apply(instance, memberArgs); if (void 0 === result) { result = memberValue } }) } else { this.each(function() { const instance = componentClass.getInstance(this); if (instance) { instance.option(options) } else { new componentClass(this, options) } }); result = this } return result } }; _m_component_registrator_callbacks.componentRegistratorCallbacks.add(registerJQueryComponent) }