Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #2 from atorkhov/master

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

0 notes on commit 97a0153

Please sign in to comment.
Something went wrong with that request. Please try again.