devextreme-vue
Version:
DevExtreme Vue UI and Visualization Components
58 lines (56 loc) • 2.04 kB
JavaScript
/*!
* devextreme-vue
* Version: 25.1.5
* Build date: Wed Sep 03 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
*/
import { PatchFlags } from '@vue/shared';
import { configurationChildren, getComponentInfo, getNormalizedProps } from './vue-helper';
function pullAllChildren(directChildren, allChildren, config) {
if (!directChildren || directChildren.length === 0) {
return;
}
pullConfigComponents(directChildren, allChildren, config);
}
export function isFragment(node) {
const { patchFlag } = node;
return patchFlag === PatchFlags.KEYED_FRAGMENT
|| patchFlag === PatchFlags.UNKEYED_FRAGMENT
|| patchFlag === PatchFlags.STABLE_FRAGMENT
|| patchFlag === PatchFlags.BAIL;
}
export 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 = getComponentInfo(node);
if (!componentInfo?.$_optionName) {
return;
}
const componentChildren = configurationChildren(node);
const initialValues = {
...componentInfo.$_predefinedProps,
...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);
}
});
}
export { pullAllChildren, };