• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript declare.declare函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中dojo/_base/declare.declare函数的典型用法代码示例。如果您正苦于以下问题:TypeScript declare函数的具体用法?TypeScript declare怎么用?TypeScript declare使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: Grid

export function Grid(pagination?, selection?, overrides?) {
    var baseClass = [];
    var params = {};
    if (pagination) {
        baseClass = [DGrid, Pagination, ColumnResizer, Keyboard, DijitRegistry];
        lang.mixin(params, {
            rowsPerPage: 50,
            pagingLinks: 1,
            pagingTextBox: true,
            firstLastArrows: true,
            pageSizeOptions: [25, 50, 100, 1000]
        });
    } else {
        baseClass = [OnDemandGrid, ColumnResizer, Keyboard, DijitRegistry];
    }
    if (selection) {
        baseClass.push(Selection);
        lang.mixin(params, {
            allowSelectAll: true,
            deselectOnRefresh: false
        });
    }
    baseClass.push(GridHelper);
    return declare(baseClass, lang.mixin(params, overrides));
}
开发者ID:Michael-Gardner,项目名称:HPCC-Platform,代码行数:25,代码来源:ESPUtil.ts


示例2: declare

import * as all from "dojo/promise/all";
import * as Memory from "dojo/store/Memory";
import * as Observable from "dojo/store/Observable";
import * as Deferred from "dojo/_base/Deferred";
import * as QueryResults from "dojo/store/util/QueryResults";
import * as SimpleQueryEngine from "dojo/store/util/SimpleQueryEngine";
import * as topic from "dojo/topic";

import * as ESPUtil from "./ESPUtil";
import * as ESPRequest from "./ESPRequest";

var UsersStore = declare([ESPRequest.Store], {
    service: "ws_access",
    action: "UserQuery",
    responseQualifier: "UserQueryResponse.Users.User",
    responseTotalQualifier: "UserQueryResponse.TotalUsers",
    idProperty: "username",
    startProperty: "PageStartFrom",
    countProperty: "PageSize",
    SortbyProperty: 'SortBy'
});

