UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

1,502 lines (1,249 loc) 154 kB
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(1047); /***/ }), /***/ 3: /***/ (function(module, exports) { module.exports = function() { throw new Error("define cannot be used indirect"); }; /***/ }), /***/ 1005: /***/ (function(module, exports) { module.exports = require("jquery"); /***/ }), /***/ 1047: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(jQuery) {(function(f, define){ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1005)], __WEBPACK_AMD_DEFINE_FACTORY__ = (f), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); })(function(){ var __meta__ = { // jshint ignore:line id: "core", name: "Core", category: "framework", description: "The core of the Kendo framework." }; /*jshint eqnull: true, loopfunc: true, evil: true, boss: true, freeze: false*/ (function($, window, undefined) { var kendo = window.kendo = window.kendo || { cultures: {} }, extend = $.extend, each = $.each, isArray = $.isArray, proxy = $.proxy, noop = $.noop, math = Math, Template, JSON = window.JSON || {}, support = {}, percentRegExp = /%/, formatRegExp = /\{(\d+)(:[^\}]+)?\}/g, boxShadowRegExp = /(\d+(?:\.?)\d*)px\s*(\d+(?:\.?)\d*)px\s*(\d+(?:\.?)\d*)px\s*(\d+)?/i, numberRegExp = /^(\+|-?)\d+(\.?)\d*$/, FUNCTION = "function", STRING = "string", NUMBER = "number", OBJECT = "object", NULL = "null", BOOLEAN = "boolean", UNDEFINED = "undefined", getterCache = {}, setterCache = {}, slice = [].slice, // avoid extending the depricated properties in latest verions of jQuery noDepricateExtend = function() { var src, copyIsArray, copy, name, options, clone, target = arguments[ 0 ] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; // skip the boolean and the target target = arguments[ i ] || {}; i++; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { target = {}; } // extend jQuery itself if only one argument is passed if ( i === length ) { target = this; i--; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( ( options = arguments[ i ] ) != null ) { // Extend the base object for ( name in options ) { // filters, concat and : properties are depricated in the jQuery 3.3.0 // accessing these properties throw a warning when jQuery migrate is included if (name == "filters" || name == "concat" || name == ":") { continue; } src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject( copy ) || ( copyIsArray = jQuery.isArray( copy ) ) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray( src ) ? src : []; } else { clone = src && jQuery.isPlainObject( src ) ? src : {}; } // Never move original objects, clone them target[ name ] = noDepricateExtend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; kendo.version = "2019.2.703".replace(/^\s+|\s+$/g, ''); function Class() {} Class.extend = function(proto) { var base = function() {}, member, that = this, subclass = proto && proto.init ? proto.init : function () { that.apply(this, arguments); }, fn; base.prototype = that.prototype; fn = subclass.fn = subclass.prototype = new base(); for (member in proto) { if (proto[member] != null && proto[member].constructor === Object) { // Merge object members fn[member] = extend(true, {}, base.prototype[member], proto[member]); } else { fn[member] = proto[member]; } } fn.constructor = subclass; subclass.extend = that.extend; return subclass; }; Class.prototype._initOptions = function(options) { this.options = deepExtend({}, this.options, options); }; var isFunction = kendo.isFunction = function(fn) { return typeof fn === "function"; }; var preventDefault = function() { this._defaultPrevented = true; }; var isDefaultPrevented = function() { return this._defaultPrevented === true; }; var Observable = Class.extend({ init: function() { this._events = {}; }, bind: function(eventName, handlers, one) { var that = this, idx, eventNames = typeof eventName === STRING ? [eventName] : eventName, length, original, handler, handlersIsFunction = typeof handlers === FUNCTION, events; if (handlers === undefined) { for (idx in eventName) { that.bind(idx, eventName[idx]); } return that; } for (idx = 0, length = eventNames.length; idx < length; idx++) { eventName = eventNames[idx]; handler = handlersIsFunction ? handlers : handlers[eventName]; if (handler) { if (one) { original = handler; handler = function() { that.unbind(eventName, handler); original.apply(that, arguments); }; handler.original = original; } events = that._events[eventName] = that._events[eventName] || []; events.push(handler); } } return that; }, one: function(eventNames, handlers) { return this.bind(eventNames, handlers, true); }, first: function(eventName, handlers) { var that = this, idx, eventNames = typeof eventName === STRING ? [eventName] : eventName, length, handler, handlersIsFunction = typeof handlers === FUNCTION, events; for (idx = 0, length = eventNames.length; idx < length; idx++) { eventName = eventNames[idx]; handler = handlersIsFunction ? handlers : handlers[eventName]; if (handler) { events = that._events[eventName] = that._events[eventName] || []; events.unshift(handler); } } return that; }, trigger: function(eventName, e) { var that = this, events = that._events[eventName], idx, length; if (events) { e = e || {}; e.sender = that; e._defaultPrevented = false; e.preventDefault = preventDefault; e.isDefaultPrevented = isDefaultPrevented; events = events.slice(); for (idx = 0, length = events.length; idx < length; idx++) { events[idx].call(that, e); } return e._defaultPrevented === true; } return false; }, unbind: function(eventName, handler) { var that = this, events = that._events[eventName], idx; if (eventName === undefined) { that._events = {}; } else if (events) { if (handler) { for (idx = events.length - 1; idx >= 0; idx--) { if (events[idx] === handler || events[idx].original === handler) { events.splice(idx, 1); } } } else { that._events[eventName] = []; } } return that; } }); function compilePart(part, stringPart) { if (stringPart) { return "'" + part.split("'").join("\\'") .split('\\"').join('\\\\\\"') .replace(/\n/g, "\\n") .replace(/\r/g, "\\r") .replace(/\t/g, "\\t") + "'"; } else { var first = part.charAt(0), rest = part.substring(1); if (first === "=") { return "+(" + rest + ")+"; } else if (first === ":") { return "+$kendoHtmlEncode(" + rest + ")+"; } else { return ";" + part + ";$kendoOutput+="; } } } var argumentNameRegExp = /^\w+/, encodeRegExp = /\$\{([^}]*)\}/g, escapedCurlyRegExp = /\\\}/g, curlyRegExp = /__CURLY__/g, escapedSharpRegExp = /\\#/g, sharpRegExp = /__SHARP__/g, zeros = ["", "0", "00", "000", "0000"]; Template = { paramName: "data", // name of the parameter of the generated template useWithBlock: true, // whether to wrap the template in a with() block render: function(template, data) { var idx, length, html = ""; for (idx = 0, length = data.length; idx < length; idx++) { html += template(data[idx]); } return html; }, compile: function(template, options) { var settings = extend({}, this, options), paramName = settings.paramName, argumentName = paramName.match(argumentNameRegExp)[0], useWithBlock = settings.useWithBlock, functionBody = "var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;", fn, parts, idx; if (isFunction(template)) { return template; } functionBody += useWithBlock ? "with(" + paramName + "){" : ""; functionBody += "$kendoOutput="; parts = template .replace(escapedCurlyRegExp, "__CURLY__") .replace(encodeRegExp, "#=$kendoHtmlEncode($1)#") .replace(curlyRegExp, "}") .replace(escapedSharpRegExp, "__SHARP__") .split("#"); for (idx = 0; idx < parts.length; idx ++) { functionBody += compilePart(parts[idx], idx % 2 === 0); } functionBody += useWithBlock ? ";}" : ";"; functionBody += "return $kendoOutput;"; functionBody = functionBody.replace(sharpRegExp, "#"); try { fn = new Function(argumentName, functionBody); fn._slotCount = Math.floor(parts.length / 2); return fn; } catch(e) { throw new Error(kendo.format("Invalid template:'{0}' Generated code:'{1}'", template, functionBody)); } } }; function pad(number, digits, end) { number = number + ""; digits = digits || 2; end = digits - number.length; if (end) { return zeros[digits].substring(0, end) + number; } return number; } //JSON stringify (function() { var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = { "\b": "\\b", "\t": "\\t", "\n": "\\n", "\f": "\\f", "\r": "\\r", "\"" : '\\"', "\\": "\\\\" }, rep, toString = {}.toString; if (typeof Date.prototype.toJSON !== FUNCTION) { Date.prototype.toJSON = function () { var that = this; return isFinite(that.valueOf()) ? pad(that.getUTCFullYear(), 4) + "-" + pad(that.getUTCMonth() + 1) + "-" + pad(that.getUTCDate()) + "T" + pad(that.getUTCHours()) + ":" + pad(that.getUTCMinutes()) + ":" + pad(that.getUTCSeconds()) + "Z" : null; }; String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function () { return this.valueOf(); }; } function quote(string) { escapable.lastIndex = 0; return escapable.test(string) ? "\"" + string.replace(escapable, function (a) { var c = meta[a]; return typeof c === STRING ? c : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4); }) + "\"" : "\"" + string + "\""; } function str(key, holder) { var i, k, v, length, mind = gap, partial, value = holder[key], type; if (value && typeof value === OBJECT && typeof value.toJSON === FUNCTION) { value = value.toJSON(key); } if (typeof rep === FUNCTION) { value = rep.call(holder, key, value); } type = typeof value; if (type === STRING) { return quote(value); } else if (type === NUMBER) { return isFinite(value) ? String(value) : NULL; } else if (type === BOOLEAN || type === NULL) { return String(value); } else if (type === OBJECT) { if (!value) { return NULL; } gap += indent; partial = []; if (toString.apply(value) === "[object Array]") { length = value.length; for (i = 0; i < length; i++) { partial[i] = str(i, value) || NULL; } v = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]"; gap = mind; return v; } if (rep && typeof rep === OBJECT) { length = rep.length; for (i = 0; i < length; i++) { if (typeof rep[i] === STRING) { k = rep[i]; v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ": " : ":") + v); } } } } else { for (k in value) { if (Object.hasOwnProperty.call(value, k)) { v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ": " : ":") + v); } } } } v = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}"; gap = mind; return v; } } if (typeof JSON.stringify !== FUNCTION) { JSON.stringify = function (value, replacer, space) { var i; gap = ""; indent = ""; if (typeof space === NUMBER) { for (i = 0; i < space; i += 1) { indent += " "; } } else if (typeof space === STRING) { indent = space; } rep = replacer; if (replacer && typeof replacer !== FUNCTION && (typeof replacer !== OBJECT || typeof replacer.length !== NUMBER)) { throw new Error("JSON.stringify"); } return str("", {"": value}); }; } })(); // Date and Number formatting (function() { var dateFormatRegExp = /dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|HH|H|hh|h|mm|m|fff|ff|f|tt|ss|s|zzz|zz|z|"[^"]*"|'[^']*'/g, standardFormatRegExp = /^(n|c|p|e)(\d*)$/i, literalRegExp = /(\\.)|(['][^']*[']?)|(["][^"]*["]?)/g, commaRegExp = /\,/g, EMPTY = "", POINT = ".", COMMA = ",", SHARP = "#", ZERO = "0", PLACEHOLDER = "??", EN = "en-US", objectToString = {}.toString; //cultures kendo.cultures["en-US"] = { name: EN, numberFormat: { pattern: ["-n"], decimals: 2, ",": ",", ".": ".", groupSize: [3], percent: { pattern: ["-n %", "n %"], decimals: 2, ",": ",", ".": ".", groupSize: [3], symbol: "%" }, currency: { name: "US Dollar", abbr: "USD", pattern: ["($n)", "$n"], decimals: 2, ",": ",", ".": ".", groupSize: [3], symbol: "$" } }, calendars: { standard: { days: { names: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], namesAbbr: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], namesShort: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ] }, months: { names: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], namesAbbr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] }, AM: [ "AM", "am", "AM" ], PM: [ "PM", "pm", "PM" ], patterns: { d: "M/d/yyyy", D: "dddd, MMMM dd, yyyy", F: "dddd, MMMM dd, yyyy h:mm:ss tt", g: "M/d/yyyy h:mm tt", G: "M/d/yyyy h:mm:ss tt", m: "MMMM dd", M: "MMMM dd", s: "yyyy'-'MM'-'ddTHH':'mm':'ss", t: "h:mm tt", T: "h:mm:ss tt", u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'", y: "MMMM, yyyy", Y: "MMMM, yyyy" }, "/": "/", ":": ":", firstDay: 0, twoDigitYearMax: 2029 } } }; function findCulture(culture) { if (culture) { if (culture.numberFormat) { return culture; } if (typeof culture === STRING) { var cultures = kendo.cultures; return cultures[culture] || cultures[culture.split("-")[0]] || null; } return null; } return null; } function getCulture(culture) { if (culture) { culture = findCulture(culture); } return culture || kendo.cultures.current; } kendo.culture = function(cultureName) { var cultures = kendo.cultures, culture; if (cultureName !== undefined) { culture = findCulture(cultureName) || cultures[EN]; culture.calendar = culture.calendars.standard; cultures.current = culture; } else { return cultures.current; } }; kendo.findCulture = findCulture; kendo.getCulture = getCulture; //set current culture to en-US. kendo.culture(EN); function formatDate(date, format, culture) { culture = getCulture(culture); var calendar = culture.calendars.standard, days = calendar.days, months = calendar.months; format = calendar.patterns[format] || format; return format.replace(dateFormatRegExp, function (match) { var minutes; var result; var sign; if (match === "d") { result = date.getDate(); } else if (match === "dd") { result = pad(date.getDate()); } else if (match === "ddd") { result = days.namesAbbr[date.getDay()]; } else if (match === "dddd") { result = days.names[date.getDay()]; } else if (match === "M") { result = date.getMonth() + 1; } else if (match === "MM") { result = pad(date.getMonth() + 1); } else if (match === "MMM") { result = months.namesAbbr[date.getMonth()]; } else if (match === "MMMM") { result = months.names[date.getMonth()]; } else if (match === "yy") { result = pad(date.getFullYear() % 100); } else if (match === "yyyy") { result = pad(date.getFullYear(), 4); } else if (match === "h" ) { result = date.getHours() % 12 || 12; } else if (match === "hh") { result = pad(date.getHours() % 12 || 12); } else if (match === "H") { result = date.getHours(); } else if (match === "HH") { result = pad(date.getHours()); } else if (match === "m") { result = date.getMinutes(); } else if (match === "mm") { result = pad(date.getMinutes()); } else if (match === "s") { result = date.getSeconds(); } else if (match === "ss") { result = pad(date.getSeconds()); } else if (match === "f") { result = math.floor(date.getMilliseconds() / 100); } else if (match === "ff") { result = date.getMilliseconds(); if (result > 99) { result = math.floor(result / 10); } result = pad(result); } else if (match === "fff") { result = pad(date.getMilliseconds(), 3); } else if (match === "tt") { result = date.getHours() < 12 ? calendar.AM[0] : calendar.PM[0]; } else if (match === "zzz") { minutes = date.getTimezoneOffset(); sign = minutes < 0; result = math.abs(minutes / 60).toString().split(".")[0]; minutes = math.abs(minutes) - (result * 60); result = (sign ? "+" : "-") + pad(result); result += ":" + pad(minutes); } else if (match === "zz" || match === "z") { result = date.getTimezoneOffset() / 60; sign = result < 0; result = math.abs(result).toString().split(".")[0]; result = (sign ? "+" : "-") + (match === "zz" ? pad(result) : result); } return result !== undefined ? result : match.slice(1, match.length - 1); }); } //number formatting function formatNumber(number, format, culture) { culture = getCulture(culture); var numberFormat = culture.numberFormat, decimal = numberFormat[POINT], precision = numberFormat.decimals, pattern = numberFormat.pattern[0], literals = [], symbol, isCurrency, isPercent, customPrecision, formatAndPrecision, negative = number < 0, integer, fraction, integerLength, fractionLength, replacement = EMPTY, value = EMPTY, idx, length, ch, hasGroup, hasNegativeFormat, decimalIndex, sharpIndex, zeroIndex, hasZero, hasSharp, percentIndex, currencyIndex, startZeroIndex, start = -1, end; //return empty string if no number if (number === undefined) { return EMPTY; } if (!isFinite(number)) { return number; } //if no format then return number.toString() or number.toLocaleString() if culture.name is not defined if (!format) { return culture.name.length ? number.toLocaleString() : number.toString(); } formatAndPrecision = standardFormatRegExp.exec(format); // standard formatting if (formatAndPrecision) { format = formatAndPrecision[1].toLowerCase(); isCurrency = format === "c"; isPercent = format === "p"; if (isCurrency || isPercent) { //get specific number format information if format is currency or percent numberFormat = isCurrency ? numberFormat.currency : numberFormat.percent; decimal = numberFormat[POINT]; precision = numberFormat.decimals; symbol = numberFormat.symbol; pattern = numberFormat.pattern[negative ? 0 : 1]; } customPrecision = formatAndPrecision[2]; if (customPrecision) { precision = +customPrecision; } //return number in exponential format if (format === "e") { var exp = customPrecision ? number.toExponential(precision) : number.toExponential(); // toExponential() and toExponential(undefined) differ in FF #653438. return exp.replace(POINT, numberFormat[POINT]); } // multiply if format is percent if (isPercent) { number *= 100; } number = round(number, precision); negative = number < 0; number = number.split(POINT); integer = number[0]; fraction = number[1]; //exclude "-" if number is negative. if (negative) { integer = integer.substring(1); } value = groupInteger(integer, 0, integer.length, numberFormat); if (fraction) { value += decimal + fraction; } if (format === "n" && !negative) { return value; } number = EMPTY; for (idx = 0, length = pattern.length; idx < length; idx++) { ch = pattern.charAt(idx); if (ch === "n") { number += value; } else if (ch === "$" || ch === "%") { number += symbol; } else { number += ch; } } return number; } //custom formatting // //separate format by sections. if (format.indexOf("'") > -1 || format.indexOf("\"") > -1 || format.indexOf("\\") > -1) { format = format.replace(literalRegExp, function (match) { var quoteChar = match.charAt(0).replace("\\", ""), literal = match.slice(1).replace(quoteChar, ""); literals.push(literal); return PLACEHOLDER; }); } format = format.split(";"); if (negative && format[1]) { //get negative format format = format[1]; hasNegativeFormat = true; } else if (number === 0 && format[2]) { //format for zeros format = format[2]; if (format.indexOf(SHARP) == -1 && format.indexOf(ZERO) == -1) { //return format if it is string constant. return format; } } else { format = format[0]; } percentIndex = format.indexOf("%"); currencyIndex = format.indexOf("$"); isPercent = percentIndex != -1; isCurrency = currencyIndex != -1; //multiply number if the format has percent if (isPercent) { number *= 100; } if (isCurrency && format[currencyIndex - 1] === "\\") { format = format.split("\\").join(""); isCurrency = false; } if (isCurrency || isPercent) { //get specific number format information if format is currency or percent numberFormat = isCurrency ? numberFormat.currency : numberFormat.percent; decimal = numberFormat[POINT]; precision = numberFormat.decimals; symbol = numberFormat.symbol; } hasGroup = format.indexOf(COMMA) > -1; if (hasGroup) { format = format.replace(commaRegExp, EMPTY); } decimalIndex = format.indexOf(POINT); length = format.length; if (decimalIndex != -1) { fraction = number.toString().split("e"); if (fraction[1]) { fraction = round(number, Math.abs(fraction[1])); } else { fraction = fraction[0]; } fraction = fraction.split(POINT)[1] || EMPTY; zeroIndex = format.lastIndexOf(ZERO) - decimalIndex; sharpIndex = format.lastIndexOf(SHARP) - decimalIndex; hasZero = zeroIndex > -1; hasSharp = sharpIndex > -1; idx = fraction.length; if (!hasZero && !hasSharp) { format = format.substring(0, decimalIndex) + format.substring(decimalIndex + 1); length = format.length; decimalIndex = -1; idx = 0; } if (hasZero && zeroIndex > sharpIndex) { idx = zeroIndex; } else if (sharpIndex > zeroIndex) { if (hasSharp && idx > sharpIndex) { var rounded = round(number, sharpIndex, negative); while (rounded.charAt(rounded.length - 1) === ZERO && sharpIndex > 0 && sharpIndex > zeroIndex) { sharpIndex--; rounded = round(number, sharpIndex, negative); } idx = sharpIndex; } else if (hasZero && idx < zeroIndex) { idx = zeroIndex; } } } number = round(number, idx, negative); sharpIndex = format.indexOf(SHARP); startZeroIndex = zeroIndex = format.indexOf(ZERO); //define the index of the first digit placeholder if (sharpIndex == -1 && zeroIndex != -1) { start = zeroIndex; } else if (sharpIndex != -1 && zeroIndex == -1) { start = sharpIndex; } else { start = sharpIndex > zeroIndex ? zeroIndex : sharpIndex; } sharpIndex = format.lastIndexOf(SHARP); zeroIndex = format.lastIndexOf(ZERO); //define the index of the last digit placeholder if (sharpIndex == -1 && zeroIndex != -1) { end = zeroIndex; } else if (sharpIndex != -1 && zeroIndex == -1) { end = sharpIndex; } else { end = sharpIndex > zeroIndex ? sharpIndex : zeroIndex; } if (start == length) { end = start; } if (start != -1) { value = number.toString().split(POINT); integer = value[0]; fraction = value[1] || EMPTY; integerLength = integer.length; fractionLength = fraction.length; if (negative && (number * -1) >= 0) { negative = false; } number = format.substring(0, start); if (negative && !hasNegativeFormat) { number += "-"; } for (idx = start; idx < length; idx++) { ch = format.charAt(idx); if (decimalIndex == -1) { if (end - idx < integerLength) { number += integer; break; } } else { if (zeroIndex != -1 && zeroIndex < idx) { replacement = EMPTY; } if ((decimalIndex - idx) <= integerLength && decimalIndex - idx > -1) { number += integer; idx = decimalIndex; } if (decimalIndex === idx) { number += (fraction ? decimal : EMPTY) + fraction; idx += end - decimalIndex + 1; continue; } } if (ch === ZERO) { number += ch; replacement = ch; } else if (ch === SHARP) { number += replacement; } } if (hasGroup) { number = groupInteger(number, start + (negative && !hasNegativeFormat ? 1 : 0), Math.max(end, (integerLength + start)), numberFormat); } if (end >= start) { number += format.substring(end + 1); } //replace symbol placeholders if (isCurrency || isPercent) { value = EMPTY; for (idx = 0, length = number.length; idx < length; idx++) { ch = number.charAt(idx); value += (ch === "$" || ch === "%") ? symbol : ch; } number = value; } length = literals.length; if (length) { for (idx = 0; idx < length; idx++) { number = number.replace(PLACEHOLDER, literals[idx]); } } } return number; } var groupInteger = function(number, start, end, numberFormat) { var decimalIndex = number.indexOf(numberFormat[POINT]); var groupSizes = numberFormat.groupSize.slice(); var groupSize = groupSizes.shift(); var integer, integerLength; var idx, parts, value; var newGroupSize; end = decimalIndex !== -1 ? decimalIndex : end + 1; integer = number.substring(start, end); integerLength = integer.length; if (integerLength >= groupSize) { idx = integerLength; parts = []; while (idx > -1) { value = integer.substring(idx - groupSize, idx); if (value) { parts.push(value); } idx -= groupSize; newGroupSize = groupSizes.shift(); groupSize = newGroupSize !== undefined ? newGroupSize : groupSize; if (groupSize === 0) { if (idx > 0) { parts.push(integer.substring(0, idx)); } break; } } integer = parts.reverse().join(numberFormat[COMMA]); number = number.substring(0, start) + integer + number.substring(end); } return number; }; var round = function(value, precision, negative) { precision = precision || 0; value = value.toString().split('e'); value = Math.round(+(value[0] + 'e' + (value[1] ? (+value[1] + precision) : precision))); if (negative) { value = -value; } value = value.toString().split('e'); value = +(value[0] + 'e' + (value[1] ? (+value[1] - precision) : -precision)); return value.toFixed(Math.min(precision, 20)); }; var toString = function(value, fmt, culture) { if (fmt) { if (objectToString.call(value) === "[object Date]") { return formatDate(value, fmt, culture); } else if (typeof value === NUMBER) { return formatNumber(value, fmt, culture); } } return value !== undefined ? value : ""; }; kendo.format = function(fmt) { var values = arguments; return fmt.replace(formatRegExp, function(match, index, placeholderFormat) { var value = values[parseInt(index, 10) + 1]; return toString(value, placeholderFormat ? placeholderFormat.substring(1) : ""); }); }; kendo._extractFormat = function (format) { if (format.slice(0,3) === "{0:") { format = format.slice(3, format.length - 1); } return format; }; kendo._activeElement = function() { try { return document.activeElement; } catch(e) { return document.documentElement.activeElement; } }; kendo._round = round; kendo._outerWidth = function (element, includeMargin) { return $(element).outerWidth(includeMargin || false) || 0; }; kendo._outerHeight = function (element, includeMargin) { return $(element).outerHeight(includeMargin || false) || 0; }; kendo.toString = toString; })(); (function() { var nonBreakingSpaceRegExp = /\u00A0/g, exponentRegExp = /[eE][\-+]?[0-9]+/, shortTimeZoneRegExp = /[+|\-]\d{1,2}/, longTimeZoneRegExp = /[+|\-]\d{1,2}:?\d{2}/, dateRegExp = /^\/Date\((.*?)\)\/$/, offsetRegExp = /[+-]\d*/, FORMATS_SEQUENCE = [ [], [ "G", "g", "F" ], [ "D", "d", "y", "m", "T", "t" ] ], STANDARD_FORMATS = [ [ "yyyy-MM-ddTHH:mm:ss.fffffffzzz", "yyyy-MM-ddTHH:mm:ss.fffffff", "yyyy-MM-ddTHH:mm:ss.fffzzz", "yyyy-MM-ddTHH:mm:ss.fff", "ddd MMM dd yyyy HH:mm:ss", "yyyy-MM-ddTHH:mm:sszzz", "yyyy-MM-ddTHH:mmzzz", "yyyy-MM-ddTHH:mmzz", "yyyy-MM-ddTHH:mm:ss", "yyyy-MM-dd HH:mm:ss", "yyyy/MM/dd HH:mm:ss" ], [ "yyyy-MM-ddTHH:mm", "yyyy-MM-dd HH:mm", "yyyy/MM/dd HH:mm" ], [ "yyyy/MM/dd", "yyyy-MM-dd", "HH:mm:ss", "HH:mm" ] ], numberRegExp = { 2: /^\d{1,2}/, 3: /^\d{1,3}/, 4: /^\d{4}/ }, objectToString = {}.toString; function outOfRange(value, start, end) { return !(value >= start && value <= end); } function designatorPredicate(designator) { return designator.charAt(0); } function mapDesignators(designators) { return $.map(designators, designatorPredicate); } //if date's day is different than the typed one - adjust function adjustDST(date, hours) { if (!hours && date.getHours() === 23) { date.setHours(date.getHours() + 2); } } function lowerArray(data) { var idx = 0, length = data.length, array = []; for (; idx < length; idx++) { array[idx] = (data[idx] + "").toLowerCase(); } return array; } function lowerLocalInfo(localInfo) { var newLocalInfo = {}, property; for (property in localInfo) { newLocalInfo[property] = lowerArray(localInfo[property]); } return newLocalInfo; } function parseExact(value, format, culture, strict) { if (!value) { return null; } var lookAhead = function (match) { var i = 0; while (format[idx] === match) { i++; idx++; } if (i > 0) { idx -= 1; } return i; }, getNumber = function(size) { var rg = numberRegExp[size] || new RegExp('^\\d{1,' + size + '}'), match = value.substr(valueIdx, size).match(rg); if (match) { match = match[0]; valueIdx += match.length; return parseInt(match, 10); } return null; }, getIndexByName = function (names, lower) { var i = 0, length = names.length, name, nameLength, matchLength = 0, matchIdx = 0, subValue; for (; i < length; i++) { name = names[i]; nameLength = name.length; subValue = value.substr(valueIdx, nameLength); if (lower) { subValue = subValue.toLowerCase(); } if (subValue == name && nameLength > matchLength) { matchLength = nameLength; matchIdx = i; } } if (matchLength) { valueIdx += matchLength; return matchIdx + 1; } return null; }, checkLiteral = function() { var result = false; if (value.charAt(valueIdx) === format[idx]) { valueIdx++; result = true; } return result; }, calendar = culture.calendars.standard, year = null, month = null, day = null, hours = null, minutes = null, seconds = null, milliseconds = null, idx = 0, valueIdx = 0, literal = false, date = new Date(), twoDigitYearMax = calendar.twoDigitYearMax || 2029, defaultYear = date.getFullYear(), ch, count, length, pattern, pmHour, UTC, matches, amDesignators, pmDesignators, hoursOffset, minutesOffset, hasTime, match; if (!format) { format = "d"; //shord date format } //if format is part of the patterns get real format pattern = calendar.patterns[format]; if (pattern) { format = pattern; } format = format.split(""); length = format.length; for (; idx < length; idx++) { ch = format[idx]; if (literal) { if (ch === "'") { literal = false; } else { checkLiteral(); } } else { if (ch === "d") { count = lookAhead("d"); if (!calendar._lowerDays) { calendar._lowerDays = lowerLocalInfo(calendar.days); } if (day !== null && count > 2) { continue; } day = count < 3 ? getNumber(2) : getIndexByName(calendar._lowerDays[count == 3 ? "namesAbbr" : "names"], true); if (day === null || outOfRange(day, 1, 31)) { return null; } } else if (ch === "M") { count = lookAhead("M"); if (!calendar._lowerMonths) { calendar._lowerMonths = lowerLocalInfo(calendar.months); } month = count < 3 ? getNumber(2) : getIndexByName(calendar._lowerMonths[count == 3 ? 'namesAbbr' : 'names'], true); if (month === null || outOfRange(month, 1, 12)) { return null; } month -= 1; //because month is zero based } else if (ch === "y") { count = lookAhead("y"); year = getNumber(count); if (year === null) { return null; } if (count == 2) { if (typeof twoDigitYearMax === "string") { twoDigitYearMax = defaultYear + parseInt(twoDigitYearMax, 10); } year = (defaultYear - defaultYear % 100) + year; if (year > twoDigitYearMax) { year -= 100; } } } else if (ch === "h" ) { lookAhead("h"); hours = getNumber(2); if (hours == 12) { hours = 0; } if (hours === null || outOfRange(hours, 0, 11)) { return null; } } else if (ch === "H") { lookAhead("H"); hours = getNumber(2); if (hours === null || outOfRange(hours, 0, 23)) { return null; } } else if (ch === "m") { lookAhead("m"); minutes = getNumber(2); if (minutes === null || outOfRange(minutes, 0, 59)) { return null; } } else if (ch === "s") { lookAhead("s"); seconds = getNumber(2); if (seconds === null || outOfRange(seconds, 0, 59)) { r