当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript service.TreeService.getTreeWithoutSelection方法代码示例

本文整理汇总了TypeScript中app/core/ui-services/tree.service.TreeService.getTreeWithoutSelection方法的典型用法代码示例。如果您正苦于以下问题:TypeScript service.TreeService.getTreeWithoutSelection方法的具体用法?TypeScript service.TreeService.getTreeWithoutSelection怎么用?TypeScript service.TreeService.getTreeWithoutSelection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app/core/ui-services/tree.service.TreeService的用法示例。


在下文中一共展示了service.TreeService.getTreeWithoutSelection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: bulkMoveItems

    /**
     * Triggers the selected motions to be moved in the call-list (sort_parent, weight)
     * as children or as following after a selected motion.
     *
     * @param motions The motions to move
     */
    public async bulkMoveItems(motions: ViewMotion[]): Promise<void> {
        const title = this.translate.instant(
            'This will move all selected motions under or after the following motion in the call list:'
        );
        const options = [this.translate.instant('Set as parent'), this.translate.instant('Insert after')];
        const allMotions = this.repo.getViewModelList();
        const tree = this.treeService.makeTree(allMotions, 'weight', 'sort_parent_id');
        const itemsToMove = this.treeService.getTopItemsFromTree(tree, motions);
        const selectableItems = this.treeService.getTreeWithoutSelection(tree, motions);

        const selectedChoice = await this.choiceService.open(title, selectableItems, false, options);
        if (selectedChoice) {
            if (selectedChoice.action === options[0]) {
                // set choice as parent
                this.repo.sortMotionBranches(itemsToMove, selectedChoice.items as number);
            } else if (selectedChoice.action === options[1]) {
                // insert after chosen
                const olderSibling = this.repo.getViewModel(selectedChoice.items as number);
                const parentId = olderSibling ? olderSibling.sort_parent_id : null;
                const siblings = this.repo.getViewModelList().filter(motion => motion.sort_parent_id === parentId);
                const idx = siblings.findIndex(sib => sib.id === olderSibling.id);
                const before = siblings.slice(0, idx + 1);
                const after = siblings.slice(idx + 1);
                const sum = [].concat(before, itemsToMove, after);
                this.repo.sortMotionBranches(sum, parentId);
            }
        }
    }
开发者ID:jwinzer,项目名称:OpenSlides,代码行数:34,代码来源:motion-multiselect.service.ts


注:本文中的app/core/ui-services/tree.service.TreeService.getTreeWithoutSelection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。