當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript store.DocumentStore類代碼示例

本文整理匯總了TypeScript中eez-studio-shared/model/store.DocumentStore的典型用法代碼示例。如果您正苦於以下問題:TypeScript DocumentStore類的具體用法?TypeScript DocumentStore怎麽用?TypeScript DocumentStore使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DocumentStore類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: deleteDragItem

 deleteDragItem() {
     if (this.dropObject && this.dropEffect == "move") {
         if (this.dragObject) {
             DocumentStore.deleteObject(this.dragObject);
         }
         this.dropEffect = undefined;
         this.dragItemDeleted = true;
     }
 }
開發者ID:eez-open,項目名稱:studio,代碼行數:9,代碼來源:dd.ts

示例2: unsetResolutionDependablePropertyForCurrentResolution

export function unsetResolutionDependablePropertyForCurrentResolution(
    object: EezObject,
    propertyName: string
) {
    const allValues: (any | null)[] = getPropertyValueForAllResolutions(object, propertyName);

    allValues[getPageContext().resolution] = null;
    while (allValues.length > 1 && allValues[allValues.length - 1] === null) {
        allValues.pop();
    }

    DocumentStore.updateObject(object, {
        [propertyName + "_"]: allValues
    });
}
開發者ID:eez-open,項目名稱:studio,代碼行數:15,代碼來源:resolution-dependable-properties.ts

示例3: resetInObject

    function resetInObject(object: EezObject) {
        const changes: {
            [key: string]: any;
        } = {};

        object._classInfo.properties.forEach(propertyInfo => {
            if (propertyInfo.resolutionDependable) {
                const value = getPropertyValueForAllResolutions(object, propertyInfo.name);
                for (let i = getPageContext().resolution + 1; i < value.length; i++) {
                    value[i] = null;
                }
                changes[propertyInfo.name + "_"] = value;
            }
        });

        DocumentStore.updateObject(object, changes);

        getChildren(object).forEach(resetInObject);
    }
開發者ID:eez-open,項目名稱:studio,代碼行數:19,代碼來源:resolution-dependable-properties.ts

示例4: replaceObjectReference

export function replaceObjectReference(object: EezObject, newValue: string) {
    let resultsGenerator = searchForReference(DocumentStore.document, object, false);

    while (true) {
        let searchResult = resultsGenerator.next();
        if (searchResult.done) {
            break;
        }

        let searchValue = searchResult.value;
        if (searchValue) {
            let value: string | string[] = newValue;

            if (searchValue.propertyInfo.replaceObjectReference) {
                value = searchValue.propertyInfo.replaceObjectReference(value);
            } else if (searchValue.propertyInfo.type === PropertyType.ConfigurationReference) {
                value = [];
                for (let i = 0; i < searchValue.value.length; i++) {
                    if (searchValue.value[i] !== getProperty(object, "name")) {
                        value.push(searchValue.value[i]);
                    } else {
                        value.push(newValue);
                    }
                }
            }

            let parent = searchValue._parent;
            if (parent) {
                let key = searchValue._key;
                if (parent && key && typeof key == "string") {
                    DocumentStore.updateObject(parent, {
                        [key]: value
                    });
                }
            }
        }
    }
}
開發者ID:eez-open,項目名稱:studio,代碼行數:38,代碼來源:search.ts


注:本文中的eez-studio-shared/model/store.DocumentStore類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。