本文整理匯總了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));
}
示例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',
示例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);
//.........這裏部分代碼省略.........
示例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;
示例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);
}
});
}
}
});
示例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 () {
示例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
});
}
});
示例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;
}
});
示例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;
示例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);
//.........這裏部分代碼省略.........