當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。