diff --git a/packages/vue2-strategy/npm/children-processing.d.ts b/packages/vue2-strategy/npm/children-processing.d.ts deleted file mode 100644 index e060318aad22..000000000000 --- a/packages/vue2-strategy/npm/children-processing.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { VNode } from "vue"; -import Configuration from "./configuration"; -declare function pullAllChildren(directChildren: VNode[], allChildren: VNode[], config: Configuration): void; -export { pullAllChildren }; diff --git a/packages/vue2-strategy/npm/children-processing.js b/packages/vue2-strategy/npm/children-processing.js deleted file mode 100644 index 102a1978a7a2..000000000000 --- a/packages/vue2-strategy/npm/children-processing.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.pullAllChildren = void 0; -function pullAllChildren(directChildren, allChildren, config) { - if (!directChildren || directChildren.length === 0) { - return; - } - pullConfigComponents(directChildren, allChildren, config); -} -exports.pullAllChildren = pullAllChildren; -function pullConfigComponents(children, nodes, ownerConfig) { - children.forEach(function (node) { - nodes.push(node); - if (!node.componentOptions) { - return; - } - var configComponent = node.componentOptions.Ctor; - if (!configComponent.$_optionName) { - return; - } - var initialValues = __assign(__assign({}, configComponent.$_predefinedProps), node.componentOptions.propsData); - var config = ownerConfig.createNested(configComponent.$_optionName, initialValues, configComponent.$_isCollectionItem, configComponent.$_expectedChildren); - node.componentOptions.$_config = config; - node.componentOptions.$_innerChanges = {}; - if (node.componentOptions.children) { - pullConfigComponents(node.componentOptions.children, nodes, config); - } - }); -} diff --git a/packages/vue2-strategy/npm/component.d.ts b/packages/vue2-strategy/npm/component.d.ts deleted file mode 100644 index a622d3db0b68..000000000000 --- a/packages/vue2-strategy/npm/component.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import IVue, { VueConstructor } from "vue"; -import { IConfigurable } from "./configuration-component"; -import { IEventBusHolder } from "./templates-discovering"; -import { TemplatesManager } from "./templates-manager"; -interface IWidgetComponent extends IConfigurable { - $_instance: any; - $_WidgetClass: any; - $_pendingOptions: Record; - $_templatesManager: TemplatesManager; -} -interface IBaseComponent extends IVue, IWidgetComponent, IEventBusHolder { - $_isExtension: boolean; - $_applyConfigurationChanges: () => void; - $_createWidget: (element: any) => void; - $_getIntegrationOptions: () => void; - $_getExtraIntegrationOptions: () => void; - $_getWatchMethod: () => void; - $_createEmitters: () => void; - $_processChildren: () => void; - $_getTemplates: () => object; -} -declare const BaseComponent: () => VueConstructor; -declare const DxComponent: () => VueConstructor; -export { DxComponent, BaseComponent, IWidgetComponent }; diff --git a/packages/vue2-strategy/npm/component.js b/packages/vue2-strategy/npm/component.js deleted file mode 100644 index a4e837cd9cb8..000000000000 --- a/packages/vue2-strategy/npm/component.js +++ /dev/null @@ -1,237 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BaseComponent = exports.DxComponent = void 0; -var VueType = __importStar(require("vue")); -var events_1 = require("devextreme/events"); -var children_processing_1 = require("./children-processing"); -var configuration_1 = __importStar(require("./configuration")); -var configuration_component_1 = require("./configuration-component"); -var constants_1 = require("./constants"); -var helpers_1 = require("./helpers"); -var templates_manager_1 = require("./templates-manager"); -var Vue = VueType.default || VueType; -var BaseComponent = function () { return Vue.extend({ - inheritAttrs: false, - data: function () { - return { - eventBus: new Vue() - }; - }, - provide: function () { - return { - eventBus: this.eventBus - }; - }, - render: function (createElement) { - var children = []; - if (this.$_config.cleanNested) { - this.$_config.cleanNested(); - } - children_processing_1.pullAllChildren(this.$slots.default, children, this.$_config); - this.$_processChildren(children); - return createElement("div", { - attrs: { id: this.$attrs.id } - }, children); - }, - beforeUpdate: function () { - this.$_config.setPrevNestedOptions(this.$_config.getNestedOptionValues()); - }, - updated: function () { - var _a, _b; - this.$children.forEach(function (child) { return configuration_component_1.initOptionChangedFunc(configuration_component_1.getConfig(child), child, configuration_component_1.getInnerChanges(child)); }); - this.$_templatesManager.discover(); - this.$_instance.beginUpdate(); - this.$_applyConfigurationChanges(); - if (this.$_templatesManager.isDirty) { - this.$_instance.option("integrationOptions.templates", this.$_templatesManager.templates); - var props = (_b = (_a = this.$vnode) === null || _a === void 0 ? void 0 : _a.componentOptions) === null || _b === void 0 ? void 0 : _b.propsData; - for (var _i = 0, _c = Object.keys(this.$_templatesManager.templates); _i < _c.length; _i++) { - var name_1 = _c[_i]; - this.$_instance.option(helpers_1.getTemplatePropName(props, name_1), name_1); - } - this.$_templatesManager.resetDirtyFlag(); - } - for (var _d = 0, _e = Object.keys(this.$_pendingOptions); _d < _e.length; _d++) { - var name_2 = _e[_d]; - this.$_instance.option(name_2, this.$_pendingOptions[name_2]); - } - this.$_pendingOptions = {}; - this.$_instance.endUpdate(); - this.eventBus.$emit("updated"); - }, - beforeDestroy: function () { - var instance = this.$_instance; - if (instance) { - events_1.triggerHandler(this.$el, constants_1.DX_REMOVE_EVENT); - instance.dispose(); - } - }, - created: function () { - var _this = this; - this.$_config = new configuration_1.default(function (n, v) { return _this.$_pendingOptions[n] = v; }, null, this.$options.propsData && __assign({}, this.$options.propsData), this.$_expectedChildren); - this.$_innerChanges = {}; - this.$_config.init(this.$props && Object.keys(this.$props)); - }, - methods: { - $_applyConfigurationChanges: function () { - var _this = this; - this.$_config.componentsCountChanged.forEach(function (_a) { - var optionPath = _a.optionPath, isCollection = _a.isCollection, removed = _a.removed; - var options = _this.$_config.getNestedOptionValues(); - if (!isCollection && removed) { - _this.$_instance.resetOption(optionPath); - } - else { - _this.$_instance.option(optionPath, helpers_1.getOptionValue(options, optionPath)); - } - }); - this.$_config.cleanComponentsCountChanged(); - }, - $_createWidget: function (element) { - var thisComponent = this; - thisComponent.$_pendingOptions = {}; - thisComponent.$_templatesManager = new templates_manager_1.TemplatesManager(this); - var config = this.$_config; - var options = __assign(__assign(__assign(__assign({}, this.$options.propsData), config.initialValues), config.getNestedOptionValues()), this.$_getIntegrationOptions()); - var instance = new this.$_WidgetClass(element, options); - thisComponent.$_instance = instance; - instance.on("optionChanged", function (args) { return config.onOptionChanged(args); }); - configuration_1.setEmitOptionChangedFunc(config, this, this.$_innerChanges); - configuration_1.bindOptionWatchers(config, this, this.$_innerChanges); - this.$_createEmitters(instance); - }, - $_getIntegrationOptions: function () { - var _a, _b; - var result = __assign({ integrationOptions: { - watchMethod: this.$_getWatchMethod(), - } }, this.$_getExtraIntegrationOptions()); - if (this.$_templatesManager.isDirty) { - var templates = this.$_templatesManager.templates; - result.integrationOptions.templates = templates; - var props = (_b = (_a = this.$vnode) === null || _a === void 0 ? void 0 : _a.componentOptions) === null || _b === void 0 ? void 0 : _b.propsData; - for (var _i = 0, _c = Object.keys(templates); _i < _c.length; _i++) { - var name_3 = _c[_i]; - result[helpers_1.getTemplatePropName(props, name_3)] = name_3; - } - this.$_templatesManager.resetDirtyFlag(); - } - return result; - }, - $_getWatchMethod: function () { - var _this = this; - return function (valueGetter, valueChangeCallback, options) { - options = options || {}; - if (!options.skipImmediate) { - valueChangeCallback(valueGetter()); - } - return _this.$watch(function () { - return valueGetter(); - }, function (newValue, oldValue) { - if (helpers_1.toComparable(oldValue) !== helpers_1.toComparable(newValue) || options.deep) { - valueChangeCallback(newValue); - } - }, { - deep: options.deep - }); - }; - }, - $_getExtraIntegrationOptions: function () { - return {}; - }, - $_processChildren: function (_children) { - return; - }, - $_createEmitters: function (instance) { - var _this = this; - Object.keys(this.$listeners).forEach(function (listenerName) { - var eventName = helpers_1.camelize(listenerName); - instance.on(eventName, function (e) { - _this.$emit(listenerName, e); - }); - }); - } - } -}); }; -exports.BaseComponent = BaseComponent; -function cleanWidgetNode(node) { - var removedNodes = []; - helpers_1.forEachChildNode(node, function (childNode) { - var parent = childNode.parentNode; - var isExtension = childNode.hasAttribute && childNode.hasAttribute("isExtension"); - if ((childNode.nodeName === "#comment" || isExtension) && parent) { - removedNodes.push(childNode); - parent.removeChild(childNode); - } - }); - return removedNodes; -} -function restoreNodes(el, nodes) { - nodes.forEach(function (node) { - el.appendChild(node); - }); -} -var DxComponent = function () { return BaseComponent().extend({ - methods: { - $_getExtraIntegrationOptions: function () { - return { - onInitializing: function () { - this.beginUpdate(); - } - }; - }, - $_processChildren: function (children) { - children.forEach(function (childNode) { - if (!childNode.componentOptions) { - return; - } - childNode.componentOptions.$_hasOwner = true; - }); - }, - }, - mounted: function () { - var _this = this; - var nodes = cleanWidgetNode(this.$el); - this.$_createWidget(this.$el); - this.$_instance.endUpdate(); - restoreNodes(this.$el, nodes); - if (this.$slots && this.$slots.default) { - this.$slots.default.forEach(function (child) { - var childExtension = child.componentInstance; - if (childExtension && childExtension.$_isExtension) { - childExtension.attachTo(_this.$el); - } - }); - } - } -}); }; -exports.DxComponent = DxComponent; diff --git a/packages/vue2-strategy/npm/config.d.ts b/packages/vue2-strategy/npm/config.d.ts deleted file mode 100644 index 9d614e3e3fa0..000000000000 --- a/packages/vue2-strategy/npm/config.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -interface IOptions { - useLegacyTemplateEngine: boolean; -} -declare function setOptions(options: Partial): void; -declare function getOption(optionName: TName): IOptions[TName]; -export default setOptions; -export { getOption }; diff --git a/packages/vue2-strategy/npm/config.js b/packages/vue2-strategy/npm/config.js deleted file mode 100644 index 8d824a3e970f..000000000000 --- a/packages/vue2-strategy/npm/config.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getOption = void 0; -var config = { - useLegacyTemplateEngine: false -}; -function setOptions(options) { - config = __assign(__assign({}, config), options); -} -function getOption(optionName) { - return config[optionName]; -} -exports.getOption = getOption; -exports.default = setOptions; diff --git a/packages/vue2-strategy/npm/configuration-component.d.ts b/packages/vue2-strategy/npm/configuration-component.d.ts deleted file mode 100644 index 17946e3d3ddf..000000000000 --- a/packages/vue2-strategy/npm/configuration-component.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import IVue, { VueConstructor } from "vue"; -import Configuration, { ExpectedChild } from "./configuration"; -interface IConfigurationOwner { - $_expectedChildren: Record; -} -interface IConfigurationComponent extends IConfigurationOwner { - $_optionName: string; - $_isCollectionItem: boolean; - $_predefinedProps: Record; -} -interface IConfigurable extends IConfigurationOwner { - $_config: Configuration; - $_innerChanges: any; -} -interface IComponentInfo { - optionPath: string; - isCollection: boolean; - removed?: boolean; -} -declare function getConfig(vueInstance: Pick): Configuration | undefined; -declare function getInnerChanges(vueInstance: Pick): any; -declare function initOptionChangedFunc(config: any, vueInstance: Pick, innerChanges: any): void; -declare const DxConfiguration: () => VueConstructor; -export { DxConfiguration, IComponentInfo, IConfigurable, IConfigurationComponent, initOptionChangedFunc, getConfig, getInnerChanges }; diff --git a/packages/vue2-strategy/npm/configuration-component.js b/packages/vue2-strategy/npm/configuration-component.js deleted file mode 100644 index f8b2224abaaf..000000000000 --- a/packages/vue2-strategy/npm/configuration-component.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getInnerChanges = exports.getConfig = exports.initOptionChangedFunc = exports.DxConfiguration = void 0; -var VueType = __importStar(require("vue")); -var Vue = VueType.default || VueType; -var configuration_1 = require("./configuration"); -function getConfig(vueInstance) { - if (!vueInstance.$vnode) { - return; - } - var componentOptions = vueInstance.$vnode.componentOptions; - return componentOptions && componentOptions.$_config; -} -exports.getConfig = getConfig; -function getInnerChanges(vueInstance) { - if (!vueInstance.$vnode) { - return; - } - var componentOptions = vueInstance.$vnode.componentOptions; - return componentOptions && componentOptions.$_innerChanges; -} -exports.getInnerChanges = getInnerChanges; -function initOptionChangedFunc(config, vueInstance, innerChanges) { - if (!config) { - return; - } - config.init(Object.keys(vueInstance.$props)); - configuration_1.setEmitOptionChangedFunc(config, vueInstance, innerChanges); -} -exports.initOptionChangedFunc = initOptionChangedFunc; -function getComponentInfo(_a, removed) { - var name = _a.name, isCollectionItem = _a.isCollectionItem, ownerConfig = _a.ownerConfig; - var parentPath = ownerConfig && ownerConfig.fullPath; - var optionPath = name && parentPath ? parentPath + "." + name : name || ""; - return { - optionPath: optionPath, - isCollection: isCollectionItem, - removed: removed - }; -} -var DxConfiguration = function () { return Vue.extend({ - beforeMount: function () { - var config = getConfig(this); - var innerChanges = getInnerChanges(this); - initOptionChangedFunc(config, this, innerChanges); - configuration_1.bindOptionWatchers(config, this, innerChanges); - }, - mounted: function () { - if (this.$parent.$_instance) { - this.$parent.$_config.componentsCountChanged - .push(getComponentInfo(getConfig(this))); - } - }, - beforeDestroy: function () { - this.$parent.$_config.componentsCountChanged - .push(getComponentInfo(getConfig(this), true)); - }, - render: function (createElement) { - return createElement(); - } -}); }; -exports.DxConfiguration = DxConfiguration; diff --git a/packages/vue2-strategy/npm/configuration.d.ts b/packages/vue2-strategy/npm/configuration.d.ts deleted file mode 100644 index fdb53b8880e1..000000000000 --- a/packages/vue2-strategy/npm/configuration.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { Vue } from "vue/types/vue"; -import { IComponentInfo } from "./configuration-component"; -declare type UpdateFunc = (name: string, value: any) => void; -declare type EmitOptionChangedFunc = (name: string, value: any) => void; -interface ExpectedChild { - isCollectionItem: boolean; - optionName: string; -} -interface IOptionChangedArgs { - fullName: string; - value: any; - previousValue: any; - component: any; -} -declare class Configuration { - private readonly _name; - private readonly _isCollectionItem; - private readonly _collectionItemIndex; - private readonly _initialValues; - private readonly _expectedChildren; - private readonly _updateFunc; - private readonly _ownerConfig; - private _nestedConfigurations; - private _prevNestedConfigOptions; - private _emitOptionChanged; - private _componentChanges; - private _options; - constructor(updateFunc: UpdateFunc, name: string | null, initialValues: Record, expectedChildren?: Record, isCollectionItem?: boolean, collectionItemIndex?: number, ownerConfig?: Pick | undefined); - get name(): string | null; - get fullName(): string | null; - get componentsCountChanged(): IComponentInfo[]; - cleanComponentsCountChanged(): void; - get fullPath(): string | null; - get ownerConfig(): Pick | undefined; - get options(): string[]; - get initialValues(): Record; - get expectedChildren(): Record; - get nested(): Configuration[]; - get prevNestedOptions(): any; - get collectionItemIndex(): number | undefined; - get isCollectionItem(): boolean; - get updateFunc(): UpdateFunc; - init(options: string[]): void; - set emitOptionChanged(handler: EmitOptionChangedFunc); - setPrevNestedOptions(value: any): void; - onOptionChanged(args: IOptionChangedArgs): void; - cleanNested(): void; - createNested(name: string, initialValues: Record, isCollectionItem?: boolean, expectedChildren?: Record): Configuration; - updateValue(nestedName: string, value: any): void; - getNestedOptionValues(): Record | undefined; - getOptionsToWatch(): string[]; - private _onOptionChanged; - private _getNestedConfig; - private _tryEmitOptionChanged; -} -declare function bindOptionWatchers(config: Configuration, vueInstance: Pick, innerChanges: Record): void; -declare function setEmitOptionChangedFunc(config: Configuration, vueInstance: Pick, innerChanges: Record): void; -export default Configuration; -export { bindOptionWatchers, setEmitOptionChangedFunc, UpdateFunc, ExpectedChild, IOptionChangedArgs }; diff --git a/packages/vue2-strategy/npm/configuration.js b/packages/vue2-strategy/npm/configuration.js deleted file mode 100644 index 2702e2c44374..000000000000 --- a/packages/vue2-strategy/npm/configuration.js +++ /dev/null @@ -1,257 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.setEmitOptionChangedFunc = exports.bindOptionWatchers = void 0; -var helpers_1 = require("./helpers"); -var Configuration = /** @class */ (function () { - function Configuration(updateFunc, name, initialValues, expectedChildren, isCollectionItem, collectionItemIndex, ownerConfig) { - this._updateFunc = updateFunc; - this._name = name; - this._initialValues = initialValues ? initialValues : {}; - this._nestedConfigurations = []; - this._isCollectionItem = !!isCollectionItem; - this._collectionItemIndex = collectionItemIndex; - this._expectedChildren = expectedChildren || {}; - this._ownerConfig = ownerConfig; - this._componentChanges = []; - this.updateValue = this.updateValue.bind(this); - } - Object.defineProperty(Configuration.prototype, "name", { - get: function () { - return this._name; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "fullName", { - get: function () { - return this._name && this._isCollectionItem - ? this._name + "[" + this._collectionItemIndex + "]" - : this._name; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "componentsCountChanged", { - get: function () { - return this._componentChanges; - }, - enumerable: false, - configurable: true - }); - Configuration.prototype.cleanComponentsCountChanged = function () { - this._componentChanges = []; - }; - Object.defineProperty(Configuration.prototype, "fullPath", { - get: function () { - return this._ownerConfig && this._ownerConfig.fullPath - ? this._ownerConfig.fullPath + "." + this.fullName - : this.fullName; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "ownerConfig", { - get: function () { - return this._ownerConfig; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "options", { - get: function () { - return this._options; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "initialValues", { - get: function () { - return this._initialValues; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "expectedChildren", { - get: function () { - return this._expectedChildren; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "nested", { - get: function () { - return this._nestedConfigurations; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "prevNestedOptions", { - get: function () { - return this._prevNestedConfigOptions; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "collectionItemIndex", { - get: function () { - return this._collectionItemIndex; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "isCollectionItem", { - get: function () { - return this._isCollectionItem; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Configuration.prototype, "updateFunc", { - get: function () { - return this._updateFunc; - }, - enumerable: false, - configurable: true - }); - Configuration.prototype.init = function (options) { - this._options = options ? options : []; - }; - Object.defineProperty(Configuration.prototype, "emitOptionChanged", { - set: function (handler) { - this._emitOptionChanged = handler; - }, - enumerable: false, - configurable: true - }); - Configuration.prototype.setPrevNestedOptions = function (value) { - this._prevNestedConfigOptions = value; - }; - Configuration.prototype.onOptionChanged = function (args) { - if (helpers_1.isEqual(args.value, args.previousValue)) { - return; - } - this._onOptionChanged(args.fullName.split("."), args); - }; - Configuration.prototype.cleanNested = function () { - this._nestedConfigurations = []; - }; - Configuration.prototype.createNested = function (name, initialValues, isCollectionItem, expectedChildren) { - var expected = this._expectedChildren[name]; - var actualName = name; - var actualIsCollectionItem = isCollectionItem; - if (expected) { - actualIsCollectionItem = expected.isCollectionItem; - if (expected.optionName) { - actualName = expected.optionName; - } - } - var collectionItemIndex = -1; - if (actualIsCollectionItem && actualName) { - collectionItemIndex = this._nestedConfigurations.filter(function (c) { return c._name && c._name === actualName; }).length; - } - var configuration = new Configuration(this._updateFunc, actualName, initialValues, expectedChildren, actualIsCollectionItem, collectionItemIndex, this); - this._nestedConfigurations.push(configuration); - return configuration; - }; - Configuration.prototype.updateValue = function (nestedName, value) { - var fullName = [this.fullPath, nestedName].filter(function (n) { return n; }).join("."); - this._updateFunc(fullName, value); - }; - Configuration.prototype.getNestedOptionValues = function () { - var values = {}; - this._nestedConfigurations.forEach(function (o) { - if (!o._name) { - return; - } - var nestedValue = __assign(__assign({}, o.initialValues), o.getNestedOptionValues()); - if (!nestedValue) { - return; - } - if (!o._isCollectionItem) { - values[o._name] = nestedValue; - } - else { - var arr = values[o._name]; - if (!arr || !Array.isArray(arr)) { - arr = []; - values[o._name] = arr; - } - arr.push(nestedValue); - } - }); - return values; - }; - Configuration.prototype.getOptionsToWatch = function () { - var blackList = {}; - this._nestedConfigurations.forEach(function (c) { return c._name && (blackList[c._name] = true); }); - return this._options.filter(function (o) { return !blackList[o]; }); - }; - Configuration.prototype._onOptionChanged = function (optionRelPath, args) { - if (optionRelPath.length === 0) { - return; - } - var optionInfo = helpers_1.getOptionInfo(optionRelPath[0]); - if (optionInfo.isCollection || optionRelPath.length > 1) { - var nestedConfig = this._getNestedConfig(optionInfo.fullName); - if (nestedConfig) { - nestedConfig._onOptionChanged(optionRelPath.slice(1), args); - return; - } - this._tryEmitOptionChanged(optionInfo.name, args.component.option(this.fullPath ? this.fullPath + "." + optionInfo.name : optionInfo.name)); - } - else { - this._tryEmitOptionChanged(optionInfo.name, args.value); - } - }; - Configuration.prototype._getNestedConfig = function (fullName) { - for (var _i = 0, _a = this._nestedConfigurations; _i < _a.length; _i++) { - var nestedConfig = _a[_i]; - if (nestedConfig.fullName === fullName) { - return nestedConfig; - } - } - return undefined; - }; - Configuration.prototype._tryEmitOptionChanged = function (name, value) { - if (this._emitOptionChanged) { - this._emitOptionChanged(name, value); - } - }; - return Configuration; -}()); -function bindOptionWatchers(config, vueInstance, innerChanges) { - var targets = config && config.getOptionsToWatch(); - if (targets) { - targets.forEach(function (optionName) { - vueInstance.$watch(optionName, function (value) { - if (!innerChanges.hasOwnProperty(optionName) || - innerChanges[optionName] !== value) { - config.updateValue(optionName, value); - } - delete innerChanges[optionName]; - }); - }); - } -} -exports.bindOptionWatchers = bindOptionWatchers; -function setEmitOptionChangedFunc(config, vueInstance, innerChanges) { - config.emitOptionChanged = function (name, value) { - if (!helpers_1.isEqual(value, vueInstance.$props[name])) { - innerChanges[name] = value; - vueInstance.$emit("update:" + name, value); - } - }; -} -exports.setEmitOptionChangedFunc = setEmitOptionChangedFunc; -exports.default = Configuration; diff --git a/packages/vue2-strategy/npm/constants.d.ts b/packages/vue2-strategy/npm/constants.d.ts deleted file mode 100644 index 95881b8a05b5..000000000000 --- a/packages/vue2-strategy/npm/constants.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const DX_TEMPLATE_WRAPPER_CLASS = "dx-template-wrapper"; -declare const DX_REMOVE_EVENT = "dxremove"; -export { DX_TEMPLATE_WRAPPER_CLASS, DX_REMOVE_EVENT }; diff --git a/packages/vue2-strategy/npm/constants.js b/packages/vue2-strategy/npm/constants.js deleted file mode 100644 index 81c29d9d862c..000000000000 --- a/packages/vue2-strategy/npm/constants.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DX_REMOVE_EVENT = exports.DX_TEMPLATE_WRAPPER_CLASS = void 0; -var DX_TEMPLATE_WRAPPER_CLASS = "dx-template-wrapper"; -exports.DX_TEMPLATE_WRAPPER_CLASS = DX_TEMPLATE_WRAPPER_CLASS; -var DX_REMOVE_EVENT = "dxremove"; -exports.DX_REMOVE_EVENT = DX_REMOVE_EVENT; diff --git a/packages/vue2-strategy/npm/errors.d.ts b/packages/vue2-strategy/npm/errors.d.ts deleted file mode 100644 index f25838848047..000000000000 --- a/packages/vue2-strategy/npm/errors.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const TEMPLATE_MULTIPLE_ROOTS_ERROR = "Template must have a single root node."; diff --git a/packages/vue2-strategy/npm/errors.js b/packages/vue2-strategy/npm/errors.js deleted file mode 100644 index 5378ecd9e3a5..000000000000 --- a/packages/vue2-strategy/npm/errors.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TEMPLATE_MULTIPLE_ROOTS_ERROR = void 0; -exports.TEMPLATE_MULTIPLE_ROOTS_ERROR = "Template must have a single root node."; diff --git a/packages/vue2-strategy/npm/extension-component.d.ts b/packages/vue2-strategy/npm/extension-component.d.ts deleted file mode 100644 index 5f0653b7e521..000000000000 --- a/packages/vue2-strategy/npm/extension-component.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { VueConstructor } from "vue"; -interface IExtension { - $_isExtension: boolean; - attachTo(element: any): any; -} -interface IExtensionComponentNode { - $_hasOwner: boolean; -} -declare const DxExtensionComponent: () => VueConstructor; -export { DxExtensionComponent, IExtension, IExtensionComponentNode }; diff --git a/packages/vue2-strategy/npm/extension-component.js b/packages/vue2-strategy/npm/extension-component.js deleted file mode 100644 index d976c363299f..000000000000 --- a/packages/vue2-strategy/npm/extension-component.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DxExtensionComponent = void 0; -var component_1 = require("./component"); -var DxExtensionComponent = function () { return component_1.BaseComponent().extend({ - created: function () { - this.$_isExtension = true; - }, - mounted: function () { - this.$el.setAttribute("isExtension", "true"); - if (this.$vnode && this.$vnode.componentOptions.$_hasOwner) { - return; - } - this.attachTo(this.$el); - }, - methods: { - attachTo: function (element) { - this.$_createWidget(element); - } - } -}); }; -exports.DxExtensionComponent = DxExtensionComponent; diff --git a/packages/vue2-strategy/npm/helpers.d.ts b/packages/vue2-strategy/npm/helpers.d.ts deleted file mode 100644 index 88a44623709d..000000000000 --- a/packages/vue2-strategy/npm/helpers.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -export declare function getTemplatePropName(props: Record | null, templateName: string): string; -export declare function uppercaseFirst(value: string): string; -export declare function lowercaseFirst(value: string): string; -export declare function camelize(value: string): string; -export declare function toComparable(value: any): any; -export declare function isEqual(value1: any, value2: any): boolean; -export declare function forEachChildNode(el: Node, callback: (child: ReturnType) => void): void; -export declare function allKeysAreEqual(obj1: object, obj2: object): boolean; -export declare function getOptionValue(options: any, optionPath: any): any; -export declare function getOptionInfo(name: string): IOptionInfo | ICollectionOptionInfo; -interface IOptionInfo { - isCollection: false; - name: string; - fullName: string; -} -interface ICollectionOptionInfo { - isCollection: true; - name: string; - fullName: string; - index: number; -} -export {}; diff --git a/packages/vue2-strategy/npm/helpers.js b/packages/vue2-strategy/npm/helpers.js deleted file mode 100644 index c9f44c4f3768..000000000000 --- a/packages/vue2-strategy/npm/helpers.js +++ /dev/null @@ -1,86 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getOptionInfo = exports.getOptionValue = exports.allKeysAreEqual = exports.forEachChildNode = exports.isEqual = exports.toComparable = exports.camelize = exports.lowercaseFirst = exports.uppercaseFirst = exports.getTemplatePropName = void 0; -function getTemplatePropName(props, templateName) { - for (var propName in props) { - if (props[propName] === templateName) { - return propName; - } - } - return templateName; -} -exports.getTemplatePropName = getTemplatePropName; -function uppercaseFirst(value) { - return value[0].toUpperCase() + value.substr(1); -} -exports.uppercaseFirst = uppercaseFirst; -function lowercaseFirst(value) { - return value[0].toLowerCase() + value.substr(1); -} -exports.lowercaseFirst = lowercaseFirst; -function camelize(value) { - return lowercaseFirst(value.split('-').map(function (v) { return uppercaseFirst(v); }).join('')); -} -exports.camelize = camelize; -function toComparable(value) { - return value instanceof Date ? value.getTime() : value; -} -exports.toComparable = toComparable; -function isEqual(value1, value2) { - if (toComparable(value1) === toComparable(value2)) { - return true; - } - if (Array.isArray(value1) && Array.isArray(value2)) { - return value1.length === 0 && value2.length === 0; - } - return false; -} -exports.isEqual = isEqual; -function forEachChildNode(el, callback) { - Array.prototype.slice.call(el.childNodes).forEach(callback); -} -exports.forEachChildNode = forEachChildNode; -function allKeysAreEqual(obj1, obj2) { - var obj1Keys = Object.keys(obj1); - if (obj1Keys.length !== Object.keys(obj2).length) { - return false; - } - for (var _i = 0, obj1Keys_1 = obj1Keys; _i < obj1Keys_1.length; _i++) { - var key = obj1Keys_1[_i]; - if (!obj2.hasOwnProperty(key)) { - return false; - } - } - return true; -} -exports.allKeysAreEqual = allKeysAreEqual; -function getOptionValue(options, optionPath) { - var value = options; - optionPath.split('.').forEach(function (p) { - var optionInfo = getOptionInfo(p); - if (value) { - value = optionInfo.isCollection - ? value[optionInfo.name] && value[optionInfo.name][optionInfo.index] - : value[optionInfo.name]; - } - }); - return value; -} -exports.getOptionValue = getOptionValue; -function getOptionInfo(name) { - var parts = name.split('['); - if (parts.length === 1) { - return { - isCollection: false, - name: name, - fullName: name, - }; - } - return { - isCollection: true, - name: parts[0], - fullName: name, - index: Number(parts[1].slice(0, -1)), - }; -} -exports.getOptionInfo = getOptionInfo; diff --git a/packages/vue2-strategy/npm/index.d.ts b/packages/vue2-strategy/npm/index.d.ts deleted file mode 100644 index f76586bfc424..000000000000 --- a/packages/vue2-strategy/npm/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare function createComponent(config: any): any; -export declare function createConfigurationComponent(config: any): any; -export declare function createExtensionComponent(config: any): any; diff --git a/packages/vue2-strategy/npm/index.js b/packages/vue2-strategy/npm/index.js deleted file mode 100644 index bf63083a7b41..000000000000 --- a/packages/vue2-strategy/npm/index.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createExtensionComponent = exports.createConfigurationComponent = exports.createComponent = void 0; -var VueType = __importStar(require("vue")); -var Vue = VueType.default || VueType; -var component_1 = require("./component"); -var configuration_component_1 = require("./configuration-component"); -var extension_component_1 = require("./extension-component"); -function createComponent(config) { - config.extends = component_1.DxComponent(); - return Vue.extend(config); -} -exports.createComponent = createComponent; -function createConfigurationComponent(config) { - config.extends = configuration_component_1.DxConfiguration(); - return Vue.extend(config); -} -exports.createConfigurationComponent = createConfigurationComponent; -function createExtensionComponent(config) { - config.extends = extension_component_1.DxExtensionComponent(); - return Vue.extend(config); -} -exports.createExtensionComponent = createExtensionComponent; diff --git a/packages/vue2-strategy/npm/templates-discovering.d.ts b/packages/vue2-strategy/npm/templates-discovering.d.ts deleted file mode 100644 index d13024e5db80..000000000000 --- a/packages/vue2-strategy/npm/templates-discovering.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import IVue from "vue"; -import { ScopedSlot } from "vue/types/vnode"; -interface IEventBusHolder { - eventBus: IVue; -} -declare function discover(component: IVue): Record; -declare function mountTemplate(getSlot: () => ScopedSlot, parent: IVue, data: any, name: string, placeholder: Element): IVue; -export { mountTemplate, discover, IEventBusHolder }; diff --git a/packages/vue2-strategy/npm/templates-discovering.js b/packages/vue2-strategy/npm/templates-discovering.js deleted file mode 100644 index 5864f420c04d..000000000000 --- a/packages/vue2-strategy/npm/templates-discovering.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.discover = exports.mountTemplate = void 0; -var VueType = __importStar(require("vue")); -var errors_1 = require("./errors"); -var TEMPLATE_PROP = "template"; -var Vue = VueType.default || VueType; -function asConfigurable(component) { - if (!component.$vnode) { - return undefined; - } - var configurable = component.$vnode.componentOptions; - if (!configurable.$_config || !configurable.$_config.name) { - return undefined; - } - return configurable; -} -function hasTemplate(component) { - return TEMPLATE_PROP in component.$props && (component.$vnode.data && component.$vnode.data.scopedSlots); -} -function discover(component) { - var templates = {}; - for (var slotName in component.$scopedSlots) { - if (slotName === "default" && component.$slots.default) { - continue; - } - var slot = component.$scopedSlots[slotName]; - if (!slot) { - continue; - } - templates[slotName] = slot; - } - for (var _i = 0, _a = component.$children; _i < _a.length; _i++) { - var childComponent = _a[_i]; - var configurable = asConfigurable(childComponent); - if (!configurable) { - continue; - } - var defaultSlot = childComponent.$scopedSlots.default; - if (!defaultSlot || !hasTemplate(childComponent)) { - continue; - } - var templateName = configurable.$_config.fullPath + "." + TEMPLATE_PROP; - templates[templateName] = defaultSlot; - } - return templates; -} -exports.discover = discover; -function mountTemplate(getSlot, parent, data, name, placeholder) { - return new Vue({ - el: placeholder, - name: name, - inject: ["eventBus"], - parent: parent, - created: function () { - var _this = this; - this.eventBus.$on("updated", function () { - _this.$forceUpdate(); - }); - }, - render: function (createElement) { - var content = getSlot()(data); - if (!content) { - return createElement("div"); - } - if (content.length > 1) { - throw new Error(errors_1.TEMPLATE_MULTIPLE_ROOTS_ERROR); - } - return content[0]; - }, - destroyed: function () { - // T857821 - this.eventBus.$off("updated"); - } - }); -} -exports.mountTemplate = mountTemplate; diff --git a/packages/vue2-strategy/npm/templates-manager.d.ts b/packages/vue2-strategy/npm/templates-manager.d.ts deleted file mode 100644 index 2522d07b4990..000000000000 --- a/packages/vue2-strategy/npm/templates-manager.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import IVue from "vue"; -declare class TemplatesManager { - private _component; - private _slots; - private _templates; - private _isDirty; - constructor(component: IVue); - discover(): void; - get templates(): Record; - get isDirty(): boolean; - resetDirtyFlag(): void; - private _prepareTemplates; - private createDxTemplate; -} -export { TemplatesManager }; diff --git a/packages/vue2-strategy/npm/templates-manager.js b/packages/vue2-strategy/npm/templates-manager.js deleted file mode 100644 index 7d022b165746..000000000000 --- a/packages/vue2-strategy/npm/templates-manager.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TemplatesManager = void 0; -var config_1 = require("./config"); -var templates_discovering_1 = require("./templates-discovering"); -var dom_adapter_1 = __importDefault(require("devextreme/core/dom_adapter")); -var events_1 = require("devextreme/events"); -var constants_1 = require("./constants"); -var helpers_1 = require("./helpers"); -var TemplatesManager = /** @class */ (function () { - function TemplatesManager(component) { - this._slots = {}; - this._templates = {}; - this._isDirty = false; - this._component = component; - this.discover(); - } - TemplatesManager.prototype.discover = function () { - var slots = templates_discovering_1.discover(this._component); - this._slots = __assign(__assign({}, this._slots), slots); - if (!helpers_1.allKeysAreEqual(this._templates, slots)) { - this._prepareTemplates(); - } - }; - Object.defineProperty(TemplatesManager.prototype, "templates", { - get: function () { - return this._templates; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TemplatesManager.prototype, "isDirty", { - get: function () { - return this._isDirty; - }, - enumerable: false, - configurable: true - }); - TemplatesManager.prototype.resetDirtyFlag = function () { - this._isDirty = false; - }; - TemplatesManager.prototype._prepareTemplates = function () { - this._templates = {}; - for (var _i = 0, _a = Object.keys(this._slots); _i < _a.length; _i++) { - var name_1 = _a[_i]; - this._templates[name_1] = this.createDxTemplate(name_1); - } - this._isDirty = true; - }; - TemplatesManager.prototype.createDxTemplate = function (name) { - var _this = this; - return { - render: function (data) { - var scopeData = config_1.getOption("useLegacyTemplateEngine") - ? data.model - : { data: data.model, index: data.index }; - var container = data.container.get ? data.container.get(0) : data.container; - var placeholder = document.createElement("div"); - container.appendChild(placeholder); - var mountedTemplate = templates_discovering_1.mountTemplate(function () { return _this._slots[name]; }, _this._component, scopeData, name, placeholder); - var element = mountedTemplate.$el; - dom_adapter_1.default.setClass(element, constants_1.DX_TEMPLATE_WRAPPER_CLASS, true); - if (element.nodeType === Node.TEXT_NODE) { - var removalListener = document.createElement(container.nodeName === "TABLE" ? "tbody" : "span"); - removalListener.style.display = "none"; - container.appendChild(removalListener); - events_1.one(removalListener, constants_1.DX_REMOVE_EVENT, mountedTemplate.$destroy.bind(mountedTemplate)); - } - else { - events_1.one(element, constants_1.DX_REMOVE_EVENT, mountedTemplate.$destroy.bind(mountedTemplate)); - } - return element; - } - }; - }; - return TemplatesManager; -}()); -exports.TemplatesManager = TemplatesManager;