This repository has been archived by the owner on Jan 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Ext-more-srv-4.1.0.js
519 lines (468 loc) · 18.2 KB
/
Ext-more-srv-4.1.0.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
/**
* @class Ext
*
* The Ext namespace (global object) encapsulates all classes, singletons, and
* utility methods provided by Sencha's libraries.
*
* Most user interface Components are at a lower level of nesting in the namespace,
* but many common utility functions are provided as direct properties of the Ext namespace.
*
* Also many frequently used methods from other classes are provided as shortcuts
* within the Ext namespace. For example {@link Ext#getCmp Ext.getCmp} aliases
* {@link Ext.ComponentManager#get Ext.ComponentManager.get}.
*
* Many applications are initiated with {@link Ext#onReady Ext.onReady} which is
* called once the DOM is ready. This ensures all scripts have been loaded,
* preventing dependency issues. For example:
*
* Ext.onReady(function(){
* new Ext.Component({
* renderTo: document.body,
* html: 'DOM ready!'
* });
* });
*
* For more information about how to use the Ext classes, see:
*
* - <a href="http://www.sencha.com/learn/">The Learning Center</a>
* - <a href="http://www.sencha.com/learn/Ext_FAQ">The FAQ</a>
* - <a href="http://www.sencha.com/forum/">The forums</a>
*
* @singleton
*/
Ext.apply(Ext, {
cache: {},
/**
* True when the document is fully initialized and ready for action
*/
isReady: false,
/**
* True to automatically uncache orphaned Ext.Elements periodically
*/
enableGarbageCollector: true,
/**
* True to automatically purge event listeners during garbageCollection.
*/
enableListenerCollection: true,
addCacheEntry: function(id, el, dom) {
dom = dom || el.dom;
//<debug>
if (!dom) {
// Without the DOM node we can't GC the entry
Ext.Error.raise('Cannot add an entry to the element cache without the DOM node');
}
//</debug>
var key = id || (el && el.id) || dom.id,
entry = Ext.cache[key] || (Ext.cache[key] = {
data: {},
events: {},
dom: dom,
// Skip garbage collection for special elements (window, document, iframes)
skipGarbageCollection: !!(dom.getElementById || dom.navigator)
});
if (el) {
el.$cache = entry;
// Inject the back link from the cache in case the cache entry
// had already been created by Ext.fly. Ext.fly creates a cache entry with no el link.
entry.el = el;
}
return entry;
},
escapeId: (function(){
var validIdRe = /^[a-zA-Z_][a-zA-Z0-9_\-]*$/i,
escapeRx = /([\W]{1})/g,
leadingNumRx = /^(\d)/g,
escapeFn = function(match, capture){
return "\\" + capture;
},
numEscapeFn = function(match, capture){
return '\\00' + capture.charCodeAt(0).toString(16) + ' ';
};
return function(id) {
return validIdRe.test(id)
? id
// replace the number portion last to keep the trailing ' '
// from being escaped
: id.replace(escapeRx, escapeFn)
.replace(leadingNumRx, numEscapeFn);
};
}()),
/**
* Attempts to destroy any objects passed to it by removing all event listeners, removing them from the
* DOM (if applicable) and calling their destroy functions (if available). This method is primarily
* intended for arguments of type {@link Ext.Element} and {@link Ext.Component}, but any subclass of
* {@link Ext.util.Observable} can be passed in. Any number of elements and/or components can be
* passed into this function in a single call as separate arguments.
*
* @param {Ext.Element/Ext.Component/Ext.Element[]/Ext.Component[]...} args
* An {@link Ext.Element}, {@link Ext.Component}, or an Array of either of these to destroy
*/
destroy: function() {
var ln = arguments.length,
i, arg;
for (i = 0; i < ln; i++) {
arg = arguments[i];
if (arg) {
if (Ext.isArray(arg)) {
this.destroy.apply(this, arg);
}
else if (Ext.isFunction(arg.destroy)) {
arg.destroy();
}
else if (arg.dom) {
arg.remove();
}
}
}
},
/**
* Execute a callback function in a particular scope. If no function is passed the call is ignored.
*
* For example, these lines are equivalent:
*
* Ext.callback(myFunc, this, [arg1, arg2]);
* Ext.isFunction(myFunc) && myFunc.apply(this, [arg1, arg2]);
*
* @param {Function} callback The callback to execute
* @param {Object} [scope] The scope to execute in
* @param {Array} [args] The arguments to pass to the function
* @param {Number} [delay] Pass a number to delay the call by a number of milliseconds.
*/
callback: function(callback, scope, args, delay){
if(Ext.isFunction(callback)){
args = args || [];
scope = scope || window;
if (delay) {
Ext.defer(callback, delay, scope, args);
} else {
callback.apply(scope, args);
}
}
},
/**
* Alias for {@link Ext.String#htmlEncode}.
* @inheritdoc Ext.String#htmlEncode
*/
htmlEncode : function(value) {
return Ext.String.htmlEncode(value);
},
/**
* Alias for {@link Ext.String#htmlDecode}.
* @inheritdoc Ext.String#htmlDecode
*/
htmlDecode : function(value) {
return Ext.String.htmlDecode(value);
},
/**
* Alias for {@link Ext.String#urlAppend}.
* @inheritdoc Ext.String#urlAppend
*/
urlAppend : function(url, s) {
return Ext.String.urlAppend(url, s);
}
});
Ext.ns = Ext.namespace;
/**
* @class Ext
*/
(function(){
/*
FF 3.6 - Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17
FF 4.0.1 - Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
FF 5.0 - Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0
IE6 - Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;)
IE7 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1;)
IE8 - Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)
IE9 - Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)
Chrome 11 - Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.60 Safari/534.24
Safari 5 - Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1
Opera 11.11 - Opera/9.80 (Windows NT 6.1; U; en) Presto/2.8.131 Version/11.11
*/
var check = function(regex){
return regex.test(Ext.userAgent);
};
nullLog = function () {};
nullLog.info = nullLog.warn = nullLog.error = Ext.emptyFn;
Ext.setVersion('extjs', '4.1.0');
Ext.apply(Ext, {
/**
* @property {Boolean} enableNestedListenerRemoval
* **Experimental.** True to cascade listener removal to child elements when an element
* is removed. Currently not optimized for performance.
*/
enableNestedListenerRemoval : false,
/**
* @property {Boolean} USE_NATIVE_JSON
* Indicates whether to use native browser parsing for JSON methods.
* This option is ignored if the browser does not support native JSON methods.
*
* **Note:** Native JSON methods will not work with objects that have functions.
* Also, property names must be quoted, otherwise the data will not parse.
*/
USE_NATIVE_JSON : false,
/**
* Utility method for returning a default value if the passed value is empty.
*
* The value is deemed to be empty if it is:
*
* - null
* - undefined
* - an empty array
* - a zero length string (Unless the `allowBlank` parameter is `true`)
*
* @param {Object} value The value to test
* @param {Object} defaultValue The value to return if the original value is empty
* @param {Boolean} [allowBlank=false] true to allow zero length strings to qualify as non-empty.
* @return {Object} value, if non-empty, else defaultValue
* @deprecated 4.0.0 Use {@link Ext#valueFrom} instead
*/
value : function(v, defaultValue, allowBlank){
return Ext.isEmpty(v, allowBlank) ? defaultValue : v;
},
/**
* Escapes the passed string for use in a regular expression.
* @param {String} str
* @return {String}
* @deprecated 4.0.0 Use {@link Ext.String#escapeRegex} instead
*/
escapeRe : function(s) {
return s.replace(/([-.*+?\^${}()|\[\]\/\\])/g, "\\$1");
},
/**
* Applies event listeners to elements by selectors when the document is ready.
* The event name is specified with an `@` suffix.
*
* Ext.addBehaviors({
* // add a listener for click on all anchors in element with id foo
* '#foo a@click' : function(e, t){
* // do something
* },
*
* // add the same listener to multiple selectors (separated by comma BEFORE the @)
* '#foo a, #bar span.some-class@mouseover' : function(){
* // do something
* }
* });
*
* @param {Object} obj The list of behaviors to apply
*/
addBehaviors : function(o){
if(!Ext.isReady){
Ext.onReady(function(){
Ext.addBehaviors(o);
});
} else {
var cache = {}, // simple cache for applying multiple behaviors to same selector does query multiple times
parts,
b,
s;
for (b in o) {
if ((parts = b.split('@'))[1]) { // for Object prototype breakers
s = parts[0];
if(!cache[s]){
cache[s] = Ext.select(s);
}
cache[s].on(parts[1], o[b]);
}
}
cache = null;
}
},
/**
* Copies a set of named properties fom the source object to the destination object.
*
* Example:
*
* ImageComponent = Ext.extend(Ext.Component, {
* initComponent: function() {
* this.autoEl = { tag: 'img' };
* MyComponent.superclass.initComponent.apply(this, arguments);
* this.initialBox = Ext.copyTo({}, this.initialConfig, 'x,y,width,height');
* }
* });
*
* Important note: To borrow class prototype methods, use {@link Ext.Base#borrow} instead.
*
* @param {Object} dest The destination object.
* @param {Object} source The source object.
* @param {String/String[]} names Either an Array of property names, or a comma-delimited list
* of property names to copy.
* @param {Boolean} [usePrototypeKeys] Defaults to false. Pass true to copy keys off of the
* prototype as well as the instance.
* @return {Object} The modified object.
*/
copyTo : function(dest, source, names, usePrototypeKeys){
if(typeof names == 'string'){
names = names.split(/[,;\s]/);
}
var n,
nLen = names.length,
name;
for(n = 0; n < nLen; n++) {
name = names[n];
if(usePrototypeKeys || source.hasOwnProperty(name)){
dest[name] = source[name];
}
}
return dest;
},
/**
* Attempts to destroy and then remove a set of named properties of the passed object.
* @param {Object} o The object (most likely a Component) who's properties you wish to destroy.
* @param {String...} args One or more names of the properties to destroy and remove from the object.
*/
destroyMembers : function(o){
for (var i = 1, a = arguments, len = a.length; i < len; i++) {
Ext.destroy(o[a[i]]);
delete o[a[i]];
}
},
/**
* Partitions the set into two sets: a true set and a false set.
*
* Example 1:
*
* Ext.partition([true, false, true, true, false]);
* // returns [[true, true, true], [false, false]]
*
* Example 2:
*
* Ext.partition(
* Ext.query("p"),
* function(val){
* return val.className == "class1"
* }
* );
* // true are those paragraph elements with a className of "class1",
* // false set are those that do not have that className.
*
* @param {Array/NodeList} arr The array to partition
* @param {Function} truth (optional) a function to determine truth.
* If this is omitted the element itself must be able to be evaluated for its truthfulness.
* @return {Array} [array of truish values, array of falsy values]
* @deprecated 4.0.0 Will be removed in the next major version
*/
partition : function(arr, truth){
var ret = [[],[]],
a, v,
aLen = arr.length;
for (a = 0; a < aLen; a++) {
v = arr[a];
ret[ (truth && truth(v, a, arr)) || (!truth && v) ? 0 : 1].push(v);
}
return ret;
},
/**
* Invokes a method on each item in an Array.
*
* Example:
*
* Ext.invoke(Ext.query("p"), "getAttribute", "id");
* // [el1.getAttribute("id"), el2.getAttribute("id"), ..., elN.getAttribute("id")]
*
* @param {Array/NodeList} arr The Array of items to invoke the method on.
* @param {String} methodName The method name to invoke.
* @param {Object...} args Arguments to send into the method invocation.
* @return {Array} The results of invoking the method on each item in the array.
* @deprecated 4.0.0 Will be removed in the next major version
*/
invoke : function(arr, methodName){
var ret = [],
args = Array.prototype.slice.call(arguments, 2),
a, v,
aLen = arr.length;
for (a = 0; a < aLen; a++) {
v = arr[a];
if (v && typeof v[methodName] == 'function') {
ret.push(v[methodName].apply(v, args));
} else {
ret.push(undefined);
}
}
return ret;
},
/**
* Zips N sets together.
*
* Example 1:
*
* Ext.zip([1,2,3],[4,5,6]); // [[1,4],[2,5],[3,6]]
*
* Example 2:
*
* Ext.zip(
* [ "+", "-", "+"],
* [ 12, 10, 22],
* [ 43, 15, 96],
* function(a, b, c){
* return "$" + a + "" + b + "." + c
* }
* ); // ["$+12.43", "$-10.15", "$+22.96"]
*
* @param {Array/NodeList...} arr This argument may be repeated. Array(s)
* to contribute values.
* @param {Function} zipper (optional) The last item in the argument list.
* This will drive how the items are zipped together.
* @return {Array} The zipped set.
* @deprecated 4.0.0 Will be removed in the next major version
*/
zip : function(){
var parts = Ext.partition(arguments, function( val ){ return typeof val != 'function'; }),
arrs = parts[0],
fn = parts[1][0],
len = Ext.max(Ext.pluck(arrs, "length")),
ret = [],
i,
j,
aLen;
for (i = 0; i < len; i++) {
ret[i] = [];
if(fn){
ret[i] = fn.apply(fn, Ext.pluck(arrs, i));
}else{
for (j = 0, aLen = arrs.length; j < aLen; j++){
ret[i].push( arrs[j][i] );
}
}
}
return ret;
},
/**
* Turns an array into a sentence, joined by a specified connector - e.g.:
*
* Ext.toSentence(['Adama', 'Tigh', 'Roslin']); //'Adama, Tigh and Roslin'
* Ext.toSentence(['Adama', 'Tigh', 'Roslin'], 'or'); //'Adama, Tigh or Roslin'
*
* @param {String[]} items The array to create a sentence from
* @param {String} connector The string to use to connect the last two words.
* Usually 'and' or 'or' - defaults to 'and'.
* @return {String} The sentence string
* @deprecated 4.0.0 Will be removed in the next major version
*/
toSentence: function(items, connector) {
var length = items.length,
head,
tail;
if (length <= 1) {
return items[0];
} else {
head = items.slice(0, length - 1);
tail = items[length - 1];
return Ext.util.Format.format("{0} {1} {2}", head.join(", "), connector || 'and', tail);
}
}
});
}());
/**
* Loads Ext.app.Application class and starts it up with given configuration after the page is ready.
*
* See Ext.app.Application for details.
*
* @param {Object} config
*/
Ext.application = function(config) {
Ext.require('Ext.app.Application');
Ext.onReady(function() {
new Ext.app.Application(config);
});
};