var GroupsStore = declare([ESPRequest.Store], {
    service: "ws_access",
    action: "GroupQuery",
    responseQualifier: "GroupQueryResponse.Groups.Group",
    responseTotalQualifier: "GroupQueryResponse.TotalGroups",
    idProperty: "name",
    startProperty: "PageStartFrom",
    countProperty: "PageSize",
    SortbyProperty: 'SortBy',
开发者ID:GordonSmith,项目名称:HPCC-Platform,代码行数:31,代码来源:ws_access.ts


示例3: declare

export const GridHelper = declare(null, {
    allowTextSelection: true,
    noDataMessage: "<span class='dojoxGridNoData'>...empty...</span>",
    loadingMessage: "<span class='dojoxGridNoData'>loading...</span>",

    postCreate: function postCreate(inherited) {
        this.inherited(postCreate, arguments);

        this.__hpcc_tooltip_header = new Tooltip({
            connectId: [this.id],
            selector: ".dgrid-resize-header-container",
            showDelay: 400,
            getContent(node) {
                if (node.offsetWidth < node.scrollWidth - 4) {
                    return node.innerHTML;
                }
                return "";
            }
        });
        this.__hpcc_tooltip_header.position = ["above-centered", "below-centered", "before-centered", "after-centered"];

        this.__hpcc_tooltip = new Tooltip({
            connectId: [this.id],
            selector: "td",
            showDelay: 400,
            getContent(node) {
                if (node.offsetWidth <= node.scrollWidth) {
                    return node.innerHTML;
                }
                return "";
            }
        });
        this.__hpcc_tooltip.position = ["above-centered", "below-centered", "before-centered", "after-centered"];
    },

    refresh: function refresh(options) {
        this.inherited(refresh, arguments, [options || {
            keepScrollPosition: true,
            keepCurrentPage: true
        }]);
    }/*,

    _onNotify(object, existingId) {
        this.inherited(arguments);
        if (this.onSelectedChangedCallback) {
            this.onSelectedChangedCallback();
        }
    },

    onSelectionChanged(callback) {
        this.onSelectedChangedCallback = callback;
        this.on("dgrid-select, dgrid-deselect, dgrid-refresh-complete", function (event) {
            callback(event);
        });
    },

    clearSelection() {
        this.inherited(arguments);
        query("input[type=checkbox]", this.domNode).forEach(function (node) {
            node.checked = false;
            node.indeterminate = false;
        });
    },

    setSelection(arrayOfIDs) {
        this.clearSelection();
        const context = this;
        arrayUtil.forEach(arrayOfIDs, function (item, idx) {
            if (idx === 0) {
                const row = context.row(item);
                if (row.element) {
                    row.element.scrollIntoView();
                }
            }
            context.select(item);
        });
    },

    setSelected(items) {
        this.clearSelection();
        const context = this;
        arrayUtil.forEach(items, function (item, idx) {
            if (idx === 0) {
                const row = context.row(item);
                if (row.element) {
                    row.element.scrollIntoView();
                }
            }
            context.select(context.store.getIdentity(item));
        });
    },

    getSelected(store) {
        if (!store) {
            store = this.store;
        }
        const retVal = [];
        for (const id in this.selection) {
            if (this.selection[id]) {
                const storeItem = store.get(id);
//.........这里部分代码省略.........
开发者ID:GordonSmith,项目名称:Visualization,代码行数:101,代码来源:gridHelper.ts


示例4: declare

import * as WsEcl from "./WsEcl";
import * as Utility from "./Utility";

declare const debugConfig;

var DebugBase = declare(null, {
    showDebugRow: function (node, key, value) {
        var domNode = dom.byId(node);
        domConstruct.create("li", {
            innerHTML: "<b>" + Utility.xmlEncode(key) + "</b>:  " + Utility.xmlEncode(value)
        }, domNode);
    },

    showDebugInfo: function (/*DOMNode|String*/ node, obj) {
        var domNode = dom.byId(node);
        if (!obj) {
            obj = this;
        }
        var ulNode = domConstruct.create("ul", {}, domNode);
        for (var key in obj) {
            if (obj.hasOwnProperty(key)) {
                this.showDebugRow(ulNode, key, obj[key]);
            }
        }
    }
});

var PageInfo = declare(DebugBase, {

    constructor: function () {
        var pathname = (typeof debugConfig !== "undefined") ? debugConfig.pathname : location.pathname;
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:31,代码来源:ESPResource.ts


示例5: declare

var Store = declare([ESPRequest.Store], {
    service: "FileSpray",
    action: "GetDFUWorkunits",
    responseQualifier: "GetDFUWorkunitsResponse.results.DFUWorkunit",
    responseTotalQualifier: "GetDFUWorkunitsResponse.NumWUs",
    idProperty: "ID",
    startProperty: "PageStartFrom",
    countProperty: "PageSize",

    _watched: [],
    preRequest: function (request) {
        switch (request.Sortby) {
            case "ClusterName":
                request.Sortby = "Cluster";
                break;
            case "JobName":
                request.Sortby = "Jobname";
                break;
            case "Command":
                request.Sortby = "Type";
                break;
            case "StateMessage":
                request.Sortby = "State";
                break;
        }
    },
    create: function (id) {
        return new Workunit({
            ID: id,
            Wuid: id
        });
    },
    update: function (id, item) {
        var storeItem = this.get(id);
        storeItem.updateData(item);
        if (!this._watched[id]) {
            var context = this;
            this._watched[id] = storeItem.watch("__hpcc_changedCount", function (name, oldValue, newValue) {
                if (oldValue !== newValue) {
                    context.notify(storeItem, id);
                }
            });
        }
    }
});
开发者ID:richardkchapman,项目名称:HPCC-Platform,代码行数:45,代码来源:ESPDFUWorkunit.ts


示例6: declare

import * as declare from "dojo/_base/declare";
import * as topic from "dojo/topic";
import * as Observable from "dojo/store/Observable";

import * as ESPRequest from "./ESPRequest";

var NagiosStore = declare([ESPRequest.Store], {
    service: "ws_machine",
    action: "GetComponentStatus",
    responseQualifier: "GetComponentStatusResponse.ComponentStatusList.ComponentStatus",
    idProperty: "__hpcc_id"
});

var monitorHandle;
export function GetComponentStatus(params) {
    return ESPRequest.send("ws_machine", "GetComponentStatus", params);
}

export function GetTargetClusterInfo(params) {
    return ESPRequest.send("ws_machine", "GetTargetClusterInfo", params);
}

export function GetMachineInfo(params) {
    return ESPRequest.send("ws_machine", "GetMachineInfo", params);
}

export function MonitorComponentStatus(params) {
    var prevResponse = null;
    if (!monitorHandle) {
        var context = this;
        monitorHandle = setInterval(function () {
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:31,代码来源:ws_machine.ts


示例7: declare

var Store = declare([ESPRequest.Store], {
    i18n: nlsHPCC,
    service: "WsWorkunits",
    action: "WUListQueries",
    responseQualifier: "WUListQueriesResponse.QuerysetQueries.QuerySetQuery",
    responseTotalQualifier: "WUListQueriesResponse.NumberOfQueries",
    idProperty: "__hpcc_id",
    startProperty: "PageStartFrom",
    countProperty: "PageSize",

    _watched: [],

    create: function (__hpcc_id) {
        var tmp = __hpcc_id.split(":");
        return new Query({
            __hpcc_id: __hpcc_id,
            QuerySetId: tmp[0],
            Id: tmp[1]
        });
    },
    update: function (id, item) {
        var storeItem = this.get(id);
        storeItem.updateData(item);
        if (!this._watched[id]) {
            var context = this;
            this._watched[id] = storeItem.watch("__hpcc_changedCount", function (name, oldValue, newValue) {
                if (oldValue !== newValue) {
                    context.notify(storeItem, id);
                }
            });
        }
    },

    preProcessRow: function (item, request, query, options) {
        var context = this;
        var ErrorCount = 0;
        var StatusMessage;
        var MixedNodeStates;
        item[this.idProperty] = item.QuerySetId + ":" + item.Id;
        if (lang.exists("Clusters", item)) {
            arrayUtil.some(item.Clusters.ClusterQueryState, function (cqs, idx) {
                if (lang.exists("Errors", cqs) && cqs.Errors || cqs.State !== "Available") {
                    ErrorCount++;
                    StatusMessage = context.i18n.SuspendedByCluster;
                    return false;
                }
                if (lang.exists("MixedNodeStates", cqs) && cqs.MixedNodeStates === true) {
                    StatusMessage = context.i18n.MixedNodeStates;
                    MixedNodeStates = true;
                }
            });
        }
        if (item.Suspended === true) {
            StatusMessage = this.i18n.SuspendedByUser;
        }

        lang.mixin(item, {
            ErrorCount: ErrorCount,
            Status: StatusMessage,
            MixedNodeStates: MixedNodeStates
        });
    }
});
开发者ID:richardkchapman,项目名称:HPCC-Platform,代码行数:63,代码来源:ESPQuery.ts


示例8: declare

var Store = declare([ESPRequest.Store], {
    service: "WsWorkunits",
    action: "WUQuery",
    responseQualifier: "WUQueryResponse.Workunits.ECLWorkunit",
    responseTotalQualifier: "WUQueryResponse.NumWUs",
    idProperty: "Wuid",
    startProperty: "PageStartFrom",
    countProperty: "Count",

    constructor: function () {
        this._watched = {};
    },
    preRequest: function (request) {
        if (request.Sortby && request.Sortby === "TotalClusterTime") {
            request.Sortby = "ClusterTime";
        }
        this.busy = true;
    },
    preProcessFullResponse: function (response, request, query, options) {
        this.busy = false;
        this._toUnwatch = lang.mixin({}, this._watched);
    },
    create: function (id) {
        return new Workunit({
            Wuid: id
        });
    },
    update: function (id, item) {
        var storeItem = this.get(id);
        storeItem.updateData(item);
        if (!this._watched[id]) {
            var context = this;
            this._watched[id] = storeItem.watch("__hpcc_changedCount", function (name, oldValue, newValue) {
                if (oldValue !== newValue) {
                    context.notify(storeItem, id);
                }
            });
        } else {
            delete this._toUnwatch[id];
        }
    },
    postProcessResults: function () {
        for (var key in this._toUnwatch) {
            this._toUnwatch[key].unwatch();
            delete this._watched[key];
        }
        delete this._toUnwatch;
    }
});
开发者ID:Michael-Gardner,项目名称:HPCC-Platform,代码行数:49,代码来源:ESPWorkunit.ts


示例9: declare

import * as _domConstruct from "dojo/dom-construct";
export const Deferred: any = _Deferred;
export const domConstruct: any = _domConstruct;

//  dstore  ---
import * as _Memory from "dojo-dstore/Memory";
import * as _QueryResults from "dojo-dstore/QueryResults";
export const Memory: any = _Memory;
export const QueryResults: any = _QueryResults;

//  dgrid  ---
import * as _Grid from "dgrid/Grid";
// import * as List from "dgrid/List";
import * as OnDemandGrid from "dgrid/OnDemandGrid";

import * as Keyboard from "dgrid/Keyboard";
import * as Selection from "dgrid/Selection";

import * as ColumnResizer from "dgrid/extensions/ColumnResizer";
import * as CompoundColumns from "dgrid/extensions/CompoundColumns";
import * as nlsPagination from "dgrid/extensions/nls/pagination";

//  Other ---
import { GridHelper, Pagination } from "./gridHelper";

export const Grid = declare("Grid", [OnDemandGrid, Keyboard, Selection, ColumnResizer, CompoundColumns, GridHelper]);
Grid.prototype.i18nPagination = nlsPagination.root;

export const PagingGrid = declare("PagingGrid", [_Grid, Pagination, Keyboard, Selection, ColumnResizer, CompoundColumns, GridHelper]);
PagingGrid.prototype.i18nPagination = nlsPagination.root;
开发者ID:GordonSmith,项目名称:Visualization,代码行数:30,代码来源:index.ts


示例10: dojoDeclare

export default dojoDeclare([_WidgetBase, _TemplatedMixin], {
    // description:
    //      a toaster notification widget
    templateString: template,
    baseClass: 'toaster',

    // separator: Number
    //		The number if items currently being shown
    count: 0,

    // separator: Number
    //		The amx number if items to show
    maxItems: 5,

    // topic: String
    //		Name of topic; anything published to this topic will be displayed as a message.
    //		Message format is either String or an object like
    //		{message: 'hello word', type: 'error'}
    topic: 'app/Toaster',

    // allowableClasses: array
    //		The css classes that will work properly with bootstrap
    allowableClasses: [
        'info',
        'success',
        'warning',
        'danger'
    ],

    // defaultClass: String
    //		The default class to use when none is passed in
    defaultClass: 'info',

    // Properties to be sent into constructor

    postCreate: function () {
        // summary:
        //      Overrides method of same name in dijit._Widget.
        console.log('app.Toaster::postCreate', arguments);

        this.toasterItems = [];

        this.setupConnections();

        this.inherited(arguments);
    },
    setupConnections: function () {
        // summary:
        //      wire events, and such
        console.log('app.Toaster::setupConnections', arguments);

        this.own(
            topic.subscribe(this.topic, lang.hitch(this, this.handleMessage))
        );
    },
    handleMessage: function (message) {
        // summary:
        //      handles the message and sets default arguments
        // {message: type: sticky:}
        console.log('app.Toaster:handleMessage', arguments);

        if (lang.isString(message)) {
            this.setContent(message, this.defaultClass);
        } else {
            var cssClass = message.type;
            if (!cssClass || this.allowableClasses.indexOf(cssClass) < 0) {
                cssClass = this.defaultClass;
            }

            this.setContent(message.message, cssClass, message.sticky);
        }
    },
    setContent: function (message, cssClass, sticky) {
        // summary:
        //      description
        // the message and it's css class
        console.log('app.Toaster:setContent', arguments);

        if (message) {
            if (this.isDuplicate(this.toasterItems, message, cssClass)) {
                return;
            }
            var item:ToasterItemType = new ToasterItem({
                message: message,
                cssClass: cssClass,
                sticky: sticky
            }).placeAt(this.domNode, 'first');

            if (this.toasterItems.length >= this.maxItems) {
                var entry = this.toasterItems[0];
                entry.destroyRecursive(false);
            }

            this.toasterItems.push(item);
            item.show();

            var connection;
            connection = aspect.before(item, 'destroyRecursive', lang.hitch(this, function () {
                this.toasterItems = this.toasterItems.slice(1);

//.........这里部分代码省略.........
开发者ID:agrc-widgets,项目名称:toaster,代码行数:101,代码来源:Toaster.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript declare.safeMixin函数代码示例发布时间:2022-05-25
下一篇:
TypeScript array.some函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap