devextreme-vue
Version:
DevExtreme Vue UI and Visualization Components
63 lines (61 loc) • 2.34 kB
JavaScript
/*!
* devextreme-vue
* Version: 25.1.6
* Build date: Mon Oct 13 2025
*
* Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file in the root of the project for details.
*
* https://github.com/DevExpress/devextreme-vue
*/
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.pullAllChildren = exports.pullConfigComponents = exports.isFragment = void 0;
const shared_1 = require("@vue/shared");
const vue_helper_1 = require("./vue-helper");
function pullAllChildren(directChildren, allChildren, config) {
if (!directChildren || directChildren.length === 0) {
return;
}
pullConfigComponents(directChildren, allChildren, config);
}
exports.pullAllChildren = pullAllChildren;
function isFragment(node) {
const { patchFlag } = node;
return patchFlag === shared_1.PatchFlags.KEYED_FRAGMENT
|| patchFlag === shared_1.PatchFlags.UNKEYED_FRAGMENT
|| patchFlag === shared_1.PatchFlags.STABLE_FRAGMENT
|| patchFlag === shared_1.PatchFlags.BAIL;
}
exports.isFragment = isFragment;
function pullConfigComponents(children, nodes, ownerConfig) {
children.forEach((node) => {
if (isFragment(node) && Array.isArray(node.children)) {
pullConfigComponents(node.children, nodes, ownerConfig);
}
if (!isFragment(node)) {
nodes.push(node);
}
if (!node) {
return;
}
const componentInfo = (0, vue_helper_1.getComponentInfo)(node);
if (!componentInfo?.$_optionName) {
return;
}
const componentChildren = (0, vue_helper_1.configurationChildren)(node);
const initialValues = {
...componentInfo.$_predefinedProps,
...(0, vue_helper_1.getNormalizedProps)(node.props || {}),
};
const config = ownerConfig.createNested(componentInfo.$_optionName, initialValues, componentInfo.$_isCollectionItem, componentInfo.$_expectedChildren);
node.$_config = config;
node.$_innerChanges = {};
if (componentChildren) {
pullConfigComponents(componentChildren, nodes, config);
}
});
}
exports.pullConfigComponents = pullConfigComponents;