").html(element).contents();
if (1 === $element.length) {
if ($element.is("script")) {
$element = normalizeTemplateElement($element.html())
} else {
if ($element.is("table")) {
$element = $element.contents()
}
}
}
return $element
};
var toggleAttr = function($target, attr, value) {
value ? $target.attr(attr, value) : $target.removeAttr(attr)
};
var clipboardText = function(event, text) {
var clipboard = event.originalEvent && event.originalEvent.clipboardData || window.clipboardData;
if (1 === arguments.length) {
return clipboard && clipboard.getData("Text")
}
clipboard && clipboard.setData("Text", text)
};
exports.resetActiveElement = resetActiveElement;
exports.createMarkupFromString = createMarkupFromString;
exports.triggerShownEvent = triggerVisibilityChangeEvent("dxshown");
exports.triggerHidingEvent = triggerVisibilityChangeEvent("dxhiding");
exports.triggerResizeEvent = triggerVisibilityChangeEvent("dxresize");
exports.getElementOptions = getElementOptions;
exports.createComponents = createComponents;
exports.normalizeTemplateElement = normalizeTemplateElement;
exports.clearSelection = clearSelection;
exports.getSelection = getSelection;
exports.uniqueId = uniqueId;
exports.closestCommonParent = closestCommonParent;
exports.clipboardText = clipboardText;
exports.toggleAttr = toggleAttr
},
/*!*************************************!*\
!*** ./Scripts/core/utils/queue.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
errors = __webpack_require__( /*! ../errors */ 17);
function createQueue(discardPendingTasks) {
var _tasks = [],
_busy = false;
function exec() {
while (_tasks.length) {
_busy = true;
var task = _tasks.shift(),
result = task();
if (void 0 === result) {
continue
}
if (result.then) {
$.when(result).always(exec);
return
}
throw errors.Error("E0015")
}
_busy = false
}
function add(task, removeTaskCallback) {
if (!discardPendingTasks) {
_tasks.push(task)
} else {
if (_tasks[0] && removeTaskCallback) {
removeTaskCallback(_tasks[0])
}
_tasks = [task]
}
if (!_busy) {
exec()
}
}
function busy() {
return _busy
}
return {
add: add,
busy: busy
}
}
exports.create = createQueue;
exports.enqueue = createQueue().add
},
/*!************************************!*\
!*** ./Scripts/core/utils/date.js ***!
\************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
commonUtils = __webpack_require__( /*! ./common */ 14),
inflector = __webpack_require__( /*! ./inflector */ 49),
isObject = commonUtils.isObject,
isString = commonUtils.isString,
isDate = commonUtils.isDate,
isDefined = commonUtils.isDefined,
camelize = inflector.camelize;
var dateUnitIntervals = ["millisecond", "second", "minute", "hour", "day", "week", "month", "quarter", "year"];
var toMilliseconds = function(value) {
switch (value) {
case "millisecond":
return 1;
case "second":
return 1e3 * toMilliseconds("millisecond");
case "minute":
return 60 * toMilliseconds("second");
case "hour":
return 60 * toMilliseconds("minute");
case "day":
return 24 * toMilliseconds("hour");
case "week":
return 7 * toMilliseconds("day");
case "month":
return 30 * toMilliseconds("day");
case "quarter":
return 3 * toMilliseconds("month");
case "year":
return 365 * toMilliseconds("day");
default:
return 0
}
};
var getDatesInterval = function(startDate, endDate, intervalUnit) {
var delta = endDate.getTime() - startDate.getTime(),
millisecondCount = toMilliseconds(intervalUnit) || 1;
return Math.floor(delta / millisecondCount)
};
var getNextDateUnit = function(unit, withWeeks) {
var interval = getDateUnitInterval(unit);
switch (interval) {
case "millisecond":
return "second";
case "second":
return "minute";
case "minute":
return "hour";
case "hour":
return "day";
case "day":
return withWeeks ? "week" : "month";
case "week":
return "month";
case "month":
return "quarter";
case "quarter":
return "year";
case "year":
return "year";
default:
return 0
}
};
var convertMillisecondsToDateUnits = function(value) {
var i, dateUnitCount, dateUnitInterval, dateUnitIntervals = ["millisecond", "second", "minute", "hour", "day", "month", "year"],
result = {};
for (i = dateUnitIntervals.length - 1; i >= 0; i--) {
dateUnitInterval = dateUnitIntervals[i];
dateUnitCount = Math.floor(value / toMilliseconds(dateUnitInterval));
if (dateUnitCount > 0) {
result[dateUnitInterval + "s"] = dateUnitCount;
value -= convertDateUnitToMilliseconds(dateUnitInterval, dateUnitCount)
}
}
return result
};
var dateToMilliseconds = function(tickInterval) {
var milliseconds = 0;
if (isObject(tickInterval)) {
$.each(tickInterval, function(key, value) {
milliseconds += convertDateUnitToMilliseconds(key.substr(0, key.length - 1), value)
})
}
if (isString(tickInterval)) {
milliseconds = convertDateUnitToMilliseconds(tickInterval, 1)
}
return milliseconds
};
var convertDateUnitToMilliseconds = function(dateUnit, count) {
return toMilliseconds(dateUnit) * count
};
var getDateUnitInterval = function(tickInterval) {
var i, maxInterval = -1;
if (isString(tickInterval)) {
return tickInterval
}
if (isObject(tickInterval)) {
$.each(tickInterval, function(key, value) {
for (i = 0; i < dateUnitIntervals.length; i++) {
if (value && (key === dateUnitIntervals[i] + "s" || key === dateUnitIntervals[i]) && maxInterval < i) {
maxInterval = i
}
}
});
return dateUnitIntervals[maxInterval]
}
return ""
};
var tickIntervalToFormatMap = {
millisecond: "millisecond",
second: "longtime",
minute: "shorttime",
hour: "shorttime",
day: "day",
week: "day",
month: "month",
quarter: "quarter",
year: "year"
};
function getDateFormatByTickInterval(tickInterval) {
return tickIntervalToFormatMap[getDateUnitInterval(tickInterval)] || ""
}
var getQuarter = function(month) {
return Math.floor(month / 3)
};
var getFirstQuarterMonth = function(month) {
return 3 * getQuarter(month)
};
var correctDateWithUnitBeginning = function(date, dateInterval, withCorrection) {
date = new Date(date.getTime());
var firstQuarterMonth, oldDate = new Date(date.getTime()),
dateUnitInterval = getDateUnitInterval(dateInterval);
switch (dateUnitInterval) {
case "second":
date.setMilliseconds(0);
break;
case "minute":
date.setSeconds(0, 0);
break;
case "hour":
date.setMinutes(0, 0, 0);
break;
case "year":
date.setMonth(0);
case "month":
date.setDate(1);
case "day":
date.setHours(0, 0, 0, 0);
break;
case "week":
date.setDate(date.getDate() - date.getDay());
date.setHours(0, 0, 0, 0);
break;
case "quarter":
firstQuarterMonth = getFirstQuarterMonth(date.getMonth());
if (date.getMonth() !== firstQuarterMonth) {
date.setMonth(firstQuarterMonth)
}
date.setDate(1);
date.setHours(0, 0, 0, 0)
}
if (withCorrection && "hour" !== dateUnitInterval && "minute" !== dateUnitInterval && "second" !== dateUnitInterval) {
fixTimezoneGap(oldDate, date)
}
return date
};
var trimTime = function(date) {
return dateUtils.correctDateWithUnitBeginning(date, "day")
};
var getDatesDifferences = function(date1, date2) {
var differences, counter = 0;
differences = {
year: date1.getFullYear() !== date2.getFullYear(),
month: date1.getMonth() !== date2.getMonth(),
day: date1.getDate() !== date2.getDate(),
hour: date1.getHours() !== date2.getHours(),
minute: date1.getMinutes() !== date2.getMinutes(),
second: date1.getSeconds() !== date2.getSeconds()
};
$.each(differences, function(key, value) {
if (value) {
counter++
}
});
differences.count = counter;
return differences
};
function addDateInterval(value, interval, dir) {
var result = new Date(value.getTime()),
intervalObject = isString(interval) ? getDateIntervalByString(interval.toLowerCase()) : interval;
if (intervalObject.years) {
result.setFullYear(result.getFullYear() + intervalObject.years * dir)
}
if (intervalObject.quarters) {
result.setMonth(result.getMonth() + 3 * intervalObject.quarters * dir)
}
if (intervalObject.months) {
result.setMonth(result.getMonth() + intervalObject.months * dir)
}
if (intervalObject.weeks) {
result.setDate(result.getDate() + 7 * intervalObject.weeks * dir)
}
if (intervalObject.days) {
result.setDate(result.getDate() + intervalObject.days * dir)
}
if (intervalObject.hours) {
result.setHours(result.getHours() + intervalObject.hours * dir)
}
if (intervalObject.minutes) {
result.setMinutes(result.getMinutes() + intervalObject.minutes * dir)
}
if (intervalObject.seconds) {
result.setSeconds(result.getSeconds() + intervalObject.seconds * dir)
}
if (intervalObject.milliseconds) {
result.setMilliseconds(value.getMilliseconds() + intervalObject.milliseconds * dir)
}
return result
}
var addInterval = function(value, interval, isNegative) {
var dir = isNegative ? -1 : 1;
return isDate(value) ? addDateInterval(value, interval, dir) : value + interval * dir
};
var getSequenceByInterval = function(min, max, interval) {
var cur, intervals = [];
intervals.push(isDate(min) ? new Date(min.getTime()) : min);
cur = min;
while (cur < max) {
cur = addInterval(cur, interval);
intervals.push(cur)
}
return intervals
};
var getViewFirstCellDate = function(viewType, date) {
if ("month" === viewType) {
return new Date(date.getFullYear(), date.getMonth(), 1)
}
if ("year" === viewType) {
return new Date(date.getFullYear(), 0, date.getDate())
}
if ("decade" === viewType) {
return new Date(getFirstYearInDecade(date), date.getMonth(), date.getDate())
}
if ("century" === viewType) {
return new Date(getFirstDecadeInCentury(date), date.getMonth(), date.getDate())
}
};
var getViewLastCellDate = function(viewType, date) {
if ("month" === viewType) {
return new Date(date.getFullYear(), date.getMonth(), getLastMonthDay(date))
}
if ("year" === viewType) {
return new Date(date.getFullYear(), 11, date.getDate())
}
if ("decade" === viewType) {
return new Date(getFirstYearInDecade(date) + 9, date.getMonth(), date.getDate())
}
if ("century" === viewType) {
return new Date(getFirstDecadeInCentury(date) + 90, date.getMonth(), date.getDate())
}
};
var getViewMinBoundaryDate = function(viewType, date) {
var resultDate = new Date(date.getFullYear(), date.getMonth(), 1);
if ("month" === viewType) {
return resultDate
}
resultDate.setMonth(0);
if ("year" === viewType) {
return resultDate
}
if ("decade" === viewType) {
resultDate.setFullYear(getFirstYearInDecade(date))
}
if ("century" === viewType) {
resultDate.setFullYear(getFirstDecadeInCentury(date))
}
return resultDate
};
var getViewMaxBoundaryDate = function(viewType, date) {
var resultDate = new Date(date.getFullYear(), date.getMonth(), getLastMonthDay(date));
if ("month" === viewType) {
return resultDate
}
resultDate.setMonth(11);
resultDate.setDate(getLastMonthDay(resultDate));
if ("year" === viewType) {
return resultDate
}
if ("decade" === viewType) {
resultDate.setFullYear(getFirstYearInDecade(date) + 9)
}
if ("century" === viewType) {
resultDate.setFullYear(getFirstDecadeInCentury(date) + 99)
}
return resultDate
};
var getLastMonthDay = function(date) {
var resultDate = new Date(date.getFullYear(), date.getMonth() + 1, 0);
return resultDate.getDate()
};
var sameView = function(view, date1, date2) {
return dateUtils[camelize("same " + view)](date1, date2)
};
var getViewUp = function(typeView) {
switch (typeView) {
case "month":
return "year";
case "year":
return "decade";
case "decade":
return "century"
}
};
var getViewDown = function(typeView) {
switch (typeView) {
case "century":
return "decade";
case "decade":
return "year";
case "year":
return "month"
}
};
var getDifferenceInMonth = function(typeView) {
var difference = 1;
if ("year" === typeView) {
difference = 12
}
if ("decade" === typeView) {
difference = 120
}
if ("century" === typeView) {
difference = 1200
}
return difference
};
var getDifferenceInMonthForCells = function(typeView) {
var difference = 1;
if ("decade" === typeView) {
difference = 12
}
if ("century" === typeView) {
difference = 120
}
return difference
};
var getDateIntervalByString = function(intervalString) {
var result = {};
switch (intervalString) {
case "year":
result.years = 1;
break;
case "month":
result.months = 1;
break;
case "quarter":
result.months = 3;
break;
case "week":
result.days = 7;
break;
case "day":
result.days = 1;
break;
case "hour":
result.hours = 1;
break;
case "minute":
result.minutes = 1;
break;
case "second":
result.seconds = 1;
break;
case "millisecond":
result.milliseconds = 1
}
return result
};
var sameDate = function(date1, date2) {
return sameMonthAndYear(date1, date2) && date1.getDate() === date2.getDate()
};
var sameMonthAndYear = function(date1, date2) {
return sameYear(date1, date2) && date1.getMonth() === date2.getMonth()
};
var sameYear = function(date1, date2) {
return date1 && date2 && date1.getFullYear() === date2.getFullYear()
};
var sameDecade = function(date1, date2) {
if (!isDefined(date1) || !isDefined(date2)) {
return
}
var startDecadeDate1 = date1.getFullYear() - date1.getFullYear() % 10,
startDecadeDate2 = date2.getFullYear() - date2.getFullYear() % 10;
return date1 && date2 && startDecadeDate1 === startDecadeDate2
};
var sameCentury = function(date1, date2) {
if (!isDefined(date1) || !isDefined(date2)) {
return
}
var startCenturyDate1 = date1.getFullYear() - date1.getFullYear() % 100,
startCenturyDate2 = date2.getFullYear() - date2.getFullYear() % 100;
return date1 && date2 && startCenturyDate1 === startCenturyDate2
};
var getFirstDecadeInCentury = function(date) {
return date && date.getFullYear() - date.getFullYear() % 100
};
var getFirstYearInDecade = function(date) {
return date && date.getFullYear() - date.getFullYear() % 10
};
var getShortDateFormat = function() {
return "yyyy/M/d"
};
var getFirstMonthDate = function(date) {
if (!isDefined(date)) {
return
}
var newDate = new Date(date.getFullYear(), date.getMonth(), 1);
return newDate
};
var getLastMonthDate = function(date) {
if (!isDefined(date)) {
return
}
var newDate = new Date(date.getFullYear(), date.getMonth() + 1, 0);
return newDate
};
var getFirstWeekDate = function(date, firstDayOfWeek) {
var delta = (date.getDay() - firstDayOfWeek + 7) % 7;
var result = new Date(date);
result.setDate(date.getDate() - delta);
return result
};
var normalizeDateByWeek = function(date, currentDate) {
var differenceInDays = dateUtils.getDatesInterval(date, currentDate, "day"),
resultDate = new Date(date);
if (differenceInDays >= 6) {
resultDate = new Date(resultDate.setDate(resultDate.getDate() + 7))
}
return resultDate
};
var dateInRange = function(date, min, max, format) {
if ("date" === format) {
min = min && new Date(min.getFullYear(), min.getMonth(), min.getDate());
max = max && new Date(max.getFullYear(), max.getMonth(), max.getDate());
date = date && new Date(date.getFullYear(), date.getMonth(), date.getDate())
}
return normalizeDate(date, min, max) === date
};
var normalizeDate = function(date, min, max) {
var normalizedDate = date;
if (!isDefined(date)) {
return date
}
if (isDefined(min) && date < min) {
normalizedDate = min
}
if (isDefined(max) && date > max) {
normalizedDate = max
}
return normalizedDate
};
var fixTimezoneGap = function(oldDate, newDate) {
if (!isDefined(oldDate)) {
return
}
var sign, trial, diff = newDate.getHours() - oldDate.getHours();
if (0 === diff) {
return
}
sign = 1 === diff || diff === -23 ? -1 : 1, trial = new Date(newDate.getTime() + 36e5 * sign);
if (sign > 0 || trial.getDate() === newDate.getDate()) {
newDate.setTime(trial.getTime())
}
};
var getTimezonesDifference = function(min, max) {
return 60 * (max.getTimezoneOffset() - min.getTimezoneOffset()) * 1e3
};
var makeDate = function(date) {
return new Date(date)
};
var NUMBER_SERIALIZATION_FORMAT = "number",
DATE_SERIALIZATION_FORMAT = "yyyy'/'MM'/'dd",
DATETIME_SERIALIZATION_FORMAT = "yyyy'/'MM'/'dd HH:mm:ss";
var getDateSerializationFormat = function(value) {
if (commonUtils.isNumber(value)) {
return NUMBER_SERIALIZATION_FORMAT
} else {
if (commonUtils.isString(value)) {
if (value.indexOf(":") >= 0) {
return DATETIME_SERIALIZATION_FORMAT
} else {
return DATE_SERIALIZATION_FORMAT
}
}
}
};
var deserializeDate = function(value, serializationFormat, localizationParseFunc) {
var parsedValue;
if (!serializationFormat || serializationFormat === NUMBER_SERIALIZATION_FORMAT || serializationFormat === DATE_SERIALIZATION_FORMAT || serializationFormat === DATETIME_SERIALIZATION_FORMAT) {
parsedValue = serializationFormat === NUMBER_SERIALIZATION_FORMAT ? value : !isDate(value) && Date.parse(value);
return parsedValue ? new Date(parsedValue) : value
}
if (void 0 !== value) {
return localizationParseFunc(value, serializationFormat)
}
};
var serializeDate = function(value, serializationFormat, localizationFormatFunc) {
if (serializationFormat === NUMBER_SERIALIZATION_FORMAT) {
return value && value.valueOf && value.valueOf()
}
if (serializationFormat) {
return localizationFormatFunc(value, serializationFormat)
}
return value
};
var dateUtils = {
dateUnitIntervals: dateUnitIntervals,
convertMillisecondsToDateUnits: convertMillisecondsToDateUnits,
dateToMilliseconds: dateToMilliseconds,
getNextDateUnit: getNextDateUnit,
convertDateUnitToMilliseconds: convertDateUnitToMilliseconds,
getDateUnitInterval: getDateUnitInterval,
getDateFormatByTickInterval: getDateFormatByTickInterval,
getDatesDifferences: getDatesDifferences,
correctDateWithUnitBeginning: correctDateWithUnitBeginning,
trimTime: trimTime,
addDateInterval: addDateInterval,
addInterval: addInterval,
getSequenceByInterval: getSequenceByInterval,
getDateIntervalByString: getDateIntervalByString,
sameDate: sameDate,
sameMonthAndYear: sameMonthAndYear,
sameMonth: sameMonthAndYear,
sameYear: sameYear,
sameDecade: sameDecade,
sameCentury: sameCentury,
sameView: sameView,
getDifferenceInMonth: getDifferenceInMonth,
getDifferenceInMonthForCells: getDifferenceInMonthForCells,
getFirstYearInDecade: getFirstYearInDecade,
getFirstDecadeInCentury: getFirstDecadeInCentury,
getShortDateFormat: getShortDateFormat,
getViewFirstCellDate: getViewFirstCellDate,
getViewLastCellDate: getViewLastCellDate,
getViewDown: getViewDown,
getViewUp: getViewUp,
getLastMonthDay: getLastMonthDay,
getLastMonthDate: getLastMonthDate,
getFirstMonthDate: getFirstMonthDate,
getFirstWeekDate: getFirstWeekDate,
normalizeDateByWeek: normalizeDateByWeek,
getQuarter: getQuarter,
getFirstQuarterMonth: getFirstQuarterMonth,
dateInRange: dateInRange,
normalizeDate: normalizeDate,
getViewMinBoundaryDate: getViewMinBoundaryDate,
getViewMaxBoundaryDate: getViewMaxBoundaryDate,
fixTimezoneGap: fixTimezoneGap,
getTimezonesDifference: getTimezonesDifference,
makeDate: makeDate,
deserializeDate: deserializeDate,
serializeDate: serializeDate,
getDateSerializationFormat: getDateSerializationFormat,
getDatesInterval: getDatesInterval
};
module.exports = dateUtils
},
/*!********************************************************!*\
!*** ./Scripts/mobile/process_hardware_back_button.js ***!
\********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
hardwareBack = $.Callbacks();
module.exports = function() {
hardwareBack.fire()
};
module.exports.processCallback = hardwareBack
},
/*!********************************************!*\
!*** ./Scripts/mobile/hide_top_overlay.js ***!
\********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9);
var hideCallback = function() {
var callbacks = [];
return {
add: function(callback) {
var indexOfCallback = $.inArray(callback, callbacks);
if (indexOfCallback === -1) {
callbacks.push(callback)
}
},
remove: function(callback) {
var indexOfCallback = $.inArray(callback, callbacks);
if (indexOfCallback !== -1) {
callbacks.splice(indexOfCallback, 1)
}
},
fire: function() {
var callback = callbacks.pop(),
result = !!callback;
if (result) {
callback()
}
return result
},
hasCallback: function() {
return callbacks.length > 0
},
reset: function() {
callbacks = []
}
}
}();
module.exports = function() {
return hideCallback.fire()
};
module.exports.hideCallback = hideCallback
},
/*!**********************************!*\
!*** ./Scripts/format_helper.js ***!
\**********************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
commonUtils = __webpack_require__( /*! ./core/utils/common */ 14),
dateUtils = __webpack_require__( /*! ./core/utils/date */ 52),
numberLocalization = __webpack_require__( /*! ./localization/number */ 22),
dateLocalization = __webpack_require__( /*! ./localization/date */ 56),
dependencyInjector = __webpack_require__( /*! ./core/utils/dependency_injector */ 23),
logger = __webpack_require__( /*! ./core/utils/console */ 12).logger;
__webpack_require__( /*! ./localization/currency */ 24);
module.exports = dependencyInjector({
format: function(value, format, precision) {
var formatIsValid = commonUtils.isString(format) && "" !== format || $.isPlainObject(format) || commonUtils.isFunction(format),
valueIsValid = commonUtils.isNumber(value) || commonUtils.isDate(value);
if (!formatIsValid || !valueIsValid) {
return commonUtils.isDefined(value) ? value.toString() : ""
}
if (commonUtils.isFunction(format)) {
return format(value)
}
if (void 0 !== precision) {
logger.warn("Option 'precision' is deprecated. Use field 'precision' of a format object instead.")
}
if (commonUtils.isString(format)) {
format = {
type: format,
precision: precision
}
}
if (commonUtils.isNumber(value)) {
return numberLocalization.format(value, format)
}
if (commonUtils.isDate(value)) {
return dateLocalization.format(value, format)
}
},
getTimeFormat: function(showSecond) {
if (showSecond) {
return dateLocalization.getPatternByFormat("longtime")
}
return dateLocalization.getPatternByFormat("shorttime")
},
_normalizeFormat: function(format) {
if (!commonUtils.isArray(format)) {
return format
}
if (1 === format.length) {
return format[0]
}
return function(date) {
return format.map(function(formatPart) {
return dateLocalization.format(date, formatPart)
}).join(" ")
}
},
getDateFormatByDifferences: function(dateDifferences) {
var resultFormat = [];
if (dateDifferences.millisecond) {
resultFormat.push(dateLocalization.getPatternByFormat("millisecond"))
}
if (dateDifferences.hour || dateDifferences.minute || dateDifferences.second) {
resultFormat.unshift(this.getTimeFormat(dateDifferences.second))
}
if (dateDifferences.year && dateDifferences.month && dateDifferences.day) {
resultFormat.unshift(dateLocalization.getPatternByFormat("shortdate"));
return this._normalizeFormat(resultFormat)
}
if (dateDifferences.year && dateDifferences.month) {
return dateLocalization.getPatternByFormat("monthandyear")
}
if (dateDifferences.year && dateDifferences.quarter) {
return dateLocalization.getPatternByFormat("quarterandyear")
}
if (dateDifferences.year) {
return dateLocalization.getPatternByFormat("year")
}
if (dateDifferences.quarter) {
return dateLocalization.getPatternByFormat("quarter")
}
if (dateDifferences.month && dateDifferences.day) {
resultFormat.unshift(dateLocalization.getPatternByFormat("monthandday"));
return this._normalizeFormat(resultFormat)
}
if (dateDifferences.month) {
return dateLocalization.getPatternByFormat("month")
}
if (dateDifferences.day) {
var dayPattern = dateLocalization.getPatternByFormat("dayofweek") + ", " + dateLocalization.getPatternByFormat("day");
resultFormat.unshift(dayPattern);
return this._normalizeFormat(resultFormat)
}
return this._normalizeFormat(resultFormat)
},
getDateFormatByTicks: function(ticks) {
var resultFormat, maxDif, currentDif, i;
if (ticks.length > 1) {
maxDif = dateUtils.getDatesDifferences(ticks[0], ticks[1]);
for (i = 1; i < ticks.length - 1; i++) {
currentDif = dateUtils.getDatesDifferences(ticks[i], ticks[i + 1]);
if (maxDif.count < currentDif.count) {
maxDif = currentDif
}
}
} else {
maxDif = {
year: true,
month: true,
day: true,
hour: ticks[0].getHours() > 0,
minute: ticks[0].getMinutes() > 0,
second: ticks[0].getSeconds() > 0
}
}
resultFormat = this.getDateFormatByDifferences(maxDif);
return resultFormat
},
getDateFormatByTickInterval: function(startValue, endValue, tickInterval) {
var resultFormat, dateDifferences, dateUnitInterval, dateDifferencesConverter = {
week: "day"
},
correctDateDifferences = function(dateDifferences, tickInterval, value) {
switch (tickInterval) {
case "year":
case "quarter":
dateDifferences.month = value;
case "month":
dateDifferences.day = value;
case "week":
case "day":
dateDifferences.hour = value;
case "hour":
dateDifferences.minute = value;
case "minute":
dateDifferences.second = value;
case "second":
dateDifferences.millisecond = value
}
},
correctDifferencesByMaxDate = function(differences, minDate, maxDate) {
if (!maxDate.getMilliseconds() && maxDate.getSeconds()) {
if (maxDate.getSeconds() - minDate.getSeconds() === 1) {
differences.millisecond = true;
differences.second = false
}
} else {
if (!maxDate.getSeconds() && maxDate.getMinutes()) {
if (maxDate.getMinutes() - minDate.getMinutes() === 1) {
differences.second = true;
differences.minute = false
}
} else {
if (!maxDate.getMinutes() && maxDate.getHours()) {
if (maxDate.getHours() - minDate.getHours() === 1) {
differences.minute = true;
differences.hour = false
}
} else {
if (!maxDate.getHours() && maxDate.getDate() > 1) {
if (maxDate.getDate() - minDate.getDate() === 1) {
differences.hour = true;
differences.day = false
}
} else {
if (1 === maxDate.getDate() && maxDate.getMonth()) {
if (maxDate.getMonth() - minDate.getMonth() === 1) {
differences.day = true;
differences.month = false
}
} else {
if (!maxDate.getMonth() && maxDate.getFullYear()) {
if (maxDate.getFullYear() - minDate.getFullYear() === 1) {
differences.month = true;
differences.year = false
}
}
}
}
}
}
}
};
tickInterval = commonUtils.isString(tickInterval) ? tickInterval.toLowerCase() : tickInterval;
dateDifferences = dateUtils.getDatesDifferences(startValue, endValue);
if (startValue !== endValue) {
correctDifferencesByMaxDate(dateDifferences, startValue > endValue ? endValue : startValue, startValue > endValue ? startValue : endValue)
}
dateUnitInterval = dateUtils.getDateUnitInterval(dateDifferences);
correctDateDifferences(dateDifferences, dateUnitInterval, true);
dateUnitInterval = dateUtils.getDateUnitInterval(tickInterval || "second");
correctDateDifferences(dateDifferences, dateUnitInterval, false);
dateDifferences[dateDifferencesConverter[dateUnitInterval] || dateUnitInterval] = true;
resultFormat = this.getDateFormatByDifferences(dateDifferences);
return resultFormat
}
})
},
/*!**************************************!*\
!*** ./Scripts/localization/date.js ***!
\**************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
numberLocalization = __webpack_require__( /*! ./number */ 22),
dependencyInjector = __webpack_require__( /*! ../core/utils/dependency_injector */ 23),
errors = __webpack_require__( /*! ../core/errors */ 17);
__webpack_require__( /*! ./core */ 57);
var FORMATS_TO_PATTERN_MAP = {
shortdate: "M/d/y",
shorttime: "h:mm a",
longdate: "EEEE, MMMM d, y",
longtime: "h:mm:ss a",
monthandday: "MMMM d",
monthandyear: "MMMM y",
quarterandyear: "QQQ y",
day: "d",
year: "y",
shortdateshorttime: "M/d/y, h:mm a",
mediumdatemediumtime: "MMMM d, h:mm a",
longdatelongtime: "EEEE, MMMM d, y, h:mm:ss a",
month: "LLLL",
shortyear: "yy",
dayofweek: "EEEE",
quarter: "QQQ",
hour: "HH",
minute: "mm",
second: "ss",
millisecond: "SSS",
"datetime-local": "yyyy-MM-ddTHH':'mm':'ss"
};
var parseTime = function(text) {
var now = new Date,
parts = text.split(" "),
time = parts[0].split(":"),
hours = Number(time[0]),
minutes = Number(time[1]),
second = Number(time[2]) || 0;
if (/^pm$/i.test(parts[1])) {
hours += 12
}
return new Date(now.getFullYear(), now.getMonth(), now.getDate(), hours, minutes, second)
};
var removeTimezoneOffset = function(date) {
return new Date(date.valueOf() + 60 * date.getTimezoneOffset() * 1e3)
};
var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var ampm = function(date) {
return date.getHours() >= 12 ? "PM" : "AM"
};
var getTwelveHourTimeFormat = function(hours) {
return hours % 12 || 12
};
var formatNumber = function(number, precision) {
return numberLocalization.format(number, {
type: "decimal",
precision: precision
})
};
var FORMATTERS = {
millisecond: function(date) {
return formatNumber(date.getMilliseconds(date), 3)
},
second: function(date) {
return formatNumber(date.getSeconds(), 2)
},
minute: function(date) {
return formatNumber(date.getMinutes(), 2)
},
h: function(date) {
return formatNumber(getTwelveHourTimeFormat(date.getHours()), 1)
},
hh: function(date) {
return formatNumber(getTwelveHourTimeFormat(date.getHours()), 2)
},
hour: function(date) {
return formatNumber(date.getHours(), 2)
},
day: function(date) {
return date.getDate()
},
dayofweek: function(date) {
return days[date.getDay()]
},
M: function(date) {
return date.getMonth() + 1
},
MM: function(date) {
return formatNumber(date.getMonth() + 1, 2)
},
month: function(date) {
return months[date.getMonth()]
},
year: function(date) {
return date.getFullYear()
},
shortyear: function(date) {
return String(date.getFullYear()).substr(2, 2)
},
shorttime: function(date) {
return FORMATTERS.h(date) + ":" + FORMATTERS.minute(date) + " " + ampm(date)
},
shortdate: function(date) {
return [FORMATTERS.M(date), FORMATTERS.day(date), FORMATTERS.year(date)].join("/")
},
shortdateshorttime: function(date) {
return [FORMATTERS.shortdate(date), FORMATTERS.shorttime(date)].join(", ")
},
mediumdatemediumtime: function(date) {
return [FORMATTERS.monthandday(date), FORMATTERS.shorttime(date)].join(", ")
},
monthandyear: function(date) {
return [FORMATTERS.month(date), FORMATTERS.year(date)].join(" ")
},
monthandday: function(date) {
return [FORMATTERS.month(date), FORMATTERS.day(date)].join(" ")
},
longdate: function(date) {
return FORMATTERS.dayofweek(date) + ", " + FORMATTERS.month(date) + " " + FORMATTERS.day(date) + ", " + FORMATTERS.year(date)
},
longtime: function(date) {
return [FORMATTERS.h(date), FORMATTERS.minute(date), FORMATTERS.second(date)].join(":") + " " + ampm(date)
},
longdatelongtime: function(date) {
return [FORMATTERS.longdate(date), FORMATTERS.longtime(date)].join(", ")
},
d: function(date) {
return formatNumber(FORMATTERS.day(date), 1)
},
dd: function(date) {
return formatNumber(FORMATTERS.day(date), 2)
},
"d MMMM": function(date) {
return FORMATTERS.day(date) + " " + FORMATTERS.month(date)
},
"yyyy/M/d": function(date) {
return [FORMATTERS.year(date), FORMATTERS.M(date), FORMATTERS.day(date)].join("/")
},
"yyyy/MM/dd": function(date) {
return [FORMATTERS.year(date), FORMATTERS.MM(date), FORMATTERS.dd(date)].join("/")
},
"dd.MM.yyyy": function(date) {
return [FORMATTERS.dd(date), FORMATTERS.MM(date), FORMATTERS.year(date)].join(".")
},
"HH:mm": function(date) {
return [FORMATTERS.hour(date), FORMATTERS.minute(date)].join(":")
},
"HH:mm:ss": function(date) {
return [FORMATTERS["HH:mm"](date), FORMATTERS.second(date)].join(":")
},
"h:mm:ss": function(date) {
return [FORMATTERS.h(date), FORMATTERS.minute(date), FORMATTERS.second(date)].join(":")
},
"h:mm:ss:SSS": function(date) {
return [FORMATTERS.h(date), FORMATTERS.minute(date), FORMATTERS.second(date), FORMATTERS.SSS(date)].join(":")
},
"yyyy/MM/dd HH:mm:ss": function(date) {
return [FORMATTERS["yyyy/MM/dd"](date), FORMATTERS["HH:mm:ss"](date)].join(" ")
},
"yyyy-MM-dd hh:mm:ss.SSS a": function(date) {
return [
[FORMATTERS.year(date), FORMATTERS.MM(date), FORMATTERS.dd(date)].join("-"), [FORMATTERS.hh(date), FORMATTERS.minute(date), FORMATTERS.second(date)].join(":") + "." + FORMATTERS.SSS(date), ampm(date)
].join(" ")
},
"yyyy-MM-dd": function(date) {
return [FORMATTERS.year(date), FORMATTERS.MM(date), FORMATTERS.dd(date)].join("-")
},
yyyyMMddTHHmmss: function(date) {
return [FORMATTERS.year(date), FORMATTERS.MM(date), FORMATTERS.dd(date), "T", FORMATTERS.hour(date), FORMATTERS.minute(date), FORMATTERS.second(date)].join("")
},
"datetime-local": function(date) {
return FORMATTERS["yyyy-MM-dd"](date) + "T" + FORMATTERS["HH:mm:ss"](date)
},
"yyyy-MM-ddTHH:mm:ssZ": function(date) {
return FORMATTERS["datetime-local"](date) + "Z"
},
"yyyy-MM-ddTHH:mmZ": function(date) {
return FORMATTERS["yyyy-MM-dd"](date) + "T" + FORMATTERS.hour(date) + ":" + FORMATTERS.minute(date) + "Z"
},
"dd/MM/yyyy": function(date) {
return [FORMATTERS.dd(date), FORMATTERS.MM(date), FORMATTERS.year(date)].join("/")
},
"yyyy MMMM d": function(date) {
return [FORMATTERS.year(date), FORMATTERS.month(date), FORMATTERS.day(date)].join(" ")
},
"EEEE, d": function(date) {
return [FORMATTERS.dayofweek(date), FORMATTERS.d(date)].join(", ")
},
"EEEE MM yy": function(date) {
return [FORMATTERS.dayofweek(date), FORMATTERS.MM(date), FORMATTERS.shortyear(date)].join(" ")
},
"d MMMM yyyy": function(date) {
return [FORMATTERS.day(date), FORMATTERS.month(date), FORMATTERS.year(date)].join(" ")
},
"E d": function(date) {
return FORMATTERS.E(date) + " " + FORMATTERS.day(date)
},
E: function(date) {
return cutCaptions([FORMATTERS.dayofweek(date)], "abbreviated")[0]
},
EEE: function(date) {
return FORMATTERS.E(date)
},
"EEE hh": function(date) {
return [FORMATTERS.EEE(date), FORMATTERS.hh(date)].join(" ")
},
"ss SSS": function(date) {
return [FORMATTERS.second(date), FORMATTERS.SSS(date)].join(" ")
},
quarter: function(date) {
var month = date.getMonth();
if (month >= 0 && month < 3) {
return "Q1"
}
if (month > 2 && month < 6) {
return "Q2"
}
if (month > 5 && month < 9) {
return "Q3"
}
return "Q4"
},
quarterandyear: function(date) {
return FORMATTERS.quarter(date) + " " + FORMATTERS.year(date)
}
};
var parseWithoutTimezone = function(text) {
if ("Z" !== text.slice(-1)) {
text += "Z"
}
return removeTimezoneOffset(new Date(text))
};
var PARSERS = {
day: function(text) {
var now = new Date;
return new Date(now.getFullYear(), now.getMonth(), Number(text))
},
hour: function(text) {
var now = new Date;
return new Date(now.getFullYear(), now.getMonth(), now.getDate(), Number(text))
},
minute: function(text) {
var now = new Date;
return new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), Number(text))
},
month: function(text) {
return new Date((new Date).getFullYear(), $.inArray(text, months))
},
monthandday: function(text) {
var parts = text.split(" "),
ret = PARSERS.month(parts[0]);
ret.setDate(Number(parts[1]));
return ret
},
monthandyear: function(text) {
var parts = text.split(" "),
ret = PARSERS.month(parts[0]);
ret.setYear(Number(parts[1]));
return ret
},
year: function(text) {
var date = new Date(new Date(0));
date.setUTCFullYear(Number(text));
return removeTimezoneOffset(date)
},
shortyear: function(text) {
var MAX_YEAR_IN_XXI_CENTURY = 36;
var year = Number(text);
if (year > MAX_YEAR_IN_XXI_CENTURY) {
year += 1900
} else {
year += 2e3
}
return PARSERS.year(year)
},
shortdate: function(text) {
var parts = text.split("/");
if (3 !== parts.length) {
return
}
return new Date(Number(parts[2]), Number(parts[0]) - 1, Number(parts[1]))
},
longtime: function(text) {
return parseTime(text)
},
shorttime: function(text) {
return parseTime(text)
},
millisecond: function(text) {
return new Date(Number(text))
},
"yyyy MMMM d": function(text) {
var parts = text.split(" ");
if (3 !== parts.length) {
return
}
return new Date(Number(parts[0]), $.inArray(parts[1], months), Number(parts[2]))
},
"HH:mm": function(text) {
var parts = text.split(":");
return new Date(0, 0, 0, Number(parts[0]), Number(parts[1]), 0, 0)
},
"yyyy-MM-ddTHH:mm:ssZ": parseWithoutTimezone,
"yyyy-MM-ddTHH:mmZ": parseWithoutTimezone,
"datetime-local": parseWithoutTimezone,
mediumdatemediumtime: function(text) {
var parts = text.split(", "),
dateParts = parts[0].split(" "),
timeParts = parts[1].split(" ");
var ampm = 2 === timeParts.length ? timeParts.pop() : void 0;
var ret = PARSERS.month(dateParts[0]);
ret.setDate(Number(dateParts[1]));
timeParts = timeParts[0].split(":");
var hours = Number(timeParts[0]);
switch (String(ampm).toLowerCase()) {
case "am":
hours = 12 === hours ? 0 : hours;
break;
case "pm":
hours = 12 === hours ? 12 : hours + 12
}
ret.setHours(hours);
ret.setMinutes(Number(timeParts[1]));
return ret
}
};
$.each(FORMATS_TO_PATTERN_MAP, function(key, value) {
value = value.replace(/'/g, "");
FORMATTERS[value] = FORMATTERS[key];
PARSERS[value] = PARSERS[key]
});
var getByFormat = function(obj, format) {
return obj[format.toLowerCase()] || obj[format.replace(/'/g, "")]
};
var cutCaptions = function(captions, format) {
var lengthByFormat = {
abbreviated: 3,
"short": 2,
narrow: 1
};
return $.map(captions, function(caption) {
return caption.substr(0, lengthByFormat[format])
})
};
var dateLocalization = dependencyInjector({
getPatternByFormat: function(format) {
return FORMATS_TO_PATTERN_MAP[format.toLowerCase()]
},
getMonthNames: function(format) {
return cutCaptions(months, format)
},
getDayNames: function(format) {
return cutCaptions(days, format)
},
getTimeSeparator: function() {
return ":"
},
format: function(date, format) {
if (!date) {
return
}
if (!format) {
return date
}
var formatter;
if ("function" === typeof format) {
formatter = format
} else {
if (format.formatter) {
formatter = format.formatter
} else {
format = format.type || format;
formatter = getByFormat(FORMATTERS, format)
}
}
if (!formatter) {
return
}
return formatter(date)
},
parse: function(text, format) {
var result, parser;
if (!text) {
return
}
if (!format) {
return new Date(text)
}
if (format.parser) {
return format.parser(text)
}
if (format.type || format.formatter) {
format = format.type
}
if (format && "function" !== typeof format) {
parser = getByFormat(PARSERS, format)
}
if (parser) {
result = parser(text)
} else {
errors.log("W0012");
result = new Date(text)
}
if (!result || isNaN(result.getTime())) {
return
}
return result
},
firstDayOfWeekIndex: function() {
return 0
}
});
module.exports = dateLocalization
},
/*!**************************************!*\
!*** ./Scripts/localization/core.js ***!
\**************************************/
function(module, exports) {},
/*!**********************************************!*\
!*** ./Scripts/animation/presets/presets.js ***!
\**********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Component = __webpack_require__( /*! ../../core/component */ 34),
devices = __webpack_require__( /*! ../../core/devices */ 40),
fx = __webpack_require__( /*! ../fx */ 59);
var directionPostfixes = {
forward: " dx-forward",
backward: " dx-backward",
none: " dx-no-direction",
undefined: " dx-no-direction"
};
var optionPrefix = "preset_";
var AnimationPresetCollection = Component.inherit({
ctor: function() {
this.callBase.apply(this, arguments);
this._customRules = [];
this._registeredPresets = [];
this.resetToDefaults()
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
defaultAnimationDuration: 400,
defaultAnimationDelay: 0,
defaultStaggerAnimationDuration: 300,
defaultStaggerAnimationDelay: 40,
defaultStaggerAnimationStartDelay: 500
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function(device) {
return device.phone
},
options: {
defaultStaggerAnimationDuration: 350,
defaultStaggerAnimationDelay: 50,
defaultStaggerAnimationStartDelay: 0
}
}, {
device: function() {
return devices.current().android || devices.real.android
},
options: {
defaultAnimationDelay: 100
}
}])
},
_getPresetOptionName: function(animationName) {
return optionPrefix + animationName
},
_createAndroidSlideAnimationConfig: function(throughOpacity, widthMultiplier) {
var that = this;
var createBaseConfig = function(configModifier) {
return {
type: "slide",
delay: void 0 === configModifier.delay ? that.option("defaultAnimationDelay") : configModifier.delay,
duration: void 0 === configModifier.duration ? that.option("defaultAnimationDuration") : configModifier.duration
}
};
return {
enter: function($element, configModifier) {
var width = $element.parent().width() * widthMultiplier,
direction = configModifier.direction,
config = createBaseConfig(configModifier);
config.to = {
left: 0,
opacity: 1
};
if ("forward" === direction) {
config.from = {
left: width,
opacity: throughOpacity
}
} else {
if ("backward" === direction) {
config.from = {
left: -width,
opacity: throughOpacity
}
} else {
config.from = {
left: 0,
opacity: 0
}
}
}
return fx.createAnimation($element, config)
},
leave: function($element, configModifier) {
var width = $element.parent().width() * widthMultiplier,
direction = configModifier.direction,
config = createBaseConfig(configModifier);
config.from = {
left: 0,
opacity: 1
};
if ("forward" === direction) {
config.to = {
left: -width,
opacity: throughOpacity
}
} else {
if ("backward" === direction) {
config.to = {
left: width,
opacity: throughOpacity
}
} else {
config.to = {
left: 0,
opacity: 0
}
}
}
return fx.createAnimation($element, config)
}
}
},
_createOpenDoorConfig: function() {
var that = this;
var createBaseConfig = function(configModifier) {
return {
type: "css",
extraCssClasses: "dx-opendoor-animation",
delay: void 0 === configModifier.delay ? that.option("defaultAnimationDelay") : configModifier.delay,
duration: void 0 === configModifier.duration ? that.option("defaultAnimationDuration") : configModifier.duration
}
};
return {
enter: function($element, configModifier) {
var direction = configModifier.direction,
config = createBaseConfig(configModifier);
config.delay = "none" === direction ? config.delay : config.duration;
config.from = "dx-enter dx-opendoor-animation" + directionPostfixes[direction];
config.to = "dx-enter-active";
return fx.createAnimation($element, config)
},
leave: function($element, configModifier) {
var direction = configModifier.direction,
config = createBaseConfig(configModifier);
config.from = "dx-leave dx-opendoor-animation" + directionPostfixes[direction];
config.to = "dx-leave-active";
return fx.createAnimation($element, config)
}
}
},
_createWinPopConfig: function() {
var that = this,
baseConfig = {
type: "css",
extraCssClasses: "dx-win-pop-animation",
duration: that.option("defaultAnimationDuration")
};
return {
enter: function($element, configModifier) {
var config = baseConfig,
direction = configModifier.direction;
config.delay = "none" === direction ? that.option("defaultAnimationDelay") : that.option("defaultAnimationDuration") / 2;
config.from = "dx-enter dx-win-pop-animation" + directionPostfixes[direction];
config.to = "dx-enter-active";
return fx.createAnimation($element, config)
},
leave: function($element, configModifier) {
var config = baseConfig,
direction = configModifier.direction;
config.delay = that.option("defaultAnimationDelay");
config.from = "dx-leave dx-win-pop-animation" + directionPostfixes[direction];
config.to = "dx-leave-active";
return fx.createAnimation($element, config)
}
}
},
resetToDefaults: function() {
this.clear();
this.registerDefaultPresets();
this.applyChanges()
},
clear: function(name) {
var that = this,
newRegisteredPresets = [];
$.each(this._registeredPresets, function(index, preset) {
if (!name || name === preset.name) {
that.option(that._getPresetOptionName(preset.name), void 0)
} else {
newRegisteredPresets.push(preset)
}
});
this._registeredPresets = newRegisteredPresets;
this.applyChanges()
},
registerPreset: function(name, config) {
this._registeredPresets.push({
name: name,
config: config
})
},
applyChanges: function() {
var that = this;
this._customRules.length = 0;
$.each(this._registeredPresets, function(index, preset) {
var rule = {
device: preset.config.device,
options: {}
};
rule.options[that._getPresetOptionName(preset.name)] = preset.config.animation;
that._customRules.push(rule)
});
this._setOptionsByDevice()
},
getPreset: function(name) {
var result = name;
while ("string" === typeof result) {
result = this.option(this._getPresetOptionName(result))
}
return result
},
registerDefaultPresets: function() {
this.registerPreset("pop", {
animation: {
extraCssClasses: "dx-android-pop-animation",
delay: this.option("defaultAnimationDelay"),
duration: this.option("defaultAnimationDuration")
}
});
this.registerPreset("openDoor", {
animation: this._createOpenDoorConfig()
});
this.registerPreset("win-pop", {
animation: this._createWinPopConfig()
});
this.registerPreset("fade", {
animation: {
extraCssClasses: "dx-fade-animation",
delay: this.option("defaultAnimationDelay"),
duration: this.option("defaultAnimationDuration")
}
});
this.registerPreset("slide", {
device: function() {
return devices.current().android || devices.real.android
},
animation: this._createAndroidSlideAnimationConfig(1, 1)
});
this.registerPreset("slide", {
device: function() {
return !devices.current().android && !devices.real.android
},
animation: {
extraCssClasses: "dx-slide-animation",
delay: this.option("defaultAnimationDelay"),
duration: this.option("defaultAnimationDuration")
}
});
this.registerPreset("ios7-slide", {
animation: {
extraCssClasses: "dx-ios7-slide-animation",
delay: this.option("defaultAnimationDelay"),
duration: this.option("defaultAnimationDuration")
}
});
this.registerPreset("overflow", {
animation: {
extraCssClasses: "dx-overflow-animation",
delay: this.option("defaultAnimationDelay"),
duration: this.option("defaultAnimationDuration")
}
});
this.registerPreset("ios7-toolbar", {
device: function() {
return !devices.current().android && !devices.real.android
},
animation: {
extraCssClasses: "dx-ios7-toolbar-animation",
delay: this.option("defaultAnimationDelay"),
duration: this.option("defaultAnimationDuration")
}
});
this.registerPreset("ios7-toolbar", {
device: function() {
return devices.current().android || devices.real.android
},
animation: this._createAndroidSlideAnimationConfig(0, .4)
});
this.registerPreset("stagger-fade", {
animation: {
extraCssClasses: "dx-fade-animation",
staggerDelay: this.option("defaultStaggerAnimationDelay"),
duration: this.option("defaultStaggerAnimationDuration"),
delay: this.option("defaultStaggerAnimationStartDelay")
}
});
this.registerPreset("stagger-slide", {
animation: {
extraCssClasses: "dx-slide-animation",
staggerDelay: this.option("defaultStaggerAnimationDelay"),
duration: this.option("defaultStaggerAnimationDuration"),
delay: this.option("defaultStaggerAnimationStartDelay")
}
});
this.registerPreset("stagger-fade-slide", {
animation: {
extraCssClasses: "dx-fade-slide-animation",
staggerDelay: this.option("defaultStaggerAnimationDelay"),
duration: this.option("defaultStaggerAnimationDuration"),
delay: this.option("defaultStaggerAnimationStartDelay")
}
});
this.registerPreset("stagger-drop", {
animation: {
extraCssClasses: "dx-drop-animation",
staggerDelay: this.option("defaultStaggerAnimationDelay"),
duration: this.option("defaultStaggerAnimationDuration"),
delay: this.option("defaultStaggerAnimationStartDelay")
}
});
this.registerPreset("stagger-fade-drop", {
animation: {
extraCssClasses: "dx-fade-drop-animation",
staggerDelay: this.option("defaultStaggerAnimationDelay"),
duration: this.option("defaultStaggerAnimationDuration"),
delay: this.option("defaultStaggerAnimationStartDelay")
}
});
this.registerPreset("stagger-fade-rise", {
animation: {
extraCssClasses: "dx-fade-rise-animation",
staggerDelay: this.option("defaultStaggerAnimationDelay"),
duration: this.option("defaultStaggerAnimationDuration"),
delay: this.option("defaultStaggerAnimationStartDelay")
}
});
this.registerPreset("stagger-3d-drop", {
animation: {
extraCssClasses: "dx-3d-drop-animation",
staggerDelay: this.option("defaultStaggerAnimationDelay"),
duration: this.option("defaultStaggerAnimationDuration"),
delay: this.option("defaultStaggerAnimationStartDelay")
}
});
this.registerPreset("stagger-fade-zoom", {
animation: {
extraCssClasses: "dx-fade-zoom-animation",
staggerDelay: this.option("defaultStaggerAnimationDelay"),
duration: this.option("defaultStaggerAnimationDuration"),
delay: this.option("defaultStaggerAnimationStartDelay")
}
})
}
});
exports.PresetCollection = AnimationPresetCollection;
var animationPresets = new AnimationPresetCollection;
exports.presets = animationPresets
},
/*!*********************************!*\
!*** ./Scripts/animation/fx.js ***!
\*********************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
errors = __webpack_require__( /*! ../core/errors */ 17),
translator = __webpack_require__( /*! ./translator */ 60),
animationFrame = __webpack_require__( /*! ./frame */ 46),
support = __webpack_require__( /*! ../core/utils/support */ 48),
positionUtils = __webpack_require__( /*! ./position */ 61),
removeEvent = __webpack_require__( /*! ../core/remove_event */ 33),
eventUtils = __webpack_require__( /*! ../events/utils */ 62),
transitionEndEventName = support.transitionEndEventName + ".dxFX",
removeEventName = eventUtils.addNamespace(removeEvent, "dxFX");
var CSS_TRANSITION_EASING_REGEX = /cubic-bezier\((\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\)/,
RELATIVE_VALUE_REGEX = /^([+-])=(.*)/i,
ANIM_DATA_KEY = "dxAnimData",
ANIM_QUEUE_KEY = "dxAnimQueue",
TRANSFORM_PROP = "transform";
var TransitionAnimationStrategy = {
initAnimation: function($element, config) {
$element.css({
transitionProperty: "none"
});
if ("string" === typeof config.from) {
$element.addClass(config.from)
} else {
setProps($element, config.from)
}
var that = this,
deferred = $.Deferred(),
cleanupWhen = config.cleanupWhen;
config.transitionAnimation = {
deferred: deferred,
finish: function() {
that._finishTransition($element, config);
if (cleanupWhen) {
$.when(deferred, cleanupWhen).always(function() {
that._cleanup($element, config)
})
} else {
that._cleanup($element, config)
}
deferred.resolveWith($element, [config, $element])
}
};
this._completeAnimationCallback($element, config).done(function() {
config.transitionAnimation.finish()
}).fail(function() {
deferred.rejectWith($element, [config, $element])
});
if (!config.duration) {
config.transitionAnimation.finish()
}
$element.css("transform")
},
animate: function($element, config) {
this._startAnimation($element, config);
return config.transitionAnimation.deferred.promise()
},
_completeAnimationCallback: function($element, config) {
var simulatedEndEventTimer, waitForJSCompleteTimer, that = this,
startTime = $.now() + config.delay,
deferred = $.Deferred(),
transitionEndFired = $.Deferred(),
simulatedTransitionEndFired = $.Deferred();
config.transitionAnimation.cleanup = function() {
clearTimeout(simulatedEndEventTimer);
clearTimeout(waitForJSCompleteTimer);
$element.off(transitionEndEventName);
$element.off(removeEventName)
};
$element.one(transitionEndEventName, function() {
if ($.now() - startTime >= config.duration) {
transitionEndFired.reject()
}
}).off(removeEventName).on(removeEventName, function() {
that.stop($element, config);
deferred.reject()
});
waitForJSCompleteTimer = setTimeout(function() {
simulatedEndEventTimer = setTimeout(function() {
simulatedTransitionEndFired.reject()
}, config.duration + config.delay + fx._simulatedTransitionEndDelay);
$.when(transitionEndFired, simulatedTransitionEndFired).fail($.proxy(function() {
deferred.resolve()
}, this))
});
return deferred.promise()
},
_startAnimation: function($element, config) {
$element.css({
transitionProperty: "all",
transitionDelay: config.delay + "ms",
transitionDuration: config.duration + "ms",
transitionTimingFunction: config.easing
});
if ("string" === typeof config.to) {
$element[0].className += " " + config.to
} else {
if (config.to) {
setProps($element, config.to)
}
}
},
_finishTransition: function($element, config) {
$element.css("transition", "none")
},
_cleanup: function($element, config) {
config.transitionAnimation.cleanup();
if ("string" === typeof config.from) {
$element.removeClass(config.from);
$element.removeClass(config.to)
}
},
stop: function($element, config, jumpToEnd) {
if (!config) {
return
}
if (jumpToEnd) {
config.transitionAnimation.finish()
} else {
if ($.isPlainObject(config.to)) {
$.each(config.to, function(key) {
$element.css(key, $element.css(key))
})
}
this._finishTransition($element, config);
this._cleanup($element, config)
}
}
};
var FrameAnimationStrategy = {
initAnimation: function($element, config) {
setProps($element, config.from)
},
animate: function($element, config) {
var deferred = $.Deferred(),
that = this;
if (!config) {
return deferred.reject().promise()
}
$.each(config.to, function(prop) {
if (void 0 === config.from[prop]) {
config.from[prop] = that._normalizeValue($element.css(prop))
}
});
if (config.to[TRANSFORM_PROP]) {
config.from[TRANSFORM_PROP] = that._parseTransform(config.from[TRANSFORM_PROP]);
config.to[TRANSFORM_PROP] = that._parseTransform(config.to[TRANSFORM_PROP])
}
config.frameAnimation = {
to: config.to,
from: config.from,
currentValue: config.from,
easing: convertTransitionTimingFuncToJQueryEasing(config.easing),
duration: config.duration,
startTime: (new Date).valueOf(),
finish: function() {
this.currentValue = this.to;
this.draw();
animationFrame.cancelAnimationFrame(config.frameAnimation.animationFrameId);
deferred.resolve()
},
draw: function() {
if (config.draw) {
config.draw(this.currentValue);
return
}
var currentValue = $.extend({}, this.currentValue);
if (currentValue[TRANSFORM_PROP]) {
currentValue[TRANSFORM_PROP] = $.map(currentValue[TRANSFORM_PROP], function(value, prop) {
if ("translate" === prop) {
return translator.getTranslateCss(value)
} else {
if ("scale" === prop) {
return "scale(" + value + ")"
} else {
if ("rotate" === prop.substr(0, prop.length - 1)) {
return prop + "(" + value + "deg)"
}
}
}
}).join(" ")
}
$element.css(currentValue)
}
};
if (config.delay) {
config.frameAnimation.startTime += config.delay;
config.frameAnimation.delayTimeout = setTimeout(function() {
that._startAnimation($element, config)
}, config.delay)
} else {
that._startAnimation($element, config)
}
return deferred.promise()
},
_startAnimation: function($element, config) {
$element.off(removeEventName).on(removeEventName, function() {
if (config.frameAnimation) {
animationFrame.cancelAnimationFrame(config.frameAnimation.animationFrameId)
}
});
this._animationStep($element, config)
},
_parseTransform: function(transformString) {
var result = {};
$.each(transformString.match(/(\w|\d)+\([^\)]*\)\s*/g), function(i, part) {
var translateData = translator.parseTranslate(part),
scaleData = part.match(/scale\((.+?)\)/),
rotateData = part.match(/(rotate.)\((.+)deg\)/);
if (translateData) {
result.translate = translateData
}
if (scaleData && scaleData[1]) {
result.scale = parseFloat(scaleData[1])
}
if (rotateData && rotateData[1]) {
result[rotateData[1]] = parseFloat(rotateData[2])
}
});
return result
},
stop: function($element, config, jumpToEnd) {
var frameAnimation = config && config.frameAnimation;
if (!frameAnimation) {
return
}
animationFrame.cancelAnimationFrame(frameAnimation.animationFrameId);
clearTimeout(frameAnimation.delayTimeout);
if (jumpToEnd) {
frameAnimation.finish()
}
delete config.frameAnimation
},
_animationStep: function($element, config) {
var frameAnimation = config && config.frameAnimation;
if (!frameAnimation) {
return
}
var now = (new Date).valueOf();
if (now >= frameAnimation.startTime + frameAnimation.duration) {
frameAnimation.finish();
return
}
frameAnimation.currentValue = this._calcStepValue(frameAnimation, now - frameAnimation.startTime);
frameAnimation.draw();
var that = this;
frameAnimation.animationFrameId = animationFrame.requestAnimationFrame(function() {
that._animationStep($element, config)
})
},
_calcStepValue: function(frameAnimation, currentDuration) {
var calcValueRecursively = function(from, to) {
var result = $.isArray(to) ? [] : {};
var calcEasedValue = function(propName) {
var x = currentDuration / frameAnimation.duration,
t = currentDuration,
b = 1 * from[propName],
c = to[propName] - from[propName],
d = frameAnimation.duration;
return $.easing[frameAnimation.easing](x, t, b, c, d)
};
$.each(to, function(propName, endPropValue) {
if ("string" === typeof endPropValue && false === parseFloat(endPropValue, 10)) {
return true
}
result[propName] = "object" === typeof endPropValue ? calcValueRecursively(from[propName], endPropValue) : calcEasedValue(propName)
});
return result
};
return calcValueRecursively(frameAnimation.from, frameAnimation.to)
},
_normalizeValue: function(value) {
var numericValue = parseFloat(value, 10);
if (false === numericValue) {
return value
}
return numericValue
}
};
var FallbackToNoAnimationStrategy = {
initAnimation: function($element, config) {},
animate: function($element, config) {
return $.Deferred().resolve().promise()
},
stop: $.noop,
isSynchronous: true
};
var animationStrategies = {
transition: support.transition ? TransitionAnimationStrategy : FrameAnimationStrategy,
frame: FrameAnimationStrategy,
noAnimation: FallbackToNoAnimationStrategy
};
var getAnimationStrategy = function(config) {
config = config || {};
var strategy = config.strategy || "transition";
if ("css" === config.type && !support.transition) {
strategy = "noAnimation"
}
return animationStrategies[strategy]
};
var TransitionTimingFuncMap = {
linear: "cubic-bezier(0, 0, 1, 1)",
ease: "cubic-bezier(0.25, 0.1, 0.25, 1)",
"ease-in": "cubic-bezier(0.42, 0, 1, 1)",
"ease-out": "cubic-bezier(0, 0, 0.58, 1)",
"ease-in-out": "cubic-bezier(0.42, 0, 0.58, 1)"
};
var convertTransitionTimingFuncToJQueryEasing = function(cssTransitionEasing) {
cssTransitionEasing = TransitionTimingFuncMap[cssTransitionEasing] || cssTransitionEasing;
var bezCoeffs = cssTransitionEasing.match(CSS_TRANSITION_EASING_REGEX);
if (!bezCoeffs) {
return "linear"
}
bezCoeffs = bezCoeffs.slice(1, 5);
$.each(bezCoeffs, function(index, value) {
bezCoeffs[index] = parseFloat(value)
});
var easingName = "cubicbezier_" + bezCoeffs.join("_").replace(/\./g, "p");
if (!$.isFunction($.easing[easingName])) {
var polynomBezier = function(x1, y1, x2, y2) {
var Cx = 3 * x1,
Bx = 3 * (x2 - x1) - Cx,
Ax = 1 - Cx - Bx,
Cy = 3 * y1,
By = 3 * (y2 - y1) - Cy,
Ay = 1 - Cy - By;
var bezierX = function(t) {
return t * (Cx + t * (Bx + t * Ax))
};
var bezierY = function(t) {
return t * (Cy + t * (By + t * Ay))
};
var findXfor = function(t) {
var z, x = t,
i = 0;
while (i < 14) {
z = bezierX(x) - t;
if (Math.abs(z) < .001) {
break
}
x -= z / derivativeX(x);
i++
}
return x
};
var derivativeX = function(t) {
return Cx + t * (2 * Bx + 3 * t * Ax)
};
return function(t) {
return bezierY(findXfor(t))
}
};
$.easing[easingName] = function(x, t, b, c, d) {
return c * polynomBezier(bezCoeffs[0], bezCoeffs[1], bezCoeffs[2], bezCoeffs[3])(t / d) + b
}
}
return easingName
};
var baseConfigValidator = function(config, animationType, validate, typeMessage) {
$.each(["from", "to"], function() {
if (!validate(config[this])) {
throw errors.Error("E0010", animationType, this, typeMessage)
}
})
};
var isObjectConfigValidator = function(config, animationType) {
return baseConfigValidator(config, animationType, function(target) {
return $.isPlainObject(target)
}, "a plain object")
};
var isStringConfigValidator = function(config, animationType) {
return baseConfigValidator(config, animationType, function(target) {
return "string" === typeof target
}, "a string")
};
var CustomAnimationConfigurator = {
setup: function($element, config) {}
};
var CssAnimationConfigurator = {
validateConfig: function(config) {
isStringConfigValidator(config, "css")
},
setup: function($element, config) {}
};
var positionAliases = {
top: {
my: "bottom center",
at: "top center"
},
bottom: {
my: "top center",
at: "bottom center"
},
right: {
my: "left center",
at: "right center"
},
left: {
my: "right center",
at: "left center"
}
};
var SlideAnimationConfigurator = {
validateConfig: function(config) {
isObjectConfigValidator(config, "slide")
},
setup: function($element, config) {
var location = translator.locate($element);
if ("slide" !== config.type) {
var positioningConfig = "slideIn" === config.type ? config.from : config.to;
positioningConfig.position = $.extend({
of: window
}, positionAliases[config.direction]);
setupPosition($element, positioningConfig)
}
this._setUpConfig(location, config.from);
this._setUpConfig(location, config.to);
translator.clearCache($element);
if (!support.transform && "static" === $element.css("position")) {
$element.css("position", "relative")
}
},
_setUpConfig: function(location, config) {
config.left = "left" in config ? config.left : "+=0";
config.top = "top" in config ? config.top : "+=0";
this._initNewPosition(location, config)
},
_initNewPosition: function(location, config) {
var position = {
left: config.left,
top: config.top
};
delete config.left;
delete config.top;
var relativeValue = this._getRelativeValue(position.left);
if (void 0 !== relativeValue) {
position.left = relativeValue + location.left
} else {
config.left = 0
}
relativeValue = this._getRelativeValue(position.top);
if (void 0 !== relativeValue) {
position.top = relativeValue + location.top
} else {
config.top = 0
}
var translate = {
x: 0,
y: 0
};
if (support.transform) {
translate = {
x: position.left,
y: position.top
}
} else {
config.left = position.left;
config.top = position.top
}
config[TRANSFORM_PROP] = translator.getTranslateCss(translate)
},
_getRelativeValue: function(value) {
var relativeValue;
if ("string" === typeof value && (relativeValue = RELATIVE_VALUE_REGEX.exec(value))) {
return parseInt(relativeValue[1] + "1") * relativeValue[2]
}
}
};
var FadeAnimationConfigurator = {
setup: function($element, config) {
var toOpacity, from = config.from,
fromOpacity = $.isPlainObject(from) ? config.skipElementInitialStyles ? 0 : $element.css("opacity") : String(from);
switch (config.type) {
case "fadeIn":
toOpacity = 1;
break;
case "fadeOut":
toOpacity = 0;
break;
default:
toOpacity = String(config.to)
}
config.from = {
visibility: "visible",
opacity: fromOpacity
};
config.to = {
opacity: toOpacity
}
}
};
var PopAnimationConfigurator = {
validateConfig: function(config) {
isObjectConfigValidator(config, "pop")
},
setup: function($element, config) {
var from = config.from,
to = config.to,
fromOpacity = "opacity" in from ? from.opacity : $element.css("opacity"),
toOpacity = "opacity" in to ? to.opacity : 1,
fromScale = "scale" in from ? from.scale : 0,
toScale = "scale" in to ? to.scale : 1;
config.from = {
opacity: fromOpacity
};
var translate = translator.getTranslate($element);
config.from[TRANSFORM_PROP] = this._getCssTransform(translate, fromScale);
config.to = {
opacity: toOpacity
};
config.to[TRANSFORM_PROP] = this._getCssTransform(translate, toScale)
},
_getCssTransform: function(translate, scale) {
return translator.getTranslateCss(translate) + "scale(" + scale + ")"
}
};
var animationConfigurators = {
custom: CustomAnimationConfigurator,
slide: SlideAnimationConfigurator,
slideIn: SlideAnimationConfigurator,
slideOut: SlideAnimationConfigurator,
fade: FadeAnimationConfigurator,
fadeIn: FadeAnimationConfigurator,
fadeOut: FadeAnimationConfigurator,
pop: PopAnimationConfigurator,
css: CssAnimationConfigurator
};
var getAnimationConfigurator = function(config) {
var result = animationConfigurators[config.type];
if (!result) {
throw errors.Error("E0011", config.type)
}
return result
};
var defaultJSConfig = {
type: "custom",
from: {},
to: {},
duration: 400,
start: $.noop,
complete: $.noop,
easing: "ease",
delay: 0
},
defaultCssConfig = {
duration: 400,
easing: "ease",
delay: 0
};
var setupAnimationOnElement = function() {
var animation = this,
$element = animation.element,
config = animation.config;
setupPosition($element, config.from);
setupPosition($element, config.to);
animation.configurator.setup($element, config);
$element.data(ANIM_DATA_KEY, animation);
if (fx.off) {
config.duration = 0;
config.delay = 0
}
animation.strategy.initAnimation($element, config);
if (config.start) {
config.start.apply(this, [$element, config])
}
};
var onElementAnimationComplete = function(animation) {
var $element = animation.element,
config = animation.config;
$element.removeData(ANIM_DATA_KEY);
if (config.complete) {
config.complete.apply(this, [$element, config])
}
animation.deferred.resolveWith(this, [$element, config])
};
var startAnimationOnElement = function() {
var animation = this,
$element = animation.element,
config = animation.config;
animation.isStarted = true;
return animation.strategy.animate($element, config).done(function() {
onElementAnimationComplete(animation)
}).fail(function() {
animation.deferred.rejectWith(this, [$element, config])
})
};
var stopAnimationOnElement = function(jumpToEnd) {
var animation = this,
$element = animation.element,
config = animation.config;
clearTimeout(animation.startTimeout);
if (!animation.isStarted) {
animation.start()
}
animation.strategy.stop($element, config, jumpToEnd)
};
var createAnimation = function(element, initialConfig) {
var defaultConfig = "css" === initialConfig.type ? defaultCssConfig : defaultJSConfig,
config = $.extend(true, {}, defaultConfig, initialConfig),
configurator = getAnimationConfigurator(config),
strategy = getAnimationStrategy(config),
animation = {
element: $(element),
config: config,
configurator: configurator,
strategy: strategy,
isSynchronous: strategy.isSynchronous,
setup: setupAnimationOnElement,
start: startAnimationOnElement,
stop: stopAnimationOnElement,
deferred: $.Deferred()
};
if ($.isFunction(configurator.validateConfig)) {
configurator.validateConfig(config)
}
return animation
};
var animate = function(element, config) {
var $element = $(element);
if (!$element.length) {
return $.Deferred().resolve().promise()
}
var animation = createAnimation($element, config);
pushInAnimationQueue($element, animation);
return animation.deferred.promise()
};
var pushInAnimationQueue = function($element, animation) {
var queueData = getAnimQueueData($element);
writeAnimQueueData($element, queueData);
queueData.push(animation);
if (!isAnimating($element)) {
shiftFromAnimationQueue($element, queueData)
}
};
var getAnimQueueData = function($element) {
return $element.data(ANIM_QUEUE_KEY) || []
};
var writeAnimQueueData = function($element, queueData) {
$element.data(ANIM_QUEUE_KEY, queueData)
};
var destroyAnimQueueData = function($element) {
$element.removeData(ANIM_QUEUE_KEY)
};
var isAnimating = function($element) {
return !!$element.data(ANIM_DATA_KEY)
};
var shiftFromAnimationQueue = function($element, queueData) {
queueData = getAnimQueueData($element);
if (!queueData.length) {
return
}
var animation = queueData.shift();
if (0 === queueData.length) {
destroyAnimQueueData($element)
}
executeAnimation(animation).done(function() {
if (!isAnimating($element)) {
shiftFromAnimationQueue($element)
}
})
};
var executeAnimation = function(animation) {
animation.setup();
if (fx.off || animation.isSynchronous) {
animation.start()
} else {
animation.startTimeout = setTimeout(function() {
animation.start()
});
var namespacedRemoveEvent = eventUtils.addNamespace(removeEvent, "dxFXStartAnimation");
animation.element.off(namespacedRemoveEvent).on(namespacedRemoveEvent, function() {
clearTimeout(animation.startTimeout)
})
}
return animation.deferred.promise()
};
var setupPosition = function($element, config) {
if (!config || !config.position) {
return
}
var position = positionUtils.calculate($element, config.position),
offset = $element.offset(),
currentPosition = $element.position();
$.extend(config, {
left: position.h.location - offset.left + currentPosition.left,
top: position.v.location - offset.top + currentPosition.top
});
delete config.position
};
var setProps = function($element, props) {
$.each(props, function(key, value) {
try {
$element.css(key, value)
} catch (e) {}
})
};
var stop = function(element, jumpToEnd) {
var $element = $(element),
queueData = getAnimQueueData($element);
$.each(queueData, function(_, animation) {
animation.config.delay = 0;
animation.config.duration = 0;
animation.isSynchronous = true
});
if (!isAnimating($element)) {
shiftFromAnimationQueue($element, queueData)
}
var animation = $element.data(ANIM_DATA_KEY);
if (animation) {
animation.stop(jumpToEnd)
}
$element.removeData(ANIM_DATA_KEY);
destroyAnimQueueData($element)
};
var fx = {
off: false,
animationTypes: animationConfigurators,
animate: animate,
createAnimation: createAnimation,
isAnimating: isAnimating,
stop: stop,
_simulatedTransitionEndDelay: 100
};
fx.__internals = {
convertTransitionTimingFuncToJQueryEasing: convertTransitionTimingFuncToJQueryEasing
};
module.exports = fx
},
/*!*****************************************!*\
!*** ./Scripts/animation/translator.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
support = __webpack_require__( /*! ../core/utils/support */ 48);
var TRANSLATOR_DATA_KEY = "dxTranslator",
TRANSFORM_MATRIX_REGEX = /matrix(3d)?\((.+?)\)/,
TRANSLATE_REGEX = /translate(?:3d)?\((.+?)\)/;
var locate = function($element) {
var translate = support.transform ? getTranslate($element) : getTranslateFallback($element);
return {
left: translate.x,
top: translate.y
}
};
var move = function($element, position) {
if (!support.transform) {
$element.css(position);
return
}
var translate, left = position.left,
top = position.top;
if (void 0 === left) {
translate = getTranslate($element);
translate.y = top || 0
} else {
if (void 0 === top) {
translate = getTranslate($element);
translate.x = left || 0
} else {
translate = {
x: left || 0,
y: top || 0,
z: 0
};
cacheTranslate($element, translate)
}
}
$element.css({
transform: getTranslateCss(translate)
});
if (isPercentValue(left) || isPercentValue(top)) {
clearCache($element)
}
};
var isPercentValue = function(value) {
return "string" === $.type(value) && "%" === value[value.length - 1]
};
var getTranslateFallback = function($element) {
var result;
try {
var originalTop = $element.css("top"),
originalLeft = $element.css("left");
var position = $element.position();
$element.css({
transform: "none",
top: 0,
left: 0
});
clearCache($element);
var finalPosition = $element.position();
result = {
x: position.left - finalPosition.left || parseInt(originalLeft) || 0,
y: position.top - finalPosition.top || parseInt(originalTop) || 0
};
$element.css({
top: originalTop,
left: originalLeft
})
} catch (e) {
result = {
x: 0,
y: 0
}
}
return result
};
var getTranslate = function($element) {
var result = $element.length ? $.data($element.get(0), TRANSLATOR_DATA_KEY) : null;
if (!result) {
var transformValue = $element.css("transform") || getTranslateCss({
x: 0,
y: 0
}),
matrix = transformValue.match(TRANSFORM_MATRIX_REGEX),
is3D = matrix && matrix[1];
if (matrix) {
matrix = matrix[2].split(",");
if ("3d" === is3D) {
matrix = matrix.slice(12, 15)
} else {
matrix.push(0);
matrix = matrix.slice(4, 7)
}
} else {
matrix = [0, 0, 0]
}
result = {
x: parseFloat(matrix[0]),
y: parseFloat(matrix[1]),
z: parseFloat(matrix[2])
};
cacheTranslate($element, result)
}
return result
};
var cacheTranslate = function($element, translate) {
if ($element.length) {
$.data($element.get(0), TRANSLATOR_DATA_KEY, translate)
}
};
var clearCache = function($element) {
if ($element.length) {
$.removeData($element.get(0), TRANSLATOR_DATA_KEY)
}
};
var resetPosition = function($element) {
$element.css({
left: 0,
top: 0,
transform: "none"
});
clearCache($element)
};
var parseTranslate = function(translateString) {
var result = translateString.match(TRANSLATE_REGEX);
if (!result || !result[1]) {
return
}
result = result[1].split(",");
result = {
x: parseFloat(result[0]),
y: parseFloat(result[1]),
z: parseFloat(result[2])
};
return result
};
var getTranslateCss = function(translate) {
translate.x = translate.x || 0;
translate.y = translate.y || 0;
var xValueString = isPercentValue(translate.x) ? translate.x : translate.x + "px";
var yValueString = isPercentValue(translate.y) ? translate.y : translate.y + "px";
return "translate(" + xValueString + ", " + yValueString + ")"
};
exports.move = move;
exports.locate = locate;
exports.clearCache = clearCache;
exports.parseTranslate = parseTranslate;
exports.getTranslate = getTranslate;
exports.getTranslateCss = getTranslateCss;
exports.resetPosition = resetPosition
},
/*!***************************************!*\
!*** ./Scripts/animation/position.js ***!
\***************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
commonUtils = __webpack_require__( /*! ../core/utils/common */ 14),
stringUtils = __webpack_require__( /*! ../core/utils/string */ 13),
translator = __webpack_require__( /*! ./translator */ 60),
support = __webpack_require__( /*! ../core/utils/support */ 48);
var horzRe = /left|right/,
vertRe = /top|bottom/,
collisionRe = /fit|flip|none/;
var normalizeAlign = function(raw) {
var result = {
h: "center",
v: "center"
};
var pair = commonUtils.splitPair(raw);
if (pair) {
$.each(pair, function() {
var w = String(this).toLowerCase();
if (horzRe.test(w)) {
result.h = w
} else {
if (vertRe.test(w)) {
result.v = w
}
}
})
}
return result
};
var normalizeOffset = function(raw) {
return stringUtils.pairToObject(raw)
};
var normalizeCollision = function(raw) {
var pair = commonUtils.splitPair(raw),
h = String(pair && pair[0]).toLowerCase(),
v = String(pair && pair[1]).toLowerCase();
if (!collisionRe.test(h)) {
h = "none"
}
if (!collisionRe.test(v)) {
v = h
}
return {
h: h,
v: v
}
};
var getAlignFactor = function(align) {
switch (align) {
case "center":
return .5;
case "right":
case "bottom":
return 1;
default:
return 0
}
};
var inverseAlign = function(align) {
switch (align) {
case "left":
return "right";
case "right":
return "left";
case "top":
return "bottom";
case "bottom":
return "top";
default:
return align
}
};
var calculateOversize = function(data, bounds) {
var oversize = 0;
if (data.myLocation < bounds.min) {
oversize += bounds.min - data.myLocation
}
if (data.myLocation > bounds.max) {
oversize += data.myLocation - bounds.max
}
return oversize
};
var collisionSide = function(direction, data, bounds) {
if (data.myLocation < bounds.min) {
return "h" === direction ? "left" : "top"
}
if (data.myLocation > bounds.max) {
return "h" === direction ? "right" : "bottom"
}
return "none"
};
var initMyLocation = function(data) {
data.myLocation = data.atLocation + getAlignFactor(data.atAlign) * data.atSize - getAlignFactor(data.myAlign) * data.mySize + data.offset
};
var decolliders = {
fit: function(data, bounds) {
var result = false;
if (data.myLocation > bounds.max) {
data.myLocation = bounds.max;
result = true
}
if (data.myLocation < bounds.min) {
data.myLocation = bounds.min;
result = true
}
data.fit = result
},
flip: function(data, bounds) {
data.flip = false;
if ("center" === data.myAlign && "center" === data.atAlign) {
return
}
if (data.myLocation < bounds.min || data.myLocation > bounds.max) {
var inverseData = $.extend({}, data, {
myAlign: inverseAlign(data.myAlign),
atAlign: inverseAlign(data.atAlign),
offset: -data.offset
});
initMyLocation(inverseData);
inverseData.oversize = calculateOversize(inverseData, bounds);
if (inverseData.myLocation >= bounds.min && inverseData.myLocation <= bounds.max || data.oversize > inverseData.oversize) {
data.myLocation = inverseData.myLocation;
data.oversize = inverseData.oversize;
data.flip = true
}
}
},
flipfit: function(data, bounds) {
this.flip(data, bounds);
this.fit(data, bounds)
},
none: function(data, bounds) {
data.oversize = 0
}
};
var scrollbarWidth;
var calculateScrollbarWidth = function() {
var $scrollDiv = $("
").css({
width: 100,
height: 100,
overflow: "scroll",
position: "absolute",
top: -9999
}).appendTo($("body")),
result = $scrollDiv.get(0).offsetWidth - $scrollDiv.get(0).clientWidth;
$scrollDiv.remove();
scrollbarWidth = result
};
var defaultPositionResult = {
h: {
location: 0,
flip: false,
fit: false,
oversize: 0
},
v: {
location: 0,
flip: false,
fit: false,
oversize: 0
}
};
var calculatePosition = function(what, options) {
var $what = $(what),
currentOffset = $what.offset(),
result = $.extend(true, {}, defaultPositionResult, {
h: {
location: currentOffset.left
},
v: {
location: currentOffset.top
}
});
if (!options) {
return result
}
var my = normalizeAlign(options.my),
at = normalizeAlign(options.at),
of = options.of || window,
offset = normalizeOffset(options.offset),
collision = normalizeCollision(options.collision),
boundary = options.boundary,
boundaryOffset = normalizeOffset(options.boundaryOffset);
var h = {
mySize: $what.outerWidth(),
myAlign: my.h,
atAlign: at.h,
offset: offset.h,
collision: collision.h,
boundaryOffset: boundaryOffset.h
};
var v = {
mySize: $what.outerHeight(),
myAlign: my.v,
atAlign: at.v,
offset: offset.v,
collision: collision.v,
boundaryOffset: boundaryOffset.v
};
if (of.preventDefault) {
h.atLocation = of.pageX;
v.atLocation = of.pageY;
h.atSize = 0;
v.atSize = 0
} else {
of = $(of);
if ($.isWindow(of[0])) {
h.atLocation = of.scrollLeft();
v.atLocation = of.scrollTop();
h.atSize = of.width();
v.atSize = of.height()
} else {
if (9 === of[0].nodeType) {
h.atLocation = 0;
v.atLocation = 0;
h.atSize = of.width();
v.atSize = of.height()
} else {
var o = of.offset();
h.atLocation = o.left;
v.atLocation = o.top;
h.atSize = of.outerWidth();
v.atSize = of.outerHeight()
}
}
}
initMyLocation(h);
initMyLocation(v);
var bounds = function() {
var win = $(window),
windowWidth = win.width(),
windowHeight = win.height(),
left = win.scrollLeft(),
top = win.scrollTop(),
hScrollbar = document.width > document.documentElement.clientWidth,
vScrollbar = document.height > document.documentElement.clientHeight,
hZoomLevel = support.touch ? document.documentElement.clientWidth / (vScrollbar ? windowWidth - scrollbarWidth : windowWidth) : 1,
vZoomLevel = support.touch ? document.documentElement.clientHeight / (hScrollbar ? windowHeight - scrollbarWidth : windowHeight) : 1;
if (void 0 === scrollbarWidth) {
calculateScrollbarWidth()
}
var boundaryWidth = windowWidth,
boundaryHeight = windowHeight;
if (boundary) {
var $boundary = $(boundary),
boundaryPosition = $boundary.offset();
left = boundaryPosition.left;
top = boundaryPosition.top;
boundaryWidth = $boundary.width();
boundaryHeight = $boundary.height()
}
return {
h: {
min: left + h.boundaryOffset,
max: left + boundaryWidth / hZoomLevel - h.mySize - h.boundaryOffset
},
v: {
min: top + v.boundaryOffset,
max: top + boundaryHeight / vZoomLevel - v.mySize - v.boundaryOffset
}
}
}();
h.oversize = calculateOversize(h, bounds.h);
v.oversize = calculateOversize(v, bounds.v);
h.collisionSide = collisionSide("h", h, bounds.h);
v.collisionSide = collisionSide("v", v, bounds.v);
if (decolliders[h.collision]) {
decolliders[h.collision](h, bounds.h)
}
if (decolliders[v.collision]) {
decolliders[v.collision](v, bounds.v)
}
var preciser = function(number) {
return options.precise ? number : Math.round(number)
};
$.extend(true, result, {
h: {
location: preciser(h.myLocation),
oversize: preciser(h.oversize),
fit: h.fit,
flip: h.flip,
collisionSide: h.collisionSide
},
v: {
location: preciser(v.myLocation),
oversize: preciser(v.oversize),
fit: v.fit,
flip: v.flip,
collisionSide: v.collisionSide
},
precise: options.precise
});
return result
};
var position = function(what, options) {
var $what = $(what);
if (!options) {
return $what.offset()
}
translator.resetPosition($what);
var offset = $what.offset(),
targetPosition = options.h && options.v ? options : calculatePosition($what, options);
var preciser = function(number) {
return options.precise ? number : Math.round(number)
};
translator.move($what, {
left: targetPosition.h.location - preciser(offset.left),
top: targetPosition.v.location - preciser(offset.top)
});
return targetPosition
};
$.extend(position, {
inverseAlign: inverseAlign,
normalizeAlign: normalizeAlign
});
module.exports = {
calculateScrollbarWidth: calculateScrollbarWidth,
calculate: calculatePosition,
setup: position
}
},
/*!*********************************!*\
!*** ./Scripts/events/utils.js ***!
\*********************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
errors = __webpack_require__( /*! ../core/errors */ 17),
eventNS = $.event,
hooksNS = eventNS.fixHooks;
var eventSource = function() {
var EVENT_SOURCES_REGEX = {
dx: /^dx/i,
mouse: /(mouse|wheel)/i,
touch: /^touch/i,
keyboard: /^key/i,
pointer: /^(ms)?pointer/i
};
return function(e) {
var result = "other";
$.each(EVENT_SOURCES_REGEX, function(key) {
if (this.test(e.type)) {
result = key;
return false
}
});
return result
}
}();
var isDxEvent = function(e) {
return "dx" === eventSource(e)
};
var isNativeMouseEvent = function(e) {
return "mouse" === eventSource(e)
};
var isNativeTouchEvent = function(e) {
return "touch" === eventSource(e)
};
var isPointerEvent = function(e) {
return "pointer" === eventSource(e)
};
var isMouseEvent = function(e) {
return isNativeMouseEvent(e) || (isPointerEvent(e) || isDxEvent(e)) && "mouse" === e.pointerType
};
var isTouchEvent = function(e) {
return isNativeTouchEvent(e) || (isPointerEvent(e) || isDxEvent(e)) && "touch" === e.pointerType
};
var isKeyboardEvent = function(e) {
return "keyboard" === eventSource(e)
};
var isFakeClickEvent = function(e) {
return 0 === e.screenX && !e.offsetX && 0 === e.pageX
};
var eventData = function(e) {
return {
x: e.pageX,
y: e.pageY,
time: e.timeStamp
}
};
var eventDelta = function(from, to) {
return {
x: to.x - from.x,
y: to.y - from.y,
time: to.time - from.time || 1
}
};
var hasTouches = function(e) {
if (isNativeTouchEvent(e)) {
return (e.originalEvent.touches || []).length
}
if (isDxEvent(e)) {
return (e.pointers || []).length
}
return 0
};
var needSkipEvent = function(e) {
var $target = $(e.target),
touchInInput = $target.is("input, textarea, select");
if ($target.is(".dx-skip-gesture-event *, .dx-skip-gesture-event")) {
return true
}
if ("dxmousewheel" === e.type) {
return $target.is("input[type='number'], textarea, select") && $target.is(":focus")
}
if (isMouseEvent(e)) {
return touchInInput || e.which > 1
}
if (isTouchEvent(e)) {
return touchInInput && $target.is(":focus")
}
};
var createEvent = function(originalEvent, args) {
var event = $.Event(originalEvent),
fixHook = hooksNS[originalEvent.type] || eventNS.mouseHooks;
var props = fixHook.props ? eventNS.props.concat(fixHook.props) : eventNS.props,
propIndex = props.length;
while (propIndex--) {
var prop = props[propIndex];
event[prop] = originalEvent[prop]
}
if (args) {
$.extend(event, args)
}
return fixHook.filter ? fixHook.filter(event, originalEvent) : event
};
var fireEvent = function(props) {
var event = createEvent(props.originalEvent, props);
eventNS.trigger(event, null, props.delegateTarget || event.target);
return event
};
var addNamespace = function(eventNames, namespace) {
if (!namespace) {
throw errors.Error("E0017")
}
if ("string" === typeof eventNames) {
if (eventNames.indexOf(" ") === -1) {
return eventNames + "." + namespace
}
return addNamespace(eventNames.split(/\s+/g), namespace)
}
$.each(eventNames, function(index, eventName) {
eventNames[index] = eventName + "." + namespace
});
return eventNames.join(" ")
};
module.exports = {
eventSource: eventSource,
isPointerEvent: isPointerEvent,
isMouseEvent: isMouseEvent,
isTouchEvent: isTouchEvent,
isKeyboardEvent: isKeyboardEvent,
isFakeClickEvent: isFakeClickEvent,
hasTouches: hasTouches,
eventData: eventData,
eventDelta: eventDelta,
needSkipEvent: needSkipEvent,
createEvent: createEvent,
fireEvent: fireEvent,
addNamespace: addNamespace
}
},
/*!**********************************************************************!*\
!*** ./Scripts/animation/transition_executor/transition_executor.js ***!
\**********************************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
fx = __webpack_require__( /*! ../fx */ 59),
animationPresetsModule = __webpack_require__( /*! ../presets/presets */ 58);
var directionPostfixes = {
forward: " dx-forward",
backward: " dx-backward",
none: " dx-no-direction",
undefined: " dx-no-direction"
},
DX_ANIMATING_CLASS = "dx-animating";
var TransitionExecutor = Class.inherit({
ctor: function() {
this._accumulatedDelays = {
enter: 0,
leave: 0
};
this._animations = [];
this.reset()
},
_createAnimations: function($elements, initialConfig, configModifier, type) {
var animationConfig, that = this,
result = [];
configModifier = configModifier || {};
animationConfig = this._prepareElementAnimationConfig(initialConfig, configModifier, type);
if (animationConfig) {
$elements.each(function() {
var animation = that._createAnimation($(this), animationConfig, configModifier);
if (animation) {
animation.element.addClass(DX_ANIMATING_CLASS);
animation.setup();
result.push(animation)
}
})
}
return result
},
_prepareElementAnimationConfig: function(config, configModifier, type) {
var result;
if ("string" === typeof config) {
var presetName = config;
config = animationPresetsModule.presets.getPreset(presetName)
}
if (!config) {
result = void 0
} else {
if ($.isFunction(config[type])) {
result = config[type]
} else {
result = $.extend({
skipElementInitialStyles: true,
cleanupWhen: this._completePromise
}, config, configModifier);
if (!result.type || "css" === result.type) {
var cssClass = "dx-" + type,
extraCssClasses = (result.extraCssClasses ? " " + result.extraCssClasses : "") + directionPostfixes[result.direction];
result.type = "css";
result.from = (result.from || cssClass) + extraCssClasses;
result.to = result.to || cssClass + "-active"
}
result.staggerDelay = result.staggerDelay || 0;
result.delay = result.delay || 0;
if (result.staggerDelay) {
result.delay += this._accumulatedDelays[type];
this._accumulatedDelays[type] += result.staggerDelay
}
}
}
return result
},
_createAnimation: function($element, animationConfig, configModifier) {
var result;
if ($.isPlainObject(animationConfig)) {
result = fx.createAnimation($element, animationConfig)
} else {
if ($.isFunction(animationConfig)) {
result = animationConfig($element, configModifier)
}
}
return result
},
_startAnimations: function() {
var animations = this._animations;
for (var i = 0; i < animations.length; i++) {
animations[i].start()
}
},
_stopAnimations: function(jumpToEnd) {
var animations = this._animations;
for (var i = 0; i < animations.length; i++) {
animations[i].stop(jumpToEnd)
}
},
_clearAnimations: function() {
var animations = this._animations;
for (var i = 0; i < animations.length; i++) {
animations[i].element.removeClass(DX_ANIMATING_CLASS)
}
this._animations.length = 0
},
reset: function() {
this._accumulatedDelays.enter = 0;
this._accumulatedDelays.leave = 0;
this._clearAnimations();
this._completeDeferred = $.Deferred();
this._completePromise = this._completeDeferred.promise()
},
enter: function($elements, animationConfig, configModifier) {
var animations = this._createAnimations($elements, animationConfig, configModifier, "enter");
this._animations.push.apply(this._animations, animations)
},
leave: function($elements, animationConfig, configModifier) {
var animations = this._createAnimations($elements, animationConfig, configModifier, "leave");
this._animations.push.apply(this._animations, animations)
},
start: function() {
var result, that = this;
if (!this._animations.length) {
that.reset();
result = $.Deferred().resolve().promise()
} else {
var animationDeferreds = $.map(this._animations, function(animation) {
var result = $.Deferred();
animation.deferred.always(function() {
result.resolve()
});
return result.promise()
});
result = $.when.apply($, animationDeferreds).always(function() {
that._completeDeferred.resolve();
that.reset()
});
commonUtils.executeAsync(function() {
that._startAnimations()
})
}
return result
},
stop: function(jumpToEnd) {
this._stopAnimations(jumpToEnd)
}
});
exports.TransitionExecutor = TransitionExecutor
},
/*!*********************************!*\
!*** ./Scripts/events/click.js ***!
\*********************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
devices = __webpack_require__( /*! ../core/devices */ 40),
domUtils = __webpack_require__( /*! ../core/utils/dom */ 50),
animationFrame = __webpack_require__( /*! ../animation/frame */ 46),
eventUtils = __webpack_require__( /*! ./utils */ 62),
pointerEvents = __webpack_require__( /*! ./pointer */ 65),
Emitter = __webpack_require__( /*! ./core/emitter */ 75),
registerEmitter = __webpack_require__( /*! ./core/emitter_registrator */ 76);
var CLICK_EVENT_NAME = "dxclick",
TOUCH_BOUNDARY = 10,
abs = Math.abs;
var isInput = function(element) {
return $(element).is("input, textarea, select, button ,:focus, :focus *")
};
var misc = {
requestAnimationFrame: animationFrame.requestAnimationFrame
};
var ClickEmitter = Emitter.inherit({
ctor: function(element) {
this.callBase(element);
this._makeElementClickable($(element))
},
_makeElementClickable: function($element) {
if (!$element.attr("onclick")) {
$element.attr("onclick", "void(0)")
}
},
start: function(e) {
this._blurPrevented = e.isDefaultPrevented();
this._startTarget = e.target;
this._startEventData = eventUtils.eventData(e)
},
end: function(e) {
if (this._eventOutOfElement(e, this.getElement().get(0)) || e.type === pointerEvents.cancel) {
this._cancel(e);
return
}
if (!isInput(e.target) && !this._blurPrevented) {
domUtils.resetActiveElement()
}
this._accept(e);
misc.requestAnimationFrame($.proxy(function() {
this._fireClickEvent(e)
}, this))
},
_eventOutOfElement: function(e, element) {
var target = e.target,
targetChanged = !$.contains(element, target) && element !== target,
gestureDelta = eventUtils.eventDelta(eventUtils.eventData(e), this._startEventData),
boundsExceeded = abs(gestureDelta.x) > TOUCH_BOUNDARY || abs(gestureDelta.y) > TOUCH_BOUNDARY;
return targetChanged || boundsExceeded
},
_fireClickEvent: function(e) {
this._fireEvent(CLICK_EVENT_NAME, e, {
target: domUtils.closestCommonParent(this._startTarget, e.target)
})
}
});
! function() {
var NATIVE_CLICK_CLASS = "dx-native-click";
var useNativeClick = devices.real().generic;
var prevented = null;
function isNativeClickEvent(e) {
return useNativeClick || $(e.target).closest("." + NATIVE_CLICK_CLASS).length
}
ClickEmitter = ClickEmitter.inherit({
configurate: function(data) {
this.callBase(data);
if (data.useNative) {
this.getElement().addClass(NATIVE_CLICK_CLASS)
}
},
start: function(e) {
prevented = null;
if (!isNativeClickEvent(e)) {
this.callBase(e)
}
},
end: function(e) {
if (!isNativeClickEvent(e)) {
this.callBase(e)
}
},
cancel: function() {
prevented = true
}
});
var clickHandler = function(e) {
if ((!e.which || 1 === e.which) && !prevented && isNativeClickEvent(e)) {
eventUtils.fireEvent({
type: CLICK_EVENT_NAME,
originalEvent: e
})
}
};
$(document).on(eventUtils.addNamespace("click", "NATIVE_DXCLICK_STRATEGY"), clickHandler);
exports.useNativeClick = useNativeClick
}();
! function() {
var desktopDevice = devices.real().generic;
if (!desktopDevice) {
var startTarget = null,
blurPrevented = false;
var pointerDownHandler = function(e) {
startTarget = e.target;
blurPrevented = e.isDefaultPrevented()
};
var clickHandler = function(e) {
var $target = $(e.target);
if (!blurPrevented && startTarget && !$target.is(startTarget) && !$(startTarget).is("label") && isInput($target)) {
domUtils.resetActiveElement()
}
startTarget = null;
blurPrevented = false
};
var NATIVE_CLICK_FIXER_NAMESPACE = "NATIVE_CLICK_FIXER";
$(document).on(eventUtils.addNamespace(pointerEvents.down, NATIVE_CLICK_FIXER_NAMESPACE), pointerDownHandler).on(eventUtils.addNamespace("click", NATIVE_CLICK_FIXER_NAMESPACE), clickHandler)
}
}();
registerEmitter({
emitter: ClickEmitter,
bubble: true,
events: [CLICK_EVENT_NAME]
});
exports.name = CLICK_EVENT_NAME;
exports.misc = misc
},
/*!***********************************!*\
!*** ./Scripts/events/pointer.js ***!
\***********************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
support = __webpack_require__( /*! ../core/utils/support */ 48),
devices = __webpack_require__( /*! ../core/devices */ 40),
registerEvent = __webpack_require__( /*! ./core/event_registrator */ 66),
TouchStrategy = __webpack_require__( /*! ./pointer/touch */ 67),
MsPointerStrategy = __webpack_require__( /*! ./pointer/mspointer */ 70),
MouseStrategy = __webpack_require__( /*! ./pointer/mouse */ 73),
MouseAndTouchStrategy = __webpack_require__( /*! ./pointer/mouse_and_touch */ 74);
var EventStrategy = function() {
if (support.pointerEvents) {
return MsPointerStrategy
}
var device = devices.real();
if (support.touch && !(device.tablet || device.phone)) {
return MouseAndTouchStrategy
}
if (support.touch) {
return TouchStrategy
}
return MouseStrategy
}();
$.each(EventStrategy.map, function(pointerEvent, originalEvents) {
registerEvent(pointerEvent, new EventStrategy(pointerEvent, originalEvents))
});
module.exports = {
down: "dxpointerdown",
up: "dxpointerup",
move: "dxpointermove",
cancel: "dxpointercancel",
enter: "dxpointerenter",
leave: "dxpointerleave",
over: "dxpointerover",
out: "dxpointerout"
}
},
/*!**************************************************!*\
!*** ./Scripts/events/core/event_registrator.js ***!
\**************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
MemorizedCallbacks = __webpack_require__( /*! ../../core/memorized_callbacks */ 44);
var eventNS = $.event,
hooksNS = eventNS.fixHooks,
specialNS = $.event.special;
var DX_EVENT_HOOKS = {
props: eventNS.mouseHooks.props.concat(["pointerType", "pointerId", "pointers"])
};
var callbacks = new MemorizedCallbacks;
var registerEvent = function(name, eventObject) {
var strategy = {};
if ("noBubble" in eventObject) {
strategy.noBubble = eventObject.noBubble
}
if ("bindType" in eventObject) {
strategy.bindType = eventObject.bindType
}
if ("delegateType" in eventObject) {
strategy.delegateType = eventObject.delegateType
}
$.each(["setup", "teardown", "add", "remove", "trigger", "handle", "_default", "dispose"], function(_, methodName) {
if (!eventObject[methodName]) {
return
}
strategy[methodName] = function() {
var args = $.makeArray(arguments);
args.unshift(this);
return eventObject[methodName].apply(eventObject, args)
}
});
hooksNS[name] = DX_EVENT_HOOKS;
callbacks.fire(name, strategy)
};
registerEvent.callbacks = callbacks;
var registerJQueryEvent = function(name, eventObject) {
specialNS[name] = eventObject
};
callbacks.add(registerJQueryEvent);
module.exports = registerEvent
},
/*!*****************************************!*\
!*** ./Scripts/events/pointer/touch.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
devices = __webpack_require__( /*! ../../core/devices */ 40),
BaseStrategy = __webpack_require__( /*! ./base */ 68);
__webpack_require__( /*! ./touch_hooks */ 69);
var eventMap = {
dxpointerdown: "touchstart",
dxpointermove: "touchmove",
dxpointerup: "touchend",
dxpointercancel: "touchcancel",
dxpointerover: "",
dxpointerout: "",
dxpointerenter: "",
dxpointerleave: ""
};
var normalizeTouchEvent = function(e) {
var pointers = [];
$.each(e.touches, function(_, touch) {
pointers.push($.extend({
pointerId: touch.identifier
}, touch))
});
return {
pointers: pointers,
pointerId: e.changedTouches[0].identifier
}
};
var skipTouchWithSameIdentifier = function(pointerEvent) {
return "ios" === devices.real().platform && ("dxpointerdown" === pointerEvent || "dxpointerup" === pointerEvent)
};
var TouchStrategy = BaseStrategy.inherit({
ctor: function() {
this.callBase.apply(this, arguments);
this._pointerId = 0
},
_handler: function(e) {
if (skipTouchWithSameIdentifier(this._eventName)) {
var touch = e.changedTouches[0];
if (this._pointerId === touch.identifier && 0 !== this._pointerId) {
return
}
this._pointerId = touch.identifier
}
return this.callBase.apply(this, arguments)
},
_fireEvent: function(args) {
return this.callBase($.extend(normalizeTouchEvent(args.originalEvent), args))
}
});
TouchStrategy.map = eventMap;
TouchStrategy.normalize = normalizeTouchEvent;
module.exports = TouchStrategy
},
/*!****************************************!*\
!*** ./Scripts/events/pointer/base.js ***!
\****************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
browser = __webpack_require__( /*! ../../core/utils/browser */ 18),
Class = __webpack_require__( /*! ../../core/class */ 20),
eventUtils = __webpack_require__( /*! ../utils */ 62);
var POINTER_EVENTS_NAMESPACE = "dxPointerEvents";
var BaseStrategy = Class.inherit({
ctor: function(eventName, originalEvents) {
this._eventName = eventName;
this._originalEvents = eventUtils.addNamespace(originalEvents, POINTER_EVENTS_NAMESPACE);
this._handlerCount = 0;
this.noBubble = this._isNoBubble()
},
_isNoBubble: function() {
var eventName = this._eventName;
return "dxpointerenter" === eventName || "dxpointerleave" === eventName
},
_handler: function(e) {
var delegateTarget = this._getDelegateTarget(e);
return this._fireEvent({
type: this._eventName,
pointerType: e.pointerType || eventUtils.eventSource(e),
originalEvent: e,
delegateTarget: delegateTarget,
timeStamp: browser.mozilla ? (new Date).getTime() : e.timeStamp
})
},
_getDelegateTarget: function(e) {
var delegateTarget;
if (this.noBubble) {
delegateTarget = e.delegateTarget
}
return delegateTarget
},
_fireEvent: function(args) {
return eventUtils.fireEvent(args)
},
setup: function() {
return true
},
add: function(element, handleObj) {
if (this._handlerCount <= 0 || this.noBubble) {
this._selector = handleObj.selector;
element = this.noBubble ? element : document;
var that = this;
$(element).on(this._originalEvents, this._selector, function(e) {
that._handler(e)
})
}
if (!this.noBubble) {
this._handlerCount++
}
},
remove: function(element) {
if (!this.noBubble) {
this._handlerCount--
}
},
teardown: function(element) {
if (this._handlerCount && !this.noBubble) {
return
}
element = this.noBubble ? element : document;
if (this._originalEvents !== "." + POINTER_EVENTS_NAMESPACE) {
$(element).off(this._originalEvents, this._selector)
}
},
dispose: function(element) {
element = this.noBubble ? element : document;
$(element).off(this._originalEvents)
}
});
module.exports = BaseStrategy
},
/*!***********************************************!*\
!*** ./Scripts/events/pointer/touch_hooks.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9);
var touchEventHook = {
filter: function(event, originalEvent) {
var touches = originalEvent.touches.length ? originalEvent.touches : originalEvent.changedTouches;
$.each(["pageX", "pageY", "screenX", "screenY", "clientX", "clientY"], function() {
event[this] = touches[0][this]
});
return event
},
props: $.event.mouseHooks.props.concat(["touches", "changedTouches", "targetTouches", "detail", "result", "originalTarget", "charCode", "prevValue"])
};
$.each(["touchstart", "touchmove", "touchend", "touchcancel"], function() {
$.event.fixHooks[this] = touchEventHook
})
},
/*!*********************************************!*\
!*** ./Scripts/events/pointer/mspointer.js ***!
\*********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
BaseStrategy = __webpack_require__( /*! ./base */ 68),
Observer = __webpack_require__( /*! ./observer */ 71),
browser = __webpack_require__( /*! ../../core/utils/browser */ 18);
__webpack_require__( /*! ./mspointer_hooks */ 72);
var isIE10 = browser.msie && 10 === parseInt(browser.version);
var eventMap = {
dxpointerdown: "MSPointerDown pointerdown",
dxpointermove: "MSPointerMove pointermove",
dxpointerup: "MSPointerUp pointerup",
dxpointercancel: "MSPointerCancel pointercancel",
dxpointerover: "MSPointerOver pointerover",
dxpointerout: "MSPointerOut pointerout",
dxpointerenter: isIE10 ? "mouseenter" : "MSPointerEnter pointerenter",
dxpointerleave: isIE10 ? "mouseleave" : "MSPointerLeave pointerleave"
};
var observer;
var activated = false;
var activateStrategy = function() {
if (activated) {
return
}
observer = new Observer(eventMap, function(a, b) {
return a.pointerId === b.pointerId
}, function(e) {
if (e.isPrimary) {
observer.reset()
}
});
activated = true
};
var MsPointerStrategy = BaseStrategy.inherit({
ctor: function() {
this.callBase.apply(this, arguments);
activateStrategy()
},
_fireEvent: function(args) {
return this.callBase($.extend({
pointers: observer.pointers(),
pointerId: args.originalEvent.pointerId
}, args))
}
});
MsPointerStrategy.map = eventMap;
MsPointerStrategy.resetObserver = function() {
observer.reset()
};
module.exports = MsPointerStrategy
},
/*!********************************************!*\
!*** ./Scripts/events/pointer/observer.js ***!
\********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9);
var addEventsListener = function(events, handler) {
events = events.split(" ");
$.each(events, function(_, event) {
if (document.addEventListener) {
document.addEventListener(event, handler, true)
} else {
document.attachEvent("on" + event, handler)
}
})
};
var Observer = function(eventMap, pointerEquals, onPointerAdding) {
onPointerAdding = onPointerAdding || function() {};
var pointers = [];
var getPointerIndex = function(e) {
var index = -1;
$.each(pointers, function(i, pointer) {
if (!pointerEquals(e, pointer)) {
return true
}
index = i;
return false
});
return index
};
var addPointer = function(e) {
if (getPointerIndex(e) === -1) {
onPointerAdding(e);
pointers.push(e)
}
};
var removePointer = function(e) {
var index = getPointerIndex(e);
if (index > -1) {
pointers.splice(index, 1)
}
};
var updatePointer = function(e) {
pointers[getPointerIndex(e)] = e
};
addEventsListener(eventMap.dxpointerdown, addPointer);
addEventsListener(eventMap.dxpointermove, updatePointer);
addEventsListener(eventMap.dxpointerup, removePointer);
addEventsListener(eventMap.dxpointercancel, removePointer);
this.pointers = function() {
return pointers
};
this.reset = function() {
pointers = []
}
};
module.exports = Observer
},
/*!***************************************************!*\
!*** ./Scripts/events/pointer/mspointer_hooks.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9);
var POINTER_TYPE_MAP = {
2: "touch",
3: "pen",
4: "mouse"
};
var pointerEventHook = {
filter: function(event, originalEvent) {
var pointerType = originalEvent.pointerType;
if ($.isNumeric(pointerType)) {
event.pointerType = POINTER_TYPE_MAP[pointerType]
}
return event
},
props: $.event.mouseHooks.props.concat(["pointerId", "pointerType", "originalTarget", "width", "height", "pressure", "result", "tiltX", "charCode", "tiltY", "detail", "isPrimary", "prevValue"])
};
$.each(["MSPointerDown", "MSPointerMove", "MSPointerUp", "MSPointerCancel", "MSPointerOver", "MSPointerOut", "mouseenter", "mouseleave", "pointerdown", "pointermove", "pointerup", "pointercancel", "pointerover", "pointerout", "pointerenter", "pointerleave"], function() {
$.event.fixHooks[this] = pointerEventHook
})
},
/*!*****************************************!*\
!*** ./Scripts/events/pointer/mouse.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
BaseStrategy = __webpack_require__( /*! ./base */ 68),
Observer = __webpack_require__( /*! ./observer */ 71);
var eventMap = {
dxpointerdown: "mousedown",
dxpointermove: "mousemove",
dxpointerup: "mouseup",
dxpointercancel: "",
dxpointerover: "mouseover",
dxpointerout: "mouseout",
dxpointerenter: "mouseenter",
dxpointerleave: "mouseleave"
};
var normalizeMouseEvent = function(e) {
e.pointerId = 1;
return {
pointers: observer.pointers(),
pointerId: 1
}
};
var observer;
var activated = false;
var activateStrategy = function() {
if (activated) {
return
}
observer = new Observer(eventMap, function(a, b) {
return true
});
activated = true
};
var MouseStrategy = BaseStrategy.inherit({
ctor: function() {
this.callBase.apply(this, arguments);
activateStrategy()
},
_fireEvent: function(args) {
return this.callBase($.extend(normalizeMouseEvent(args.originalEvent), args))
}
});
MouseStrategy.map = eventMap;
MouseStrategy.normalize = normalizeMouseEvent;
MouseStrategy.activate = activateStrategy;
MouseStrategy.resetObserver = function() {
observer.reset()
};
module.exports = MouseStrategy
},
/*!***************************************************!*\
!*** ./Scripts/events/pointer/mouse_and_touch.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
BaseStrategy = __webpack_require__( /*! ./base */ 68),
MouseStrategy = __webpack_require__( /*! ./mouse */ 73),
TouchStrategy = __webpack_require__( /*! ./touch */ 67),
eventUtils = __webpack_require__( /*! ../utils */ 62);
var eventMap = {
dxpointerdown: "touchstart mousedown",
dxpointermove: "touchmove mousemove",
dxpointerup: "touchend mouseup",
dxpointercancel: "touchcancel",
dxpointerover: "mouseover",
dxpointerout: "mouseout",
dxpointerenter: "mouseenter",
dxpointerleave: "mouseleave"
};
var activated = false;
var activateStrategy = function() {
if (activated) {
return
}
MouseStrategy.activate();
activated = true
};
var MouseAndTouchStrategy = BaseStrategy.inherit({
EVENT_LOCK_TIMEOUT: 100,
ctor: function() {
this.callBase.apply(this, arguments);
activateStrategy()
},
_handler: function(e) {
var isMouseEvent = eventUtils.isMouseEvent(e);
if (!isMouseEvent) {
this._skipNextEvents = true
}
if (isMouseEvent && this._mouseLocked) {
return
}
if (isMouseEvent && this._skipNextEvents) {
this._skipNextEvents = false;
this._mouseLocked = true;
clearTimeout(this._unlockMouseTimer);
var that = this;
this._unlockMouseTimer = setTimeout(function() {
that._mouseLocked = false
}, this.EVENT_LOCK_TIMEOUT);
return
}
return this.callBase(e)
},
_fireEvent: function(args) {
var isMouseEvent = eventUtils.isMouseEvent(args.originalEvent),
normalizer = isMouseEvent ? MouseStrategy.normalize : TouchStrategy.normalize;
return this.callBase($.extend(normalizer(args.originalEvent), args))
},
dispose: function() {
this.callBase();
this._skipNextEvents = false;
this._mouseLocked = false;
clearTimeout(this._unlockMouseTimer)
}
});
MouseAndTouchStrategy.map = eventMap;
MouseAndTouchStrategy.resetObserver = MouseStrategy.resetObserver;
module.exports = MouseAndTouchStrategy
},
/*!****************************************!*\
!*** ./Scripts/events/core/emitter.js ***!
\****************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
eventUtils = __webpack_require__( /*! ../utils */ 62);
var Emitter = Class.inherit({
ctor: function(element) {
this._$element = $(element);
this._cancelCallback = $.Callbacks();
this._acceptCallback = $.Callbacks()
},
getElement: function() {
return this._$element
},
validate: function(e) {
return "dxmousewheel" !== e.type
},
validatePointers: function(e) {
return 1 === eventUtils.hasTouches(e)
},
allowInterruptionByMousewheel: function() {
return true
},
configurate: function(data) {
$.extend(this, data)
},
addCancelCallback: function(callback) {
this._cancelCallback.add(callback)
},
removeCancelCallback: function() {
this._cancelCallback.empty()
},
_cancel: function(e) {
this._cancelCallback.fire(this, e)
},
addAcceptCallback: function(callback) {
this._acceptCallback.add(callback)
},
removeAcceptCallback: function() {
this._acceptCallback.empty()
},
_accept: function(e) {
this._acceptCallback.fire(this, e)
},
_requestAccept: function(e) {
this._acceptRequestEvent = e
},
_forgetAccept: function() {
this._accept(this._acceptRequestEvent);
this._acceptRequestEvent = null
},
start: $.noop,
move: $.noop,
end: $.noop,
cancel: $.noop,
reset: function() {
if (this._acceptRequestEvent) {
this._accept(this._acceptRequestEvent)
}
},
_fireEvent: function(eventName, e, params) {
var eventData = $.extend({
type: eventName,
originalEvent: e,
target: this._getEmitterTarget(e),
delegateTarget: this.getElement().get(0)
}, params);
e = eventUtils.fireEvent(eventData);
if (e.cancel) {
this._cancel(e)
}
return e
},
_getEmitterTarget: function(e) {
return (this.delegateSelector ? $(e.target).closest(this.delegateSelector) : this.getElement()).get(0)
},
dispose: $.noop
});
module.exports = Emitter
},
/*!****************************************************!*\
!*** ./Scripts/events/core/emitter_registrator.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
registerEvent = __webpack_require__( /*! ./event_registrator */ 66),
eventUtils = __webpack_require__( /*! ../utils */ 62),
pointerEvents = __webpack_require__( /*! ../pointer */ 65),
wheelEvent = __webpack_require__( /*! ./wheel */ 77);
var MANAGER_EVENT = "dxEventManager",
EMITTER_DATA = "dxEmitter";
var EventManager = Class.inherit({
ctor: function() {
this._attachHandlers();
this.reset();
this._proxiedCancelHandler = $.proxy(this._cancelHandler, this);
this._proxiedAcceptHandler = $.proxy(this._acceptHandler, this)
},
_attachHandlers: function() {
$(document).on(eventUtils.addNamespace(pointerEvents.down, MANAGER_EVENT), $.proxy(this._pointerDownHandler, this)).on(eventUtils.addNamespace(pointerEvents.move, MANAGER_EVENT), $.proxy(this._pointerMoveHandler, this)).on(eventUtils.addNamespace([pointerEvents.up, pointerEvents.cancel].join(" "), MANAGER_EVENT), $.proxy(this._pointerUpHandler, this)).on(eventUtils.addNamespace(wheelEvent.name, MANAGER_EVENT), $.proxy(this._mouseWheelHandler, this))
},
_eachEmitter: function(callback) {
var activeEmitters = this._activeEmitters || [];
var i = 0;
while (activeEmitters.length > i) {
var emitter = activeEmitters[i];
if (false === callback(emitter)) {
break
}
if (activeEmitters[i] === emitter) {
i++
}
}
},
_applyToEmitters: function(method, arg) {
this._eachEmitter(function(emitter) {
emitter[method].call(emitter, arg)
})
},
reset: function() {
this._eachEmitter(this._proxiedCancelHandler);
this._activeEmitters = []
},
resetEmitter: function(emitter) {
this._proxiedCancelHandler(emitter)
},
_pointerDownHandler: function(e) {
if (eventUtils.isMouseEvent(e) && e.which > 1) {
return
}
this._updateEmitters(e)
},
_updateEmitters: function(e) {
if (!this._isSetChanged(e)) {
return
}
this._cleanEmitters(e);
this._fetchEmitters(e)
},
_isSetChanged: function(e) {
var currentSet = this._closestEmitter(e);
var previousSet = this._emittersSet || [];
var setChanged = currentSet.length !== previousSet.length;
$.each(currentSet, function(index, emitter) {
setChanged = setChanged || previousSet[index] !== emitter;
return !setChanged
});
this._emittersSet = currentSet;
return setChanged
},
_closestEmitter: function(e) {
var that = this,
result = [],
$element = $(e.target);
function handleEmitter(_, emitter) {
if (!!emitter && emitter.validatePointers(e) && emitter.validate(e)) {
emitter.addCancelCallback(that._proxiedCancelHandler);
emitter.addAcceptCallback(that._proxiedAcceptHandler);
result.push(emitter)
}
}
while ($element.length) {
var emitters = $.data($element.get(0), EMITTER_DATA) || [];
$.each(emitters, handleEmitter);
$element = $element.parent()
}
return result
},
_acceptHandler: function(acceptedEmitter, e) {
var that = this;
this._eachEmitter(function(emitter) {
if (emitter !== acceptedEmitter) {
that._cancelEmitter(emitter, e)
}
})
},
_cancelHandler: function(canceledEmitter, e) {
this._cancelEmitter(canceledEmitter, e)
},
_cancelEmitter: function(emitter, e) {
var activeEmitters = this._activeEmitters;
if (e) {
emitter.cancel(e)
} else {
emitter.reset()
}
emitter.removeCancelCallback();
emitter.removeAcceptCallback();
var emitterIndex = $.inArray(emitter, activeEmitters);
if (emitterIndex > -1) {
activeEmitters.splice(emitterIndex, 1)
}
},
_cleanEmitters: function(e) {
this._applyToEmitters("end", e);
this.reset(e)
},
_fetchEmitters: function(e) {
this._activeEmitters = this._emittersSet.slice();
this._applyToEmitters("start", e)
},
_pointerMoveHandler: function(e) {
this._applyToEmitters("move", e)
},
_pointerUpHandler: function(e) {
this._updateEmitters(e)
},
_mouseWheelHandler: function(e) {
if (!this._allowInterruptionByMousewheel()) {
return
}
e.pointers = [null];
this._pointerDownHandler(e);
this._adjustWheelEvent(e);
this._pointerMoveHandler(e);
e.pointers = [];
this._pointerUpHandler(e)
},
_allowInterruptionByMousewheel: function() {
var allowInterruption = true;
this._eachEmitter(function(emitter) {
allowInterruption = emitter.allowInterruptionByMousewheel() && allowInterruption;
return allowInterruption
});
return allowInterruption
},
_adjustWheelEvent: function(e) {
var closestGestureEmitter = null;
this._eachEmitter(function(emitter) {
if (!emitter.gesture) {
return
}
var direction = emitter.getDirection(e);
if ("horizontal" !== direction && !e.shiftKey || "vertical" !== direction && e.shiftKey) {
closestGestureEmitter = emitter;
return false
}
});
if (!closestGestureEmitter) {
return
}
var direction = closestGestureEmitter.getDirection(e),
verticalGestureDirection = "both" === direction && !e.shiftKey || "vertical" === direction,
prop = verticalGestureDirection ? "pageY" : "pageX";
e[prop] += e.delta
},
isActive: function(element) {
var result = false;
this._eachEmitter(function(emitter) {
result = result || emitter.getElement().is(element)
});
return result
}
});
var eventManager = new EventManager;
var EMITTER_SUBSCRIPTION_DATA = "dxEmitterSubscription";
var registerEmitter = function(emitterConfig) {
var emitterClass = emitterConfig.emitter,
emitterName = emitterConfig.events[0],
emitterEvents = emitterConfig.events;
$.each(emitterEvents, function(_, eventName) {
registerEvent(eventName, {
noBubble: !emitterConfig.bubble,
setup: function(element, data) {
var subscriptions = $.data(element, EMITTER_SUBSCRIPTION_DATA) || {},
emitters = $.data(element, EMITTER_DATA) || {},
emitter = emitters[emitterName] || new emitterClass(element);
subscriptions[eventName] = true;
emitters[emitterName] = emitter;
$.data(element, EMITTER_DATA, emitters);
$.data(element, EMITTER_SUBSCRIPTION_DATA, subscriptions)
},
add: function(element, handleObj) {
var emitters = $.data(element, EMITTER_DATA),
emitter = emitters[emitterName];
emitter.configurate($.extend({
delegateSelector: handleObj.selector
}, handleObj.data), handleObj.type)
},
teardown: function(element) {
var subscriptions = $.data(element, EMITTER_SUBSCRIPTION_DATA),
emitters = $.data(element, EMITTER_DATA),
emitter = emitters[emitterName];
delete subscriptions[eventName];
var disposeEmitter = true;
$.each(emitterEvents, function(_, eventName) {
disposeEmitter = disposeEmitter && !subscriptions[eventName];
return disposeEmitter
});
if (disposeEmitter) {
if (eventManager.isActive(element)) {
eventManager.resetEmitter(emitter)
}
emitter && emitter.dispose();
delete emitters[emitterName]
}
}
})
})
};
module.exports = registerEmitter
},
/*!**************************************!*\
!*** ./Scripts/events/core/wheel.js ***!
\**************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
registerEvent = __webpack_require__( /*! ./event_registrator */ 66),
eventUtils = __webpack_require__( /*! ../utils */ 62);
var EVENT_NAME = "dxmousewheel",
EVENT_NAMESPACE = "dxWheel";
$.event.fixHooks.wheel = $.event.mouseHooks;
var wheelEvent = void 0 !== document.onwheel ? "wheel" : "mousewheel";
var wheel = {
setup: function(element, data) {
var $element = $(element);
$element.on(eventUtils.addNamespace(wheelEvent, EVENT_NAMESPACE), $.proxy(wheel._wheelHandler, wheel))
},
teardown: function(element) {
var $element = $(element);
$element.off("." + EVENT_NAMESPACE)
},
_wheelHandler: function(e) {
var delta = this._getWheelDelta(e.originalEvent);
eventUtils.fireEvent({
type: EVENT_NAME,
originalEvent: e,
delta: delta,
pointerType: "mouse"
});
e.stopPropagation()
},
_getWheelDelta: function(event) {
return event.wheelDelta ? event.wheelDelta : 30 * -event.deltaY
}
};
registerEvent(EVENT_NAME, wheel);
exports.name = EVENT_NAME
},
/*!***************************************************!*\
!*** ./Scripts/events/gesture/emitter.gesture.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
devices = __webpack_require__( /*! ../../core/devices */ 40),
support = __webpack_require__( /*! ../../core/utils/support */ 48),
browser = __webpack_require__( /*! ../../core/utils/browser */ 18),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50),
mathUtils = __webpack_require__( /*! ../../core/utils/math */ 79),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
eventUtils = __webpack_require__( /*! ../utils */ 62),
Emitter = __webpack_require__( /*! ../core/emitter */ 75),
sign = mathUtils.sign,
abs = Math.abs;
var SLEEP = 0,
INITED = 1,
STARTED = 2,
TOUCH_BOUNDARY = 10,
IMMEDIATE_TOUCH_BOUNDARY = 0,
IMMEDIATE_TIMEOUT = 180;
var isMousewheelEvent = function(e) {
return e && "dxmousewheel" === e.type
};
var supportPointerEvents = function() {
var cssSupport = support.styleProp("pointer-events");
var msieLess11 = browser.msie && parseInt(browser.version, 10) < 11;
return cssSupport && !msieLess11
};
var gestureCover = function() {
var GESTURE_COVER_CLASS = "dx-gesture-cover";
var isDesktop = "generic" === devices.real().platform;
if (!supportPointerEvents() || !isDesktop) {
return $.noop
}
var $cover = $("
").addClass(GESTURE_COVER_CLASS).css("pointerEvents", "none");
$cover.on("dxmousewheel", function(e) {
e.preventDefault()
});
$(function() {
$cover.appendTo("body")
});
return function(toggle, cursor) {
$cover.css("pointerEvents", toggle ? "all" : "none");
toggle && $cover.css("cursor", cursor)
}
}();
var GestureEmitter = Emitter.inherit({
gesture: true,
configurate: function(data) {
this.getElement().css("msTouchAction", data.immediate ? "pinch-zoom" : "");
this.callBase(data)
},
allowInterruptionByMousewheel: function() {
return this._stage !== STARTED
},
getDirection: function() {
return this.direction
},
_cancel: function(e) {
this.callBase.apply(this, arguments);
this._toggleGestureCover(false);
this._stage = SLEEP
},
start: function(e) {
if (eventUtils.needSkipEvent(e)) {
this._cancel(e);
return
}
this._startEvent = eventUtils.createEvent(e);
this._startEventData = eventUtils.eventData(e);
this._prevEventData = this._startEventData;
this._stage = INITED;
this._init(e);
this._setupImmediateTimer()
},
_setupImmediateTimer: function() {
clearTimeout(this._immediateTimer);
this._immediateAccepted = false;
if (!this.immediate) {
return
}
this._immediateTimer = setTimeout($.proxy(function() {
this._immediateAccepted = true
}, this), IMMEDIATE_TIMEOUT)
},
move: function(e) {
if (this._stage === INITED && this._directionConfirmed(e)) {
this._stage = STARTED;
this._resetActiveElement();
this._toggleGestureCover(true, e);
this._clearSelection(e);
this._adjustStartEvent(e);
this._start(this._startEvent);
this._prevEventData = eventUtils.eventData(this._startEvent);
if (this._stage === SLEEP) {
return
}
this._requestAccept(e);
this._move(e);
this._forgetAccept()
} else {
if (this._stage === STARTED) {
this._clearSelection(e);
this._move(e)
}
}
this._prevEventData = eventUtils.eventData(e)
},
_directionConfirmed: function(e) {
var touchBoundary = this._getTouchBoundary(e),
delta = eventUtils.eventDelta(this._startEventData, eventUtils.eventData(e)),
deltaX = abs(delta.x),
deltaY = abs(delta.y);
var horizontalMove = this._validateMove(touchBoundary, deltaX, deltaY),
verticalMove = this._validateMove(touchBoundary, deltaY, deltaX);
var direction = this.getDirection(e),
bothAccepted = "both" === direction && (horizontalMove || verticalMove),
horizontalAccepted = "horizontal" === direction && horizontalMove,
verticalAccepted = "vertical" === direction && verticalMove;
return bothAccepted || horizontalAccepted || verticalAccepted || this._immediateAccepted
},
_validateMove: function(touchBoundary, mainAxis, crossAxis) {
return mainAxis && mainAxis >= touchBoundary && (this.immediate ? mainAxis >= crossAxis : true)
},
_getTouchBoundary: function(e) {
return this.immediate || isMousewheelEvent(e) ? IMMEDIATE_TOUCH_BOUNDARY : TOUCH_BOUNDARY
},
_adjustStartEvent: function(e) {
var touchBoundary = this._getTouchBoundary(e),
delta = eventUtils.eventDelta(this._startEventData, eventUtils.eventData(e));
this._startEvent.pageX += sign(delta.x) * touchBoundary;
this._startEvent.pageY += sign(delta.y) * touchBoundary
},
_resetActiveElement: function() {
if ("ios" === devices.real().platform && $(":focus", this.getElement()).length) {
domUtils.resetActiveElement()
}
},
_toggleGestureCover: function(toggle, e) {
var isStarted = this._stage === STARTED;
if (isStarted) {
gestureCover(toggle, this.getElement().css("cursor"))
}
},
_clearSelection: function(e) {
if (isMousewheelEvent(e) || eventUtils.isTouchEvent(e)) {
return
}
domUtils.clearSelection()
},
end: function(e) {
this._toggleGestureCover(false, e);
if (this._stage === STARTED) {
this._end(e)
} else {
if (this._stage === INITED) {
this._stop(e)
}
}
this._stage = SLEEP
},
dispose: function() {
clearTimeout(this._immediateTimer);
this.callBase.apply(this, arguments);
this._toggleGestureCover(false)
},
_init: $.noop,
_start: $.noop,
_move: $.noop,
_stop: $.noop,
_end: $.noop
});
GestureEmitter.initialTouchBoundary = TOUCH_BOUNDARY;
GestureEmitter.touchBoundary = function(newBoundary) {
if (commonUtils.isDefined(newBoundary)) {
TOUCH_BOUNDARY = newBoundary;
return
}
return TOUCH_BOUNDARY
};
module.exports = GestureEmitter
},
/*!************************************!*\
!*** ./Scripts/core/utils/math.js ***!
\************************************/
function(module, exports) {
var sign = function(value) {
if (0 === value) {
return 0
}
return value / Math.abs(value)
};
var fitIntoRange = function(value, minValue, maxValue) {
return Math.min(Math.max(value, minValue), maxValue)
};
exports.sign = sign;
exports.fitIntoRange = fitIntoRange
},
/*!*****************************************!*\
!*** ./Scripts/localization/message.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
dependencyInjector = __webpack_require__( /*! ../core/utils/dependency_injector */ 23),
stringFormat = __webpack_require__( /*! ../core/utils/string */ 13).format,
humanize = __webpack_require__( /*! ../core/utils/inflector */ 49).humanize;
__webpack_require__( /*! ./core */ 57);
var baseDictionary = $.extend(true, {}, __webpack_require__( /*! ./en/core.en */ 81), __webpack_require__( /*! ./en/widgets-base.en */ 82), __webpack_require__( /*! ./en/widgets-mobile.en */ 83), __webpack_require__( /*! ./en/widgets-web.en */ 84));
var newMessages = {};
var messageLocalization = dependencyInjector({
_dictionary: baseDictionary,
locale: function() {
var currentLocale = "en";
return function(locale) {
if (!locale) {
return currentLocale
}
currentLocale = locale
}
}(),
load: function(messages) {
$.extend(true, this._dictionary, messages)
},
_localizablePrefix: "@",
setup: function(localizablePrefix) {
this._localizablePrefix = localizablePrefix
},
localizeString: function(text) {
var that = this,
regex = new RegExp("(^|[^a-zA-Z_0-9" + that._localizablePrefix + "-]+)(" + that._localizablePrefix + "{1,2})([a-zA-Z_0-9-]+)", "g"),
escapeString = that._localizablePrefix + that._localizablePrefix;
return text.replace(regex, function(str, prefix, escape, localizationKey) {
var result, defaultResult = that._localizablePrefix + localizationKey;
if (escape !== escapeString) {
result = that.format(localizationKey)
}
if (!result) {
newMessages[localizationKey] = humanize(localizationKey)
}
return prefix + (result || defaultResult)
})
},
_messageLoaded: function(key, locale) {
return void 0 !== this._dictionary[locale || this.locale()][key]
},
localizeNode: function(node) {
var that = this;
$(node).each(function(index, nodeItem) {
if (!nodeItem.nodeType) {
return
}
if (3 === nodeItem.nodeType) {
nodeItem.nodeValue = that.localizeString(nodeItem.nodeValue)
} else {
if (!$(nodeItem).is("iframe")) {
$.each(nodeItem.attributes || [], function(index, attr) {
if ("string" === typeof attr.value) {
var localizedValue = that.localizeString(attr.value);
if (attr.value !== localizedValue) {
attr.value = localizedValue
}
}
});
$(nodeItem).contents().each(function(index, node) {
that.localizeNode(node)
})
}
}
})
},
getMessagesByLocales: function() {
return this._dictionary
},
getDictionary: function(onlyNew) {
if (onlyNew) {
return newMessages
}
return $.extend({}, newMessages, this.getMessagesByLocales()[this.locale()])
},
getFormatter: function(key, locale) {
var localeMessages = this._dictionary[locale || this.locale()],
message = localeMessages && localeMessages[key];
if (message) {
return function() {
var args = 1 === arguments.length && Array.isArray(arguments[0]) ? arguments[0].slice(0) : Array.prototype.slice.call(arguments, 0);
args.unshift(message);
return stringFormat.apply(this, args)
}
}
},
format: function(key) {
var formatter = this.getFormatter(key);
return formatter && formatter() || ""
}
});
module.exports = messageLocalization
},
/*!********************************************!*\
!*** ./Scripts/localization/en/core.en.js ***!
\********************************************/
function(module, exports) {
module.exports = {
en: {
Yes: "Yes",
No: "No",
Cancel: "Cancel",
Clear: "Clear",
Done: "Done",
Loading: "Loading...",
Select: "Select...",
Search: "Search",
Back: "Back",
OK: "OK",
"dxCollectionWidget-noDataText": "No data to display",
"validation-required": "Required",
"validation-required-formatted": "{0} is required",
"validation-numeric": "Value must be a number",
"validation-numeric-formatted": "{0} must be a number",
"validation-range": "Value is out of range",
"validation-range-formatted": "{0} is out of range",
"validation-stringLength": "The length of the value is not correct",
"validation-stringLength-formatted": "The length of {0} is not correct",
"validation-custom": "Value is invalid",
"validation-custom-formatted": "{0} is invalid",
"validation-compare": "Values do not match",
"validation-compare-formatted": "{0} does not match",
"validation-pattern": "Value does not match pattern",
"validation-pattern-formatted": "{0} does not match pattern",
"validation-email": "Email is invalid",
"validation-email-formatted": "{0} is invalid",
"validation-mask": "Value is invalid"
}
}
},
/*!****************************************************!*\
!*** ./Scripts/localization/en/widgets-base.en.js ***!
\****************************************************/
function(module, exports) {
module.exports = {
en: {
"dxLookup-searchPlaceholder": "Minimum character number: {0}",
"dxList-pullingDownText": "Pull down to refresh...",
"dxList-pulledDownText": "Release to refresh...",
"dxList-refreshingText": "Refreshing...",
"dxList-pageLoadingText": "Loading...",
"dxList-nextButtonText": "More",
"dxList-selectAll": "Select All",
"dxListEditDecorator-delete": "Delete",
"dxListEditDecorator-more": "More",
"dxScrollView-pullingDownText": "Pull down to refresh...",
"dxScrollView-pulledDownText": "Release to refresh...",
"dxScrollView-refreshingText": "Refreshing...",
"dxScrollView-reachBottomText": "Loading...",
"dxDateBox-simulatedDataPickerTitleTime": "Select time",
"dxDateBox-simulatedDataPickerTitleDate": "Select date",
"dxDateBox-simulatedDataPickerTitleDateTime": "Select date and time",
"dxDateBox-validation-datetime": "Value must be a date or time",
"dxFileUploader-selectFile": "Select file",
"dxFileUploader-dropFile": "or Drop file here",
"dxFileUploader-bytes": "bytes",
"dxFileUploader-kb": "kb",
"dxFileUploader-Mb": "Mb",
"dxFileUploader-Gb": "Gb",
"dxFileUploader-upload": "Upload",
"dxFileUploader-uploaded": "Uploaded",
"dxFileUploader-readyToUpload": "Ready to upload",
"dxFileUploader-uploadFailedMessage": "Upload failed",
"dxRangeSlider-ariaFrom": "From",
"dxRangeSlider-ariaTill": "Till",
"dxSwitch-onText": "ON",
"dxSwitch-offText": "OFF",
"dxForm-optionalMark": "optional",
"dxForm-requiredMessage": "{0} is required",
"dxNumberBox-invalidValueMessage": "Value must be a number"
}
}
},
/*!******************************************************!*\
!*** ./Scripts/localization/en/widgets-mobile.en.js ***!
\******************************************************/
function(module, exports) {},
/*!***************************************************!*\
!*** ./Scripts/localization/en/widgets-web.en.js ***!
\***************************************************/
function(module, exports) {
module.exports = {
en: {
"dxDataGrid-columnChooserTitle": "Column Chooser",
"dxDataGrid-columnChooserEmptyText": "Drag a column here to hide it",
"dxDataGrid-groupContinuesMessage": "Continues on the next page",
"dxDataGrid-groupContinuedMessage": "Continued from the previous page",
"dxDataGrid-groupHeaderText": "Group by This Column",
"dxDataGrid-ungroupHeaderText": "Ungroup",
"dxDataGrid-ungroupAllText": "Ungroup All",
"dxDataGrid-editingEditRow": "Edit",
"dxDataGrid-editingSaveRowChanges": "Save",
"dxDataGrid-editingCancelRowChanges": "Cancel",
"dxDataGrid-editingDeleteRow": "Delete",
"dxDataGrid-editingUndeleteRow": "Undelete",
"dxDataGrid-editingConfirmDeleteMessage": "Are you sure you want to delete this record?",
"dxDataGrid-validationCancelChanges": "Cancel changes",
"dxDataGrid-groupPanelEmptyText": "Drag a column header here to group by that column",
"dxDataGrid-noDataText": "No data",
"dxDataGrid-searchPanelPlaceholder": "Search...",
"dxDataGrid-filterRowShowAllText": "(All)",
"dxDataGrid-filterRowResetOperationText": "Reset",
"dxDataGrid-filterRowOperationEquals": "Equals",
"dxDataGrid-filterRowOperationNotEquals": "Does not equal",
"dxDataGrid-filterRowOperationLess": "Less than",
"dxDataGrid-filterRowOperationLessOrEquals": "Less than or equal to",
"dxDataGrid-filterRowOperationGreater": "Greater than",
"dxDataGrid-filterRowOperationGreaterOrEquals": "Greater than or equal to",
"dxDataGrid-filterRowOperationStartsWith": "Starts with",
"dxDataGrid-filterRowOperationContains": "Contains",
"dxDataGrid-filterRowOperationNotContains": "Does not contain",
"dxDataGrid-filterRowOperationEndsWith": "Ends with",
"dxDataGrid-filterRowOperationBetween": "Between",
"dxDataGrid-filterRowOperationBetweenStartText": "Start",
"dxDataGrid-filterRowOperationBetweenEndText": "End",
"dxDataGrid-applyFilterText": "Apply filter",
"dxDataGrid-trueText": "true",
"dxDataGrid-falseText": "false",
"dxDataGrid-sortingAscendingText": "Sort Ascending",
"dxDataGrid-sortingDescendingText": "Sort Descending",
"dxDataGrid-sortingClearText": "Clear Sorting",
"dxDataGrid-editingSaveAllChanges": "Save changes",
"dxDataGrid-editingCancelAllChanges": "Discard changes",
"dxDataGrid-editingAddRow": "Add a row",
"dxDataGrid-summaryMin": "Min: {0}",
"dxDataGrid-summaryMinOtherColumn": "Min of {1} is {0}",
"dxDataGrid-summaryMax": "Max: {0}",
"dxDataGrid-summaryMaxOtherColumn": "Max of {1} is {0}",
"dxDataGrid-summaryAvg": "Avg: {0}",
"dxDataGrid-summaryAvgOtherColumn": "Avg of {1} is {0}",
"dxDataGrid-summarySum": "Sum: {0}",
"dxDataGrid-summarySumOtherColumn": "Sum of {1} is {0}",
"dxDataGrid-summaryCount": "Count: {0}",
"dxDataGrid-columnFixingFix": "Fix",
"dxDataGrid-columnFixingUnfix": "Unfix",
"dxDataGrid-columnFixingLeftPosition": "To the left",
"dxDataGrid-columnFixingRightPosition": "To the right",
"dxDataGrid-exportTo": "Export",
"dxDataGrid-exportToExcel": "Export to Excel file",
"dxDataGrid-excelFormat": "Excel file",
"dxDataGrid-selectedRows": "Selected rows",
"dxDataGrid-exportSelectedRows": "Export selected rows",
"dxDataGrid-exportAll": "Export all data",
"dxDataGrid-headerFilterEmptyValue": "(Blanks)",
"dxDataGrid-headerFilterOK": "OK",
"dxDataGrid-headerFilterCancel": "Cancel",
"dxDataGrid-ariaColumn": "Column",
"dxDataGrid-ariaValue": "Value",
"dxDataGrid-ariaFilterCell": "Filter cell",
"dxDataGrid-ariaCollapse": "Collapse",
"dxDataGrid-ariaExpand": "Expand",
"dxDataGrid-ariaDataGrid": "Data grid",
"dxDataGrid-ariaSearchInGrid": "Search in data grid",
"dxDataGrid-ariaSelectAll": "Select all",
"dxDataGrid-ariaSelectRow": "Select row",
"dxPager-infoText": "Page {0} of {1} ({2} items)",
"dxPager-pagesCountText": "of",
"dxPivotGrid-grandTotal": "Grand Total",
"dxPivotGrid-total": "{0} Total",
"dxPivotGrid-fieldChooserTitle": "Field Chooser",
"dxPivotGrid-showFieldChooser": "Show Field Chooser",
"dxPivotGrid-expandAll": "Expand All",
"dxPivotGrid-collapseAll": "Collapse All",
"dxPivotGrid-sortColumnBySummary": 'Sort "{0}" by This Column',
"dxPivotGrid-sortRowBySummary": 'Sort "{0}" by This Row',
"dxPivotGrid-removeAllSorting": "Remove All Sorting",
"dxPivotGrid-rowFields": "Row Fields",
"dxPivotGrid-columnFields": "Column Fields",
"dxPivotGrid-dataFields": "Data Fields",
"dxPivotGrid-filterFields": "Filter Fields",
"dxPivotGrid-allFields": "All Fields",
"dxPivotGrid-columnFieldArea": "Drop Column Fields Here",
"dxPivotGrid-dataFieldArea": "Drop Data Fields Here",
"dxPivotGrid-rowFieldArea": "Drop Row Fields Here",
"dxPivotGrid-filterFieldArea": "Drop Filter Fields Here",
"dxScheduler-editorLabelTitle": "Subject",
"dxScheduler-editorLabelStartDate": "Start Date",
"dxScheduler-editorLabelEndDate": "End Date",
"dxScheduler-editorLabelDescription": "Description",
"dxScheduler-editorLabelRecurrence": "Repeat",
"dxScheduler-openAppointment": "Open appointment",
"dxScheduler-recurrenceNever": "Never",
"dxScheduler-recurrenceDaily": "Daily",
"dxScheduler-recurrenceWeekly": "Weekly",
"dxScheduler-recurrenceMonthly": "Monthly",
"dxScheduler-recurrenceYearly": "Yearly",
"dxScheduler-recurrenceEvery": "Every",
"dxScheduler-recurrenceEnd": "End repeat",
"dxScheduler-recurrenceAfter": "After",
"dxScheduler-recurrenceOn": "On",
"dxScheduler-recurrenceRepeatDaily": "day(s)",
"dxScheduler-recurrenceRepeatWeekly": "week(s)",
"dxScheduler-recurrenceRepeatMonthly": "month(s)",
"dxScheduler-recurrenceRepeatYearly": "year(s)",
"dxScheduler-switcherDay": "Day",
"dxScheduler-switcherWeek": "Week",
"dxScheduler-switcherWorkWeek": "Work week",
"dxScheduler-switcherMonth": "Month",
"dxScheduler-switcherAgenda": "Agenda",
"dxScheduler-switcherTimelineDay": "Timeline Day",
"dxScheduler-switcherTimelineWeek": "Timeline Week",
"dxScheduler-switcherTimelineWorkWeek": "Timeline Work Week",
"dxScheduler-switcherTimelineMonth": "Timeline Month",
"dxScheduler-recurrenceRepeatOnDate": "on date",
"dxScheduler-recurrenceRepeatCount": "occurrence(s)",
"dxScheduler-allDay": "All day",
"dxScheduler-confirmRecurrenceEditMessage": "Do you want to edit only this appointment or the whole series?",
"dxScheduler-confirmRecurrenceDeleteMessage": "Do you want to delete only this appointment or the whole series?",
"dxScheduler-confirmRecurrenceEditSeries": "Edit series",
"dxScheduler-confirmRecurrenceDeleteSeries": "Delete series",
"dxScheduler-confirmRecurrenceEditOccurrence": "Edit appointment",
"dxScheduler-confirmRecurrenceDeleteOccurrence": "Delete appointment",
"dxScheduler-noTimezoneTitle": "No timezone",
"dxCalendar-todayButtonText": "Today",
"dxCalendar-ariaWidgetName": "Calendar",
"dxColorView-ariaRed": "Red",
"dxColorView-ariaGreen": "Green",
"dxColorView-ariaBlue": "Blue",
"dxColorView-ariaAlpha": "Transparency",
"dxColorView-ariaHex": "Color code",
"vizExport-printingButtonText": "Print",
"vizExport-titleMenuText": "Exporting/Printing",
"vizExport-exportButtonText": "{0} file"
}
}
},
/*!**********************************************!*\
!*** ./Scripts/bundles/modules/framework.js ***!
\**********************************************/
function(module, exports, __webpack_require__) {
__webpack_require__( /*! ./core */ 6);
__webpack_require__( /*! ../../integration/knockout */ 86);
module.exports = DevExpress.framework = {};
DevExpress.framework.dxCommand = __webpack_require__( /*! ../../framework/command */ 121);
DevExpress.framework.Router = __webpack_require__( /*! ../../framework/router */ 123);
DevExpress.framework.StateManager = __webpack_require__( /*! ../../framework/state_manager */ 124);
DevExpress.framework.ViewCache = __webpack_require__( /*! ../../framework/view_cache */ 125);
DevExpress.framework.NullViewCache = __webpack_require__( /*! ../../framework/view_cache */ 125).NullViewCache;
DevExpress.framework.ConditionalViewCacheDecorator = __webpack_require__( /*! ../../framework/view_cache */ 125).ConditionalViewCacheDecorator;
DevExpress.framework.CapacityViewCacheDecorator = __webpack_require__( /*! ../../framework/view_cache */ 125).CapacityViewCacheDecorator;
DevExpress.framework.HistoryDependentViewCacheDecorator = __webpack_require__( /*! ../../framework/view_cache */ 125).HistoryDependentViewCacheDecorator;
DevExpress.framework.dxCommandContainer = __webpack_require__( /*! ../../framework/html/command_container */ 126);
DevExpress.framework.dxView = __webpack_require__( /*! ../../framework/html/view_engine_components */ 128).dxView;
DevExpress.framework.dxLayout = __webpack_require__( /*! ../../framework/html/view_engine_components */ 128).dxLayout;
DevExpress.framework.dxViewPlaceholder = __webpack_require__( /*! ../../framework/html/view_engine_components */ 128).dxViewPlaceholder;
DevExpress.framework.dxContentPlaceholder = __webpack_require__( /*! ../../framework/html/view_engine_components */ 128).dxContentPlaceholder;
DevExpress.framework.dxTransition = __webpack_require__( /*! ../../framework/html/view_engine_components */ 128).dxTransition;
DevExpress.framework.dxContent = __webpack_require__( /*! ../../framework/html/view_engine_components */ 128).dxContent;
DevExpress.framework.html = {};
DevExpress.framework.html.HtmlApplication = __webpack_require__( /*! ../../framework/html/html_application */ 129);
DevExpress.framework.Route = __webpack_require__( /*! ../../framework/router */ 123).Route;
DevExpress.framework.MemoryKeyValueStorage = __webpack_require__( /*! ../../framework/state_manager */ 124).MemoryKeyValueStorage;
DevExpress.framework.NavigationDevices = __webpack_require__( /*! ../../framework/navigation_devices */ 134);
DevExpress.framework.NavigationManager = __webpack_require__( /*! ../../framework/navigation_manager */ 133);
DevExpress.framework.createActionExecutors = __webpack_require__( /*! ../../framework/action_executors */ 132).createActionExecutors;
DevExpress.framework.Application = __webpack_require__( /*! ../../framework/application */ 130).Application;
var browserAdapters = __webpack_require__( /*! ../../framework/browser_adapters */ 135);
DevExpress.framework.DefaultBrowserAdapter = browserAdapters.DefaultBrowserAdapter;
DevExpress.framework.OldBrowserAdapter = browserAdapters.OldBrowserAdapter;
DevExpress.framework.BuggyAndroidBrowserAdapter = browserAdapters.BuggyAndroidBrowserAdapter;
DevExpress.framework.HistorylessBrowserAdapter = browserAdapters.HistorylessBrowserAdapter;
DevExpress.framework.BuggyCordovaWP81BrowserAdapter = browserAdapters.BuggyCordovaWP81BrowserAdapter;
DevExpress.framework.CommandMapping = __webpack_require__( /*! ../../framework/command_mapping */ 136);
DevExpress.framework.HistoryBasedNavigationDevice = __webpack_require__( /*! ../../framework/navigation_devices */ 134).HistoryBasedNavigationDevice;
DevExpress.framework.StackBasedNavigationDevice = __webpack_require__( /*! ../../framework/navigation_devices */ 134).StackBasedNavigationDevice;
DevExpress.framework.HistoryBasedNavigationManager = __webpack_require__( /*! ../../framework/navigation_manager */ 133).HistoryBasedNavigationManager;
DevExpress.framework.StackBasedNavigationManager = __webpack_require__( /*! ../../framework/navigation_manager */ 133).StackBasedNavigationManager;
DevExpress.framework.NavigationStack = __webpack_require__( /*! ../../framework/navigation_manager */ 133).NavigationStack;
DevExpress.framework.utils = __webpack_require__( /*! ../../framework/utils */ 131).utils;
DevExpress.framework.templateProvider = __webpack_require__( /*! ../../framework/utils */ 131).templateProvider;
DevExpress.framework.html.CommandManager = __webpack_require__( /*! ../../framework/html/command_manager */ 139);
DevExpress.framework.html.HtmlApplication = __webpack_require__( /*! ../../framework/html/html_application */ 129);
DevExpress.framework.html.layoutSets = __webpack_require__( /*! ../../framework/html/presets */ 138).layoutSets;
DevExpress.framework.html.animationSets = __webpack_require__( /*! ../../framework/html/presets */ 138).animationSets;
DevExpress.framework.html.DefaultLayoutController = __webpack_require__( /*! ../../framework/html/layout_controller */ 142).DefaultLayoutController;
DevExpress.framework.html.layoutSets = __webpack_require__( /*! ../../framework/html/layout_controller */ 142).layoutSets;
DevExpress.framework.html.MarkupComponent = __webpack_require__( /*! ../../framework/html/markup_component */ 127).MarkupComponent;
DevExpress.framework.html.ViewEngine = __webpack_require__( /*! ../../framework/html/view_engine */ 141).ViewEngine;
DevExpress.framework.html.ViewEngineComponents = __webpack_require__( /*! ../../framework/html/view_engine_components */ 128);
var widgetCommandAdaptersModule = __webpack_require__( /*! ../../framework/html/widget_command_adapters */ 140);
DevExpress.framework.html.commandToDXWidgetAdapters = {
dxToolbar: widgetCommandAdaptersModule.dxToolbar,
dxList: widgetCommandAdaptersModule.dxList,
dxNavBar: widgetCommandAdaptersModule.dxNavBar,
dxPivot: widgetCommandAdaptersModule.dxPivot,
dxSlideOut: widgetCommandAdaptersModule.dxSlideOut
}
},
/*!*****************************************!*\
!*** ./Scripts/integration/knockout.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var ko = __webpack_require__( /*! knockout */ 87);
if (ko) {
var errors = __webpack_require__( /*! ../core/errors */ 17),
compareVersion = __webpack_require__( /*! ../core/utils/version */ 45).compare;
if (compareVersion(ko.version, [2, 3]) < 0) {
throw errors.Error("E0013")
}
__webpack_require__( /*! ./knockout/component_registrator */ 88);
__webpack_require__( /*! ./knockout/event_registrator */ 114);
__webpack_require__( /*! ./knockout/components */ 115);
__webpack_require__( /*! ./knockout/validation */ 116);
__webpack_require__( /*! ./knockout/variable_wrapper_utils */ 118);
__webpack_require__( /*! ./knockout/clean_node */ 119);
__webpack_require__( /*! ./knockout/clean_node_old */ 120)
}
},
/*!****************************!*\
!*** external "window.ko" ***!
\****************************/
function(module, exports) {
module.exports = window.ko
},
/*!***************************************************************!*\
!*** ./Scripts/integration/knockout/component_registrator.js ***!
\***************************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
ko = __webpack_require__( /*! knockout */ 87),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 43),
Widget = __webpack_require__( /*! ../../ui/widget/ui.widget */ 89),
KoTemplateProvider = __webpack_require__( /*! ./template_provider */ 104),
Editor = __webpack_require__( /*! ../../ui/editor/editor */ 107),
Locker = __webpack_require__( /*! ../../core/utils/locker */ 113);
var LOCKS_DATA_KEY = "dxKoLocks",
CREATED_WITH_KO_DATA_KEY = "dxKoCreation";
var editorsBindingHandlers = [];
var registerComponentKoBinding = function(componentName, componentClass) {
if (componentClass.subclassOf(Editor)) {
editorsBindingHandlers.push(componentName)
}
ko.bindingHandlers[componentName] = {
init: function(domNode, valueAccessor) {
var $element = $(domNode),
optionChangedCallbacks = $.Callbacks(),
ctorOptions = {
templateProvider: KoTemplateProvider,
modelByElement: function($element) {
if ($element.length) {
return ko.dataFor($element.get(0))
}
},
nestedComponentOptions: function(component) {
return {
modelByElement: component.option("modelByElement"),
nestedComponentOptions: component.option("nestedComponentOptions")
}
},
watchMethod: function(watchValue, callback, element) {
var values;
ko.computed(function() {
if (values) {
callback()
}
values = watchValue()
}, null, {
disposeWhenNodeIsRemoved: element
})
},
_optionChangedCallbacks: optionChangedCallbacks
},
optionNameToModelMap = {};
var applyModelValueToOption = function(optionName, modelValue) {
var component = $element.data(componentName),
locks = $element.data(LOCKS_DATA_KEY),
optionValue = ko.unwrap(modelValue);
if (ko.isWriteableObservable(modelValue)) {
optionNameToModelMap[optionName] = modelValue
}
if (component) {
if (locks.locked(optionName)) {
return
}
locks.obtain(optionName);
try {
if (ko.ignoreDependencies) {
ko.ignoreDependencies(component.option, component, [optionName, optionValue])
} else {
component.option(optionName, optionValue)
}
} finally {
locks.release(optionName)
}
} else {
ctorOptions[optionName] = optionValue
}
};
var handleOptionChanged = function(args) {
var optionName = args.fullName,
optionValue = args.value;
if (!(optionName in optionNameToModelMap)) {
return
}
var $element = this._$element,
locks = $element.data(LOCKS_DATA_KEY);
if (locks.locked(optionName)) {
return
}
locks.obtain(optionName);
try {
optionNameToModelMap[optionName](optionValue)
} finally {
locks.release(optionName)
}
};
var createComponent = function() {
optionChangedCallbacks.add(handleOptionChanged);
$element.data(CREATED_WITH_KO_DATA_KEY, true).data(LOCKS_DATA_KEY, new Locker)[componentName](ctorOptions);
ctorOptions = null
};
var unwrapModelValue = function(currentModel, propertyName, propertyPath) {
var unwrappedPropertyValue;
ko.computed(function() {
var propertyValue = currentModel[propertyName];
applyModelValueToOption(propertyPath, propertyValue);
unwrappedPropertyValue = ko.unwrap(propertyValue)
}, null, {
disposeWhenNodeIsRemoved: domNode
});
if ($.isPlainObject(unwrappedPropertyValue)) {
unwrapModel(unwrappedPropertyValue, propertyPath)
}
};
var unwrapModel = function(model, propertyPath) {
for (var propertyName in model) {
if (model.hasOwnProperty(propertyName)) {
unwrapModelValue(model, propertyName, propertyPath ? [propertyPath, propertyName].join(".") : propertyName)
}
}
};
ko.computed(function() {
var component = $element.data(componentName),
model = ko.unwrap(valueAccessor());
if (component) {
component.beginUpdate()
}
unwrapModel(model);
if (component) {
component.endUpdate()
} else {
createComponent()
}
}, null, {
disposeWhenNodeIsRemoved: domNode
});
return {
controlsDescendantBindings: componentClass.subclassOf(Widget)
}
}
};
if ("dxValidator" === componentName) {
ko.bindingHandlers.dxValidator.after = editorsBindingHandlers
}
};
registerComponent.callbacks.add(function(name, componentClass) {
registerComponentKoBinding(name, componentClass)
})
},
/*!****************************************!*\
!*** ./Scripts/ui/widget/ui.widget.js ***!
\****************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
errors = __webpack_require__( /*! ./ui.errors */ 10),
Action = __webpack_require__( /*! ../../core/action */ 35),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50),
devices = __webpack_require__( /*! ../../core/devices */ 40),
DOMComponent = __webpack_require__( /*! ../../core/dom_component */ 29),
TemplateBase = __webpack_require__( /*! ./ui.template_base */ 90),
DynamicTemplate = __webpack_require__( /*! ./ui.template.dynamic */ 91),
EmptyTemplate = __webpack_require__( /*! ./ui.template.empty */ 92),
MoveTemplate = __webpack_require__( /*! ./ui.template.move */ 93),
TemplateProvider = __webpack_require__( /*! ./jquery.template_provider */ 94),
KeyboardProcessor = __webpack_require__( /*! ./ui.keyboard_processor */ 100),
selectors = __webpack_require__( /*! ./jquery.selectors */ 101),
eventUtils = __webpack_require__( /*! ../../events/utils */ 62),
hoverEvents = __webpack_require__( /*! ../../events/hover */ 102),
feedbackEvents = __webpack_require__( /*! ../../events/core/emitter.feedback */ 103),
clickEvent = __webpack_require__( /*! ../../events/click */ 64);
var UI_FEEDBACK = "UIFeedback",
WIDGET_CLASS = "dx-widget",
ACTIVE_STATE_CLASS = "dx-state-active",
DISABLED_STATE_CLASS = "dx-state-disabled",
INVISIBLE_STATE_CLASS = "dx-state-invisible",
HOVER_STATE_CLASS = "dx-state-hover",
FOCUSED_STATE_CLASS = "dx-state-focused",
FEEDBACK_SHOW_TIMEOUT = 30,
FEEDBACK_HIDE_TIMEOUT = 400,
FOCUS_NAMESPACE = "Focus",
ANONYMOUS_TEMPLATE_NAME = "template",
TEXT_NODE = 3,
TEMPLATE_SELECTOR = "[data-options*='dxTemplate']",
TEMPLATE_WRAPPER_CLASS = "dx-template-wrapper";
var beforeActivateExists = void 0 !== document.onbeforeactivate;
var Widget = DOMComponent.inherit({
_supportedKeys: function() {
return {}
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
disabled: false,
visible: true,
hint: void 0,
activeStateEnabled: false,
onContentReady: null,
hoverStateEnabled: false,
focusStateEnabled: false,
tabIndex: 0,
accessKey: null,
onFocusIn: null,
onFocusOut: null,
watchMethod: $.noop,
_keyboardProcessor: void 0,
templateProvider: TemplateProvider,
_templates: {}
})
},
_feedbackShowTimeout: FEEDBACK_SHOW_TIMEOUT,
_feedbackHideTimeout: FEEDBACK_HIDE_TIMEOUT,
_init: function() {
this.callBase();
this._tempTemplates = [];
this._dynamicTemplates = {};
this._initTemplates();
this._initContentReadyAction()
},
_initTemplates: function() {
this._extractTemplates();
this._extractAnonymousTemplate()
},
_extractTemplates: function() {
var templates = this.option("_templates"),
templateElements = this.element().contents().filter(TEMPLATE_SELECTOR);
var templatesMap = {};
templateElements.each(function(_, template) {
var templateOptions = domUtils.getElementOptions(template).dxTemplate;
if (!templateOptions) {
return
}
if (!templateOptions.name) {
throw errors.Error("E0023")
}
$(template).addClass(TEMPLATE_WRAPPER_CLASS).detach();
templatesMap[templateOptions.name] = templatesMap[templateOptions.name] || [];
templatesMap[templateOptions.name].push(template)
});
$.each(templatesMap, $.proxy(function(templateName, value) {
var deviceTemplate = this._findTemplateByDevice(value);
if (deviceTemplate) {
templates[templateName] = this._createTemplate(deviceTemplate, this)
}
}, this))
},
_findTemplateByDevice: function(templates) {
var suitableTemplate = commonUtils.findBestMatches(devices.current(), templates, function(template) {
return domUtils.getElementOptions(template).dxTemplate
})[0];
$.each(templates, function(index, template) {
if (template !== suitableTemplate) {
$(template).remove()
}
});
return suitableTemplate
},
_extractAnonymousTemplate: function() {
var templates = this.option("_templates"),
anonymousTemplateName = this._getAnonymousTemplateName(),
$anonymousTemplate = this.element().contents().detach();
var $notJunkTemplateContent = $anonymousTemplate.filter(function(_, element) {
var isTextNode = element.nodeType === TEXT_NODE,
isEmptyText = $.trim($(element).text()).length < 1;
return !(isTextNode && isEmptyText)
}),
onlyJunkTemplateContent = $notJunkTemplateContent.length < 1;
if (!templates[anonymousTemplateName] && !onlyJunkTemplateContent) {
templates[anonymousTemplateName] = this._createTemplate($anonymousTemplate, this)
}
},
_getAriaTarget: function() {
return this._focusTarget()
},
_getAnonymousTemplateName: function() {
return ANONYMOUS_TEMPLATE_NAME
},
_getTemplateByOption: function(optionName) {
return this._getTemplate(this.option(optionName))
},
_getTemplate: function(templateSource) {
if ($.isFunction(templateSource)) {
var that = this;
return new DynamicTemplate(function(options) {
var args = [];
if ("model" in options) {
args.push(options.model)
}
if ("index" in options) {
args.push(options.index)
}
args.push(options.container);
var templateSourceResult = templateSource.apply(that, args);
if (commonUtils.isDefined(templateSourceResult)) {
return that._acquireTemplate(templateSourceResult, this, true)
} else {
return new EmptyTemplate
}
}, this)
}
return this._acquireTemplate(templateSource, this)
},
_acquireTemplate: function(templateSource, owner, preferRenderer) {
if (null == templateSource) {
return this._createTemplate(domUtils.normalizeTemplateElement(templateSource), owner)
}
if (templateSource instanceof TemplateBase || commonUtils.isFunction(templateSource.render)) {
return templateSource
}
if (templateSource.nodeType || templateSource.jquery) {
templateSource = $(templateSource);
if (preferRenderer && !templateSource.is("script")) {
return new MoveTemplate(templateSource, owner)
}
return this._createTemplate(templateSource, owner)
}
if ("string" === typeof templateSource) {
var userTemplate = this.option("_templates")[templateSource];
if (userTemplate) {
return userTemplate
}
var dynamicTemplate = this._dynamicTemplates[templateSource];
if (dynamicTemplate) {
return dynamicTemplate
}
var defaultTemplate = this.option("templateProvider").getTemplates(this)[templateSource];
if (defaultTemplate) {
return defaultTemplate
}
return this._createTemplate(domUtils.normalizeTemplateElement(templateSource), owner)
}
return this._acquireTemplate(templateSource.toString(), owner)
},
_createTemplate: function(element, owner) {
var template = this.option("templateProvider").createTemplate(element, owner);
this._tempTemplates.push(template);
return template
},
_cleanTemplates: function() {
var that = this;
$.each(this.option("_templates"), function(_, template) {
if (that === template.owner()) {
template.dispose()
}
});
$.each(this._tempTemplates, function(_, template) {
template.dispose()
})
},
_initContentReadyAction: function() {
this._contentReadyAction = this._createActionByOption("onContentReady", {
excludeValidators: ["designMode", "disabled", "readOnly"]
})
},
_render: function() {
this.element().addClass(WIDGET_CLASS);
this.callBase();
this._toggleDisabledState(this.option("disabled"));
this._toggleVisibility(this.option("visible"));
this._renderHint();
this._renderContent();
this._renderFocusState();
this._attachFeedbackEvents();
this._attachHoverEvents()
},
_renderHint: function() {
domUtils.toggleAttr(this.element(), "title", this.option("hint"))
},
_renderContent: function() {
var that = this;
commonUtils.deferRender(function() {
that._renderContentImpl()
});
that._fireContentReadyAction()
},
_renderContentImpl: $.noop,
_fireContentReadyAction: function() {
this._contentReadyAction()
},
_dispose: function() {
this._cleanTemplates();
this._contentReadyAction = null;
this.callBase()
},
_clean: function() {
this._cleanFocusState();
this.callBase();
this.element().empty()
},
_toggleVisibility: function(visible) {
this.element().toggleClass(INVISIBLE_STATE_CLASS, !visible);
this.setAria("hidden", !visible || void 0)
},
_renderFocusState: function() {
if (!this.option("focusStateEnabled") || this.option("disabled")) {
return
}
this._renderFocusTarget();
this._attachFocusEvents();
this._attachKeyboardEvents();
this._renderAccessKey()
},
_renderAccessKey: function() {
var focusTarget = this._focusTarget();
focusTarget.attr("accesskey", this.option("accessKey"));
var clickNamespace = eventUtils.addNamespace(clickEvent.name, UI_FEEDBACK);
focusTarget.off(clickNamespace);
this.option("accessKey") && focusTarget.on(clickNamespace, $.proxy(function(e) {
if (eventUtils.isFakeClickEvent(e)) {
e.stopImmediatePropagation();
this.focus()
}
}, this))
},
_eventBindingTarget: function() {
return this.element()
},
_focusTarget: function() {
return this._getActiveElement()
},
_getActiveElement: function() {
var activeElement = this._eventBindingTarget();
if (this._activeStateUnit) {
activeElement = activeElement.find(this._activeStateUnit).not("." + DISABLED_STATE_CLASS)
}
return activeElement
},
_renderFocusTarget: function() {
this._focusTarget().attr("tabindex", this.option("tabIndex"))
},
_keyboardEventBindingTarget: function() {
return this._eventBindingTarget()
},
_detachFocusEvents: function() {
var $element = this._focusTarget(),
namespace = this.NAME + FOCUS_NAMESPACE,
focusEvents = eventUtils.addNamespace("focusin", namespace);
focusEvents = focusEvents + " " + eventUtils.addNamespace("focusout", namespace);
if (beforeActivateExists) {
focusEvents = focusEvents + " " + eventUtils.addNamespace("beforeactivate", namespace)
}
$element.off(focusEvents)
},
_attachFocusEvents: function() {
var namespace = this.NAME + FOCUS_NAMESPACE,
focusInEvent = eventUtils.addNamespace("focusin", namespace),
focusOutEvent = eventUtils.addNamespace("focusout", namespace);
this._focusTarget().on(focusInEvent, $.proxy(this._focusInHandler, this)).on(focusOutEvent, $.proxy(this._focusOutHandler, this));
if (beforeActivateExists) {
var beforeactivateEvent = eventUtils.addNamespace("beforeactivate", namespace);
this._focusTarget().on(beforeactivateEvent, function(e) {
if (!$(e.target).is(selectors.focusable)) {
e.preventDefault()
}
})
}
},
_refreshFocusEvent: function() {
this._detachFocusEvents();
this._attachFocusEvents()
},
_focusInHandler: function(e) {
var that = this;
that._createActionByOption("onFocusIn", {
beforeExecute: function() {
that._updateFocusState(e, true)
},
excludeValidators: ["readOnly"]
})({
jQueryEvent: e
})
},
_focusOutHandler: function(e) {
var that = this;
that._createActionByOption("onFocusOut", {
beforeExecute: function() {
that._updateFocusState(e, false)
},
excludeValidators: ["readOnly", "disabled"]
})({
jQueryEvent: e
})
},
_updateFocusState: function(e, isFocused) {
var target = e.target;
if ($.inArray(target, this._focusTarget()) !== -1) {
this._toggleFocusClass(isFocused, $(target))
}
},
_toggleFocusClass: function(isFocused, $element) {
var $focusTarget = $element && $element.length ? $element : this._focusTarget();
$focusTarget.toggleClass(FOCUSED_STATE_CLASS, isFocused)
},
_hasFocusClass: function(element) {
var $focusTarget = $(element || this._focusTarget());
return $focusTarget.hasClass(FOCUSED_STATE_CLASS)
},
_attachKeyboardEvents: function() {
var processor = this.option("_keyboardProcessor") || new KeyboardProcessor({
element: this._keyboardEventBindingTarget(),
focusTarget: this._focusTarget()
});
this._keyboardProcessor = processor.reinitialize(this._keyboardHandler, this)
},
_keyboardHandler: function(options) {
var e = options.originalEvent,
key = options.key;
var keys = this._supportedKeys(),
func = keys[key];
if (void 0 !== func) {
var handler = $.proxy(func, this);
return handler(e) || false
} else {
return true
}
},
_refreshFocusState: function() {
this._cleanFocusState();
this._renderFocusState()
},
_cleanFocusState: function() {
var $element = this._focusTarget();
this._detachFocusEvents();
this._toggleFocusClass(false);
$element.removeAttr("tabindex");
if (this._keyboardProcessor) {
this._keyboardProcessor.dispose()
}
},
_attachHoverEvents: function() {
var that = this,
hoverableSelector = that._activeStateUnit,
nameStart = eventUtils.addNamespace(hoverEvents.start, UI_FEEDBACK),
nameEnd = eventUtils.addNamespace(hoverEvents.end, UI_FEEDBACK);
that._eventBindingTarget().off(nameStart, hoverableSelector).off(nameEnd, hoverableSelector);
if (that.option("hoverStateEnabled")) {
var startAction = new Action(function(args) {
that._hoverStartHandler(args.event);
var $target = args.element;
that._refreshHoveredElement($target)
}, {
excludeValidators: ["readOnly"]
});
that._eventBindingTarget().on(nameStart, hoverableSelector, function(e) {
startAction.execute({
element: $(e.target),
event: e
})
}).on(nameEnd, hoverableSelector, function(e) {
that._hoverEndHandler(e);
that._forgetHoveredElement()
})
} else {
that._toggleHoverClass(false)
}
},
_hoverStartHandler: $.noop,
_hoverEndHandler: $.noop,
_attachFeedbackEvents: function() {
var feedbackAction, feedbackActionDisabled, that = this,
feedbackSelector = that._activeStateUnit,
activeEventName = eventUtils.addNamespace(feedbackEvents.active, UI_FEEDBACK),
inactiveEventName = eventUtils.addNamespace(feedbackEvents.inactive, UI_FEEDBACK);
that._eventBindingTarget().off(activeEventName, feedbackSelector).off(inactiveEventName, feedbackSelector);
if (that.option("activeStateEnabled")) {
var feedbackActionHandler = function(args) {
var $element = args.element,
value = args.value,
jQueryEvent = args.jQueryEvent;
that._toggleActiveState($element, value, jQueryEvent)
};
that._eventBindingTarget().on(activeEventName, feedbackSelector, {
timeout: that._feedbackShowTimeout
}, function(e) {
feedbackAction = feedbackAction || new Action(feedbackActionHandler), feedbackAction.execute({
element: $(e.currentTarget),
value: true,
jQueryEvent: e
})
}).on(inactiveEventName, feedbackSelector, {
timeout: that._feedbackHideTimeout
}, function(e) {
feedbackActionDisabled = feedbackActionDisabled || new Action(feedbackActionHandler, {
excludeValidators: ["disabled", "readOnly"]
}), feedbackActionDisabled.execute({
element: $(e.currentTarget),
value: false,
jQueryEvent: e
})
})
}
},
_toggleActiveState: function($element, value) {
this._toggleHoverClass(!value);
$element.toggleClass(ACTIVE_STATE_CLASS, value)
},
_refreshHoveredElement: function(hoveredElement) {
var selector = this._activeStateUnit || this._eventBindingTarget();
this._forgetHoveredElement();
this._hoveredElement = hoveredElement.closest(selector);
this._toggleHoverClass(true)
},
_forgetHoveredElement: function() {
this._toggleHoverClass(false);
delete this._hoveredElement
},
_toggleHoverClass: function(value) {
if (this._hoveredElement) {
this._hoveredElement.toggleClass(HOVER_STATE_CLASS, value && this.option("hoverStateEnabled"))
}
},
_toggleDisabledState: function(value) {
this.element().toggleClass(DISABLED_STATE_CLASS, Boolean(value));
this._toggleHoverClass(!value);
this.setAria("disabled", value || void 0)
},
_setWidgetOption: function(widgetName, args) {
if (!this[widgetName]) {
return
}
if ($.isPlainObject(args[0])) {
$.each(args[0], $.proxy(function(option, value) {
this._setWidgetOption(widgetName, [option, value])
}, this));
return
}
var optionName = args[0];
var value = args[1];
if (1 === args.length) {
value = this.option(optionName)
}
var widgetOptionMap = this[widgetName + "OptionMap"];
this[widgetName].option(widgetOptionMap ? widgetOptionMap(optionName) : optionName, value)
},
_createComponent: function(element, name, config) {
config = config || {};
this._extendConfig(config, {
templateProvider: this.option("templateProvider"),
_templates: this.option("_templates")
});
return this.callBase(element, name, config)
},
_optionChanged: function(args) {
switch (args.name) {
case "disabled":
this._toggleDisabledState(args.value);
this._refreshFocusState();
break;
case "hint":
this._renderHint();
break;
case "activeStateEnabled":
this._attachFeedbackEvents();
break;
case "hoverStateEnabled":
this._attachHoverEvents();
break;
case "tabIndex":
case "_keyboardProcessor":
case "focusStateEnabled":
this._refreshFocusState();
break;
case "onFocusIn":
case "onFocusOut":
break;
case "accessKey":
this._renderAccessKey();
break;
case "visible":
var visible = args.value;
this._toggleVisibility(visible);
if (this._isVisibilityChangeSupported()) {
this._checkVisibilityChanged(args.value ? "shown" : "hiding")
}
break;
case "onContentReady":
this._initContentReadyAction();
break;
case "_templates":
case "templateProvider":
break;
default:
this.callBase(args)
}
},
_isVisible: function() {
return this.callBase() && this.option("visible")
},
beginUpdate: function() {
this._ready(false);
this.callBase()
},
endUpdate: function() {
this.callBase();
if (this._initialized) {
this._ready(true)
}
},
_ready: function(value) {
if (0 === arguments.length) {
return this._isReady
}
this._isReady = value
},
setAria: function() {
var setAttribute = function(option) {
var attrName = "role" === option.name || "id" === option.name ? option.name : "aria-" + option.name,
attrValue = option.value;
if (null === attrValue || void 0 === attrValue) {
attrValue = void 0
} else {
attrValue = attrValue.toString()
}
domUtils.toggleAttr(option.target, attrName, attrValue)
};
if (!$.isPlainObject(arguments[0])) {
setAttribute({
name: arguments[0],
value: arguments[1],
target: arguments[2] || this._getAriaTarget()
})
} else {
var $target = arguments[1] || this._getAriaTarget();
$.each(arguments[0], function(key, value) {
setAttribute({
name: key,
value: value,
target: $target
})
})
}
},
isReady: function() {
return this._ready()
},
repaint: function() {
this._refresh()
},
focus: function() {
this._focusTarget().focus()
},
registerKeyHandler: function(key, handler) {
var currentKeys = this._supportedKeys(),
addingKeys = {};
addingKeys[key] = handler;
this._supportedKeys = function() {
return $.extend(currentKeys, addingKeys)
}
}
});
module.exports = Widget
},
/*!***********************************************!*\
!*** ./Scripts/ui/widget/ui.template_base.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
triggerShownEvent = __webpack_require__( /*! ../../core/utils/dom */ 50).triggerShownEvent,
Class = __webpack_require__( /*! ../../core/class */ 20),
abstract = Class.abstract;
var renderedCallbacks = $.Callbacks();
var TemplateBase = Class.inherit({
ctor: function(element, owner) {
this._element = $(element);
this._owner = owner
},
owner: function() {
return this._owner
},
render: function(options) {
options = options || {};
var data = options.model;
if (options.container) {
data = this._prepareDataForContainer(data, options.container)
}
var $result = this._renderCore($.extend({}, options, {
model: data
}));
this._ensureResultInContainer($result, options.container);
renderedCallbacks.fire($result, options.container);
return $result
},
_ensureResultInContainer: function($result, $container) {
if (!$container) {
return
}
var resultInContainer = $.contains($container.get(0), $result.get(0));
$container.append($result);
if (resultInContainer) {
return
}
var resultInBody = $.contains(document.body, $container.get(0));
if (!resultInBody) {
return
}
triggerShownEvent($result)
},
source: function() {
return this._element.clone()
},
_prepareDataForContainer: function(data) {
return data
},
_renderCore: abstract,
dispose: function() {
this._owner = null
}
});
module.exports = TemplateBase;
module.exports.renderedCallbacks = renderedCallbacks
},
/*!**************************************************!*\
!*** ./Scripts/ui/widget/ui.template.dynamic.js ***!
\**************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
TemplateBase = __webpack_require__( /*! ./ui.template_base */ 90);
var DynamicTemplate = TemplateBase.inherit({
ctor: function(compileFunction, owner) {
this.callBase($(), owner);
this._compileFunction = compileFunction
},
_renderCore: function(options) {
var compiledTemplate = this._compileFunction(options);
var renderResult = compiledTemplate.render(options);
if (compiledTemplate.owner() === this) {
compiledTemplate.dispose()
}
return renderResult
}
});
module.exports = DynamicTemplate
},
/*!************************************************!*\
!*** ./Scripts/ui/widget/ui.template.empty.js ***!
\************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
TemplateBase = __webpack_require__( /*! ./ui.template_base */ 90);
var EmptyTemplate = TemplateBase.inherit({
ctor: function(owner) {
this.callBase($(), owner)
},
_renderCore: function() {
return $()
}
});
module.exports = EmptyTemplate
},
/*!***********************************************!*\
!*** ./Scripts/ui/widget/ui.template.move.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var TemplateBase = __webpack_require__( /*! ./ui.template_base */ 90);
var MoveTemplate = TemplateBase.inherit({
_renderCore: function() {
return this._element
}
});
module.exports = MoveTemplate
},
/*!*******************************************************!*\
!*** ./Scripts/ui/widget/jquery.template_provider.js ***!
\*******************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
TemplateProviderBase = __webpack_require__( /*! ./ui.template_provider_base */ 95),
Template = __webpack_require__( /*! ./jquery.template */ 96),
FunctionTemplate = __webpack_require__( /*! ./ui.template.function */ 97),
defaultTemplates = __webpack_require__( /*! ./jquery.default_templates */ 98);
var TemplateProvider = TemplateProviderBase.inherit({
createTemplate: function(element, owner) {
return new Template(element, owner)
},
_templatesForWidget: function(widgetName) {
var templateGenerators = defaultTemplates[widgetName] || {},
templates = {};
$.each(templateGenerators, function(name, generator) {
templates[name] = new FunctionTemplate(function() {
var $markup = generator.apply(this, arguments);
if ("itemFrame" !== name) {
$markup = $markup.contents()
}
return $markup
}, templateProvider)
});
return templates
}
});
var templateProvider = new TemplateProvider;
module.exports = templateProvider
},
/*!********************************************************!*\
!*** ./Scripts/ui/widget/ui.template_provider_base.js ***!
\********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20);
var abstract = Class.abstract;
var TemplateProviderBase = Class.inherit({
ctor: function() {
this.widgetTemplatesCache = {}
},
createTemplate: abstract,
getTemplates: function(widget) {
return this._getWidgetTemplates(widget.constructor)
},
_getWidgetTemplates: function(widgetConstructor) {
if (!widgetConstructor.publicName) {
return {}
}
return this._getCachedWidgetTemplates(widgetConstructor)
},
_getCachedWidgetTemplates: function(widgetConstructor) {
var widgetName = widgetConstructor.publicName(),
templatesCache = this.widgetTemplatesCache;
if (!templatesCache[widgetName]) {
templatesCache[widgetName] = $.extend({}, this._getWidgetTemplates(widgetConstructor.parent), this._templatesForWidget(widgetName))
}
return templatesCache[widgetName]
},
_templatesForWidget: abstract
});
module.exports = TemplateProviderBase
},
/*!**********************************************!*\
!*** ./Scripts/ui/widget/jquery.template.js ***!
\**********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
errors = __webpack_require__( /*! ../../core/errors */ 17),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
TemplateBase = __webpack_require__( /*! ./ui.template_base */ 90),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50);
var templateEngines = {};
var registerTemplateEngine = function(name, templateEngine) {
templateEngines[name] = templateEngine
};
var outerHtml = function(element) {
element = $(element);
var templateTag = element.length && element[0].nodeName.toLowerCase();
if ("script" === templateTag) {
return element.html()
} else {
element = $("
").append(element);
return element.html()
}
};
registerTemplateEngine("default", {
compile: function(element) {
return domUtils.normalizeTemplateElement(element)
},
render: function(template, data) {
return template.clone()
}
});
registerTemplateEngine("jquery-tmpl", {
compile: function(element) {
return outerHtml(element)
},
render: function(template, data) {
return $.tmpl(template, data)
}
});
registerTemplateEngine("jsrender", {
compile: function(element) {
return $.templates(outerHtml(element))
},
render: function(template, data) {
return template.render(data)
}
});
registerTemplateEngine("mustache", {
compile: function(element) {
return Mustache.compile(outerHtml(element))
},
render: function(template, data) {
return template(data)
}
});
registerTemplateEngine("hogan", {
compile: function(element) {
return Hogan.compile(outerHtml(element))
},
render: function(template, data) {
return template.render(data)
}
});
registerTemplateEngine("underscore", {
compile: function(element) {
return _.template(outerHtml(element))
},
render: function(template, data) {
return template(data)
}
});
registerTemplateEngine("handlebars", {
compile: function(element) {
return Handlebars.compile(outerHtml(element))
},
render: function(template, data) {
return template(data)
}
});
registerTemplateEngine("doT", {
compile: function(element) {
return doT.template(outerHtml(element))
},
render: function(template, data) {
return template(data)
}
});
var currentTemplateEngine;
var setTemplateEngine = function(templateEngine) {
if (commonUtils.isString(templateEngine)) {
currentTemplateEngine = templateEngines[templateEngine];
if (!currentTemplateEngine) {
throw errors.Error("E0020", templateEngine)
}
} else {
currentTemplateEngine = templateEngine
}
};
setTemplateEngine("default");
var Template = TemplateBase.inherit({
ctor: function(element, owner) {
this.callBase(element, owner);
this._compiledTemplate = currentTemplateEngine.compile(element)
},
_renderCore: function(options) {
return $("
").append(currentTemplateEngine.render(this._compiledTemplate, options.model)).contents()
}
});
module.exports = Template;
module.exports.setTemplateEngine = setTemplateEngine
},
/*!***************************************************!*\
!*** ./Scripts/ui/widget/ui.template.function.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
TemplateBase = __webpack_require__( /*! ./ui.template_base */ 90),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50);
var FunctionTemplate = TemplateBase.inherit({
ctor: function(render, owner) {
this.callBase($(), owner);
this._render = render
},
_renderCore: function(options) {
return domUtils.normalizeTemplateElement(this._render(options.model, options.index, options.container))
}
});
module.exports = FunctionTemplate
},
/*!*******************************************************!*\
!*** ./Scripts/ui/widget/jquery.default_templates.js ***!
\*******************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
inflector = __webpack_require__( /*! ../../core/utils/inflector */ 49),
iconUtils = __webpack_require__( /*! ../../core/utils/icon */ 99),
dateUtils = __webpack_require__( /*! ../../core/utils/date */ 52),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
errors = __webpack_require__( /*! ../../core/errors */ 17),
dateLocalization = __webpack_require__( /*! ../../localization/date */ 56);
var TEMPLATE_GENERATORS = {};
var emptyTemplate = function() {
return $()
};
var ITEM_CONTENT_PLACEHOLDER_CLASS = "dx-item-content-placeholder";
TEMPLATE_GENERATORS.CollectionWidget = {
item: function(itemData) {
var $itemContent = $("
");
if ($.isPlainObject(itemData)) {
if (itemData.text) {
$itemContent.text(itemData.text)
}
if (itemData.html) {
$itemContent.html(itemData.html)
}
} else {
$itemContent.text(String(itemData))
}
return $itemContent
},
itemFrame: function(itemData) {
var $itemFrame = $("
");
$itemFrame.toggleClass("dx-state-invisible", void 0 !== itemData.visible && !itemData.visible);
$itemFrame.toggleClass("dx-state-disabled", !!itemData.disabled);
var $placeholder = $("
").addClass(ITEM_CONTENT_PLACEHOLDER_CLASS);
$itemFrame.append($placeholder);
return $itemFrame
}
};
var BUTTON_TEXT_CLASS = "dx-button-text";
TEMPLATE_GENERATORS.dxButton = {
content: function(itemData) {
var $itemContent = $("
"),
$iconElement = iconUtils.getImageContainer(itemData.icon),
$textContainer = itemData.text ? $("
").text(itemData.text).addClass(BUTTON_TEXT_CLASS) : void 0;
$itemContent.append($iconElement).append($textContainer);
return $itemContent
}
};
var LIST_ITEM_BADGE_CONTAINER_CLASS = "dx-list-item-badge-container",
LIST_ITEM_BADGE_CLASS = "dx-list-item-badge",
BADGE_CLASS = "dx-badge",
LIST_ITEM_CHEVRON_CONTAINER_CLASS = "dx-list-item-chevron-container",
LIST_ITEM_CHEVRON_CLASS = "dx-list-item-chevron";
TEMPLATE_GENERATORS.dxList = {
item: function(itemData) {
var $itemContent = TEMPLATE_GENERATORS.CollectionWidget.item(itemData);
if (itemData.key) {
var $key = $("").text(itemData.key);
$key.appendTo($itemContent)
}
return $itemContent
},
itemFrame: function(itemData) {
var $itemFrame = TEMPLATE_GENERATORS.CollectionWidget.itemFrame(itemData);
if (itemData.badge) {
var $badgeContainer = $("
").addClass(LIST_ITEM_BADGE_CONTAINER_CLASS),
$badge = $("
").addClass(LIST_ITEM_BADGE_CLASS).addClass(BADGE_CLASS);
$badge.text(itemData.badge);
$badgeContainer.append($badge).appendTo($itemFrame)
}
if (itemData.showChevron) {
var $chevronContainer = $("
").addClass(LIST_ITEM_CHEVRON_CONTAINER_CLASS),
$chevron = $("
").addClass(LIST_ITEM_CHEVRON_CLASS);
$chevronContainer.append($chevron).appendTo($itemFrame)
}
return $itemFrame
},
group: function(groupData) {
var $groupContent = $("
");
if ($.isPlainObject(groupData)) {
if (groupData.key) {
$groupContent.text(groupData.key)
}
} else {
$groupContent.html(String(groupData))
}
return $groupContent
}
};
TEMPLATE_GENERATORS.dxDropDownMenu = {
item: TEMPLATE_GENERATORS.dxList.item,
content: TEMPLATE_GENERATORS.dxButton.content
};
TEMPLATE_GENERATORS.dxDropDownList = {
item: TEMPLATE_GENERATORS.dxList.item
};
TEMPLATE_GENERATORS.dxRadioGroup = {
item: TEMPLATE_GENERATORS.CollectionWidget.item
};
TEMPLATE_GENERATORS.dxScheduler = {
item: function(itemData) {
var $itemContent = TEMPLATE_GENERATORS.CollectionWidget.item(itemData);
var $details = $("
").addClass("dx-scheduler-appointment-content-details");
if (itemData.allDay) {
$("
").text(" All day: ").addClass("dx-scheduler-appointment-content-allday").appendTo($details)
}
if (itemData.startDate) {
$("
").text(dateLocalization.format(dateUtils.makeDate(itemData.startDate), "shorttime")).addClass("dx-scheduler-appointment-content-date").appendTo($details)
}
if (itemData.endDate) {
$("
").text(" - ").addClass("dx-scheduler-appointment-content-date").appendTo($details);
$("
").text(dateLocalization.format(dateUtils.makeDate(itemData.endDate), "shorttime")).addClass("dx-scheduler-appointment-content-date").appendTo($details)
}
$details.appendTo($itemContent);
if (itemData.recurrenceRule) {
$("
").addClass("dx-scheduler-appointment-recurrence-icon dx-icon-repeat").appendTo($itemContent)
}
return $itemContent
},
appointmentTooltip: emptyTemplate,
appointmentPopup: emptyTemplate
};
TEMPLATE_GENERATORS.dxOverlay = {
content: emptyTemplate
};
TEMPLATE_GENERATORS.dxSlideOutView = {
menu: emptyTemplate,
content: emptyTemplate
};
TEMPLATE_GENERATORS.dxSlideOut = {
menuItem: TEMPLATE_GENERATORS.dxList.item,
menuGroup: TEMPLATE_GENERATORS.dxList.group,
content: emptyTemplate
};
TEMPLATE_GENERATORS.dxAccordion = {
title: function(titleData) {
var $titleContent = $(""),
icon = titleData.icon,
iconSrc = titleData.iconSrc,
$iconElement = iconUtils.getImageContainer(icon || iconSrc);
if ($.isPlainObject(titleData)) {
if (titleData.title) {
$titleContent.text(titleData.title)
}
} else {
$titleContent.html(String(titleData))
}
$iconElement && $iconElement.prependTo($titleContent);
return $titleContent
},
item: TEMPLATE_GENERATORS.CollectionWidget.item
};
TEMPLATE_GENERATORS.dxActionSheet = {
item: function(itemData) {
return $("
").append($("
").dxButton($.extend({
onClick: itemData.click
}, itemData)))
}
};
var GALLERY_IMAGE_CLASS = "dx-gallery-item-image";
TEMPLATE_GENERATORS.dxGallery = {
item: function(itemData) {
var $itemContent = $("
"),
$img = $("
").addClass(GALLERY_IMAGE_CLASS);
if ($.isPlainObject(itemData)) {
$img.attr({
src: itemData.imageSrc,
alt: itemData.imageAlt
}).appendTo($itemContent)
} else {
$img.attr("src", String(itemData)).appendTo($itemContent)
}
return $itemContent
}
};
var DX_MENU_ITEM_CAPTION_CLASS = "dx-menu-item-text",
DX_MENU_ITEM_POPOUT_CLASS = "dx-menu-item-popout",
DX_MENU_ITEM_POPOUT_CONTAINER_CLASS = "dx-menu-item-popout-container";
TEMPLATE_GENERATORS.dxMenuBase = {
item: function(itemData) {
var $itemContent = $("
"),
icon = itemData.icon,
iconSrc = itemData.iconSrc,
$iconElement = iconUtils.getImageContainer(icon || iconSrc);
$iconElement && $iconElement.appendTo($itemContent);
var $itemCaption;
if (!commonUtils.isPrimitive(itemData) && itemData.text) {
$itemCaption = $("
").addClass(DX_MENU_ITEM_CAPTION_CLASS).text(itemData.text)
} else {
if (!$.isPlainObject(itemData)) {
$itemCaption = $("").addClass(DX_MENU_ITEM_CAPTION_CLASS).html(String(itemData))
}
}
$itemContent.append($itemCaption);
var $popOutImage, $popOutContainer;
if (itemData.items && itemData.items.length > 0) {
$popOutContainer = $("").addClass(DX_MENU_ITEM_POPOUT_CONTAINER_CLASS).appendTo($itemContent);
$popOutImage = $("").addClass(DX_MENU_ITEM_POPOUT_CLASS).appendTo($popOutContainer)
}
return $itemContent
}
};
var PANORAMA_ITEM_TITLE_CLASS = "dx-panorama-item-title";
TEMPLATE_GENERATORS.dxPanorama = {
itemFrame: function(itemData) {
var $itemContent = TEMPLATE_GENERATORS.CollectionWidget.itemFrame(itemData);
if (itemData.title) {
var $itemHeader = $("
").addClass(PANORAMA_ITEM_TITLE_CLASS).text(itemData.title);
$itemContent.prepend($itemHeader)
}
return $itemContent
}
};
TEMPLATE_GENERATORS.dxPivotTabs = {
item: function(itemData) {
var $itemContent = $("
");
var $itemText;
if (itemData && itemData.title) {
$itemText = $("
").text(itemData.title)
} else {
$itemText = $("").text(String(itemData))
}
$itemContent.html($itemText);
return $itemContent
}
};
TEMPLATE_GENERATORS.dxPivot = {
title: TEMPLATE_GENERATORS.dxPivotTabs.item,
content: emptyTemplate
};
var TABS_ITEM_TEXT_CLASS = "dx-tab-text";
TEMPLATE_GENERATORS.dxTabs = {
item: function(itemData) {
var $itemContent = TEMPLATE_GENERATORS.CollectionWidget.item(itemData);
if (itemData.html) {
return $itemContent
}
var icon = itemData.icon,
iconSrc = itemData.iconSrc,
$iconElement = iconUtils.getImageContainer(icon || iconSrc);
if (!itemData.html) {
$itemContent.wrapInner($("").addClass(TABS_ITEM_TEXT_CLASS))
}
$iconElement && $iconElement.prependTo($itemContent);
return $itemContent
},
itemFrame: function(itemData) {
var $badge = $(),
$itemFrame = TEMPLATE_GENERATORS.CollectionWidget.itemFrame(itemData);
if (itemData.badge) {
$badge = $("", {
"class": "dx-tabs-item-badge dx-badge"
}).text(itemData.badge)
}
$itemFrame.append($badge);
return $itemFrame
}
};
TEMPLATE_GENERATORS.dxTabPanel = {
item: TEMPLATE_GENERATORS.CollectionWidget.item,
title: function(itemData) {
var itemTitleData = itemData;
if ($.isPlainObject(itemData)) {
itemTitleData = $.extend({}, itemData, {
text: itemData.title,
html: null
})
}
var $title = TEMPLATE_GENERATORS.dxTabs.item(itemTitleData);
return $title
}
};
var NAVBAR_ITEM_BADGE_CLASS = "dx-navbar-item-badge";
TEMPLATE_GENERATORS.dxNavBar = {
itemFrame: function(itemData) {
var $itemFrame = TEMPLATE_GENERATORS.CollectionWidget.itemFrame(itemData);
if (itemData.badge) {
var $badge = $("
").addClass(NAVBAR_ITEM_BADGE_CLASS).addClass(BADGE_CLASS);
$badge.text(itemData.badge);
$badge.appendTo($itemFrame)
}
return $itemFrame
}
};
TEMPLATE_GENERATORS.dxToolbarBase = {
item: function(itemData) {
var $itemContent = TEMPLATE_GENERATORS.CollectionWidget.item(itemData);
var widgetName = itemData.widget;
if (widgetName) {
var widgetElement = $("
").appendTo($itemContent),
options = itemData.options || {};
if ("button" === widgetName || "tabs" === widgetName || "dropDownMenu" === widgetName) {
var depricatedName = widgetName;
widgetName = inflector.camelize("dx-" + widgetName);
errors.log("W0001", "dxToolbar - 'widget' item field", depricatedName, "16.1", "Use: '" + widgetName + "' instead")
}
widgetElement[widgetName](options)
} else {
if (itemData.text) {
$itemContent.wrapInner("
")
}
}
return $itemContent
},
actionSheetItem: TEMPLATE_GENERATORS.dxActionSheet.item
};
TEMPLATE_GENERATORS.dxToolbarBase.menuItem = TEMPLATE_GENERATORS.dxToolbarBase.item;
TEMPLATE_GENERATORS.dxTreeView = {
item: function(itemData) {
var $itemContent = $("
"),
icon = itemData.icon,
iconSrc = itemData.iconSrc,
$iconElement = iconUtils.getImageContainer(icon || iconSrc);
if (itemData.html) {
$itemContent.html(itemData.html)
} else {
$iconElement && $iconElement.appendTo($itemContent);
$("
").text(itemData.text).appendTo($itemContent)
}
return $itemContent
}
};
var popupTitleAndBottom = function(itemData) {
return $("").append($("
").dxToolbarBase({
items: itemData
}))
};
TEMPLATE_GENERATORS.dxPopup = {
title: popupTitleAndBottom,
bottom: popupTitleAndBottom
};
TEMPLATE_GENERATORS.dxLookup = {
title: TEMPLATE_GENERATORS.dxPopup.title,
group: TEMPLATE_GENERATORS.dxList.group
};
var TAGBOX_TAG_CONTENT_CLASS = "dx-tag-content",
TAGBOX_TAG_REMOVE_BUTTON_CLASS = "dx-tag-remove-button";
TEMPLATE_GENERATORS.dxTagBox = {
tag: function(itemData, index, $tag) {
var $tagContent = $("
").addClass(TAGBOX_TAG_CONTENT_CLASS);
$("
").text(itemData).appendTo($tagContent);
$("").addClass(TAGBOX_TAG_REMOVE_BUTTON_CLASS).appendTo($tagContent);
return $("
").append($tagContent)
}
};
TEMPLATE_GENERATORS.dxCalendar = {
cell: function(itemData) {
return $("
").append($("
").text(itemData.text || String(itemData)))
}
};
module.exports = TEMPLATE_GENERATORS
},
/*!************************************!*\
!*** ./Scripts/core/utils/icon.js ***!
\************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9);
var getImageSourceType = function(source) {
if (!source || "string" !== typeof source) {
return false
}
if (/data:.*base64|\.|\//.test(source)) {
return "image"
}
if (/^[\w-_]+$/.test(source)) {
return "dxIcon"
}
return "fontIcon"
};
var getImageContainer = function(source) {
var imageType = getImageSourceType(source),
ICON_CLASS = "dx-icon";
switch (imageType) {
case "image":
return $("", {
src: source
}).addClass(ICON_CLASS);
case "fontIcon":
return $("", {
"class": ICON_CLASS + " " + source
});
case "dxIcon":
return $("", {
"class": ICON_CLASS + " " + ICON_CLASS + "-" + source
});
default:
return null
}
};
exports.getImageSourceType = getImageSourceType;
exports.getImageContainer = getImageContainer
},
/*!****************************************************!*\
!*** ./Scripts/ui/widget/ui.keyboard_processor.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
eventUtils = __webpack_require__( /*! ../../events/utils */ 62);
var KeyboardProcessor = Class.inherit({
_keydown: eventUtils.addNamespace("keydown", "KeyboardProcessor"),
codes: {
8: "backspace",
9: "tab",
13: "enter",
27: "escape",
33: "pageUp",
34: "pageDown",
35: "end",
36: "home",
37: "leftArrow",
38: "upArrow",
39: "rightArrow",
40: "downArrow",
46: "del",
32: "space",
70: "F",
65: "A",
106: "asterisk",
109: "minus"
},
ctor: function(options) {
var _this = this;
options = options || {};
if (options.element) {
this._element = $(options.element)
}
if (options.focusTarget) {
this._focusTarget = options.focusTarget
}
this._handler = options.handler;
this._context = options.context;
this._childProcessors = [];
if (this._element) {
this._processFunction = function(e) {
_this.process(e)
};
this._element.on(this._keydown, this._processFunction)
}
},
dispose: function() {
if (this._element) {
this._element.off(this._keydown, this._processFunction)
}
this._element = void 0;
this._handler = void 0;
this._context = void 0;
this._childProcessors = void 0
},
clearChildren: function() {
this._childProcessors = []
},
push: function(child) {
if (!this._childProcessors) {
this.clearChildren()
}
this._childProcessors.push(child);
return child
},
attachChildProcessor: function() {
var childProcessor = new KeyboardProcessor;
this._childProcessors.push(childProcessor);
return childProcessor
},
reinitialize: function(childHandler, childContext) {
this._context = childContext;
this._handler = childHandler;
return this
},
process: function(e) {
if (this._focusTarget && this._focusTarget !== e.target && $.inArray(e.target, this._focusTarget) < 0) {
return false
}
var args = {
key: this.codes[e.which] || e.which,
ctrl: e.ctrlKey,
shift: e.shiftKey,
alt: e.altKey,
originalEvent: e
};
var handlerResult = this._handler && this._handler.call(this._context, args);
if (handlerResult && this._childProcessors) {
$.each(this._childProcessors, function(index, childProcessor) {
childProcessor.process(e)
})
}
}
});
module.exports = KeyboardProcessor
},
/*!***********************************************!*\
!*** ./Scripts/ui/widget/jquery.selectors.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9);
var focusable = function(element, tabIndex) {
var nodeName = element.nodeName.toLowerCase(),
isTabIndexNotNaN = !isNaN(tabIndex),
isVisible = visible(element),
isDisabled = element.disabled,
isDefaultFocus = /^(input|select|textarea|button|object|iframe)$/.test(nodeName),
isHyperlink = "a" === nodeName,
isFocusable = true;
if (isDefaultFocus) {
isFocusable = !isDisabled
} else {
if (isHyperlink) {
isFocusable = element.href || isTabIndexNotNaN
} else {
isFocusable = isTabIndexNotNaN
}
}
return isVisible ? isFocusable : false
};
var visible = function(element) {
var $element = $(element);
return $element.is(":visible") && "hidden" !== $element.css("visibility") && "hidden" !== $element.parents().css("visibility")
};
var icontains = function(elem, text) {
var result = false;
$.each($(elem).contents(), function(index, content) {
if (3 === content.nodeType && (content.textContent || content.nodeValue || "").toLowerCase().indexOf((text || "").toLowerCase()) > -1) {
result = true;
return false
}
});
return result
};
$.extend($.expr[":"], {
"dx-focusable": function(element) {
return focusable(element, $.attr(element, "tabindex"))
},
"dx-tabbable": function(element) {
var tabIndex = $.attr(element, "tabindex");
return (isNaN(tabIndex) || tabIndex >= 0) && focusable(element, tabIndex)
},
"dx-icontains": $.expr.createPseudo(function(text) {
return function(elem) {
return icontains(elem, text)
}
})
});
module.exports = {
focusable: ":dx-focusable",
tabbable: ":dx-tabbable",
icontains: ":dx-icontains"
}
},
/*!*********************************!*\
!*** ./Scripts/events/hover.js ***!
\*********************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../core/class */ 20),
devices = __webpack_require__( /*! ../core/devices */ 40),
registerEvent = __webpack_require__( /*! ./core/event_registrator */ 66),
eventUtils = __webpack_require__( /*! ./utils */ 62),
pointerEvents = __webpack_require__( /*! ./pointer */ 65);
var HOVERSTART_NAMESPACE = "dxHoverStart",
HOVERSTART = "dxhoverstart",
POINTERENTER_NAMESPACED_EVENT_NAME = eventUtils.addNamespace(pointerEvents.enter, HOVERSTART_NAMESPACE),
HOVEREND_NAMESPACE = "dxHoverEnd",
HOVEREND = "dxhoverend",
POINTERLEAVE_NAMESPACED_EVENT_NAME = eventUtils.addNamespace(pointerEvents.leave, HOVEREND_NAMESPACE);
var Hover = Class.inherit({
noBubble: true,
add: function(element, handleObj) {
var that = this,
$element = $(element);
$element.off(this._originalEventName).on(this._originalEventName, handleObj.selector, function(e) {
that._handler(e)
})
},
_handler: function(e) {
if (eventUtils.isTouchEvent(e) || devices.isSimulator()) {
return
}
eventUtils.fireEvent({
type: this._eventName,
originalEvent: e,
delegateTarget: e.delegateTarget
})
},
teardown: function(element) {
$(element).off(this._originalEventName)
}
});
var HoverStart = Hover.inherit({
ctor: function() {
this._eventName = HOVERSTART;
this._originalEventName = POINTERENTER_NAMESPACED_EVENT_NAME;
this._isMouseDown = false
},
_handler: function(e) {
var pointers = e.pointers || [];
if (!pointers.length) {
this.callBase(e)
}
}
});
var HoverEnd = Hover.inherit({
ctor: function() {
this._eventName = HOVEREND;
this._originalEventName = POINTERLEAVE_NAMESPACED_EVENT_NAME
}
});
registerEvent(HOVERSTART, new HoverStart);
registerEvent(HOVEREND, new HoverEnd);
exports.start = HOVERSTART;
exports.end = HOVEREND
},
/*!*************************************************!*\
!*** ./Scripts/events/core/emitter.feedback.js ***!
\*************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
devices = __webpack_require__( /*! ../../core/devices */ 40),
eventUtils = __webpack_require__( /*! ../utils */ 62),
pointerEvents = __webpack_require__( /*! ../pointer */ 65),
Emitter = __webpack_require__( /*! ./emitter */ 75),
registerEmitter = __webpack_require__( /*! ./emitter_registrator */ 76);
var ACTIVE_EVENT_NAME = "dxactive",
INACTIVE_EVENT_NAME = "dxinactive",
ACTIVE_TIMEOUT = 30,
INACTIVE_TIMEOUT = 400;
var FeedbackEvent = Class.inherit({
ctor: function(timeout, fire) {
this._timeout = timeout;
this._fire = fire
},
start: function() {
var that = this;
this._schedule(function() {
that.force()
})
},
_schedule: function(fn) {
this._timer = window.setTimeout(fn, this._timeout)
},
stop: function() {
clearTimeout(this._timer)
},
force: function() {
if (this._fired) {
return
}
this.stop();
this._fire();
this._fired = true
},
fired: function() {
return this._fired
}
});
var activeFeedback;
var FeedbackEmitter = Emitter.inherit({
ctor: function() {
this.callBase.apply(this, arguments);
this._active = new FeedbackEvent(0, $.noop);
this._inactive = new FeedbackEvent(0, $.noop)
},
configurate: function(data, eventName) {
switch (eventName) {
case ACTIVE_EVENT_NAME:
data.activeTimeout = data.timeout;
break;
case INACTIVE_EVENT_NAME:
data.inactiveTimeout = data.timeout
}
this.callBase(data)
},
start: function(e) {
if (activeFeedback) {
var activeChildExists = $.contains(this.getElement().get(0), activeFeedback.getElement().get(0));
var childJustActivated = !activeFeedback._active.fired();
if (activeChildExists && childJustActivated) {
this._cancel();
return
}
activeFeedback._inactive.force()
}
activeFeedback = this;
this._initEvents(e);
this._active.start()
},
_initEvents: function(e) {
var that = this,
eventTarget = this._getEmitterTarget(e),
mouseEvent = eventUtils.isMouseEvent(e),
isSimulator = devices.isSimulator(),
deferFeedback = isSimulator || !mouseEvent,
activeTimeout = commonUtils.ensureDefined(this.activeTimeout, ACTIVE_TIMEOUT),
inactiveTimeout = commonUtils.ensureDefined(this.inactiveTimeout, INACTIVE_TIMEOUT);
this._active = new FeedbackEvent(deferFeedback ? activeTimeout : 0, function() {
that._fireEvent(ACTIVE_EVENT_NAME, e, {
target: eventTarget
})
});
this._inactive = new FeedbackEvent(deferFeedback ? inactiveTimeout : 0, function() {
that._fireEvent(INACTIVE_EVENT_NAME, e, {
target: eventTarget
});
activeFeedback = null
})
},
cancel: function(e) {
this.end(e)
},
end: function(e) {
var skipTimers = e.type !== pointerEvents.up;
if (skipTimers) {
this._active.stop()
} else {
this._active.force()
}
this._inactive.start();
if (skipTimers) {
this._inactive.force()
}
},
dispose: function() {
this._active.stop();
this._inactive.stop();
this.callBase()
},
lockInactive: function() {
this._active.force();
this._inactive.stop();
activeFeedback = null;
this._cancel();
return $.proxy(this._inactive.force, this._inactive)
}
});
FeedbackEmitter.lock = function(deferred) {
var lockInactive = activeFeedback ? activeFeedback.lockInactive() : $.noop;
$.when(deferred).always(lockInactive)
};
registerEmitter({
emitter: FeedbackEmitter,
events: [ACTIVE_EVENT_NAME, INACTIVE_EVENT_NAME]
});
exports.lock = FeedbackEmitter.lock;
exports.active = ACTIVE_EVENT_NAME;
exports.inactive = INACTIVE_EVENT_NAME
},
/*!***********************************************************!*\
!*** ./Scripts/integration/knockout/template_provider.js ***!
\***********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
ko = __webpack_require__( /*! knockout */ 87),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50),
templateProvider = __webpack_require__( /*! ../../ui/widget/jquery.template_provider */ 94),
KoTemplate = __webpack_require__( /*! ./template */ 105),
defaultTemplates = __webpack_require__( /*! ./default_templates */ 106);
var KoTemplateProvider = templateProvider.constructor.inherit({
createTemplate: function(element, owner) {
return new KoTemplate(element, owner)
},
applyTemplate: function(element, model) {
ko.applyBindings(model, element)
},
_templatesForWidget: function(widgetName) {
var templateGenerators = defaultTemplates[widgetName];
if (!templateGenerators) {
return this.callBase(widgetName)
}
var templates = {};
$.each(templateGenerators, function(name, generator) {
var $markup = domUtils.createMarkupFromString(generator());
if ("itemFrame" !== name) {
$markup = $markup.contents()
}
templates[name] = new KoTemplate($markup, koTemplateProvider)
});
return templates
}
});
var koTemplateProvider = new KoTemplateProvider;
module.exports = koTemplateProvider
},
/*!**************************************************!*\
!*** ./Scripts/integration/knockout/template.js ***!
\**************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
ko = __webpack_require__( /*! knockout */ 87),
TemplateBase = __webpack_require__( /*! ../../ui/widget/ui.template_base */ 90),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50);
var KoTemplate = TemplateBase.inherit({
ctor: function(element, owner) {
this.callBase(element, owner);
this._template = $("").append(domUtils.normalizeTemplateElement(element));
this._registerKoTemplate()
},
_registerKoTemplate: function() {
var template = this._template.get(0);
new ko.templateSources.anonymousTemplate(template).nodes(template)
},
_prepareDataForContainer: function(data, container) {
var containerElement, containerContext, result = data;
if (container.length) {
containerElement = container.get(0);
data = void 0 !== data ? data : ko.dataFor(containerElement) || {};
containerContext = ko.contextFor(containerElement);
if (containerContext) {
result = data === containerContext.$data ? containerContext : containerContext.createChildContext(data)
} else {
result = data
}
}
return result
},
_renderCore: function(options) {
var $placeholder = $("
").appendTo(options.container);
var $result;
ko.renderTemplate(this._template.get(0), options.model, {
afterRender: function(nodes) {
$result = $(nodes)
}
}, $placeholder.get(0), "replaceNode");
return $result
},
dispose: function() {
this.callBase();
this._template.remove()
}
});
module.exports = KoTemplate
},
/*!***********************************************************!*\
!*** ./Scripts/integration/knockout/default_templates.js ***!
\***********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9);
var TEMPLATE_GENERATORS = {};
var createElementWithBindAttr = function(tagName, bindings, closeTag, additionalProperties) {
closeTag = void 0 === closeTag ? true : closeTag;
var bindAttr = $.map(bindings, function(value, key) {
return key + ":" + value
}).join(",");
additionalProperties = additionalProperties || "";
return "<" + tagName + ' data-bind="' + bindAttr + '" ' + additionalProperties + ">" + (closeTag ? "" + tagName + ">" : "")
};
var defaultKoTemplateBasicBindings = {
css: "{ 'dx-state-disabled': $data.disabled, 'dx-state-invisible': !($data.visible === undefined || ko.unwrap($data.visible)) }"
};
var emptyTemplate = function() {
return ""
};
TEMPLATE_GENERATORS.CollectionWidget = {
itemFrame: function() {
var markup = [createElementWithBindAttr("div", defaultKoTemplateBasicBindings, false), "
", "
"];
return markup.join("")
},
item: function() {
var htmlBinding = createElementWithBindAttr("div", {
html: "html"
}),
textBinding = createElementWithBindAttr("div", {
text: "text"
}),
primitiveBinding = createElementWithBindAttr("div", {
text: "String($data)"
});
var markup = ["
", "", htmlBinding, "", "", textBinding, "", "", primitiveBinding, "", "
"];
return markup.join("")
}
};
var BUTTON_TEXT_CLASS = "dx-button-text";
TEMPLATE_GENERATORS.dxButton = {
content: function() {
var textBinding = createElementWithBindAttr("span", {
text: "$data.text",
css: "{ '" + BUTTON_TEXT_CLASS + "' : !!$data.text }"
});
var markup = ["
", "", textBinding, "
"];
return markup.join("")
}
};
var LIST_ITEM_BADGE_CONTAINER_CLASS = "dx-list-item-badge-container",
LIST_ITEM_BADGE_CLASS = "dx-list-item-badge",
BADGE_CLASS = "dx-badge",
LIST_ITEM_CHEVRON_CONTAINER_CLASS = "dx-list-item-chevron-container",
LIST_ITEM_CHEVRON_CLASS = "dx-list-item-chevron";
TEMPLATE_GENERATORS.dxList = {
item: function() {
var template = TEMPLATE_GENERATORS.CollectionWidget.item(),
keyBinding = createElementWithBindAttr("div", {
text: "key"
});
template = [template.substring(0, template.length - 6), "" + keyBinding + "", "
"];
return template.join("")
},
itemFrame: function() {
var template = TEMPLATE_GENERATORS.CollectionWidget.itemFrame(),
badgeBinding = createElementWithBindAttr("div", {
text: "badge"
}, true, 'class="' + LIST_ITEM_BADGE_CLASS + " " + BADGE_CLASS + '"');
var markup = [template.substring(0, template.length - 6), "", '', badgeBinding, "
", "", "", '", "", ""];
return markup.join("")
},
group: function() {
var keyBinding = createElementWithBindAttr("div", {
text: "key"
}),
primitiveBinding = createElementWithBindAttr("div", {
text: "String($data)"
});
var markup = ["
", "", keyBinding, "", "", primitiveBinding, "", "
"];
return markup.join("")
}
};
TEMPLATE_GENERATORS.dxDropDownMenu = {
item: TEMPLATE_GENERATORS.dxList.item,
content: TEMPLATE_GENERATORS.dxButton.content
};
TEMPLATE_GENERATORS.dxDropDownList = {
item: TEMPLATE_GENERATORS.dxList.item
};
TEMPLATE_GENERATORS.dxRadioGroup = {
item: TEMPLATE_GENERATORS.CollectionWidget.item
};
TEMPLATE_GENERATORS.dxScheduler = {
item: function() {
var template = TEMPLATE_GENERATORS.CollectionWidget.item(),
startDateBinding = createElementWithBindAttr("div class='dx-scheduler-appointment-content-date'", {
dxShorttimeDate: "$data.startDate"
}),
endDateBinding = createElementWithBindAttr("div class='dx-scheduler-appointment-content-date'", {
dxShorttimeDate: "$data.endDate"
}),
allDayBinding = createElementWithBindAttr("div class='dx-scheduler-appointment-content-allday'", {
text: "' All day: '"
}),
dash = createElementWithBindAttr("div class='dx-scheduler-appointment-content-date'", {
text: "' - '"
});
template = [template.substring(0, template.length - 6), "
", "" + allDayBinding + "", "" + startDateBinding + "", "" + dash + "", "" + endDateBinding + "", "
", "
", "
"];
return template.join("")
},
appointmentTooltip: emptyTemplate,
appointmentPopup: emptyTemplate
};
TEMPLATE_GENERATORS.dxOverlay = {
content: emptyTemplate
};
TEMPLATE_GENERATORS.dxSlideOutView = {
menu: emptyTemplate,
content: emptyTemplate
};
TEMPLATE_GENERATORS.dxSlideOut = {
menuItem: TEMPLATE_GENERATORS.dxList.item,
menuGroup: TEMPLATE_GENERATORS.dxList.group,
content: emptyTemplate
};
TEMPLATE_GENERATORS.dxAccordion = {
title: function() {
var titleBinding = createElementWithBindAttr("span", {
text: "jQuery.isPlainObject($data) ? $data.title : String($data)"
});
var markup = ["
", "", titleBinding, "
"];
return markup.join("")
},
item: TEMPLATE_GENERATORS.CollectionWidget.item
};
TEMPLATE_GENERATORS.dxResponsiveBox = {
item: TEMPLATE_GENERATORS.CollectionWidget.item
}, TEMPLATE_GENERATORS.dxPivotTabs = {
item: function() {
var titleBinding = createElementWithBindAttr("span", {
text: "title"
}),
primitiveBinding = createElementWithBindAttr("div", {
text: "String($data)"
});
var markup = ["
", "", titleBinding, "", "", primitiveBinding, "", "
"];
return markup.join("")
}
};
TEMPLATE_GENERATORS.dxPivot = {
title: TEMPLATE_GENERATORS.dxPivotTabs.item,
content: emptyTemplate
};
var PANORAMA_ITEM_TITLE_CLASS = "dx-panorama-item-title";
TEMPLATE_GENERATORS.dxPanorama = {
itemFrame: function() {
var template = TEMPLATE_GENERATORS.CollectionWidget.itemFrame(),
headerBinding = createElementWithBindAttr("div", {
text: "title"
}, true, 'class="' + PANORAMA_ITEM_TITLE_CLASS + '"');
var divInnerStart = template.indexOf(">") + 1;
template = [template.substring(0, divInnerStart), "", headerBinding, "", template.substring(divInnerStart, template.length)];
return template.join("")
}
};
TEMPLATE_GENERATORS.dxActionSheet = {
item: function() {
return ["
", createElementWithBindAttr("div", {
dxButton: "{ text: $data.text, onClick: $data.clickAction || $data.onClick, type: $data.type, disabled: !!ko.unwrap($data.disabled) }"
}), "
"].join("")
}
};
TEMPLATE_GENERATORS.dxToolbarBase = {
item: function() {
var template = TEMPLATE_GENERATORS.CollectionWidget.item();
template = [template.substring(0, template.length - 6), ""];
template.push("");
template.push("");
return template.join("")
},
actionSheetItem: TEMPLATE_GENERATORS.dxActionSheet.item
};
TEMPLATE_GENERATORS.dxToolbarBase.menuItem = TEMPLATE_GENERATORS.dxToolbarBase.item;
var GALLERY_IMAGE_CLASS = "dx-gallery-item-image";
TEMPLATE_GENERATORS.dxGallery = {
item: function() {
var template = TEMPLATE_GENERATORS.CollectionWidget.item(),
primitiveBinding = createElementWithBindAttr("div", {
text: "String($data)"
}),
imgBinding = createElementWithBindAttr("img", {
attr: "{ src: String($data) }"
}, false, 'class="' + GALLERY_IMAGE_CLASS + '"');
template = [template.substring(0, template.length - 6).replace(primitiveBinding, imgBinding), "", createElementWithBindAttr("img", {
attr: "{ src: $data.imageSrc, alt: $data.imageAlt }"
}, false, 'class="' + GALLERY_IMAGE_CLASS + '"'), ""].join("");
return template
}
};
TEMPLATE_GENERATORS.dxTabs = {
item: function() {
var template = TEMPLATE_GENERATORS.CollectionWidget.item(),
basePrimitiveBinding = createElementWithBindAttr("div", {
text: "String($data)"
}),
primitiveBinding = '
',
baseTextBinding = createElementWithBindAttr("div", {
text: "text"
}),
textBinding = '
';
template = template.replace("", "").replace(basePrimitiveBinding, primitiveBinding).replace(baseTextBinding, textBinding);
return template
},
itemFrame: function() {
var template = TEMPLATE_GENERATORS.CollectionWidget.itemFrame(),
badgeBinding = createElementWithBindAttr("div", {
attr: "{ 'class': 'dx-tabs-item-badge dx-badge' }",
text: "badge"
});
var markup = [template.substring(0, template.length - 6), "", badgeBinding, "", "
"];
return markup.join("")
}
};
TEMPLATE_GENERATORS.dxTabPanel = {
item: TEMPLATE_GENERATORS.CollectionWidget.item,
title: function() {
var template = TEMPLATE_GENERATORS.dxTabs.item(),
htmlBinding = "" + createElementWithBindAttr("div", {
html: "html"
}) + "";
return template.replace(/\$data\.text/g, "$data.title").replace(/\!\$data\.html\ \&\&\ /, "").replace(htmlBinding, "")
}
};
var NAVBAR_ITEM_BADGE_CLASS = "dx-navbar-item-badge";
TEMPLATE_GENERATORS.dxNavBar = {
itemFrame: function() {
var template = TEMPLATE_GENERATORS.CollectionWidget.itemFrame(),
badgeBinding = createElementWithBindAttr("div", {
text: "badge"
}, true, 'class="' + NAVBAR_ITEM_BADGE_CLASS + " " + BADGE_CLASS + '"');
var markup = [template.substring(0, template.length - 6), "", badgeBinding, "", ""];
return markup.join("")
}
};
TEMPLATE_GENERATORS.dxMenuBase = {
item: function() {
var template = [createElementWithBindAttr("div", defaultKoTemplateBasicBindings, false)],
textBinding = createElementWithBindAttr("span", {
text: "text",
css: "{ 'dx-menu-item-text': true }"
}),
primitiveBinding = createElementWithBindAttr("span", {
text: "String($data)",
css: "{ 'dx-menu-item-text': true }"
}),
popout = "";
template.push("", "", textBinding, "", "", primitiveBinding, "", "", popout, "", "
");
return template.join("")
}
};
TEMPLATE_GENERATORS.dxTreeView = {
item: function() {
var node = [],
link = createElementWithBindAttr("span", {
text: "text"
}, true),
htmlBinding = createElementWithBindAttr("div", {
html: "html"
});
node.push("
", "", htmlBinding, "", "", "" + link + "", "
");
return node.join("")
}
};
var popupTitleAndBottom = function() {
return ["
", createElementWithBindAttr("div", {
dxToolbarBase: "{ items: $data }"
}), "
"].join("")
};
TEMPLATE_GENERATORS.dxPopup = {
title: popupTitleAndBottom,
bottom: popupTitleAndBottom
};
TEMPLATE_GENERATORS.dxLookup = {
title: TEMPLATE_GENERATORS.dxPopup.title,
group: TEMPLATE_GENERATORS.dxList.group
};
var TAGBOX_TAG_CONTENT_CLASS = "dx-tag-content",
TAGBOX_TAG_REMOVE_BUTTON_CLASS = "dx-tag-remove-button";
TEMPLATE_GENERATORS.dxTagBox = {
tag: function() {
return ["
", "
", createElementWithBindAttr("span", {
text: "$data"
}), "
", "
", "
"].join("")
}
};
module.exports = TEMPLATE_GENERATORS
},
/*!*************************************!*\
!*** ./Scripts/ui/editor/editor.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
Widget = __webpack_require__( /*! ../widget/ui.widget */ 89),
ValidationMixin = __webpack_require__( /*! ../validation/validation_mixin */ 108),
Overlay = __webpack_require__( /*! ../overlay */ 109);
var READONLY_STATE_CLASS = "dx-state-readonly",
INVALID_CLASS = "dx-invalid",
INVALID_MESSAGE = "dx-invalid-message",
INVALID_MESSAGE_AUTO = "dx-invalid-message-auto",
INVALID_MESSAGE_ALWAYS = "dx-invalid-message-always",
VALIDATION_TARGET = "dx-validation-target",
VALIDATION_MESSAGE_MIN_WIDTH = 100;
var Editor = Widget.inherit({
_init: function() {
this.callBase();
this.validationRequest = $.Callbacks();
var $element = this.element();
if ($element) {
$.data($element[0], VALIDATION_TARGET, this)
}
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
value: null,
onValueChanged: null,
readOnly: false,
isValid: true,
validationError: null,
validationMessageMode: "auto",
validationBoundary: void 0,
validationMessageOffset: {
h: 0,
v: 0
}
})
},
_attachKeyboardEvents: function() {
if (this.option("readOnly")) {
return
}
this.callBase();
this._attachChildKeyboardEvents()
},
_attachChildKeyboardEvents: $.noop,
_setOptionsByReference: function() {
this.callBase();
$.extend(this._optionsByReference, {
validationError: true
})
},
_createValueChangeAction: function() {
this._valueChangeAction = this._createActionByOption("onValueChanged", {
excludeValidators: ["disabled", "readOnly"]
})
},
_suppressValueChangeAction: function() {
this._valueChangeActionSuppressed = true
},
_resumeValueChangeAction: function() {
this._valueChangeActionSuppressed = false
},
_render: function() {
this.callBase();
this._renderValidationState();
this._toggleReadOnlyState()
},
_raiseValueChangeAction: function(value, previousValue, extraArguments) {
if (!this._valueChangeAction) {
this._createValueChangeAction()
}
this._valueChangeAction(this._valueChangeArgs(value, previousValue))
},
_valueChangeArgs: function(value, previousValue) {
return {
value: value,
previousValue: previousValue,
jQueryEvent: this._valueChangeEventInstance
}
},
_saveValueChangeEvent: function(e) {
this._valueChangeEventInstance = e
},
_renderValidationState: function() {
var isValid = this.option("isValid"),
validationError = this.option("validationError"),
validationMessageMode = this.option("validationMessageMode"),
$element = this.element();
$element.toggleClass(INVALID_CLASS, !isValid);
this.setAria("invalid", !isValid || void 0);
if (this._$validationMessage) {
this._$validationMessage.remove();
this._$validationMessage = null
}
if (!isValid && validationError && validationError.message) {
this._$validationMessage = $("
", {
"class": INVALID_MESSAGE
}).html(validationError.message).appendTo($element);
this._validationMessage = this._createComponent(this._$validationMessage, Overlay, {
target: this._getValidationMessageTarget(),
shading: false,
width: "auto",
height: "auto",
container: $element,
position: this._getValidationMessagePosition("below"),
closeOnOutsideClick: false,
closeOnTargetScroll: false,
animation: null,
visible: true,
propagateOutsideClick: true
});
this._$validationMessage.toggleClass(INVALID_MESSAGE_AUTO, "auto" === validationMessageMode).toggleClass(INVALID_MESSAGE_ALWAYS, "always" === validationMessageMode);
this._setValidationMessageMaxWidth()
}
},
_setValidationMessageMaxWidth: function() {
if (!this._validationMessage) {
return
}
var validationMessageMaxWidth = Math.max(VALIDATION_MESSAGE_MIN_WIDTH, this._getValidationMessageTarget().outerWidth());
this._validationMessage.option("maxWidth", validationMessageMaxWidth)
},
_getValidationMessageTarget: function() {
return this.element()
},
_getValidationMessagePosition: function(positionRequest) {
var rtlEnabled = this.option("rtlEnabled"),
messagePositionSide = commonUtils.getDefaultAlignment(rtlEnabled),
messageOriginalOffset = this.option("validationMessageOffset"),
messageOffset = {
h: messageOriginalOffset.h,
v: messageOriginalOffset.v
},
verticalPositions = "below" === positionRequest ? [" top", " bottom"] : [" bottom", " top"];
if (rtlEnabled) {
messageOffset.h = -messageOffset.h
}
if ("below" !== positionRequest) {
messageOffset.v = -messageOffset.v
}
return {
offset: messageOffset,
boundary: this.option("validationBoundary"),
my: messagePositionSide + verticalPositions[0],
at: messagePositionSide + verticalPositions[1],
collision: "none flip"
}
},
_toggleReadOnlyState: function() {
this.element().toggleClass(READONLY_STATE_CLASS, !!this.option("readOnly"));
this.setAria("readonly", this.option("readOnly") || void 0)
},
_dispose: function() {
var element = this.element()[0];
$.data(element, VALIDATION_TARGET, null);
this.callBase()
},
_optionChanged: function(args) {
switch (args.name) {
case "onValueChanged":
this._createValueChangeAction();
break;
case "isValid":
case "validationError":
case "validationBoundary":
case "validationMessageMode":
this._renderValidationState();
break;
case "readOnly":
this._toggleReadOnlyState();
this._refreshFocusState();
break;
case "value":
if (!this._valueChangeActionSuppressed) {
this._raiseValueChangeAction(args.value, args.previousValue);
this._saveValueChangeEvent(void 0)
}
if (args.value != args.previousValue) {
this.validationRequest.fire({
value: args.value,
editor: this
})
}
break;
case "width":
this.callBase(args);
this._setValidationMessageMaxWidth();
break;
default:
this.callBase(args)
}
},
reset: function() {
this.option("value", null)
}
}).include(ValidationMixin);
module.exports = Editor
},
/*!***************************************************!*\
!*** ./Scripts/ui/validation/validation_mixin.js ***!
\***************************************************/
function(module, exports) {
var ValidationMixin = {
_findGroup: function() {
var $dxGroup, group = this.option("validationGroup");
if (!group) {
$dxGroup = this.element().parents(".dx-validationgroup:first");
if ($dxGroup.length) {
group = $dxGroup.dxValidationGroup("instance")
} else {
group = this._modelByElement(this.element())
}
}
return group
}
};
module.exports = ValidationMixin
},
/*!*******************************!*\
!*** ./Scripts/ui/overlay.js ***!
\*******************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
fx = __webpack_require__( /*! ../animation/fx */ 59),
translator = __webpack_require__( /*! ../animation/translator */ 60),
compareVersions = __webpack_require__( /*! ../core/utils/version */ 45).compare,
viewPortUtils = __webpack_require__( /*! ../core/utils/view_port */ 42),
viewPort = viewPortUtils.value,
viewPortChanged = viewPortUtils.changeCallback,
hideTopOverlayCallback = __webpack_require__( /*! ../mobile/hide_top_overlay */ 54).hideCallback,
positionUtils = __webpack_require__( /*! ../animation/position */ 61),
fitIntoRange = __webpack_require__( /*! ../core/utils/math */ 79).fitIntoRange,
domUtils = __webpack_require__( /*! ../core/utils/dom */ 50),
commonUtils = __webpack_require__( /*! ../core/utils/common */ 14),
devices = __webpack_require__( /*! ../core/devices */ 40),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 43),
Widget = __webpack_require__( /*! ./widget/ui.widget */ 89),
KeyboardProcessor = __webpack_require__( /*! ./widget/ui.keyboard_processor */ 100),
selectors = __webpack_require__( /*! ./widget/jquery.selectors */ 101),
dragEvents = __webpack_require__( /*! ../events/drag */ 110),
eventUtils = __webpack_require__( /*! ../events/utils */ 62),
pointerEvents = __webpack_require__( /*! ../events/pointer */ 65),
Resizable = __webpack_require__( /*! ./resizable */ 112);
var OVERLAY_CLASS = "dx-overlay",
OVERLAY_WRAPPER_CLASS = "dx-overlay-wrapper",
OVERLAY_CONTENT_CLASS = "dx-overlay-content",
OVERLAY_SHADER_CLASS = "dx-overlay-shader",
OVERLAY_MODAL_CLASS = "dx-overlay-modal",
INVISIBLE_STATE_CLASS = "dx-state-invisible",
ANONYMOUS_TEMPLATE_NAME = "content",
RTL_DIRECTION_CLASS = "dx-rtl",
ACTIONS = ["onShowing", "onShown", "onHiding", "onHidden", "onPositioning", "onPositioned", "onResizeStart", "onResize", "onResizeEnd"],
FIRST_Z_INDEX = 1500,
OVERLAY_STACK = [],
DISABLED_STATE_CLASS = "dx-state-disabled",
TAB_KEY = 9;
var realDevice = devices.real(),
realVersion = realDevice.version,
iOS = "ios" === realDevice.platform,
iOS7_0andBelow = iOS && compareVersions(realVersion, [7, 1]) < 0,
android4_0nativeBrowser = "android" === realDevice.platform && 0 === compareVersions(realVersion, [4, 0], 2) && navigator.userAgent.indexOf("Chrome") === -1;
var forceRepaint = function($element) {
if (iOS7_0andBelow) {
$element.width()
}
if (android4_0nativeBrowser) {
var $parents = $element.parents(),
inScrollView = $parents.is(".dx-scrollable-native");
if (!inScrollView) {
$parents.css("backface-visibility", "hidden");
$parents.css("backface-visibility");
$parents.css("backface-visibility", "visible")
}
}
};
var getElement = function(value) {
return value && $(value instanceof $.Event ? value.target : value)
};
$(document).on(pointerEvents.down, function(e) {
for (var i = OVERLAY_STACK.length - 1; i >= 0; i--) {
if (!OVERLAY_STACK[i]._proxiedDocumentDownHandler(e)) {
return
}
}
});
var Overlay = Widget.inherit({
_supportedKeys: function() {
var offsetSize = 5,
move = function(top, left, e) {
if (!this.option("dragEnabled")) {
return
}
e.preventDefault();
e.stopPropagation();
var allowedOffsets = this._allowedOffsets();
var offset = {
top: fitIntoRange(top, -allowedOffsets.top, allowedOffsets.bottom),
left: fitIntoRange(left, -allowedOffsets.left, allowedOffsets.right)
};
this._changePosition(offset)
};
return $.extend(this.callBase(), {
escape: function(e) {
this.hide()
},
upArrow: $.proxy(move, this, -offsetSize, 0),
downArrow: $.proxy(move, this, offsetSize, 0),
leftArrow: $.proxy(move, this, 0, -offsetSize),
rightArrow: $.proxy(move, this, 0, offsetSize)
})
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
activeStateEnabled: false,
visible: false,
deferRendering: true,
shading: true,
shadingColor: "",
position: {
my: "center",
at: "center"
},
width: function() {
return .8 * $(window).width()
},
minWidth: null,
maxWidth: null,
height: function() {
return .8 * $(window).height()
},
minHeight: null,
maxHeight: null,
animation: {
show: {
type: "pop",
duration: 300,
from: {
scale: .55
}
},
hide: {
type: "pop",
duration: 300,
to: {
opacity: 0,
scale: .55
},
from: {
opacity: 1,
scale: 1
}
}
},
closeOnOutsideClick: false,
closeOnBackButton: true,
onShowing: null,
onShown: null,
onHiding: null,
onHidden: null,
contentTemplate: "content",
dragEnabled: false,
resizeEnabled: false,
onResizeStart: null,
onResize: null,
onResizeEnd: null,
onContentReady: null,
target: void 0,
container: void 0,
hideTopOverlayHandler: void 0,
closeOnTargetScroll: false,
onPositioned: null,
boundaryOffset: {
h: 0,
v: 0
},
propagateOutsideClick: false
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function(device) {
var realDevice = devices.real(),
realPlatform = realDevice.platform,
realVersion = realDevice.version;
return "android" === realPlatform && compareVersions(realVersion, [4, 2]) < 0
},
options: {
animation: {
show: {
type: "fade",
duration: 400
},
hide: {
type: "fade",
duration: 400,
to: {
opacity: 0
},
from: {
opacity: 1
}
}
}
}
}])
},
_setOptionsByReference: function() {
this.callBase();
$.extend(this._optionsByReference, {
animation: true
})
},
_getAnonymousTemplateName: function() {
return ANONYMOUS_TEMPLATE_NAME
},
_wrapper: function() {
return this._$wrapper
},
_container: function() {
return this._$content
},
_eventBindingTarget: function() {
return this._$content
},
_init: function() {
this.callBase();
this._initActions();
this._initCloseOnOutsideClickHandler();
this._initTabTerminatorHandler();
this._$wrapper = $("
").addClass(OVERLAY_WRAPPER_CLASS);
this._$content = $("
").addClass(OVERLAY_CONTENT_CLASS);
var $element = this.element();
this._$wrapper.addClass($element.attr("class"));
$element.addClass(OVERLAY_CLASS);
this._$wrapper.attr("data-bind", "dxControlsDescendantBindings: true");
this._$wrapper.on("MSPointerDown", $.noop);
this._$wrapper.on("focusin", function(e) {
e.stopPropagation()
});
this._toggleViewPortSubscription(true)
},
_initOptions: function(options) {
this._initTarget(options.target);
this._initContainer(options.container);
this._initHideTopOverlayHandler(options.hideTopOverlayHandler);
this.callBase(options)
},
_initTarget: function(target) {
if (!commonUtils.isDefined(target)) {
return
}
var options = this.option();
$.each(["position.of", "animation.show.from.position.of", "animation.show.to.position.of", "animation.hide.from.position.of", "animation.hide.to.position.of"], function(_, path) {
var pathParts = path.split(".");
var option = options;
while (option) {
if (1 === pathParts.length) {
if ($.isPlainObject(option)) {
option[pathParts.shift()] = target
}
break
} else {
option = option[pathParts.shift()]
}
}
})
},
_initContainer: function(container) {
container = void 0 === container ? viewPort() : container;
var $element = this.element(),
$container = $element.closest(container);
if (!$container.length) {
$container = $(container).first()
}
this._$container = $container.length ? $container : $element.parent()
},
_initHideTopOverlayHandler: function(handler) {
this._hideTopOverlayHandler = void 0 !== handler ? handler : $.proxy(this._defaultHideTopOverlayHandler, this)
},
_defaultHideTopOverlayHandler: function() {
this.hide()
},
_initActions: function() {
this._actions = {};
$.each(ACTIONS, $.proxy(function(_, action) {
this._actions[action] = this._createActionByOption(action, {
excludeValidators: ["disabled", "readOnly"]
}) || $.noop
}, this))
},
_initCloseOnOutsideClickHandler: function() {
var that = this;
this._proxiedDocumentDownHandler = function() {
return that._documentDownHandler.apply(that, arguments)
}
},
_documentDownHandler: function(e) {
if (this._showAnimationProcessing) {
this._stopAnimation();
return
}
var closeOnOutsideClick = this.option("closeOnOutsideClick");
if ($.isFunction(closeOnOutsideClick)) {
closeOnOutsideClick = closeOnOutsideClick(e)
}
if (closeOnOutsideClick) {
var $container = this._$content,
outsideClick = !$container.is(e.target) && !$.contains($container.get(0), e.target);
if (outsideClick) {
if (this.option("shading")) {
e.preventDefault()
}
this.hide()
}
}
return this.option("propagateOutsideClick")
},
_isTopOverlay: function() {
var overlayStack = this._overlayStack();
return overlayStack[overlayStack.length - 1] === this
},
_overlayStack: function() {
return OVERLAY_STACK
},
_zIndexInitValue: function() {
return FIRST_Z_INDEX
},
_toggleViewPortSubscription: function(toggle) {
viewPortChanged.remove(this._viewPortChangeHandle);
if (toggle) {
this._viewPortChangeHandle = $.proxy(this._viewPortChangeHandler, this);
viewPortChanged.add(this._viewPortChangeHandle)
}
},
_viewPortChangeHandler: function() {
this._initContainer(this.option("container"));
this._refresh()
},
_renderVisibilityAnimate: function(visible) {
this._stopAnimation();
return visible ? this._show() : this._hide()
},
_normalizePosition: function() {
this._position = this.option("position")
},
_getAnimationConfig: function() {
var animation = this.option("animation");
if ($.isFunction(animation)) {
animation = animation.call(this)
}
return animation
},
_show: function() {
var that = this,
deferred = $.Deferred();
this._parentHidden = this._isParentHidden();
deferred.done(function() {
delete that._parentHidden
});
if (this._parentHidden) {
return deferred.resolve()
}
if (this._currentVisible) {
return $.when().promise()
}
this._currentVisible = true;
this._normalizePosition();
var animation = that._getAnimationConfig() || {},
showAnimation = this._normalizeAnimation(animation.show, "to"),
startShowAnimation = showAnimation && showAnimation.start || $.noop,
completeShowAnimation = showAnimation && showAnimation.complete || $.noop;
if (this._isHidingActionCanceled) {
delete this._isHidingActionCanceled;
deferred.resolve()
} else {
var show = function() {
this._renderVisibility(true);
this._animate(showAnimation, function() {
if (that.option("focusStateEnabled")) {
that._focusTarget().focus()
}
completeShowAnimation.apply(this, arguments);
that._showAnimationProcessing = false;
that._actions.onShown();
deferred.resolve()
}, function() {
startShowAnimation.apply(this, arguments);
that._showAnimationProcessing = true
})
}.bind(this);
if (this.option("templatesRenderAsynchronously")) {
this._asyncShowTimeout = setTimeout(show)
} else {
show()
}
}
return deferred.promise()
},
_normalizeAnimation: function(animation, prop) {
if (animation && animation[prop]) {
animation = $.extend({
type: "slide"
}, animation);
$.extend(animation[prop], {
position: this._position
})
}
return animation
},
_hide: function() {
if (!this._currentVisible) {
return $.when().promise()
}
this._currentVisible = false;
var that = this,
deferred = $.Deferred(),
animation = that._getAnimationConfig() || {},
hideAnimation = this._normalizeAnimation(animation.hide, "from"),
completeHideAnimation = hideAnimation && hideAnimation.complete || $.noop,
hidingArgs = {
cancel: false
};
this._actions.onHiding(hidingArgs);
if (hidingArgs.cancel) {
this._isHidingActionCanceled = true;
this.option("visible", true);
deferred.resolve()
} else {
this._forceFocusLost();
this._toggleShading(false);
this._toggleSubscriptions(false);
this._animate(hideAnimation, function() {
that._renderVisibility(false);
completeHideAnimation.apply(this, arguments);
that._actions.onHidden();
deferred.resolve()
})
}
return deferred.promise()
},
_forceFocusLost: function() {
document.activeElement && this._$content.find(document.activeElement).length && document.activeElement.blur()
},
_animate: function(animation, completeCallback, startCallback) {
if (animation) {
startCallback = startCallback || animation.start || $.noop;
var $content = this._$content;
fx.animate(this._$content, $.extend({}, animation, {
start: function() {
$content.css("pointer-events", "none");
startCallback.apply(this, arguments)
},
complete: function() {
$content.css("pointer-events", "");
completeCallback.apply(this, arguments)
}
}))
} else {
completeCallback()
}
},
_stopAnimation: function() {
fx.stop(this._$content, true)
},
_renderVisibility: function(visible) {
if (visible && this._isParentHidden()) {
return
}
this._currentVisible = visible;
this._stopAnimation();
clearTimeout(this._asyncShowTimeout);
if (!visible) {
domUtils.triggerHidingEvent(this._$content)
}
this._toggleVisibility(visible);
this._$content.toggleClass(INVISIBLE_STATE_CLASS, !visible);
this._updateZIndexStackPosition(visible);
if (visible) {
this._renderContent();
this._actions.onShowing();
this._moveToContainer();
this._renderGeometry();
domUtils.triggerShownEvent(this._$content);
domUtils.triggerResizeEvent(this._$content)
} else {
this._moveFromContainer()
}
this._toggleShading(visible);
this._toggleSubscriptions(visible)
},
_updateZIndexStackPosition: function(pushToStack) {
var overlayStack = this._overlayStack(),
index = $.inArray(this, overlayStack);
if (pushToStack) {
if (index === -1) {
var length = overlayStack.length;
this._zIndex = (length ? overlayStack[length - 1]._zIndex : this._zIndexInitValue()) + 1;
overlayStack.push(this)
}
this._$wrapper.css("z-index", this._zIndex);
this._$content.css("z-index", this._zIndex)
} else {
if (index !== -1) {
overlayStack.splice(index, 1)
}
}
},
_toggleShading: function(visible) {
this._$wrapper.toggleClass(OVERLAY_MODAL_CLASS, this.option("shading") && !this.option("container"));
this._$wrapper.toggleClass(OVERLAY_SHADER_CLASS, visible && this.option("shading"));
this._$wrapper.css("background-color", this.option("shading") ? this.option("shadingColor") : "");
this._toggleTabTerminator(visible && this.option("shading"))
},
_initTabTerminatorHandler: function() {
var that = this;
this._proxiedTabTerminatorHandler = function() {
that._tabKeyHandler.apply(that, arguments)
}
},
_toggleTabTerminator: function(enabled) {
var eventName = eventUtils.addNamespace("keydown", this.NAME);
if (enabled) {
$(document).on(eventName, this._proxiedTabTerminatorHandler)
} else {
$(document).off(eventName, this._proxiedTabTerminatorHandler)
}
},
_tabKeyHandler: function(e) {
if (e.keyCode !== TAB_KEY || !this._isTopOverlay()) {
return
}
var tabbableElements = this._$wrapper.find(selectors.tabbable),
$firstTabbable = tabbableElements.first(),
$lastTabbable = tabbableElements.last(),
isTabOnLast = !e.shiftKey && e.target === $lastTabbable.get(0),
isShiftTabOnFirst = e.shiftKey && e.target === $firstTabbable.get(0),
isEmptyTabList = 0 === tabbableElements.length,
isOutsideTarget = $.inArray(e.target, tabbableElements) === -1;
if (isTabOnLast || isShiftTabOnFirst || isEmptyTabList || isOutsideTarget) {
e.preventDefault();
(e.shiftKey ? $lastTabbable : $firstTabbable).focusin().focus()
}
},
_toggleSubscriptions: function(enabled) {
this._toggleHideTopOverlayCallback(enabled);
this._toggleParentsScrollSubscription(enabled)
},
_toggleHideTopOverlayCallback: function(subscribe) {
if (!this._hideTopOverlayHandler) {
return
}
if (subscribe && this.option("closeOnBackButton")) {
hideTopOverlayCallback.add(this._hideTopOverlayHandler)
} else {
hideTopOverlayCallback.remove(this._hideTopOverlayHandler)
}
},
_toggleParentsScrollSubscription: function(subscribe) {
if (!this._position) {
return
}
var target = this._position.of || $(),
closeOnScroll = this.option("closeOnTargetScroll"),
$parents = getElement(target).parents(),
scrollEvent = eventUtils.addNamespace("scroll", this.NAME);
if ("generic" === devices.real().platform) {
$parents = $parents.add(window)
}
this._proxiedTargetParentsScrollHandler = this._proxiedTargetParentsScrollHandler || $.proxy(function(e) {
this._targetParentsScrollHandler(e)
}, this);
$().add(this._$prevTargetParents).off(scrollEvent, this._proxiedTargetParentsScrollHandler);
if (subscribe && closeOnScroll) {
$parents.on(scrollEvent, this._proxiedTargetParentsScrollHandler);
this._$prevTargetParents = $parents
}
},
_targetParentsScrollHandler: function(e) {
var closeHandled = false,
closeOnScroll = this.option("closeOnTargetScroll");
if ($.isFunction(closeOnScroll)) {
closeHandled = closeOnScroll(e)
}
if (!closeHandled && !this._showAnimationProcessing) {
this.hide()
}
},
_render: function() {
this.callBase();
this._$content.appendTo(this.element());
this._renderVisibilityAnimate(this.option("visible"))
},
_renderContent: function() {
var shouldDeferRendering = !this._currentVisible && this.option("deferRendering");
var isParentHidden = this.option("visible") && this._isParentHidden();
if (isParentHidden) {
this._isHidden = true;
return
}
if (this._contentAlreadyRendered || shouldDeferRendering) {
return
}
this._contentAlreadyRendered = true;
this.callBase()
},
_isParentHidden: function() {
if (void 0 !== this._parentHidden) {
return this._parentHidden
}
var $parent = this.element().parent();
if ($parent.is(":visible")) {
return false
}
var isHidden = false;
$parent.add($parent.parents()).each(function() {
var $element = $(this);
if ("none" === $element.css("display")) {
isHidden = true;
return false
}
});
return isHidden || !$.contains(document, $parent.get(0))
},
_renderContentImpl: function() {
var $element = this.element();
this._$content.appendTo($element);
var contentTemplate = this._getTemplate(this.option("contentTemplate"));
contentTemplate && contentTemplate.render({
container: this.content(),
noModel: true
});
this._renderDrag();
this._renderResize();
this._renderScrollTerminator()
},
_renderDrag: function() {
var $dragTarget = this._getDragTarget();
if (!$dragTarget) {
return
}
var startEventName = eventUtils.addNamespace(dragEvents.start, this.NAME),
updateEventName = eventUtils.addNamespace(dragEvents.move, this.NAME);
$dragTarget.off(startEventName).off(updateEventName);
if (!this.option("dragEnabled")) {
return
}
$dragTarget.on(startEventName, $.proxy(this._dragStartHandler, this)).on(updateEventName, $.proxy(this._dragUpdateHandler, this))
},
_renderResize: function() {
this._createComponent(this._$content, Resizable, {
handles: this.option("resizeEnabled") ? "all" : "none",
onResizeEnd: $.proxy(this._resizeEndHandler, this),
onResize: $.proxy(this._actions.onResize, this),
onResizeStart: $.proxy(this._actions.onResizeStart, this),
minHeight: 100,
minWidth: 100,
area: this._$container
})
},
_resizeEndHandler: function() {
this._positionChangeHandled = true;
this._dimensionChangeHandled = true;
this._actions.onResizeEnd()
},
_renderScrollTerminator: function() {
var $scrollTerminator = this._wrapper();
var terminatorEventName = eventUtils.addNamespace(dragEvents.move, this.NAME);
$scrollTerminator.off(terminatorEventName).on(terminatorEventName, {
validate: function() {
return true
},
getDirection: function() {
return "both"
},
_toggleGestureCover: $.noop,
_clearSelection: $.noop,
isNative: true
}, function(e) {
if ("mousemove" !== e.originalEvent.originalEvent.type) {
e.preventDefault()
}
})
},
_getDragTarget: function() {
return this.content()
},
_dragStartHandler: function(e) {
e.targetElements = [];
this._prevOffset = {
x: 0,
y: 0
};
var allowedOffsets = this._allowedOffsets();
e.maxTopOffset = allowedOffsets.top;
e.maxBottomOffset = allowedOffsets.bottom;
e.maxLeftOffset = allowedOffsets.left;
e.maxRightOffset = allowedOffsets.right
},
_deltaSize: function() {
var $content = this._$content,
$container = this._$container;
var contentWidth = $content.outerWidth(),
contentHeight = $content.outerHeight(),
containerWidth = $container.width(),
containerHeight = $container.height();
return {
width: containerWidth - contentWidth,
height: containerHeight - contentHeight
}
},
_dragUpdateHandler: function(e) {
var offset = e.offset,
prevOffset = this._prevOffset,
targetOffset = {
top: offset.y - prevOffset.y,
left: offset.x - prevOffset.x
};
this._changePosition(targetOffset);
this._prevOffset = offset
},
_changePosition: function(offset) {
var position = translator.locate(this._$content);
translator.move(this._$content, {
left: position.left + offset.left,
top: position.top + offset.top
});
this._positionChangeHandled = true
},
_allowedOffsets: function() {
var position = translator.locate(this._$content),
deltaSize = this._deltaSize(),
isAllowedDrag = deltaSize.height >= 0 && deltaSize.width >= 0,
boundaryOffset = this.option("boundaryOffset");
return {
top: isAllowedDrag ? position.top + boundaryOffset.v : 0,
bottom: isAllowedDrag ? -position.top + deltaSize.height - boundaryOffset.v : 0,
left: isAllowedDrag ? position.left + boundaryOffset.h : 0,
right: isAllowedDrag ? -position.left + deltaSize.width - boundaryOffset.h : 0
}
},
_fireContentReadyAction: function() {
if (this.option("visible")) {
this._moveToContainer()
}
this.callBase.apply(this, arguments)
},
_moveFromContainer: function() {
this._$content.appendTo(this.element());
this._detachWrapperToContainer()
},
_detachWrapperToContainer: function() {
this._$wrapper.detach()
},
_moveToContainer: function() {
this._attachWrapperToContainer();
this._$content.appendTo(this._$wrapper)
},
_attachWrapperToContainer: function() {
var $element = this.element();
if (this._$container && this._$container[0] !== $element.parent()[0]) {
this._$wrapper.appendTo(this._$container)
} else {
this._$wrapper.appendTo($element)
}
},
_renderGeometry: function() {
if (this.option("visible")) {
this._renderGeometryImpl()
}
},
_renderGeometryImpl: function() {
this._stopAnimation();
this._normalizePosition();
this._renderShading();
this._renderDimensions();
var resultPosition = this._renderPosition();
this._actions.onPositioned({
position: resultPosition
})
},
_renderShading: function() {
var $wrapper = this._$wrapper,
$container = this._getContainer();
$wrapper.css("position", this._isWindow($container) && !iOS ? "fixed" : "absolute");
this._renderShadingDimensions();
this._renderShadingPosition()
},
_renderShadingPosition: function() {
if (this.option("shading")) {
var $container = this._getContainer();
positionUtils.setup(this._$wrapper, {
my: "top left",
at: "top left",
of: $container
})
}
},
_renderShadingDimensions: function() {
if (this.option("shading")) {
var $container = this._getContainer(),
wrapperWidth = this._isWindow($container) ? "100%" : $container.outerWidth(),
wrapperHeight = this._isWindow($container) ? "100%" : $container.outerHeight();
this._$wrapper.css({
width: wrapperWidth,
height: wrapperHeight
})
}
},
_isWindow: function($element) {
return !!$element && $.isWindow($element.get(0))
},
_getContainer: function() {
var position = this._position,
container = this.option("container"),
positionOf = position ? position.of || window : null;
return getElement(container || positionOf)
},
_renderDimensions: function() {
this._$content.css({
minWidth: this.option("minWidth"),
maxWidth: this.option("maxWidth"),
minHeight: this.option("minHeight"),
maxHeight: this.option("maxHeight")
});
if (this._dimensionChangeHandled) {
var $content = this._$content,
$container = this._$container;
$content.outerWidth(Math.min($content.outerWidth(), $container.width())).outerHeight(Math.min($content.outerHeight(), $container.height()))
} else {
this._$content.outerWidth(this.option("width")).outerHeight(this.option("height"))
}
},
_renderPosition: function() {
if (this._positionChangeHandled) {
var allowedOffsets = this._allowedOffsets();
this._changePosition({
top: fitIntoRange(0, -allowedOffsets.top, allowedOffsets.bottom),
left: fitIntoRange(0, -allowedOffsets.left, allowedOffsets.right)
})
} else {
this._renderOverlayBoundaryOffset();
translator.resetPosition(this._$content);
var resultPosition = positionUtils.setup(this._$content, this._position);
forceRepaint(this._$content);
this._actions.onPositioning();
return resultPosition
}
},
_renderOverlayBoundaryOffset: function() {
var boundaryOffset = this.option("boundaryOffset");
this._$content.css("margin", boundaryOffset.v + "px " + boundaryOffset.h + "px")
},
_focusTarget: function() {
return this._$content
},
_attachKeyboardEvents: function() {
this._keyboardProcessor = new KeyboardProcessor({
element: this._$content,
handler: this._keyboardHandler,
context: this
})
},
_keyboardHandler: function(options) {
var e = options.originalEvent,
$target = $(e.target);
if ($target.is(this._$content)) {
this.callBase.apply(this, arguments)
}
},
_isVisible: function() {
return this.option("visible")
},
_visibilityChanged: function(visible) {
if (visible) {
if (this.option("visible")) {
this._renderVisibilityAnimate(visible)
}
} else {
this._renderVisibilityAnimate(visible)
}
},
_dimensionChanged: function() {
this._renderGeometry()
},
_clean: function() {
if (!this._contentAlreadyRendered) {
this.content().empty()
}
this._renderVisibility(false);
this._cleanFocusState()
},
_dispose: function() {
fx.stop(this._$content, false);
clearTimeout(this._deferShowTimer);
this._toggleViewPortSubscription(false);
this._toggleSubscriptions(false);
this._updateZIndexStackPosition(false);
this._toggleTabTerminator(false);
this._actions = null;
this.callBase();
this._$wrapper.remove();
this._$content.remove()
},
_toggleDisabledState: function(value) {
this.callBase.apply(this, arguments);
this._$content.toggleClass(DISABLED_STATE_CLASS, Boolean(value))
},
_toggleRTLDirection: function(rtl) {
this._$content.toggleClass(RTL_DIRECTION_CLASS, rtl)
},
_optionChanged: function(args) {
var value = args.value;
if ($.inArray(args.name, ACTIONS) > -1) {
this._initActions();
return
}
switch (args.name) {
case "dragEnabled":
this._renderDrag();
this._renderGeometry();
break;
case "resizeEnabled":
this._renderResize();
this._renderGeometry();
break;
case "shading":
case "shadingColor":
this._toggleShading(this.option("visible"));
break;
case "width":
case "minWidth":
case "maxWidth":
case "height":
case "minHeight":
case "maxHeight":
case "position":
case "boundaryOffset":
this._renderGeometry();
break;
case "visible":
this._renderVisibilityAnimate(value).done($.proxy(function() {
if (!this._animateDeferred) {
return
}
this._animateDeferred.resolveWith(this)
}, this));
break;
case "target":
this._initTarget(value);
this._invalidate();
break;
case "container":
this._initContainer(value);
this._invalidate();
break;
case "deferRendering":
case "contentTemplate":
this._contentAlreadyRendered = false;
this._invalidate();
break;
case "closeOnBackButton":
this._toggleHideTopOverlayCallback(this.option("visible"));
break;
case "closeOnTargetScroll":
this._toggleParentsScrollSubscription(this.option("visible"));
break;
case "closeOnOutsideClick":
case "animation":
case "propagateOutsideClick":
break;
default:
this.callBase(args)
}
},
toggle: function(showing) {
showing = void 0 === showing ? !this.option("visible") : showing;
if (showing === this.option("visible")) {
return $.Deferred().resolve().promise()
}
var animateDeferred = $.Deferred();
this._animateDeferred = animateDeferred;
this.option("visible", showing);
return animateDeferred.promise().done($.proxy(function() {
delete this._animateDeferred
}, this))
},
show: function() {
return this.toggle(true)
},
hide: function() {
return this.toggle(false)
},
content: function() {
return this._$content
},
repaint: function() {
this._renderGeometry()
}
});
Overlay.baseZIndex = function(zIndex) {
FIRST_Z_INDEX = zIndex
};
registerComponent("dxOverlay", Overlay);
module.exports = Overlay
},
/*!********************************!*\
!*** ./Scripts/events/drag.js ***!
\********************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
wrapToArray = __webpack_require__( /*! ../core/utils/array */ 111).wrapToArray,
registerEvent = __webpack_require__( /*! ./core/event_registrator */ 66),
eventUtils = __webpack_require__( /*! ./utils */ 62),
GestureEmitter = __webpack_require__( /*! ./gesture/emitter.gesture */ 78),
registerEmitter = __webpack_require__( /*! ./core/emitter_registrator */ 76);
var DRAG_START_EVENT = "dxdragstart",
DRAG_EVENT = "dxdrag",
DRAG_END_EVENT = "dxdragend",
DRAG_ENTER_EVENT = "dxdragenter",
DRAG_LEAVE_EVENT = "dxdragleave",
DROP_EVENT = "dxdrop";
var knownDropTargets = [],
knownDropTargetSelectors = [],
knownDropTargetConfigs = [];
var dropTargetRegistration = {
setup: function(element, data) {
var knownDropTarget = $.inArray(element, knownDropTargets) !== -1;
if (!knownDropTarget) {
knownDropTargets.push(element);
knownDropTargetSelectors.push([]);
knownDropTargetConfigs.push(data || {})
}
},
add: function(element, handleObj) {
var index = $.inArray(element, knownDropTargets);
var selector = handleObj.selector;
if ($.inArray(selector, knownDropTargetSelectors[index]) === -1) {
knownDropTargetSelectors[index].push(selector)
}
},
teardown: function(element, data) {
var elementEvents = $._data(element, "events"),
handlersCount = 0;
$.each([DRAG_ENTER_EVENT, DRAG_LEAVE_EVENT, DROP_EVENT], function(_, eventName) {
var eventHandlers = elementEvents[eventName];
if (eventHandlers) {
handlersCount += eventHandlers.length
}
});
if (!handlersCount) {
var index = $.inArray(element, knownDropTargets);
knownDropTargets.splice(index, 1);
knownDropTargetSelectors.splice(index, 1);
knownDropTargetConfigs.splice(index, 1)
}
}
};
registerEvent(DRAG_ENTER_EVENT, dropTargetRegistration);
registerEvent(DRAG_LEAVE_EVENT, dropTargetRegistration);
registerEvent(DROP_EVENT, dropTargetRegistration);
var getItemDelegatedTargets = function($element) {
var dropTargetIndex = $.inArray($element.get(0), knownDropTargets),
dropTargetSelectors = knownDropTargetSelectors[dropTargetIndex];
var $delegatedTargets = $element.find(dropTargetSelectors.join(", "));
if ($.inArray(void 0, dropTargetSelectors) !== -1) {
$delegatedTargets = $delegatedTargets.addBack()
}
return $delegatedTargets
};
var getItemConfig = function($element) {
var dropTargetIndex = $.inArray($element.get(0), knownDropTargets);
return knownDropTargetConfigs[dropTargetIndex]
};
var getItemPosition = function(dropTargetConfig, $element) {
if (dropTargetConfig.itemPositionFunc) {
return dropTargetConfig.itemPositionFunc($element)
} else {
return $element.offset()
}
};
var getItemSize = function(dropTargetConfig, $element) {
if (dropTargetConfig.itemSizeFunc) {
return dropTargetConfig.itemSizeFunc($element)
}
return {
width: $element.width(),
height: $element.height()
}
};
var DragEmitter = GestureEmitter.inherit({
ctor: function(element) {
this.callBase(element);
this.direction = "both"
},
_init: function(e) {
this._initEvent = e
},
_start: function(e) {
e = this._fireEvent(DRAG_START_EVENT, this._initEvent);
this._maxLeftOffset = e.maxLeftOffset;
this._maxRightOffset = e.maxRightOffset;
this._maxTopOffset = e.maxTopOffset;
this._maxBottomOffset = e.maxBottomOffset;
var dropTargets = wrapToArray(e.targetElements || (null === e.targetElements ? [] : knownDropTargets));
this._dropTargets = $.map(dropTargets, function(element) {
return $(element).get(0)
})
},
_move: function(e) {
var eventData = eventUtils.eventData(e),
dragOffset = this._calculateOffset(eventData);
this._fireEvent(DRAG_EVENT, e, {
offset: dragOffset
});
this._processDropTargets(e, dragOffset);
e.preventDefault()
},
_calculateOffset: function(eventData) {
return {
x: this._calculateXOffset(eventData),
y: this._calculateYOffset(eventData)
}
},
_calculateXOffset: function(eventData) {
if ("vertical" !== this.direction) {
var offset = eventData.x - this._startEventData.x;
return this._fitOffset(offset, this._maxLeftOffset, this._maxRightOffset)
}
return 0
},
_calculateYOffset: function(eventData) {
if ("horizontal" !== this.direction) {
var offset = eventData.y - this._startEventData.y;
return this._fitOffset(offset, this._maxTopOffset, this._maxBottomOffset)
}
return 0
},
_fitOffset: function(offset, minOffset, maxOffset) {
if (null != minOffset) {
offset = Math.max(offset, -minOffset)
}
if (null != maxOffset) {
offset = Math.min(offset, maxOffset)
}
return offset
},
_processDropTargets: function(e, dragOffset) {
var target = this._findDropTarget(e),
sameTarget = target === this._currentDropTarget;
if (!sameTarget) {
this._fireDropTargetEvent(e, DRAG_LEAVE_EVENT);
this._currentDropTarget = target;
this._fireDropTargetEvent(e, DRAG_ENTER_EVENT)
}
},
_fireDropTargetEvent: function(event, eventName) {
if (!this._currentDropTarget) {
return
}
var eventData = {
type: eventName,
originalEvent: event,
draggingElement: this._$element.get(0),
target: this._currentDropTarget
};
eventUtils.fireEvent(eventData)
},
_findDropTarget: function(e) {
var result, that = this;
$.each(knownDropTargets, function(_, target) {
if (!that._checkDropTargetActive(target)) {
return
}
var $target = $(target);
$.each(getItemDelegatedTargets($target), function(_, delegatedTarget) {
var $delegatedTarget = $(delegatedTarget);
if (that._checkDropTarget(getItemConfig($target), $delegatedTarget, e)) {
result = delegatedTarget
}
})
});
return result
},
_checkDropTargetActive: function(target) {
var active = false;
$.each(this._dropTargets, function(_, activeTarget) {
active = active || activeTarget === target || $.contains(activeTarget, target);
return !active
});
return active
},
_checkDropTarget: function(config, $target, e) {
var isDraggingElement = $target.get(0) === this._$element.get(0);
if (isDraggingElement) {
return false
}
var targetPosition = getItemPosition(config, $target);
if (e.pageX < targetPosition.left) {
return false
}
if (e.pageY < targetPosition.top) {
return false
}
var targetSize = getItemSize(config, $target);
if (e.pageX > targetPosition.left + targetSize.width) {
return false
}
if (e.pageY > targetPosition.top + targetSize.height) {
return false
}
return $target
},
_end: function(e) {
var eventData = eventUtils.eventData(e);
this._fireEvent(DRAG_END_EVENT, e, {
offset: this._calculateOffset(eventData)
});
this._fireDropTargetEvent(e, DROP_EVENT);
delete this._currentDropTarget
}
});
registerEmitter({
emitter: DragEmitter,
events: [DRAG_START_EVENT, DRAG_EVENT, DRAG_END_EVENT]
});
exports.dropTargets = knownDropTargets;
exports.move = DRAG_EVENT;
exports.start = DRAG_START_EVENT;
exports.end = DRAG_END_EVENT;
exports.enter = DRAG_ENTER_EVENT;
exports.leave = DRAG_LEAVE_EVENT;
exports.drop = DROP_EVENT
},
/*!*************************************!*\
!*** ./Scripts/core/utils/array.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
commonUtils = __webpack_require__( /*! ./common */ 14),
objectUtils = __webpack_require__( /*! ./object */ 37);
var isEmpty = function(entity) {
return $.isArray(entity) && !entity.length
};
var wrapToArray = function(entity) {
return $.isArray(entity) ? entity : [entity]
};
var intersection = function(a, b) {
if (!$.isArray(a) || 0 === a.length || !$.isArray(b) || 0 === b.length) {
return []
}
var result = [];
$.each(a, function(_, value) {
var index = $.inArray(value, b);
if (index !== -1) {
result.push(value)
}
});
return result
};
var removeDuplicates = function(from, what) {
if (!$.isArray(from) || 0 === from.length) {
return []
}
if (!$.isArray(what) || 0 === what.length) {
return from.slice()
}
var result = [];
$.each(from, function(_, value) {
var index = $.inArray(value, what);
if (index === -1) {
result.push(value)
}
});
return result
};
var normalizeIndexes = function(items, indexParameterName, currentItem, needIndexCallback) {
var indexedItems = {},
parameterIndex = 0;
$.each(items, function(index, item) {
index = item[indexParameterName];
if (commonUtils.isDefined(index)) {
indexedItems[index] = indexedItems[index] || [];
if (item === currentItem) {
indexedItems[index].unshift(item)
} else {
indexedItems[index].push(item)
}
delete item[indexParameterName]
}
});
objectUtils.orderEach(indexedItems, function(index, items) {
$.each(items, function() {
if (index >= 0) {
this[indexParameterName] = parameterIndex++
}
})
});
$.each(items, function() {
if (!commonUtils.isDefined(this[indexParameterName]) && (!needIndexCallback || needIndexCallback(this))) {
this[indexParameterName] = parameterIndex++
}
});
return parameterIndex
};
exports.isEmpty = isEmpty;
exports.wrapToArray = wrapToArray;
exports.intersection = intersection;
exports.removeDuplicates = removeDuplicates;
exports.normalizeIndexes = normalizeIndexes
},
/*!*********************************!*\
!*** ./Scripts/ui/resizable.js ***!
\*********************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 43),
stringUtils = __webpack_require__( /*! ../core/utils/string */ 13),
translator = __webpack_require__( /*! ../animation/translator */ 60),
fitIntoRange = __webpack_require__( /*! ../core/utils/math */ 79).fitIntoRange,
DOMComponent = __webpack_require__( /*! ../core/dom_component */ 29),
eventUtils = __webpack_require__( /*! ../events/utils */ 62),
dragEvents = __webpack_require__( /*! ../events/drag */ 110);
var RESIZABLE = "dxResizable",
RESIZABLE_CLASS = "dx-resizable",
RESIZABLE_RESIZING_CLASS = "dx-resizable-resizing",
RESIZABLE_HANDLE_CLASS = "dx-resizable-handle",
RESIZABLE_HANDLE_TOP_CLASS = "dx-resizable-handle-top",
RESIZABLE_HANDLE_BOTTOM_CLASS = "dx-resizable-handle-bottom",
RESIZABLE_HANDLE_LEFT_CLASS = "dx-resizable-handle-left",
RESIZABLE_HANDLE_RIGHT_CLASS = "dx-resizable-handle-right",
RESIZABLE_HANDLE_CORNER_CLASS = "dx-resizable-handle-corner",
DRAGSTART_START_EVENT_NAME = eventUtils.addNamespace(dragEvents.start, RESIZABLE),
DRAGSTART_EVENT_NAME = eventUtils.addNamespace(dragEvents.move, RESIZABLE),
DRAGSTART_END_EVENT_NAME = eventUtils.addNamespace(dragEvents.end, RESIZABLE);
var Resizable = DOMComponent.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
handles: "all",
step: "1",
stepPrecision: "simple",
area: void 0,
minWidth: 30,
maxWidth: 1 / 0,
minHeight: 30,
maxHeight: 1 / 0,
onResizeStart: null,
onResize: null,
onResizeEnd: null
})
},
_init: function() {
this.callBase();
this.element().addClass(RESIZABLE_CLASS)
},
_render: function() {
this.callBase();
this._renderActions();
this._renderHandles()
},
_renderActions: function() {
this._resizeStartAction = this._createActionByOption("onResizeStart");
this._resizeEndAction = this._createActionByOption("onResizeEnd");
this._resizeAction = this._createActionByOption("onResize")
},
_renderHandles: function() {
var handles = this.option("handles");
if ("none" === handles) {
return
}
var directions = "all" === handles ? ["top", "bottom", "left", "right"] : handles.split(" ");
$.each(directions, $.proxy(function(index, handleName) {
this._renderHandle(handleName)
}, this));
$.inArray("bottom", directions) + 1 && $.inArray("right", directions) + 1 && this._renderHandle("corner-bottom-right");
$.inArray("bottom", directions) + 1 && $.inArray("left", directions) + 1 && this._renderHandle("corner-bottom-left");
$.inArray("top", directions) + 1 && $.inArray("right", directions) + 1 && this._renderHandle("corner-top-right");
$.inArray("top", directions) + 1 && $.inArray("left", directions) + 1 && this._renderHandle("corner-top-left")
},
_renderHandle: function(handleName) {
var $element = this.element(),
$handle = $("
");
$handle.addClass(RESIZABLE_HANDLE_CLASS).addClass(RESIZABLE_HANDLE_CLASS + "-" + handleName).appendTo($element);
this._attachEventHandlers($handle)
},
_attachEventHandlers: function($handle) {
if (this.option("disabled")) {
return
}
var handlers = {};
handlers[DRAGSTART_START_EVENT_NAME] = $.proxy(this._dragStartHandler, this);
handlers[DRAGSTART_EVENT_NAME] = $.proxy(this._dragHandler, this);
handlers[DRAGSTART_END_EVENT_NAME] = $.proxy(this._dragEndHandler, this);
$handle.on(handlers, {
direction: "both",
immediate: true
})
},
_dragStartHandler: function(e) {
var $element = this.element();
if ($element.is(".dx-state-disabled, .dx-state-disabled *")) {
e.cancel = true;
return
}
this._toggleResizingClass(true);
this._movingSides = this._getMovingSides(e);
this._elementLocation = translator.locate($element);
this._elementSize = {
width: $element.outerWidth(),
height: $element.outerHeight()
};
this._renderDragOffsets(e);
this._resizeStartAction({
jQueryEvent: e,
width: this._elementSize.width,
height: this._elementSize.height,
handles: this._movingSides
});
e.targetElements = null
},
_toggleResizingClass: function(value) {
this.element().toggleClass(RESIZABLE_RESIZING_CLASS, value)
},
_renderDragOffsets: function(e) {
var area = this._getArea();
if (!area) {
return
}
var $handle = $(e.target).closest("." + RESIZABLE_HANDLE_CLASS),
handleWidth = $handle.outerWidth(),
handleHeight = $handle.outerHeight(),
handleOffset = $handle.offset(),
areaOffset = area.offset;
e.maxLeftOffset = handleOffset.left - areaOffset.left;
e.maxRightOffset = areaOffset.left + area.width - handleOffset.left - handleWidth;
e.maxTopOffset = handleOffset.top - areaOffset.top;
e.maxBottomOffset = areaOffset.top + area.height - handleOffset.top - handleHeight
},
_getBorderWidth: function($element, direction) {
var borderWidth = $element.css("border-" + direction + "-width");
return parseInt(borderWidth) || 0
},
_dragHandler: function(e) {
var $element = this.element(),
sides = this._movingSides;
var location = this._elementLocation,
size = this._elementSize,
offset = this._getOffset(e);
var width = size.width + offset.x * (sides.left ? -1 : 1),
height = size.height + offset.y * (sides.top ? -1 : 1);
if (offset.x || "strict" === this.option("stepPrecision")) {
this._renderWidth(width)
}
if (offset.y || "strict" === this.option("stepPrecision")) {
this._renderHeight(height)
}
var offsetTop = offset.y - ((this.element().outerHeight() || height) - height),
offsetLeft = offset.x - ((this.element().outerWidth() || width) - width);
translator.move($element, {
top: location.top + (sides.top ? offsetTop : 0),
left: location.left + (sides.left ? offsetLeft : 0)
});
this._resizeAction({
jQueryEvent: e,
width: width,
height: height,
handles: this._movingSides
})
},
_getOffset: function(e) {
var offset = e.offset,
steps = stringUtils.pairToObject(this.option("step")),
sides = this._getMovingSides(e),
strictPrecision = "strict" === this.option("stepPrecision");
if (!sides.left && !sides.right) {
offset.x = 0
}
if (!sides.top && !sides.bottom) {
offset.y = 0
}
return strictPrecision ? this._getStrictOffset(offset, steps, sides) : this._getSimpleOffset(offset, steps)
},
_getSimpleOffset: function(offset, steps) {
return {
x: offset.x - offset.x % steps.h,
y: offset.y - offset.y % steps.v
}
},
_getStrictOffset: function(offset, steps, sides) {
var location = this._elementLocation,
size = this._elementSize,
xPos = sides.left ? location.left : location.left + size.width,
yPos = sides.top ? location.top : location.top + size.height,
newXShift = (xPos + offset.x) % steps.h,
newYShift = (yPos + offset.y) % steps.v,
sign = Math.sign || function(x) {
x = +x;
if (0 === x || isNaN(x)) {
return x
}
return x > 0 ? 1 : -1
},
separatorOffset = function(steps, offset) {
return (1 + .2 * sign(offset)) % 1 * steps
},
isSmallOffset = function(offset, steps) {
return Math.abs(offset) < .2 * steps
};
var newOffsetX = offset.x - newXShift,
newOffsetY = offset.y - newYShift;
if (newXShift > separatorOffset(steps.h, offset.x)) {
newOffsetX += steps.h
}
if (newYShift > separatorOffset(steps.v, offset.y)) {
newOffsetY += steps.v
}
return {
x: (sides.left || sides.right) && !isSmallOffset(offset.x, steps.h) ? newOffsetX : 0,
y: (sides.top || sides.bottom) && !isSmallOffset(offset.y, steps.v) ? newOffsetY : 0
}
},
_getMovingSides: function(e) {
var $target = $(e.target),
hasCornerTopLeftClass = $target.hasClass(RESIZABLE_HANDLE_CORNER_CLASS + "-top-left"),
hasCornerTopRightClass = $target.hasClass(RESIZABLE_HANDLE_CORNER_CLASS + "-top-right"),
hasCornerBottomLeftClass = $target.hasClass(RESIZABLE_HANDLE_CORNER_CLASS + "-bottom-left"),
hasCornerBottomRightClass = $target.hasClass(RESIZABLE_HANDLE_CORNER_CLASS + "-bottom-right");
return {
top: $target.hasClass(RESIZABLE_HANDLE_TOP_CLASS) || hasCornerTopLeftClass || hasCornerTopRightClass,
left: $target.hasClass(RESIZABLE_HANDLE_LEFT_CLASS) || hasCornerTopLeftClass || hasCornerBottomLeftClass,
bottom: $target.hasClass(RESIZABLE_HANDLE_BOTTOM_CLASS) || hasCornerBottomLeftClass || hasCornerBottomRightClass,
right: $target.hasClass(RESIZABLE_HANDLE_RIGHT_CLASS) || hasCornerTopRightClass || hasCornerBottomRightClass
}
},
_getArea: function() {
var area = this.option("area");
if ($.isFunction(area)) {
area = area.call(this)
}
if ($.isPlainObject(area)) {
return this._getAreaFromObject(area)
}
return this._getAreaFromElement(area)
},
_getAreaFromObject: function(area) {
var result = {
width: area.right - area.left,
height: area.bottom - area.top,
offset: {
left: area.left,
top: area.top
}
};
this._correctAreaGeometry(result);
return result
},
_getAreaFromElement: function(area) {
var result, $area = $(area);
if ($area.length) {
result = {};
result.width = $area.innerWidth();
result.height = $area.innerHeight();
result.offset = $area.offset();
this._correctAreaGeometry(result, $area)
}
return result
},
_correctAreaGeometry: function(result, $area) {
var areaBorderLeft = $area ? this._getBorderWidth($area, "left") : 0,
areaBorderTop = $area ? this._getBorderWidth($area, "top") : 0;
result.offset.left += areaBorderLeft + this._getBorderWidth(this.element(), "left");
result.offset.top += areaBorderTop + this._getBorderWidth(this.element(), "top");
result.width -= this.element().outerWidth() - this.element().innerWidth();
result.height -= this.element().outerHeight() - this.element().innerHeight()
},
_dragEndHandler: function(e) {
var $element = this.element();
this._resizeEndAction({
jQueryEvent: e,
width: $element.outerWidth(),
height: $element.outerHeight(),
handles: this._movingSides
});
this._toggleResizingClass(false)
},
_renderWidth: function(width) {
this.option("width", fitIntoRange(width, this.option("minWidth"), this.option("maxWidth")))
},
_renderHeight: function(height) {
this.option("height", fitIntoRange(height, this.option("minHeight"), this.option("maxHeight")))
},
_optionChanged: function(args) {
switch (args.name) {
case "disabled":
case "handles":
this._invalidate();
break;
case "minWidth":
case "maxWidth":
this._renderWidth(this.element().outerWidth());
break;
case "minHeight":
case "maxHeight":
this._renderHeight(this.element().outerHeight());
break;
case "onResize":
case "onResizeStart":
case "onResizeEnd":
this._renderActions();
break;
case "area":
case "step":
case "stepPrecision":
break;
default:
this.callBase(args)
}
},
_clean: function() {
this.element().find("." + RESIZABLE_HANDLE_CLASS).remove()
}
});
registerComponent(RESIZABLE, Resizable);
module.exports = Resizable
},
/*!**************************************!*\
!*** ./Scripts/core/utils/locker.js ***!
\**************************************/
function(module, exports, __webpack_require__) {
var errors = __webpack_require__( /*! ../errors */ 17);
var Locker = function() {
var info = {};
var currentCount = function(lockName) {
return info[lockName] || 0
};
return {
obtain: function(lockName) {
info[lockName] = currentCount(lockName) + 1
},
release: function(lockName) {
var count = currentCount(lockName);
if (count < 1) {
throw errors.Error("E0014")
}
if (1 === count) {
delete info[lockName]
} else {
info[lockName] = count - 1
}
},
locked: function(lockName) {
return currentCount(lockName) > 0
}
}
};
module.exports = Locker
},
/*!***********************************************************!*\
!*** ./Scripts/integration/knockout/event_registrator.js ***!
\***********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
ko = __webpack_require__( /*! knockout */ 87),
eventRegistrator = __webpack_require__( /*! ../../events/core/event_registrator */ 66),
eventUtils = __webpack_require__( /*! ../../events/utils */ 62);
eventRegistrator.callbacks.add(function(name, eventObject) {
var koBindingEventName = eventUtils.addNamespace(name, name + "Binding");
ko.bindingHandlers[name] = {
update: function(element, valueAccessor, allBindingsAccessor, viewModel) {
var $element = $(element),
unwrappedValue = ko.utils.unwrapObservable(valueAccessor()),
eventSource = unwrappedValue.execute ? unwrappedValue.execute : unwrappedValue;
$element.off(koBindingEventName).on(koBindingEventName, $.isPlainObject(unwrappedValue) ? unwrappedValue : {}, function(e) {
eventSource.call(viewModel, viewModel, e)
})
}
}
})
},
/*!****************************************************!*\
!*** ./Scripts/integration/knockout/components.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
errors = __webpack_require__( /*! ../../core/errors */ 17),
Action = __webpack_require__( /*! ../../core/action */ 35),
compileGetter = __webpack_require__( /*! ../../core/utils/data */ 36).compileGetter,
ko = __webpack_require__( /*! knockout */ 87),
iconUtils = __webpack_require__( /*! ../../core/utils/icon */ 99),
inflector = __webpack_require__( /*! ../../core/utils/inflector */ 49),
clickEvent = __webpack_require__( /*! ../../events/click */ 64),
dateUtils = __webpack_require__( /*! ../../core/utils/date */ 52),
dateLocalization = __webpack_require__( /*! ../../localization/date */ 56);
ko.bindingHandlers.dxAction = {
update: function(element, valueAccessor, allBindingsAccessor, viewModel) {
var $element = $(element);
var unwrappedValue = ko.utils.unwrapObservable(valueAccessor()),
actionSource = unwrappedValue,
actionOptions = {
context: element
};
if (unwrappedValue.execute) {
actionSource = unwrappedValue.execute;
$.extend(actionOptions, unwrappedValue)
}
var action = new Action(actionSource, actionOptions);
$element.off(".dxActionBinding").on(clickEvent.name + ".dxActionBinding", function(e) {
action.execute({
element: $element,
model: viewModel,
evaluate: function(expression) {
var context = viewModel;
if (expression.length > 0 && "$" === expression[0]) {
context = ko.contextFor(element)
}
var getter = compileGetter(expression);
return getter(context)
},
jQueryEvent: e
});
if (!actionOptions.bubbling) {
e.stopPropagation()
}
})
}
};
ko.bindingHandlers.dxControlsDescendantBindings = {
init: function(_, valueAccessor) {
return {
controlsDescendantBindings: ko.unwrap(valueAccessor())
}
}
};
ko.bindingHandlers.dxPolymorphWidget = {
init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
var widgetName = ko.utils.unwrapObservable(valueAccessor()).name;
if (!widgetName) {
return
}
ko.virtualElements.emptyNode(element);
if ("button" === widgetName || "tabs" === widgetName || "dropDownMenu" === widgetName) {
var depricatedName = widgetName;
widgetName = inflector.camelize("dx-" + widgetName);
errors.log("W0001", "dxToolbar - 'widget' item field", depricatedName, "16.1", "Use: '" + widgetName + "' instead")
}
var markup = $('
').get(0);
ko.virtualElements.prepend(element, markup);
var innerBindingContext = bindingContext.extend(valueAccessor);
ko.applyBindingsToDescendants(innerBindingContext, element);
return {
controlsDescendantBindings: true
}
}
};
ko.virtualElements.allowedBindings.dxPolymorphWidget = true;
ko.bindingHandlers.dxIcon = {
init: function(element, valueAccessor) {
var options = ko.utils.unwrapObservable(valueAccessor()) || {},
iconElement = iconUtils.getImageContainer(options);
ko.virtualElements.emptyNode(element);
if (iconElement) {
ko.virtualElements.prepend(element, iconElement.get(0))
}
},
update: function(element, valueAccessor) {
var options = ko.utils.unwrapObservable(valueAccessor()) || {},
iconElement = iconUtils.getImageContainer(options);
ko.virtualElements.emptyNode(element);
if (iconElement) {
ko.virtualElements.prepend(element, iconElement.get(0))
}
}
};
ko.virtualElements.allowedBindings.dxIcon = true;
ko.bindingHandlers.dxShorttimeDate = {
update: function(element, valueAccessor, allBindingsAccessor) {
return ko.bindingHandlers.text.update(element, function() {
var value = ko.utils.unwrapObservable(valueAccessor());
return dateUtils.serializeDate(dateUtils.makeDate(value), "shorttime", $.proxy(dateLocalization.format, dateLocalization))
}, allBindingsAccessor, null, null)
}
}
},
/*!****************************************************!*\
!*** ./Scripts/integration/knockout/validation.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
EventsMixin = __webpack_require__( /*! ../../core/events_mixin */ 39),
ValidationEngine = __webpack_require__( /*! ../../ui/validation_engine */ 117),
ko = __webpack_require__( /*! knockout */ 87);
var koDxValidator = Class.inherit({
ctor: function(target, option) {
var that = this;
that.target = target;
that.validationRules = option.validationRules;
that.name = option.name;
that.isValid = ko.observable(true);
that.validationError = ko.observable();
$.each(this.validationRules, function(_, rule) {
rule.validator = that
})
},
validate: function() {
var result = ValidationEngine.validate(this.target(), this.validationRules, this.name);
this._applyValidationResult(result);
return result
},
reset: function() {
this.target(null);
var result = {
isValid: true,
brokenRule: null
};
this._applyValidationResult(result);
return result
},
_applyValidationResult: function(result) {
result.validator = this;
this.target.dxValidator.isValid(result.isValid);
this.target.dxValidator.validationError(result.brokenRule);
this.fireEvent("validated", [result])
}
}).include(EventsMixin);
ko.extenders.dxValidator = function(target, option) {
target.dxValidator = new koDxValidator(target, option);
target.subscribe($.proxy(target.dxValidator.validate, target.dxValidator));
return target
};
ValidationEngine.registerModelForValidation = function(model) {
$.each(model, function(name, member) {
if (ko.isObservable(member) && member.dxValidator) {
ValidationEngine.registerValidatorInGroup(model, member.dxValidator)
}
})
};
ValidationEngine.unregisterModelForValidation = function(model) {
$.each(model, function(name, member) {
if (ko.isObservable(member) && member.dxValidator) {
ValidationEngine.removeRegisteredValidator(model, member.dxValidator)
}
})
};
ValidationEngine.validateModel = ValidationEngine.validateGroup
},
/*!*****************************************!*\
!*** ./Scripts/ui/validation_engine.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../core/class */ 20),
EventsMixin = __webpack_require__( /*! ../core/events_mixin */ 39),
errors = __webpack_require__( /*! ../core/errors */ 17),
commonUtils = __webpack_require__( /*! ../core/utils/common */ 14),
numberLocalization = __webpack_require__( /*! ../localization/number */ 22),
messageLocalization = __webpack_require__( /*! ../localization/message */ 80);
var rulesValidators = {
required: {
validate: function(value, rule) {
if (!commonUtils.isDefined(value)) {
return false
}
if (false === value) {
return false
}
value = String(value);
if (rule.trim || !commonUtils.isDefined(rule.trim)) {
value = $.trim(value)
}
return "" !== value
},
defaultMessage: function(value) {
return messageLocalization.getFormatter("validation-required")(value)
},
defaultFormattedMessage: function(value) {
return messageLocalization.getFormatter("validation-required-formatted")(value)
}
},
numeric: {
validate: function(value, rule) {
if (!rulesValidators.required.validate(value, {})) {
return true
}
if (rule.useCultureSettings && commonUtils.isString(value)) {
return !isNaN(numberLocalization.parse(value))
} else {
return $.isNumeric(value)
}
},
defaultMessage: function(value) {
return messageLocalization.getFormatter("validation-numeric")(value)
},
defaultFormattedMessage: function(value) {
return messageLocalization.getFormatter("validation-numeric-formatted")(value)
}
},
range: {
validate: function(value, rule) {
if (!rulesValidators.required.validate(value, {})) {
return true
}
var validNumber = rulesValidators.numeric.validate(value, rule),
validValue = commonUtils.isDefined(value),
number = validNumber ? parseFloat(value) : validValue && value.valueOf(),
min = rule.min,
max = rule.max;
if (!(validNumber || commonUtils.isDate(value)) && !validValue) {
return false
}
if (commonUtils.isDefined(min)) {
if (commonUtils.isDefined(max)) {
return number >= min && number <= max
}
return number >= min
} else {
if (commonUtils.isDefined(max)) {
return number <= max
} else {
throw errors.Error("E0101")
}
}
},
defaultMessage: function(value) {
return messageLocalization.getFormatter("validation-range")(value)
},
defaultFormattedMessage: function(value) {
return messageLocalization.getFormatter("validation-range-formatted")(value)
}
},
stringLength: {
validate: function(value, rule) {
value = commonUtils.isDefined(value) ? String(value) : "";
if (rule.trim || !commonUtils.isDefined(rule.trim)) {
value = $.trim(value)
}
return rulesValidators.range.validate(value.length, $.extend({}, rule))
},
defaultMessage: function(value) {
return messageLocalization.getFormatter("validation-stringLength")(value)
},
defaultFormattedMessage: function(value) {
return messageLocalization.getFormatter("validation-stringLength-formatted")(value)
}
},
custom: {
validate: function(value, rule) {
return rule.validationCallback({
value: value,
validator: rule.validator,
rule: rule
})
},
defaultMessage: function(value) {
return messageLocalization.getFormatter("validation-custom")(value)
},
defaultFormattedMessage: function(value) {
return messageLocalization.getFormatter("validation-custom-formatted")(value)
}
},
compare: {
validate: function(value, rule) {
if (!rule.comparisonTarget) {
throw errors.Error("E0102")
}
$.extend(rule, {
reevaluate: true
});
var otherValue = rule.comparisonTarget(),
type = rule.comparisonType || "==";
switch (type) {
case "==":
return value == otherValue;
case "!=":
return value != otherValue;
case "===":
return value === otherValue;
case "!==":
return value !== otherValue;
case ">":
return value > otherValue;
case ">=":
return value >= otherValue;
case "<":
return value < otherValue;
case "<=":
return value <= otherValue
}
},
defaultMessage: function(value) {
return messageLocalization.getFormatter("validation-compare")(value)
},
defaultFormattedMessage: function(value) {
return messageLocalization.getFormatter("validation-compare-formatted")(value)
}
},
pattern: {
validate: function(value, rule) {
if (!rulesValidators.required.validate(value, {})) {
return true
}
var pattern = rule.pattern;
if (commonUtils.isString(pattern)) {
pattern = new RegExp(pattern)
}
return pattern.test(value)
},
defaultMessage: function(value) {
return messageLocalization.getFormatter("validation-pattern")(value)
},
defaultFormattedMessage: function(value) {
return messageLocalization.getFormatter("validation-pattern-formatted")(value)
}
},
email: {
validate: function(value, rule) {
if (!rulesValidators.required.validate(value, {})) {
return true
}
return rulesValidators.pattern.validate(value, $.extend({}, rule, {
pattern: /^[\d\w\._\-]+@([\d\w\._\-]+\.)+[\w]+$/i
}))
},
defaultMessage: function(value) {
return messageLocalization.getFormatter("validation-email")(value)
},
defaultFormattedMessage: function(value) {
return messageLocalization.getFormatter("validation-email-formatted")(value)
}
}
};
var GroupConfig = Class.inherit({
ctor: function(group) {
this.group = group;
this.validators = []
},
validate: function() {
var result = {
isValid: true,
brokenRules: [],
validators: []
};
$.each(this.validators, function(_, validator) {
var validatorResult = validator.validate();
result.isValid = result.isValid && validatorResult.isValid;
if (validatorResult.brokenRule) {
result.brokenRules.push(validatorResult.brokenRule)
}
result.validators.push(validator)
});
this.fireEvent("validated", [{
validators: result.validators,
brokenRules: result.brokenRules,
isValid: result.isValid
}]);
return result
},
reset: function() {
$.each(this.validators, function(_, validator) {
validator.reset()
})
}
}).include(EventsMixin);
var ValidationEngine = {
groups: [],
getGroupConfig: function(group) {
var result = $.grep(this.groups, function(config) {
return config.group === group
});
if (result.length) {
return result[0]
}
},
initGroups: function() {
this.groups = [];
this.addGroup()
},
addGroup: function(group) {
var config = this.getGroupConfig(group);
if (!config) {
config = new GroupConfig(group);
this.groups.push(config)
}
return config
},
removeGroup: function(group) {
var config = this.getGroupConfig(group),
index = $.inArray(config, this.groups);
if (index > -1) {
this.groups.splice(index, 1)
}
return config
},
_setDefaultMessage: function(rule, validator, name) {
if (!commonUtils.isDefined(rule.message)) {
if (validator.defaultFormattedMessage && commonUtils.isDefined(name)) {
rule.message = validator.defaultFormattedMessage(name)
} else {
rule.message = validator.defaultMessage()
}
}
},
validate: function(value, rules, name) {
var result = {
name: name,
value: value,
brokenRule: null,
isValid: true,
validationRules: rules
},
that = this;
$.each(rules || [], function(_, rule) {
var ruleValidationResult, ruleValidator = rulesValidators[rule.type];
if (ruleValidator) {
if (commonUtils.isDefined(rule.isValid) && rule.value === value && !rule.reevaluate) {
if (!rule.isValid) {
result.isValid = false;
result.brokenRule = rule;
return false
}
return true
}
rule.value = value;
ruleValidationResult = ruleValidator.validate(value, rule);
rule.isValid = ruleValidationResult;
if (!ruleValidationResult) {
result.isValid = false;
that._setDefaultMessage(rule, ruleValidator, name);
result.brokenRule = rule
}
if (!rule.isValid) {
return false
}
} else {
throw errors.Error("E0100")
}
});
return result
},
registerValidatorInGroup: function(group, validator) {
var groupConfig = ValidationEngine.addGroup(group);
if ($.inArray(validator, groupConfig.validators) < 0) {
groupConfig.validators.push(validator)
}
},
removeRegisteredValidator: function(group, validator) {
var config = ValidationEngine.getGroupConfig(group),
validatorsInGroup = config && config.validators;
var index = $.inArray(validator, validatorsInGroup);
if (index > -1) {
validatorsInGroup.splice(index, 1)
}
},
validateGroup: function(group) {
var groupConfig = ValidationEngine.getGroupConfig(group);
if (!groupConfig) {
throw errors.Error("E0110")
}
return groupConfig.validate()
},
resetGroup: function(group) {
var groupConfig = ValidationEngine.getGroupConfig(group);
if (!groupConfig) {
throw errors.Error("E0110")
}
return groupConfig.reset()
}
};
ValidationEngine.initGroups();
module.exports = ValidationEngine
},
/*!****************************************************************!*\
!*** ./Scripts/integration/knockout/variable_wrapper_utils.js ***!
\****************************************************************/
function(module, exports, __webpack_require__) {
var ko = __webpack_require__( /*! knockout */ 87),
variableWrapper = __webpack_require__( /*! ../../core/utils/variable_wrapper */ 38);
variableWrapper.inject({
isWrapped: ko.isObservable,
isWritableWrapped: ko.isWritableObservable,
wrap: ko.observable,
unwrap: function(value) {
if (ko.isObservable(value)) {
return ko.utils.unwrapObservable(value)
}
return this.callBase(value)
},
assign: function(variable, value) {
if (ko.isObservable(variable)) {
variable(value)
} else {
this.callBase(variable, value)
}
}
})
},
/*!****************************************************!*\
!*** ./Scripts/integration/knockout/clean_node.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
ko = __webpack_require__( /*! knockout */ 87),
cleanData = $.cleanData,
compareVersion = __webpack_require__( /*! ../../core/utils/version */ 45).compare;
if (compareVersion($.fn.jquery, [2, 0]) >= 0) {
$.cleanData = function(nodes) {
var result = cleanData(nodes);
for (var i = 0; i < nodes.length; i++) {
nodes[i].cleanedByJquery = true
}
for (i = 0; i < nodes.length; i++) {
if (!nodes[i].cleanedByKo) {
ko.cleanNode(nodes[i])
}
delete nodes[i].cleanedByKo
}
for (i = 0; i < nodes.length; i++) {
delete nodes[i].cleanedByJquery
}
return result
};
ko.utils.domNodeDisposal.cleanExternalData = function(node) {
node.cleanedByKo = true;
if (!node.cleanedByJquery) {
$.cleanData([node])
}
}
}
},
/*!********************************************************!*\
!*** ./Scripts/integration/knockout/clean_node_old.js ***!
\********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
ko = __webpack_require__( /*! knockout */ 87),
compareVersion = __webpack_require__( /*! ../../core/utils/version */ 45).compare;
if (compareVersion($.fn.jquery, [2, 0]) < 0) {
var cleanKoData = function(element, andSelf) {
var cleanNode = function() {
ko.cleanNode(this)
};
if (andSelf) {
element.each(cleanNode)
} else {
element.find("*").each(cleanNode)
}
};
var originalEmpty = $.fn.empty;
$.fn.empty = function() {
cleanKoData(this, false);
return originalEmpty.apply(this, arguments)
};
var originalRemove = $.fn.remove;
$.fn.remove = function(selector, keepData) {
if (!keepData) {
var subject = this;
if (selector) {
subject = subject.filter(selector)
}
cleanKoData(subject, true)
}
return originalRemove.call(this, selector, keepData)
};
var originalHtml = $.fn.html;
$.fn.html = function(value) {
if ("string" === typeof value) {
cleanKoData(this, false)
}
return originalHtml.apply(this, arguments)
};
var originalReplaceWith = $.fn.replaceWith;
$.fn.replaceWith = function(value) {
var result = originalReplaceWith.apply(this, arguments);
if (!this.parent().length) {
cleanKoData(this, true)
}
return result
}
}
},
/*!**************************************!*\
!*** ./Scripts/framework/command.js ***!
\**************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
errors = __webpack_require__( /*! ./errors */ 122),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 43),
DOMComponent = __webpack_require__( /*! ../core/dom_component */ 29);
__webpack_require__( /*! ../integration/knockout */ 86);
var Command = DOMComponent.inherit({
ctor: function(element, options) {
if ($.isPlainObject(element)) {
options = element;
element = $("
")
}
this.callBase(element, options)
},
_setDeprecatedOptions: function() {
this.callBase();
$.extend(this._deprecatedOptions, {
iconSrc: {
since: "15.1",
alias: "icon"
}
})
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
onExecute: null,
id: null,
title: "",
icon: "",
visible: true,
disabled: false,
renderStage: "onViewShown"
})
},
execute: function() {
var isDisabled = this._options.disabled;
if ($.isFunction(isDisabled)) {
isDisabled = !!isDisabled.apply(this, arguments)
}
if (isDisabled) {
throw errors.Error("E3004", this._options.id)
}
this.fireEvent("beforeExecute", arguments);
this._createActionByOption("onExecute").apply(this, arguments);
this.fireEvent("afterExecute", arguments)
},
_render: function() {
this.callBase();
this.element().addClass("dx-command")
},
_renderDisabledState: $.noop,
_dispose: function() {
this.callBase();
this.element().removeData(this.NAME)
}
});
registerComponent("dxCommand", Command);
module.exports = Command
},
/*!*************************************!*\
!*** ./Scripts/framework/errors.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var errorUtils = __webpack_require__( /*! ../core/utils/error */ 11),
errors = __webpack_require__( /*! ../core/errors */ 17);
module.exports = errorUtils(errors.ERROR_MESSAGES, {
E3001: "Routing rule is not found for the '{0}' URI.",
E3002: "The passed object cannot be formatted into a URI string by the application's router. An appropriate route should be registered.",
E3003: "Unable to navigate. Application is being initialized.",
E3004: "Cannot execute the command: {0}.",
E3005: "The '{0}' command {1} is not registered in the application's command mapping. Go to http://dxpr.es/1bTjfj1 for more details.",
E3006: "Unknown navigation target: '{0}'. Use the 'current', 'back' or 'blank' values.",
E3007: "Error while restoring the application state. The state has been cleared. Refresh the page.",
E3008: "Unable to go back.",
E3009: "Unable to go forward.",
E3010: "The command's 'id' option should be specified.\r\nProcessed markup: {0}\n",
E3011: "Layout controller cannot be resolved. There are no appropriate layout controllers for the current context. Check browser console for details.",
E3012: "Layout controller cannot be resolved. Two or more layout controllers suit the current context. Check browser console for details.",
E3013: "The '{0}' template with the '{1}' name is not found. Make sure the case is correct in the specified view name and the template fits the current context.",
E3014: "All the children of the dxView element should be either of the dxCommand or dxContent type.\r\nProcessed markup: {0}",
E3015: "The 'exec' method should be called before the 'finalize' method.",
E3016: "Unknown transition type '{0}'.",
E3018: "Unable to parse options.\nMessage: {0};\nOptions value: {1}.",
E3019: "View templates should be updated according to the 13.1 changes. Go to http://dxpr.es/15ikrJA for more details.",
E3020: "Concurrent templates are found:\r\n{0}Target device:\r\n{1}.",
E3021: "Remote template cannot be loaded.\r\nUrl:{0}\r\nError:{1}.",
E3022: "Cannot initialize the HtmlApplication component.",
E3023: "Navigation item is not found",
E3024: "Layout controller is not initialized",
W3001: "A view with the '{0}' key doesn't exist.",
W3002: "A view with the '{0}' key has already been released.",
W3003: "Layout resolving context:\n{0}\nAvailable layout controller registrations:\n{1}\n",
W3004: "Layout resolving context:\n{0}\nConcurent layout controller registrations for the context:\n{1}\n",
W3005: 'Direct hash-based navigation is detected in a mobile application. Use data-bind="dxAction: url" instead of href="#url" to avoid navigation issues.\nFound markup:\n{0}\n'
})
},
/*!*************************************!*\
!*** ./Scripts/framework/router.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../core/class */ 20);
var JSON_URI_PREFIX = encodeURIComponent("json:");
var Route = Class.inherit({
_trimSeparators: function(str) {
return str.replace(/^[\/.]+|\/+$/g, "")
},
_escapeRe: function(str) {
return str.replace(/\W/g, "\\$1")
},
_checkConstraint: function(param, constraint) {
param = String(param);
if ("string" === typeof constraint) {
constraint = new RegExp(constraint)
}
var match = constraint.exec(param);
if (!match || match[0] !== param) {
return false
}
return true
},
_ensureReady: function() {
var that = this;
if (this._patternRe) {
return false
}
this._pattern = this._trimSeparators(this._pattern);
this._patternRe = "";
this._params = [];
this._segments = [];
this._separators = [];
this._pattern.replace(/[^\/]+/g, function(segment, index) {
that._segments.push(segment);
if (index) {
that._separators.push(that._pattern.substr(index - 1, 1))
}
});
$.each(this._segments, function(index) {
var isStatic = true,
segment = this,
separator = index ? that._separators[index - 1] : "";
if (":" === segment.charAt(0)) {
isStatic = false;
segment = segment.substr(1);
that._params.push(segment);
that._patternRe += "(?:" + separator + "([^/]*))";
if (segment in that._defaults) {
that._patternRe += "?"
}
} else {
that._patternRe += separator + that._escapeRe(segment)
}
});
this._patternRe = new RegExp("^" + this._patternRe + "$")
},
ctor: function(pattern, defaults, constraints) {
this._pattern = pattern || "";
this._defaults = defaults || {};
this._constraints = constraints || {}
},
parse: function(uri) {
var that = this;
this._ensureReady();
var matches = this._patternRe.exec(uri);
if (!matches) {
return false
}
var result = $.extend({}, this._defaults);
$.each(this._params, function(i) {
var index = i + 1;
if (matches.length >= index && matches[index]) {
result[this] = that.parseSegment(matches[index])
}
});
$.each(this._constraints, function(key) {
if (!that._checkConstraint(result[key], that._constraints[key])) {
result = false;
return false
}
});
return result
},
format: function(routeValues) {
var that = this,
query = "";
this._ensureReady();
var mergeValues = $.extend({}, this._defaults),
useStatic = 0,
ret = [],
dels = [],
unusedRouteValues = {};
$.each(routeValues, function(paramName, paramValue) {
routeValues[paramName] = that.formatSegment(paramValue);
if (!(paramName in mergeValues)) {
unusedRouteValues[paramName] = true
}
});
$.each(this._segments, function(index, segment) {
ret[index] = index ? that._separators[index - 1] : "";
if (":" === segment.charAt(0)) {
var paramName = segment.substr(1);
if (!(paramName in routeValues) && !(paramName in that._defaults)) {
ret = null;
return false
}
if (paramName in that._constraints && !that._checkConstraint(routeValues[paramName], that._constraints[paramName])) {
ret = null;
return false
}
if (paramName in routeValues) {
if (void 0 !== routeValues[paramName]) {
mergeValues[paramName] = routeValues[paramName];
ret[index] += routeValues[paramName];
useStatic = index
}
delete unusedRouteValues[paramName]
} else {
if (paramName in mergeValues) {
ret[index] += mergeValues[paramName];
dels.push(index)
}
}
} else {
ret[index] += segment;
useStatic = index
}
});
$.each(mergeValues, function(key, value) {
if (!!value && $.inArray(":" + key, that._segments) === -1 && routeValues[key] !== value) {
ret = null;
return false
}
});
var unusedCount = 0;
if (!$.isEmptyObject(unusedRouteValues)) {
query = "?";
$.each(unusedRouteValues, function(key) {
query += key + "=" + routeValues[key] + "&";
unusedCount++
});
query = query.substr(0, query.length - 1)
}
if (null === ret) {
return false
}
if (dels.length) {
$.map(dels, function(i) {
if (i >= useStatic) {
ret[i] = ""
}
})
}
var path = ret.join("");
path = path.replace(/\/+$/, "");
return {
uri: path + query,
unusedCount: unusedCount
}
},
formatSegment: function(value) {
if ($.isArray(value) || $.isPlainObject(value)) {
return JSON_URI_PREFIX + encodeURIComponent(JSON.stringify(value))
}
return encodeURIComponent(value)
},
parseSegment: function(value) {
if (value.substr(0, JSON_URI_PREFIX.length) === JSON_URI_PREFIX) {
try {
return $.parseJSON(decodeURIComponent(value.substr(JSON_URI_PREFIX.length)))
} catch (x) {}
}
return decodeURIComponent(value)
}
});
var Router = Class.inherit({
ctor: function() {
this._registry = []
},
_trimSeparators: function(str) {
return str.replace(/^[\/.]+|\/+$/g, "")
},
_createRoute: function(pattern, defaults, constraints) {
return new Route(pattern, defaults, constraints)
},
register: function(pattern, defaults, constraints) {
this._registry.push(this._createRoute(pattern, defaults, constraints))
},
_parseQuery: function(query) {
var result = {},
values = query.split("&");
$.each(values, function(index, value) {
var keyValuePair = value.split("=");
result[keyValuePair[0]] = decodeURIComponent(keyValuePair[1])
});
return result
},
parse: function(uri) {
var ret, that = this;
uri = this._trimSeparators(uri);
var parts = uri.split("?", 2),
path = parts[0],
query = parts[1];
$.each(this._registry, function() {
var result = this.parse(path);
if (false !== result) {
ret = result;
if (query) {
ret = $.extend(ret, that._parseQuery(query))
}
return false
}
});
return ret ? ret : false
},
format: function(obj) {
var ret = false,
minUnusedCount = 99999;
obj = obj || {};
$.each(this._registry, function() {
var toFormat = $.extend(true, {}, obj);
var result = this.format(toFormat);
if (false !== result) {
if (minUnusedCount > result.unusedCount) {
minUnusedCount = result.unusedCount;
ret = result.uri
}
}
});
return ret
}
});
Route.__internals = {
JSON_URI_PREFIX: JSON_URI_PREFIX
};
module.exports = Router;
module.exports.Route = Route
},
/*!********************************************!*\
!*** ./Scripts/framework/state_manager.js ***!
\********************************************/
function(module, exports, __webpack_require__) {
var Class = __webpack_require__( /*! ../core/class */ 20),
$ = __webpack_require__( /*! jquery */ 9);
var MemoryKeyValueStorage = Class.inherit({
ctor: function() {
this.storage = {}
},
getItem: function(key) {
return this.storage[key]
},
setItem: function(key, value) {
this.storage[key] = value
},
removeItem: function(key) {
delete this.storage[key]
}
});
var StateManager = Class.inherit({
ctor: function(options) {
options = options || {};
this.storage = options.storage || new MemoryKeyValueStorage;
this.stateSources = options.stateSources || []
},
addStateSource: function(stateSource) {
this.stateSources.push(stateSource)
},
removeStateSource: function(stateSource) {
var index = $.inArray(stateSource, this.stateSources);
if (index > -1) {
this.stateSources.splice(index, 1);
stateSource.removeState(this.storage)
}
},
saveState: function() {
var that = this;
$.each(this.stateSources, function(index, stateSource) {
stateSource.saveState(that.storage)
})
},
restoreState: function() {
var that = this;
$.each(this.stateSources, function(index, stateSource) {
stateSource.restoreState(that.storage)
})
},
clearState: function() {
var that = this;
$.each(this.stateSources, function(index, stateSource) {
stateSource.removeState(that.storage)
})
}
});
module.exports = StateManager;
module.exports.MemoryKeyValueStorage = MemoryKeyValueStorage
},
/*!*****************************************!*\
!*** ./Scripts/framework/view_cache.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../core/class */ 20),
EventsMixin = __webpack_require__( /*! ../core/events_mixin */ 39);
var ViewCache = Class.inherit({
ctor: function() {
this._cache = {}
},
setView: function(key, viewInfo) {
this._cache[key] = viewInfo
},
getView: function(key) {
return this._cache[key]
},
removeView: function(key) {
var result = this._cache[key];
if (result) {
delete this._cache[key];
this.fireEvent("viewRemoved", [{
viewInfo: result
}])
}
return result
},
clear: function() {
var that = this;
$.each(this._cache, function(key) {
that.removeView(key)
})
},
hasView: function(key) {
return key in this._cache
}
}).include(EventsMixin);
var NullViewCache = ViewCache.inherit({
setView: function(key, viewInfo) {
this.callBase(key, viewInfo);
this.removeView(key)
}
});
var ConditionalViewCacheDecorator = Class.inherit({
ctor: function(options) {
this._filter = options.filter;
this._viewCache = options.viewCache;
this.viewRemoved = this._viewCache.viewRemoved;
this._events = this._viewCache._events
},
setView: function(key, viewInfo) {
this._viewCache.setView(key, viewInfo);
if (!this._filter(key, viewInfo)) {
this._viewCache.removeView(key)
}
},
getView: function(key) {
return this._viewCache.getView(key)
},
removeView: function(key) {
return this._viewCache.removeView(key)
},
clear: function() {
return this._viewCache.clear()
},
hasView: function(key) {
return this._viewCache.hasView(key)
}
}).include(EventsMixin);
var DEFAULT_VIEW_CACHE_CAPACITY = 5;
var CapacityViewCacheDecorator = Class.inherit({
ctor: function(options) {
this._keys = [];
this._size = options.size || DEFAULT_VIEW_CACHE_CAPACITY;
this._viewCache = options.viewCache;
this.viewRemoved = this._viewCache.viewRemoved;
this._events = this._viewCache._events
},
setView: function(key, viewInfo) {
if (!this.hasView(key)) {
if (this._keys.length === this._size) {
this.removeView(this._keys[0])
}
this._keys.push(key)
}
this._viewCache.setView(key, viewInfo)
},
getView: function(key) {
var index = $.inArray(key, this._keys);
if (index < 0) {
return null
}
this._keys.push(key);
this._keys.splice(index, 1);
return this._viewCache.getView(key)
},
removeView: function(key) {
var index = $.inArray(key, this._keys);
if (index > -1) {
this._keys.splice(index, 1)
}
return this._viewCache.removeView(key)
},
clear: function() {
this._keys = [];
return this._viewCache.clear()
},
hasView: function(key) {
return this._viewCache.hasView(key)
}
}).include(EventsMixin);
var HistoryDependentViewCacheDecorator = Class.inherit({
ctor: function(options) {
this._viewCache = options.viewCache || new ViewCache;
this._navigationManager = options.navigationManager;
this._navigationManager.on("itemRemoved", $.proxy(this._onNavigationItemRemoved, this));
this.viewRemoved = this._viewCache.viewRemoved;
this._events = this._viewCache._events
},
_onNavigationItemRemoved: function(item) {
this.removeView(item.key)
},
setView: function(key, viewInfo) {
this._viewCache.setView(key, viewInfo)
},
getView: function(key) {
return this._viewCache.getView(key)
},
removeView: function(key) {
return this._viewCache.removeView(key)
},
clear: function() {
return this._viewCache.clear()
},
hasView: function(key) {
return this._viewCache.hasView(key)
}
}).include(EventsMixin);
module.exports = ViewCache;
module.exports.NullViewCache = NullViewCache;
module.exports.ConditionalViewCacheDecorator = ConditionalViewCacheDecorator;
module.exports.CapacityViewCacheDecorator = CapacityViewCacheDecorator;
module.exports.HistoryDependentViewCacheDecorator = HistoryDependentViewCacheDecorator
},
/*!*****************************************************!*\
!*** ./Scripts/framework/html/command_container.js ***!
\*****************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
MarkupComponent = __webpack_require__( /*! ./markup_component */ 127).MarkupComponent,
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 43);
__webpack_require__( /*! ../../integration/knockout */ 86);
var CommandContainer = MarkupComponent.inherit({
ctor: function(element, options) {
if ($.isPlainObject(element)) {
options = element;
element = $("
")
}
this.callBase(element, options)
},
_setDefaultOptions: function() {
this.callBase();
this.option({
id: null
})
},
_render: function() {
this.callBase();
this.element().addClass("dx-command-container")
}
});
registerComponent("dxCommandContainer", CommandContainer);
module.exports = CommandContainer
},
/*!****************************************************!*\
!*** ./Scripts/framework/html/markup_component.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
publicComponentUtils = __webpack_require__( /*! ../../core/utils/public_component */ 31);
var MarkupComponent = Class.inherit({
ctor: function(element, options) {
this.NAME = this.constructor.publicName();
options = options || {};
this._$element = $(element);
publicComponentUtils.attachInstanceToElement(this._$element, this.NAME, this, this._dispose);
if (options.fromCache) {
this._options = options
} else {
this._options = {};
this._setDefaultOptions();
if (options) {
this.option(options)
}
this._render()
}
},
_setDefaultOptions: $.noop,
_render: $.noop,
_dispose: $.noop,
element: function() {
return this._$element
},
option: function(name, value) {
if (0 === arguments.length) {
return this._options
} else {
if (1 === arguments.length) {
if ("string" === typeof name) {
return this._options[name]
} else {
value = name;
$.extend(this._options, value)
}
} else {
this._options[name] = value
}
}
},
instance: function() {
return this
}
});
MarkupComponent.publicName = publicComponentUtils.getName;
MarkupComponent.getInstance = function($element) {
return publicComponentUtils.getInstanceByElement($element, this.publicName())
};
exports.MarkupComponent = MarkupComponent
},
/*!**********************************************************!*\
!*** ./Scripts/framework/html/view_engine_components.js ***!
\**********************************************************/
function(module, exports, __webpack_require__) {
var errors = __webpack_require__( /*! ../errors */ 122),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 43),
MarkupComponent = __webpack_require__( /*! ./markup_component */ 127).MarkupComponent;
__webpack_require__( /*! ../../integration/knockout */ 86);
var View = MarkupComponent.inherit({
_setDefaultOptions: function() {
this.callBase();
this.option({
name: null,
title: null
})
},
ctor: function() {
this._id = domUtils.uniqueId();
this.callBase.apply(this, arguments)
},
_render: function() {
this.callBase();
this.element().addClass("dx-view");
this.element().attr("dx-data-template-id", this._id)
},
getId: function() {
return this._id
}
});
var Layout = MarkupComponent.inherit({
_setDefaultOptions: function() {
this.callBase();
this.option({
name: null
})
},
_render: function() {
this.callBase();
this.element().addClass("dx-layout")
}
});
var ViewPlaceholder = MarkupComponent.inherit({
_setDefaultOptions: function() {
this.callBase();
this.option({
viewName: null
})
},
_render: function() {
this.callBase();
this.element().addClass("dx-view-placeholder")
}
});
var setupTransitionElement = function($element, transitionType, transitionName, contentCssPosition) {
if ("absolute" === contentCssPosition) {
$element.addClass("dx-transition-absolute")
} else {
$element.addClass("dx-transition-static")
}
$element.addClass("dx-transition").addClass("dx-transition-" + transitionName).addClass("dx-transition-" + transitionType).attr("data-dx-transition-type", transitionType).attr("data-dx-transition-name", transitionName)
};
var setupTransitionInnerElement = function($element) {
$element.addClass("dx-transition-inner-wrapper")
};
var Transition = MarkupComponent.inherit({
_setDefaultOptions: function() {
this.callBase();
this.option({
name: null,
type: void 0,
animation: "slide"
})
},
_render: function() {
this.callBase();
var element = this.element();
setupTransitionElement(element, this.option("type") || this.option("animation"), this.option("name"), "absolute");
element.wrapInner("
");
setupTransitionInnerElement(element.children());
if (this.option("type")) {
errors.log("W0003", "dxTransition", "type", "15.1", "Use the 'animation' property instead")
}
},
_clean: function() {
this.callBase();
this.element().empty()
}
});
var ContentPlaceholder = MarkupComponent.inherit({
_setDefaultOptions: function() {
this.callBase();
this.option({
name: null,
transition: void 0,
animation: "none",
contentCssPosition: "absolute"
})
},
_render: function() {
this.callBase();
var $element = this.element();
$element.addClass("dx-content-placeholder").addClass("dx-content-placeholder-" + this.option("name"));
$element.attr("data-dx-content-placeholder-name", this.option("name"));
setupTransitionElement($element, this.option("transition") || this.option("animation"), this.option("name"), this.option("contentCssPosition"));
if (this.option("transition")) {
errors.log("W0003", "dxContentPlaceholder", "transition", "15.1", "Use the 'animation' property instead")
}
}
});
var Content = MarkupComponent.inherit({
_setDefaultOptions: function() {
this.callBase();
this.option({
targetPlaceholder: null
})
},
_optionChanged: function() {
this._refresh()
},
_clean: function() {
this.callBase();
this.element().removeClass(this._currentClass)
},
_render: function() {
this.callBase();
var element = this.element();
element.addClass("dx-content");
this._currentClass = "dx-content-" + this.option("targetPlaceholder");
element.attr("data-dx-target-placeholder-id", this.option("targetPlaceholder"));
element.addClass(this._currentClass);
setupTransitionInnerElement(element)
}
});
registerComponent("dxView", View);
registerComponent("dxLayout", Layout);
registerComponent("dxViewPlaceholder", ViewPlaceholder);
registerComponent("dxContentPlaceholder", ContentPlaceholder);
registerComponent("dxTransition", Transition);
registerComponent("dxContent", Content);
exports.dxView = View;
exports.dxLayout = Layout;
exports.dxViewPlaceholder = ViewPlaceholder;
exports.dxContentPlaceholder = ContentPlaceholder;
exports.dxTransition = Transition;
exports.dxContent = Content
},
/*!****************************************************!*\
!*** ./Scripts/framework/html/html_application.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
objectUtils = __webpack_require__( /*! ../../core/utils/object */ 37),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
Component = __webpack_require__( /*! ../../core/component */ 34),
errors = __webpack_require__( /*! ../errors */ 122),
Application = __webpack_require__( /*! ../application */ 130).Application,
ConditionalViewCacheDecorator = __webpack_require__( /*! ../view_cache */ 125).ConditionalViewCacheDecorator,
html = __webpack_require__( /*! ./presets */ 138),
CommandManager = __webpack_require__( /*! ./command_manager */ 139),
ViewEngine = __webpack_require__( /*! ./view_engine */ 141).ViewEngine,
messageLocalization = __webpack_require__( /*! ../../localization/message */ 80),
viewPort = __webpack_require__( /*! ../../core/utils/view_port */ 42).value,
initMobileViewportModule = __webpack_require__( /*! ../../mobile/init_mobile_viewport/init_mobile_viewport */ 47),
devices = __webpack_require__( /*! ../../core/devices */ 40),
feedbackEvents = __webpack_require__( /*! ../../events/core/emitter.feedback */ 103),
TransitionExecutorModule = __webpack_require__( /*! ../../animation/transition_executor/transition_executor */ 63),
animationPresetsModule = __webpack_require__( /*! ../../animation/presets/presets */ 58);
__webpack_require__( /*! ./layout_controller */ 142);
__webpack_require__( /*! ../../ui/themes */ 143);
var VIEW_PORT_CLASSNAME = "dx-viewport",
LAYOUT_CHANGE_ANIMATION_NAME = "layout-change";
var HtmlApplication = Application.inherit({
ctor: function(options) {
options = options || {};
this.callBase(options);
this._$root = $(options.rootNode || document.body);
this._initViewport(options.viewPort);
if ("mobileApp" === this._applicationMode) {
initMobileViewportModule.initMobileViewport(options.viewPort)
}
this.device = options.device || devices.current();
this.commandManager = options.commandManager || new CommandManager({
commandMapping: this.commandMapping
});
this._initTemplateContext();
this.viewEngine = options.viewEngine || new ViewEngine({
$root: this._$root,
device: this.device,
templateCacheStorage: options.templateCacheStorage || window.localStorage,
templatesVersion: options.templatesVersion,
templateContext: this._templateContext
});
this.components.push(this.viewEngine);
this._initMarkupFilters(this.viewEngine);
this._layoutSet = options.layoutSet || html.layoutSets.default;
this._animationSet = options.animationSet || html.animationSets.default;
this._availableLayoutControllers = [];
this._activeLayoutControllersStack = [];
this.transitionExecutor = new TransitionExecutorModule.TransitionExecutor;
this._initAnimations(this._animationSet)
},
_initAnimations: function(animationSet) {
if (!animationSet) {
return
}
$.each(animationSet, function(name, configs) {
$.each(configs, function(index, config) {
animationPresetsModule.presets.registerPreset(name, config)
})
});
animationPresetsModule.presets.applyChanges()
},
_localizeMarkup: function($markup) {
messageLocalization.localizeNode($markup)
},
_notifyIfBadMarkup: function($markup) {
$markup.each(function() {
var html = $(this).html();
if (/href="#/.test(html)) {
errors.log("W3005", html)
}
})
},
_initMarkupFilters: function(viewEngine) {
var filters = [];
filters.push(this._localizeMarkup);
if ("mobileApp" === this._applicationMode) {
filters.push(this._notifyIfBadMarkup)
}
if (viewEngine.markupLoaded) {
viewEngine.markupLoaded.add(function(args) {
$.each(filters, function(_, filter) {
filter(args.markup)
})
})
}
},
_createViewCache: function(options) {
var result = this.callBase(options);
if (!options.viewCache) {
result = new ConditionalViewCacheDecorator({
filter: function(key, viewInfo) {
return !viewInfo.viewTemplateInfo.disableCache
},
viewCache: result
})
}
return result
},
_initViewport: function() {
this._$viewPort = this._getViewPort();
viewPort(this._$viewPort)
},
_getViewPort: function() {
var $viewPort = $("." + VIEW_PORT_CLASSNAME);
if (!$viewPort.length) {
$viewPort = $("
").addClass(VIEW_PORT_CLASSNAME).appendTo(this._$root)
}
return $viewPort
},
_initTemplateContext: function() {
this._templateContext = new Component({
orientation: devices.orientation()
});
devices.on("orientationChanged", $.proxy(function(args) {
this._templateContext.option("orientation", args.orientation)
}, this))
},
_showViewImpl: function(viewInfo, direction) {
var that = this,
deferred = $.Deferred(),
result = deferred.promise(),
layoutController = viewInfo.layoutController;
that._obtainViewLink(viewInfo);
layoutController.showView(viewInfo, direction).done(function() {
that._activateLayoutController(layoutController, that._getTargetNode(viewInfo), direction).done(function() {
deferred.resolve()
})
});
feedbackEvents.lock(result);
return result
},
_resolveLayoutController: function(viewInfo) {
var args = {
viewInfo: viewInfo,
layoutController: null,
availableLayoutControllers: this._availableLayoutControllers
};
this._processEvent("resolveLayoutController", args, viewInfo.model);
this._checkLayoutControllerIsInitialized(args.layoutController);
return args.layoutController || this._resolveLayoutControllerImpl(viewInfo)
},
_checkLayoutControllerIsInitialized: function(layoutController) {
if (layoutController) {
var isControllerInited = false;
$.each(this._layoutSet, function(_, controllerInfo) {
if (controllerInfo.controller === layoutController) {
isControllerInited = true;
return false
}
});
if (!isControllerInited) {
throw errors.Error("E3024")
}
}
},
_ensureOneLayoutControllerFound: function(target, matches) {
var toJSONInterceptor = function(key, value) {
if ("controller" === key) {
return "[controller]: { name:" + value.name + " }"
}
return value
};
if (!matches.length) {
errors.log("W3003", JSON.stringify(target, null, 4), JSON.stringify(this._availableLayoutControllers, toJSONInterceptor, 4));
throw errors.Error("E3011")
}
if (matches.length > 1) {
errors.log("W3004", JSON.stringify(target, null, 4), JSON.stringify(matches, toJSONInterceptor, 4));
throw errors.Error("E3012")
}
},
_resolveLayoutControllerImpl: function(viewInfo) {
var templateInfo = viewInfo.viewTemplateInfo || {},
navigateOptions = viewInfo.navigateOptions || {},
target = $.extend({
root: !viewInfo.canBack,
customResolveRequired: false,
pane: templateInfo.pane,
modal: void 0 !== navigateOptions.modal ? navigateOptions.modal : templateInfo.modal || false
}, devices.current());
var matches = commonUtils.findBestMatches(target, this._availableLayoutControllers);
this._ensureOneLayoutControllerFound(target, matches);
return matches[0].controller
},
_onNavigatingBack: function(args) {
this.callBase.apply(this, arguments);
if (!args.cancel && !this.canBack() && this._activeLayoutControllersStack.length > 1) {
var previousActiveLayoutController = this._activeLayoutControllersStack[this._activeLayoutControllersStack.length - 2],
previousViewInfo = previousActiveLayoutController.activeViewInfo();
args.cancel = true;
this._activateLayoutController(previousActiveLayoutController, void 0, "backward");
this.navigationManager.currentItem(previousViewInfo.key)
}
},
_activeLayoutController: function() {
return this._activeLayoutControllersStack.length ? this._activeLayoutControllersStack[this._activeLayoutControllersStack.length - 1] : void 0
},
_getTargetNode: function(viewInfo) {
var jQueryEvent = (viewInfo.navigateOptions || {}).jQueryEvent;
return jQueryEvent ? $(jQueryEvent.target) : void 0
},
_activateLayoutController: function(layoutController, targetNode, direction) {
var that = this,
previousLayoutController = that._activeLayoutController();
if (previousLayoutController === layoutController) {
return $.Deferred().resolve().promise()
}
return layoutController.ensureActive(targetNode).then($.proxy(this._deactivatePreviousLayoutControllers, this, layoutController, direction)).then(function() {
that._activeLayoutControllersStack.push(layoutController)
})
},
_deactivatePreviousLayoutControllers: function(layoutController, direction) {
var that = this,
tasks = [],
controllerToDeactivate = that._activeLayoutControllersStack.pop();
if (!controllerToDeactivate) {
return $.Deferred().resolve().promise()
}
if (layoutController.isOverlay) {
that._activeLayoutControllersStack.push(controllerToDeactivate);
tasks.push(controllerToDeactivate.disable())
} else {
var transitionDeferred = $.Deferred(),
skipAnimation = false;
var getControllerDeactivator = function(controllerToDeactivate, d) {
return function() {
controllerToDeactivate.deactivate().done(function() {
d.resolve()
})
}
};
while (controllerToDeactivate && controllerToDeactivate !== layoutController) {
var d = $.Deferred();
if (controllerToDeactivate.isOverlay) {
skipAnimation = true
} else {
that.transitionExecutor.leave(controllerToDeactivate.element(), LAYOUT_CHANGE_ANIMATION_NAME, {
direction: direction
})
}
transitionDeferred.promise().done(getControllerDeactivator(controllerToDeactivate, d));
tasks.push(d.promise());
controllerToDeactivate = that._activeLayoutControllersStack.pop()
}
if (skipAnimation) {
transitionDeferred.resolve()
} else {
that.transitionExecutor.enter(layoutController.element(), LAYOUT_CHANGE_ANIMATION_NAME, {
direction: direction
});
that.transitionExecutor.start().done(function() {
transitionDeferred.resolve()
})
}
}
return $.when.apply($, tasks)
},
init: function() {
var that = this,
result = this.callBase();
result.done(function() {
that._initLayoutControllers();
that.renderNavigation()
});
return result
},
_disposeView: function(viewInfo) {
if (viewInfo.layoutController.disposeView) {
viewInfo.layoutController.disposeView(viewInfo)
}
this.callBase(viewInfo)
},
viewPort: function() {
return this._$viewPort
},
_createViewInfo: function(navigationItem, navigateOptions) {
var viewInfo = this.callBase.apply(this, arguments),
templateInfo = this.getViewTemplateInfo(viewInfo.viewName);
if (!templateInfo) {
throw errors.Error("E3013", "dxView", viewInfo.viewName)
}
viewInfo.viewTemplateInfo = templateInfo;
viewInfo.layoutController = this._resolveLayoutController(viewInfo);
return viewInfo
},
_createViewModel: function(viewInfo) {
this.callBase(viewInfo);
objectUtils.extendFromObject(viewInfo.model, viewInfo.viewTemplateInfo)
},
_initLayoutControllers: function() {
var that = this;
$.each(that._layoutSet, function(index, controllerInfo) {
var controller = controllerInfo.controller,
target = devices.current();
if (commonUtils.findBestMatches(target, [controllerInfo]).length) {
that._availableLayoutControllers.push(controllerInfo);
if (controller.init) {
controller.init({
app: that,
$viewPort: that._$viewPort,
navigationManager: that.navigationManager,
viewEngine: that.viewEngine,
templateContext: that._templateContext,
commandManager: that.commandManager
})
}
if (controller.on) {
controller.on("viewReleased", function(viewInfo) {
that._onViewReleased(viewInfo)
});
controller.on("viewHidden", function(viewInfo) {
that._onViewHidden(viewInfo)
});
controller.on("viewRendered", function(viewInfo) {
that._processEvent("viewRendered", {
viewInfo: viewInfo
}, viewInfo.model)
});
controller.on("viewShowing", function(viewInfo, direction) {
that._processEvent("viewShowing", {
viewInfo: viewInfo,
direction: direction,
params: viewInfo.routeData
}, viewInfo.model)
});
controller.on("viewShown", function(viewInfo, direction) {
that._processEvent("viewShown", {
viewInfo: viewInfo,
direction: direction,
params: viewInfo.routeData
}, viewInfo.model)
})
}
}
})
},
_onViewReleased: function(viewInfo) {
this._releaseViewLink(viewInfo)
},
renderNavigation: function() {
var that = this;
$.each(that._availableLayoutControllers, function(index, controllerInfo) {
var controller = controllerInfo.controller;
if (controller.renderNavigation) {
controller.renderNavigation(that.navigation)
}
})
},
getViewTemplate: function(viewName) {
return this.viewEngine.getViewTemplate(viewName)
},
getViewTemplateInfo: function(viewName) {
var viewComponent = this.viewEngine.getViewTemplateInfo(viewName);
return viewComponent && viewComponent.option()
},
loadTemplates: function(source) {
return this.viewEngine.loadTemplates(source)
},
templateContext: function() {
return this._templateContext
}
});
module.exports = HtmlApplication
},
/*!******************************************!*\
!*** ./Scripts/framework/application.js ***!
\******************************************/
function(module, exports, __webpack_require__) {
var BACK_COMMAND_TITLE, $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../core/class */ 20),
abstract = Class.abstract,
Action = __webpack_require__( /*! ../core/action */ 35),
commonUtils = __webpack_require__( /*! ../core/utils/common */ 14),
mergeCommands = __webpack_require__( /*! ./utils */ 131).utils.mergeCommands,
createActionExecutors = __webpack_require__( /*! ./action_executors */ 132).createActionExecutors,
Router = __webpack_require__( /*! ./router */ 123),
NavigationManager = __webpack_require__( /*! ./navigation_manager */ 133),
StateManager = __webpack_require__( /*! ./state_manager */ 124),
dxCommand = __webpack_require__( /*! ./command */ 121),
messageLocalization = __webpack_require__( /*! ../localization/message */ 80),
CommandMapping = __webpack_require__( /*! ./command_mapping */ 136),
ViewCache = __webpack_require__( /*! ./view_cache */ 125),
EventsMixin = __webpack_require__( /*! ../core/events_mixin */ 39),
sessionStorage = __webpack_require__( /*! ../core/utils/storage */ 41).sessionStorage,
dataUtils = __webpack_require__( /*! ../data/utils */ 137),
errors = __webpack_require__( /*! ./errors */ 122),
INIT_IN_PROGRESS = "InProgress",
INIT_COMPLETE = "Inited";
var Application = Class.inherit({
ctor: function(options) {
options = options || {};
this._options = options;
this.namespace = options.namespace || window;
this._applicationMode = options.mode ? options.mode : "mobileApp";
this.components = [];
BACK_COMMAND_TITLE = messageLocalization.localizeString("@Back");
this.router = options.router || new Router;
var navigationManagers = {
mobileApp: NavigationManager.StackBasedNavigationManager,
webSite: NavigationManager.HistoryBasedNavigationManager
};
this.navigationManager = options.navigationManager || new navigationManagers[this._applicationMode]({
keepPositionInStack: "keepHistory" === options.navigateToRootViewMode
});
this.navigationManager.on("navigating", $.proxy(this._onNavigating, this));
this.navigationManager.on("navigatingBack", $.proxy(this._onNavigatingBack, this));
this.navigationManager.on("navigated", $.proxy(this._onNavigated, this));
this.navigationManager.on("navigationCanceled", $.proxy(this._onNavigationCanceled, this));
this.stateManager = options.stateManager || new StateManager({
storage: options.stateStorage || sessionStorage()
});
this.stateManager.addStateSource(this.navigationManager);
this.viewCache = this._createViewCache(options);
this.commandMapping = this._createCommandMapping(options.commandMapping);
this.createNavigation(options.navigation);
this._isNavigating = false;
this._viewLinksHash = {};
Action.registerExecutor(createActionExecutors(this));
this.components.push(this.router);
this.components.push(this.navigationManager)
},
_createViewCache: function(options) {
var result;
if (options.viewCache) {
result = options.viewCache
} else {
if (options.disableViewCache) {
result = new ViewCache.NullViewCache
} else {
result = new ViewCache.CapacityViewCacheDecorator({
size: options.viewCacheSize,
viewCache: new ViewCache
})
}
}
result.on("viewRemoved", $.proxy(function(e) {
this._releaseViewLink(e.viewInfo)
}, this));
return result
},
_createCommandMapping: function(commandMapping) {
var result = commandMapping;
if (!(commandMapping instanceof CommandMapping)) {
result = new CommandMapping;
result.load(CommandMapping.defaultMapping || {}).load(commandMapping || {})
}
return result
},
createNavigation: function(navigationConfig) {
this.navigation = this._createNavigationCommands(navigationConfig);
this._mapNavigationCommands(this.navigation, this.commandMapping)
},
_createNavigationCommands: function(commandConfig) {
if (!commandConfig) {
return []
}
var generatedIdCount = 0;
return $.map(commandConfig, function(item) {
var command;
if (item instanceof dxCommand) {
command = item
} else {
command = new dxCommand($.extend({
root: true
}, item))
}
if (!command.option("id")) {
command.option("id", "navigation_" + generatedIdCount++)
}
return command
})
},
_mapNavigationCommands: function(navigationCommands, commandMapping) {
var navigationCommandIds = $.map(navigationCommands, function(command) {
return command.option("id")
});
commandMapping.mapCommands("global-navigation", navigationCommandIds)
},
_callComponentMethod: function(methodName, args) {
var tasks = [];
$.each(this.components, function(index, component) {
if (component[methodName] && $.isFunction(component[methodName])) {
var result = component[methodName](args);
if (result && result.done) {
tasks.push(result)
}
}
});
return $.when.apply($, tasks)
},
init: function() {
var that = this;
that._initState = INIT_IN_PROGRESS;
return that._callComponentMethod("init").done(function() {
that._initState = INIT_COMPLETE;
that._processEvent("initialized")
}).fail(function(error) {
throw error || errors.Error("E3022")
})
},
_onNavigatingBack: function(args) {
this._processEvent("navigatingBack", args)
},
_onNavigating: function(args) {
var that = this;
if (that._isNavigating) {
that._pendingNavigationArgs = args;
args.cancel = true;
return
} else {
that._isNavigating = true;
delete that._pendingNavigationArgs
}
var routeData = this.router.parse(args.uri);
if (!routeData) {
throw errors.Error("E3001", args.uri)
}
var uri = this.router.format(routeData);
if (args.uri !== uri && uri) {
args.cancel = true;
args.cancelReason = "redirect";
commonUtils.executeAsync(function() {
that.navigate(uri, args.options)
})
} else {
that._processEvent("navigating", args)
}
},
_onNavigated: function(args) {
var resultDeferred, that = this,
direction = args.options.direction,
viewInfo = that._acquireViewInfo(args.item, args.options);
if (!viewInfo.model) {
this._processEvent("beforeViewSetup", {
viewInfo: viewInfo
});
that._createViewModel(viewInfo);
that._createViewCommands(viewInfo);
this._processEvent("afterViewSetup", {
viewInfo: viewInfo
})
}
that._highlightCurrentNavigationCommand(viewInfo);
resultDeferred = that._showView(viewInfo, direction).always(function() {
that._isNavigating = false;
var pendingArgs = that._pendingNavigationArgs;
if (pendingArgs) {
commonUtils.executeAsync(function() {
that.navigate(pendingArgs.uri, pendingArgs.options)
})
}
});
return resultDeferred
},
_isViewReadyToShow: function(viewInfo) {
return !!viewInfo.model
},
_onNavigationCanceled: function(args) {
var that = this;
if (!that._pendingNavigationArgs || that._pendingNavigationArgs.uri !== args.uri) {
var currentItem = that.navigationManager.currentItem();
if (currentItem) {
commonUtils.executeAsync(function() {
var viewInfo = that._acquireViewInfo(currentItem, args.options);
that._highlightCurrentNavigationCommand(viewInfo, true)
})
}
that._isNavigating = false
}
},
_disposeRemovedViews: function() {
var args, that = this;
$.each(that._viewLinksHash, function(key, link) {
if (!link.linkCount) {
args = {
viewInfo: link.viewInfo
};
that._processEvent("viewDisposing", args, args.viewInfo.model);
that._disposeView(link.viewInfo);
that._processEvent("viewDisposed", args, args.viewInfo.model);
delete that._viewLinksHash[key]
}
})
},
_onViewHidden: function(viewInfo) {
var args = {
viewInfo: viewInfo
};
this._processEvent("viewHidden", args, args.viewInfo.model)
},
_disposeView: function(viewInfo) {
var commands = viewInfo.commands || [];
$.each(commands, function(index, command) {
command._dispose()
})
},
_acquireViewInfo: function(navigationItem, navigateOptions) {
var routeData = this.router.parse(navigationItem.uri),
viewInfoKey = this._getViewInfoKey(navigationItem, routeData),
viewInfo = this.viewCache.getView(viewInfoKey);
if (!viewInfo) {
viewInfo = this._createViewInfo(navigationItem, navigateOptions);
this._obtainViewLink(viewInfo);
this.viewCache.setView(viewInfoKey, viewInfo)
} else {
this._updateViewInfo(viewInfo, navigationItem, navigateOptions)
}
return viewInfo
},
_getViewInfoKey: function(navigationItem, routeData) {
var args = {
key: navigationItem.key,
navigationItem: navigationItem,
routeData: routeData
};
this._processEvent("resolveViewCacheKey", args);
return args.key
},
_processEvent: function(eventName, args, model) {
this._callComponentMethod(eventName, args);
this.fireEvent(eventName, args && [args]);
var modelMethod = (model || {})[eventName];
if (modelMethod) {
modelMethod.call(model, args)
}
},
_updateViewInfo: function(viewInfo, navigationItem, navigateOptions) {
var uri = navigationItem.uri,
routeData = this.router.parse(uri);
viewInfo.viewName = routeData.view;
viewInfo.routeData = routeData;
viewInfo.uri = uri;
viewInfo.navigateOptions = navigateOptions;
viewInfo.canBack = this.canBack(navigateOptions.stack);
viewInfo.previousViewInfo = this._getPreviousViewInfo(navigateOptions)
},
_createViewInfo: function(navigationItem, navigateOptions) {
var uri = navigationItem.uri,
routeData = this.router.parse(uri),
viewInfo = {
key: this._getViewInfoKey(navigationItem, routeData)
};
this._updateViewInfo(viewInfo, navigationItem, navigateOptions);
return viewInfo
},
_createViewModel: function(viewInfo) {
viewInfo.model = viewInfo.model || this._callViewCodeBehind(viewInfo)
},
_createViewCommands: function(viewInfo) {
viewInfo.commands = viewInfo.model.commands || [];
if (viewInfo.canBack && "webSite" !== this._applicationMode) {
this._appendBackCommand(viewInfo)
}
},
_callViewCodeBehind: function(viewInfo) {
var setupFunc = $.noop,
routeData = viewInfo.routeData;
if (routeData.view in this.namespace) {
setupFunc = this.namespace[routeData.view]
}
return setupFunc.call(this.namespace, routeData, viewInfo) || {}
},
_appendBackCommand: function(viewInfo) {
var commands = viewInfo.commands,
that = this,
backTitle = BACK_COMMAND_TITLE;
if (that._options.useViewTitleAsBackText) {
backTitle = ((viewInfo.previousViewInfo || {}).model || {}).title || backTitle
}
var toMergeTo = [new dxCommand({
id: "back",
title: backTitle,
behavior: "back",
onExecute: function() {
that.back({
stack: viewInfo.navigateOptions.stack
})
},
icon: "arrowleft",
type: "back",
renderStage: that._options.useViewTitleAsBackText ? "onViewRendering" : "onViewShown"
})];
var result = mergeCommands(toMergeTo, commands);
commands.length = 0;
commands.push.apply(commands, result)
},
_showView: function(viewInfo, direction) {
var that = this;
var eventArgs = {
viewInfo: viewInfo,
direction: direction,
params: viewInfo.routeData
};
dataUtils.processRequestResultLock.obtain();
return that._showViewImpl(eventArgs.viewInfo, eventArgs.direction).done(function() {
commonUtils.executeAsync(function() {
dataUtils.processRequestResultLock.release();
that._processEvent("viewShown", eventArgs, viewInfo.model);
that._disposeRemovedViews()
})
})
},
_highlightCurrentNavigationCommand: function(viewInfo, forceUpdate) {
var selectedCommand, that = this,
currentNavigationItemId = viewInfo.model && viewInfo.model.currentNavigationItemId;
if (void 0 !== currentNavigationItemId) {
$.each(this.navigation, function(index, command) {
if (command.option("id") === currentNavigationItemId) {
selectedCommand = command;
return false
}
})
}
if (!selectedCommand) {
$.each(this.navigation, function(index, command) {
var commandUri = command.option("onExecute");
if (commonUtils.isString(commandUri)) {
commandUri = commandUri.replace(/^#+/, "");
if (commandUri === that.navigationManager.rootUri()) {
selectedCommand = command;
return false
}
}
})
}
$.each(this.navigation, function(index, command) {
if (forceUpdate && command === selectedCommand && command.option("highlighted")) {
command.fireEvent("optionChanged", [{
name: "highlighted",
value: true,
previousValue: true
}])
}
command.option("highlighted", command === selectedCommand)
})
},
_showViewImpl: abstract,
_obtainViewLink: function(viewInfo) {
var key = viewInfo.key;
if (!this._viewLinksHash[key]) {
this._viewLinksHash[key] = {
viewInfo: viewInfo,
linkCount: 1
}
} else {
this._viewLinksHash[key].linkCount++
}
},
_releaseViewLink: function(viewInfo) {
if (void 0 === this._viewLinksHash[viewInfo.key]) {
errors.log("W3001", viewInfo.key)
}
if (0 === this._viewLinksHash[viewInfo.key].linkCount) {
errors.log("W3002", viewInfo.key)
}
this._viewLinksHash[viewInfo.key].linkCount--
},
navigate: function(uri, options) {
var that = this;
if ($.isPlainObject(uri)) {
uri = that.router.format(uri);
if (false === uri) {
throw errors.Error("E3002")
}
}
if (!that._initState) {
that.init().done(function() {
that.restoreState();
that.navigate(uri, options)
})
} else {
if (that._initState === INIT_COMPLETE) {
if (!that._isNavigating || uri) {
that.navigationManager.navigate(uri, options)
}
} else {
throw errors.Error("E3003")
}
}
},
canBack: function(stackKey) {
return this.navigationManager.canBack(stackKey)
},
_getPreviousViewInfo: function(navigateOptions) {
var result, previousNavigationItem = this.navigationManager.previousItem(navigateOptions.stack);
if (previousNavigationItem) {
var routeData = this.router.parse(previousNavigationItem.uri);
result = this.viewCache.getView(this._getViewInfoKey(previousNavigationItem, routeData))
}
return result
},
back: function(options) {
this.navigationManager.back(options)
},
saveState: function() {
this.stateManager.saveState()
},
restoreState: function() {
this.stateManager.restoreState()
},
clearState: function() {
this.stateManager.clearState()
}
}).include(EventsMixin);
exports.Application = Application
},
/*!************************************!*\
!*** ./Scripts/framework/utils.js ***!
\************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
KoTemplateProvider = __webpack_require__( /*! ../integration/knockout/template_provider */ 104);
var mergeWithReplace = function(targetArray, arrayToMerge, needReplaceFn) {
var result = [];
for (var i = 0, length = targetArray.length; i < length; i++) {
if (!needReplaceFn(targetArray[i], arrayToMerge)) {
result.push(targetArray[i])
}
}
result.push.apply(result, arrayToMerge);
return result
};
var prepareCommandToReplace = function(targetCommand, commandsToMerge) {
var needToReplace = false;
$.each(commandsToMerge, function(_, commandToMerge) {
var idEqual = targetCommand.option("id") === commandToMerge.option("id") && commandToMerge.option("id"),
behaviorEqual = targetCommand.option("behavior") === commandToMerge.option("behavior") && targetCommand.option("behavior");
needToReplace = idEqual || behaviorEqual;
if (behaviorEqual && null === commandToMerge.option("onExecute")) {
commandToMerge.option("onExecute", targetCommand.option("onExecute"))
}
if (needToReplace) {
targetCommand.element().remove();
return false
}
});
return needToReplace
};
var mergeCommands = function(targetCommands, commandsToMerge) {
return mergeWithReplace(targetCommands, commandsToMerge, prepareCommandToReplace)
};
var resolvePropertyValue = function(command, containerOptions, propertyName, defaultValue) {
var containerOption = containerOptions ? containerOptions[propertyName] : void 0,
defaultOption = void 0 === containerOption ? defaultValue : containerOption,
commandOption = command.option(propertyName);
return void 0 === commandOption || commandOption === defaultValue ? defaultOption : commandOption
};
var resolveTextValue = function(command, containerOptions) {
var showText = resolvePropertyValue(command, containerOptions, "showText"),
hasIcon = !!command.option("icon"),
titleValue = resolvePropertyValue(command, containerOptions, "title", "");
return showText || !hasIcon ? titleValue : ""
};
var resolveIconValue = function(command, containerOptions) {
var showIcon = resolvePropertyValue(command, containerOptions, "showIcon"),
hasText = !!command.option("title"),
iconValue = resolvePropertyValue(command, containerOptions, "icon", "");
return showIcon || !hasText ? iconValue : ""
};
exports.utils = {
mergeCommands: mergeCommands,
commandToContainer: {
resolveIconValue: resolveIconValue,
resolveTextValue: resolveTextValue,
resolvePropertyValue: resolvePropertyValue
}
};
exports.templateProvider = KoTemplateProvider
},
/*!***********************************************!*\
!*** ./Scripts/framework/action_executors.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
dataCoreUtils = __webpack_require__( /*! ../core/utils/data */ 36),
Route = __webpack_require__( /*! ./router */ 123).Route;
function prepareNavigateOptions(options, actionArguments) {
if (actionArguments.args) {
var sourceEventArguments = actionArguments.args[0];
options.jQueryEvent = sourceEventArguments.jQueryEvent
}
if ("dxCommand" === (actionArguments.component || {}).NAME) {
$.extend(options, actionArguments.component.option())
}
}
function preventDefaultLinkBehaviour(e) {
if (!e) {
return
}
var $targetElement = $(e.target);
if ($targetElement.attr("href")) {
e.preventDefault()
}
}
var createActionExecutors = function(app) {
return {
routing: {
execute: function(e) {
var routeValues, uri, action = e.action,
options = {};
if ($.isPlainObject(action)) {
routeValues = action.routeValues;
if (routeValues && $.isPlainObject(routeValues)) {
options = action.options
} else {
routeValues = action
}
uri = app.router.format(routeValues);
prepareNavigateOptions(options, e);
preventDefaultLinkBehaviour(options.jQueryEvent);
app.navigate(uri, options);
e.handled = true
}
}
},
hash: {
execute: function(e) {
if ("string" !== typeof e.action || "#" !== e.action.charAt(0)) {
return
}
var uriTemplate = e.action.substr(1),
args = e.args[0],
uri = uriTemplate;
var defaultEvaluate = function(expr) {
var getter = dataCoreUtils.compileGetter(expr),
model = e.args[0].model;
return getter(model)
};
var evaluate = args.evaluate || defaultEvaluate;
uri = uriTemplate.replace(/\{([^}]+)\}/g, function(entry, expr) {
expr = $.trim(expr);
if (expr.indexOf(",") > -1) {
expr = $.map(expr.split(","), $.trim)
}
var value = evaluate(expr);
if (void 0 === value) {
value = ""
}
value = Route.prototype.formatSegment(value);
return value
});
var options = {};
prepareNavigateOptions(options, e);
preventDefaultLinkBehaviour(options.jQueryEvent);
app.navigate(uri, options);
e.handled = true
}
},
url: {
execute: function(e) {
if ("string" === typeof e.action && "#" !== e.action.charAt(0)) {
document.location = e.action
}
}
}
}
};
exports.createActionExecutors = createActionExecutors
},
/*!*************************************************!*\
!*** ./Scripts/framework/navigation_manager.js ***!
\*************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../core/class */ 20),
commonUtils = __webpack_require__( /*! ../core/utils/common */ 14),
navigationDevices = __webpack_require__( /*! ./navigation_devices */ 134),
EventsMixin = __webpack_require__( /*! ../core/events_mixin */ 39),
errors = __webpack_require__( /*! ./errors */ 122),
hardwareBackButton = __webpack_require__( /*! ../mobile/process_hardware_back_button */ 53).processCallback,
hideTopOverlay = __webpack_require__( /*! ../mobile/hide_top_overlay */ 54);
var NAVIGATION_TARGETS = {
current: "current",
blank: "blank",
back: "back"
},
STORAGE_HISTORY_KEY = "__history";
var HistoryBasedNavigationManager = Class.inherit({
ctor: function(options) {
options = options || {};
this._currentItem = void 0;
this._previousItem = void 0;
this._createNavigationDevice(options)
},
_createNavigationDevice: function(options) {
this._navigationDevice = options.navigationDevice || new navigationDevices.HistoryBasedNavigationDevice;
this._navigationDevice.uriChanged.add($.proxy(this._uriChangedHandler, this))
},
_uriChangedHandler: function(uri) {
while (hideTopOverlay()) {}
this.navigate(uri)
},
_syncUriWithCurrentNavigationItem: function() {
var currentUri = this._currentItem && this._currentItem.uri;
this._navigationDevice.setUri(currentUri, true)
},
_cancelNavigation: function(args) {
this._syncUriWithCurrentNavigationItem();
this.fireEvent("navigationCanceled", [args])
},
_getDefaultOptions: function() {
return {
direction: "none",
target: NAVIGATION_TARGETS.blank
}
},
_updateHistory: function(uri, options) {
this._previousItem = this._currentItem;
this._currentItem = {
uri: uri,
key: uri
};
this._navigationDevice.setUri(uri, options.target === NAVIGATION_TARGETS.current)
},
_setCurrentItem: function(item) {
this._currentItem = item
},
navigate: function(uri, options) {
options = options || {};
var args, that = this,
isFirstNavigate = !that._currentItem,
currentItem = that._currentItem || {},
targetItem = options.item || {},
currentUri = currentItem.uri,
currentKey = currentItem.key,
targetKey = targetItem.key;
if (void 0 === uri) {
uri = that._navigationDevice.getUri()
}
if (/^_back$/.test(uri)) {
that.back();
return
}
options = $.extend(that._getDefaultOptions(), options || {});
if (isFirstNavigate) {
options.target = NAVIGATION_TARGETS.current
}
args = {
currentUri: currentUri,
uri: uri,
cancel: false,
navigateWhen: [],
options: options
};
that.fireEvent("navigating", [args]);
uri = args.uri;
if (args.cancel || currentUri === uri && (void 0 === targetKey || targetKey === currentKey) && !that._forceNavigate) {
that._cancelNavigation(args)
} else {
that._forceNavigate = false;
$.when.apply($, args.navigateWhen).done(function() {
commonUtils.executeAsync(function() {
that._updateHistory(uri, options);
that.fireEvent("navigated", [{
uri: uri,
previousUri: currentUri,
options: options,
item: that._currentItem
}])
})
})
}
},
back: function() {
return this._navigationDevice.back()
},
previousItem: function() {
return this._previousItem
},
currentItem: function(item) {
if (arguments.length > 0) {
if (!item) {
throw errors.Error("E3023")
}
this._setCurrentItem(item)
} else {
return this._currentItem
}
},
rootUri: function() {
return this._currentItem && this._currentItem.uri
},
canBack: function() {
return true
},
saveState: $.noop,
restoreState: $.noop,
removeState: $.noop
}).include(EventsMixin);
var StackBasedNavigationManager = HistoryBasedNavigationManager.inherit({
ctor: function(options) {
options = options || {};
this.callBase(options);
this._createNavigationStacks(options);
hardwareBackButton.add($.proxy(this._deviceBackInitiated, this));
this._stateStorageKey = options.stateStorageKey || STORAGE_HISTORY_KEY
},
init: function() {
return this._navigationDevice.init()
},
_createNavigationDevice: function(options) {
if (!options.navigationDevice) {
options.navigationDevice = new navigationDevices.StackBasedNavigationDevice
}
this.callBase(options);
this._navigationDevice.backInitiated.add($.proxy(this._deviceBackInitiated, this))
},
_uriChangedHandler: function(uri) {
this.navigate(uri)
},
_createNavigationStacks: function(options) {
this.navigationStacks = {};
this._keepPositionInStack = options.keepPositionInStack;
this.currentStack = new NavigationStack
},
_deviceBackInitiated: function() {
if (!hideTopOverlay()) {
this.back({
isHardwareButton: true
})
} else {
this._syncUriWithCurrentNavigationItem()
}
},
_getDefaultOptions: function() {
return {
target: NAVIGATION_TARGETS.blank
}
},
_createNavigationStack: function() {
var result = new NavigationStack;
result.itemsRemoved.add($.proxy(this._removeItems, this));
return result
},
_setCurrentItem: function(item) {
this._setCurrentStack(item.stack);
this.currentStack.currentItem(item);
this.callBase(item);
this._syncUriWithCurrentNavigationItem()
},
_setCurrentStack: function(stackOrStackKey) {
var stack, stackKey;
if ("string" === typeof stackOrStackKey) {
stackKey = stackOrStackKey;
if (!(stackKey in this.navigationStacks)) {
this.navigationStacks[stackKey] = this._createNavigationStack()
}
stack = this.navigationStacks[stackKey]
} else {
stack = stackOrStackKey;
stackKey = $.map(this.navigationStacks, function(stack, key) {
if (stack === stackOrStackKey) {
return key
}
return null
})[0]
}
this.currentStack = stack;
this.currentStackKey = stackKey
},
_getViewTargetStackKey: function(uri, isRoot) {
var result;
if (isRoot) {
if (void 0 !== this.navigationStacks[uri]) {
result = uri
} else {
for (var stackKey in this.navigationStacks) {
if (this.navigationStacks[stackKey].items[0].uri === uri) {
result = stackKey;
break
}
}
result = result || uri
}
} else {
result = this.currentStackKey || uri
}
return result
},
_updateHistory: function(uri, options) {
var isRoot = options.root,
forceIsRoot = isRoot,
forceToRoot = false,
previousStack = this.currentStack,
keepPositionInStack = void 0 !== options.keepPositionInStack ? options.keepPositionInStack : this._keepPositionInStack;
options.stack = options.stack || this._getViewTargetStackKey(uri, isRoot);
this._setCurrentStack(options.stack);
if (isRoot || !this.currentStack.items.length) {
forceToRoot = this.currentStack === previousStack;
forceIsRoot = true
}
if (isRoot && this.currentStack.items.length) {
if (!keepPositionInStack || forceToRoot) {
this.currentStack.currentIndex = 0;
if (this.currentItem().uri !== uri) {
this.currentStack.navigate(uri, true)
}
}
options.direction = options.direction || "none"
} else {
var prevIndex = this.currentStack.currentIndex,
prevItem = this.currentItem() || {};
switch (options.target) {
case NAVIGATION_TARGETS.blank:
this.currentStack.navigate(uri);
break;
case NAVIGATION_TARGETS.current:
this.currentStack.navigate(uri, true);
break;
case NAVIGATION_TARGETS.back:
if (this.currentStack.currentIndex > 0) {
this.currentStack.back(uri)
} else {
this.currentStack.navigate(uri, true)
}
break;
default:
throw errors.Error("E3006", options.target)
}
if (void 0 === options.direction) {
var indexDelta = this.currentStack.currentIndex - prevIndex;
if (indexDelta < 0) {
options.direction = this.currentStack.currentItem().backDirection || "backward"
} else {
if (indexDelta > 0 && this.currentStack.currentIndex > 0) {
options.direction = "forward"
} else {
options.direction = "none"
}
}
}
prevItem.backDirection = "forward" === options.direction ? "backward" : "none"
}
options.root = forceIsRoot;
this._currentItem = this.currentStack.currentItem();
this._syncUriWithCurrentNavigationItem()
},
_removeItems: function(items) {
var that = this;
$.each(items, function(index, item) {
that.fireEvent("itemRemoved", [item])
})
},
back: function(options) {
options = options || {};
var navigatingBackArgs = $.extend({
cancel: false
}, options);
this.fireEvent("navigatingBack", [navigatingBackArgs]);
if (navigatingBackArgs.cancel) {
this._syncUriWithCurrentNavigationItem();
return
}
var item = this.previousItem(navigatingBackArgs.stack);
if (item) {
this.navigate(item.uri, {
stack: navigatingBackArgs.stack,
target: NAVIGATION_TARGETS.back,
item: item
})
} else {
this.callBase()
}
},
rootUri: function() {
return this.currentStack.items.length ? this.currentStack.items[0].uri : this.callBase()
},
canBack: function(stackKey) {
var stack = stackKey ? this.navigationStacks[stackKey] : this.currentStack;
return stack.canBack()
},
saveState: function(storage) {
if (this.currentStack.items.length) {
var state = {
navigationStacks: {},
currentStackKey: this.currentStackKey
};
$.each(this.navigationStacks, function(stackKey, stack) {
var stackState = {};
state.navigationStacks[stackKey] = stackState;
stackState.currentIndex = stack.currentIndex;
stackState.items = $.map(stack.items, function(item) {
return {
key: item.key,
uri: item.uri
}
})
});
var json = JSON.stringify(state);
storage.setItem(this._stateStorageKey, json)
} else {
this.removeState(storage)
}
},
restoreState: function(storage) {
if (this.disableRestoreState) {
return
}
var json = storage.getItem(this._stateStorageKey);
if (json) {
try {
var that = this,
state = JSON.parse(json);
$.each(state.navigationStacks, function(stackKey, stackState) {
var stack = that._createNavigationStack();
that.navigationStacks[stackKey] = stack;
stack.currentIndex = stackState.currentIndex;
stack.items = $.map(stackState.items, function(item) {
item.stack = stack;
return item
})
});
this.currentStackKey = state.currentStackKey;
this.currentStack = this.navigationStacks[this.currentStackKey];
this._currentItem = this.currentStack.currentItem();
this._navigationDevice.setUri(this.currentItem().uri);
this._forceNavigate = true
} catch (e) {
this.removeState(storage);
throw errors.Error("E3007")
}
}
},
removeState: function(storage) {
storage.removeItem(this._stateStorageKey)
},
currentIndex: function() {
return this.currentStack.currentIndex
},
previousItem: function(stackKey) {
var stack = this.navigationStacks[stackKey] || this.currentStack;
return stack.previousItem()
},
getItemByIndex: function(index) {
return this.currentStack.items[index]
},
clearHistory: function() {
this._createNavigationStacks({
keepPositionInStack: this._keepPositionInStack
})
},
itemByKey: function(itemKey) {
var result;
$.each(this.navigationStacks, function(stackKey, stack) {
var item = stack.itemByKey(itemKey);
if (item) {
result = item;
return false
}
});
return result
},
currentItem: function(itemOrItemKey) {
var item;
if (arguments.length > 0) {
if ("string" === typeof itemOrItemKey) {
item = this.itemByKey(itemOrItemKey)
} else {
if ($.isPlainObject(itemOrItemKey)) {
item = itemOrItemKey
}
}
this.callBase(item)
} else {
return this.callBase()
}
}
});
var NavigationStack = Class.inherit({
ctor: function(options) {
options = options || {};
this.itemsRemoved = $.Callbacks();
this.clear()
},
currentItem: function(item) {
if (item) {
for (var i = 0; i < this.items.length; i++) {
if (item === this.items[i]) {
this.currentIndex = i;
break
}
}
} else {
return this.items[this.currentIndex]
}
},
previousItem: function() {
return this.items.length > 1 ? this.items[this.currentIndex - 1] : void 0
},
canBack: function() {
return this.currentIndex > 0
},
clear: function() {
this._deleteItems(this.items);
this.items = [];
this.currentIndex = -1
},
back: function(uri) {
this.currentIndex--;
if (this.currentIndex < 0) {
throw errors.Error("E3008")
}
var currentItem = this.currentItem();
if (currentItem.uri !== uri) {
this._updateItem(this.currentIndex, uri)
}
},
forward: function() {
this.currentIndex++;
if (this.currentIndex >= this.items.length) {
throw errors.Error("E3009")
}
},
navigate: function(uri, replaceCurrent) {
if (this.currentIndex < this.items.length && this.currentIndex > -1 && this.items[this.currentIndex].uri === uri) {
return
}
if (replaceCurrent && this.currentIndex > -1) {
this.currentIndex--
}
if (this.currentIndex + 1 < this.items.length && this.items[this.currentIndex + 1].uri === uri) {
this.currentIndex++
} else {
var toDelete = this.items.splice(this.currentIndex + 1, this.items.length - this.currentIndex - 1);
this.items.push({
stack: this
});
this.currentIndex++;
this._updateItem(this.currentIndex, uri);
this._deleteItems(toDelete)
}
return this.currentItem()
},
itemByKey: function(key) {
for (var i = 0; i < this.items.length; i++) {
var item = this.items[i];
if (item.key === key) {
return item
}
}
},
_updateItem: function(index, uri) {
var item = this.items[index];
item.uri = uri;
item.key = this.items[0].uri + "_" + index + "_" + uri
},
_deleteItems: function(items) {
if (items) {
this.itemsRemoved.fire(items)
}
}
});
HistoryBasedNavigationManager.NAVIGATION_TARGETS = NAVIGATION_TARGETS;
exports.HistoryBasedNavigationManager = HistoryBasedNavigationManager;
exports.StackBasedNavigationManager = StackBasedNavigationManager;
exports.NavigationStack = NavigationStack
},
/*!*************************************************!*\
!*** ./Scripts/framework/navigation_devices.js ***!
\*************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../core/class */ 20),
browserAdapters = __webpack_require__( /*! ./browser_adapters */ 135),
SessionStorage = __webpack_require__( /*! ../core/utils/storage */ 41).sessionStorage,
devices = __webpack_require__( /*! ../core/devices */ 40);
var SESSION_KEY = "dxPhoneJSApplication";
var HistoryBasedNavigationDevice = Class.inherit({
ctor: function(options) {
options = options || {};
this._browserAdapter = options.browserAdapter || this._createBrowserAdapter(options);
this.uriChanged = $.Callbacks();
this._browserAdapter.popState.add($.proxy(this._onPopState, this))
},
init: $.noop,
getUri: function() {
return this._browserAdapter.getHash()
},
setUri: function(uri, replaceCurrent) {
if (replaceCurrent) {
return this._browserAdapter.replaceState(uri)
} else {
if (uri !== this.getUri()) {
return this._browserAdapter.pushState(uri)
} else {
return $.Deferred().resolve().promise()
}
}
},
back: function() {
return this._browserAdapter.back()
},
_onPopState: function() {
this.uriChanged.fire(this.getUri())
},
_isBuggyAndroid2: function() {
var realDevice = devices.real();
var version = realDevice.version;
return "android" === realDevice.platform && version.length > 1 && (2 === version[0] && version[1] < 4 || version[0] < 2)
},
_isBuggyAndroid4: function() {
var realDevice = devices.real();
var version = realDevice.version;
return "android" === realDevice.platform && version.length > 1 && 4 === version[0] && 0 === version[1]
},
_isWindowsPhone8: function() {
var realDevice = devices.real();
return "win" === realDevice.platform && realDevice.phone
},
_createBrowserAdapter: function(options) {
var result, sourceWindow = options.window || window,
supportPushReplace = sourceWindow.history.replaceState && sourceWindow.history.pushState;
if (this._isWindowsPhone8()) {
result = new browserAdapters.BuggyCordovaWP81BrowserAdapter(options)
} else {
if (sourceWindow !== sourceWindow.top) {
result = new browserAdapters.HistorylessBrowserAdapter(options)
} else {
if (this._isBuggyAndroid4()) {
result = new browserAdapters.BuggyAndroidBrowserAdapter(options)
} else {
if (this._isBuggyAndroid2() || !supportPushReplace) {
result = new browserAdapters.OldBrowserAdapter(options)
} else {
result = new browserAdapters.DefaultBrowserAdapter(options)
}
}
}
}
return result
}
});
var StackBasedNavigationDevice = HistoryBasedNavigationDevice.inherit({
ctor: function(options) {
this.callBase(options);
this.backInitiated = $.Callbacks();
this._rootStateHandler = null;
$(window).on("unload", this._saveBrowserState)
},
init: function() {
var that = this;
if (that._browserAdapter.canWorkInPureBrowser) {
return that._initRootPage().done(function() {
if (that._browserAdapter.isRootPage()) {
that._browserAdapter.pushState("")
}
})
} else {
return $.Deferred().resolve().promise()
}
},
setUri: function(uri) {
return this.callBase(uri, !this._browserAdapter.isRootPage())
},
_saveBrowserState: function() {
var sessionStorage = SessionStorage();
if (sessionStorage) {
sessionStorage.setItem(SESSION_KEY, true)
}
},
_initRootPage: function() {
var hash = this.getUri(),
sessionStorage = SessionStorage();
if (!sessionStorage || sessionStorage.getItem(SESSION_KEY)) {
return $.Deferred().resolve().promise()
}
sessionStorage.removeItem(SESSION_KEY);
this._browserAdapter.createRootPage();
return this._browserAdapter.pushState(hash)
},
_onPopState: function() {
if (this._browserAdapter.isRootPage()) {
if (this._rootStateHandler) {
this._rootStateHandler()
} else {
this.backInitiated.fire()
}
} else {
if (!this._rootStateHandler) {
this._createRootStateHandler()
}
this.back()
}
},
_createRootStateHandler: function() {
var uri = this.getUri();
this._rootStateHandler = function() {
this.uriChanged.fire(uri);
this._rootStateHandler = null
}
}
});
exports.HistoryBasedNavigationDevice = HistoryBasedNavigationDevice;
exports.StackBasedNavigationDevice = StackBasedNavigationDevice
},
/*!***********************************************!*\
!*** ./Scripts/framework/browser_adapters.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../core/class */ 20),
queue = __webpack_require__( /*! ../core/utils/queue */ 51);
var ROOT_PAGE_URL = "__root__",
BUGGY_ANDROID_BUFFER_PAGE_URL = "__buffer__";
var DefaultBrowserAdapter = Class.inherit({
ctor: function(options) {
options = options || {};
this._window = options.window || window;
this.popState = $.Callbacks();
$(this._window).on("hashchange", $.proxy(this._onHashChange, this));
this._tasks = queue.create();
this.canWorkInPureBrowser = true
},
replaceState: function(uri) {
var that = this;
return this._addTask(function() {
uri = that._normalizeUri(uri);
that._window.history.replaceState(null, null, "#" + uri);
that._currentTask.resolve()
})
},
pushState: function(uri) {
var that = this;
return this._addTask(function() {
uri = that._normalizeUri(uri);
that._window.history.pushState(null, null, "#" + uri);
that._currentTask.resolve()
})
},
createRootPage: function() {
return this.replaceState(ROOT_PAGE_URL)
},
_onHashChange: function() {
if (this._currentTask) {
this._currentTask.resolve()
}
this.popState.fire()
},
back: function() {
var that = this;
return this._addTask(function() {
that._window.history.back()
})
},
getHash: function() {
return this._normalizeUri(this._window.location.hash)
},
isRootPage: function() {
return this.getHash() === ROOT_PAGE_URL
},
_normalizeUri: function(uri) {
return (uri || "").replace(/^#+/, "")
},
_addTask: function(task) {
var that = this,
d = $.Deferred();
this._tasks.add(function() {
that._currentTask = d;
task();
return d
});
return d.promise()
}
});
var OldBrowserAdapter = DefaultBrowserAdapter.inherit({
ctor: function() {
this._innerEventCount = 0;
this.callBase.apply(this, arguments);
this._skipNextEvent = false
},
replaceState: function(uri) {
var that = this;
uri = that._normalizeUri(uri);
if (that.getHash() !== uri) {
that._addTask(function() {
that._skipNextEvent = true;
that._window.history.back()
});
return that._addTask(function() {
that._skipNextEvent = true;
that._window.location.hash = uri
})
}
return $.Deferred().resolve().promise()
},
pushState: function(uri) {
var that = this;
uri = this._normalizeUri(uri);
if (this.getHash() !== uri) {
return that._addTask(function() {
that._skipNextEvent = true;
that._window.location.hash = uri
})
}
return $.Deferred().resolve().promise()
},
createRootPage: function() {
return this.pushState(ROOT_PAGE_URL)
},
_onHashChange: function() {
var currentTask = this._currentTask;
this._currentTask = null;
if (this._skipNextEvent) {
this._skipNextEvent = false
} else {
this.popState.fire()
}
if (currentTask) {
currentTask.resolve()
}
}
});
var BuggyAndroidBrowserAdapter = OldBrowserAdapter.inherit({
createRootPage: function() {
this.pushState(BUGGY_ANDROID_BUFFER_PAGE_URL);
return this.callBase()
}
});
var HistorylessBrowserAdapter = DefaultBrowserAdapter.inherit({
ctor: function(options) {
options = options || {};
this._window = options.window || window;
this.popState = $.Callbacks();
$(this._window).on("dxback", $.proxy(this._onHashChange, this));
this._currentHash = this._window.location.hash
},
replaceState: function(uri) {
this._currentHash = this._normalizeUri(uri);
return $.Deferred().resolve().promise()
},
pushState: function(uri) {
return this.replaceState(uri)
},
createRootPage: function() {
return this.replaceState(ROOT_PAGE_URL)
},
getHash: function() {
return this._normalizeUri(this._currentHash)
},
back: function() {
return this.replaceState(ROOT_PAGE_URL)
},
_onHashChange: function() {
var promise = this.back();
this.popState.fire();
return promise
}
});
var BuggyCordovaWP81BrowserAdapter = DefaultBrowserAdapter.inherit({
ctor: function(options) {
this.callBase(options);
this.canWorkInPureBrowser = false
}
});
exports.DefaultBrowserAdapter = DefaultBrowserAdapter;
exports.OldBrowserAdapter = OldBrowserAdapter;
exports.BuggyAndroidBrowserAdapter = BuggyAndroidBrowserAdapter;
exports.HistorylessBrowserAdapter = HistorylessBrowserAdapter;
exports.BuggyCordovaWP81BrowserAdapter = BuggyCordovaWP81BrowserAdapter
},
/*!**********************************************!*\
!*** ./Scripts/framework/command_mapping.js ***!
\**********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../core/class */ 20),
errors = __webpack_require__( /*! ./errors */ 122);
var CommandMapping = Class.inherit({
ctor: function() {
this._commandMappings = {};
this._containerDefaults = {}
},
setDefaults: function(containerId, defaults) {
this._containerDefaults[containerId] = defaults;
return this
},
mapCommands: function(containerId, commandMappings) {
var that = this;
$.each(commandMappings, function(index, commandMapping) {
if ("string" === typeof commandMapping) {
commandMapping = {
id: commandMapping
}
}
var commandId = commandMapping.id;
var mappings = that._commandMappings[containerId] || {};
mappings[commandId] = $.extend({
showIcon: true,
showText: true
}, that._containerDefaults[containerId] || {}, commandMapping);
that._commandMappings[containerId] = mappings
});
this._initExistingCommands();
return this
},
unmapCommands: function(containerId, commandIds) {
var that = this;
$.each(commandIds, function(index, commandId) {
var mappings = that._commandMappings[containerId] || {};
if (mappings) {
delete mappings[commandId]
}
});
this._initExistingCommands()
},
getCommandMappingForContainer: function(commandId, containerId) {
return (this._commandMappings[containerId] || {})[commandId]
},
checkCommandsExist: function(commands) {
var that = this,
result = $.grep(commands, function(commandName, index) {
return $.inArray(commandName, that._existingCommands) < 0 && $.inArray(commandName, commands) === index
});
if (0 !== result.length) {
throw errors.Error("E3005", result.join("', '"), 1 === result.length ? " is" : "s are")
}
},
load: function(config) {
if (!config) {
return
}
var that = this;
$.each(config, function(name, container) {
that.setDefaults(name, container.defaults);
that.mapCommands(name, container.commands)
});
return this
},
_initExistingCommands: function() {
var that = this;
this._existingCommands = [];
$.each(that._commandMappings, function(name, _commands) {
$.each(_commands, function(index, command) {
if ($.inArray(command.id, that._existingCommands) < 0) {
that._existingCommands.push(command.id)
}
})
})
}
});
CommandMapping.defaultMapping = {
"global-navigation": {
defaults: {
showIcon: true,
showText: true
},
commands: []
},
"ios-header-toolbar": {
defaults: {
showIcon: false,
showText: true,
location: "after"
},
commands: ["edit", "save", {
id: "back",
location: "before"
}, {
id: "cancel",
location: "before"
}, {
id: "create",
showIcon: true,
showText: false
}]
},
"ios-action-sheet": {
defaults: {
showIcon: false,
showText: true
},
commands: []
},
"ios-view-footer": {
defaults: {
showIcon: false,
showText: true
},
commands: [{
id: "delete",
type: "danger"
}]
},
"android-header-toolbar": {
defaults: {
showIcon: true,
showText: false,
location: "after"
},
commands: [{
id: "back",
showIcon: false,
location: "before"
}, "create", {
id: "save",
showText: true,
showIcon: false,
location: "after"
}, {
id: "edit",
showText: false,
location: "after"
}, {
id: "cancel",
showText: false,
location: "before"
}, {
id: "delete",
showText: false,
location: "after"
}]
},
"android-simple-toolbar": {
defaults: {
showIcon: true,
showText: false,
location: "after"
},
commands: [{
id: "back",
showIcon: false,
location: "before"
}, {
id: "create"
}, {
id: "save",
showText: true,
showIcon: false,
location: "after"
}, {
id: "edit",
showText: false,
location: "after"
}, {
id: "cancel",
showText: false,
location: "before"
}, {
id: "delete",
showText: false,
location: "after"
}]
},
"android-footer-toolbar": {
defaults: {
location: "after"
},
commands: [{
id: "create",
showText: false,
location: "center"
}, {
id: "edit",
showText: false,
location: "before"
}, {
id: "delete",
locateInMenu: "always"
}, {
id: "save",
showIcon: false,
location: "before"
}]
},
"generic-header-toolbar": {
defaults: {
showIcon: false,
showText: true,
location: "after"
},
commands: ["edit", "save", {
id: "back",
location: "before"
}, {
id: "cancel",
location: "before"
}, {
id: "create",
showIcon: true,
showText: false
}]
},
"generic-view-footer": {
defaults: {
showIcon: false,
showText: true
},
commands: [{
id: "delete",
type: "danger"
}]
},
"win8-appbar": {
defaults: {
location: "after"
},
commands: ["edit", "cancel", "save", "delete", {
id: "create",
location: "before"
}, {
id: "refresh",
location: "before"
}]
},
"win8-toolbar": {
defaults: {
showText: false,
location: "before"
},
commands: [{
id: "previousPage"
}]
},
"win8-phone-appbar": {
defaults: {
location: "center"
},
commands: ["create", "edit", "cancel", "save", "refresh", {
id: "delete",
locateInMenu: "always"
}]
},
"win8-split-toolbar": {
defaults: {
showIcon: true,
showText: false,
location: "after"
},
commands: [{
id: "back",
showIcon: false,
location: "before"
}, {
id: "create"
}, {
id: "save",
showText: true,
location: "before"
}, {
id: "edit",
showText: true,
locateInMenu: "always"
}, {
id: "cancel",
showText: true,
locateInMenu: "always"
}, {
id: "delete",
showText: true,
locateInMenu: "always"
}]
},
"win8-master-detail-toolbar": {
defaults: {
showText: false,
location: "before"
},
commands: ["back"]
},
"win10-appbar": {
defaults: {
showText: false,
location: "after"
},
commands: [{
id: "back",
location: "before"
}, "edit", "cancel", "save", "delete", "create", "refresh"]
},
"win10-phone-appbar": {
defaults: {
location: "after"
},
commands: ["create", "edit", "cancel", "save", "refresh", {
id: "delete",
locateInMenu: "always"
}]
},
"desktop-toolbar": {
defaults: {
showIcon: false,
showText: true,
location: "after"
},
commands: ["cancel", "create", "edit", "save", {
id: "delete",
type: "danger"
}]
}
};
module.exports = CommandMapping
},
/*!*******************************!*\
!*** ./Scripts/data/utils.js ***!
\*******************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
toComparable = __webpack_require__( /*! ../core/utils/data */ 36).toComparable;
var normalizeBinaryCriterion = function(crit) {
return [crit[0], crit.length < 3 ? "=" : String(crit[1]).toLowerCase(), crit.length < 2 ? true : crit[crit.length - 1]]
};
var normalizeSortingInfo = function(info) {
if (!$.isArray(info)) {
info = [info]
}
return $.map(info, function(i) {
return {
selector: $.isFunction(i) || "string" === typeof i ? i : i.getter || i.field || i.selector,
desc: !!(i.desc || "d" === String(i.dir).charAt(0).toLowerCase())
}
})
};
var errorMessageFromXhr = function() {
var textStatusMessages = {
timeout: "Network connection timeout",
error: "Unspecified network error",
parsererror: "Unexpected server response"
};
var textStatusDetails = {
timeout: "possible causes: the remote host is not accessible, overloaded or is not included into the domain white-list when being run in the native container",
error: "if the remote host is located on another domain, make sure it properly supports cross-origin resource sharing (CORS), or use the JSONP approach instead",
parsererror: "the remote host did not respond with valid JSON data"
};
var explainTextStatus = function(textStatus) {
var result = textStatusMessages[textStatus];
if (!result) {
return textStatus
}
result += " (" + textStatusDetails[textStatus] + ")";
return result
};
return function(xhr, textStatus) {
if (xhr.status < 400) {
return explainTextStatus(textStatus)
}
return xhr.statusText
}
}();
var aggregators = {
count: {
seed: 0,
step: function(count) {
return 1 + count
}
},
sum: {
seed: 0,
step: function(sum, item) {
return sum + item
}
},
min: {
step: function(min, item) {
return item < min ? item : min
}
},
max: {
step: function(max, item) {
return item > max ? item : max
}
},
avg: {
seed: [0, 0],
step: function(pair, value) {
return [pair[0] + value, pair[1] + 1]
},
finalize: function(pair) {
return pair[1] ? pair[0] / pair[1] : NaN
}
}
};
var processRequestResultLock = function() {
var lockDeferred, lockCount = 0;
var obtain = function() {
if (0 === lockCount) {
lockDeferred = $.Deferred()
}
lockCount++
};
var release = function() {
lockCount--;
if (lockCount < 1) {
lockDeferred.resolve()
}
};
var promise = function() {
var deferred = 0 === lockCount ? $.Deferred().resolve() : lockDeferred;
return deferred.promise()
};
var reset = function() {
lockCount = 0;
if (lockDeferred) {
lockDeferred.resolve()
}
};
return {
obtain: obtain,
release: release,
promise: promise,
reset: reset
}
}();
function isDisjunctiveOperator(condition) {
return /^(or|\|\||\|)$/i.test(condition)
}
function isConjunctiveOperator(condition) {
return /^(and|\&\&|\&)$/i.test(condition)
}
var keysEqual = function(keyExpr, key1, key2) {
if ($.isArray(keyExpr)) {
var name, names = $.map(key1, function(v, k) {
return k
});
for (var i = 0; i < names.length; i++) {
name = names[i];
if (toComparable(key1[name], true) != toComparable(key2[name], true)) {
return false
}
}
return true
}
return toComparable(key1, true) == toComparable(key2, true)
};
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var base64_encode = function(input) {
if (!$.isArray(input)) {
input = stringToByteArray(String(input))
}
var result = "";
function getBase64Char(index) {
return BASE64_CHARS.charAt(index)
}
for (var i = 0; i < input.length; i += 3) {
var octet1 = input[i],
octet2 = input[i + 1],
octet3 = input[i + 2];
result += $.map([octet1 >> 2, (3 & octet1) << 4 | octet2 >> 4, isNaN(octet2) ? 64 : (15 & octet2) << 2 | octet3 >> 6, isNaN(octet3) ? 64 : 63 & octet3], getBase64Char).join("")
}
return result
};
var stringToByteArray = function(str) {
var code, i, bytes = [];
for (i = 0; i < str.length; i++) {
code = str.charCodeAt(i);
if (code < 128) {
bytes.push(code)
} else {
if (code < 2048) {
bytes.push(192 + (code >> 6), 128 + (63 & code))
} else {
if (code < 65536) {
bytes.push(224 + (code >> 12), 128 + (code >> 6 & 63), 128 + (63 & code))
} else {
if (code < 2097152) {
bytes.push(240 + (code >> 18), 128 + (code >> 12 & 63), 128 + (code >> 6 & 63), 128 + (63 & code))
}
}
}
}
}
return bytes
};
var utils = {
normalizeBinaryCriterion: normalizeBinaryCriterion,
normalizeSortingInfo: normalizeSortingInfo,
errorMessageFromXhr: errorMessageFromXhr,
aggregators: aggregators,
keysEqual: keysEqual,
isDisjunctiveOperator: isDisjunctiveOperator,
isConjunctiveOperator: isConjunctiveOperator,
processRequestResultLock: processRequestResultLock,
base64_encode: base64_encode
};
module.exports = utils
},
/*!*******************************************!*\
!*** ./Scripts/framework/html/presets.js ***!
\*******************************************/
function(module, exports) {
exports.layoutSets = {};
exports.animationSets = {
"native": {
"view-content-change": [{
animation: "slide"
}, {
animation: "ios7-slide",
device: {
platform: "ios"
}
}, {
animation: "none",
device: {
deviceType: "desktop",
platform: "generic"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"view-header-toolbar": [{
animation: "ios7-toolbar"
}, {
animation: "slide",
device: {
grade: "B"
}
}, {
animation: "none",
device: {
grade: "C"
}
}]
},
"default": {
"layout-change": [{
animation: "none"
}, {
animation: "ios7-slide",
device: {
platform: "ios"
}
}, {
animation: "pop",
device: {
platform: "android"
}
}, {
animation: "openDoor",
device: {
deviceType: "phone",
platform: "win",
version: [8]
}
}, {
animation: "win-pop",
device: {
deviceType: "phone",
platform: "win"
}
}],
"view-content-change": [{
animation: "slide"
}, {
animation: "ios7-slide",
device: {
platform: "ios"
}
}, {
animation: "fade",
device: {
deviceType: "desktop",
platform: "generic"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"view-content-rendered": [{
animation: "fade"
}, {
animation: "none",
device: {
grade: "C"
}
}],
"view-header-toolbar": [{
animation: "ios7-toolbar"
}, {
animation: "slide",
device: {
grade: "B"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"command-rendered-top": [{
animation: "stagger-fade-drop"
}, {
animation: "fade",
device: {
grade: "B"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}, {
animation: "none",
device: {
platform: "win",
version: [10]
}
}],
"command-rendered-bottom": [{
animation: "stagger-fade-rise"
}, {
animation: "fade",
device: {
grade: "B"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}, {
animation: "none",
device: {
platform: "win",
version: [10]
}
}],
"list-item-rendered": [{
animation: "stagger-3d-drop",
device: {
grade: "A"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"detail-item-rendered": [{
animation: "stagger-3d-drop",
device: {
grade: "A"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"edit-item-rendered": [{
animation: "stagger-3d-drop",
device: {
grade: "A"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}]
},
slide: {
"view-content-change": [{
animation: "slide"
}, {
animation: "ios7-slide",
device: {
platform: "ios"
}
}, {
animation: "fade",
device: {
deviceType: "desktop",
platform: "generic"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"view-content-rendered": [{
animation: "fade"
}, {
animation: "none",
device: {
grade: "C"
}
}],
"view-header-toolbar": [{
animation: "ios7-toolbar"
}, {
animation: "slide",
device: {
grade: "B"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"command-rendered-top": [{
animation: "stagger-fade-drop"
}, {
animation: "fade",
device: {
grade: "B"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"command-rendered-bottom": [{
animation: "stagger-fade-rise"
}, {
animation: "fade",
device: {
grade: "B"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"list-item-rendered": [{
animation: "stagger-fade-slide",
device: {
grade: "A"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"detail-item-rendered": [{
animation: "stagger-fade-slide",
device: {
grade: "A"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"edit-item-rendered": [{
animation: "stagger-fade-slide",
device: {
grade: "A"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}]
},
zoom: {
"view-content-change": [{
animation: "slide"
}, {
animation: "ios7-slide",
device: {
platform: "ios"
}
}, {
animation: "fade",
device: {
deviceType: "desktop",
platform: "generic"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"view-content-rendered": [{
animation: "fade"
}, {
animation: "none",
device: {
grade: "C"
}
}],
"view-header-toolbar": [{
animation: "ios7-toolbar"
}, {
animation: "slide",
device: {
grade: "B"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"command-rendered-top": [{
animation: "stagger-fade-zoom"
}, {
animation: "fade",
device: {
grade: "B"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"command-rendered-bottom": [{
animation: "stagger-fade-zoom"
}, {
animation: "fade",
device: {
grade: "B"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"list-item-rendered": [{
animation: "stagger-fade-zoom",
device: {
grade: "A"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"detail-item-rendered": [{
animation: "stagger-fade-zoom",
device: {
grade: "A"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}],
"edit-item-rendered": [{
animation: "stagger-fade-zoom",
device: {
grade: "A"
}
}, {
animation: "fade",
device: {
deviceType: "desktop"
}
}, {
animation: "none",
device: {
grade: "C"
}
}]
}
}
},
/*!***************************************************!*\
!*** ./Scripts/framework/html/command_manager.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
errors = __webpack_require__( /*! ../errors */ 122),
CommandMapping = __webpack_require__( /*! ../command_mapping */ 136),
commandToDXWidgetAdapters = __webpack_require__( /*! ./widget_command_adapters */ 140);
__webpack_require__( /*! ../command */ 121);
__webpack_require__( /*! ./command_container */ 126);
var CommandManager = Class.inherit({
ctor: function(options) {
options = options || {};
this.defaultWidgetAdapter = options.defaultWidgetAdapter || this._getDefaultWidgetAdapter();
this.commandMapping = options.commandMapping || new CommandMapping
},
_getDefaultWidgetAdapter: function() {
return {
addCommand: $.noop,
clearContainer: $.noop
}
},
_getContainerAdapter: function($container) {
var componentNames = $container.data("dxComponents"),
adapters = commandToDXWidgetAdapters;
if (componentNames) {
for (var index in componentNames) {
var widgetName = componentNames[index];
if (widgetName in adapters) {
return adapters[widgetName]
}
}
}
return this.defaultWidgetAdapter
},
findCommands: function($view) {
var result = $.map($view.addBack().find(".dx-command"), function(element) {
return $(element).dxCommand("instance")
});
return result
},
findCommandContainers: function($markup) {
var result = $.map($markup.find(".dx-command-container"), function(element) {
return $(element).dxCommandContainer("instance")
});
return result
},
_checkCommandId: function(id, command) {
if (null === id) {
throw errors.Error("E3010", command.element().get(0).outerHTML)
}
},
renderCommandsToContainers: function(commands, containers) {
var that = this,
commandHash = {},
commandIds = [],
deferreds = [];
$.each(commands, function(i, command) {
var id = command.option("id");
that._checkCommandId(id, command);
commandIds.push(id);
commandHash[id] = command
});
that.commandMapping.checkCommandsExist(commandIds);
$.each(containers, function(k, container) {
var commandInfos = [];
$.each(commandHash, function(id, command) {
var commandId = id;
var commandOptions = that.commandMapping.getCommandMappingForContainer(commandId, container.option("id"));
if (commandOptions) {
commandInfos.push({
command: command,
options: commandOptions
})
}
});
if (commandInfos.length) {
var deferred = that._attachCommandsToContainer(container.element(), commandInfos);
if (deferred) {
deferreds.push(deferred)
}
}
});
return $.when.apply($, deferreds)
},
clearContainer: function(container) {
var $container = container.element(),
adapter = this._getContainerAdapter($container);
adapter.clearContainer($container)
},
_arrangeCommandsToContainers: function(commands, containers) {
errors.log("W0002", "CommandManager", "_arrangeCommandsToContainers", "14.1", "Use the 'renderCommandsToContainers' method instead.");
this.renderCommandsToContainers(commands, containers)
},
_attachCommandsToContainer: function($container, commandInfos) {
var result, adapter = this._getContainerAdapter($container);
if (adapter.beginUpdate) {
adapter.beginUpdate($container)
}
$.each(commandInfos, function(index, commandInfo) {
adapter.addCommand($container, commandInfo.command, commandInfo.options)
});
if (adapter.endUpdate) {
result = adapter.endUpdate($container)
}
return result
}
});
module.exports = CommandManager
},
/*!***********************************************************!*\
!*** ./Scripts/framework/html/widget_command_adapters.js ***!
\***********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
commandToContainer = __webpack_require__( /*! ../utils */ 131).utils.commandToContainer,
fx = __webpack_require__( /*! ../../animation/fx */ 59),
TransitionExecutorModule = __webpack_require__( /*! ../../animation/transition_executor/transition_executor */ 63),
DX_COMMAND_TO_WIDGET_ADAPTER = "dxCommandToWidgetAdapter";
var WidgetItemWrapperBase = Class.inherit({
ctor: function(command, containerOptions) {
this.command = command;
this.widgetItem = this._createWidgetItem(command, containerOptions)
},
_createWidgetItem: function(command, containerOptions) {
var result, itemOptions = $.extend({}, containerOptions, command.option()),
executeCommandCallback = function(e) {
command.execute(e)
};
itemOptions.text = commandToContainer.resolveTextValue(command, containerOptions);
itemOptions.icon = commandToContainer.resolveIconValue(command, containerOptions);
itemOptions.type = commandToContainer.resolvePropertyValue(command, containerOptions, "type");
itemOptions.location = commandToContainer.resolvePropertyValue(command, containerOptions, "location");
itemOptions.locateInMenu = commandToContainer.resolvePropertyValue(command, containerOptions, "locateInMenu");
result = this._createWidgetItemCore(itemOptions, executeCommandCallback);
result.command = command;
return result
},
_createWidgetItemCore: function(itemOptions, executeCommandCallback) {
return itemOptions
},
dispose: function() {
delete this.command;
delete this.widgetItem
}
});
var WidgetAdapterBase = Class.inherit({
ctor: function($widgetElement) {
this._commandToWidgetItemOptionNames = {};
this.$widgetElement = $widgetElement;
this.$widgetElement.data(DX_COMMAND_TO_WIDGET_ADAPTER, this);
this.widget = this._getWidgetByElement($widgetElement);
this._widgetWidgetContentReadyHandler = $.proxy(this._onWidgetContentReady, this);
this._widgetWidgetItemRenderedHandler = $.proxy(this._onWidgetItemRendered, this);
this._widgetDisposingHandler = $.proxy(this._onWidgetDisposing, this);
this.widget.on("itemRendered", this._widgetWidgetItemRenderedHandler);
this.widget.on("contentReady", this._widgetWidgetContentReadyHandler);
this.widget.on("disposing", this._widgetDisposingHandler);
this.itemWrappers = [];
this._transitionExecutor = new TransitionExecutorModule.TransitionExecutor
},
addCommand: function(command, containerOptions) {
var itemWrapper = this._createItemWrapper(command, containerOptions);
this.itemWrappers.push(itemWrapper);
this._addItemToWidget(itemWrapper);
this._commandChangedHandler = $.proxy(this._onCommandChanged, this);
itemWrapper.command.on("optionChanged", this._commandChangedHandler)
},
beginUpdate: function() {
this.widget.beginUpdate()
},
endUpdate: function() {
this.widget.endUpdate();
return this.animationDeferred
},
_onWidgetItemRendered: function(e) {
if (e.itemData.isJustAdded && e.itemData.command && e.itemData.command.option("visible") && this._commandRenderedAnimation) {
this._transitionExecutor.enter(e.itemElement, this._commandRenderedAnimation);
delete e.itemData.isJustAdded
}
},
_onWidgetContentReady: function(e) {
this.animationDeferred = this._transitionExecutor.start()
},
_onWidgetDisposing: function() {
this.dispose(true)
},
_setWidgetItemOption: function(optionName, optionValue, itemCommand) {
var items = this.widget.option("items"),
itemIndex = $.inArray(itemCommand, $.map(items, function(item) {
return item.command || {}
}));
if (itemIndex > -1) {
var optionPath = "items[" + itemIndex + "].";
if (!this._requireWidgetRefresh(optionName) && this.widget.option("items[" + itemIndex + "]").options) {
optionPath += "options."
}
optionPath += this._commandToWidgetItemOptionNames[optionName] || optionName;
this.widget.option(optionPath, optionValue)
}
},
_requireWidgetRefresh: function(optionName) {
return "visible" === optionName || "locateInMenu" === optionName || "location" === optionName
},
_onCommandChanged: function(args) {
if ("highlighted" === args.name || args.component.isOptionDeprecated(args.name)) {
return
}
this._setWidgetItemOption(args.name, args.value, args.component)
},
_addItemToWidget: function(itemWrapper) {
var items = this.widget.option("items");
items.push(itemWrapper.widgetItem);
if (this.widget.element().is(":visible")) {
itemWrapper.widgetItem.isJustAdded = true
}
this.widget.option("items", items)
},
refresh: function() {
var items = this.widget.option("items");
this.widget.option("items", items)
},
clear: function(widgetDisposing) {
var that = this;
$.each(that.itemWrappers, function(index, itemWrapper) {
itemWrapper.command.off("optionChanged", that._commandChangedHandler);
itemWrapper.dispose()
});
this.itemWrappers.length = 0;
if (!widgetDisposing) {
this._clearWidgetItems()
}
},
_clearWidgetItems: function() {
this.widget.option("items", [])
},
dispose: function(widgetDisposing) {
this.clear(widgetDisposing);
if (this.widget) {
this.widget.off("itemRendered", this._widgetWidgetItemRenderedHandler);
this.widget.off("contentReady", this._widgetContentReadyHandler);
this.widget.off("disposing", this._widgetDisposingHandler);
this.$widgetElement.removeData(DX_COMMAND_TO_WIDGET_ADAPTER);
delete this.widget;
delete this.$widgetElement
}
}
});
var CommandToWidgetAdapter = Class.inherit({
ctor: function(createAdapter) {
this.createAdapter = createAdapter
},
_getWidgetAdapter: function($container) {
var widgetAdapter = $container.data(DX_COMMAND_TO_WIDGET_ADAPTER);
if (!widgetAdapter) {
widgetAdapter = this.createAdapter($container)
}
return widgetAdapter
},
addCommand: function($container, command, containerOptions) {
var widgetAdapter = this._getWidgetAdapter($container);
widgetAdapter.addCommand(command, containerOptions)
},
clearContainer: function($container) {
var widgetAdapter = this._getWidgetAdapter($container);
widgetAdapter.clear()
},
beginUpdate: function($container) {
var widgetAdapter = this._getWidgetAdapter($container);
widgetAdapter.beginUpdate()
},
endUpdate: function($container) {
var widgetAdapter = this._getWidgetAdapter($container);
return widgetAdapter.endUpdate()
}
});
var dxToolbarItemWrapper = WidgetItemWrapperBase.inherit({
_createWidgetItemCore: function(itemOptions, executeCommandCallback) {
var widgetItem;
itemOptions.onClick = executeCommandCallback;
if ("menu" === itemOptions.location || "always" === itemOptions.locateInMenu) {
widgetItem = itemOptions
} else {
widgetItem = {
locateInMenu: itemOptions.locateInMenu,
location: itemOptions.location,
visible: itemOptions.visible,
options: itemOptions,
widget: "dxButton"
};
itemOptions.visible = true;
delete itemOptions.location
}
return widgetItem
}
});
var dxToolbarAdapter = WidgetAdapterBase.inherit({
ctor: function($widgetElement) {
this.callBase($widgetElement);
this._commandToWidgetItemOptionNames = {
title: "text"
};
if ("topToolbar" === this.widget.option("renderAs")) {
this._commandRenderedAnimation = "command-rendered-top"
} else {
this._commandRenderedAnimation = "command-rendered-bottom"
}
},
_getWidgetByElement: function($element) {
return $element.dxToolbar("instance")
},
_createItemWrapper: function(command, containerOptions) {
return new dxToolbarItemWrapper(command, containerOptions)
},
addCommand: function(command, containerOptions) {
this.widget.option("visible", true);
this.callBase(command, containerOptions)
}
});
var dxListItemWrapper = WidgetItemWrapperBase.inherit({
_createWidgetItemCore: function(itemOptions, executeCommandCallback) {
itemOptions.title = itemOptions.text;
itemOptions.onClick = executeCommandCallback;
return itemOptions
}
});
var dxListAdapter = WidgetAdapterBase.inherit({
_createItemWrapper: function(command, containerOptions) {
return new dxListItemWrapper(command, containerOptions)
},
_getWidgetByElement: function($element) {
return $element.dxList("instance")
}
});
var dxNavBarItemWrapper = WidgetItemWrapperBase.inherit({});
var dxNavBarAdapter = WidgetAdapterBase.inherit({
ctor: function($widgetElement) {
this.callBase($widgetElement);
this._commandToWidgetItemOptionNames = {
title: "text"
};
this.widget.option("onItemClick", $.proxy(this._onNavBarItemClick, this))
},
_onNavBarItemClick: function(e) {
var items = this.widget.option("items");
for (var i = items.length; --i;) {
items[i].command.option("highlighted", false)
}
e.itemData.command.execute(e)
},
_getWidgetByElement: function($element) {
return $element.dxNavBar("instance")
},
_createItemWrapper: function(command, containerOptions) {
return new dxNavBarItemWrapper(command, containerOptions)
},
addCommand: function(command, containerOptions) {
this.callBase(command, containerOptions);
this._updateSelectedIndex()
},
_onCommandChanged: function(args) {
var optionName = args.name,
newValue = args.value;
if ("highlighted" === optionName && newValue) {
this._updateSelectedIndex()
}
this.callBase(args)
},
_updateSelectedIndex: function() {
var items = this.widget.option("items");
for (var i = 0, itemsCount = items.length; i < itemsCount; i++) {
var command = items[i].command;
if (command && command.option("highlighted")) {
this.widget.option("selectedIndex", i);
break
}
}
}
});
var dxPivotItemWrapper = WidgetItemWrapperBase.inherit({
_createWidgetItemCore: function(itemOptions, executeCommandCallback) {
itemOptions.title = itemOptions.text;
return itemOptions
}
});
var dxPivotAdapter = WidgetAdapterBase.inherit({
ctor: function($widgetElement) {
this.callBase($widgetElement);
this.widget.option("onSelectionChanged", $.proxy(this._onPivotSelectionChange, this))
},
_onPivotSelectionChange: function(e) {
if (e.addedItems.length && e.removedItems.length && e.addedItems[0] && e.addedItems[0].command) {
e.addedItems[0].command.execute(e)
}
},
_getWidgetByElement: function($element) {
return $element.dxPivot("instance")
},
_createItemWrapper: function(command, containerOptions) {
return new dxPivotItemWrapper(command, containerOptions)
},
addCommand: function(command, containerOptions) {
this.callBase(command, containerOptions);
this._updateSelectedIndex()
},
_onCommandChanged: function(args) {
var optionName = args.name,
newValue = args.value;
if ("visible" === optionName) {
this._rerenderPivot()
} else {
if ("highlighted" === optionName && newValue) {
this._updateSelectedIndex()
}
}
this.callBase(args)
},
_addItemToWidget: function(itemWrapper) {
if (itemWrapper.command.option("visible")) {
this.callBase(itemWrapper)
}
},
_updateSelectedIndex: function() {
var pivot = this.widget,
items = pivot.option("items") || [];
fx.off = true;
for (var i = 0, itemsCount = items.length; i < itemsCount; i++) {
var command = items[i].command;
if (command && command.option("highlighted")) {
pivot.option("selectedIndex", i);
break
}
}
fx.off = false
},
_rerenderPivot: function() {
var that = this;
that.widget.option("items", []);
$.each(that.itemWrappers, function(index, itemWrapper) {
if (itemWrapper.command.option("visible")) {
that._addItemToWidget(itemWrapper)
}
});
that.refresh();
that._updateSelectedIndex()
}
});
var dxSlideOutItemWrapper = WidgetItemWrapperBase.inherit({});
var dxSlideOutAdapter = WidgetAdapterBase.inherit({
ctor: function($widgetElement) {
this.callBase($widgetElement);
this._commandToWidgetItemOptionNames = {
title: "text"
};
this.widget.option("onItemClick", $.proxy(this._onSlideOutItemClick, this))
},
_onSlideOutItemClick: function(e) {
e.itemData.command.execute(e)
},
_getWidgetByElement: function($element) {
return $element.dxSlideOut("instance")
},
_createItemWrapper: function(command, containerOptions) {
return new dxSlideOutItemWrapper(command, containerOptions)
},
_updateSelectedIndex: function() {
var items = this.widget.option("items") || [];
for (var i = 0, itemsCount = items.length; i < itemsCount; i++) {
var command = items[i].command;
if (command && command.option("highlighted")) {
this.widget.option("selectedIndex", i);
break
}
}
},
addCommand: function(command, containerOptions) {
this.callBase(command, containerOptions);
this._updateSelectedIndex()
},
_onCommandChanged: function(args) {
var optionName = args.name,
newValue = args.value;
if ("highlighted" === optionName && newValue) {
this._updateSelectedIndex()
}
this.callBase(args)
}
});
exports.dxToolbar = new CommandToWidgetAdapter(function($widgetElement) {
return new dxToolbarAdapter($widgetElement)
});
exports.dxList = new CommandToWidgetAdapter(function($widgetElement) {
return new dxListAdapter($widgetElement)
});
exports.dxNavBar = new CommandToWidgetAdapter(function($widgetElement) {
return new dxNavBarAdapter($widgetElement)
});
exports.dxPivot = new CommandToWidgetAdapter(function($widgetElement) {
return new dxPivotAdapter($widgetElement)
});
exports.dxSlideOut = new CommandToWidgetAdapter(function($widgetElement) {
return new dxSlideOutAdapter($widgetElement)
});
exports.WidgetItemWrapperBase = WidgetItemWrapperBase;
exports.WidgetAdapterBase = WidgetAdapterBase
},
/*!***********************************************!*\
!*** ./Scripts/framework/html/view_engine.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
version = __webpack_require__( /*! ../../core/version */ 16),
Class = __webpack_require__( /*! ../../core/class */ 20),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
errors = __webpack_require__( /*! ../errors */ 122),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50),
_VIEW_ROLE = "dxView",
_LAYOUT_ROLE = "dxLayout",
MARKUP_TEMPLATE_MARKER = "MarkupTemplate:";
__webpack_require__( /*! ./view_engine_components */ 128);
var ViewEngine = Class.inherit({
ctor: function(options) {
options = options || {};
this.$root = options.$root;
this.device = options.device || {};
this.dataOptionsAttributeName = options.dataOptionsAttributeName || "data-options";
this._templateMap = {};
this._pendingViewContainer = null;
this.markupLoaded = $.Callbacks();
this._templateContext = options.templateContext;
this._$skippedMarkup = $();
if (void 0 !== options.templatesVersion && options.templateCacheStorage && this._isReleaseVersion()) {
this._templateCacheEnabled = true;
this._templatesVersion = "v_" + options.templatesVersion;
this._templateCacheStorage = options.templateCacheStorage;
this._templateCacheKey = "dxTemplateCache_" + version + "_" + JSON.stringify(this.device)
}
},
_isReleaseVersion: function() {
return !/http:\/\/localhost/.test(location.href)
},
_enumerateTemplates: function(processFn) {
var that = this;
$.each(that._templateMap, function(name, templatesByRoleMap) {
$.each(templatesByRoleMap, function(role, templates) {
$.each(templates, function(index, template) {
processFn(template)
})
})
})
},
_findComponent: function(name, role) {
var components = (this._templateMap[name] || {})[role] || [],
filter = this._templateContext && this._templateContext.option() || {};
components = this._filterTemplates(filter, components);
this._checkMatchedTemplates(components);
return components[0]
},
_findTemplate: function(name, role) {
var component = this._findComponent(name, role);
if (!component) {
this._clearCache();
throw errors.Error("E3013", role, name)
}
var $result, $template = component.element();
if (!component._isStaticComponentsCreated) {
domUtils.createComponents($template, ["dxContent", "dxContentPlaceholder", "dxTransition"]);
component._isStaticComponentsCreated = true
}
$result = $template.clone().removeClass("dx-hidden");
return $result
},
_clearCache: function() {
this._templateCacheStorage.removeItem(this._templateCacheKey)
},
_loadTemplatesFromMarkupCore: function($markup) {
var that = this;
if ($markup.find("[data-dx-role]").length) {
throw errors.Error("E3019")
}
that.markupLoaded.fire({
markup: $markup
});
var components = domUtils.createComponents($markup, [_VIEW_ROLE, _LAYOUT_ROLE]);
$.each(components, function(index, component) {
var $element = component.element();
$element.addClass("dx-hidden");
that._registerTemplateComponent(component);
component.element().detach()
});
var $skipped = $markup.filter("script");
$skipped.appendTo(that.$root);
that._$skippedMarkup = that._$skippedMarkup.add($skipped)
},
_registerTemplateComponent: function(component) {
var role = component.NAME,
options = component.option(),
templateName = options.name,
componentsByRoleMap = this._templateMap[templateName] || {};
componentsByRoleMap[role] = componentsByRoleMap[role] || [];
componentsByRoleMap[role].push(component);
this._templateMap[templateName] = componentsByRoleMap
},
_applyPartialViews: function($render) {
var that = this;
domUtils.createComponents($render, ["dxViewPlaceholder"]);
$.each($render.find(".dx-view-placeholder"), function() {
var $partialPlaceholder = $(this);
if ($partialPlaceholder.children().length) {
return
}
var viewName = $partialPlaceholder.data("dxViewPlaceholder").option("viewName"),
$view = that._findTemplate(viewName, _VIEW_ROLE);
that._applyPartialViews($view);
$partialPlaceholder.append($view);
$view.removeClass("dx-hidden")
})
},
_ajaxImpl: function() {
return $.ajax.apply($, arguments)
},
_loadTemplatesFromURL: function(url) {
var that = this,
options = this._getLoadOptions(),
deferred = $.Deferred();
url = options.winPhonePrefix + url;
this._ajaxImpl({
url: url,
isLocal: options.isLocal,
dataType: "html"
}).done(function(data) {
that._loadTemplatesFromMarkupCore(domUtils.createMarkupFromString(data));
deferred.resolve()
}).fail(function(jqXHR, textStatus, errorThrown) {
var error = errors.Error("E3021", url, errorThrown);
deferred.reject(error)
});
return deferred.promise()
},
_getLoadOptions: function() {
if (location.protocol.indexOf("wmapp") >= 0) {
return {
winPhonePrefix: location.protocol + "www/",
isLocal: true
}
}
return {
winPhonePrefix: "",
isLocal: void 0
}
},
_loadExternalTemplates: function() {
var tasks = [],
that = this;
$("head").find("link[rel='dx-template']").each(function(index, link) {
var task = that._loadTemplatesFromURL($(link).attr("href"));
tasks.push(task)
});
return $.when.apply($, tasks)
},
_processTemplates: function() {
var that = this;
$.each(that._templateMap, function(name, templatesByRoleMap) {
$.each(templatesByRoleMap, function(role, templates) {
that._filterTemplatesByDevice(templates)
})
});
that._enumerateTemplates(function(template) {
that._applyPartialViews(template.element())
})
},
_filterTemplatesByDevice: function(components) {
var filteredComponents = this._filterTemplates(this.device, components);
$.each(components, function(index, component) {
if ($.inArray(component, filteredComponents) < 0) {
component.element().remove()
}
});
components.length = 0;
components.push.apply(components, filteredComponents)
},
_filterTemplates: function(filter, components) {
return commonUtils.findBestMatches(filter, components, function(component) {
return component.option()
})
},
_checkMatchedTemplates: function(bestMatches) {
if (bestMatches.length > 1) {
var message = "";
$.each(bestMatches, function(index, match) {
message += match.element().attr("data-options") + "\r\n"
});
throw errors.Error("E3020", message, JSON.stringify(this.device))
}
},
_wrapViewDefaultContent: function($viewTemplate) {
$viewTemplate.wrapInner('
');
$viewTemplate.children().eq(0).dxContent({
targetPlaceholder: "content"
})
},
_initDefaultLayout: function() {
this._$defaultLayoutTemplate = $('
');
domUtils.createComponents(this._$defaultLayoutTemplate)
},
_getDefaultLayoutTemplate: function() {
return this._$defaultLayoutTemplate.clone()
},
applyLayout: function($view, $layout) {
if (void 0 === $layout || 0 === $layout.length) {
$layout = this._getDefaultLayoutTemplate()
}
if (0 === $view.children(".dx-content").length) {
this._wrapViewDefaultContent($view)
}
var $toMerge = $().add($layout).add($view);
var $placeholderContents = $toMerge.find(".dx-content");
$.each($placeholderContents, function() {
var $placeholderContent = $(this);
var placeholderId = $placeholderContent.attr("data-dx-target-placeholder-id");
var $placeholder = $toMerge.find(".dx-content-placeholder-" + placeholderId);
$placeholder.empty();
$placeholder.append($placeholderContent)
});
$placeholderContents.filter(":not(.dx-content-placeholder .dx-content)").remove();
return $layout
},
_loadTemplatesFromCache: function() {
if (!this._templateCacheEnabled) {
return
}
var cache;
var fromJSONInterceptor = function(key, value) {
if ("string" === typeof value && 0 === value.indexOf(MARKUP_TEMPLATE_MARKER)) {
var data = JSON.parse(value.substr(MARKUP_TEMPLATE_MARKER.length)),
type = data.type,
options = data.options,
$markup = domUtils.createMarkupFromString(data.markup);
options.fromCache = true;
return $markup[type](options)[type]("instance")
} else {
if ("skippedMarkup" === key) {
return $("
").append(domUtils.createMarkupFromString(value)).contents()
}
}
return value
};
var toParse = this._templateCacheStorage.getItem(this._templateCacheKey);
if (toParse) {
try {
var cacheContainer = JSON.parse(toParse, fromJSONInterceptor);
cache = cacheContainer[this._templatesVersion]
} catch (e) {
this._clearCache()
}
}
if (!cache) {
return
}
this._templateMap = cache.templates;
this.$root.append(cache.skippedMarkup);
return true
},
_putTemplatesToCache: function() {
if (!this._templateCacheEnabled) {
return
}
var toJSONInterceptor = function(key, value) {
if (value && value.element) {
return MARKUP_TEMPLATE_MARKER + JSON.stringify({
markup: value.element().prop("outerHTML"),
options: value.option(),
type: value.NAME
})
} else {
if ("skippedMarkup" === key) {
return $("
").append(value.clone()).html()
}
}
return value
};
var cacheContainer = {};
cacheContainer[this._templatesVersion] = {
templates: this._templateMap,
skippedMarkup: this._$skippedMarkup
};
this._templateCacheStorage.setItem(this._templateCacheKey, JSON.stringify(cacheContainer, toJSONInterceptor, 4))
},
init: function() {
var that = this;
this._initDefaultLayout();
if (!this._loadTemplatesFromCache()) {
that._loadTemplatesFromMarkupCore(that.$root.children());
return this._loadExternalTemplates().done(function() {
that._processTemplates();
that._putTemplatesToCache()
})
} else {
return $.Deferred().resolve().promise()
}
},
getViewTemplate: function(viewName) {
return this._findTemplate(viewName, _VIEW_ROLE)
},
getViewTemplateInfo: function(name) {
return this._findComponent(name, _VIEW_ROLE)
},
getLayoutTemplate: function(layoutName) {
if (!layoutName) {
return this._getDefaultLayoutTemplate()
}
return this._findTemplate(layoutName, _LAYOUT_ROLE)
},
getLayoutTemplateInfo: function(name) {
return this._findComponent(name, _LAYOUT_ROLE)
},
loadTemplates: function(source) {
var result;
if ("string" === typeof source) {
result = this._loadTemplatesFromURL(source)
} else {
this._loadTemplatesFromMarkupCore(source);
result = $.Deferred().resolve().promise()
}
return result.done($.proxy(this._processTemplates, this))
}
});
exports.ViewEngine = ViewEngine
},
/*!*****************************************************!*\
!*** ./Scripts/framework/html/layout_controller.js ***!
\*****************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
frameworkUtils = __webpack_require__( /*! ../utils */ 131),
layoutSets = __webpack_require__( /*! ./presets */ 138).layoutSets,
EventsMixin = __webpack_require__( /*! ../../core/events_mixin */ 39),
errors = __webpack_require__( /*! ../errors */ 122),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50),
HIDDEN_BAG_ID = "__hidden-bag",
TRANSITION_SELECTOR = ".dx-transition:not(.dx-transition .dx-transition)",
CONTENT_SELECTOR = ".dx-content",
DEFAULT_COMMAND_RENDER_STAGE = "onViewShown",
CONTENT_RENDERED_EVENT_NAME = "dxcontentrendered.layoutController",
PENDING_RENDERING_SELECTOR = ".dx-pending-rendering",
PENDING_RENDERING_MANUAL_SELECTOR = ".dx-pending-rendering-manual",
TransitionExecutorModule = __webpack_require__( /*! ../../animation/transition_executor/transition_executor */ 63);
__webpack_require__( /*! ./command_container */ 126);
__webpack_require__( /*! ./view_engine_components */ 128);
var transitionSelector = function(transitionName) {
return ".dx-transition-" + transitionName
};
var DefaultLayoutController = Class.inherit({
ctor: function(options) {
options = options || {};
this.name = options.name || "";
this._layoutModel = options.layoutModel || {};
this._defaultPaneName = options.defaultPaneName || "content";
this._transitionDuration = void 0 === options.transitionDuration ? 400 : options.transitionDuration;
this._showViewFired = false
},
init: function(options) {
options = options || {};
this._visibleViews = {};
this._$viewPort = options.$viewPort || $("body");
this._commandManager = options.commandManager;
this._viewEngine = options.viewEngine;
this.transitionExecutor = new TransitionExecutorModule.TransitionExecutor;
this._prepareTemplates();
this._$viewPort.append(this.element());
this._hideElements(this.element());
if (options.templateContext) {
this._templateContext = options.templateContext;
this._proxiedTemplateContextChangedHandler = $.proxy(this._templateContextChangedHandler, this)
}
},
ensureActive: function(targetNode) {
if (this._disabledState) {
return this.enable()
} else {
return this.activate(targetNode)
}
},
activate: function() {
this._showViewFired = false;
var $rootElement = this.element();
this._showElements($rootElement);
this._attachRefreshViewRequiredHandler();
return $.Deferred().resolve().promise()
},
deactivate: function() {
this._disabledState = false;
this._showViewFired = false;
this._releaseVisibleViews();
this._hideElements(this.element());
this._detachRefreshViewRequiredHandler();
return $.Deferred().resolve().promise()
},
enable: function() {
this._disabledState = false;
if (!this._showViewFired) {
this._notifyShowing()
}
this._showViewFired = false;
return $.Deferred().resolve().promise()
},
disable: function() {
this._disabledState = true;
this._showViewFired = false;
this._notifyHidden()
},
activeViewInfo: function() {
return this._visibleViews[this._defaultPaneName]
},
_fireViewEvents: function(eventName) {
var that = this;
$.each(this._visibleViews, function(index, viewInfo) {
that.fireEvent(eventName, [viewInfo])
})
},
_notifyShowing: function() {
this._fireViewEvents("viewShowing")
},
_notifyShown: function() {
this._fireViewEvents("viewShown")
},
_notifyHidden: function() {
this._fireViewEvents("viewHidden")
},
_applyTemplate: function($elements, model) {
$elements.each(function(i, element) {
frameworkUtils.templateProvider.applyTemplate(element, model)
})
},
_releaseVisibleViews: function() {
var that = this;
$.each(this._visibleViews, function(index, viewInfo) {
that._hideView(viewInfo);
that._releaseView(viewInfo)
});
this._visibleViews = {}
},
_templateContextChangedHandler: function() {
var that = this;
$.when.apply($, $.map(that._visibleViews, function(viewInfo) {
return that.showView(viewInfo)
})).then(function() {
that._notifyShown()
})
},
_attachRefreshViewRequiredHandler: function() {
if (this._templateContext) {
this._templateContext.on("optionChanged", this._proxiedTemplateContextChangedHandler)
}
},
_detachRefreshViewRequiredHandler: function() {
if (this._templateContextChanged) {
this._templateContext.off("optionChanged", this._proxiedTemplateContextChangedHandler)
}
},
_getPreviousViewInfo: function(viewInfo) {
return this._visibleViews[this._getViewPaneName(viewInfo.viewTemplateInfo)]
},
_prepareTemplates: function() {
var that = this;
var $layoutTemplate = that._viewEngine.getLayoutTemplate(this._getLayoutTemplateName());
that._$layoutTemplate = $layoutTemplate;
that._$mainLayout = that._createEmptyLayout();
that._showElements(that._$mainLayout);
that._applyTemplate(that._$mainLayout, that._layoutModel);
that._$navigationWidget = that._createNavigationWidget()
},
renderNavigation: function(navigationCommands) {
this._clearNavigationWidget();
this._renderNavigationImpl(navigationCommands)
},
_renderNavigationImpl: function(navigationCommands) {
this._renderCommands(this._$mainLayout, navigationCommands)
},
_createNavigationWidget: function() {
var result, containers = this._findCommandContainers(this._$mainLayout);
$.each(containers, function(k, container) {
if ("global-navigation" === container.option("id")) {
result = container.element();
return false
}
});
return result
},
_clearNavigationWidget: function() {
if (this._$navigationWidget) {
this._commandManager.clearContainer(this._$navigationWidget.dxCommandContainer("instance"))
}
},
element: function() {
return this._$mainLayout
},
_getViewFrame: function(viewInfo) {
return this._$mainLayout
},
_getLayoutTemplateName: function() {
return this.name
},
_applyModelToTransitionElements: function($markup, model) {
var that = this;
this._getTransitionElements($markup).each(function(i, item) {
that._applyTemplate($(item).children(), model)
})
},
_createViewLayoutTemplate: function() {
var that = this;
var $viewLayoutTemplate = that._$layoutTemplate.clone();
this._hideElements($viewLayoutTemplate);
return $viewLayoutTemplate
},
_createEmptyLayout: function() {
var that = this;
var $result = that._$layoutTemplate.clone();
this._hideElements($result);
this._getTransitionElements($result).empty();
$result.children(CONTENT_SELECTOR).remove();
return $result
},
_getTransitionElements: function($markup) {
return $markup.find(TRANSITION_SELECTOR).addBack(TRANSITION_SELECTOR)
},
showView: function(viewInfo, direction) {
direction = direction || "forward";
var result, that = this,
previousViewInfo = that._getPreviousViewInfo(viewInfo),
previousViewTemplateId = previousViewInfo === viewInfo ? previousViewInfo.currentViewTemplateId : void 0;
this._showViewFired = true;
this._defineCurrentViewTemplateId(viewInfo);
if (previousViewTemplateId && previousViewTemplateId === viewInfo.currentViewTemplateId && viewInfo === previousViewInfo) {
that.fireEvent("viewShowing", [viewInfo, direction]);
result = $.Deferred().resolve().promise()
} else {
that._ensureViewRendered(viewInfo);
that.fireEvent("viewShowing", [viewInfo, direction]);
result = this._showViewImpl(viewInfo, direction, previousViewTemplateId).done(function() {
that._onViewShown(viewInfo)
})
}
return result
},
disposeView: function(viewInfo) {
this._clearRenderResult(viewInfo)
},
_clearRenderResult: function(viewInfo) {
if (viewInfo.renderResult) {
viewInfo.renderResult.$markup.remove();
viewInfo.renderResult.$viewItems.remove();
delete viewInfo.renderResult
}
},
_renderViewImpl: function($viewTemplate, viewInfo) {
var $viewItems, that = this,
allowedChildrenSelector = ".dx-command,.dx-content,script",
$layout = this._createViewLayoutTemplate(),
isSimplifiedMarkup = true,
outOfContentItems = $();
if (0 === $viewTemplate.children(allowedChildrenSelector).length) {
this._viewEngine._wrapViewDefaultContent($viewTemplate)
}
$viewItems = $viewTemplate.children();
this._applyModelToTransitionElements($layout, viewInfo.model);
this._viewEngine.applyLayout($viewTemplate, $layout);
$viewItems.each(function(i, item) {
var $item = $(item);
that._applyTemplate($item, viewInfo.model);
if ($item.is(allowedChildrenSelector)) {
isSimplifiedMarkup = false
} else {
outOfContentItems = outOfContentItems.add($item)
}
});
if (outOfContentItems.length && !isSimplifiedMarkup) {
throw errors.Error("E3014", outOfContentItems[0].outerHTML)
}
viewInfo.renderResult = viewInfo.renderResult || {};
viewInfo.renderResult.$viewItems = $viewItems;
viewInfo.renderResult.$markup = $layout
},
_renderCommands: function($markup, commands) {
var commandContainers = this._findCommandContainers($markup);
return this._commandManager.renderCommandsToContainers(commands, commandContainers)
},
_prepareViewCommands: function(viewInfo) {
var $viewItems = viewInfo.renderResult.$viewItems,
viewCommands = this._commandManager.findCommands($viewItems),
commandsToRenderMap = {};
viewInfo.commands = frameworkUtils.utils.mergeCommands(viewInfo.commands || [], viewCommands);
viewInfo.commandsToRenderMap = commandsToRenderMap;
$.each(viewInfo.commands, function(index, command) {
var renderStage = command.option("renderStage") || DEFAULT_COMMAND_RENDER_STAGE,
targetArray = commandsToRenderMap[renderStage] = commandsToRenderMap[renderStage] || [];
targetArray.push(command)
})
},
_applyViewCommands: function(viewInfo, renderStage) {
renderStage = renderStage || DEFAULT_COMMAND_RENDER_STAGE;
var result, commandsToRender = viewInfo.commandsToRenderMap[renderStage],
$markup = viewInfo.renderResult.$markup;
if (commandsToRender) {
result = this._renderCommands($markup, commandsToRender);
delete viewInfo.commandsToRenderMap[renderStage]
} else {
result = $.Deferred().resolve().promise()
}
return result
},
_findCommandContainers: function($markup) {
return domUtils.createComponents($markup, ["dxCommandContainer"])
},
_defineCurrentViewTemplateId: function(viewInfo) {
var viewTemplateInstance = viewInfo.$viewTemplate ? viewInfo.$viewTemplate.dxView("instance") : this._viewEngine.getViewTemplateInfo(viewInfo.viewName),
currentViewTemplateId = viewTemplateInstance.getId();
viewInfo.currentViewTemplateId = currentViewTemplateId
},
_ensureViewRendered: function(viewInfo) {
var $cachedMarkup = viewInfo.renderResult && viewInfo.renderResult.markupCache[viewInfo.currentViewTemplateId];
if ($cachedMarkup) {
viewInfo.renderResult.$markup = $cachedMarkup
} else {
this._renderView(viewInfo);
viewInfo.renderResult.markupCache = viewInfo.renderResult.markupCache || {};
viewInfo.renderResult.markupCache[viewInfo.currentViewTemplateId] = viewInfo.renderResult.$markup
}
},
_renderView: function(viewInfo) {
var $viewTemplate = viewInfo.$viewTemplate || this._viewEngine.getViewTemplate(viewInfo.viewName);
this._renderViewImpl($viewTemplate, viewInfo);
this._prepareViewCommands(viewInfo);
this._applyViewCommands(viewInfo, "onViewRendering");
this._appendViewToLayout(viewInfo);
$viewTemplate.remove();
this._onRenderComplete(viewInfo);
this.fireEvent("viewRendered", [viewInfo])
},
_prepareTransition: function($element, targetPlaceholderName) {
if (0 === $element.children(".dx-content").length) {
$element.wrapInner("
");
$element.children().dxContent({
targetPlaceholder: targetPlaceholderName
})
}
},
_appendViewToLayout: function(viewInfo) {
var that = this,
$viewFrame = that._getViewFrame(viewInfo),
$markup = viewInfo.renderResult.$markup,
$transitionContentElements = $(),
animationItems = [];
$.each($markup.find(".dx-content-placeholder"), function(index, el) {
that._prepareTransition($(el), $(el).attr("data-dx-content-placeholder-name"))
});
$.each(that._getTransitionElements($viewFrame), function(index, transitionElement) {
var $transition = $(transitionElement),
$viewElement = $markup.find(transitionSelector($transition.attr("data-dx-transition-name"))).children(),
animationItem = {
$element: $viewElement,
animation: $transition.attr("data-dx-transition-type")
};
animationItems.push(animationItem);
$transition.append($viewElement);
that._showViewElements($viewElement);
domUtils.triggerShownEvent($viewElement);
$transitionContentElements = $transitionContentElements.add($viewElement)
});
that._$mainLayout.append(viewInfo.renderResult.$viewItems.filter(".dx-command"));
$markup.remove();
viewInfo.renderResult.$markup = $transitionContentElements;
viewInfo.renderResult.animationItems = animationItems
},
_onRenderComplete: function(viewInfo) {},
_onViewShown: function(viewInfo) {
$(document).trigger("dx.viewchanged")
},
_enter: function(animationItems, animationModifier) {
var transitionExecutor = this.transitionExecutor;
$.each(animationItems, function(index, item) {
transitionExecutor.enter(item.$element, item.animation, animationModifier)
})
},
_leave: function(animationItems, animationModifier) {
var transitionExecutor = this.transitionExecutor;
$.each(animationItems, function(index, item) {
transitionExecutor.leave(item.$element, item.animation, animationModifier)
})
},
_doTransition: function(oldViewInfo, newViewInfo, animationModifier) {
if (oldViewInfo) {
this._leave(oldViewInfo.renderResult.animationItems, animationModifier)
}
this._enter(newViewInfo.renderResult.animationItems, animationModifier);
this._showView(newViewInfo);
return this.transitionExecutor.start()
},
_showViewImpl: function(viewInfo, direction, previousViewTemplateId) {
var result, that = this,
previousViewInfo = this._getPreviousViewInfo(viewInfo),
animationModifier = {
direction: direction
};
if (previousViewInfo === viewInfo) {
previousViewInfo = void 0
}
if (!previousViewInfo) {
animationModifier.duration = 0;
animationModifier.delay = 0
}
result = that._doTransition(previousViewInfo, viewInfo, animationModifier).then(function() {
return that._changeView(viewInfo, previousViewTemplateId)
});
return result
},
_releaseView: function(viewInfo) {
this.fireEvent("viewReleased", [viewInfo])
},
_getReadyForRenderDeferredItems: function(viewInfo) {
return $.Deferred().resolve().promise()
},
_changeView: function(viewInfo, previousViewTemplateId) {
var that = this;
if (previousViewTemplateId) {
that._hideView(viewInfo, previousViewTemplateId)
} else {
var previousViewInfo = that._getPreviousViewInfo(viewInfo);
if (previousViewInfo && previousViewInfo !== viewInfo) {
that._hideView(previousViewInfo);
that._releaseView(previousViewInfo)
}
this._visibleViews[this._getViewPaneName(viewInfo.viewTemplateInfo)] = viewInfo
}
this._subscribeToDeferredItems(viewInfo);
return this._getReadyForRenderDeferredItems(viewInfo).then(function() {
return that._applyViewCommands(viewInfo)
}).then(function() {
return that._renderDeferredItems(viewInfo.renderResult.$markup)
})
},
_subscribeToDeferredItems: function(viewInfo) {
var that = this,
$markup = viewInfo.renderResult.$markup;
$markup.find(PENDING_RENDERING_SELECTOR).add($markup.filter(PENDING_RENDERING_SELECTOR)).each(function() {
var eventData = {
viewInfo: viewInfo,
context: that
};
$(this).on(CONTENT_RENDERED_EVENT_NAME, eventData, that._onDeferredContentRendered)
})
},
_onDeferredContentRendered: function(event) {
var $element = $(event.target),
viewInfo = event.data.viewInfo,
that = event.data.context;
$element.off(CONTENT_RENDERED_EVENT_NAME, that._onDeferredContentRendered);
that._renderCommands($element, viewInfo.commands)
},
_renderDeferredItems: function($items) {
var that = this,
result = $.Deferred();
var $pendingItem = $items.find(PENDING_RENDERING_MANUAL_SELECTOR).add($items.filter(PENDING_RENDERING_MANUAL_SELECTOR)).first();
if ($pendingItem.length) {
var render = $pendingItem.data("dx-render-delegate");
commonUtils.executeAsync(function() {
render().then(function() {
return that._renderDeferredItems($items)
}).then(function() {
result.resolve()
})
})
} else {
result.resolve()
}
return result.promise()
},
_getViewPaneName: function(viewTemplateInfo) {
return this._defaultPaneName
},
_hideElements: function($elements) {
$elements.addClass("dx-fast-hidden")
},
_showElements: function($elements) {
$elements.removeClass("dx-fast-hidden")
},
_hideViewElements: function($elements) {
this._patchIDs($elements);
this._disableInputs($elements);
$elements.removeClass("dx-active-view").addClass("dx-inactive-view")
},
_hideView: function(viewInfo, templateId) {
if (viewInfo.renderResult) {
var $markupToHide = void 0 === templateId ? viewInfo.renderResult.$markup : viewInfo.renderResult.markupCache[templateId];
this._hideViewElements($markupToHide);
this.fireEvent("viewHidden", [viewInfo])
}
},
_showViewElements: function($elements) {
this._unpatchIDs($elements);
this._enableInputs($elements);
$elements.removeClass("dx-inactive-view").addClass("dx-active-view");
this._skipAnimation($elements)
},
_showView: function(viewInfo) {
if (viewInfo.renderResult) {
this._showViewElements(viewInfo.renderResult.$markup)
}
},
_skipAnimation: function($elements) {
$elements.addClass("dx-skip-animation");
for (var i = 0; i < $elements.length; i++) {
$elements.eq(i).css("transform")
}
$elements.removeClass("dx-skip-animation")
},
_patchIDs: function($markup) {
this._processIDs($markup, function(id) {
var result = id;
if (id.indexOf(HIDDEN_BAG_ID) === -1) {
result = HIDDEN_BAG_ID + "-" + id
}
return result
})
},
_unpatchIDs: function($markup) {
this._processIDs($markup, function(id) {
var result = id;
if (0 === id.indexOf(HIDDEN_BAG_ID)) {
result = id.substr(HIDDEN_BAG_ID.length + 1)
}
return result
})
},
_processIDs: function($markup, process) {
var elementsWithIds = $markup.find("[id]");
$.each(elementsWithIds, function(index, element) {
var $el = $(element),
id = $el.attr("id");
$el.attr("id", process(id))
})
},
_enableInputs: function($markup) {
var $inputs = $markup.find(":input[data-disabled=true]");
$.each($inputs, function(index, input) {
$(input).removeAttr("disabled").removeAttr("data-disabled")
})
},
_disableInputs: function($markup) {
var $inputs = $markup.find(":input:not([disabled], [disabled=true])");
$.each($inputs, function(index, input) {
$(input).attr({
disabled: true,
"data-disabled": true
})
})
}
}).include(EventsMixin);
layoutSets.default = layoutSets.default || [];
layoutSets.default.push({
controller: new DefaultLayoutController
});
exports.DefaultLayoutController = DefaultLayoutController;
exports.layoutSets = layoutSets
},
/*!******************************!*\
!*** ./Scripts/ui/themes.js ***!
\******************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
errors = __webpack_require__( /*! ./widget/ui.errors */ 10),
domUtils = __webpack_require__( /*! ../core/utils/dom */ 50),
devices = __webpack_require__( /*! ../core/devices */ 40),
viewPortUtils = __webpack_require__( /*! ../core/utils/view_port */ 42),
viewPort = viewPortUtils.value,
viewPortChanged = viewPortUtils.changeCallback;
var DX_LINK_SELECTOR = "link[rel=dx-theme]",
THEME_ATTR = "data-theme",
ACTIVE_ATTR = "data-active",
DX_HAIRLINES_CLASS = "dx-hairlines";
var context, $activeThemeLink, knownThemes, currentThemeName, pendingThemeName;
var THEME_MARKER_PREFIX = "dx.";
function readThemeMarker() {
var result, element = $("
", context).addClass("dx-theme-marker").appendTo(context.documentElement);
try {
result = element.css("font-family");
if (!result) {
return null
}
result = result.replace(/["']/g, "");
if (result.substr(0, THEME_MARKER_PREFIX.length) !== THEME_MARKER_PREFIX) {
return null
}
return result.substr(THEME_MARKER_PREFIX.length)
} finally {
element.remove()
}
}
function waitForThemeLoad(themeName, callback) {
var timerId, waitStartTime;
pendingThemeName = themeName;
function handleLoaded() {
pendingThemeName = null;
callback()
}
if (isPendingThemeLoaded()) {
handleLoaded()
} else {
waitStartTime = $.now();
timerId = setInterval(function() {
var isLoaded = isPendingThemeLoaded(),
isTimeout = !isLoaded && $.now() - waitStartTime > 15e3;
if (isTimeout) {
errors.log("W0004", pendingThemeName)
}
if (isLoaded || isTimeout) {
clearInterval(timerId);
handleLoaded()
}
}, 10)
}
}
function isPendingThemeLoaded() {
return !pendingThemeName || readThemeMarker() === pendingThemeName
}
function processMarkup() {
var $allThemeLinks = $(DX_LINK_SELECTOR, context);
if (!$allThemeLinks.length) {
return
}
knownThemes = {};
$activeThemeLink = $(domUtils.createMarkupFromString("
"), context);
$allThemeLinks.each(function() {
var link = $(this, context),
fullThemeName = link.attr(THEME_ATTR),
url = link.attr("href"),
isActive = "true" === link.attr(ACTIVE_ATTR);
knownThemes[fullThemeName] = {
url: url,
isActive: isActive
}
});
$allThemeLinks.last().after($activeThemeLink);
$allThemeLinks.remove()
}
function resolveFullThemeName(desiredThemeName) {
var desiredThemeParts = desiredThemeName.split("."),
result = null;
if (knownThemes) {
$.each(knownThemes, function(knownThemeName, themeData) {
var knownThemeParts = knownThemeName.split(".");
if (knownThemeParts[0] !== desiredThemeParts[0]) {
return
}
if (desiredThemeParts[1] && desiredThemeParts[1] !== knownThemeParts[1]) {
return
}
if (desiredThemeParts[2] && desiredThemeParts[2] !== knownThemeParts[2]) {
return
}
if (!result || themeData.isActive) {
result = knownThemeName
}
if (themeData.isActive) {
return false
}
})
}
return result
}
function initContext(newContext) {
try {
if (newContext !== context) {
knownThemes = null
}
} catch (x) {
knownThemes = null
}
context = newContext
}
function init(options) {
options = options || {};
initContext(options.context || document);
processMarkup();
currentThemeName = void 0;
current(options)
}
function current(options) {
if (!arguments.length) {
currentThemeName = currentThemeName || readThemeMarker();
return currentThemeName
}
detachCssClasses(viewPort(), currentThemeName);
options = options || {};
if ("string" === typeof options) {
options = {
theme: options
}
}
var currentThemeData, isAutoInit = options._autoInit,
loadCallback = options.loadCallback;
currentThemeName = options.theme || currentThemeName;
if (isAutoInit && !currentThemeName) {
currentThemeName = themeNameFromDevice(devices.current())
}
currentThemeName = resolveFullThemeName(currentThemeName);
if (currentThemeName) {
currentThemeData = knownThemes[currentThemeName]
}
if (currentThemeData) {
$activeThemeLink.attr("href", knownThemes[currentThemeName].url);
if (loadCallback) {
waitForThemeLoad(currentThemeName, loadCallback)
} else {
if (pendingThemeName) {
pendingThemeName = currentThemeName
}
}
} else {
if (isAutoInit) {
if (loadCallback) {
loadCallback()
}
} else {
throw errors.Error("E0021", currentThemeName)
}
}
attachCssClasses(viewPortUtils.originalViewPort(), currentThemeName)
}
function themeNameFromDevice(device) {
var themeName = device.platform;
var majorVersion = device.version && device.version[0];
switch (themeName) {
case "ios":
themeName += "7";
break;
case "android":
themeName += "5";
break;
case "win":
themeName += majorVersion && 8 === majorVersion ? "8" : "10"
}
return themeName
}
function getCssClasses(themeName) {
themeName = themeName || current();
var result = [],
themeNameParts = themeName && themeName.split(".");
if (themeNameParts) {
result.push("dx-theme-" + themeNameParts[0], "dx-theme-" + themeNameParts[0] + "-typography");
if (themeNameParts.length > 1) {
result.push("dx-color-scheme-" + themeNameParts[1])
}
}
return result
}
var themeClasses;
function attachCssClasses(element, themeName) {
themeClasses = getCssClasses(themeName).join(" ");
$(element).addClass(themeClasses);
var activateHairlines = function() {
var pixelRatio = window.devicePixelRatio;
if (!pixelRatio || pixelRatio < 2) {
return
}
var $tester = $("
");
$tester.css("border", ".5px solid transparent");
$("body").append($tester);
if (1 === $tester.outerHeight()) {
$(element).addClass(DX_HAIRLINES_CLASS);
themeClasses += " " + DX_HAIRLINES_CLASS
}
$tester.remove()
};
activateHairlines()
}
function detachCssClasses(element, themeName) {
$(element).removeClass(themeClasses)
}
$.holdReady(true);
init({
_autoInit: true,
loadCallback: function() {
$.holdReady(false)
}
});
$(function() {
if ($(DX_LINK_SELECTOR, context).length) {
throw errors.Error("E0022")
}
});
viewPortChanged.add(function(viewPort, prevViewPort) {
detachCssClasses(prevViewPort);
attachCssClasses(viewPort)
});
devices.changed.add(function() {
init({
_autoInit: true
})
});
exports.current = current;
exports.init = init;
exports.attachCssClasses = attachCssClasses;
exports.detachCssClasses = detachCssClasses;
exports.themeNameFromDevice = themeNameFromDevice;
exports.waitForThemeLoad = waitForThemeLoad;
exports.resetTheme = function() {
$activeThemeLink && $activeThemeLink.attr("href", "about:blank");
currentThemeName = null;
pendingThemeName = null
}
},
/*!****************************************!*\
!*** ./Scripts/integration/angular.js ***!
\****************************************/
function(module, exports, __webpack_require__) {
var angular = __webpack_require__( /*! angular */ 145);
if (angular) {
__webpack_require__( /*! ./angular/component_registrator */ 146);
__webpack_require__( /*! ./angular/event_registrator */ 168);
__webpack_require__( /*! ./angular/components */ 169);
__webpack_require__( /*! ./angular/action_executors */ 170)
}
},
/*!*********************************!*\
!*** external "window.angular" ***!
\*********************************/
function(module, exports) {
module.exports = window.angular
},
/*!**************************************************************!*\
!*** ./Scripts/integration/angular/component_registrator.js ***!
\**************************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 43),
Class = __webpack_require__( /*! ../../core/class */ 20),
Locker = __webpack_require__( /*! ../../core/utils/locker */ 113),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50),
Widget = __webpack_require__( /*! ../../ui/widget/ui.widget */ 89),
Editor = __webpack_require__( /*! ../../ui/editor/editor */ 107),
NgTemplateProvider = __webpack_require__( /*! ./template_provider */ 147),
ngModule = __webpack_require__( /*! ./module */ 150),
removeEvent = __webpack_require__( /*! ../../core/remove_event */ 33),
CollectionWidget = __webpack_require__( /*! ../../ui/collection/ui.collection_widget.edit */ 151),
compileSetter = __webpack_require__( /*! ../../core/utils/data */ 36).compileSetter,
compileGetter = __webpack_require__( /*! ../../core/utils/data */ 36).compileGetter,
extendFromObject = __webpack_require__( /*! ../../core/utils/object */ 37).extendFromObject;
var ITEM_ALIAS_ATTRIBUTE_NAME = "dxItemAlias",
DEFAULT_MODEL_ALIAS = "dxTemplateModel",
MODEL_IS_PRIMITIVE_FLAG_NAME = "dxTemplateModelIsPrimitive",
SKIP_APPLY_ACTION_CATEGORIES = ["rendering"];
var safeApply = function(func, scope) {
if (scope.$root.$$phase) {
return func(scope)
} else {
return scope.$apply(function() {
return func(scope)
})
}
};
var ComponentBuilder = Class.inherit({
ctor: function(options) {
this._componentDisposing = $.Callbacks();
this._optionChangedCallbacks = $.Callbacks();
this._ngLocker = new Locker;
this._scope = options.scope;
this._$element = options.$element;
this._$templates = options.$templates;
this._componentClass = options.componentClass;
this._parse = options.parse;
this._compile = options.compile;
this._itemAlias = options.itemAlias;
this._transcludeFn = options.transcludeFn;
this._digestCallbacks = options.dxDigestCallbacks;
this._normalizeOptions(options.ngOptions);
this._initComponentBindings();
this._initComponent(this._scope);
if (options.ngOptions) {
this._triggerResizeEvent()
} else {
this._addOptionsStringWatcher(options.ngOptionsString)
}
},
_addOptionsStringWatcher: function(optionsString) {
var that = this;
var clearOptionsStringWatcher = that._scope.$watch(optionsString, function(newOptions) {
if (!newOptions) {
return
}
clearOptionsStringWatcher();
that._normalizeOptions(newOptions);
that._initComponentBindings();
that._component.option(that._evalOptions(that._scope));
that._triggerResizeEvent()
});
that._componentDisposing.add(clearOptionsStringWatcher)
},
_normalizeOptions: function(options) {
var that = this;
that._ngOptions = extendFromObject({}, options);
if (!options) {
return
}
if (options.bindingOptions) {
$.each(options.bindingOptions, function(key, value) {
if ("string" === $.type(value)) {
that._ngOptions.bindingOptions[key] = {
dataPath: value
}
}
})
}
},
_triggerResizeEvent: function() {
var that = this;
clearTimeout(that._shownEventTimer);
that._shownEventTimer = setTimeout(function() {
domUtils.triggerResizeEvent(that._$element)
});
that._componentDisposing.add(function() {
clearTimeout(that._shownEventTimer)
})
},
_initComponent: function(scope) {
this._component = new this._componentClass(this._$element, this._evalOptions(scope));
this._component._isHidden = true;
this._handleDigestPhase()
},
_handleDigestPhase: function() {
var that = this,
beginUpdate = function() {
that._component.beginUpdate()
},
endUpdate = function() {
that._component.endUpdate()
};
that._digestCallbacks.begin.add(beginUpdate);
that._digestCallbacks.end.add(endUpdate);
that._componentDisposing.add(function() {
that._digestCallbacks.begin.remove(beginUpdate);
that._digestCallbacks.end.remove(endUpdate)
})
},
_initComponentBindings: function() {
var that = this,
optionDependencies = {};
if (!that._ngOptions.bindingOptions) {
return
}
$.each(that._ngOptions.bindingOptions, function(optionPath, value) {
var prevWatchMethod, clearWatcher, separatorIndex = optionPath.search(/\[|\./),
optionForSubscribe = separatorIndex > -1 ? optionPath.substring(0, separatorIndex) : optionPath,
valuePath = value.dataPath,
deepWatch = true,
forcePlainWatchMethod = false;
if (void 0 !== value.deep) {
forcePlainWatchMethod = deepWatch = !!value.deep
}
if (!optionDependencies[optionForSubscribe]) {
optionDependencies[optionForSubscribe] = {}
}
optionDependencies[optionForSubscribe][optionPath] = valuePath;
var watchCallback = function(newValue, oldValue) {
if (that._ngLocker.locked(optionPath)) {
return
}
that._ngLocker.obtain(optionPath);
that._component.option(optionPath, newValue);
updateWatcher();
if (that._component._optionValuesEqual(optionPath, oldValue, newValue) && that._ngLocker.locked(optionPath)) {
that._ngLocker.release(optionPath)
}
};
var updateWatcher = function() {
var watchMethod = $.isArray(that._scope.$eval(valuePath)) && !forcePlainWatchMethod ? "$watchCollection" : "$watch";
if (prevWatchMethod !== watchMethod) {
if (clearWatcher) {
clearWatcher()
}
clearWatcher = that._scope[watchMethod](valuePath, watchCallback, deepWatch);
prevWatchMethod = watchMethod
}
};
updateWatcher();
that._componentDisposing.add(clearWatcher)
});
that._optionChangedCallbacks.add(function(args) {
var optionName = args.name,
fullName = args.fullName,
component = args.component;
if (that._ngLocker.locked(fullName)) {
that._ngLocker.release(fullName);
return
}
if (!optionDependencies || !optionDependencies[optionName]) {
return
}
that._ngLocker.obtain(fullName);
safeApply(function(scope) {
$.each(optionDependencies[optionName], function(optionPath, valuePath) {
var value = component.option(optionPath);
that._parse(valuePath).assign(that._scope, value);
var scopeValue = that._parse(valuePath)(that._scope);
if (scopeValue !== value) {
that._component.option(optionPath, scopeValue)
}
})
}, that._scope);
var releaseOption = function() {
if (that._ngLocker.locked(fullName)) {
that._ngLocker.release(fullName)
}
that._digestCallbacks.end.remove(releaseOption)
};
that._digestCallbacks.end.add(releaseOption)
})
},
_compilerByTemplate: function(template) {
var that = this,
scopeItemsPath = this._getScopeItemsPath();
return function(options) {
var $resultMarkup = $(template).clone(),
dataIsScope = options.model && options.model.constructor === that._scope.$root.constructor,
templateScope = dataIsScope ? options.model : options.noModel ? that._scope : that._createScopeWithData(options.model);
if (scopeItemsPath) {
that._synchronizeScopes(templateScope, scopeItemsPath, options.index)
}
$resultMarkup.appendTo(options.container).on("$destroy", function() {
var destroyAlreadyCalled = !templateScope.$parent;
if (destroyAlreadyCalled) {
return
}
templateScope.$destroy()
});
that._applyAsync(that._compile($resultMarkup, that._transcludeFn), templateScope);
return $resultMarkup
}
},
_applyAsync: function(func, scope) {
var that = this;
func(scope);
if (!scope.$root.$$phase) {
clearTimeout(that._renderingTimer);
that._renderingTimer = setTimeout(function() {
scope.$apply()
});
that._componentDisposing.add(function() {
clearTimeout(that._renderingTimer)
})
}
},
_getScopeItemsPath: function() {
if (this._componentClass.subclassOf(CollectionWidget) && this._ngOptions.bindingOptions && this._ngOptions.bindingOptions.items) {
return this._ngOptions.bindingOptions.items.dataPath
}
},
_createScopeWithData: function(data) {
var newScope = this._scope.$new(),
modelIsPrimitive = data && "object" !== typeof data && "function" !== typeof data;
newScope[DEFAULT_MODEL_ALIAS] = data;
newScope[MODEL_IS_PRIMITIVE_FLAG_NAME] = !!modelIsPrimitive;
if (this._itemAlias) {
newScope[this._itemAlias] = data
}
return newScope
},
_synchronizeScopes: function(itemScope, parentPrefix, itemIndex) {
var that = this,
fieldsToSynchronize = [DEFAULT_MODEL_ALIAS];
if (that._itemAlias && "object" !== typeof itemScope[that._itemAlias]) {
fieldsToSynchronize.push(that._itemAlias)
}
$.each(fieldsToSynchronize, function(i, fieldPath) {
that._synchronizeScopeField({
parentScope: that._scope,
childScope: itemScope,
fieldPath: fieldPath,
parentPrefix: parentPrefix,
itemIndex: itemIndex
})
})
},
_synchronizeScopeField: function(args) {
var parentScope = args.parentScope,
childScope = args.childScope,
fieldPath = args.fieldPath,
parentPrefix = args.parentPrefix,
itemIndex = args.itemIndex;
var optionOuterPath, innerPathSuffix = fieldPath === (this._itemAlias || DEFAULT_MODEL_ALIAS) ? "" : "." + fieldPath,
collectionField = void 0 !== itemIndex,
optionOuterBag = [parentPrefix];
if (collectionField) {
optionOuterBag.push("[", itemIndex, "]")
}
optionOuterBag.push(innerPathSuffix);
optionOuterPath = optionOuterBag.join("");
var clearParentWatcher = parentScope.$watch(optionOuterPath, function(newValue, oldValue) {
if (newValue !== oldValue) {
compileSetter(fieldPath)(childScope, newValue)
}
});
var clearItemWatcher = childScope.$watch(fieldPath, function(newValue, oldValue) {
if (newValue !== oldValue) {
if (collectionField && !compileGetter(parentPrefix)(parentScope)[itemIndex]) {
clearItemWatcher();
return
}
compileSetter(optionOuterPath)(parentScope, newValue)
}
});
this._componentDisposing.add([clearParentWatcher, clearItemWatcher])
},
_evalOptions: function(scope) {
var result = extendFromObject({}, this._ngOptions);
delete result.bindingOptions;
if (this._ngOptions.bindingOptions) {
$.each(this._ngOptions.bindingOptions, function(key, value) {
result[key] = scope.$eval(value.dataPath)
})
}
result._optionChangedCallbacks = this._optionChangedCallbacks;
result._disposingCallbacks = this._componentDisposing;
result.templateProvider = NgTemplateProvider;
result.templateCompiler = $.proxy(function($template) {
return this._compilerByTemplate($template)
}, this);
result.onActionCreated = function(component, action, config) {
if (config && $.inArray(config.category, SKIP_APPLY_ACTION_CATEGORIES) > -1) {
return action
}
var wrappedAction = function() {
var that = this,
args = arguments;
if (!scope || !scope.$root || scope.$root.$$phase) {
return action.apply(that, args)
}
return safeApply(function() {
return action.apply(that, args)
}, scope)
};
return wrappedAction
};
result.nestedComponentOptions = function(component) {
return {
templatesRenderAsynchronously: true,
templateCompiler: component.option("templateCompiler"),
modelByElement: component.option("modelByElement"),
onActionCreated: component.option("onActionCreated"),
nestedComponentOptions: component.option("nestedComponentOptions")
}
};
result.templatesRenderAsynchronously = true;
result.watchMethod = function(watchValue, callback, element) {
var disposeWatcher = scope.$watch(watchValue, function(oldValue, newValue) {
if (oldValue !== newValue) {
disposeWatcher();
callback()
}
}, true);
$(element).on(removeEvent, function() {
disposeWatcher()
})
};
result.modelByElement = function() {
return scope
};
return result
}
});
ComponentBuilder = ComponentBuilder.inherit({
ctor: function(options) {
this._componentName = options.componentName;
this._ngModel = options.ngModel;
this._ngModelController = options.ngModelController;
this.callBase.apply(this, arguments)
},
_isNgModelRequired: function() {
return this._componentClass.subclassOf(Editor) && this._ngModel
},
_initComponentBindings: function() {
this.callBase.apply(this, arguments);
this._initNgModelBinding()
},
_initNgModelBinding: function() {
if (!this._isNgModelRequired()) {
return
}
var that = this;
var clearNgModelWatcher = this._scope.$watch(this._ngModel, function(newValue, oldValue) {
if (that._ngLocker.locked(that._ngModelOption())) {
return
}
if (newValue === oldValue) {
return
}
that._component.option(that._ngModelOption(), newValue)
});
that._optionChangedCallbacks.add(function(args) {
that._ngLocker.obtain(that._ngModelOption());
try {
if (args.name !== that._ngModelOption()) {
return
}
that._ngModelController.$setViewValue(args.value)
} finally {
that._ngLocker.release(that._ngModelOption())
}
});
this._componentDisposing.add(clearNgModelWatcher)
},
_ngModelOption: function() {
if ($.inArray(this._componentName, ["dxFileUploader", "dxTagBox"]) > -1) {
return "values"
}
return "value"
},
_evalOptions: function() {
if (!this._isNgModelRequired()) {
return this.callBase.apply(this, arguments)
}
var result = this.callBase.apply(this, arguments);
result[this._ngModelOption()] = this._parse(this._ngModel)(this._scope);
return result
}
});
var registeredComponents = {};
var registerComponentDirective = function(name) {
var priority = "dxValidator" !== name ? 1 : 10;
ngModule.directive(name, ["$compile", "$parse", "dxDigestCallbacks", function($compile, $parse, dxDigestCallbacks) {
return {
restrict: "A",
require: "^?ngModel",
priority: priority,
compile: function($element) {
var componentClass = registeredComponents[name],
$content = componentClass.subclassOf(Widget) ? $element.contents().detach() : null;
return function(scope, $element, attrs, ngModelController, transcludeFn) {
$element.append($content);
safeApply(function() {
new ComponentBuilder({
componentClass: componentClass,
componentName: name,
compile: $compile,
parse: $parse,
$element: $element,
scope: scope,
ngOptionsString: attrs[name],
ngOptions: attrs[name] ? scope.$eval(attrs[name]) : {},
ngModel: attrs.ngModel,
ngModelController: ngModelController,
transcludeFn: transcludeFn,
itemAlias: attrs[ITEM_ALIAS_ATTRIBUTE_NAME],
dxDigestCallbacks: dxDigestCallbacks
})
}, scope)
}
}
}
}])
};
registerComponent.callbacks.add(function(name, componentClass) {
if (!registeredComponents[name]) {
registerComponentDirective(name)
}
registeredComponents[name] = componentClass
})
},
/*!**********************************************************!*\
!*** ./Scripts/integration/angular/template_provider.js ***!
\**********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50),
templateProvider = __webpack_require__( /*! ../../ui/widget/jquery.template_provider */ 94),
NgTemplate = __webpack_require__( /*! ./template */ 148),
defaultTemplates = __webpack_require__( /*! ./default_templates */ 149);
var NgTemplateProvider = templateProvider.constructor.inherit({
createTemplate: function(element, owner) {
return new NgTemplate(element, owner)
},
getTemplates: function(widget) {
var templateCompiler = widget.option("templateCompiler"),
templates = this.callBase.apply(this, arguments);
$.each(templates, function(_, template) {
template.setCompiler && template.setCompiler(templateCompiler)
});
return templates
},
_templatesForWidget: function(widgetName) {
var templateGenerators = defaultTemplates[widgetName];
if (!templateGenerators) {
return this.callBase(widgetName)
}
var templates = {};
$.each(templateGenerators, function(name, generator) {
var $markup = domUtils.createMarkupFromString(generator());
templates[name] = new NgTemplate($markup.wrap(), ngTemplateProvider)
});
return templates
}
});
var ngTemplateProvider = new NgTemplateProvider;
module.exports = ngTemplateProvider
},
/*!*************************************************!*\
!*** ./Scripts/integration/angular/template.js ***!
\*************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
TemplateBase = __webpack_require__( /*! ../../ui/widget/ui.template_base */ 90),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50);
var NgTemplate = TemplateBase.inherit({
ctor: function(element, owner) {
this.callBase(element, owner);
this.setCompiler(this._getParentTemplateCompiler())
},
_getParentTemplateCompiler: function() {
var templateCompiler = null,
owner = this.owner();
while (!templateCompiler && owner) {
templateCompiler = $.isFunction(owner.option) ? owner.option("templateCompiler") : null;
owner = $.isFunction(owner.owner) ? owner.owner() : null
}
return templateCompiler
},
_renderCore: function(options) {
var compiledTemplate = this._compiledTemplate,
result = $.isFunction(compiledTemplate) ? compiledTemplate(options) : compiledTemplate;
return result
},
setCompiler: function(templateCompiler) {
if (!templateCompiler) {
return
}
this._compiledTemplate = templateCompiler(domUtils.normalizeTemplateElement(this._element))
}
});
module.exports = NgTemplate
},
/*!**********************************************************!*\
!*** ./Scripts/integration/angular/default_templates.js ***!
\**********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9);
var TEMPLATE_GENERATORS = {};
var TEMPLATE_WRAPPER_CLASS = "dx-template-wrapper";
var baseElements = {
container: function() {
return $("
").addClass(TEMPLATE_WRAPPER_CLASS)
},
html: function() {
return $("
").attr("ng-if", "dxTemplateModel.html").attr("ng-bind-html", "dxTemplateModel.html")
},
text: function(element) {
element = element || "
";
return $(element).attr("ng-if", "dxTemplateModel.text").attr("ng-if", "!dxTemplateModel.html").attr("ng-bind", "dxTemplateModel.text")
},
primitive: function() {
return $("
").attr("ng-if", "dxTemplateModelIsPrimitive").attr("ng-bind", "'' + dxTemplateModel")
}
};
var emptyTemplate = function() {
return $()
};
TEMPLATE_GENERATORS.CollectionWidget = {
item: function() {
return baseElements.container().append(baseElements.html()).append(baseElements.text()).append(baseElements.primitive())
},
itemFrame: function() {
var $container = $("
").attr("ng-class", "{ 'dx-state-invisible': !dxTemplateModel.visible && dxTemplateModel.visible != undefined, 'dx-state-disabled': !!dxTemplateModel.disabled }"),
$placeholder = $("
").addClass("dx-item-content-placeholder");
$container.append($placeholder);
return $container
}
};
var BUTTON_TEXT_CLASS = "dx-button-text";
TEMPLATE_GENERATORS.dxButton = {
content: function() {
var $titleBinding = $("
").attr("ng-bind", "dxTemplateModel.text").attr("ng-class", "{ '" + BUTTON_TEXT_CLASS + "' : !!dxTemplateModel.text }"),
icon = $("");
return baseElements.container().append(icon).append($titleBinding).append(baseElements.primitive())
}
};
var LIST_ITEM_BADGE_CONTAINER_CLASS = "dx-list-item-badge-container",
LIST_ITEM_BADGE_CLASS = "dx-list-item-badge",
BADGE_CLASS = "dx-badge",
LIST_ITEM_CHEVRON_CONTAINER_CLASS = "dx-list-item-chevron-container",
LIST_ITEM_CHEVRON_CLASS = "dx-list-item-chevron";
TEMPLATE_GENERATORS.dxList = {
item: function() {
return TEMPLATE_GENERATORS.CollectionWidget.item().append($("").attr("ng-if", "dxTemplateModel.key").attr("ng-bind", "dxTemplateModel.key"))
},
itemFrame: function() {
var $badgeContainer = $("
").addClass(LIST_ITEM_BADGE_CONTAINER_CLASS).attr("ng-if", "dxTemplateModel.badge"),
$badge = $("
").addClass(LIST_ITEM_BADGE_CLASS).addClass(BADGE_CLASS).attr("ng-bind", "dxTemplateModel.badge");
var $chevronContainer = $("
").addClass(LIST_ITEM_CHEVRON_CONTAINER_CLASS).attr("ng-if", "dxTemplateModel.showChevron"),
$chevron = $("
").addClass(LIST_ITEM_CHEVRON_CLASS);
return TEMPLATE_GENERATORS.CollectionWidget.itemFrame().append($badgeContainer.append($badge)).append($chevronContainer.append($chevron))
},
group: function() {
var $keyBinding = $("
").attr("ng-if", "dxTemplateModel.key").attr("ng-bind", "dxTemplateModel.key");
return baseElements.container().append($keyBinding).append(baseElements.primitive())
}
};
TEMPLATE_GENERATORS.dxDropDownMenu = {
item: TEMPLATE_GENERATORS.dxList.item,
content: TEMPLATE_GENERATORS.dxButton.content
};
TEMPLATE_GENERATORS.dxDropDownList = {
item: TEMPLATE_GENERATORS.dxList.item
};
TEMPLATE_GENERATORS.dxRadioGroup = {
item: TEMPLATE_GENERATORS.CollectionWidget.item
};
TEMPLATE_GENERATORS.dxScheduler = {
item: function() {
var $itemContent = TEMPLATE_GENERATORS.CollectionWidget.item();
var $details = $("
").addClass("dx-scheduler-appointment-content-details");
$("
").attr("ng-if", "dxTemplateModel.allDay").addClass("dx-scheduler-appointment-content-allday").text(" All day: ").appendTo($details);
$("
").attr("ng-if", "dxTemplateModel.startDate").addClass("dx-scheduler-appointment-content-date").text("{{dxTemplateModel.startDate | date : 'shortTime' }}").appendTo($details);
$("
").attr("ng-if", "dxTemplateModel.endDate").addClass("dx-scheduler-appointment-content-date").text(" - ").appendTo($details);
$("
").attr("ng-if", "dxTemplateModel.endDate").addClass("dx-scheduler-appointment-content-date").text("{{dxTemplateModel.endDate | date : 'shortTime' }}").appendTo($details);
$details.appendTo($itemContent);
$("
").attr("ng-if", "dxTemplateModel.recurrenceRule").addClass("dx-scheduler-appointment-recurrence-icon dx-icon-repeat").appendTo($itemContent);
return $itemContent
},
appointmentTooltip: emptyTemplate,
appointmentPopup: emptyTemplate
};
TEMPLATE_GENERATORS.dxOverlay = {
content: emptyTemplate
};
TEMPLATE_GENERATORS.dxSlideOutView = {
menu: emptyTemplate,
content: emptyTemplate
};
TEMPLATE_GENERATORS.dxSlideOut = {
menuItem: TEMPLATE_GENERATORS.dxList.item,
menuGroup: TEMPLATE_GENERATORS.dxList.group,
content: emptyTemplate
};
TEMPLATE_GENERATORS.dxAccordion = {
title: function() {
var $titleBinding = $("").attr("ng-if", "dxTemplateModel.title").attr("ng-bind", "dxTemplateModel.title"),
icon = $("");
return baseElements.container().append(icon).append($titleBinding).append(baseElements.primitive())
},
content: TEMPLATE_GENERATORS.CollectionWidget.item
};
TEMPLATE_GENERATORS.dxPivotTabs = {
item: function() {
return baseElements.container().append($("").attr("ng-if", "dxTemplateModel.title").attr("ng-bind", "dxTemplateModel.title")).append(baseElements.primitive())
}
};
TEMPLATE_GENERATORS.dxPivot = {
title: TEMPLATE_GENERATORS.dxPivotTabs.item,
content: emptyTemplate
};
var PANORAMA_ITEM_TITLE_CLASS = "dx-panorama-item-title";
TEMPLATE_GENERATORS.dxPanorama = {
itemFrame: function() {
return TEMPLATE_GENERATORS.CollectionWidget.itemFrame().prepend($("").addClass(PANORAMA_ITEM_TITLE_CLASS).attr("ng-if", "dxTemplateModel.title").attr("ng-bind", "dxTemplateModel.title"))
}
};
TEMPLATE_GENERATORS.dxActionSheet = {
item: function() {
return baseElements.container().append($("
").attr("dx-button", "{ bindingOptions: { text: 'dxTemplateModel.text', onClick: 'dxTemplateModel.onClick', type: 'dxTemplateModel.type', disabled: 'dxTemplateModel.disabled' } }"))
}
};
TEMPLATE_GENERATORS.dxToolbarBase = {
item: function() {
var template = TEMPLATE_GENERATORS.CollectionWidget.item();
$('
').appendTo(template);
return template
},
actionSheetItem: TEMPLATE_GENERATORS.dxActionSheet.item
};
TEMPLATE_GENERATORS.dxToolbarBase.menuItem = TEMPLATE_GENERATORS.dxToolbarBase.item;
var GALLERY_IMAGE_CLASS = "dx-gallery-item-image";
TEMPLATE_GENERATORS.dxGallery = {
item: function() {
return baseElements.container().append(baseElements.html()).append(baseElements.text()).append($("").addClass(GALLERY_IMAGE_CLASS).attr("ng-if", "!dxTemplateModel.imageSrc").attr("ng-src", "{{'' + dxTemplateModel}}")).append($("").addClass(GALLERY_IMAGE_CLASS).attr("ng-if", "dxTemplateModel.imageSrc").attr("ng-src", "{{dxTemplateModel.imageSrc}}").attr("ng-attr-alt", "{{dxTemplateModel.imageAlt}}"))
}
};
var TABS_ITEM_TEXT_CLASS = "dx-tab-text";
TEMPLATE_GENERATORS.dxTabs = {
item: function() {
var container = baseElements.container();
var icon = $(""),
text = baseElements.text("").addClass(TABS_ITEM_TEXT_CLASS);
return container.append(baseElements.html()).append(icon).append(text).append(baseElements.primitive().addClass(TABS_ITEM_TEXT_CLASS))
},
itemFrame: function() {
var $badge = $("").addClass("dx-tabs-item-badge dx-badge").attr("ng-bind", "dxTemplateModel.badge").attr("ng-if", "dxTemplateModel.badge");
return TEMPLATE_GENERATORS.CollectionWidget.itemFrame().append($badge)
}
};
var NAVBAR_ITEM_BADGE_CLASS = "dx-navbar-item-badge";
TEMPLATE_GENERATORS.dxNavBar = {
itemFrame: function() {
var $badge = $("
").addClass(NAVBAR_ITEM_BADGE_CLASS).addClass(BADGE_CLASS).attr("ng-if", "dxTemplateModel.badge").attr("ng-bind", "dxTemplateModel.badge");
return TEMPLATE_GENERATORS.CollectionWidget.itemFrame().append($badge)
}
};
TEMPLATE_GENERATORS.dxMenuBase = {
item: function() {
var container = baseElements.container();
var text = $("
").attr("ng-if", "dxTemplateModel.text").addClass("dx-menu-item-text").attr("ng-bind", "dxTemplateModel.text"),
icon = $(""),
popout = $("").addClass("dx-menu-item-popout-container").attr("ng-if", "dxTemplateModel.items").append($("").addClass("dx-menu-item-popout"));
container.append(baseElements.html()).append(icon).append(text).append(popout).append(baseElements.primitive()).appendTo(container);
return container
}
};
TEMPLATE_GENERATORS.dxTreeView = {
item: function() {
var content = baseElements.container(),
link = $("
").attr("ng-bind", "dxTemplateModel.text"),
icon = $("
");
content.append(baseElements.html()).append(icon).append(link).append(baseElements.primitive());
return content
}
};
TEMPLATE_GENERATORS.dxTabPanel = {
item: TEMPLATE_GENERATORS.CollectionWidget.item,
title: function() {
var content = TEMPLATE_GENERATORS.dxTabs.item();
content.find(".dx-tab-text").eq(0).attr("ng-bind", "dxTemplateModel.title").attr("ng-if", "dxTemplateModel.title");
content.find("[ng-if='dxTemplateModel.html']").remove();
return content
}
};
var popupTitleAndBottom = function() {
return $("").attr("dx-toolbar-base", "{ bindingOptions: { items: 'dxTemplateModel' } }")
};
TEMPLATE_GENERATORS.dxPopup = {
title: popupTitleAndBottom,
bottom: popupTitleAndBottom
};
TEMPLATE_GENERATORS.dxLookup = {
title: TEMPLATE_GENERATORS.dxPopup.title,
group: TEMPLATE_GENERATORS.dxList.group
};
var TAGBOX_TAG_CONTENT_CLASS = "dx-tag-content",
TAGBOX_TAG_REMOVE_BUTTON_CLASS = "dx-tag-remove-button";
TEMPLATE_GENERATORS.dxTagBox = {
tag: function() {
return $("
").addClass(TAGBOX_TAG_CONTENT_CLASS).append($("
").attr("ng-bind", "dxTemplateModel")).append($("").addClass(TAGBOX_TAG_REMOVE_BUTTON_CLASS))
}
};
module.exports = TEMPLATE_GENERATORS
},
/*!***********************************************!*\
!*** ./Scripts/integration/angular/module.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var angular = __webpack_require__( /*! angular */ 145);
__webpack_require__( /*! angular-sanitize */ 145);
module.exports = angular.module("dx", ["ngSanitize"])
},
/*!************************************************************!*\
!*** ./Scripts/ui/collection/ui.collection_widget.edit.js ***!
\************************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
BaseCollectionWidget = __webpack_require__( /*! ./ui.collection_widget.base */ 152),
errors = __webpack_require__( /*! ../widget/ui.errors */ 10),
arrayUtils = __webpack_require__( /*! ../../core/utils/array */ 111),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
PlainEditStrategy = __webpack_require__( /*! ./ui.collection_widget.edit.strategy.plain */ 166),
DataSource = __webpack_require__( /*! ../../data/data_source/data_source */ 155).DataSource;
var ITEM_DELETING_DATA_KEY = "dxItemDeleting";
var CollectionWidget = BaseCollectionWidget.inherit({
_setOptionsByReference: function() {
this.callBase();
$.extend(this._optionsByReference, {
selectedItem: true
})
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
selectionMode: "none",
selectionRequired: false,
selectionByClick: true,
selectedItems: [],
selectedIndex: -1,
selectedItem: null,
onSelectionChanged: null,
onItemReordered: null,
onItemDeleting: null,
onItemDeleted: null
})
},
_init: function() {
this._initEditStrategy();
this.callBase();
this._selectedItemIndices = [];
if ("multi" === this.option("selectionMode")) {
this._showDeprecatedSelectionMode()
}
},
_initEditStrategy: function() {
var Strategy = PlainEditStrategy;
this._editStrategy = new Strategy(this)
},
_forgetNextPageLoading: function() {
this.callBase();
this._selectedItemIndices = this._editStrategy.selectedItemIndices()
},
_render: function() {
this._syncSelectionOptions();
this._normalizeSelectedItems();
this._initSelectedItems();
this.callBase();
this._renderSelection(this._selectedItemIndices, [])
},
_syncSelectionOptions: function(byOption) {
byOption = byOption || this._chooseSelectOption();
var selectedItem, selectedItems;
switch (byOption) {
case "selectedIndex":
selectedItem = this._editStrategy.getItemDataByIndex(this.option("selectedIndex"));
if (commonUtils.isDefined(selectedItem)) {
this._setOptionSilent("selectedItems", [selectedItem]);
this._setOptionSilent("selectedItem", selectedItem)
} else {
this._setOptionSilent("selectedItems", []);
this._setOptionSilent("selectedItem", null)
}
break;
case "selectedItems":
selectedItems = this.option("selectedItems") || [];
this._setOptionSilent("selectedItem", selectedItems[0]);
this._setOptionSilent("selectedIndex", this._editStrategy.getIndexByItemData(selectedItems[0]));
break;
case "selectedItem":
selectedItem = this.option("selectedItem");
if (commonUtils.isDefined(selectedItem)) {
this._setOptionSilent("selectedItems", [selectedItem]);
this._setOptionSilent("selectedIndex", this._editStrategy.getIndexByItemData(selectedItem))
} else {
this._setOptionSilent("selectedItems", []);
this._setOptionSilent("selectedIndex", -1)
}
}
},
_chooseSelectOption: function() {
var optionName = "selectedIndex";
if (this.option("selectedItems").length) {
optionName = "selectedItems"
} else {
if (commonUtils.isDefined(this.option("selectedItem"))) {
optionName = "selectedItem"
}
}
return optionName
},
_normalizeSelectedItems: function() {
if ("none" === this.option("selectionMode")) {
this._setOptionSilent("selectedItems", []);
this._syncSelectionOptions("selectedItems")
} else {
if ("single" === this.option("selectionMode")) {
var newSelection = this._editStrategy.selectedItemIndices(this.option("selectedItems"));
if (newSelection.length > 1 || !newSelection.length && this.option("selectionRequired") && this.option("items") && this.option("items").length) {
var normalizedSelection = [newSelection[0] || this._selectedItemIndices[0] || 0];
this._setOptionSilent("selectedItems", this._editStrategy.fetchSelectedItems(normalizedSelection));
this._syncSelectionOptions("selectedItems")
}
}
}
},
_initSelectedItems: function() {
this._selectedItemIndices = this._editStrategy.selectedItemIndices(this.option("selectedItems"))
},
_renderSelection: $.noop,
_itemClickHandler: function(e) {
this._createAction($.proxy(function(e) {
this._itemSelectHandler(e.jQueryEvent)
}, this), {
validatingTargetName: "itemElement"
})({
itemElement: $(e.currentTarget),
jQueryEvent: e
});
this.callBase.apply(this, arguments)
},
_itemSelectHandler: function(e) {
if (!this.option("selectionByClick")) {
return
}
var $itemElement = e.currentTarget;
if (this.isItemSelected($itemElement)) {
this.unselectItem(e.currentTarget)
} else {
this.selectItem(e.currentTarget)
}
},
_selectedItemElement: function(index) {
return this._itemElements().eq(index)
},
_postprocessRenderItem: function(args) {
var $itemElement = $(args.itemElement);
if (this._isItemSelected(this._editStrategy.getNormalizedIndex($itemElement))) {
$itemElement.addClass(this._selectedItemClass());
this._setAriaSelected($itemElement, "true")
} else {
this._setAriaSelected($itemElement, "false")
}
},
_updateSelectedItems: function() {
var that = this,
oldSelection = this._selectedItemIndices.slice(),
newSelection = this._editStrategy.selectedItemIndices(),
addedSelection = arrayUtils.removeDuplicates(newSelection, oldSelection),
removedSelection = arrayUtils.removeDuplicates(oldSelection, newSelection);
$.each(removedSelection, function(_, normalizedIndex) {
that._removeSelection(normalizedIndex)
});
$.each(addedSelection, function(_, normalizedIndex) {
that._addSelection(normalizedIndex)
});
if (removedSelection.length || addedSelection.length) {
var selectionChangePromise = this._selectionChangePromise;
this._updateSelection(addedSelection, removedSelection);
$.when(selectionChangePromise).done(function() {
that._fireSelectionChangeEvent(addedSelection, removedSelection)
})
}
},
_fireSelectionChangeEvent: function(addedSelection, removedSelection) {
this._createActionByOption("onSelectionChanged", {
excludeValidators: ["disabled", "readOnly"]
})(this._editStrategy.fetchSelectionDifference(addedSelection, removedSelection))
},
_updateSelection: function() {
this._renderSelection.apply(this, arguments)
},
_setAriaSelected: function($target, value) {
this.setAria("selected", value, $target)
},
_removeSelection: function(normalizedIndex) {
var $itemElement = this._editStrategy.getItemElement(normalizedIndex),
itemSelectionIndex = $.inArray(normalizedIndex, this._selectedItemIndices);
if (itemSelectionIndex > -1) {
$itemElement.removeClass(this._selectedItemClass());
this._setAriaSelected($itemElement, "false");
this._selectedItemIndices.splice(itemSelectionIndex, 1);
$itemElement.triggerHandler("stateChanged")
}
},
_showDeprecatedSelectionMode: function() {
errors.log("W0001", this.NAME, "selectionMode: 'multi'", "16.1", "Use selectionMode: 'multiple' instead");
this.option("selectionMode", "multiple")
},
_addSelection: function(normalizedIndex) {
var $itemElement = this._editStrategy.getItemElement(normalizedIndex);
if (normalizedIndex > -1 && !this._isItemSelected(normalizedIndex)) {
$itemElement.addClass(this._selectedItemClass());
this._setAriaSelected($itemElement, "true");
this._selectedItemIndices.push(normalizedIndex);
$itemElement.triggerHandler("stateChanged")
}
},
_isItemSelected: function(index) {
return $.inArray(index, this._selectedItemIndices) > -1
},
_optionChanged: function(args) {
if (this._cancelOptionChange === args.name) {
return
}
switch (args.name) {
case "selectionMode":
if ("multi" === args.value) {
this._showDeprecatedSelectionMode()
} else {
this._invalidate()
}
break;
case "selectedIndex":
case "selectedItem":
case "selectedItems":
this._syncSelectionOptions(args.name);
this._normalizeSelectedItems();
this._updateSelectedItems();
break;
case "selectionRequired":
this._normalizeSelectedItems();
this._updateSelectedItems();
break;
case "selectionByClick":
case "onSelectionChanged":
case "onItemDeleting":
case "onItemDeleted":
case "onItemReordered":
break;
default:
this.callBase(args)
}
},
_clearSelectedItems: function() {
this._selectedItemIndices = [];
this._setOptionSilent("selectedItems", []);
this._syncSelectionOptions("selectedItems")
},
_setOptionSilent: function(name, value) {
this._cancelOptionChange = name;
this.option(name, value);
this._cancelOptionChange = false
},
_waitDeletingPrepare: function($itemElement) {
if ($itemElement.data(ITEM_DELETING_DATA_KEY)) {
return $.Deferred().resolve().promise()
}
$itemElement.data(ITEM_DELETING_DATA_KEY, true);
var deferred = $.Deferred(),
deletePromise = this._itemEventHandler($itemElement, "onItemDeleting", {}, {
excludeValidators: ["disabled", "readOnly"]
});
$.when(deletePromise).always($.proxy(function(value) {
var deletePromiseExists = !deletePromise,
deletePromiseResolved = !deletePromiseExists && "resolved" === deletePromise.state(),
argumentsSpecified = !!arguments.length,
shouldDelete = deletePromiseExists || deletePromiseResolved && !argumentsSpecified || deletePromiseResolved && value;
$itemElement.data(ITEM_DELETING_DATA_KEY, false);
shouldDelete ? deferred.resolve() : deferred.reject()
}, this));
return deferred.promise()
},
_deleteItemFromDS: function($item) {
if (!this._dataSource) {
return $.Deferred().resolve().promise()
}
var deferred = $.Deferred(),
disabledState = this.option("disabled"),
dataStore = this._dataSource.store();
this.option("disabled", true);
if (!dataStore.remove) {
throw errors.Error("E1011")
}
dataStore.remove(dataStore.keyOf(this._getItemData($item))).done(function(key) {
if (void 0 !== key) {
deferred.resolve()
} else {
deferred.reject()
}
}).fail(function() {
deferred.reject()
});
deferred.always($.proxy(function() {
this.option("disabled", disabledState)
}, this));
return deferred
},
_tryRefreshLastPage: function() {
var deferred = $.Deferred();
if (this._isLastPage() || this.option("grouped")) {
deferred.resolve()
} else {
this._refreshLastPage().done(function() {
deferred.resolve()
})
}
return deferred.promise()
},
_refreshLastPage: function() {
this._expectLastItemLoading();
return this._dataSource.load()
},
_updateSelectionAfterDelete: function(fromIndex) {
var itemIndex = $.inArray(fromIndex, this._selectedItemIndices);
if (itemIndex > -1) {
this._selectedItemIndices.splice(itemIndex, 1)
}
this._editStrategy.updateSelectionAfterDelete(fromIndex);
this.option("selectedItems", this._editStrategy.fetchSelectedItems())
},
_simulateOptionChange: function(optionName) {
var optionValue = this.option(optionName);
if (optionValue instanceof DataSource) {
return
}
this._optionChangedAction({
name: optionName,
fullName: optionName,
value: optionValue
})
},
isItemSelected: function(itemElement) {
return this._isItemSelected(this._editStrategy.getNormalizedIndex(itemElement))
},
selectItem: function(itemElement) {
var itemIndex = this._editStrategy.getNormalizedIndex(itemElement);
if (itemIndex === -1) {
return
}
var itemSelectionIndex = $.inArray(itemIndex, this._selectedItemIndices);
if (itemSelectionIndex !== -1) {
return
}
if ("single" === this.option("selectionMode")) {
this.option("selectedItems", this._editStrategy.fetchSelectedItems([itemIndex]))
} else {
var newSelectedIndices = this._selectedItemIndices.slice();
newSelectedIndices.push(itemIndex);
this.option("selectedItems", this._editStrategy.fetchSelectedItems(newSelectedIndices))
}
},
unselectItem: function(itemElement) {
var itemIndex = this._editStrategy.getNormalizedIndex(itemElement);
if (itemIndex === -1) {
return
}
var itemSelectionIndex = $.inArray(itemIndex, this._selectedItemIndices);
if (itemSelectionIndex === -1) {
return
}
var newSelectedIndices = this._selectedItemIndices.slice();
newSelectedIndices.splice(itemSelectionIndex, 1);
if (this.option("selectionRequired") && 0 === newSelectedIndices.length) {
return
}
this.option("selectedItems", this._editStrategy.fetchSelectedItems(newSelectedIndices))
},
deleteItem: function(itemElement) {
var that = this,
deferred = $.Deferred(),
$item = this._editStrategy.getItemElement(itemElement),
index = this._editStrategy.getNormalizedIndex(itemElement),
changingOption = this._dataSource ? "dataSource" : "items",
itemResponseWaitClass = this._itemResponseWaitClass();
if (index > -1) {
this._waitDeletingPrepare($item).done(function() {
$item.addClass(itemResponseWaitClass);
var deletedActionArgs = that._extendActionArgs($item);
that._deleteItemFromDS($item).done(function() {
that._editStrategy.deleteItemAtIndex(index);
that._simulateOptionChange(changingOption);
that._updateSelectionAfterDelete(index);
that._itemEventHandler($item, "onItemDeleted", deletedActionArgs, {
beforeExecute: function() {
$item.detach()
},
excludeValidators: ["disabled", "readOnly"]
});
that._renderEmptyMessage();
that._tryRefreshLastPage().done(function() {
deferred.resolveWith(that)
})
}).fail(function() {
$item.removeClass(itemResponseWaitClass);
deferred.rejectWith(that)
})
}).fail(function() {
deferred.rejectWith(that)
})
} else {
deferred.rejectWith(that)
}
return deferred.promise()
},
reorderItem: function(itemElement, toItemElement) {
var deferred = $.Deferred(),
that = this,
strategy = this._editStrategy,
$movingItem = strategy.getItemElement(itemElement),
$destinationItem = strategy.getItemElement(toItemElement),
movingIndex = strategy.getNormalizedIndex(itemElement),
destinationIndex = strategy.getNormalizedIndex(toItemElement),
changingOption = this._dataSource ? "dataSource" : "items";
var canMoveItems = movingIndex > -1 && destinationIndex > -1 && movingIndex !== destinationIndex;
if (canMoveItems) {
deferred.resolveWith(this)
} else {
deferred.rejectWith(this)
}
return deferred.promise().done(function() {
$destinationItem[strategy.itemPlacementFunc(movingIndex, destinationIndex)]($movingItem);
var newSelectedItems = strategy.getSelectedItemsAfterReorderItem(movingIndex, destinationIndex);
strategy.moveItemAtIndexToIndex(movingIndex, destinationIndex);
that._selectedItemIndices = strategy.selectedItemIndices(newSelectedItems);
that.option("selectedItems", strategy.fetchSelectedItems());
if ("items" === changingOption) {
that._simulateOptionChange(changingOption)
}
that._itemEventHandler($movingItem, "onItemReordered", {
fromIndex: strategy.getIndex(movingIndex),
toIndex: strategy.getIndex(destinationIndex)
}, {
excludeValidators: ["disabled", "readOnly"]
})
})
}
});
module.exports = CollectionWidget
},
/*!************************************************************!*\
!*** ./Scripts/ui/collection/ui.collection_widget.base.js ***!
\************************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Action = __webpack_require__( /*! ../../core/action */ 35),
Guid = __webpack_require__( /*! ../../core/guid */ 153),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50),
Widget = __webpack_require__( /*! ../widget/ui.widget */ 89),
eventUtils = __webpack_require__( /*! ../../events/utils */ 62),
pointerEvents = __webpack_require__( /*! ../../events/pointer */ 65),
DataHelperMixin = __webpack_require__( /*! ./ui.data_helper */ 154),
selectors = __webpack_require__( /*! ../widget/jquery.selectors */ 101),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 80),
holdEvent = __webpack_require__( /*! ../../events/hold */ 164),
clickEvent = __webpack_require__( /*! ../../events/click */ 64),
contextmenuEvent = __webpack_require__( /*! ../../events/contextmenu */ 165);
var COLLECTION_CLASS = "dx-collection",
ITEM_CLASS = "dx-item",
CONTENT_CLASS_POSTFIX = "-content",
ITEM_CONTENT_PLACEHOLDER_CLASS = "dx-item-content-placeholder",
ITEM_DATA_KEY = "dxItemData",
ITEM_INDEX_KEY = "dxItemIndex",
ITEM_TEMPLATE_ID_PREFIX = "tmpl-",
ITEMS_SELECTOR = "[data-options*='dxItem']",
SELECTED_ITEM_CLASS = "dx-item-selected",
ITEM_RESPONSE_WAIT_CLASS = "dx-item-response-wait",
EMPTY_COLLECTION = "dx-empty-collection",
TEMPLATE_WRAPPER_CLASS = "dx-template-wrapper",
DISABLED_STATE_CLASS = "dx-state-disabled",
INVISIBLE_STATE_CLASS = "dx-state-invisible",
ITEM_PATH_REGEX = /^([^.]+\[\d+\]\.)+(\w+)$/;
var FOCUS_UP = "up",
FOCUS_DOWN = "down",
FOCUS_LEFT = "left",
FOCUS_RIGHT = "right",
FOCUS_PAGE_UP = "pageup",
FOCUS_PAGE_DOWN = "pagedown",
FOCUS_LAST = "last",
FOCUS_FIRST = "first";
var CollectionWidget = Widget.inherit({
_activeStateUnit: "." + ITEM_CLASS,
_supportedKeys: function() {
var click = function(e) {
var $itemElement = this.option("focusedElement");
if (!$itemElement) {
return
}
e.target = $itemElement;
e.currentTarget = $itemElement;
this._itemClickHandler(e)
},
move = function(location, e) {
e.preventDefault();
e.stopPropagation();
this._moveFocus(location, e)
};
return $.extend(this.callBase(), {
space: click,
enter: click,
leftArrow: $.proxy(move, this, FOCUS_LEFT),
rightArrow: $.proxy(move, this, FOCUS_RIGHT),
upArrow: $.proxy(move, this, FOCUS_UP),
downArrow: $.proxy(move, this, FOCUS_DOWN),
pageUp: $.proxy(move, this, FOCUS_UP),
pageDown: $.proxy(move, this, FOCUS_DOWN),
home: $.proxy(move, this, FOCUS_FIRST),
end: $.proxy(move, this, FOCUS_LAST)
})
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
selectOnFocus: false,
loopItemFocus: true,
items: [],
itemTemplate: "item",
onItemRendered: null,
onItemClick: null,
onItemHold: null,
itemHoldTimeout: 750,
onItemContextMenu: null,
onFocusedItemChanged: null,
noDataText: messageLocalization.format("dxCollectionWidget-noDataText"),
dataSource: null,
_itemAttributes: {},
itemTemplateProperty: "template",
focusOnSelectedItem: true,
focusedElement: null
})
},
_getAnonymousTemplateName: function() {
return "item"
},
_init: function() {
this.callBase();
this._cleanRenderedItems();
this._refreshDataSource()
},
_initTemplates: function() {
this._initItemsFromMarkup();
this.callBase()
},
_initItemsFromMarkup: function() {
var $items = this.element().contents().filter(ITEMS_SELECTOR);
if (!$items.length || this.option("items").length) {
return
}
var items = $.map($items, $.proxy(function(item) {
var $item = $(item);
var result = domUtils.getElementOptions(item).dxItem;
var isTemplateRequired = $.trim($item.html()) && !result.template;
if (isTemplateRequired) {
result.template = this._prepareItemTemplate($item)
} else {
$item.remove()
}
return result
}, this));
this.option("items", items)
},
_prepareItemTemplate: function($item) {
var templateId = ITEM_TEMPLATE_ID_PREFIX + new Guid;
var templateOptions = 'dxTemplate: { name: "' + templateId + '" }';
$item.detach().clone().attr("data-options", templateOptions).data("options", templateOptions).appendTo(this.element());
return templateId
},
_dataSourceOptions: function() {
return {
paginate: false
}
},
_cleanRenderedItems: function() {
this._renderedItemsCount = 0
},
_focusTarget: function() {
return this.element()
},
_focusInHandler: function(e) {
this.callBase.apply(this, arguments);
if ($.inArray(e.target, this._focusTarget()) === -1) {
return
}
var $focusedElement = this.option("focusedElement");
if ($focusedElement && $focusedElement.length) {
this._setFocusedItem($focusedElement)
} else {
var $activeItem = this._getActiveItem();
if ($activeItem.length) {
this.option("focusedElement", $activeItem)
}
}
},
_focusOutHandler: function(e) {
this.callBase.apply(this, arguments);
var $target = this.option("focusedElement");
if ($target) {
this._toggleFocusClass(false, $target)
}
},
_getActiveItem: function(last) {
var $focusedElement = this.option("focusedElement");
if ($focusedElement && $focusedElement.length) {
return $focusedElement
}
var index = this.option("focusOnSelectedItem") ? this.option("selectedIndex") : 0,
activeElements = this._getActiveElement(),
lastIndex = activeElements.length - 1;
if (index < 0) {
index = last ? lastIndex : 0
}
return activeElements.eq(index)
},
_renderFocusTarget: function() {
this.callBase.apply(this, arguments);
this._refreshActiveDescendant()
},
_moveFocus: function(location) {
var $newTarget, $items = this._itemElements().filter(":visible").not(".dx-state-disabled");
switch (location) {
case FOCUS_PAGE_UP:
case FOCUS_UP:
$newTarget = this._prevItem($items);
break;
case FOCUS_PAGE_DOWN:
case FOCUS_DOWN:
$newTarget = this._nextItem($items);
break;
case FOCUS_RIGHT:
$newTarget = this.option("rtlEnabled") ? this._prevItem($items) : this._nextItem($items);
break;
case FOCUS_LEFT:
$newTarget = this.option("rtlEnabled") ? this._nextItem($items) : this._prevItem($items);
break;
case FOCUS_FIRST:
$newTarget = $items.first();
break;
case FOCUS_LAST:
$newTarget = $items.last();
break;
default:
return false
}
if (0 !== $newTarget.length) {
this.option("focusedElement", $newTarget)
}
},
_prevItem: function($items) {
var $target = this._getActiveItem(),
targetIndex = $items.index($target),
$last = $items.last(),
$item = $($items[targetIndex - 1]),
loop = this.option("loopItemFocus");
if (0 === $item.length && loop) {
$item = $last
}
return $item
},
_nextItem: function($items) {
var $target = this._getActiveItem(true),
targetIndex = $items.index($target),
$first = $items.first(),
$item = $($items[targetIndex + 1]),
loop = this.option("loopItemFocus");
if (0 === $item.length && loop) {
$item = $first
}
return $item
},
_selectFocusedItem: function($target) {
this.selectItem($target)
},
_removeFocusedItem: function($target) {
if ($target && $target.length) {
this._toggleFocusClass(false, $target);
$target.removeAttr("id")
}
},
_refreshActiveDescendant: function() {
this.setAria("activedescendant", "");
this.setAria("activedescendant", this.getFocusedItemId())
},
_setFocusedItem: function($target) {
if (!$target || !$target.length) {
return
}
$target.attr("id", this.getFocusedItemId());
this._toggleFocusClass(true, $target);
this.onFocusedItemChanged(this.getFocusedItemId());
this._refreshActiveDescendant();
if (this.option("selectOnFocus")) {
this._selectFocusedItem($target)
}
},
_findItemElementByItem: function(item) {
var result = $(),
that = this;
this.itemElements().each(function() {
var $item = $(this);
if ($item.data(that._itemDataKey()) === item) {
result = $item;
return false
}
});
return result
},
_getIndexByItem: function(item) {
return this.option("items").indexOf(item)
},
_itemOptionChanged: function(item, property, value) {
var $item = this._findItemElementByItem(item);
switch (property) {
case "visible":
this._renderItemVisibleState($item, value);
break;
case "disabled":
this._renderItemDisableState($item, value);
break;
default:
var index = this._getIndexByItem(item);
this._renderItem(index, item, null, $item)
}
},
_renderItemVisibleState: function($item, value) {
$item.toggleClass(INVISIBLE_STATE_CLASS, !value)
},
_renderItemDisableState: function($item, value) {
$item.toggleClass(DISABLED_STATE_CLASS, !!value)
},
_optionChanged: function(args) {
if ("items" === args.name) {
var matches = args.fullName.match(ITEM_PATH_REGEX);
if (matches && matches.length) {
var property = matches[matches.length - 1],
itemPath = args.fullName.replace("." + property, ""),
item = this.option(itemPath);
this._itemOptionChanged(item, property, args.value);
return
}
}
switch (args.name) {
case "items":
case "_itemAttributes":
case "itemTemplateProperty":
this._cleanRenderedItems();
this._invalidate();
break;
case "dataSource":
this.option("items", []);
this._refreshDataSource();
this._renderEmptyMessage();
break;
case "noDataText":
this._renderEmptyMessage();
break;
case "itemTemplate":
this._invalidate();
break;
case "onItemRendered":
this._createItemRenderAction();
break;
case "onItemClick":
break;
case "onItemHold":
case "itemHoldTimeout":
this._attachHoldEvent();
break;
case "onItemContextMenu":
this._attachContextMenuEvent();
break;
case "onFocusedItemChanged":
this.onFocusedItemChanged = this._createActionByOption("onFocusedItemChanged");
break;
case "selectOnFocus":
case "loopItemFocus":
case "focusOnSelectedItem":
break;
case "focusedElement":
this._removeFocusedItem(args.previousValue);
this._setFocusedItem(args.value);
break;
default:
this.callBase(args)
}
},
_loadNextPage: function() {
var dataSource = this._dataSource;
this._expectNextPageLoading();
dataSource.pageIndex(1 + dataSource.pageIndex());
return dataSource.load()
},
_expectNextPageLoading: function() {
this._startIndexForAppendedItems = 0
},
_expectLastItemLoading: function() {
this._startIndexForAppendedItems = -1
},
_forgetNextPageLoading: function() {
this._startIndexForAppendedItems = null
},
_dataSourceChangedHandler: function(newItems) {
var items = this.option("items");
if (this._initialized && items && this._shouldAppendItems()) {
this._renderedItemsCount = items.length;
if (!this._isLastPage() || this._startIndexForAppendedItems !== -1) {
this.option().items = items.concat(newItems.slice(this._startIndexForAppendedItems))
}
this._forgetNextPageLoading();
this._renderContent();
this._renderFocusTarget()
} else {
this.option("items", newItems)
}
},
_dataSourceLoadErrorHandler: function() {
this._forgetNextPageLoading();
this.option("items", this.option("items"))
},
_shouldAppendItems: function() {
return null != this._startIndexForAppendedItems && this._allowDynamicItemsAppend()
},
_allowDynamicItemsAppend: function() {
return false
},
_clean: function() {
this._cleanFocusState();
this._cleanItemContainer()
},
_cleanItemContainer: function() {
this._itemContainer().empty()
},
_dispose: function() {
this.callBase();
clearTimeout(this._itemFocusTimeout)
},
_refresh: function() {
this._cleanRenderedItems();
this.callBase.apply(this, arguments)
},
_itemContainer: function() {
return this.element()
},
_itemClass: function() {
return ITEM_CLASS
},
_itemContentClass: function() {
return this._itemClass() + CONTENT_CLASS_POSTFIX
},
_selectedItemClass: function() {
return SELECTED_ITEM_CLASS
},
_itemResponseWaitClass: function() {
return ITEM_RESPONSE_WAIT_CLASS
},
_itemSelector: function() {
return "." + this._itemClass()
},
_itemDataKey: function() {
return ITEM_DATA_KEY
},
_itemIndexKey: function() {
return ITEM_INDEX_KEY
},
_itemElements: function() {
return this._itemContainer().find(this._itemSelector())
},
_render: function() {
this.onFocusedItemChanged = this._createActionByOption("onFocusedItemChanged");
this.callBase();
this.element().addClass(COLLECTION_CLASS);
this._attachClickEvent();
this._attachHoldEvent();
this._attachContextMenuEvent()
},
_attachClickEvent: function() {
var itemSelector = this._itemSelector(),
clickEventNamespace = eventUtils.addNamespace(clickEvent.name, this.NAME),
pointerDownEventNamespace = eventUtils.addNamespace(pointerEvents.down, this.NAME),
that = this;
var pointerDownAction = new Action(function(args) {
var event = args.event;
that._itemPointerDownHandler(event)
});
this._itemContainer().off(clickEventNamespace, itemSelector).off(pointerDownEventNamespace, itemSelector).on(clickEventNamespace, itemSelector, $.proxy(function(e) {
this._itemClickHandler(e)
}, this)).on(pointerDownEventNamespace, itemSelector, function(e) {
pointerDownAction.execute({
element: $(e.target),
event: e
})
})
},
_itemClickHandler: function(e, args, config) {
this._itemJQueryEventHandler(e, "onItemClick", args, config)
},
_itemPointerDownHandler: function(e) {
if (!this.option("focusStateEnabled")) {
return
}
clearTimeout(this._itemFocusTimeout);
this._itemFocusTimeout = setTimeout(function() {
if (e.isDefaultPrevented()) {
return
}
var $target = $(e.target),
$closestItem = $target.closest(this._itemElements()),
$closestFocusable = $target.closest(selectors.focusable);
if ($closestItem.length && $.inArray($closestFocusable.get(0), this._focusTarget()) !== -1) {
this.option("focusedElement", $closestItem)
}
}.bind(this))
},
_attachHoldEvent: function() {
var $itemContainer = this._itemContainer(),
itemSelector = this._itemSelector(),
eventName = eventUtils.addNamespace(holdEvent.name, this.NAME);
$itemContainer.off(eventName, itemSelector);
if (this._shouldAttachHoldEvent()) {
$itemContainer.on(eventName, itemSelector, {
timeout: this._getHoldTimeout()
}, $.proxy(this._itemHoldHandler, this))
}
},
_getHoldTimeout: function() {
return this.option("itemHoldTimeout")
},
_shouldAttachHoldEvent: function() {
return this.option("onItemHold")
},
_itemHoldHandler: function(e) {
this._itemJQueryEventHandler(e, "onItemHold")
},
_attachContextMenuEvent: function() {
var $itemContainer = this._itemContainer(),
itemSelector = this._itemSelector(),
eventName = eventUtils.addNamespace(contextmenuEvent.name, this.NAME);
$itemContainer.off(eventName, itemSelector);
if (this._shouldAttachContextMenuEvent()) {
$itemContainer.on(eventName, itemSelector, $.proxy(this._itemContextMenuHandler, this))
}
},
_shouldAttachContextMenuEvent: function() {
return this.option("onItemContextMenu")
},
_itemContextMenuHandler: function(e) {
this._itemJQueryEventHandler(e, "onItemContextMenu")
},
_renderContentImpl: function() {
var items = this.option("items") || [];
if (this._renderedItemsCount) {
this._renderItems(items.slice(this._renderedItemsCount))
} else {
this._renderItems(items)
}
},
_renderItems: function(items) {
if (items.length) {
$.each(items, $.proxy(this._renderItem, this))
}
this._renderEmptyMessage()
},
_renderItem: function(index, itemData, $container, $itemToReplace) {
$container = $container || this._itemContainer();
var $itemFrame = this._renderItemFrame(index, itemData, $container, $itemToReplace);
this._setElementData($itemFrame, itemData, index);
$itemFrame.attr(this.option("_itemAttributes"));
this._attachItemClickEvent(itemData, $itemFrame);
var $itemContent = $itemFrame.find("." + ITEM_CONTENT_PLACEHOLDER_CLASS);
$itemContent.removeClass(ITEM_CONTENT_PLACEHOLDER_CLASS);
var renderContentPromise = this._renderItemContent({
index: index,
itemData: itemData,
container: $itemContent,
contentClass: this._itemContentClass(),
defaultTemplateName: this.option("itemTemplate")
});
var that = this;
$.when(renderContentPromise).done(function($itemContent) {
that._postprocessRenderItem({
itemElement: $itemFrame,
itemContent: $itemContent,
itemData: itemData,
itemIndex: index
});
that._executeItemRenderAction(index, itemData, $itemFrame)
});
return $itemFrame
},
_attachItemClickEvent: function(itemData, $itemElement) {
if (!itemData || !itemData.onClick) {
return
}
$itemElement.on(clickEvent.name, $.proxy(function(e) {
this._itemEventHandlerByHandler($itemElement, itemData.onClick, {
jQueryEvent: e
})
}, this))
},
_renderItemContent: function(args) {
var itemTemplateName = this._getItemTemplateName(args);
var itemTemplate = this._getTemplate(itemTemplateName);
this._addItemContentClasses(args);
var $templateResult = this._createItemByTemplate(itemTemplate, args);
if (!$templateResult.hasClass(TEMPLATE_WRAPPER_CLASS)) {
return args.container
}
return this._renderItemContentByNode(args, $templateResult)
},
_renderItemContentByNode: function(args, $node) {
args.container.replaceWith($node);
args.container = $node;
this._addItemContentClasses(args);
return $node
},
_addItemContentClasses: function(args) {
var classes = [ITEM_CLASS + CONTENT_CLASS_POSTFIX, args.contentClass];
args.container.addClass(classes.join(" "))
},
_renderItemFrame: function(index, itemData, $container, $itemToReplace) {
var itemFrameTemplate = this.option("templateProvider").getTemplates(this).itemFrame,
$itemFrame = itemFrameTemplate.render({
model: commonUtils.isDefined(itemData) ? itemData : {},
container: $container,
index: index
});
if ($itemToReplace && $itemToReplace.length) {
$itemToReplace.replaceWith($itemFrame)
} else {
$itemFrame.appendTo($container)
}
return $itemFrame
},
_postprocessRenderItem: $.noop,
_executeItemRenderAction: function(index, itemData, itemElement) {
this._getItemRenderAction()({
itemElement: itemElement,
itemIndex: index,
itemData: itemData
})
},
_setElementData: function(element, data, index) {
element.addClass([ITEM_CLASS, this._itemClass()].join(" ")).data(this._itemDataKey(), data).data(this._itemIndexKey(), index)
},
_createItemRenderAction: function() {
return this._itemRenderAction = this._createActionByOption("onItemRendered", {
element: this.element(),
excludeValidators: ["designMode", "disabled", "readOnly"],
category: "rendering"
})
},
_getItemRenderAction: function() {
return this._itemRenderAction || this._createItemRenderAction()
},
_getItemTemplateName: function(args) {
var data = args.itemData,
templateProperty = args.templateProperty || this.option("itemTemplateProperty"),
template = data && data[templateProperty];
return template || args.defaultTemplateName
},
_createItemByTemplate: function(itemTemplate, renderArgs) {
return itemTemplate.render({
model: renderArgs.itemData,
container: renderArgs.container,
index: renderArgs.index
})
},
_emptyMessageContainer: function() {
return this._itemContainer()
},
_renderEmptyMessage: function() {
var noDataText = this.option("noDataText"),
items = this.option("items"),
hideNoData = !noDataText || items && items.length || this._isDataSourceLoading();
if (hideNoData && this._$nodata) {
this._$nodata.remove();
this._$nodata = null;
this.setAria("label", void 0)
}
if (!hideNoData) {
this._$nodata = this._$nodata || $("
").addClass("dx-empty-message");
this._$nodata.appendTo(this._emptyMessageContainer()).html(noDataText);
this.setAria("label", noDataText)
}
this.element().toggleClass(EMPTY_COLLECTION, !hideNoData)
},
_itemJQueryEventHandler: function(jQueryEvent, handlerOptionName, actionArgs, actionConfig) {
this._itemEventHandler(jQueryEvent.target, handlerOptionName, $.extend(actionArgs, {
jQueryEvent: jQueryEvent
}), actionConfig)
},
_itemEventHandler: function(initiator, handlerOptionName, actionArgs, actionConfig) {
var action = this._createActionByOption(handlerOptionName, $.extend({
validatingTargetName: "itemElement"
}, actionConfig));
return this._itemEventHandlerImpl(initiator, action, actionArgs)
},
_itemEventHandlerByHandler: function(initiator, handler, actionArgs, actionConfig) {
var action = this._createAction(handler, $.extend({
validatingTargetName: "itemElement"
}, actionConfig));
return this._itemEventHandlerImpl(initiator, action, actionArgs)
},
_itemEventHandlerImpl: function(initiator, action, actionArgs) {
var $itemElement = this._closestItemElement($(initiator));
return action($.extend(this._extendActionArgs($itemElement), actionArgs))
},
_extendActionArgs: function($itemElement) {
return {
itemElement: $itemElement,
itemIndex: this._itemElements().index($itemElement),
itemData: this._getItemData($itemElement)
}
},
_closestItemElement: function($element) {
return $($element).closest(this._itemSelector())
},
_getItemData: function(itemElement) {
return $(itemElement).data(this._itemDataKey())
},
getFocusedItemId: function() {
if (!this._focusedItemId) {
this._focusedItemId = new Guid
}
return this._focusedItemId
},
itemElements: function() {
return this._itemElements()
},
itemsContainer: function() {
return this._itemContainer()
}
}).include(DataHelperMixin);
CollectionWidget.publicName("CollectionWidget");
module.exports = CollectionWidget
},
/*!******************************!*\
!*** ./Scripts/core/guid.js ***!
\******************************/
function(module, exports, __webpack_require__) {
var Class = __webpack_require__( /*! ./class */ 20);
var Guid = Class.inherit({
ctor: function(value) {
if (value) {
value = String(value)
}
this._value = this._normalize(value || this._generate())
},
_normalize: function(value) {
value = value.replace(/[^a-f0-9]/gi, "").toLowerCase();
while (value.length < 32) {
value += "0"
}
return [value.substr(0, 8), value.substr(8, 4), value.substr(12, 4), value.substr(16, 4), value.substr(20, 12)].join("-")
},
_generate: function() {
var value = "";
for (var i = 0; i < 32; i++) {
value += Math.round(15 * Math.random()).toString(16)
}
return value
},
toString: function() {
return this._value
},
valueOf: function() {
return this._value
},
toJSON: function() {
return this._value
}
});
module.exports = Guid
},
/*!*************************************************!*\
!*** ./Scripts/ui/collection/ui.data_helper.js ***!
\*************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
DataSource = __webpack_require__( /*! ../../data/data_source/data_source */ 155).DataSource,
normalizeDataSourceOptions = __webpack_require__( /*! ../../data/data_source/data_source */ 155).normalizeDataSourceOptions;
var DATA_SOURCE_OPTIONS_METHOD = "_dataSourceOptions",
DATA_SOURCE_CHANGED_METHOD = "_dataSourceChangedHandler",
DATA_SOURCE_LOAD_ERROR_METHOD = "_dataSourceLoadErrorHandler",
DATA_SOURCE_LOADING_CHANGED_METHOD = "_dataSourceLoadingChangedHandler";
var DataHelperMixin = {
postCtor: function() {
this.on("disposing", function() {
this._disposeDataSource()
})
},
_refreshDataSource: function() {
this._initDataSource();
this._loadDataSource()
},
_initDataSource: function() {
var widgetDataSourceOptions, dataSourceType, dataSourceOptions = this.option("dataSource");
this._disposeDataSource();
if (dataSourceOptions) {
if (dataSourceOptions instanceof DataSource) {
this._isSharedDataSource = true;
this._dataSource = dataSourceOptions
} else {
widgetDataSourceOptions = DATA_SOURCE_OPTIONS_METHOD in this ? this[DATA_SOURCE_OPTIONS_METHOD]() : {};
dataSourceType = this._dataSourceType ? this._dataSourceType() : DataSource;
this._dataSource = new dataSourceType($.extend(true, {}, widgetDataSourceOptions, normalizeDataSourceOptions(dataSourceOptions)))
}
this._addDataSourceHandlers()
}
},
_addDataSourceHandlers: function() {
if (DATA_SOURCE_CHANGED_METHOD in this) {
this._addDataSourceChangeHandler()
}
if (DATA_SOURCE_LOAD_ERROR_METHOD in this) {
this._addDataSourceLoadErrorHandler()
}
if (DATA_SOURCE_LOADING_CHANGED_METHOD in this) {
this._addDataSourceLoadingChangedHandler()
}
this._addReadyWatcher()
},
_addReadyWatcher: function() {
this._dataSource.on("loadingChanged", $.proxy(function(isLoading) {
this._ready && this._ready(!isLoading)
}, this))
},
_addDataSourceChangeHandler: function() {
var dataSource = this._dataSource;
this._proxiedDataSourceChangedHandler = $.proxy(function() {
this[DATA_SOURCE_CHANGED_METHOD](dataSource.items())
}, this);
dataSource.on("changed", this._proxiedDataSourceChangedHandler)
},
_addDataSourceLoadErrorHandler: function() {
this._proxiedDataSourceLoadErrorHandler = $.proxy(this[DATA_SOURCE_LOAD_ERROR_METHOD], this);
this._dataSource.on("loadError", this._proxiedDataSourceLoadErrorHandler)
},
_addDataSourceLoadingChangedHandler: function() {
this._proxiedDataSourceLoadingChangedHandler = $.proxy(this[DATA_SOURCE_LOADING_CHANGED_METHOD], this);
this._dataSource.on("loadingChanged", this._proxiedDataSourceLoadingChangedHandler)
},
_loadDataSource: function() {
if (this._dataSource) {
var dataSource = this._dataSource;
if (dataSource.isLoaded()) {
this._proxiedDataSourceChangedHandler && this._proxiedDataSourceChangedHandler()
} else {
dataSource.load()
}
}
},
_loadSingle: function(key, value) {
key = "this" === key ? this._dataSource.key() || "this" : key;
return this._dataSource.loadSingle(key, value)
},
_isLastPage: function() {
return !this._dataSource || this._dataSource.isLastPage() || !this._dataSource._pageSize
},
_isDataSourceLoading: function() {
return this._dataSource && this._dataSource.isLoading()
},
_disposeDataSource: function() {
if (this._dataSource) {
if (this._isSharedDataSource) {
delete this._isSharedDataSource;
this._proxiedDataSourceChangedHandler && this._dataSource.off("changed", this._proxiedDataSourceChangedHandler);
this._proxiedDataSourceLoadErrorHandler && this._dataSource.off("loadError", this._proxiedDataSourceLoadErrorHandler);
this._proxiedDataSourceLoadingChangedHandler && this._dataSource.off("loadingChanged", this._proxiedDataSourceLoadingChangedHandler)
} else {
this._dataSource.dispose()
}
delete this._dataSource;
delete this._proxiedDataSourceChangedHandler;
delete this._proxiedDataSourceLoadErrorHandler;
delete this._proxiedDataSourceLoadingChangedHandler
}
}
};
module.exports = DataHelperMixin
},
/*!*************************************************!*\
!*** ./Scripts/data/data_source/data_source.js ***!
\*************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
dataUtils = __webpack_require__( /*! ../utils */ 137),
Store = __webpack_require__( /*! ../abstract_store */ 156),
ArrayStore = __webpack_require__( /*! ../array_store */ 162),
CustomStore = __webpack_require__( /*! ../custom_store */ 163),
EventsMixin = __webpack_require__( /*! ../../core/events_mixin */ 39),
errors = __webpack_require__( /*! ../errors */ 157).errors,
array = __webpack_require__( /*! ../../core/utils/array */ 111),
queue = __webpack_require__( /*! ../../core/utils/queue */ 51),
__isString = commonUtils.isString,
__isNumber = commonUtils.isNumber,
__isBoolean = commonUtils.isBoolean,
__isDefined = commonUtils.isDefined;
var CANCELED_TOKEN = "canceled";
function OperationManager() {
this._counter = -1;
this._deferreds = {}
}
OperationManager.prototype.constructor = OperationManager;
OperationManager.prototype.add = function(deferred) {
this._counter += 1;
this._deferreds[this._counter] = deferred;
return this._counter
};
OperationManager.prototype.remove = function(operationId) {
return delete this._deferreds[operationId]
};
OperationManager.prototype.cancel = function(operationId) {
if (operationId in this._deferreds) {
this._deferreds[operationId].reject(CANCELED_TOKEN);
return true
}
return false
};
var operationManager = new OperationManager;
function isPending(deferred) {
return "pending" === deferred.state()
}
function normalizeDataSourceOptions(options) {
var store;
function createCustomStoreFromLoadFunc() {
var storeConfig = {};
$.each(["useDefaultSearch", "key", "load", "byKey", "lookup", "totalCount", "insert", "update", "remove"], function() {
storeConfig[this] = options[this];
delete options[this]
});
return new CustomStore(storeConfig)
}
function createStoreFromConfig(storeConfig) {
var alias = storeConfig.type;
delete storeConfig.type;
return Store.create(alias, storeConfig)
}
function createCustomStoreFromUrl(url) {
return new CustomStore({
load: function() {
return $.getJSON(url)
}
})
}
if ("string" === typeof options) {
options = {
paginate: false,
store: createCustomStoreFromUrl(options)
}
}
if (void 0 === options) {
options = []
}
if ($.isArray(options) || options instanceof Store) {
options = {
store: options
}
} else {
options = $.extend({}, options)
}
if (void 0 === options.store) {
options.store = []
}
store = options.store;
if ("load" in options) {
store = createCustomStoreFromLoadFunc()
} else {
if ($.isArray(store)) {
store = new ArrayStore(store)
} else {
if ($.isPlainObject(store)) {
store = createStoreFromConfig($.extend({}, store))
}
}
}
options.store = store;
return options
}
function normalizeStoreLoadOptionAccessorArguments(originalArguments) {
switch (originalArguments.length) {
case 0:
return;
case 1:
return originalArguments[0]
}
return $.makeArray(originalArguments)
}
function generateStoreLoadOptionAccessor(optionName) {
return function() {
var args = normalizeStoreLoadOptionAccessorArguments(arguments);
if (void 0 === args) {
return this._storeLoadOptions[optionName]
}
this._storeLoadOptions[optionName] = args
}
}
function mapDataRespectingGrouping(items, mapper, groupInfo) {
function mapRecursive(items, level) {
if (!commonUtils.isArray(items)) {
return items
}
return level ? mapGroup(items, level) : $.map(items, mapper)
}
function mapGroup(group, level) {
return $.map(group, function(item) {
var result = {
key: item.key,
items: mapRecursive(item.items, level - 1)
};
if ("aggregates" in item) {
result.aggregates = item.aggregates
}
return result
})
}
return mapRecursive(items, groupInfo ? dataUtils.normalizeSortingInfo(groupInfo).length : 0)
}
var DataSource = Class.inherit({
ctor: function(options) {
var that = this;
options = normalizeDataSourceOptions(options);
this._store = options.store;
this._storeLoadOptions = this._extractLoadOptions(options);
this._mapFunc = options.map;
this._postProcessFunc = options.postProcess;
this._pageIndex = void 0 !== options.pageIndex ? options.pageIndex : 0;
this._pageSize = void 0 !== options.pageSize ? options.pageSize : 20;
this._loadingCount = 0;
this._loadQueue = this._createLoadQueue();
this._searchValue = "searchValue" in options ? options.searchValue : null;
this._searchOperation = options.searchOperation || "contains";
this._searchExpr = options.searchExpr;
this._paginate = options.paginate;
$.each(["onChanged", "onLoadError", "onLoadingChanged", "onCustomizeLoadResult", "onCustomizeStoreLoadOptions"], function(_, optionName) {
if (optionName in options) {
that.on(optionName.substr(2, 1).toLowerCase() + optionName.substr(3), options[optionName])
}
});
this._init()
},
_init: function() {
this._items = [];
this._userData = {};
this._totalCount = -1;
this._isLoaded = false;
if (!__isDefined(this._paginate)) {
this._paginate = !this.group()
}
this._isLastPage = !this._paginate
},
dispose: function() {
this._disposeEvents();
delete this._store;
if (this._delayedLoadTask) {
this._delayedLoadTask.abort()
}
this._disposed = true
},
_extractLoadOptions: function(options) {
var result = {},
names = ["sort", "filter", "select", "group", "requireTotalCount"],
customNames = this._store._customLoadOptions();
if (customNames) {
names = names.concat(customNames)
}
$.each(names, function() {
result[this] = options[this]
});
return result
},
loadOptions: function() {
return this._storeLoadOptions
},
items: function() {
return this._items
},
pageIndex: function(newIndex) {
if (!__isNumber(newIndex)) {
return this._pageIndex
}
this._pageIndex = newIndex;
this._isLastPage = !this._paginate
},
paginate: function(value) {
if (!__isBoolean(value)) {
return this._paginate
}
if (this._paginate !== value) {
this._paginate = value;
this.pageIndex(0)
}
},
pageSize: function(value) {
if (!__isNumber(value)) {
return this._pageSize
}
this._pageSize = value
},
isLastPage: function() {
return this._isLastPage
},
sort: generateStoreLoadOptionAccessor("sort"),
filter: function() {
var newFilter = normalizeStoreLoadOptionAccessorArguments(arguments);
if (void 0 === newFilter) {
return this._storeLoadOptions.filter
}
this._storeLoadOptions.filter = newFilter;
this.pageIndex(0)
},
group: generateStoreLoadOptionAccessor("group"),
select: generateStoreLoadOptionAccessor("select"),
requireTotalCount: function(value) {
if (!__isBoolean(value)) {
return this._storeLoadOptions.requireTotalCount
}
this._storeLoadOptions.requireTotalCount = value
},
searchValue: function(value) {
if (arguments.length < 1) {
return this._searchValue
}
this._searchValue = value;
this.pageIndex(0)
},
searchOperation: function(op) {
if (!__isString(op)) {
return this._searchOperation
}
this._searchOperation = op;
this.pageIndex(0)
},
searchExpr: function(expr) {
var argc = arguments.length;
if (0 === argc) {
return this._searchExpr
}
if (argc > 1) {
expr = $.makeArray(arguments)
}
this._searchExpr = expr;
this.pageIndex(0)
},
store: function() {
return this._store
},
key: function() {
return this._store && this._store.key()
},
totalCount: function() {
return this._totalCount
},
isLoaded: function() {
return this._isLoaded
},
isLoading: function() {
return this._loadingCount > 0
},
_createLoadQueue: function() {
return queue.create()
},
_changeLoadingCount: function(increment) {
var newLoading, oldLoading = this.isLoading();
this._loadingCount += increment;
newLoading = this.isLoading();
if (oldLoading ^ newLoading) {
this.fireEvent("loadingChanged", [newLoading])
}
},
_scheduleLoadCallbacks: function(deferred) {
var that = this;
that._changeLoadingCount(1);
deferred.always(function() {
that._changeLoadingCount(-1)
})
},
_scheduleFailCallbacks: function(deferred) {
var that = this;
deferred.fail(function() {
if (arguments[0] === CANCELED_TOKEN) {
return
}
that.fireEvent("loadError", arguments)
})
},
_scheduleChangedCallbacks: function(deferred) {
var that = this;
deferred.done(function() {
that.fireEvent("changed")
})
},
loadSingle: function(propName, propValue) {
var that = this;
var d = $.Deferred(),
key = this.key(),
store = this._store,
options = this._createStoreLoadOptions(),
handleDone = function(data) {
if (!__isDefined(data) || array.isEmpty(data)) {
d.reject(new errors.Error("E4009"))
} else {
d.resolve(that._applyMapFunction($.makeArray(data))[0])
}
};
this._scheduleFailCallbacks(d);
if (arguments.length < 2) {
propValue = propName;
propName = key
}
delete options.skip;
delete options.group;
delete options.refresh;
delete options.pageIndex;
delete options.searchString;
(function() {
if (propName === key || store instanceof CustomStore) {
return store.byKey(propValue, options)
}
options.take = 1;
options.filter = options.filter ? [options.filter, [propName, propValue]] : [propName, propValue];
return store.load(options)
})().fail(d.reject).done(handleDone);
return d.promise()
},
load: function() {
var loadOperation, that = this,
d = $.Deferred();
function loadTask() {
if (that._disposed) {
return
}
if (!isPending(d)) {
return
}
return that._loadFromStore(loadOperation, d)
}
this._scheduleLoadCallbacks(d);
this._scheduleFailCallbacks(d);
this._scheduleChangedCallbacks(d);
loadOperation = this._createLoadOperation(d);
this.fireEvent("customizeStoreLoadOptions", [loadOperation]);
this._loadQueue.add(function() {
if ("number" === typeof loadOperation.delay) {
that._delayedLoadTask = commonUtils.executeAsync(loadTask, loadOperation.delay)
} else {
loadTask()
}
return d.promise()
});
return d.promise({
operationId: loadOperation.operationId
})
},
_createLoadOperation: function(deferred) {
var id = operationManager.add(deferred),
options = this._createStoreLoadOptions();
deferred.always(function() {
operationManager.remove(id)
});
return {
operationId: id,
storeLoadOptions: options
}
},
reload: function() {
this._init();
return this.load()
},
cancel: function(operationId) {
return operationManager.cancel(operationId)
},
_addSearchOptions: function(storeLoadOptions) {
if (this._disposed) {
return
}
if (this.store()._useDefaultSearch) {
this._addSearchFilter(storeLoadOptions)
} else {
storeLoadOptions.searchOperation = this._searchOperation;
storeLoadOptions.searchValue = this._searchValue;
storeLoadOptions.searchExpr = this._searchExpr
}
},
_createStoreLoadOptions: function() {
var result = $.extend({}, this._storeLoadOptions);
this._addSearchOptions(result);
if (this._paginate) {
if (this._pageSize) {
result.skip = this._pageIndex * this._pageSize;
result.take = this._pageSize
}
}
result.userData = this._userData;
return result
},
_addSearchFilter: function(storeLoadOptions) {
var value = this._searchValue,
op = this._searchOperation,
selector = this._searchExpr,
searchFilter = [];
if (!value) {
return
}
if (!selector) {
selector = "this"
}
if (!$.isArray(selector)) {
selector = [selector]
}
$.each(selector, function(i, item) {
if (searchFilter.length) {
searchFilter.push("or")
}
searchFilter.push([item, op, value])
});
if (storeLoadOptions.filter) {
storeLoadOptions.filter = [searchFilter, storeLoadOptions.filter]
} else {
storeLoadOptions.filter = searchFilter
}
},
_loadFromStore: function(loadOptions, pendingDeferred) {
var that = this;
function handleSuccess(data, extra) {
function processResult() {
var loadResult;
if (data && !$.isArray(data) && data.data) {
extra = data;
data = data.data
}
loadResult = $.extend({
data: data,
extra: extra
}, loadOptions);
that.fireEvent("customizeLoadResult", [loadResult]);
$.when(loadResult.data).done(function(data) {
loadResult.data = data;
that._processStoreLoadResult(loadResult, pendingDeferred)
}).fail(pendingDeferred.reject)
}
if (that._disposed) {
return
}
if (!isPending(pendingDeferred)) {
return
}
processResult()
}
if (loadOptions.data) {
return $.Deferred().resolve(loadOptions.data).done(handleSuccess)
}
return this.store().load(loadOptions.storeLoadOptions).done(handleSuccess).fail(pendingDeferred.reject)
},
_processStoreLoadResult: function(loadResult, pendingDeferred) {
var that = this;
var data = $.makeArray(loadResult.data),
extra = loadResult.extra,
storeLoadOptions = loadResult.storeLoadOptions;
function resolvePendingDeferred() {
that._isLoaded = true;
that._totalCount = isFinite(extra.totalCount) ? extra.totalCount : -1;
return pendingDeferred.resolve(data, extra)
}
function proceedLoadingTotalCount() {
that.store().totalCount(storeLoadOptions).done(function(count) {
extra.totalCount = count;
resolvePendingDeferred()
}).fail(pendingDeferred.reject)
}
if (that._disposed) {
return
}
data = that._applyPostProcessFunction(that._applyMapFunction(data));
if (!$.isPlainObject(extra)) {
extra = {}
}
that._items = data;
if (!data.length || !that._paginate || that._pageSize && data.length < that._pageSize) {
that._isLastPage = true
}
if (storeLoadOptions.requireTotalCount && !isFinite(extra.totalCount)) {
proceedLoadingTotalCount()
} else {
resolvePendingDeferred()
}
},
_applyMapFunction: function(data) {
if (this._mapFunc) {
return mapDataRespectingGrouping(data, this._mapFunc, this.group())
}
return data
},
_applyPostProcessFunction: function(data) {
if (this._postProcessFunc) {
return this._postProcessFunc(data)
}
return data
}
}).include(EventsMixin);
exports.DataSource = DataSource;
exports.normalizeDataSourceOptions = normalizeDataSourceOptions
},
/*!****************************************!*\
!*** ./Scripts/data/abstract_store.js ***!
\****************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../core/class */ 20),
abstract = Class.abstract,
EventsMixin = __webpack_require__( /*! ../core/events_mixin */ 39),
errorsModule = __webpack_require__( /*! ./errors */ 157),
dataUtils = __webpack_require__( /*! ./utils */ 137),
normalizeSortingInfo = dataUtils.normalizeSortingInfo,
compileGetter = __webpack_require__( /*! ../core/utils/data */ 36).compileGetter,
Query = __webpack_require__( /*! ./query */ 158),
storeImpl = {};
function multiLevelGroup(query, groupInfo) {
query = query.groupBy(groupInfo[0].selector);
if (groupInfo.length > 1) {
query = query.select(function(g) {
return $.extend({}, g, {
items: multiLevelGroup(Query(g.items), groupInfo.slice(1)).toArray()
})
})
}
return query
}
function arrangeSortingInfo(groupInfo, sortInfo) {
var filteredGroup = [];
$.each(groupInfo, function(_, group) {
var collision = $.grep(sortInfo, function(sort) {
return group.selector === sort.selector
});
if (collision.length < 1) {
filteredGroup.push(group)
}
});
return filteredGroup.concat(sortInfo)
}
var Store = Class.inherit({
ctor: function(options) {
var that = this;
options = options || {};
$.each(["onLoaded", "onLoading", "onInserted", "onInserting", "onUpdated", "onUpdating", "onRemoved", "onRemoving", "onModified", "onModifying"], function(_, optionName) {
if (optionName in options) {
that.on(optionName.slice(2).toLowerCase(), options[optionName])
}
});
this._key = options.key;
this._errorHandler = options.errorHandler;
this._useDefaultSearch = true
},
_customLoadOptions: function() {
return null
},
key: function() {
return this._key
},
keyOf: function(obj) {
if (!this._keyGetter) {
this._keyGetter = compileGetter(this.key())
}
return this._keyGetter(obj)
},
_requireKey: function() {
if (!this.key()) {
throw errorsModule.errors.Error("E4005")
}
},
load: function(options) {
var that = this;
options = options || {};
this.fireEvent("loading", [options]);
return this._withLock(this._loadImpl(options)).done(function(result, extra) {
that.fireEvent("loaded", [result, options])
})
},
_loadImpl: function(options) {
var filter = options.filter,
sort = options.sort,
select = options.select,
group = options.group,
skip = options.skip,
take = options.take,
q = this.createQuery(options);
if (filter) {
q = q.filter(filter)
}
if (group) {
group = normalizeSortingInfo(group)
}
if (sort || group) {
sort = normalizeSortingInfo(sort || []);
if (group) {
sort = arrangeSortingInfo(group, sort)
}
$.each(sort, function(index) {
q = q[index ? "thenBy" : "sortBy"](this.selector, this.desc)
})
}
if (select) {
q = q.select(select)
}
if (group) {
q = multiLevelGroup(q, group)
}
if (take || skip) {
q = q.slice(skip || 0, take)
}
return q.enumerate()
},
_withLock: function(task) {
var result = $.Deferred();
task.done(function() {
var that = this,
args = arguments;
dataUtils.processRequestResultLock.promise().done(function() {
result.resolveWith(that, args)
})
}).fail(function() {
result.rejectWith(this, arguments)
});
return result
},
createQuery: abstract,
totalCount: function(options) {
return this._totalCountImpl(options)
},
_totalCountImpl: function(options) {
options = options || {};
var q = this.createQuery(options),
group = options.group,
filter = options.filter;
if (filter) {
q = q.filter(filter)
}
if (group) {
group = normalizeSortingInfo(group);
q = multiLevelGroup(q, group)
}
return q.count()
},
byKey: function(key, extraOptions) {
return this._addFailHandlers(this._withLock(this._byKeyImpl(key, extraOptions)))
},
_byKeyImpl: abstract,
insert: function(values) {
var that = this;
that.fireEvent("modifying");
that.fireEvent("inserting", [values]);
return that._addFailHandlers(that._insertImpl(values).done(function(callbackValues, callbackKey) {
that.fireEvent("inserted", [callbackValues, callbackKey]);
that.fireEvent("modified")
}))
},
_insertImpl: abstract,
update: function(key, values) {
var that = this;
that.fireEvent("modifying");
that.fireEvent("updating", [key, values]);
return that._addFailHandlers(that._updateImpl(key, values).done(function(callbackKey, callbackValues) {
that.fireEvent("updated", [callbackKey, callbackValues]);
that.fireEvent("modified")
}))
},
_updateImpl: abstract,
remove: function(key) {
var that = this;
that.fireEvent("modifying");
that.fireEvent("removing", [key]);
return that._addFailHandlers(that._removeImpl(key).done(function(callbackKey) {
that.fireEvent("removed", [callbackKey]);
that.fireEvent("modified")
}))
},
_removeImpl: abstract,
_addFailHandlers: function(deferred) {
return deferred.fail(this._errorHandler, errorsModule._errorHandler)
}
}).include(EventsMixin);
Store.create = function(alias, options) {
if (!(alias in storeImpl)) {
throw errorsModule.errors.Error("E4020", alias)
}
return new storeImpl[alias](options)
};
Store.inherit = function(inheritor) {
return function(members, alias) {
var type = inheritor.apply(this, [members]);
if (alias) {
storeImpl[alias] = type
}
return type
}
}(Store.inherit);
module.exports = Store;
module.exports.multiLevelGroup = multiLevelGroup;
module.exports.arrangeSortingInfo = arrangeSortingInfo
},
/*!********************************!*\
!*** ./Scripts/data/errors.js ***!
\********************************/
function(module, exports, __webpack_require__) {
var errorUtils = __webpack_require__( /*! ../core/utils/error */ 11),
coreErrors = __webpack_require__( /*! ../core/errors */ 17),
handlers = {};
var errors = errorUtils(coreErrors.ERROR_MESSAGES, {
E4000: "[DevExpress.data]: {0}",
E4001: "Unknown aggregating function is detected: '{0}'",
E4002: "Unsupported OData protocol version is used",
E4003: "Unknown filter operation is used: {0}",
E4004: "The thenby() method is called before the sortby() method",
E4005: "Store requires a key expression for this operation",
E4006: "ArrayStore 'data' option must be an array",
E4007: "Compound keys cannot be auto-generated",
E4008: "Attempt to insert an item with the a duplicated key",
E4009: "Data item cannot be found",
E4010: "CustomStore does not support creating queries",
E4011: "Custom Store method is not implemented or is not a function: {0}",
E4012: "Custom Store method returns an invalid value: {0}",
E4013: "Local Store requires the 'name' configuration option is specified",
E4014: "Unknown key type is detected: {0}",
E4015: "Unknown entity name or alias is used: {0}",
E4017: "Keys cannot be modified",
E4018: "The server has returned a non-numeric value in a response to an item count request",
E4019: "Mixing of group operators inside a single group of filter expression is not allowed",
E4020: "Unknown store type is detected: {0}"
});
function handleError(error) {
var id = "E4000";
if (error && "__id" in error) {
id = error.__id
}
errors.log(id, error)
}
var errorHandler = null;
var _errorHandler = function(error) {
handleError(error);
if (handlers.errorHandler) {
handlers.errorHandler(error)
}
};
handlers = {
errors: errors,
errorHandler: errorHandler,
_errorHandler: _errorHandler
};
module.exports = handlers
},
/*!*******************************!*\
!*** ./Scripts/data/query.js ***!
\*******************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
arrayQueryImpl = __webpack_require__( /*! ./array_query */ 159),
remoteQueryImpl = __webpack_require__( /*! ./remote_query */ 160);
var queryImpl = {
array: arrayQueryImpl,
remote: remoteQueryImpl
};
var query = function() {
var impl = $.isArray(arguments[0]) ? "array" : "remote";
return queryImpl[impl].apply(this, arguments)
};
module.exports = query;
module.exports.queryImpl = queryImpl
},
/*!*************************************!*\
!*** ./Scripts/data/array_query.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../core/class */ 20),
commonUtils = __webpack_require__( /*! ../core/utils/common */ 14),
compileGetter = __webpack_require__( /*! ../core/utils/data */ 36).compileGetter,
toComparable = __webpack_require__( /*! ../core/utils/data */ 36).toComparable,
errorsModule = __webpack_require__( /*! ./errors */ 157),
dataUtils = __webpack_require__( /*! ./utils */ 137);
var Iterator = Class.inherit({
toArray: function() {
var result = [];
this.reset();
while (this.next()) {
result.push(this.current())
}
return result
},
countable: function() {
return false
}
});
var ArrayIterator = Iterator.inherit({
ctor: function(array) {
this.array = array;
this.index = -1
},
next: function() {
if (this.index + 1 < this.array.length) {
this.index++;
return true
}
return false
},
current: function() {
return this.array[this.index]
},
reset: function() {
this.index = -1
},
toArray: function() {
return this.array.slice(0)
},
countable: function() {
return true
},
count: function() {
return this.array.length
}
});
var WrappedIterator = Iterator.inherit({
ctor: function(iter) {
this.iter = iter
},
next: function() {
return this.iter.next()
},
current: function() {
return this.iter.current()
},
reset: function() {
return this.iter.reset()
}
});
var MapIterator = WrappedIterator.inherit({
ctor: function(iter, mapper) {
this.callBase(iter);
this.index = -1;
this.mapper = mapper
},
current: function() {
return this.mapper(this.callBase(), this.index)
},
next: function() {
var hasNext = this.callBase();
if (hasNext) {
this.index++
}
return hasNext
}
});
var SortIterator = Iterator.inherit({
ctor: function(iter, getter, desc) {
if (!(iter instanceof MapIterator)) {
iter = new MapIterator(iter, this._wrap)
}
this.iter = iter;
this.rules = [{
getter: getter,
desc: desc
}]
},
thenBy: function(getter, desc) {
var result = new SortIterator(this.sortedIter || this.iter, getter, desc);
if (!this.sortedIter) {
result.rules = this.rules.concat(result.rules)
}
return result
},
next: function() {
this._ensureSorted();
return this.sortedIter.next()
},
current: function() {
this._ensureSorted();
return this.sortedIter.current()
},
reset: function() {
delete this.sortedIter
},
countable: function() {
return this.sortedIter || this.iter.countable()
},
count: function() {
if (this.sortedIter) {
return this.sortedIter.count()
}
return this.iter.count()
},
_ensureSorted: function() {
var that = this;
if (that.sortedIter) {
return
}
$.each(that.rules, function() {
this.getter = compileGetter(this.getter)
});
that.sortedIter = new MapIterator(new ArrayIterator(this.iter.toArray().sort(function(x, y) {
return that._compare(x, y)
})), that._unwrap)
},
_wrap: function(record, index) {
return {
index: index,
value: record
}
},
_unwrap: function(wrappedItem) {
return wrappedItem.value
},
_compare: function(x, y) {
var xIndex = x.index,
yIndex = y.index;
x = x.value;
y = y.value;
if (x === y) {
return xIndex - yIndex
}
for (var i = 0, rulesCount = this.rules.length; i < rulesCount; i++) {
var rule = this.rules[i],
xValue = toComparable(rule.getter(x)),
yValue = toComparable(rule.getter(y)),
factor = rule.desc ? -1 : 1;
if (null === xValue && null !== yValue) {
return -factor
}
if (null !== xValue && null === yValue) {
return factor
}
if (void 0 === xValue && void 0 !== yValue) {
return factor
}
if (void 0 !== xValue && void 0 === yValue) {
return -factor
}
if (xValue < yValue) {
return -factor
}
if (xValue > yValue) {
return factor
}
}
return xIndex - yIndex
}
});
var compileCriteria = function() {
var compileGroup = function(crit) {
var groupOperator, nextGroupOperator, idx = 0,
bag = [],
ops = [];
$.each(crit, function() {
if ($.isArray(this) || $.isFunction(this)) {
if (bag.length > 1 && groupOperator !== nextGroupOperator) {
throw new errorsModule.errors.Error("E4019")
}
ops.push(compileCriteria(this));
bag.push("op[" + idx + "](d)");
idx++;
groupOperator = nextGroupOperator;
nextGroupOperator = "&&"
} else {
nextGroupOperator = dataUtils.isConjunctiveOperator(this) ? "&&" : "||"
}
});
return new Function("op", "return function(d) { return " + bag.join(" " + groupOperator + " ") + " }")(ops)
};
var toString = function(value) {
return commonUtils.isDefined(value) ? value.toString() : ""
};
var compileBinary = function(crit) {
crit = dataUtils.normalizeBinaryCriterion(crit);
var getter = compileGetter(crit[0]),
op = crit[1],
value = crit[2];
value = toComparable(value);
switch (op.toLowerCase()) {
case "=":
return compileEquals(getter, value);
case "<>":
return compileEquals(getter, value, true);
case ">":
return function(obj) {
return toComparable(getter(obj)) > value
};
case "<":
return function(obj) {
return toComparable(getter(obj)) < value
};
case ">=":
return function(obj) {
return toComparable(getter(obj)) >= value
};
case "<=":
return function(obj) {
return toComparable(getter(obj)) <= value
};
case "startswith":
return function(obj) {
return 0 === toComparable(toString(getter(obj))).indexOf(value)
};
case "endswith":
return function(obj) {
var getterValue = toComparable(toString(getter(obj))),
searchValue = toString(value);
if (getterValue.length < searchValue.length) {
return false
}
return getterValue.lastIndexOf(value) === getterValue.length - value.length
};
case "contains":
return function(obj) {
return toComparable(toString(getter(obj))).indexOf(value) > -1
};
case "notcontains":
return function(obj) {
return toComparable(toString(getter(obj))).indexOf(value) === -1
}
}
throw errorsModule.errors.Error("E4003", op)
};
function compileEquals(getter, value, negate) {
return function(obj) {
obj = toComparable(getter(obj));
var result = useStrictComparison(value) ? obj === value : obj == value;
if (negate) {
result = !result
}
return result
}
}
function useStrictComparison(value) {
return "" === value || 0 === value || false === value
}
return function(crit) {
if ($.isFunction(crit)) {
return crit
}
if ($.isArray(crit[0])) {
return compileGroup(crit)
}
return compileBinary(crit)
}
}();
var FilterIterator = WrappedIterator.inherit({
ctor: function(iter, criteria) {
this.callBase(iter);
this.criteria = compileCriteria(criteria)
},
next: function() {
while (this.iter.next()) {
if (this.criteria(this.current())) {
return true
}
}
return false
}
});
var GroupIterator = Iterator.inherit({
ctor: function(iter, getter) {
this.iter = iter;
this.getter = getter
},
next: function() {
this._ensureGrouped();
return this.groupedIter.next()
},
current: function() {
this._ensureGrouped();
return this.groupedIter.current()
},
reset: function() {
delete this.groupedIter
},
countable: function() {
return !!this.groupedIter
},
count: function() {
return this.groupedIter.count()
},
_ensureGrouped: function() {
if (this.groupedIter) {
return
}
var hash = {},
keys = [],
iter = this.iter,
getter = compileGetter(this.getter);
iter.reset();
while (iter.next()) {
var current = iter.current(),
key = getter(current);
if (key in hash) {
hash[key].push(current)
} else {
hash[key] = [current];
keys.push(key)
}
}
this.groupedIter = new ArrayIterator($.map(keys, function(key) {
return {
key: key,
items: hash[key]
}
}))
}
});
var SelectIterator = WrappedIterator.inherit({
ctor: function(iter, getter) {
this.callBase(iter);
this.getter = compileGetter(getter)
},
current: function() {
return this.getter(this.callBase())
},
countable: function() {
return this.iter.countable()
},
count: function() {
return this.iter.count()
}
});
var SliceIterator = WrappedIterator.inherit({
ctor: function(iter, skip, take) {
this.callBase(iter);
this.skip = Math.max(0, skip);
this.take = Math.max(0, take);
this.pos = 0
},
next: function() {
if (this.pos >= this.skip + this.take) {
return false
}
while (this.pos < this.skip && this.iter.next()) {
this.pos++
}
this.pos++;
return this.iter.next()
},
reset: function() {
this.callBase();
this.pos = 0
},
countable: function() {
return this.iter.countable()
},
count: function() {
return Math.min(this.iter.count() - this.skip, this.take)
}
});
var arrayQueryImpl = function(iter, queryOptions) {
queryOptions = queryOptions || {};
if (!(iter instanceof Iterator)) {
iter = new ArrayIterator(iter)
}
var handleError = function(error) {
var handler = queryOptions.errorHandler;
if (handler) {
handler(error)
}
errorsModule._errorHandler(error)
};
var aggregateCore = function(aggregator) {
var seed, d = $.Deferred().fail(handleError),
step = aggregator.step,
finalize = aggregator.finalize;
try {
iter.reset();
if ("seed" in aggregator) {
seed = aggregator.seed
} else {
seed = iter.next() ? iter.current() : NaN
}
var accumulator = seed;
while (iter.next()) {
accumulator = step(accumulator, iter.current())
}
d.resolve(finalize ? finalize(accumulator) : accumulator)
} catch (x) {
d.reject(x)
}
return d.promise()
};
var aggregate = function(seed, step, finalize) {
if (arguments.length < 2) {
return aggregateCore({
step: arguments[0]
})
}
return aggregateCore({
seed: seed,
step: step,
finalize: finalize
})
};
var standardAggregate = function(name) {
return aggregateCore(dataUtils.aggregators[name])
};
var select = function(getter) {
if (!$.isFunction(getter) && !$.isArray(getter)) {
getter = $.makeArray(arguments)
}
return chainQuery(new SelectIterator(iter, getter))
};
var selectProp = function(name) {
return select(compileGetter(name))
};
var chainQuery = function(iter) {
return arrayQueryImpl(iter, queryOptions)
};
return {
toArray: function() {
return iter.toArray()
},
enumerate: function() {
var d = $.Deferred().fail(handleError);
try {
d.resolve(iter.toArray())
} catch (x) {
d.reject(x)
}
return d.promise()
},
sortBy: function(getter, desc) {
return chainQuery(new SortIterator(iter, getter, desc))
},
thenBy: function(getter, desc) {
if (iter instanceof SortIterator) {
return chainQuery(iter.thenBy(getter, desc))
}
throw errorsModule.errors.Error("E4004")
},
filter: function(criteria) {
if (!$.isArray(criteria)) {
criteria = $.makeArray(arguments)
}
return chainQuery(new FilterIterator(iter, criteria))
},
slice: function(skip, take) {
if (void 0 === take) {
take = Number.MAX_VALUE
}
return chainQuery(new SliceIterator(iter, skip, take))
},
select: select,
groupBy: function(getter) {
return chainQuery(new GroupIterator(iter, getter))
},
aggregate: aggregate,
count: function() {
if (iter.countable()) {
var d = $.Deferred().fail(handleError);
try {
d.resolve(iter.count())
} catch (x) {
d.reject(x)
}
return d.promise()
}
return standardAggregate("count")
},
sum: function(getter) {
if (getter) {
return selectProp(getter).sum()
}
return standardAggregate("sum")
},
min: function(getter) {
if (getter) {
return selectProp(getter).min()
}
return standardAggregate("min")
},
max: function(getter) {
if (getter) {
return selectProp(getter).max()
}
return standardAggregate("max")
},
avg: function(getter) {
if (getter) {
return selectProp(getter).avg()
}
return standardAggregate("avg")
}
}
};
module.exports = arrayQueryImpl
},
/*!**************************************!*\
!*** ./Scripts/data/remote_query.js ***!
\**************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
queryAdapters = __webpack_require__( /*! ./query_adapters */ 161),
errorsModule = __webpack_require__( /*! ./errors */ 157),
arrayQueryImpl = __webpack_require__( /*! ./array_query */ 159);
var remoteQueryImpl = function(url, queryOptions, tasks) {
tasks = tasks || [];
queryOptions = queryOptions || {};
var createTask = function(name, args) {
return {
name: name,
args: args
}
};
var exec = function(executorTask) {
var _adapterFactory, _adapter, _taskQueue, _currentTask, _mergedSortArgs, d = $.Deferred();
var rejectWithNotify = function(error) {
var handler = queryOptions.errorHandler;
if (handler) {
handler(error)
}
errorsModule._errorHandler(error);
d.reject(error)
};
function mergeSortTask(task) {
switch (task.name) {
case "sortBy":
_mergedSortArgs = [task.args];
return true;
case "thenBy":
if (!_mergedSortArgs) {
throw errorsModule.errors.Error("E4004")
}
_mergedSortArgs.push(task.args);
return true
}
return false
}
function unmergeSortTasks() {
var head = _taskQueue[0],
unmergedTasks = [];
if (head && "multiSort" === head.name) {
_taskQueue.shift();
$.each(head.args[0], function() {
unmergedTasks.push(createTask(unmergedTasks.length ? "thenBy" : "sortBy", this))
})
}
_taskQueue = unmergedTasks.concat(_taskQueue)
}
try {
_adapterFactory = queryOptions.adapter;
if (!$.isFunction(_adapterFactory)) {
_adapterFactory = queryAdapters[_adapterFactory]
}
_adapter = _adapterFactory(queryOptions);
_taskQueue = [].concat(tasks).concat(executorTask);
while (_taskQueue.length) {
_currentTask = _taskQueue[0];
if (!mergeSortTask(_currentTask)) {
if (_mergedSortArgs) {
_taskQueue.unshift(createTask("multiSort", [_mergedSortArgs]));
_mergedSortArgs = null;
continue
}
if ("enumerate" !== String(_currentTask.name)) {
if (!_adapter[_currentTask.name] || false === _adapter[_currentTask.name].apply(_adapter, _currentTask.args)) {
break
}
}
}
_taskQueue.shift()
}
unmergeSortTasks();
_adapter.exec(url).done(function(result, extra) {
if (!_taskQueue.length) {
d.resolve(result, extra)
} else {
var clientChain = arrayQueryImpl(result, {
errorHandler: queryOptions.errorHandler
});
$.each(_taskQueue, function() {
clientChain = clientChain[this.name].apply(clientChain, this.args)
});
clientChain.done(d.resolve).fail(d.reject)
}
}).fail(rejectWithNotify)
} catch (x) {
rejectWithNotify(x)
}
return d.promise()
};
var query = {};
$.each(["sortBy", "thenBy", "filter", "slice", "select", "groupBy"], function() {
var name = String(this);
query[name] = function() {
return remoteQueryImpl(url, queryOptions, tasks.concat(createTask(name, arguments)))
}
});
$.each(["count", "min", "max", "sum", "avg", "aggregate", "enumerate"], function() {
var name = String(this);
query[name] = function() {
return exec.call(this, createTask(name, arguments))
}
});
return query
};
module.exports = remoteQueryImpl
},
/*!****************************************!*\
!*** ./Scripts/data/query_adapters.js ***!
\****************************************/
function(module, exports) {
var queryAdapters = {};
module.exports = queryAdapters
},
/*!*************************************!*\
!*** ./Scripts/data/array_store.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Guid = __webpack_require__( /*! ../core/guid */ 153),
objectUtils = __webpack_require__( /*! ../core/utils/object */ 37),
keysEqual = __webpack_require__( /*! ./utils */ 137).keysEqual,
Query = __webpack_require__( /*! ./query */ 158),
errors = __webpack_require__( /*! ./errors */ 157).errors,
Store = __webpack_require__( /*! ./abstract_store */ 156);
var hasKey = function(target, keyOrKeys) {
var key, keys = $.makeArray(keyOrKeys);
while (keys.length) {
key = keys.shift();
if (key in target) {
return true
}
}
return false
};
var trivialPromise = function() {
var d = $.Deferred();
return d.resolve.apply(d, arguments).promise()
};
var rejectedPromise = function() {
var d = $.Deferred();
return d.reject.apply(d, arguments).promise()
};
var ArrayStore = Store.inherit({
ctor: function(options) {
if ($.isArray(options)) {
options = {
data: options
}
} else {
options = options || {}
}
this.callBase(options);
var initialArray = options.data;
if (initialArray && !$.isArray(initialArray)) {
throw errors.Error("E4006")
}
this._array = initialArray || []
},
createQuery: function() {
return Query(this._array, {
errorHandler: this._errorHandler
})
},
_byKeyImpl: function(key) {
var index = this._indexByKey(key);
if (index === -1) {
return rejectedPromise(errors.Error("E4009"))
}
return trivialPromise(this._array[index])
},
_insertImpl: function(values) {
var keyValue, obj, keyExpr = this.key();
if ($.isPlainObject(values)) {
obj = $.extend({}, values)
} else {
obj = values
}
if (keyExpr) {
keyValue = this.keyOf(obj);
if (void 0 === keyValue || "object" === typeof keyValue && $.isEmptyObject(keyValue)) {
if ($.isArray(keyExpr)) {
throw errors.Error("E4007")
}
keyValue = obj[keyExpr] = String(new Guid)
} else {
if (void 0 !== this._array[this._indexByKey(keyValue)]) {
return rejectedPromise(errors.Error("E4008"))
}
}
} else {
keyValue = obj
}
this._array.push(obj);
return trivialPromise(values, keyValue)
},
_updateImpl: function(key, values) {
var index, target, keyExpr = this.key();
if (keyExpr) {
if (hasKey(values, keyExpr) && !keysEqual(keyExpr, key, this.keyOf(values))) {
return rejectedPromise(errors.Error("E4017"))
}
index = this._indexByKey(key);
if (index < 0) {
return rejectedPromise(errors.Error("E4009"))
}
target = this._array[index]
} else {
target = key
}
objectUtils.deepExtendArraySafe(target, values);
return trivialPromise(key, values)
},
_removeImpl: function(key) {
var index = this._indexByKey(key);
if (index > -1) {
this._array.splice(index, 1)
}
return trivialPromise(key)
},
_indexByKey: function(key) {
for (var i = 0, arrayLength = this._array.length; i < arrayLength; i++) {
if (keysEqual(this.key(), this.keyOf(this._array[i]), key)) {
return i
}
}
return -1
},
clear: function() {
this.fireEvent("modifying");
this._array = [];
this.fireEvent("modified")
}
}, "array");
module.exports = ArrayStore
},
/*!**************************************!*\
!*** ./Scripts/data/custom_store.js ***!
\**************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
dataUtils = __webpack_require__( /*! ./utils */ 137),
errors = __webpack_require__( /*! ./errors */ 157).errors,
Store = __webpack_require__( /*! ./abstract_store */ 156);
var TOTAL_COUNT = "totalCount",
LOAD = "load",
BY_KEY = "byKey",
INSERT = "insert",
UPDATE = "update",
REMOVE = "remove";
function isPromise(obj) {
return obj && $.isFunction(obj.then)
}
function trivialPromise(value) {
return $.Deferred().resolve(value).promise()
}
function ensureRequiredFuncOption(name, obj) {
if (!$.isFunction(obj)) {
throw errors.Error("E4011", name)
}
}
function throwInvalidUserFuncResult(name) {
throw errors.Error("E4012", name)
}
function createUserFuncFailureHandler(pendingDeferred) {
function errorMessageFromXhr(promiseArguments) {
var xhr = promiseArguments[0],
textStatus = promiseArguments[1];
if (!xhr || !xhr.getResponseHeader) {
return null
}
return dataUtils.errorMessageFromXhr(xhr, textStatus)
}
return function(arg) {
var error;
if (arg instanceof Error) {
error = arg
} else {
error = new Error(errorMessageFromXhr(arguments) || arg && String(arg) || "Unknown error")
}
pendingDeferred.reject(error)
}
}
var CustomStore = Store.inherit({
ctor: function(options) {
options = options || {};
this.callBase(options);
this._useDefaultSearch = !!options.useDefaultSearch;
this._loadFunc = options[LOAD];
this._totalCountFunc = options[TOTAL_COUNT];
this._byKeyFunc = options[BY_KEY];
this._insertFunc = options[INSERT];
this._updateFunc = options[UPDATE];
this._removeFunc = options[REMOVE]
},
createQuery: function() {
throw errors.Error("E4010")
},
_totalCountImpl: function(options) {
var userResult, userFunc = this._totalCountFunc,
d = $.Deferred();
ensureRequiredFuncOption(TOTAL_COUNT, userFunc);
userResult = userFunc.apply(this, [options]);
if (!isPromise(userResult)) {
userResult = Number(userResult);
if (!isFinite(userResult)) {
throwInvalidUserFuncResult(TOTAL_COUNT)
}
userResult = trivialPromise(userResult)
}
userResult.then(function(count) {
d.resolve(Number(count))
}, createUserFuncFailureHandler(d));
return this._addFailHandlers(d.promise())
},
_loadImpl: function(options) {
var userResult, userFunc = this._loadFunc,
d = $.Deferred();
ensureRequiredFuncOption(LOAD, userFunc);
userResult = userFunc.apply(this, [options]);
if ($.isArray(userResult)) {
userResult = trivialPromise(userResult)
} else {
if (null === userResult || void 0 === userResult) {
userResult = trivialPromise([])
} else {
if (!isPromise(userResult)) {
throwInvalidUserFuncResult(LOAD)
}
}
}
userResult.then(function(data, extra) {
d.resolve(data, extra)
}, createUserFuncFailureHandler(d));
return this._addFailHandlers(d.promise())
},
_byKeyImpl: function(key, extraOptions) {
var userResult, userFunc = this._byKeyFunc,
d = $.Deferred();
ensureRequiredFuncOption(BY_KEY, userFunc);
userResult = userFunc.apply(this, [key, extraOptions]);
if (!isPromise(userResult)) {
userResult = trivialPromise(userResult)
}
userResult.then(function(obj) {
d.resolve(obj)
}, createUserFuncFailureHandler(d));
return d.promise()
},
_insertImpl: function(values) {
var userResult, userFunc = this._insertFunc,
d = $.Deferred();
ensureRequiredFuncOption(INSERT, userFunc);
userResult = userFunc.apply(this, [values]);
if (!isPromise(userResult)) {
userResult = trivialPromise(userResult)
}
userResult.then(function(newKey) {
d.resolve(values, newKey)
}, createUserFuncFailureHandler(d));
return d.promise()
},
_updateImpl: function(key, values) {
var userResult, userFunc = this._updateFunc,
d = $.Deferred();
ensureRequiredFuncOption(UPDATE, userFunc);
userResult = userFunc.apply(this, [key, values]);
if (!isPromise(userResult)) {
userResult = trivialPromise()
}
userResult.then(function() {
d.resolve(key, values)
}, createUserFuncFailureHandler(d));
return d.promise()
},
_removeImpl: function(key) {
var userResult, userFunc = this._removeFunc,
d = $.Deferred();
ensureRequiredFuncOption(REMOVE, userFunc);
userResult = userFunc.apply(this, [key]);
if (!isPromise(userResult)) {
userResult = trivialPromise()
}
userResult.then(function() {
d.resolve(key)
}, createUserFuncFailureHandler(d));
return d.promise()
}
});
module.exports = CustomStore
},
/*!********************************!*\
!*** ./Scripts/events/hold.js ***!
\********************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
eventUtils = __webpack_require__( /*! ./utils */ 62),
Emitter = __webpack_require__( /*! ./core/emitter */ 75),
registerEmitter = __webpack_require__( /*! ./core/emitter_registrator */ 76),
abs = Math.abs;
var HOLD_EVENT_NAME = "dxhold",
HOLD_TIMEOUT = 750,
TOUCH_BOUNDARY = 5;
var HoldEmitter = Emitter.inherit({
start: function(e) {
this._startEventData = eventUtils.eventData(e);
this._startTimer(e)
},
_startTimer: function(e) {
var holdTimeout = "timeout" in this ? this.timeout : HOLD_TIMEOUT;
this._holdTimer = setTimeout($.proxy(function() {
this._requestAccept(e);
this._fireEvent(HOLD_EVENT_NAME, e, {
target: e.target
});
this._forgetAccept()
}, this), holdTimeout)
},
move: function(e) {
if (this._touchWasMoved(e)) {
this._cancel(e)
}
},
_touchWasMoved: function(e) {
var delta = eventUtils.eventDelta(this._startEventData, eventUtils.eventData(e));
return abs(delta.x) > TOUCH_BOUNDARY || abs(delta.y) > TOUCH_BOUNDARY
},
end: function() {
this._stopTimer()
},
_stopTimer: function() {
clearTimeout(this._holdTimer)
},
cancel: function() {
this._stopTimer()
}
});
registerEmitter({
emitter: HoldEmitter,
bubble: true,
events: [HOLD_EVENT_NAME]
});
module.exports = {
name: HOLD_EVENT_NAME
}
},
/*!***************************************!*\
!*** ./Scripts/events/contextmenu.js ***!
\***************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
support = __webpack_require__( /*! ../core/utils/support */ 48),
devices = __webpack_require__( /*! ../core/devices */ 40),
Class = __webpack_require__( /*! ../core/class */ 20),
registerEvent = __webpack_require__( /*! ./core/event_registrator */ 66),
eventUtils = __webpack_require__( /*! ./utils */ 62),
holdEvent = __webpack_require__( /*! ./hold */ 164);
var CONTEXTMENU_NAMESPACE = "dxContexMenu",
CONTEXTMENU_NAMESPACED_EVENT_NAME = eventUtils.addNamespace("contextmenu", CONTEXTMENU_NAMESPACE),
HOLD_NAMESPACED_EVENT_NAME = eventUtils.addNamespace(holdEvent.name, CONTEXTMENU_NAMESPACE),
CONTEXTMENU_EVENT_NAME = "dxcontextmenu";
var ContextMenu = Class.inherit({
setup: function(element, data) {
var $element = $(element);
$element.on(CONTEXTMENU_NAMESPACED_EVENT_NAME, $.proxy(this._contextMenuHandler, this));
if (support.touch || devices.isSimulator()) {
$element.on(HOLD_NAMESPACED_EVENT_NAME, $.proxy(this._holdHandler, this))
}
},
_holdHandler: function(e) {
if (eventUtils.isMouseEvent(e) && !devices.isSimulator()) {
return
}
this._fireContextMenu(e)
},
_contextMenuHandler: function(e) {
this._fireContextMenu(e)
},
_fireContextMenu: function(e) {
return eventUtils.fireEvent({
type: CONTEXTMENU_EVENT_NAME,
originalEvent: e
})
},
teardown: function(element) {
$(element).off("." + CONTEXTMENU_NAMESPACE)
}
});
registerEvent(CONTEXTMENU_EVENT_NAME, new ContextMenu);
exports.name = CONTEXTMENU_EVENT_NAME
},
/*!***************************************************************************!*\
!*** ./Scripts/ui/collection/ui.collection_widget.edit.strategy.plain.js ***!
\***************************************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
errors = __webpack_require__( /*! ../widget/ui.errors */ 10),
arrayUtils = __webpack_require__( /*! ../../core/utils/array */ 111),
EditStrategy = __webpack_require__( /*! ./ui.collection_widget.edit.strategy */ 167);
var PlainEditStrategy = EditStrategy.inherit({
_getPlainItems: function() {
return this._collectionWidget.option("items") || []
},
getIndexByItemData: function(itemData) {
return $.inArray(itemData, this._getPlainItems())
},
getItemDataByIndex: function(index) {
return this._getPlainItems()[index]
},
deleteItemAtIndex: function(index) {
this._getPlainItems().splice(index, 1)
},
updateSelectionAfterDelete: function(fromIndex) {
var selectedItemIndices = this._collectionWidget._selectedItemIndices;
$.each(selectedItemIndices, function(i, index) {
if (index > fromIndex) {
selectedItemIndices[i] -= 1
}
})
},
fetchSelectedItems: function(indices) {
indices = indices || this._collectionWidget._selectedItemIndices;
indices.sort(function(a, b) {
return a - b
});
var items = this._getPlainItems(),
selectedItems = [];
$.each(indices, function(_, index) {
selectedItems.push(items[index])
});
if (this._collectionWidget._dataSource && "single" !== this._collectionWidget.option("selectionMode")) {
var allSelectedItems = this._collectionWidget.option("selectedItems"),
unavailableItems = $.grep(allSelectedItems, function(item) {
return $.inArray(item, items) === -1
});
selectedItems = selectedItems.concat(unavailableItems)
}
return selectedItems
},
fetchSelectionDifference: function(addedSelection, removedSelection) {
var difference = this.callBase(addedSelection, removedSelection);
if (this._collectionWidget._dataSource) {
var addedItems = difference.addedItems,
removedItems = difference.removedItems,
duplicatedItems = arrayUtils.intersection(addedItems, removedItems);
$.each(duplicatedItems, function(_, item) {
var addedItemIndex = $.inArray(item, addedItems),
removedItemIndex = $.inArray(item, removedItems);
addedItems.splice(addedItemIndex, 1);
removedItems.splice(removedItemIndex, 1)
})
}
return difference
},
selectedItemIndices: function() {
var selectedIndices = [],
items = this._getPlainItems(),
selected = this._collectionWidget.option("selectedItems"),
dataSource = this._collectionWidget._dataSource;
$.each(selected, function(_, selectedItem) {
var index = $.inArray(selectedItem, items);
if (index !== -1) {
selectedIndices.push(index)
} else {
if (!dataSource) {
errors.log("W1002", selectedItem)
}
}
});
return selectedIndices
},
moveItemAtIndexToIndex: function(movingIndex, destinationIndex) {
var items = this._getPlainItems(),
movedItemData = items[movingIndex];
items.splice(movingIndex, 1);
items.splice(destinationIndex, 0, movedItemData)
},
_isItemIndex: function(index) {
return "number" === typeof index && Math.round(index) === index
},
_getNormalizedItemIndex: function(itemElement) {
return this._collectionWidget._itemElements().index(itemElement)
},
_normalizeItemIndex: function(index) {
return index
},
_denormalizeItemIndex: function(index) {
return index
},
_getItemByNormalizedIndex: function(index) {
return index > -1 ? this._collectionWidget._itemElements().eq(index) : null
},
_itemsFromSameParent: function() {
return true
}
});
module.exports = PlainEditStrategy
},
/*!*********************************************************************!*\
!*** ./Scripts/ui/collection/ui.collection_widget.edit.strategy.js ***!
\*********************************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
abstract = Class.abstract;
var EditStrategy = Class.inherit({
ctor: function(collectionWidget) {
this._collectionWidget = collectionWidget
},
getIndexByItemData: abstract,
getItemDataByIndex: abstract,
getNormalizedIndex: function(value) {
if (this._isNormalizedItemIndex(value)) {
return value
}
if (this._isItemIndex(value)) {
return this._normalizeItemIndex(value)
}
if (this._isDOMNode(value)) {
return this._getNormalizedItemIndex(value)
}
return this._normalizeItemIndex(this.getIndexByItemData(value))
},
getIndex: function(value) {
if (this._isNormalizedItemIndex(value)) {
return this._denormalizeItemIndex(value)
}
if (this._isItemIndex(value)) {
return value
}
if (this._isDOMNode(value)) {
return this._denormalizeItemIndex(this._getNormalizedItemIndex(value))
}
return this.getIndexByItemData(value)
},
getItemElement: function(value) {
if (this._isNormalizedItemIndex(value)) {
return this._getItemByNormalizedIndex(value)
}
if (this._isItemIndex(value)) {
return this._getItemByNormalizedIndex(this._normalizeItemIndex(value))
}
if (this._isDOMNode(value)) {
return $(value)
}
return this._getItemByNormalizedIndex(this.getIndexByItemData(value))
},
deleteItemAtIndex: abstract,
updateSelectionAfterDelete: abstract,
fetchSelectedItems: abstract,
fetchSelectionDifference: function(addedSelection, removedSelection) {
return {
addedItems: this.fetchSelectedItems(addedSelection),
removedItems: this.fetchSelectedItems(removedSelection)
}
},
selectedItemIndices: abstract,
itemPlacementFunc: function(movingIndex, destinationIndex) {
return this._itemsFromSameParent(movingIndex, destinationIndex) && movingIndex < destinationIndex ? "after" : "before"
},
moveItemAtIndexToIndex: abstract,
getSelectedItemsAfterReorderItem: function() {
return this._collectionWidget.option("selectedItems")
},
_isNormalizedItemIndex: function(index) {
return "number" === typeof index && Math.round(index) === index
},
_isDOMNode: function(value) {
var $value;
try {
$value = $(value)
} catch (error) {
return false
}
return $value && $value.length && $value.get(0).nodeType
},
_isItemIndex: abstract,
_getNormalizedItemIndex: abstract,
_normalizeItemIndex: abstract,
_denormalizeItemIndex: abstract,
_getItemByNormalizedIndex: abstract,
_itemsFromSameParent: abstract
});
module.exports = EditStrategy
},
/*!**********************************************************!*\
!*** ./Scripts/integration/angular/event_registrator.js ***!
\**********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
eventRegistrator = __webpack_require__( /*! ../../events/core/event_registrator */ 66),
ngModule = __webpack_require__( /*! ./module */ 150);
eventRegistrator.callbacks.add(function(name, eventObject) {
var ngEventName = name.slice(0, 2) + name.charAt(2).toUpperCase() + name.slice(3);
ngModule.directive(ngEventName, ["$parse", function($parse) {
return function(scope, element, attr) {
var handler, attrValue = $.trim(attr[ngEventName]),
eventOptions = {};
if ("{" === attrValue.charAt(0)) {
eventOptions = scope.$eval(attrValue);
handler = $parse(eventOptions.execute)
} else {
handler = $parse(attr[ngEventName])
}
element.on(name, eventOptions, function(e) {
scope.$apply(function() {
handler(scope, {
$event: e
})
})
})
}
}])
})
},
/*!***************************************************!*\
!*** ./Scripts/integration/angular/components.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
MemorizedCallbacks = __webpack_require__( /*! ../../core/memorized_callbacks */ 44),
ngModule = __webpack_require__( /*! ./module */ 150),
iconUtils = __webpack_require__( /*! ../../core/utils/icon */ 99),
inflector = __webpack_require__( /*! ../../core/utils/inflector */ 49),
errors = __webpack_require__( /*! ../../core/errors */ 17);
ngModule.directive("dxIcon", ["$compile", function($compile) {
return {
restrict: "E",
link: function($scope, $element, $attrs) {
var html = iconUtils.getImageContainer($scope.dxTemplateModel.icon || $scope.dxTemplateModel.iconSrc);
if (html) {
var e = $compile(html.get(0))($scope);
$element.replaceWith(e)
}
}
}
}]);
ngModule.directive("dxPolymorphWidget", ["$compile", function($compile) {
return {
restrict: "E",
scope: {
name: "=",
options: "="
},
link: function($scope, $element, $attrs) {
var widgetName = $scope.name;
if (!widgetName) {
return
}
if ("button" === widgetName || "tabs" === widgetName || "dropDownMenu" === widgetName) {
var depricatedName = widgetName;
widgetName = inflector.camelize("dx-" + widgetName);
errors.log("W0001", "dxToolbar - 'widget' item field", depricatedName, "16.1", "Use: '" + widgetName + "' instead")
}
var markup = $("
').get(0);
$element.after(markup);
$compile(markup)($scope)
}
}
}]);
ngModule.service("dxDigestCallbacks", ["$rootScope", function($rootScope) {
var begin = new MemorizedCallbacks,
end = new MemorizedCallbacks;
var digestPhase = false;
$rootScope.$watch(function() {
if (digestPhase) {
return
}
digestPhase = true;
begin.fire();
$rootScope.$$postDigest(function() {
digestPhase = false;
end.fire()
})
});
return {
begin: begin,
end: end
}
}])
},
/*!*********************************************************!*\
!*** ./Scripts/integration/angular/action_executors.js ***!
\*********************************************************/
function(module, exports, __webpack_require__) {
var Action = __webpack_require__( /*! ../../core/action */ 35);
Action.registerExecutor({
ngExpression: {
execute: function(e) {
if ("string" === typeof e.action) {
e.context.$eval(e.action)
}
}
}
})
},
/*!************************************************!*\
!*** ./Scripts/localization/globalize/core.js ***!
\************************************************/
function(module, exports, __webpack_require__) {
var Globalize = __webpack_require__( /*! globalize */ 172);
if (Globalize && Globalize.load) {
var likelySubtags = {
supplemental: {
version: {
_cldrVersion: "28",
_unicodeVersion: "8.0.0",
_number: "$Revision: 11965 $"
},
likelySubtags: {
en: "en-Latn-US",
de: "de-Latn-DE",
ru: "ru-Cyrl-RU",
ja: "ja-Jpan-JP"
}
}
};
if (!Globalize.locale()) {
Globalize.load(likelySubtags);
Globalize.locale("en")
}
}
},
/*!***********************************!*\
!*** external "window.Globalize" ***!
\***********************************/
function(module, exports) {
module.exports = window.Globalize
},
/*!***************************************************!*\
!*** ./Scripts/localization/globalize/message.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
__webpack_require__( /*! ./core */ 171);
var Globalize = __webpack_require__( /*! globalize */ 172),
messageLocalization = __webpack_require__( /*! ../message */ 80);
__webpack_require__( /*! globalize/message */ 172);
if (Globalize && Globalize.formatMessage) {
var DEFAULT_LOCALE = "en";
var originalLoadMessages = Globalize.loadMessages;
Globalize.loadMessages = function(messages) {
messageLocalization.load(messages)
};
var globalizeMessageLocalization = {
ctor: function() {
this.load(this._dictionary)
},
load: function(messages) {
this.callBase(messages);
originalLoadMessages(messages)
},
locale: function(locale) {
if (!locale) {
return Globalize.locale().locale
}
Globalize.locale(locale)
},
getMessagesByLocales: function() {
return Globalize.cldr.get("globalize-messages")
},
getFormatter: function(key, locale) {
var currentLocale = locale || this.locale(),
formatter = this.callBase(key, locale);
if (!formatter) {
formatter = this._formatterByGlobalize(key, locale)
}
if (!formatter && currentLocale !== DEFAULT_LOCALE) {
formatter = this.getFormatter(key, DEFAULT_LOCALE)
}
return formatter
},
_formatterByGlobalize: function(key, locale) {
var result, currentGlobalize = !locale || locale === this.locale() ? Globalize : new Globalize(locale);
if (this._messageLoaded(key, locale)) {
result = currentGlobalize.messageFormatter(key)
}
return result
},
_messageLoaded: function(key, locale) {
var currentCldr = locale ? new Globalize(locale).cldr : Globalize.locale(),
value = currentCldr.get(["globalize-messages/{bundle}", key]);
return void 0 !== value
},
_loadSingle: function(key, value, locale) {
var data = {};
data[locale] = {};
data[locale][key] = value;
this.load(data)
}
};
messageLocalization.inject(globalizeMessageLocalization)
}
},
/*!**************************************************!*\
!*** ./Scripts/localization/globalize/number.js ***!
\**************************************************/
function(module, exports, __webpack_require__) {
__webpack_require__( /*! ./core */ 171);
var Globalize = __webpack_require__( /*! globalize */ 172),
numberLocalization = __webpack_require__( /*! ../number */ 22),
errors = __webpack_require__( /*! ../../core/errors */ 17);
__webpack_require__( /*! globalize/number */ 172);
if (Globalize && Globalize.formatNumber) {
var enNumbers = {
main: {
en: {
identity: {
version: {
_cldrVersion: "28",
_number: "$Revision: 11972 $"
},
language: "en"
},
numbers: {
defaultNumberingSystem: "latn",
otherNumberingSystems: {
"native": "latn"
},
minimumGroupingDigits: "1",
"symbols-numberSystem-latn": {
decimal: ".",
group: ",",
list: ";",
percentSign: "%",
plusSign: "+",
minusSign: "-",
exponential: "E",
superscriptingExponent: "×",
perMille: "‰",
infinity: "∞",
nan: "NaN",
timeSeparator: ":"
},
"decimalFormats-numberSystem-latn": {
standard: "#,##0.###",
"long": {
decimalFormat: {
"1000-count-one": "0 thousand",
"1000-count-other": "0 thousand",
"10000-count-one": "00 thousand",
"10000-count-other": "00 thousand",
"100000-count-one": "000 thousand",
"100000-count-other": "000 thousand",
"1000000-count-one": "0 million",
"1000000-count-other": "0 million",
"10000000-count-one": "00 million",
"10000000-count-other": "00 million",
"100000000-count-one": "000 million",
"100000000-count-other": "000 million",
"1000000000-count-one": "0 billion",
"1000000000-count-other": "0 billion",
"10000000000-count-one": "00 billion",
"10000000000-count-other": "00 billion",
"100000000000-count-one": "000 billion",
"100000000000-count-other": "000 billion",
"1000000000000-count-one": "0 trillion",
"1000000000000-count-other": "0 trillion",
"10000000000000-count-one": "00 trillion",
"10000000000000-count-other": "00 trillion",
"100000000000000-count-one": "000 trillion",
"100000000000000-count-other": "000 trillion"
}
},
"short": {
decimalFormat: {
"1000-count-one": "0K",
"1000-count-other": "0K",
"10000-count-one": "00K",
"10000-count-other": "00K",
"100000-count-one": "000K",
"100000-count-other": "000K",
"1000000-count-one": "0M",
"1000000-count-other": "0M",
"10000000-count-one": "00M",
"10000000-count-other": "00M",
"100000000-count-one": "000M",
"100000000-count-other": "000M",
"1000000000-count-one": "0B",
"1000000000-count-other": "0B",
"10000000000-count-one": "00B",
"10000000000-count-other": "00B",
"100000000000-count-one": "000B",
"100000000000-count-other": "000B",
"1000000000000-count-one": "0T",
"1000000000000-count-other": "0T",
"10000000000000-count-one": "00T",
"10000000000000-count-other": "00T",
"100000000000000-count-one": "000T",
"100000000000000-count-other": "000T"
}
}
},
"scientificFormats-numberSystem-latn": {
standard: "#E0"
},
"percentFormats-numberSystem-latn": {
standard: "#,##0%"
},
"currencyFormats-numberSystem-latn": {
currencySpacing: {
beforeCurrency: {
currencyMatch: "[:^S:]",
surroundingMatch: "[:digit:]",
insertBetween: "Â "
},
afterCurrency: {
currencyMatch: "[:^S:]",
surroundingMatch: "[:digit:]",
insertBetween: "Â "
}
},
standard: "¤#,##0.00",
accounting: "¤#,##0.00;(¤#,##0.00)",
"short": {
standard: {
"1000-count-one": "¤0K",
"1000-count-other": "¤0K",
"10000-count-one": "¤00K",
"10000-count-other": "¤00K",
"100000-count-one": "¤000K",
"100000-count-other": "¤000K",
"1000000-count-one": "¤0M",
"1000000-count-other": "¤0M",
"10000000-count-one": "¤00M",
"10000000-count-other": "¤00M",
"100000000-count-one": "¤000M",
"100000000-count-other": "¤000M",
"1000000000-count-one": "¤0B",
"1000000000-count-other": "¤0B",
"10000000000-count-one": "¤00B",
"10000000000-count-other": "¤00B",
"100000000000-count-one": "¤000B",
"100000000000-count-other": "¤000B",
"1000000000000-count-one": "¤0T",
"1000000000000-count-other": "¤0T",
"10000000000000-count-one": "¤00T",
"10000000000000-count-other": "¤00T",
"100000000000000-count-one": "¤000T",
"100000000000000-count-other": "¤000T"
}
},
"unitPattern-count-one": "{0} {1}",
"unitPattern-count-other": "{0} {1}"
},
"miscPatterns-numberSystem-latn": {
atLeast: "{0}+",
range: "{0}–{1}"
}
}
}
}
};
if ("en" === Globalize.locale().locale) {
Globalize.load(enNumbers);
Globalize.locale("en")
}
var formattersCache = {};
var getFormatter = function(format) {
var formatter, formatCacheKey;
if ("object" === typeof format) {
formatCacheKey = Globalize.locale().locale + ":" + JSON.stringify(format)
} else {
formatCacheKey = Globalize.locale().locale + ":" + format
}
formatter = formattersCache[formatCacheKey];
if (!formatter) {
formatter = formattersCache[formatCacheKey] = Globalize.numberFormatter(format)
}
return formatter
};
var globalizeNumberLocalization = {
_formatNumberCore: function(value, format, formatConfig) {
if ("exponential" === format) {
return this.callBase.apply(this, arguments)
}
return getFormatter(this._normalizeFormatConfig(format, formatConfig, value))(value)
},
_normalizeFormatConfig: function(format, formatConfig, value) {
var config;
if ("decimal" === format) {
config = {
minimumIntegerDigits: formatConfig.precision || 1,
useGrouping: false,
maximumFractionDigits: 0,
round: value < 0 ? "ceil" : "floor"
}
} else {
config = {
minimumFractionDigits: formatConfig.precision || 0,
maximumFractionDigits: formatConfig.precision || 0
}
}
if ("percent" === format) {
config.style = "percent"
}
return config
},
format: function(value, format) {
if ("number" !== typeof value) {
return value
}
format = this._normalizeFormat(format);
if (!format || "function" !== typeof format && !format.type && !format.formatter) {
return getFormatter(format)(value)
}
return this.callBase.apply(this, arguments)
},
parse: function(text, format) {
if (!text) {
return
}
if (format && format.parser) {
return format.parser(text)
}
if (format) {
errors.log("W0011")
}
return Globalize.parseNumber(text)
}
};
numberLocalization.inject(globalizeNumberLocalization)
}
},
/*!************************************************!*\
!*** ./Scripts/localization/globalize/date.js ***!
\************************************************/
function(module, exports, __webpack_require__) {
__webpack_require__( /*! ./core */ 171);
__webpack_require__( /*! ./number */ 174);
__webpack_require__( /*! globalize/date */ 172);
var timeData = {
supplemental: {
version: {
_cldrVersion: "28",
_unicodeVersion: "8.0.0",
_number: "$Revision: 11969 $"
},
timeData: {
"001": {
_allowed: "H h",
_preferred: "H"
},
DE: {
_allowed: "H",
_preferred: "H"
},
JP: {
_allowed: "H K h",
_preferred: "H"
},
RU: {
_allowed: "H",
_preferred: "H"
},
US: {
_allowed: "H h",
_preferred: "h"
}
}
}
};
var enCaGregorian = {
main: {
en: {
identity: {
version: {
_cldrVersion: "28",
_number: "$Revision: 11972 $"
},
language: "en"
},
dates: {
calendars: {
gregorian: {
months: {
format: {
abbreviated: {
1: "Jan",
2: "Feb",
3: "Mar",
4: "Apr",
5: "May",
6: "Jun",
7: "Jul",
8: "Aug",
9: "Sep",
10: "Oct",
11: "Nov",
12: "Dec"
},
narrow: {
1: "J",
2: "F",
3: "M",
4: "A",
5: "M",
6: "J",
7: "J",
8: "A",
9: "S",
10: "O",
11: "N",
12: "D"
},
wide: {
1: "January",
2: "February",
3: "March",
4: "April",
5: "May",
6: "June",
7: "July",
8: "August",
9: "September",
10: "October",
11: "November",
12: "December"
}
},
"stand-alone": {
abbreviated: {
1: "Jan",
2: "Feb",
3: "Mar",
4: "Apr",
5: "May",
6: "Jun",
7: "Jul",
8: "Aug",
9: "Sep",
10: "Oct",
11: "Nov",
12: "Dec"
},
narrow: {
1: "J",
2: "F",
3: "M",
4: "A",
5: "M",
6: "J",
7: "J",
8: "A",
9: "S",
10: "O",
11: "N",
12: "D"
},
wide: {
1: "January",
2: "February",
3: "March",
4: "April",
5: "May",
6: "June",
7: "July",
8: "August",
9: "September",
10: "October",
11: "November",
12: "December"
}
}
},
days: {
format: {
abbreviated: {
sun: "Sun",
mon: "Mon",
tue: "Tue",
wed: "Wed",
thu: "Thu",
fri: "Fri",
sat: "Sat"
},
narrow: {
sun: "S",
mon: "M",
tue: "T",
wed: "W",
thu: "T",
fri: "F",
sat: "S"
},
"short": {
sun: "Su",
mon: "Mo",
tue: "Tu",
wed: "We",
thu: "Th",
fri: "Fr",
sat: "Sa"
},
wide: {
sun: "Sunday",
mon: "Monday",
tue: "Tuesday",
wed: "Wednesday",
thu: "Thursday",
fri: "Friday",
sat: "Saturday"
}
},
"stand-alone": {
abbreviated: {
sun: "Sun",
mon: "Mon",
tue: "Tue",
wed: "Wed",
thu: "Thu",
fri: "Fri",
sat: "Sat"
},
narrow: {
sun: "S",
mon: "M",
tue: "T",
wed: "W",
thu: "T",
fri: "F",
sat: "S"
},
"short": {
sun: "Su",
mon: "Mo",
tue: "Tu",
wed: "We",
thu: "Th",
fri: "Fr",
sat: "Sa"
},
wide: {
sun: "Sunday",
mon: "Monday",
tue: "Tuesday",
wed: "Wednesday",
thu: "Thursday",
fri: "Friday",
sat: "Saturday"
}
}
},
quarters: {
format: {
abbreviated: {
1: "Q1",
2: "Q2",
3: "Q3",
4: "Q4"
},
narrow: {
1: "1",
2: "2",
3: "3",
4: "4"
},
wide: {
1: "1st quarter",
2: "2nd quarter",
3: "3rd quarter",
4: "4th quarter"
}
},
"stand-alone": {
abbreviated: {
1: "Q1",
2: "Q2",
3: "Q3",
4: "Q4"
},
narrow: {
1: "1",
2: "2",
3: "3",
4: "4"
},
wide: {
1: "1st quarter",
2: "2nd quarter",
3: "3rd quarter",
4: "4th quarter"
}
}
},
dayPeriods: {
format: {
abbreviated: {
midnight: "midnight",
am: "AM",
"am-alt-variant": "am",
noon: "noon",
pm: "PM",
"pm-alt-variant": "pm",
morning1: "in the morning",
afternoon1: "in the afternoon",
evening1: "in the evening",
night1: "at night"
},
narrow: {
midnight: "mi",
am: "a",
"am-alt-variant": "am",
noon: "n",
pm: "p",
"pm-alt-variant": "pm",
morning1: "in the morning",
afternoon1: "in the afternoon",
evening1: "in the evening",
night1: "at night"
},
wide: {
midnight: "midnight",
am: "AM",
"am-alt-variant": "am",
noon: "noon",
pm: "PM",
"pm-alt-variant": "pm",
morning1: "in the morning",
afternoon1: "in the afternoon",
evening1: "in the evening",
night1: "at night"
}
},
"stand-alone": {
abbreviated: {
midnight: "midnight",
am: "AM",
"am-alt-variant": "am",
noon: "noon",
pm: "PM",
"pm-alt-variant": "pm",
morning1: "in the morning",
afternoon1: "in the afternoon",
evening1: "in the evening",
night1: "at night"
},
narrow: {
midnight: "midnight",
am: "AM",
"am-alt-variant": "am",
noon: "noon",
pm: "PM",
"pm-alt-variant": "pm",
morning1: "in the morning",
afternoon1: "in the afternoon",
evening1: "in the evening",
night1: "at night"
},
wide: {
midnight: "midnight",
am: "AM",
"am-alt-variant": "am",
noon: "noon",
pm: "PM",
"pm-alt-variant": "pm",
morning1: "morning",
afternoon1: "afternoon",
evening1: "evening",
night1: "night"
}
}
},
eras: {
eraNames: {
0: "Before Christ",
"0-alt-variant": "Before Common Era",
1: "Anno Domini",
"1-alt-variant": "Common Era"
},
eraAbbr: {
0: "BC",
"0-alt-variant": "BCE",
1: "AD",
"1-alt-variant": "CE"
},
eraNarrow: {
0: "B",
"0-alt-variant": "BCE",
1: "A",
"1-alt-variant": "CE"
}
},
dateFormats: {
full: "EEEE, MMMM d, y",
"long": "MMMM d, y",
medium: "MMM d, y",
"short": "M/d/yy"
},
timeFormats: {
full: "h:mm:ss a zzzz",
"long": "h:mm:ss a z",
medium: "h:mm:ss a",
"short": "h:mm a"
},
dateTimeFormats: {
full: "{1} 'at' {0}",
"long": "{1} 'at' {0}",
medium: "{1}, {0}",
"short": "{1}, {0}",
availableFormats: {
d: "d",
E: "ccc",
Ed: "d E",
Ehm: "E h:mm a",
EHm: "E HH:mm",
Ehms: "E h:mm:ss a",
EHms: "E HH:mm:ss",
Gy: "y G",
GyMMM: "MMM y G",
GyMMMd: "MMM d, y G",
GyMMMEd: "E, MMM d, y G",
h: "h a",
H: "HH",
hm: "h:mm a",
Hm: "HH:mm",
hms: "h:mm:ss a",
Hms: "HH:mm:ss",
hmsv: "h:mm:ss a v",
Hmsv: "HH:mm:ss v",
hmv: "h:mm a v",
Hmv: "HH:mm v",
M: "L",
Md: "M/d",
MEd: "E, M/d",
MMM: "LLL",
MMMd: "MMM d",
MMMEd: "E, MMM d",
MMMMd: "MMMM d",
ms: "mm:ss",
y: "y",
yM: "M/y",
yMd: "M/d/y",
yMEd: "E, M/d/y",
yMMM: "MMM y",
yMMMd: "MMM d, y",
yMMMEd: "E, MMM d, y",
yMMMM: "MMMM y",
yQQQ: "QQQ y",
yQQQQ: "QQQQ y"
},
appendItems: {
Day: "{0} ({2}: {1})",
"Day-Of-Week": "{0} {1}",
Era: "{0} {1}",
Hour: "{0} ({2}: {1})",
Minute: "{0} ({2}: {1})",
Month: "{0} ({2}: {1})",
Quarter: "{0} ({2}: {1})",
Second: "{0} ({2}: {1})",
Timezone: "{0} {1}",
Week: "{0} ({2}: {1})",
Year: "{0} {1}"
},
intervalFormats: {
intervalFormatFallback: "{0} – {1}",
d: {
d: "d – d"
},
h: {
a: "h a – h a",
h: "h – h a"
},
H: {
H: "HH – HH"
},
hm: {
a: "h:mm a – h:mm a",
h: "h:mm – h:mm a",
m: "h:mm – h:mm a"
},
Hm: {
H: "HH:mm – HH:mm",
m: "HH:mm – HH:mm"
},
hmv: {
a: "h:mm a – h:mm a v",
h: "h:mm – h:mm a v",
m: "h:mm – h:mm a v"
},
Hmv: {
H: "HH:mm – HH:mm v",
m: "HH:mm – HH:mm v"
},
hv: {
a: "h a – h a v",
h: "h – h a v"
},
Hv: {
H: "HH – HH v"
},
M: {
M: "M – M"
},
Md: {
d: "M/d – M/d",
M: "M/d – M/d"
},
MEd: {
d: "E, M/d – E, M/d",
M: "E, M/d – E, M/d"
},
MMM: {
M: "MMM – MMM"
},
MMMd: {
d: "MMM d – d",
M: "MMM d – MMM d"
},
MMMEd: {
d: "E, MMM d – E, MMM d",
M: "E, MMM d – E, MMM d"
},
y: {
y: "y – y"
},
yM: {
M: "M/y – M/y",
y: "M/y – M/y"
},
yMd: {
d: "M/d/y – M/d/y",
M: "M/d/y – M/d/y",
y: "M/d/y – M/d/y"
},
yMEd: {
d: "E, M/d/y – E, M/d/y",
M: "E, M/d/y – E, M/d/y",
y: "E, M/d/y – E, M/d/y"
},
yMMM: {
M: "MMM – MMM y",
y: "MMM y – MMM y"
},
yMMMd: {
d: "MMM d – d, y",
M: "MMM d – MMM d, y",
y: "MMM d, y – MMM d, y"
},
yMMMEd: {
d: "E, MMM d – E, MMM d, y",
M: "E, MMM d – E, MMM d, y",
y: "E, MMM d, y – E, MMM d, y"
},
yMMMM: {
M: "MMMM – MMMM y",
y: "MMMM y – MMMM y"
}
}
}
}
}
}
}
}
};
var weekData = {
supplemental: {
version: {
_cldrVersion: "28",
_unicodeVersion: "8.0.0",
_number: "$Revision: 11969 $"
},
weekData: {
minDays: {
"001": "1",
US: "1",
DE: "4"
},
firstDay: {
"001": "mon",
DE: "mon",
RU: "mon",
JP: "sun",
US: "sun"
},
weekendStart: {
"001": "sat"
},
weekendEnd: {
"001": "sun"
}
}
}
};
var $ = __webpack_require__( /*! jquery */ 9),
Globalize = __webpack_require__( /*! globalize */ 172),
dateLocalization = __webpack_require__( /*! ../date */ 56),
errors = __webpack_require__( /*! ../../core/errors */ 17);
if (Globalize && Globalize.formatDate) {
if ("en" === Globalize.locale().locale) {
Globalize.load(weekData, timeData, enCaGregorian);
Globalize.locale("en")
}
var formattersCache = {};
var FORMATS_TO_GLOBALIZE_MAP = {
shortdate: {
path: "dateTimeFormats/availableFormats/yMd"
},
shorttime: {
path: "timeFormats/short"
},
longdate: {
path: "dateFormats/full"
},
longtime: {
path: "timeFormats/medium"
},
monthandday: {
path: "dateTimeFormats/availableFormats/MMMMd"
},
monthandyear: {
path: "dateTimeFormats/availableFormats/yMMMM"
},
quarterandyear: {
path: "dateTimeFormats/availableFormats/yQQQ"
},
day: {
path: "dateTimeFormats/availableFormats/d"
},
year: {
path: "dateTimeFormats/availableFormats/y"
},
shortdateshorttime: {
path: "dateTimeFormats/short",
parts: ["shorttime", "shortdate"]
},
mediumdatemediumtime: {
path: "dateTimeFormats/medium",
parts: ["shorttime", "monthandday"]
},
longdatelongtime: {
path: "dateTimeFormats/medium",
parts: ["longtime", "longdate"]
},
month: {
pattern: "LLLL"
},
shortyear: {
pattern: "yy"
},
dayofweek: {
pattern: "EEEE"
},
quarter: {
pattern: "QQQ"
},
millisecond: {
pattern: "SSS"
},
hour: {
pattern: "HH"
},
minute: {
pattern: "mm"
}
};
var globalizeDateLocalization = {
getPatternByFormat: function(format) {
var that = this,
lowerFormat = format.toLowerCase(),
globalizeFormat = FORMATS_TO_GLOBALIZE_MAP[lowerFormat];
if ("datetime-local" === lowerFormat) {
return "yyyy-MM-ddTHH':'mm':'ss"
}
if (!globalizeFormat) {
return
}
var result = globalizeFormat.path && that._getFormatStringByPath(globalizeFormat.path) || globalizeFormat.pattern;
if (globalizeFormat.parts) {
$.each(globalizeFormat.parts, function(index, part) {
result = result.replace("{" + index + "}", that.getPatternByFormat(part))
})
}
return result
},
_getFormatStringByPath: function(path) {
return Globalize.locale().main("dates/calendars/gregorian/" + path)
},
getMonthNames: function(format) {
var months = Globalize.locale().main("dates/calendars/gregorian/months/stand-alone/" + (format || "wide"));
return $.map(months, function(month) {
return month
})
},
getDayNames: function(format) {
var days = Globalize.locale().main("dates/calendars/gregorian/days/stand-alone/" + (format || "wide"));
return $.map(days, function(day) {
return day
})
},
getTimeSeparator: function() {
return Globalize.locale().main("numbers/symbols-numberSystem-latn/timeSeparator")
},
format: function(date, format) {
if (!date) {
return
}
if (!format) {
return date
}
var formatter, formatCacheKey;
if ("function" === typeof format) {
return format(date)
}
if (format.formatter) {
return format.formatter(date)
}
format = format.type || format;
if ("string" === typeof format) {
formatCacheKey = Globalize.locale().locale + ":" + format;
formatter = formattersCache[formatCacheKey];
if (!formatter) {
format = {
raw: this.getPatternByFormat(format) || format
};
formatter = formattersCache[formatCacheKey] = Globalize.dateFormatter(format)
}
} else {
formatter = Globalize.dateFormatter(format)
}
return formatter(date)
},
parse: function(text, format) {
if (!text) {
return
}
if (!format || "function" === typeof format || format.formatter && !format.parser) {
if (format) {
errors.log("W0012")
}
return Globalize.parseDate(text)
}
if (format.parser) {
return format.parser(text)
}
if ("string" === typeof format) {
format = {
raw: this.getPatternByFormat(format) || format
}
}
return Globalize.parseDate(text, format)
},
firstDayOfWeekIndex: function() {
var firstDay = Globalize.locale().supplemental.weekData.firstDay();
return $.inArray(firstDay, this._getDayKeys())
},
_getDayKeys: function() {
var days = Globalize.locale().main("dates/calendars/gregorian/days/format/short");
return $.map(days, function(day, key) {
return key
})
}
};
dateLocalization.inject(globalizeDateLocalization)
}
},
/*!****************************************************!*\
!*** ./Scripts/localization/globalize/currency.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
__webpack_require__( /*! ./core */ 171);
__webpack_require__( /*! ./number */ 174);
__webpack_require__( /*! ../currency */ 24);
__webpack_require__( /*! globalize/currency */ 172);
var enCurrencyUSD = {
main: {
en: {
identity: {
version: {
_cldrVersion: "28",
_number: "$Revision: 11972 $"
},
language: "en"
},
numbers: {
currencies: {
USD: {
displayName: "US Dollar",
"displayName-count-one": "US dollar",
"displayName-count-other": "US dollars",
symbol: "$",
"symbol-alt-narrow": "$"
}
}
}
}
}
};
var currencyData = {
supplemental: {
version: {
_cldrVersion: "28",
_unicodeVersion: "8.0.0",
_number: "$Revision: 11969 $"
},
currencyData: {
fractions: {
DEFAULT: {
_rounding: "0",
_digits: "2"
}
}
}
}
};
var Globalize = __webpack_require__( /*! globalize */ 172),
config = __webpack_require__( /*! ../../core/config */ 15),
numberLocalization = __webpack_require__( /*! ../number */ 22);
if (Globalize && Globalize.formatCurrency) {
if ("en" === Globalize.locale().locale) {
Globalize.load(enCurrencyUSD, currencyData);
Globalize.locale("en")
}
var formattersCache = {};
var getFormatter = function(currency, format) {
var formatter, formatCacheKey;
if ("object" === typeof format) {
formatCacheKey = Globalize.locale().locale + ":" + currency + ":" + JSON.stringify(format)
} else {
formatCacheKey = Globalize.locale().locale + ":" + currency + ":" + format
}
formatter = formattersCache[formatCacheKey];
if (!formatter) {
formatter = formattersCache[formatCacheKey] = Globalize.currencyFormatter(currency, format)
}
return formatter
};
var globalizeCurrencyLocalization = {
_formatNumberCore: function(value, format, formatConfig) {
if ("currency" === format) {
var currency = formatConfig && formatConfig.currency || config().defaultCurrency;
return getFormatter(currency, this._normalizeFormatConfig(format, formatConfig, value))(value)
}
return this.callBase.apply(this, arguments)
},
_normalizeFormatConfig: function(format, formatConfig, value) {
var config = this.callBase(format, formatConfig, value);
if ("currency" === format) {
config.style = "accounting"
}
return config
},
format: function(value, format) {
if ("number" !== typeof value) {
return value
}
format = this._normalizeFormat(format);
if (format) {
if ("default" === format.currency) {
format.currency = config().defaultCurrency
}
if ("currency" === format.type) {
return this._formatNumber(value, this._parseNumberFormatString("currency"), format)
} else {
if (format.currency) {
return getFormatter(format.currency, format)(value)
}
}
}
return this.callBase.apply(this, arguments)
},
getCurrencySymbol: function(currency) {
if (!currency) {
currency = config().defaultCurrency
}
return Globalize.cldr.main("numbers/currencies/" + currency)
},
getOpenXmlCurrencyFormat: function(currency) {
var i, result, symbol, encodeSymbols, currencySymbol = this.getCurrencySymbol(currency).symbol,
currencyFormat = Globalize.cldr.main("numbers/currencyFormats-numberSystem-latn");
if (currencyFormat.accounting) {
encodeSymbols = {
".00": "{0}",
"'": "\\'",
"\\(": "\\(",
"\\)": "\\)",
" ": "\\ ",
'"': """,
"\\¤": currencySymbol
};
result = currencyFormat.accounting.split(";");
for (i = 0; i < result.length; i++) {
for (symbol in encodeSymbols) {
if (encodeSymbols.hasOwnProperty(symbol)) {
result[i] = result[i].replace(new RegExp(symbol, "g"), encodeSymbols[symbol])
}
}
}
return 2 === result.length ? result[0] + "_);" + result[1] : result[0]
}
}
};
numberLocalization.inject(globalizeCurrencyLocalization)
}
},
/*!************************************!*\
!*** ./Scripts/events/dblclick.js ***!
\************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
domUtils = __webpack_require__( /*! ../core/utils/dom */ 50),
Class = __webpack_require__( /*! ../core/class */ 20),
registerEvent = __webpack_require__( /*! ./core/event_registrator */ 66),
clickEvent = __webpack_require__( /*! ./click */ 64),
eventUtils = __webpack_require__( /*! ./utils */ 62);
var DBLCLICK_EVENT_NAME = "dxdblclick",
DBLCLICK_NAMESPACE = "dxDblClick",
NAMESPACED_CLICK_EVENT = eventUtils.addNamespace(clickEvent.name, DBLCLICK_NAMESPACE),
DBLCLICK_TIMEOUT = 300;
var DblClick = Class.inherit({
ctor: function() {
this._handlerCount = 0;
this._forgetLastClick()
},
_forgetLastClick: function() {
this._firstClickTarget = null;
this._lastClickTimeStamp = -DBLCLICK_TIMEOUT
},
add: function() {
if (this._handlerCount <= 0) {
$(document).on(NAMESPACED_CLICK_EVENT, $.proxy(this._clickHandler, this))
}
this._handlerCount++
},
_clickHandler: function(e) {
var timeStamp = e.timeStamp || $.now();
if (timeStamp - this._lastClickTimeStamp < DBLCLICK_TIMEOUT) {
eventUtils.fireEvent({
type: DBLCLICK_EVENT_NAME,
target: domUtils.closestCommonParent(this._firstClickTarget, e.target),
originalEvent: e
});
this._forgetLastClick()
} else {
this._firstClickTarget = e.target;
this._lastClickTimeStamp = timeStamp
}
},
remove: function() {
this._handlerCount--;
if (this._handlerCount <= 0) {
this._forgetLastClick();
$(document).off(NAMESPACED_CLICK_EVENT)
}
}
});
registerEvent(DBLCLICK_EVENT_NAME, new DblClick);
exports.name = DBLCLICK_EVENT_NAME
},
/*!*********************************!*\
!*** ./Scripts/events/swipe.js ***!
\*********************************/
function(module, exports, __webpack_require__) {
var eventUtils = __webpack_require__( /*! ./utils */ 62),
GestureEmitter = __webpack_require__( /*! ./gesture/emitter.gesture */ 78),
registerEmitter = __webpack_require__( /*! ./core/emitter_registrator */ 76);
var SWIPE_START_EVENT = "dxswipestart",
SWIPE_EVENT = "dxswipe",
SWIPE_END_EVENT = "dxswipeend";
var HorizontalStrategy = {
defaultItemSizeFunc: function() {
return this.getElement().width()
},
getBounds: function() {
return [this._maxLeftOffset, this._maxRightOffset]
},
calcOffsetRatio: function(e) {
var endEventData = eventUtils.eventData(e);
return (endEventData.x - (this._savedEventData && this._savedEventData.x || 0)) / this._itemSizeFunc().call(this, e)
},
isFastSwipe: function(e) {
var endEventData = eventUtils.eventData(e);
return this.FAST_SWIPE_SPEED_LIMIT * Math.abs(endEventData.x - this._tickData.x) >= endEventData.time - this._tickData.time
}
};
var VerticalStrategy = {
defaultItemSizeFunc: function() {
return this.getElement().height()
},
getBounds: function() {
return [this._maxTopOffset, this._maxBottomOffset]
},
calcOffsetRatio: function(e) {
var endEventData = eventUtils.eventData(e);
return (endEventData.y - (this._savedEventData && this._savedEventData.y || 0)) / this._itemSizeFunc().call(this, e)
},
isFastSwipe: function(e) {
var endEventData = eventUtils.eventData(e);
return this.FAST_SWIPE_SPEED_LIMIT * Math.abs(endEventData.y - this._tickData.y) >= endEventData.time - this._tickData.time
}
};
var STRATEGIES = {
horizontal: HorizontalStrategy,
vertical: VerticalStrategy
};
var SwipeEmitter = GestureEmitter.inherit({
TICK_INTERVAL: 300,
FAST_SWIPE_SPEED_LIMIT: 10,
ctor: function(element) {
this.callBase(element);
this.direction = "horizontal";
this.elastic = true
},
_getStrategy: function() {
return STRATEGIES[this.direction]
},
_defaultItemSizeFunc: function() {
return this._getStrategy().defaultItemSizeFunc.call(this)
},
_itemSizeFunc: function() {
return this.itemSizeFunc || this._defaultItemSizeFunc
},
_init: function(e) {
this._tickData = eventUtils.eventData(e)
},
_start: function(e) {
this._savedEventData = eventUtils.eventData(e);
e = this._fireEvent(SWIPE_START_EVENT, e);
if (!e.cancel) {
this._maxLeftOffset = e.maxLeftOffset;
this._maxRightOffset = e.maxRightOffset;
this._maxTopOffset = e.maxTopOffset;
this._maxBottomOffset = e.maxBottomOffset
}
},
_move: function(e) {
var strategy = this._getStrategy(),
moveEventData = eventUtils.eventData(e),
offset = strategy.calcOffsetRatio.call(this, e);
offset = this._fitOffset(offset, this.elastic);
if (moveEventData.time - this._tickData.time > this.TICK_INTERVAL) {
this._tickData = moveEventData
}
this._fireEvent(SWIPE_EVENT, e, {
offset: offset
});
e.preventDefault()
},
_end: function(e) {
var strategy = this._getStrategy(),
offsetRatio = strategy.calcOffsetRatio.call(this, e),
isFast = strategy.isFastSwipe.call(this, e),
startOffset = offsetRatio,
targetOffset = this._calcTargetOffset(offsetRatio, isFast);
startOffset = this._fitOffset(startOffset, this.elastic);
targetOffset = this._fitOffset(targetOffset, false);
this._fireEvent(SWIPE_END_EVENT, e, {
offset: startOffset,
targetOffset: targetOffset
})
},
_fitOffset: function(offset, elastic) {
var strategy = this._getStrategy(),
bounds = strategy.getBounds.call(this);
if (offset < -bounds[0]) {
return elastic ? (-2 * bounds[0] + offset) / 3 : -bounds[0]
}
if (offset > bounds[1]) {
return elastic ? (2 * bounds[1] + offset) / 3 : bounds[1]
}
return offset
},
_calcTargetOffset: function(offsetRatio, isFast) {
var result;
if (isFast) {
result = Math.ceil(Math.abs(offsetRatio));
if (offsetRatio < 0) {
result = -result
}
} else {
result = Math.round(offsetRatio)
}
return result
}
});
registerEmitter({
emitter: SwipeEmitter,
events: [SWIPE_START_EVENT, SWIPE_EVENT, SWIPE_END_EVENT]
});
exports.swipe = SWIPE_EVENT;
exports.start = SWIPE_START_EVENT;
exports.end = SWIPE_END_EVENT
},
/*!*************************************!*\
!*** ./Scripts/events/transform.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
mathUtils = __webpack_require__( /*! ../core/utils/math */ 79),
errors = __webpack_require__( /*! ../core/errors */ 17),
eventUtils = __webpack_require__( /*! ./utils */ 62),
Emitter = __webpack_require__( /*! ./core/emitter */ 75),
registerEmitter = __webpack_require__( /*! ./core/emitter_registrator */ 76);
var DX_PREFIX = "dx",
TRANSFORM = "transform",
TRANSLATE = "translate",
ZOOM = "zoom",
PINCH = "pinch",
ROTATE = "rotate",
START_POSTFIX = "start",
UPDATE_POSTFIX = "",
END_POSTFIX = "end";
var eventAliases = [];
var addAlias = function(eventName, eventArgs) {
eventAliases.push({
name: eventName,
args: eventArgs
})
};
addAlias(TRANSFORM, {
scale: true,
deltaScale: true,
rotation: true,
deltaRotation: true,
translation: true,
deltaTranslation: true
});
addAlias(TRANSLATE, {
translation: true,
deltaTranslation: true
});
addAlias(ZOOM, {
scale: true,
deltaScale: true
});
addAlias(PINCH, {
scale: true,
deltaScale: true
});
addAlias(ROTATE, {
rotation: true,
deltaRotation: true
});
var getVector = function(first, second) {
return {
x: second.pageX - first.pageX,
y: -second.pageY + first.pageY,
centerX: .5 * (second.pageX + first.pageX),
centerY: .5 * (second.pageY + first.pageY)
}
};
var getEventVector = function(e) {
var pointers = e.pointers;
return getVector(pointers[0], pointers[1])
};
var getDistance = function(vector) {
return Math.sqrt(vector.x * vector.x + vector.y * vector.y)
};
var getScale = function(firstVector, secondVector) {
return getDistance(firstVector) / getDistance(secondVector)
};
var getRotation = function(firstVector, secondVector) {
var scalarProduct = firstVector.x * secondVector.x + firstVector.y * secondVector.y;
var distanceProduct = getDistance(firstVector) * getDistance(secondVector);
if (0 === distanceProduct) {
return 0
}
var sign = mathUtils.sign(firstVector.x * secondVector.y - secondVector.x * firstVector.y);
var angle = Math.acos(mathUtils.fitIntoRange(scalarProduct / distanceProduct, -1, 1));
return sign * angle
};
var getTranslation = function(firstVector, secondVector) {
return {
x: firstVector.centerX - secondVector.centerX,
y: firstVector.centerY - secondVector.centerY
}
};
var TransformEmitter = Emitter.inherit({
configurate: function(data, eventName) {
if (eventName.indexOf(ZOOM) > -1) {
errors.log("W0005", eventName, "15.1", "Use '" + eventName.replace(ZOOM, PINCH) + "' event instead")
}
this.callBase(data)
},
validatePointers: function(e) {
return eventUtils.hasTouches(e) > 1
},
start: function(e) {
this._accept(e);
var startVector = getEventVector(e);
this._startVector = startVector;
this._prevVector = startVector;
this._fireEventAliases(START_POSTFIX, e)
},
move: function(e) {
var currentVector = getEventVector(e),
eventArgs = this._getEventArgs(currentVector);
this._fireEventAliases(UPDATE_POSTFIX, e, eventArgs);
this._prevVector = currentVector
},
end: function(e) {
var eventArgs = this._getEventArgs(this._prevVector);
this._fireEventAliases(END_POSTFIX, e, eventArgs)
},
_getEventArgs: function(vector) {
return {
scale: getScale(vector, this._startVector),
deltaScale: getScale(vector, this._prevVector),
rotation: getRotation(vector, this._startVector),
deltaRotation: getRotation(vector, this._prevVector),
translation: getTranslation(vector, this._startVector),
deltaTranslation: getTranslation(vector, this._prevVector)
}
},
_fireEventAliases: function(eventPostfix, originalEvent, eventArgs) {
eventArgs = eventArgs || {};
$.each(eventAliases, $.proxy(function(_, eventAlias) {
var args = {};
$.each(eventAlias.args, function(name) {
if (name in eventArgs) {
args[name] = eventArgs[name]
}
});
this._fireEvent(DX_PREFIX + eventAlias.name + eventPostfix, originalEvent, args)
}, this))
}
});
var eventNames = $.map(eventAliases, function(eventAlias) {
var eventNames = [];
$.each([START_POSTFIX, UPDATE_POSTFIX, END_POSTFIX], function(_, eventPostfix) {
eventNames.push(DX_PREFIX + eventAlias.name + eventPostfix)
});
return eventNames
});
registerEmitter({
emitter: TransformEmitter,
events: eventNames
});
$.each(eventNames, function(_, eventName) {
exports[eventName.substring(DX_PREFIX.length)] = eventName
})
},
/*!***********************************************!*\
!*** ./Scripts/bundles/modules/parts/data.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var DevExpress = __webpack_require__( /*! ./core */ 5);
var data = DevExpress.data = __webpack_require__( /*! ../../../bundles/modules/data */ 181);
data.odata = __webpack_require__( /*! ../../../bundles/modules/data.odata */ 186);
module.exports = data
},
/*!*****************************************!*\
!*** ./Scripts/bundles/modules/data.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var DevExpress = __webpack_require__( /*! ./core */ 6);
module.exports = DevExpress.data = DevExpress.data || {};
Object.defineProperty(DevExpress.data, "errorHandler", {
get: function() { /*! ../../data/errors */
return __webpack_require__(157).errorHandler
},
set: function(value) {
__webpack_require__( /*! ../../data/errors */ 157).errorHandler = value
}
});
Object.defineProperty(DevExpress.data, "_errorHandler", {
get: function() { /*! ../../data/errors */
return __webpack_require__(157)._errorHandler
},
set: function(value) {
__webpack_require__( /*! ../../data/errors */ 157)._errorHandler = value
}
});
DevExpress.data.DataSource = __webpack_require__( /*! ../../data/data_source */ 182);
DevExpress.data.query = __webpack_require__( /*! ../../data/query */ 158);
DevExpress.data.Store = __webpack_require__( /*! ../../data/abstract_store */ 156);
DevExpress.data.ArrayStore = __webpack_require__( /*! ../../data/array_store */ 162);
DevExpress.data.CustomStore = __webpack_require__( /*! ../../data/custom_store */ 163);
DevExpress.data.LocalStore = __webpack_require__( /*! ../../data/local_store */ 183);
DevExpress.data.base64_encode = __webpack_require__( /*! ../../data/utils */ 137).base64_encode;
DevExpress.data.Guid = __webpack_require__( /*! ../../core/guid */ 153);
DevExpress.data.utils = {};
DevExpress.data.utils.compileGetter = __webpack_require__( /*! ../../core/utils/data */ 36).compileGetter;
DevExpress.data.utils.compileSetter = __webpack_require__( /*! ../../core/utils/data */ 36).compileSetter;
DevExpress.EndpointSelector = __webpack_require__( /*! ../../data/endpoint_selector */ 184);
DevExpress.data.queryImpl = __webpack_require__( /*! ../../data/query */ 158).queryImpl;
DevExpress.data.queryAdapters = __webpack_require__( /*! ../../data/query_adapters */ 161);
var dataUtils = __webpack_require__( /*! ../../data/utils */ 137);
DevExpress.data.utils.normalizeBinaryCriterion = dataUtils.normalizeBinaryCriterion;
DevExpress.data.utils.normalizeSortingInfo = dataUtils.normalizeSortingInfo;
DevExpress.data.utils.errorMessageFromXhr = dataUtils.errorMessageFromXhr;
DevExpress.data.utils.aggregators = dataUtils.aggregators;
DevExpress.data.utils.keysEqual = dataUtils.keysEqual;
DevExpress.data.utils.isDisjunctiveOperator = dataUtils.isDisjunctiveOperator;
DevExpress.data.utils.isConjunctiveOperator = dataUtils.isConjunctiveOperator;
DevExpress.data.utils.processRequestResultLock = dataUtils.processRequestResultLock;
DevExpress.data.utils.toComparable = __webpack_require__( /*! ../../core/utils/data */ 36).toComparable;
DevExpress.data.utils.multiLevelGroup = __webpack_require__( /*! ../../data/abstract_store */ 156).multiLevelGroup;
DevExpress.data.utils.arrangeSortingInfo = __webpack_require__( /*! ../../data/abstract_store */ 156).arrangeSortingInfo;
DevExpress.data.utils.normalizeDataSourceOptions = __webpack_require__( /*! ../../data/data_source/data_source */ 155).normalizeDataSourceOptions
},
/*!*************************************!*\
!*** ./Scripts/data/data_source.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
module.exports = __webpack_require__( /*! ./data_source/data_source */ 155).DataSource
},
/*!*************************************!*\
!*** ./Scripts/data/local_store.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../core/class */ 20),
abstract = Class.abstract,
errors = __webpack_require__( /*! ./errors */ 157).errors,
ArrayStore = __webpack_require__( /*! ./array_store */ 162);
var LocalStoreBackend = Class.inherit({
ctor: function(store, storeOptions) {
this._store = store;
this._dirty = false;
var immediate = this._immediate = storeOptions.immediate;
var flushInterval = Math.max(100, storeOptions.flushInterval || 1e4);
if (!immediate) {
var saveProxy = $.proxy(this.save, this);
setInterval(saveProxy, flushInterval);
$(window).on("beforeunload", saveProxy);
if (window.cordova) {
document.addEventListener("pause", saveProxy, false)
}
}
},
notifyChanged: function() {
this._dirty = true;
if (this._immediate) {
this.save()
}
},
load: function() {
this._store._array = this._loadImpl();
this._dirty = false
},
save: function() {
if (!this._dirty) {
return
}
this._saveImpl(this._store._array);
this._dirty = false
},
_loadImpl: abstract,
_saveImpl: abstract
});
var DomLocalStoreBackend = LocalStoreBackend.inherit({
ctor: function(store, storeOptions) {
this.callBase(store, storeOptions);
var name = storeOptions.name;
if (!name) {
throw errors.Error("E4013")
}
this._key = "dx-data-localStore-" + name
},
_loadImpl: function() {
var raw = localStorage.getItem(this._key);
if (raw) {
return JSON.parse(raw)
}
return []
},
_saveImpl: function(array) {
if (!array.length) {
localStorage.removeItem(this._key)
} else {
localStorage.setItem(this._key, JSON.stringify(array))
}
}
});
var localStoreBackends = {
dom: DomLocalStoreBackend
};
var LocalStore = ArrayStore.inherit({
ctor: function(options) {
if ("string" === typeof options) {
options = {
name: options
}
} else {
options = options || {}
}
this.callBase(options);
this._backend = new localStoreBackends[options.backend || "dom"](this, options);
this._backend.load()
},
clear: function() {
this.callBase();
this._backend.notifyChanged()
},
_insertImpl: function(values) {
var b = this._backend;
return this.callBase(values).done($.proxy(b.notifyChanged, b))
},
_updateImpl: function(key, values) {
var b = this._backend;
return this.callBase(key, values).done($.proxy(b.notifyChanged, b))
},
_removeImpl: function(key) {
var b = this._backend;
return this.callBase(key).done($.proxy(b.notifyChanged, b))
}
}, "local");
module.exports = LocalStore
},
/*!*******************************************!*\
!*** ./Scripts/data/endpoint_selector.js ***!
\*******************************************/
function(module, exports, __webpack_require__) {
var errors = __webpack_require__( /*! ../core/errors */ 17),
proxyUrlFormatter = __webpack_require__( /*! ./proxy_url_formatter */ 185);
var location = window.location,
IS_WINJS_ORIGIN = "ms-appx:" === location.protocol,
IS_LOCAL_ORIGIN = isLocalHostName(location.hostname);
function isLocalHostName(url) {
return /^(localhost$|127\.)/i.test(url)
}
var EndpointSelector = function(config) {
this.config = config
};
EndpointSelector.prototype = {
urlFor: function(key) {
var bag = this.config[key];
if (!bag) {
throw errors.Error("E0006")
}
if (proxyUrlFormatter.isProxyUsed()) {
return proxyUrlFormatter.formatProxyUrl(bag.local)
}
if (bag.production) {
if (IS_WINJS_ORIGIN && !Debug.debuggerEnabled || !IS_WINJS_ORIGIN && !IS_LOCAL_ORIGIN) {
return bag.production
}
}
return bag.local
}
};
module.exports = EndpointSelector
},
/*!*********************************************!*\
!*** ./Scripts/data/proxy_url_formatter.js ***!
\*********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
location = window.location,
DXPROXY_HOST = "dxproxy.devexpress.com:8000",
IS_DXPROXY_ORIGIN = location.host === DXPROXY_HOST,
urlMapping = {};
var parseUrl = function() {
var a = document.createElement("a"),
props = ["protocol", "hostname", "port", "pathname", "search", "hash"];
var normalizePath = function(value) {
if ("/" !== value.charAt(0)) {
value = "/" + value
}
return value
};
return function(url) {
a.href = url;
var result = {};
$.each(props, function() {
result[this] = a[this]
});
result.pathname = normalizePath(result.pathname);
return result
}
}();
var extractProxyAppId = function() {
return location.pathname.split("/")[1]
};
module.exports = {
parseUrl: parseUrl,
isProxyUsed: function() {
return IS_DXPROXY_ORIGIN
},
formatProxyUrl: function(localUrl) {
var urlData = parseUrl(localUrl);
if (!/^(localhost$|127\.)/i.test(urlData.hostname)) {
return localUrl
}
var proxyUrlPart = DXPROXY_HOST + "/" + extractProxyAppId() + "_" + urlData.port;
urlMapping[proxyUrlPart] = urlData.hostname + ":" + urlData.port;
var resultUrl = "http://" + proxyUrlPart + urlData.pathname + urlData.search;
return resultUrl
},
formatLocalUrl: function(proxyUrl) {
if (proxyUrl.indexOf(DXPROXY_HOST) < 0) {
return proxyUrl
}
var resultUrl = proxyUrl;
for (var proxyUrlPart in urlMapping) {
if (urlMapping.hasOwnProperty(proxyUrlPart)) {
if (proxyUrl.indexOf(proxyUrlPart) >= 0) {
resultUrl = proxyUrl.replace(proxyUrlPart, urlMapping[proxyUrlPart]);
break
}
}
}
return resultUrl
}
}
},
/*!***********************************************!*\
!*** ./Scripts/bundles/modules/data.odata.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
__webpack_require__( /*! ./data */ 181);
DevExpress.data.ODataStore = __webpack_require__( /*! ../../data/odata/store */ 187);
DevExpress.data.ODataContext = __webpack_require__( /*! ../../data/odata/context */ 191);
DevExpress.data.utils = DevExpress.data.utils || {};
DevExpress.data.utils.odata = {};
DevExpress.data.utils.odata.keyConverters = __webpack_require__( /*! ../../data/odata/utils */ 188).keyConverters;
DevExpress.data.EdmLiteral = __webpack_require__( /*! ../../data/odata/utils */ 188).EdmLiteral;
var ODataUtilsModule = __webpack_require__( /*! ../../data/odata/utils */ 188);
DevExpress.data.utils.odata.serializePropName = ODataUtilsModule.serializePropName;
DevExpress.data.utils.odata.serializeValue = ODataUtilsModule.serializeValue;
DevExpress.data.utils.odata.serializeKey = ODataUtilsModule.serializeKey;
DevExpress.data.utils.odata.sendRequest = ODataUtilsModule.sendRequest;
DevExpress.data.OData__internals = ODataUtilsModule.OData__internals;
DevExpress.data.queryAdapters = DevExpress.data.queryAdapters || {};
DevExpress.data.queryAdapters.odata = __webpack_require__( /*! ../../data/odata/query_adapter */ 190).odata
},
/*!*************************************!*\
!*** ./Scripts/data/odata/store.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
odataUtils = __webpack_require__( /*! ./utils */ 188),
proxyUrlFormatter = __webpack_require__( /*! ../proxy_url_formatter */ 185),
errorsModule = __webpack_require__( /*! ../errors */ 157),
query = __webpack_require__( /*! ../query */ 158),
Store = __webpack_require__( /*! ../abstract_store */ 156),
mixins = __webpack_require__( /*! ./mixins */ 189);
__webpack_require__( /*! ./query_adapter */ 190);
var convertSimpleKey = function(keyType, keyValue) {
var converter = odataUtils.keyConverters[keyType];
if (!converter) {
throw errorsModule.errors.Error("E4014", keyType)
}
return converter(keyValue)
};
var ODataStore = Store.inherit({
ctor: function(options) {
this.callBase(options);
this._extractServiceOptions(options);
this._keyType = options.keyType;
if (2 === this.version()) {
this._updateMethod = "MERGE"
} else {
this._updateMethod = "PATCH"
}
},
_customLoadOptions: function() {
return ["expand", "customQueryParams"]
},
_byKeyImpl: function(key, extraOptions) {
var params = {};
if (extraOptions) {
if (extraOptions.expand) {
params.$expand = $.map($.makeArray(extraOptions.expand), odataUtils.serializePropName).join()
}
}
return this._sendRequest(this._byKeyUrl(key), "GET", params)
},
createQuery: function(loadOptions) {
var url, queryOptions;
loadOptions = loadOptions || {};
queryOptions = {
adapter: "odata",
beforeSend: this._beforeSend,
errorHandler: this._errorHandler,
jsonp: this._jsonp,
version: this._version,
withCredentials: this._withCredentials,
deserializeDates: this._deserializeDates,
expand: loadOptions.expand,
requireTotalCount: loadOptions.requireTotalCount
};
if (commonUtils.isDefined(loadOptions.urlOverride)) {
url = loadOptions.urlOverride
} else {
url = this._url
}
if ("customQueryParams" in loadOptions) {
var params = mixins.escapeServiceOperationParams(loadOptions.customQueryParams, this.version());
if (4 === this.version()) {
url = mixins.formatFunctionInvocationUrl(url, params)
} else {
queryOptions.params = params
}
}
return query(url, queryOptions)
},
_insertImpl: function(values) {
this._requireKey();
var that = this,
d = $.Deferred();
$.when(this._sendRequest(this._url, "POST", null, values)).done(function(serverResponse) {
d.resolve(values, that.keyOf(serverResponse))
}).fail(d.reject);
return d.promise()
},
_updateImpl: function(key, values) {
var d = $.Deferred();
$.when(this._sendRequest(this._byKeyUrl(key), this._updateMethod, null, values)).done(function() {
d.resolve(key, values)
}).fail(d.reject);
return d.promise()
},
_removeImpl: function(key) {
var d = $.Deferred();
$.when(this._sendRequest(this._byKeyUrl(key), "DELETE")).done(function() {
d.resolve(key)
}).fail(d.reject);
return d.promise()
},
_byKeyUrl: function(key, useOriginalHost) {
var keyObj = key,
keyType = this._keyType,
baseUrl = useOriginalHost ? proxyUrlFormatter.formatLocalUrl(this._url) : this._url;
if ($.isPlainObject(keyType)) {
keyObj = {};
$.each(keyType, function(subKeyName, subKeyType) {
keyObj[subKeyName] = convertSimpleKey(subKeyType, key[subKeyName])
})
} else {
if (keyType) {
keyObj = convertSimpleKey(keyType, key)
}
}
return baseUrl + "(" + encodeURIComponent(odataUtils.serializeKey(keyObj, this._version)) + ")"
}
}, "odata").include(mixins.SharedMethods);
module.exports = ODataStore
},
/*!*************************************!*\
!*** ./Scripts/data/odata/utils.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
Guid = __webpack_require__( /*! ../../core/guid */ 153),
isDefined = commonUtils.isDefined,
errors = __webpack_require__( /*! ../errors */ 157).errors,
dataUtils = __webpack_require__( /*! ../utils */ 137);
var GUID_REGEX = /^(\{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\}{0,1})$/;
var VERBOSE_DATE_REGEX = /^\/Date\((-?\d+)((\+|-)?(\d+)?)\)\/$/;
var ISO8601_DATE_REGEX = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[-+]{1}\d{2}(:?)(\d{2})?)?$/;
var JSON_VERBOSE_MIME_TYPE = "application/json;odata=verbose";
function formatISO8601(date, skipZeroTime, skipTimezone) {
var ret = [];
var pad = function(n) {
if (n < 10) {
return "0".concat(n)
}
return String(n)
};
var isZeroTime = function() {
return date.getHours() + date.getMinutes() + date.getSeconds() + date.getMilliseconds() < 1
};
ret.push(date.getFullYear());
ret.push("-");
ret.push(pad(date.getMonth() + 1));
ret.push("-");
ret.push(pad(date.getDate()));
if (!(skipZeroTime && isZeroTime())) {
ret.push("T");
ret.push(pad(date.getHours()));
ret.push(":");
ret.push(pad(date.getMinutes()));
ret.push(":");
ret.push(pad(date.getSeconds()));
if (date.getMilliseconds()) {
ret.push(".");
ret.push(date.getMilliseconds())
}
if (!skipTimezone) {
ret.push("Z")
}
}
return ret.join("")
}
function parseISO8601(isoString) {
var result = new Date(60 * new Date(0).getTimezoneOffset() * 1e3),
chunks = isoString.replace("Z", "").split("T"),
date = /(\d{4})-(\d{2})-(\d{2})/.exec(chunks[0]),
time = /(\d{2}):(\d{2}):(\d{2})\.?(\d{0,7})?/.exec(chunks[1]);
result.setFullYear(Number(date[1]));
result.setMonth(Number(date[2]) - 1);
result.setDate(Number(date[3]));
if ($.isArray(time) && time.length) {
result.setHours(Number(time[1]));
result.setMinutes(Number(time[2]));
result.setSeconds(Number(time[3]));
result.setMilliseconds(Number(String(time[4]).substr(0, 3)) || 0)
}
return result
}
function isAbsoluteUrl(url) {
return /^(?:[a-z]+:)?\/\//i.test(url)
}
function toAbsoluteUrl(basePath, relativePath) {
var part;
var baseParts = stripParams(basePath).split("/");
var relativeParts = relativePath.split("/");
function stripParams(url) {
var index = url.indexOf("?");
if (index > -1) {
return url.substr(0, index)
}
return url
}
baseParts.pop();
while (relativeParts.length) {
part = relativeParts.shift();
if (".." === part) {
baseParts.pop()
} else {
baseParts.push(part)
}
}
return baseParts.join("/")
}
var ajaxOptionsForRequest = function(protocolVersion, request, requestOptions) {
request = $.extend({
async: true,
method: "get",
url: "",
params: {},
payload: null,
headers: {},
timeout: 3e4
}, request);
requestOptions = requestOptions || {};
var beforeSend = requestOptions.beforeSend;
if (beforeSend) {
beforeSend(request)
}
var method = (request.method || "get").toLowerCase(),
isGet = "get" === method,
useJsonp = isGet && requestOptions.jsonp,
params = $.extend({}, request.params),
ajaxData = isGet ? params : formatPayload(request.payload),
qs = !isGet && $.param(params),
url = request.url,
contentType = !isGet && JSON_VERBOSE_MIME_TYPE;
if (qs) {
url += (url.indexOf("?") > -1 ? "&" : "?") + qs
}
if (useJsonp) {
ajaxData.$format = "json"
}
return {
url: url,
data: ajaxData,
dataType: useJsonp ? "jsonp" : "json",
jsonp: useJsonp && "$callback",
type: method,
async: request.async,
timeout: request.timeout,
headers: request.headers,
contentType: contentType,
accepts: {
json: [JSON_VERBOSE_MIME_TYPE, "text/plain"].join()
},
xhrFields: {
withCredentials: requestOptions.withCredentials
}
};
function formatPayload(payload) {
return JSON.stringify(payload, function(key, value) {
if (!(this[key] instanceof Date)) {
return value
}
value = formatISO8601(this[key]);
switch (protocolVersion) {
case 2:
return value.substr(0, value.length - 1);
case 3:
case 4:
return value;
default:
throw errors.Error("E4002")
}
})
}
};
var sendRequest = function(protocolVersion, request, requestOptions, deserializeDates) {
var d = $.Deferred();
var options = ajaxOptionsForRequest(protocolVersion, request, requestOptions);
$.ajax(options).always(function(obj, textStatus) {
var extra, tuplet = interpretJsonFormat(obj, textStatus, deserializeDates),
error = tuplet.error,
data = tuplet.data,
nextUrl = tuplet.nextUrl;
if (error) {
d.reject(error)
} else {
if (requestOptions.countOnly) {
if (isFinite(tuplet.count)) {
d.resolve(tuplet.count)
} else {
d.reject(new errors.Error("E4018"))
}
} else {
if (nextUrl) {
if (!isAbsoluteUrl(nextUrl)) {
nextUrl = toAbsoluteUrl(options.url, nextUrl)
}
sendRequest(protocolVersion, {
url: nextUrl
}, requestOptions, deserializeDates).fail(d.reject).done(function(nextData) {
d.resolve(data.concat(nextData))
})
} else {
if (isFinite(tuplet.count)) {
extra = {
totalCount: tuplet.count
}
}
d.resolve(data, extra)
}
}
}
});
return d.promise()
};
var formatDotNetError = function(errorObj) {
var message, currentError = errorObj;
if ("message" in errorObj) {
if (errorObj.message.value) {
message = errorObj.message.value
} else {
message = errorObj.message
}
}
while (currentError = currentError.innererror || currentError.internalexception) {
message = currentError.message;
if (currentError.internalexception && message.indexOf("inner exception") === -1) {
break
}
}
return message
};
var errorFromResponse = function(obj, textStatus) {
if ("nocontent" === textStatus) {
return null
}
var httpStatus = 200,
message = "Unknown error",
response = obj;
if ("success" !== textStatus) {
httpStatus = obj.status;
message = dataUtils.errorMessageFromXhr(obj, textStatus);
try {
response = $.parseJSON(obj.responseText)
} catch (x) {}
}
var errorObj = response && (response.error || response["odata.error"] || response["@odata.error"]);
if (errorObj) {
message = formatDotNetError(errorObj) || message;
if (200 === httpStatus) {
httpStatus = 500
}
if (errorObj.code) {
httpStatus = Number(errorObj.code)
}
return $.extend(Error(message), {
httpStatus: httpStatus,
errorDetails: errorObj
})
} else {
if (200 !== httpStatus) {
return $.extend(Error(message), {
httpStatus: httpStatus
})
}
}
};
var interpretJsonFormat = function(obj, textStatus, deserializeDates) {
var value, error = errorFromResponse(obj, textStatus);
if (error) {
return {
error: error
}
}
if (!$.isPlainObject(obj)) {
return {
data: obj
}
}
if ("d" in obj && (commonUtils.isArray(obj.d) || commonUtils.isObject(obj.d))) {
value = interpretVerboseJsonFormat(obj, textStatus)
} else {
value = interpretLightJsonFormat(obj, textStatus)
}
transformTypes(value, deserializeDates);
return value
};
var interpretVerboseJsonFormat = function(obj) {
var data = obj.d;
if (!isDefined(data)) {
return {
error: Error("Malformed or unsupported JSON response received")
}
}
data = data;
if (isDefined(data.results)) {
data = data.results
}
return {
data: data,
nextUrl: obj.d.__next,
count: parseInt(obj.d.__count, 10)
}
};
var interpretLightJsonFormat = function(obj) {
var data = obj;
if (isDefined(data.value)) {
data = data.value
}
return {
data: data,
nextUrl: obj["@odata.nextLink"],
count: parseInt(obj["@odata.count"], 10)
}
};
var EdmLiteral = Class.inherit({
ctor: function(value) {
this._value = value
},
valueOf: function() {
return this._value
}
});
var transformTypes = function(obj, deserializeDates) {
$.each(obj, function(key, value) {
if (null !== value && "object" === typeof value) {
if ("results" in value) {
obj[key] = value.results
}
transformTypes(obj[key], deserializeDates)
} else {
if ("string" === typeof value) {
if (GUID_REGEX.test(value)) {
obj[key] = new Guid(value)
}
if (false !== deserializeDates) {
if (value.match(VERBOSE_DATE_REGEX)) {
var date = new Date(Number(RegExp.$1) + 60 * RegExp.$2 * 1e3);
obj[key] = new Date(date.valueOf() + 60 * date.getTimezoneOffset() * 1e3)
} else {
if (ISO8601_DATE_REGEX.test(value)) {
obj[key] = new Date(parseISO8601(obj[key]).valueOf())
}
}
}
}
}
})
};
var serializeDate = function(date) {
return "datetime'" + formatISO8601(date, true, true) + "'"
};
var serializeString = function(value) {
return "'" + value.replace(/'/g, "''") + "'"
};
var serializePropName = function(propName) {
if (propName instanceof EdmLiteral) {
return propName.valueOf()
}
return propName.replace(/\./g, "/")
};
var serializeValueV4 = function(value) {
if (value instanceof Date) {
return formatISO8601(value, false, false)
}
if (value instanceof Guid) {
return value.valueOf()
}
if (commonUtils.isArray(value)) {
return "[" + value.map(function(item) {
return serializeValueV4(item)
}).join(",") + "]"
}
return serializeValueV2(value)
};
var serializeValueV2 = function(value) {
if (value instanceof Date) {
return serializeDate(value)
}
if (value instanceof Guid) {
return "guid'" + value + "'"
}
if (value instanceof EdmLiteral) {
return value.valueOf()
}
if ("string" === typeof value) {
return serializeString(value)
}
return String(value)
};
var serializeValue = function(value, protocolVersion) {
switch (protocolVersion) {
case 2:
case 3:
return serializeValueV2(value);
case 4:
return serializeValueV4(value);
default:
throw errors.Error("E4002")
}
};
var serializeKey = function(key, protocolVersion) {
if ($.isPlainObject(key)) {
var parts = [];
$.each(key, function(k, v) {
parts.push(serializePropName(k) + "=" + serializeValue(v, protocolVersion))
});
return parts.join()
}
return serializeValue(key, protocolVersion)
};
var keyConverters = {
String: function(value) {
return value + ""
},
Int32: function(value) {
return Math.floor(value)
},
Int64: function(value) {
if (value instanceof EdmLiteral) {
return value
}
return new EdmLiteral(value + "L")
},
Guid: function(value) {
if (value instanceof Guid) {
return value
}
return new Guid(value)
},
Boolean: function(value) {
return !!value
},
Single: function(value) {
if (value instanceof EdmLiteral) {
return value
}
return new EdmLiteral(value + "f")
},
Decimal: function(value) {
if (value instanceof EdmLiteral) {
return value
}
return new EdmLiteral(value + "m")
}
};
exports.sendRequest = sendRequest;
exports.serializePropName = serializePropName;
exports.serializeValue = serializeValue;
exports.serializeKey = serializeKey;
exports.keyConverters = keyConverters;
exports.EdmLiteral = EdmLiteral;
exports.OData__internals = {
interpretJsonFormat: interpretJsonFormat
}
},
/*!**************************************!*\
!*** ./Scripts/data/odata/mixins.js ***!
\**************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
stringUtils = __webpack_require__( /*! ../../core/utils/string */ 13),
odataUtils = __webpack_require__( /*! ./utils */ 188);
__webpack_require__( /*! ./query_adapter */ 190);
var DEFAULT_PROTOCOL_VERSION = 2;
var formatFunctionInvocationUrl = function(baseUrl, args) {
return stringUtils.format("{0}({1})", baseUrl, $.map(args || {}, function(value, key) {
return stringUtils.format("{0}={1}", key, value)
}).join(","))
};
var escapeServiceOperationParams = function(params, version) {
if (!params) {
return params
}
var result = {};
$.each(params, function(k, v) {
result[k] = odataUtils.serializeValue(v, version)
});
return result
};
var SharedMethods = {
_extractServiceOptions: function(options) {
options = options || {};
this._url = String(options.url).replace(/\/+$/, "");
this._beforeSend = options.beforeSend;
this._jsonp = options.jsonp;
this._version = options.version || DEFAULT_PROTOCOL_VERSION;
this._withCredentials = options.withCredentials;
this._deserializeDates = options.deserializeDates
},
_sendRequest: function(url, method, params, payload) {
return odataUtils.sendRequest(this.version(), {
url: url,
method: method,
params: params || {},
payload: payload
}, {
beforeSend: this._beforeSend,
jsonp: this._jsonp,
withCredentials: this._withCredentials
}, this._deserializeDates)
},
version: function() {
return this._version
}
};
exports.SharedMethods = SharedMethods;
exports.escapeServiceOperationParams = escapeServiceOperationParams;
exports.formatFunctionInvocationUrl = formatFunctionInvocationUrl
},
/*!*********************************************!*\
!*** ./Scripts/data/odata/query_adapter.js ***!
\*********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
queryAdapters = __webpack_require__( /*! ../query_adapters */ 161),
odataUtils = __webpack_require__( /*! ./utils */ 188),
serializePropName = odataUtils.serializePropName,
errors = __webpack_require__( /*! ../errors */ 157).errors,
dataUtils = __webpack_require__( /*! ../utils */ 137);
var DEFAULT_PROTOCOL_VERSION = 2;
var compileCriteria = function() {
var createBinaryOperationFormatter = function(op) {
return function(prop, val) {
return prop + " " + op + " " + val
}
};
var createStringFuncFormatter = function(op, reverse) {
return function(prop, val) {
var bag = [op, "("];
if (reverse) {
bag.push(val, ",", prop)
} else {
bag.push(prop, ",", val)
}
bag.push(")");
return bag.join("")
}
};
var formatters = {
"=": createBinaryOperationFormatter("eq"),
"<>": createBinaryOperationFormatter("ne"),
">": createBinaryOperationFormatter("gt"),
">=": createBinaryOperationFormatter("ge"),
"<": createBinaryOperationFormatter("lt"),
"<=": createBinaryOperationFormatter("le"),
startswith: createStringFuncFormatter("startswith"),
endswith: createStringFuncFormatter("endswith")
};
var formattersV2 = $.extend({}, formatters, {
contains: createStringFuncFormatter("substringof", true),
notcontains: createStringFuncFormatter("not substringof", true)
});
var formattersV4 = $.extend({}, formatters, {
contains: createStringFuncFormatter("contains"),
notcontains: createStringFuncFormatter("not contains")
});
var compileBinary = function(criteria, protocolVersion) {
criteria = dataUtils.normalizeBinaryCriterion(criteria);
var op = criteria[1],
formatters = 4 === protocolVersion ? formattersV4 : formattersV2,
formatter = formatters[op.toLowerCase()];
if (!formatter) {
throw errors.Error("E4003", op)
}
return formatter(serializePropName(criteria[0]), odataUtils.serializeValue(criteria[2], protocolVersion))
};
var compileGroup = function(criteria, protocolVersion) {
var groupOperator, nextGroupOperator, bag = [];
$.each(criteria, function(index, criterion) {
if ($.isArray(criterion)) {
if (bag.length > 1 && groupOperator !== nextGroupOperator) {
throw new errors.Error("E4019")
}
bag.push("(" + compileCore(criterion, protocolVersion) + ")");
groupOperator = nextGroupOperator;
nextGroupOperator = "and"
} else {
nextGroupOperator = dataUtils.isConjunctiveOperator(this) ? "and" : "or"
}
});
return bag.join(" " + groupOperator + " ")
};
var compileCore = function(criteria, protocolVersion) {
if ($.isArray(criteria[0])) {
return compileGroup(criteria, protocolVersion)
}
return compileBinary(criteria, protocolVersion)
};
return function(criteria, protocolVersion) {
return compileCore(criteria, protocolVersion)
}
}();
var createODataQueryAdapter = function(queryOptions) {
var _select, _skip, _take, _countQuery, _sorting = [],
_criteria = [],
_expand = queryOptions.expand,
_oDataVersion = queryOptions.version || DEFAULT_PROTOCOL_VERSION;
var hasSlice = function() {
return _skip || void 0 !== _take
};
var hasFunction = function(criterion) {
for (var i = 0; i < criterion.length; i++) {
if ($.isFunction(criterion[i])) {
return true
}
if ($.isArray(criterion[i]) && hasFunction(criterion[i])) {
return true
}
}
return false
};
var generateSelectExpand = function() {
var hasDot = function(x) {
return /\./.test(x)
};
var generateSelect = function() {
if (!_select) {
return
}
if (_oDataVersion < 4) {
return serializePropName(_select.join())
}
return $.grep(_select, hasDot, true).join()
};
var generateExpand = function() {
var generatorV2 = function() {
var hash = {};
if (_expand) {
$.each($.makeArray(_expand), function() {
hash[serializePropName(this)] = 1
})
}
if (_select) {
$.each($.makeArray(_select), function() {
var path = this.split(".");
if (path.length < 2) {
return
}
path.pop();
hash[serializePropName(path.join("."))] = 1
})
}
return $.map(hash, function(k, v) {
return v
}).join()
};
var generatorV4 = function() {
var format = function(hash) {
var formatCore = function(hash) {
var ret = "",
select = [],
expand = [];
$.each(hash, function(key, value) {
if ($.isArray(value)) {
[].push.apply(select, value)
}
if ($.isPlainObject(value)) {
expand.push(key + formatCore(value))
}
});
if (select.length || expand.length) {
ret += "(";
if (select.length) {
ret += "$select=" + $.map(select, serializePropName).join()
}
if (expand.length) {
if (select.length) {
ret += ";"
}
ret += "$expand=" + $.map(expand, serializePropName).join()
}
ret += ")"
}
return ret
};
var ret = [];
$.each(hash, function(key, value) {
ret.push(key + formatCore(value))
});
return ret.join()
};
var parseTree = function(exprs, root, stepper) {
var parseCore = function(exprParts, root, stepper) {
var result = stepper(root, exprParts.shift(), exprParts);
if (false === result) {
return
}
parseCore(exprParts, result, stepper)
};
$.each(exprs, function(_, x) {
parseCore(x.split("."), root, stepper)
})
};
var hash = {};
if (_expand || _select) {
if (_expand) {
parseTree($.makeArray(_expand), hash, function(node, key, path) {
node[key] = node[key] || {};
if (!path.length) {
return false
}
return node[key]
})
}
if (_select) {
parseTree($.grep($.makeArray(_select), hasDot), hash, function(node, key, path) {
if (!path.length) {
node[key] = node[key] || [];
node[key].push(key);
return false
}
return node[key] = node[key] || {}
})
}
return format(hash)
}
};
if (_oDataVersion < 4) {
return generatorV2()
}
return generatorV4()
};
var tuple = {
$select: generateSelect() || void 0,
$expand: generateExpand() || void 0
};
return tuple
};
var requestData = function() {
var result = {};
if (!_countQuery) {
if (_sorting.length) {
result.$orderby = _sorting.join(",")
}
if (_skip) {
result.$skip = _skip
}
if (void 0 !== _take) {
result.$top = _take
}
var tuple = generateSelectExpand();
result.$select = tuple.$select;
result.$expand = tuple.$expand
}
if (_criteria.length) {
result.$filter = compileCriteria(_criteria.length < 2 ? _criteria[0] : _criteria, _oDataVersion)
}
if (_countQuery) {
result.$top = 0
}
if (queryOptions.requireTotalCount || _countQuery) {
if (4 !== _oDataVersion) {
result.$inlinecount = "allpages"
} else {
result.$count = "true"
}
}
return result
};
return {
exec: function(url) {
return odataUtils.sendRequest(_oDataVersion, {
url: url,
params: $.extend(requestData(), queryOptions && queryOptions.params)
}, {
beforeSend: queryOptions.beforeSend,
jsonp: queryOptions.jsonp,
withCredentials: queryOptions.withCredentials,
countOnly: _countQuery
}, queryOptions.deserializeDates)
},
multiSort: function(args) {
var rules;
if (hasSlice()) {
return false
}
for (var i = 0; i < args.length; i++) {
var rule, getter = args[i][0],
desc = !!args[i][1];
if ("string" !== typeof getter) {
return false
}
rule = serializePropName(getter);
if (desc) {
rule += " desc"
}
rules = rules || [];
rules.push(rule)
}
_sorting = rules
},
slice: function(skipCount, takeCount) {
if (hasSlice()) {
return false
}
_skip = skipCount;
_take = takeCount
},
filter: function(criterion) {
if (hasSlice()) {
return false
}
if (!$.isArray(criterion)) {
criterion = $.makeArray(arguments)
}
if (hasFunction(criterion)) {
return false
}
if (_criteria.length) {
_criteria.push("and")
}
_criteria.push(criterion)
},
select: function(expr) {
if (_select || $.isFunction(expr)) {
return false
}
if (!$.isArray(expr)) {
expr = $.makeArray(arguments)
}
_select = expr
},
count: function() {
_countQuery = true
}
}
};
queryAdapters.odata = createODataQueryAdapter;
exports.odata = createODataQueryAdapter
},
/*!***************************************!*\
!*** ./Scripts/data/odata/context.js ***!
\***************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
errorsModule = __webpack_require__( /*! ../errors */ 157),
ODataStore = __webpack_require__( /*! ./store */ 187),
mixins = __webpack_require__( /*! ./mixins */ 189);
__webpack_require__( /*! ./query_adapter */ 190);
var ODataContext = Class.inherit({
ctor: function(options) {
var that = this;
that._extractServiceOptions(options);
that._errorHandler = options.errorHandler;
$.each(options.entities || [], function(entityAlias, entityOptions) {
that[entityAlias] = new ODataStore($.extend({}, options, {
url: that._url + "/" + encodeURIComponent(entityOptions.name || entityAlias)
}, entityOptions))
})
},
get: function(operationName, params) {
return this.invoke(operationName, params, "GET")
},
invoke: function(operationName, params, httpMethod) {
params = params || {};
httpMethod = (httpMethod || "POST").toLowerCase();
var payload, d = $.Deferred(),
url = this._url + "/" + encodeURIComponent(operationName);
if (4 === this.version()) {
if ("get" === httpMethod) {
url = mixins.formatFunctionInvocationUrl(url, mixins.escapeServiceOperationParams(params, this.version()));
params = null
} else {
if ("post" === httpMethod) {
payload = params;
params = null
}
}
}
$.when(this._sendRequest(url, httpMethod, mixins.escapeServiceOperationParams(params, this.version()), payload)).done(function(r) {
if ($.isPlainObject(r) && operationName in r) {
r = r[operationName]
}
d.resolve(r)
}).fail([this._errorHandler, errorsModule._errorHandler, d.reject]);
return d.promise()
},
objectLink: function(entityAlias, key) {
var store = this[entityAlias];
if (!store) {
throw errorsModule.errors.Error("E4015", entityAlias)
}
if (!commonUtils.isDefined(key)) {
return null
}
return {
__metadata: {
uri: store._byKeyUrl(key, true)
}
}
}
}).include(mixins.SharedMethods);
module.exports = ODataContext
},
/*!***************************************!*\
!*** ./Scripts/bundles/modules/ui.js ***!
\***************************************/
function(module, exports, __webpack_require__) {
__webpack_require__( /*! ./core */ 6);
module.exports = DevExpress.ui = {};
DevExpress.ui.templateRendered = __webpack_require__( /*! ../../ui/widget/ui.template_base */ 90).renderedCallbacks
},
/*!*******************************************!*\
!*** ./Scripts/ui/set_template_engine.js ***!
\*******************************************/
function(module, exports, __webpack_require__) {
module.exports = __webpack_require__( /*! ./widget/jquery.template */ 96).setTemplateEngine
},
/*!******************************!*\
!*** ./Scripts/ui/dialog.js ***!
\******************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Component = __webpack_require__( /*! ../core/component */ 34),
Action = __webpack_require__( /*! ../core/action */ 35),
domUtils = __webpack_require__( /*! ../core/utils/dom */ 50),
viewPortUtils = __webpack_require__( /*! ../core/utils/view_port */ 42),
devices = __webpack_require__( /*! ../core/devices */ 40),
themes = __webpack_require__( /*! ./themes */ 143),
errors = __webpack_require__( /*! ./widget/ui.errors */ 10),
messageLocalization = __webpack_require__( /*! ../localization/message */ 80),
Popup = __webpack_require__( /*! ./popup */ 195),
config = __webpack_require__( /*! ../core/config */ 15);
var DEFAULT_BUTTON = {
text: "OK",
onClick: function() {
return true
}
};
var DX_DIALOG_CLASSNAME = "dx-dialog",
DX_DIALOG_WRAPPER_CLASSNAME = DX_DIALOG_CLASSNAME + "-wrapper",
DX_DIALOG_ROOT_CLASSNAME = DX_DIALOG_CLASSNAME + "-root",
DX_DIALOG_CONTENT_CLASSNAME = DX_DIALOG_CLASSNAME + "-content",
DX_DIALOG_MESSAGE_CLASSNAME = DX_DIALOG_CLASSNAME + "-message",
DX_DIALOG_BUTTONS_CLASSNAME = DX_DIALOG_CLASSNAME + "-buttons",
DX_DIALOG_BUTTON_CLASSNAME = DX_DIALOG_CLASSNAME + "-button";
var FakeDialogComponent = Component.inherit({
ctor: function(element, options) {
this.callBase(options)
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: {
platform: "ios"
},
options: {
width: 276
}
}, {
device: {
platform: "android"
},
options: {
lWidth: "60%",
pWidth: "80%"
}
}, {
device: function(device) {
var currentTheme = (themes.current() || "").split(".")[0];
return !device.phone && "win8" === currentTheme
},
options: {
width: function() {
return $(window).width()
}
}
}, {
device: function(device) {
var currentTheme = (themes.current() || "").split(".")[0];
return device.phone && "win8" === currentTheme
},
options: {
position: {
my: "top center",
at: "top center",
of: window,
offset: "0 0"
}
}
}])
}
});
var dialog = function(options) {
var deferred = $.Deferred();
var defaultOptions = (new FakeDialogComponent).option();
options = $.extend(defaultOptions, options);
var $element = $("
").addClass(DX_DIALOG_CLASSNAME).appendTo(viewPortUtils.value());
var $message = $("
").addClass(DX_DIALOG_MESSAGE_CLASSNAME).html(String(options.message));
var popupToolbarItems = [];
var toolbarItemsOption = options.buttons;
if (toolbarItemsOption) {
errors.log("W0001", "DevExpress.ui.dialog", "buttons", "16.1", "Use the 'toolbarItems' option instead")
} else {
toolbarItemsOption = options.toolbarItems
}
$.each(toolbarItemsOption || [DEFAULT_BUTTON], function() {
var action = new Action(this.onClick, {
context: popupInstance
});
popupToolbarItems.push({
toolbar: "bottom",
location: devices.current().android ? "after" : "center",
widget: "dxButton",
options: $.extend({}, this, {
onClick: function() {
var result = action.execute(arguments);
hide(result)
}
})
})
});
var popupInstance = new Popup($element, {
title: options.title || this.title,
showTitle: function() {
var isTitle = void 0 === options.showTitle ? true : options.showTitle;
return isTitle
}(),
height: "auto",
width: function() {
var isPortrait = $(window).height() > $(window).width(),
key = (isPortrait ? "p" : "l") + "Width",
widthOption = options.hasOwnProperty(key) ? options[key] : options.width;
return $.isFunction(widthOption) ? widthOption() : widthOption
},
showCloseButton: options.showCloseButton || false,
focusStateEnabled: false,
onContentReady: function(args) {
args.component.content().addClass(DX_DIALOG_CONTENT_CLASSNAME).append($message)
},
onShowing: function(e) {
e.component.bottomToolbar().addClass(DX_DIALOG_BUTTONS_CLASSNAME).find(".dx-button").addClass(DX_DIALOG_BUTTON_CLASSNAME);
domUtils.resetActiveElement()
},
onShown: function(e) {
e.component.bottomToolbar().find(".dx-button").first().focus()
},
onHiding: function() {
deferred.reject()
},
toolbarItems: popupToolbarItems,
animation: {
show: {
type: "pop",
duration: 400
},
hide: {
type: "pop",
duration: 400,
to: {
opacity: 0,
scale: 0
},
from: {
opacity: 1,
scale: 1
}
}
},
rtlEnabled: config().rtlEnabled,
boundaryOffset: {
h: 10,
v: 0
}
});
popupInstance._wrapper().addClass(DX_DIALOG_WRAPPER_CLASSNAME);
if (options.position) {
popupInstance.option("position", options.position)
}
popupInstance._wrapper().addClass(DX_DIALOG_ROOT_CLASSNAME);
function show() {
popupInstance.show();
return deferred.promise()
}
function hide(value) {
deferred.resolve(value);
popupInstance.hide().done(function() {
popupInstance.element().remove()
})
}
return {
show: show,
hide: hide
}
};
var alert = function(message, title, showTitle) {
var dialogInstance, options = $.isPlainObject(message) ? message : {
title: title,
message: message,
showTitle: showTitle
};
dialogInstance = this.custom(options);
return dialogInstance.show()
};
var confirm = function(message, title, showTitle) {
var dialogInstance, options = $.isPlainObject(message) ? message : {
title: title,
message: message,
showTitle: showTitle,
toolbarItems: [{
text: messageLocalization.format("Yes"),
onClick: function() {
return true
}
}, {
text: messageLocalization.format("No"),
onClick: function() {
return false
}
}]
};
dialogInstance = this.custom(options);
return dialogInstance.show()
};
exports.custom = dialog;
exports.alert = alert;
exports.confirm = confirm;
exports.FakeDialogComponent = FakeDialogComponent
},
/*!*****************************!*\
!*** ./Scripts/ui/popup.js ***!
\*****************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
translator = __webpack_require__( /*! ../animation/translator */ 60),
camelize = __webpack_require__( /*! ../core/utils/inflector */ 49).camelize,
commonUtils = __webpack_require__( /*! ../core/utils/common */ 14),
messageLocalization = __webpack_require__( /*! ../localization/message */ 80),
devices = __webpack_require__( /*! ../core/devices */ 40),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 43),
Button = __webpack_require__( /*! ./button */ 196),
themes = __webpack_require__( /*! ./themes */ 143),
Overlay = __webpack_require__( /*! ./overlay */ 109);
__webpack_require__( /*! ./toolbar/ui.toolbar.base */ 198);
var POPUP_CLASS = "dx-popup",
POPUP_WRAPPER_CLASS = "dx-popup-wrapper",
POPUP_FULL_SCREEN_CLASS = "dx-popup-fullscreen",
POPUP_FULL_SCREEN_WIDTH_CLASS = "dx-popup-fullscreen-width",
POPUP_NORMAL_CLASS = "dx-popup-normal",
POPUP_CONTENT_CLASS = "dx-popup-content",
POPUP_DRAGGABLE_CLASS = "dx-popup-draggable",
POPUP_TITLE_CLASS = "dx-popup-title",
POPUP_TITLE_CLOSEBUTTON_CLASS = "dx-closebutton",
POPUP_BOTTOM_CLASS = "dx-popup-bottom",
TEMPLATE_WRAPPER_CLASS = "dx-template-wrapper",
ALLOWED_TOOLBAR_ITEM_ALIASES = ["cancel", "clear", "done"];
var getButtonPlace = function(name) {
var device = devices.current(),
platform = device.platform,
toolbar = "bottom",
location = "before";
if ("ios" === platform) {
switch (name) {
case "cancel":
toolbar = "top";
break;
case "clear":
toolbar = "top";
location = "after";
break;
case "done":
location = "after"
}
} else {
if ("win" === platform) {
location = "after"
} else {
if ("android" === platform && device.version && parseInt(device.version[0]) > 4) {
switch (name) {
case "cancel":
location = "after";
break;
case "done":
location = "after"
}
} else {
if ("android" === platform) {
location = "center"
}
}
}
}
return {
toolbar: toolbar,
location: location
}
};
var Popup = Overlay.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
fullScreen: false,
title: "",
showTitle: true,
titleTemplate: "title",
onTitleRendered: null,
dragEnabled: false,
toolbarItems: [],
showCloseButton: false,
bottomTemplate: "bottom"
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function() {
var currentTheme = (themes.current() || "").split(".")[0];
return "win8" === currentTheme
},
options: {
width: function() {
return $(window).width()
}
}
}, {
device: function(device) {
var currentTheme = (themes.current() || "").split(".")[0];
return device.phone && "win8" === currentTheme
},
options: {
position: {
my: "top center",
at: "top center",
offset: "0 0"
}
}
}, {
device: {
platform: "ios"
},
options: {
animation: this._iosAnimation
}
}, {
device: {
platform: "android"
},
options: {
animation: this._androidAnimation
}
}, {
device: {
platform: "generic"
},
options: {
showCloseButton: true
}
}, {
device: function(device) {
return "generic" === devices.real().platform && "generic" === device.platform
},
options: {
dragEnabled: true
}
}, {
device: function(device) {
return "desktop" === devices.real().deviceType && !devices.isSimulator()
},
options: {
focusStateEnabled: true
}
}])
},
_setDeprecatedOptions: function() {
this.callBase();
$.extend(this._deprecatedOptions, {
buttons: {
since: "16.1",
alias: "toolbarItems"
}
})
},
_iosAnimation: {
show: {
type: "slide",
duration: 400,
from: {
position: {
my: "top",
at: "bottom"
}
},
to: {
position: {
my: "center",
at: "center"
}
}
},
hide: {
type: "slide",
duration: 400,
from: {
opacity: 1,
position: {
my: "center",
at: "center"
}
},
to: {
opacity: 1,
position: {
my: "top",
at: "bottom"
}
}
}
},
_androidAnimation: function() {
var fullScreenConfig = {
show: {
type: "slide",
duration: 300,
from: {
top: "30%",
opacity: 0
},
to: {
top: 0,
opacity: 1
}
},
hide: {
type: "slide",
duration: 300,
from: {
top: 0,
opacity: 1
},
to: {
top: "30%",
opacity: 0
}
}
},
defaultConfig = {
show: {
type: "fade",
duration: 400,
from: 0,
to: 1
},
hide: {
type: "fade",
duration: 400,
from: 1,
to: 0
}
};
return this.option("fullScreen") ? fullScreenConfig : defaultConfig
},
_init: function() {
this.callBase();
this.element().addClass(POPUP_CLASS);
this._wrapper().addClass(POPUP_WRAPPER_CLASS);
this._$popupContent = this._$content.wrapInner($("
").addClass(POPUP_CONTENT_CLASS)).children().eq(0)
},
_render: function() {
var isFullscreen = this.option("fullScreen");
this._$content.toggleClass(POPUP_FULL_SCREEN_CLASS, isFullscreen).toggleClass(POPUP_NORMAL_CLASS, !isFullscreen);
this.callBase()
},
_renderContentImpl: function() {
this.callBase();
this._renderTitle();
this._renderBottom()
},
_renderTitle: function() {
var items = this._getToolbarItems("top"),
titleText = this.option("title"),
showTitle = this.option("showTitle");
if (showTitle && !!titleText) {
items.unshift({
location: devices.current().ios ? "center" : "before",
text: titleText
})
}
if (showTitle || items.length > 0) {
this._$title && this._$title.remove();
var $title = $("
").addClass(POPUP_TITLE_CLASS).insertBefore(this.content());
this._$title = this._renderTemplateByType("titleTemplate", items, $title).addClass(POPUP_TITLE_CLASS);
this._renderDrag();
this._executeTitleRenderAction(this._$title)
} else {
if (this._$title) {
this._$title.detach()
}
}
},
_renderTemplateByType: function(optionName, data, $container) {
var $result, template = this._getTemplateByOption(optionName),
toolbarTemplate = template.owner() === this.option("templateProvider");
if (toolbarTemplate) {
$result = template.render({
model: data,
container: $container
});
$container.replaceWith($result);
return $result
} else {
$result = template.render({
container: $container
});
if ($result.hasClass(TEMPLATE_WRAPPER_CLASS)) {
$container.replaceWith($result);
$container = $result
}
return $container
}
},
_executeTitleRenderAction: function(titleElement) {
this._getTitleRenderAction()({
titleElement: titleElement
})
},
_getTitleRenderAction: function() {
return this._titleRenderAction || this._createTitleRenderAction()
},
_createTitleRenderAction: function() {
return this._titleRenderAction = this._createActionByOption("onTitleRendered", {
element: this.element(),
excludeValidators: ["designMode", "disabled", "readOnly"]
})
},
_getCloseButton: function() {
return {
toolbar: "top",
location: "after",
template: this._getCloseButtonRenderer()
}
},
_getCloseButtonRenderer: function() {
return $.proxy(function(_, __, $container) {
var $button = $("
").addClass(POPUP_TITLE_CLOSEBUTTON_CLASS);
this._createComponent($button, Button, {
icon: "close",
onClick: this._createToolbarItemAction(void 0),
_templates: {}
});
$container.append($button)
}, this)
},
_getToolbarItems: function(toolbar) {
var toolbarItems = this.option("toolbarItems");
var toolbarsItems = [];
this._toolbarItemClasses = [];
var currentPlatform = devices.current().platform,
index = 0;
$.each(toolbarItems, $.proxy(function(_, data) {
var isShortcut = commonUtils.isDefined(data.shortcut),
item = isShortcut ? getButtonPlace(data.shortcut) : data;
if (isShortcut && "ios" === currentPlatform && index < 2) {
item.toolbar = "top";
index++
}
$.extend(item, commonUtils.isDefined(data.toolbar) ? {
toolbar: data.toolbar
} : {});
if (item && item.toolbar === toolbar) {
if (isShortcut) {
$.extend(item, {
location: data.location
}, this._getToolbarItemByAlias(data))
}
var isLTROrder = "win" === currentPlatform || "generic" === currentPlatform;
if ("done" === data.shortcut && isLTROrder || "cancel" === data.shortcut && !isLTROrder) {
toolbarsItems.unshift(item)
} else {
toolbarsItems.push(item)
}
}
}, this));
if ("top" === toolbar && this.option("showCloseButton") && this.option("showTitle")) {
toolbarsItems.push(this._getCloseButton())
}
return toolbarsItems
},
_getToolbarItemByAlias: function(data) {
var that = this,
itemType = data.shortcut;
if ($.inArray(itemType, ALLOWED_TOOLBAR_ITEM_ALIASES) < 0) {
return false
}
var itemConfig = $.extend({
text: messageLocalization.format(camelize(itemType, true)),
onClick: this._createToolbarItemAction(data.onClick),
_templates: {}
}, data.options || {});
var itemClass = POPUP_CLASS + "-" + itemType;
this._toolbarItemClasses.push(itemClass);
return {
template: function(_, __, $container) {
var $toolbarItem = $("
").addClass(itemClass).appendTo($container);
that._createComponent($toolbarItem, Button, itemConfig)
}
}
},
_createToolbarItemAction: function(clickAction) {
return this._createAction(clickAction, {
afterExecute: function(e) {
e.component.hide()
}
})
},
_renderBottom: function() {
var items = this._getToolbarItems("bottom");
if (items.length) {
this._$bottom && this._$bottom.remove();
var $bottom = $("
").addClass(POPUP_BOTTOM_CLASS).insertAfter(this.content());
this._$bottom = this._renderTemplateByType("bottomTemplate", items, $bottom).addClass(POPUP_BOTTOM_CLASS);
this._toggleClasses()
} else {
this._$bottom && this._$bottom.detach()
}
},
_toggleClasses: function() {
var aliases = ALLOWED_TOOLBAR_ITEM_ALIASES;
$.each(aliases, $.proxy(function(_, alias) {
var className = POPUP_CLASS + "-" + alias;
if ($.inArray(className, this._toolbarItemClasses) >= 0) {
this._wrapper().addClass(className + "-visible");
this._$bottom.addClass(className)
} else {
this._wrapper().removeClass(className + "-visible");
this._$bottom.removeClass(className)
}
}, this))
},
_getDragTarget: function() {
return this._$title
},
_renderGeometryImpl: function() {
this._resetContentHeight();
this.callBase.apply(this, arguments);
this._setContentHeight()
},
_resetContentHeight: function() {
this._$popupContent.css({
height: "auto"
})
},
_renderDrag: function() {
this.callBase();
this._$content.toggleClass(POPUP_DRAGGABLE_CLASS, this.option("dragEnabled"))
},
_renderResize: function() {
this.callBase();
this._$content.dxResizable("option", "onResize", $.proxy(function() {
this._setContentHeight();
this._actions.onResize(arguments)
}, this))
},
_setContentHeight: function() {
if (this._disallowUpdateContentHeight()) {
return
}
var contentPaddings = this._$content.outerHeight() - this._$content.height(),
contentHeight = this._$content.get(0).getBoundingClientRect().height - contentPaddings;
if (this._$title && this._$title.is(":visible")) {
contentHeight -= this._$title.get(0).getBoundingClientRect().height || 0
}
if (this._$bottom && this._$bottom.is(":visible")) {
contentHeight -= this._$bottom.get(0).getBoundingClientRect().height || 0
}
this._$popupContent.css({
height: contentHeight
})
},
_disallowUpdateContentHeight: function() {
var isHeightAuto = "auto" === this._$content.get(0).style.height,
maxHeightSpecified = "none" !== this._$content.css("maxHeight"),
minHeightSpecified = parseInt(this._$content.css("minHeight")) > 0;
return isHeightAuto && !(maxHeightSpecified || minHeightSpecified)
},
_renderDimensions: function() {
if (this.option("fullScreen")) {
this._$content.css({
width: "100%",
height: "100%"
})
} else {
this.callBase.apply(this, arguments)
}
this._renderFullscreenWidthClass()
},
_renderFullscreenWidthClass: function() {
this.overlayContent().toggleClass(POPUP_FULL_SCREEN_WIDTH_CLASS, this.overlayContent().outerWidth() === $(window).width())
},
_renderShadingDimensions: function() {
if (this.option("fullScreen")) {
this._wrapper().css({
width: "100%",
height: "100%"
})
} else {
this.callBase.apply(this, arguments)
}
},
_renderPosition: function() {
if (this.option("fullScreen")) {
translator.move(this._$content, {
top: 0,
left: 0
})
} else {
return this.callBase.apply(this, arguments)
}
},
_optionChanged: function(args) {
switch (args.name) {
case "showTitle":
case "title":
case "titleTemplate":
this._renderTitle();
this._renderGeometry();
break;
case "bottomTemplate":
this._renderBottom();
this._renderGeometry();
break;
case "onTitleRendered":
this._createTitleRenderAction(args.value);
break;
case "toolbarItems":
this._renderTitle();
this._renderBottom();
this._renderGeometry();
break;
case "dragEnabled":
this._renderDrag();
break;
case "fullScreen":
this._$content.toggleClass(POPUP_FULL_SCREEN_CLASS, args.value);
this._refresh();
break;
case "showCloseButton":
this._renderTitle();
break;
default:
this.callBase(args)
}
},
bottomToolbar: function() {
return this._$bottom
},
content: function() {
return this._$popupContent
},
overlayContent: function() {
return this._$content
}
});
registerComponent("dxPopup", Popup);
module.exports = Popup
},
/*!******************************!*\
!*** ./Scripts/ui/button.js ***!
\******************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
iconUtils = __webpack_require__( /*! ../core/utils/icon */ 99),
devices = __webpack_require__( /*! ../core/devices */ 40),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 43),
ValidationMixin = __webpack_require__( /*! ./validation/validation_mixin */ 108),
ValidationEngine = __webpack_require__( /*! ./validation_engine */ 117),
Widget = __webpack_require__( /*! ./widget/ui.widget */ 89),
inkRipple = __webpack_require__( /*! ./widget/utils.ink_ripple */ 197),
eventUtils = __webpack_require__( /*! ../events/utils */ 62),
themes = __webpack_require__( /*! ./themes */ 143),
clickEvent = __webpack_require__( /*! ../events/click */ 64);
var BUTTON_CLASS = "dx-button",
BUTTON_CONTENT_CLASS = "dx-button-content",
BUTTON_HAS_TEXT_CLASS = "dx-button-has-text",
BUTTON_HAS_ICON_CLASS = "dx-button-has-icon",
TEMPLATE_WRAPPER_CLASS = "dx-template-wrapper",
ANONYMOUS_TEMPLATE_NAME = "content",
BUTTON_FEEDBACK_HIDE_TIMEOUT = 100;
var Button = Widget.inherit({
_supportedKeys: function() {
var that = this,
click = function(e) {
e.preventDefault();
that._executeClickAction(e)
};
return $.extend(this.callBase(), {
space: click,
enter: click
})
},
_setDeprecatedOptions: function() {
this.callBase();
$.extend(this._deprecatedOptions, {
iconSrc: {
since: "15.1",
alias: "icon"
}
})
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
hoverStateEnabled: true,
onClick: null,
type: "normal",
text: "",
icon: "",
validationGroup: void 0,
activeStateEnabled: true,
template: "content",
useInkRipple: false
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function(device) {
return "desktop" === devices.real().deviceType && !devices.isSimulator()
},
options: {
focusStateEnabled: true
}
}, {
device: function() {
return /android5/.test(themes.current())
},
options: {
useInkRipple: true
}
}])
},
_getAnonymousTemplateName: function() {
return ANONYMOUS_TEMPLATE_NAME
},
_feedbackHideTimeout: BUTTON_FEEDBACK_HIDE_TIMEOUT,
_render: function() {
this.element().addClass(BUTTON_CLASS);
this._renderType();
this.option("useInkRipple") && this._renderInkRipple();
this._renderClick();
this.setAria("role", "button");
this._updateAriaLabel();
this.callBase()
},
_renderInkRipple: function() {
var isOnlyIconButton = !this.option("text") && this.option("icon") || "back" === this.option("type"),
config = {};
if (isOnlyIconButton) {
$.extend(config, {
waveSizeCoefficient: 1,
useHoldAnimation: false,
isCentered: true
})
}
this._inkRipple = inkRipple.render(config)
},
_toggleActiveState: function($element, value, e) {
this.callBase.apply(this, arguments);
if (!this._inkRipple) {
return
}
var config = {
element: this._$content,
jQueryEvent: e
};
if (value) {
this._inkRipple.showWave(config)
} else {
this._inkRipple.hideWave(config)
}
},
_renderContentImpl: function() {
var $element = this.element(),
data = this._getContentData();
if (this._$content) {
this._$content.empty()
} else {
this._$content = $("
").addClass(BUTTON_CONTENT_CLASS).appendTo($element)
}
$element.toggleClass(BUTTON_HAS_ICON_CLASS, !!data.icon).toggleClass(BUTTON_HAS_TEXT_CLASS, !!data.text);
var template = this._getTemplateByOption("template"),
$result = template.render({
model: data,
container: this._$content
});
if ($result.hasClass(TEMPLATE_WRAPPER_CLASS)) {
this._$content.replaceWith($result);
this._$content = $result;
this._$content.addClass(BUTTON_CONTENT_CLASS)
}
},
_getContentData: function() {
var icon = this.option("icon"),
text = this.option("text"),
back = "back" === this.option("type");
if (back && !icon) {
icon = "back"
}
return {
icon: icon,
text: text
}
},
_renderClick: function() {
var that = this,
eventName = eventUtils.addNamespace(clickEvent.name, this.NAME);
this._clickAction = this._createActionByOption("onClick");
this.element().off(eventName).on(eventName, function(e) {
that._executeClickAction(e)
})
},
_executeClickAction: function(e) {
this._clickAction({
jQueryEvent: e,
validationGroup: ValidationEngine.getGroupConfig(this._findGroup())
})
},
_updateAriaLabel: function() {
var icon = this.option("icon"),
text = this.option("text");
if ("image" === iconUtils.getImageSourceType(icon)) {
if (icon.indexOf("base64") === -1) {
icon = icon.replace(/.+\/([^\.]+)\..+$/, "$1")
} else {
icon = "Base64"
}
}
var ariaLabel = text || icon;
this.setAria("label", $.trim(ariaLabel))
},
_renderType: function() {
var type = this.option("type");
if (type) {
this.element().addClass("dx-button-" + type)
}
},
_refreshType: function(prevType) {
var type = this.option("type");
prevType && this.element().removeClass("dx-button-" + prevType).addClass("dx-button-" + type);
if (!this.element().hasClass(BUTTON_HAS_ICON_CLASS) && "back" === type) {
this._renderContentImpl()
}
},
_optionChanged: function(args) {
switch (args.name) {
case "onClick":
this._renderClick();
break;
case "icon":
case "text":
this._renderContentImpl();
this._updateAriaLabel();
break;
case "type":
this._refreshType(args.previousValue);
this._renderContentImpl();
this._updateAriaLabel();
break;
case "template":
this._renderContentImpl();
break;
case "useInkRipple":
this._invalidate();
break;
default:
this.callBase(args)
}
},
_clean: function() {
this.callBase();
delete this._$content
}
}).include(ValidationMixin);
registerComponent("dxButton", Button);
module.exports = Button
},
/*!***********************************************!*\
!*** ./Scripts/ui/widget/utils.ink_ripple.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9);
var INKRIPPLE_CLASS = "dx-inkripple",
INKRIPPLE_WAVE_CLASS = "dx-inkripple-wave",
INKRIPPLE_SHOWING_CLASS = "dx-inkripple-showing",
INKRIPPLE_HIDING_CLASS = "dx-inkripple-hiding";
var DEFAULT_WAVE_SIZE_COEFFICIENT = 2,
MAX_WAVE_SIZE = 4e3,
ANIMATION_DURATION = 300,
HOLD_ANIMATION_DURATION = 1e3,
DEFAULT_WAVE_INDEX = 0;
var render = function(args) {
args = args || {};
if (void 0 === args.useHoldAnimation) {
args.useHoldAnimation = true
}
var config = {
waveSizeCoefficient: args.waveSizeCoefficient || DEFAULT_WAVE_SIZE_COEFFICIENT,
isCentered: args.isCentered || false,
wavesNumber: args.wavesNumber || 1,
durations: getDurations(args.useHoldAnimation)
};
return {
showWave: $.proxy(showWave, null, config),
hideWave: $.proxy(hideWave, null, config)
}
};
var getInkRipple = function(element) {
var result = element.children("." + INKRIPPLE_CLASS);
if (0 === result.length) {
result = $("
").addClass(INKRIPPLE_CLASS).appendTo(element)
}
return result
};
var getWaves = function(element, wavesNumber) {
var inkRipple = getInkRipple(element),
result = inkRipple.children("." + INKRIPPLE_WAVE_CLASS);
for (var i = result.length; i < wavesNumber; i++) {
var $currentWave = $("
").appendTo(inkRipple).addClass(INKRIPPLE_WAVE_CLASS);
result.push($currentWave[0])
}
return result
};
var getWaveStyleConfig = function(args, config) {
var left, top, element = config.element,
elementWidth = element.width(),
elementHeight = element.height(),
elementDiagonal = parseInt(Math.sqrt(elementWidth * elementWidth + elementHeight * elementHeight)),
waveSize = Math.min(MAX_WAVE_SIZE, parseInt(elementDiagonal * args.waveSizeCoefficient));
if (args.isCentered) {
left = (elementWidth - waveSize) / 2;
top = (elementHeight - waveSize) / 2
} else {
var event = config.jQueryEvent,
position = config.element.offset(),
x = event.pageX - position.left,
y = event.pageY - position.top;
left = x - waveSize / 2;
top = y - waveSize / 2
}
return {
left: left,
top: top,
height: waveSize,
width: waveSize
}
};
var showWave = function(args, config) {
var $wave = getWaves(config.element, args.wavesNumber).eq(config.wave || DEFAULT_WAVE_INDEX);
args.hidingTimeout && clearTimeout(args.hidingTimeout);
hideSelectedWave($wave);
$wave.css(getWaveStyleConfig(args, config));
setTimeout($.proxy(showingWaveHandler, null, args, $wave), 0)
};
var showingWaveHandler = function(args, $wave) {
var durationCss = args.durations.showingScale + "ms";
$wave.addClass(INKRIPPLE_SHOWING_CLASS).css("transition-duration", durationCss)
};
var getDurations = function(useHoldAnimation) {
return {
showingScale: useHoldAnimation ? HOLD_ANIMATION_DURATION : ANIMATION_DURATION,
hidingScale: ANIMATION_DURATION,
hidingOpacity: ANIMATION_DURATION
}
};
var hideSelectedWave = function($wave) {
$wave.removeClass(INKRIPPLE_HIDING_CLASS).css("transition-duration", "")
};
var hideWave = function(args, config) {
var $wave = getWaves(config.element, config.wavesNumber).eq(config.wave || DEFAULT_WAVE_INDEX),
durations = args.durations,
durationCss = durations.hidingScale + "ms, " + durations.hidingOpacity + "ms";
$wave.addClass(INKRIPPLE_HIDING_CLASS).removeClass(INKRIPPLE_SHOWING_CLASS).css("transition-duration", durationCss);
var animationDuration = Math.max(durations.hidingScale, durations.hidingOpacity);
args.hidingTimeout = setTimeout($.proxy(hideSelectedWave, null, $wave), animationDuration)
};
module.exports = {
render: render
}
},
/*!***********************************************!*\
!*** ./Scripts/ui/toolbar/ui.toolbar.base.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 43),
CollectionWidget = __webpack_require__( /*! ../collection/ui.collection_widget.edit */ 151);
var TOOLBAR_CLASS = "dx-toolbar",
TOOLBAR_BOTTOM_CLASS = "dx-toolbar-bottom",
TOOLBAR_MINI_CLASS = "dx-toolbar-mini",
TOOLBAR_ITEM_CLASS = "dx-toolbar-item",
TOOLBAR_LABEL_CLASS = "dx-toolbar-label",
TOOLBAR_BUTTON_CLASS = "dx-toolbar-button",
TOOLBAR_ITEMS_CONTAINER_CLASS = "dx-toolbar-items-container",
TOOLBAR_GROUP_CLASS = "dx-toolbar-group",
TOOLBAR_LABEL_SELECTOR = "." + TOOLBAR_LABEL_CLASS,
TOOLBAR_ITEM_DATA_KEY = "dxToolbarItemDataKey";
var ToolbarBase = CollectionWidget.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
renderAs: "topToolbar"
})
},
_itemContainer: function() {
return this._$toolbarItemsContainer.find([".dx-toolbar-before", ".dx-toolbar-center", ".dx-toolbar-after"].join(","))
},
_itemClass: function() {
return TOOLBAR_ITEM_CLASS
},
_itemDataKey: function() {
return TOOLBAR_ITEM_DATA_KEY
},
_buttonClass: function() {
return TOOLBAR_BUTTON_CLASS
},
_dimensionChanged: function() {
this._arrangeItems()
},
_render: function() {
this._renderToolbar();
this._renderSections();
this.setAria("role", "toolbar");
this.callBase();
this._arrangeItems()
},
_renderToolbar: function() {
this.element().addClass(TOOLBAR_CLASS).toggleClass(TOOLBAR_BOTTOM_CLASS, "bottomToolbar" === this.option("renderAs"));
this._$toolbarItemsContainer = $("
").addClass(TOOLBAR_ITEMS_CONTAINER_CLASS).appendTo(this.element())
},
_renderSections: function() {
var $container = this._$toolbarItemsContainer,
that = this;
$.each(["before", "center", "after"], function() {
var sectionClass = "dx-toolbar-" + this,
$section = $container.find("." + sectionClass);
if (!$section.length) {
that["_$" + this + "Section"] = $section = $("
").addClass(sectionClass).appendTo($container)
}
})
},
_arrangeItems: function(elementWidth) {
elementWidth = elementWidth || this.element().width();
this._$centerSection.css({
margin: "0 auto",
"float": "none"
});
var beforeRect = this._$beforeSection.get(0).getBoundingClientRect(),
centerRect = this._$centerSection.get(0).getBoundingClientRect(),
afterRect = this._$afterSection.get(0).getBoundingClientRect();
if (beforeRect.right > centerRect.left || centerRect.right > afterRect.left) {
this._$centerSection.css({
marginLeft: Math.round(beforeRect.width),
marginRight: Math.round(afterRect.width),
"float": beforeRect.width > afterRect.width ? "none" : "right"
})
}
var $label = this._$toolbarItemsContainer.find(TOOLBAR_LABEL_SELECTOR).eq(0),
$section = $label.parent();
if (!$label.length) {
return
}
var labelOffset = beforeRect.width ? Math.round(beforeRect.width) : $label.position().left,
widthBeforeSection = $section.hasClass("dx-toolbar-before") ? 0 : labelOffset,
widthAfterSection = $section.hasClass("dx-toolbar-after") ? 0 : Math.round(afterRect.width),
elemsAtSectionWidth = 0;
$section.children().not(TOOLBAR_LABEL_SELECTOR).each(function() {
elemsAtSectionWidth += $(this).outerWidth()
});
var freeSpace = elementWidth - elemsAtSectionWidth,
labelPaddings = $label.outerWidth() - $label.width(),
labelMaxWidth = Math.max(freeSpace - widthBeforeSection - widthAfterSection - labelPaddings, 0);
$label.css("max-width", labelMaxWidth)
},
_renderItem: function(index, item, itemContainer, $after) {
var location = item.location || "center",
container = itemContainer || this._$toolbarItemsContainer.find(".dx-toolbar-" + location),
itemHasText = Boolean(item.text),
itemElement = this.callBase(index, item, container, $after);
itemElement.toggleClass(this._buttonClass(), !itemHasText).toggleClass(TOOLBAR_LABEL_CLASS, itemHasText);
return itemElement
},
_renderGroupedItems: function() {
var that = this;
$.each(this.option("items"), function(groupIndex, group) {
var groupItems = group.items,
$container = $("
", {
"class": TOOLBAR_GROUP_CLASS
}),
location = group.location || "center";
if (!groupItems.length) {
return
}
$.each(groupItems, function(itemIndex, item) {
that._renderItem(itemIndex, item, $container, null)
});
that._$toolbarItemsContainer.find(".dx-toolbar-" + location).append($container)
})
},
_renderItems: function(items) {
var grouped = items.length && items[0].items;
grouped ? this._renderGroupedItems() : this.callBase(items)
},
_getToolbarItems: function() {
return this.option("items") || []
},
_renderContentImpl: function() {
var items = this._getToolbarItems();
this.element().toggleClass(TOOLBAR_MINI_CLASS, 0 === items.length);
if (this._renderedItemsCount) {
this._renderItems(items.slice(this._renderedItemsCount))
} else {
this._renderItems(items)
}
},
_renderEmptyMessage: $.noop,
_clean: function() {
this._$toolbarItemsContainer.children().empty();
this.element().empty()
},
_visibilityChanged: function(visible) {
if (visible) {
this._arrangeItems()
}
},
_isVisible: function() {
return this.element().width() > 0 && this.element().height() > 0
},
_getIndexByItem: function(item) {
return $.inArray(item, this._getToolbarItems())
},
_itemOptionChanged: function(item, property, value) {
this.callBase.apply(this, [item, property, value]);
this._arrangeItems()
},
_optionChanged: function(args) {
var name = args.name;
switch (name) {
case "width":
this.callBase.apply(this, arguments);
this._dimensionChanged();
break;
case "renderAs":
this._invalidate();
break;
default:
this.callBase.apply(this, arguments)
}
}
});
registerComponent("dxToolbarBase", ToolbarBase);
module.exports = ToolbarBase
},
/*!******************************!*\
!*** ./Scripts/ui/notify.js ***!
\******************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Action = __webpack_require__( /*! ../core/action */ 35),
viewPortUtils = __webpack_require__( /*! ../core/utils/view_port */ 42),
Toast = __webpack_require__( /*! ./toast */ 200);
var $notify = null;
var notify = function(message, type, displayTime) {
var options = $.isPlainObject(message) ? message : {
message: message
};
var userHiddenAction = options.onHidden;
$.extend(options, {
type: type,
displayTime: displayTime,
onHidden: function(args) {
args.element.remove();
new Action(userHiddenAction, {
context: args.model
}).execute(arguments)
}
});
$notify = $("
").appendTo(viewPortUtils.value());
new Toast($notify, options).show()
};
module.exports = notify
},
/*!*****************************!*\
!*** ./Scripts/ui/toast.js ***!
\*****************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
commonUtils = __webpack_require__( /*! ../core/utils/common */ 14),
pointerEvents = __webpack_require__( /*! ../events/pointer */ 65),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 43),
Overlay = __webpack_require__( /*! ./overlay */ 109);
var TOAST_CLASS = "dx-toast",
TOAST_CLASS_PREFIX = TOAST_CLASS + "-",
TOAST_WRAPPER_CLASS = TOAST_CLASS_PREFIX + "wrapper",
TOAST_CONTENT_CLASS = TOAST_CLASS_PREFIX + "content",
TOAST_MESSAGE_CLASS = TOAST_CLASS_PREFIX + "message",
TOAST_ICON_CLASS = TOAST_CLASS_PREFIX + "icon",
WIDGET_NAME = "dxToast",
toastTypes = ["info", "warning", "error", "success"],
TOAST_STACK = [],
FIRST_Z_INDEX_OFFSET = 8e3,
visibleToastInstance = null,
POSITION_ALIASES = {
top: {
my: "top",
at: "top",
of: null,
offset: "0 0"
},
bottom: {
my: "bottom",
at: "bottom",
of: null,
offset: "0 -20"
},
center: {
my: "center",
at: "center",
of: null,
offset: "0 0"
},
right: {
my: "center right",
at: "center right",
of: null,
offset: "0 0"
},
left: {
my: "center left",
at: "center left",
of: null,
offset: "0 0"
}
};
$(document).on(pointerEvents.down, function(e) {
for (var i = TOAST_STACK.length - 1; i >= 0; i--) {
if (!TOAST_STACK[i]._proxiedDocumentDownHandler(e)) {
return
}
}
});
var Toast = Overlay.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
message: "",
type: "info",
displayTime: 2e3,
position: "bottom center",
animation: {
show: {
type: "fade",
duration: 400,
from: 0,
to: 1
},
hide: {
type: "fade",
duration: 400,
to: 0
}
},
shading: false,
height: "auto",
closeOnBackButton: false,
closeOnSwipe: true,
closeOnClick: false,
resizeEnabled: false
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function(device) {
return "win" === device.platform && device.version && 8 === device.version[0]
},
options: {
position: "top center",
width: function() {
return $(window).width()
}
}
}, {
device: function(device) {
return "win" === device.platform && device.version && 10 === device.version[0]
},
options: {
position: "bottom right",
width: "auto"
}
}, {
device: {
platform: "android"
},
options: {
closeOnOutsideClick: true,
width: "auto",
position: {
at: "bottom left",
my: "bottom left",
offset: "20 -20"
},
animation: {
show: {
type: "slide",
duration: 200,
from: {
top: $(window).height()
}
},
hide: {
type: "slide",
duration: 200,
to: {
top: $(window).height()
}
}
}
}
}, {
device: function(device) {
var isPhone = "phone" === device.deviceType,
isAndroid = "android" === device.platform,
isWin10 = "win" === device.platform && device.version && 10 === device.version[0];
return isPhone && (isAndroid || isWin10)
},
options: {
width: function() {
return $(window).width()
},
position: {
at: "bottom center",
my: "bottom center",
offset: "0 0"
}
}
}])
},
_init: function() {
this.callBase();
this._posStringToObject()
},
_renderContentImpl: function() {
if (this.option("message")) {
this._message = $("
").addClass(TOAST_MESSAGE_CLASS).text(this.option("message")).appendTo(this.content())
}
this.setAria("role", "alert", this._message);
if ($.inArray(this.option("type").toLowerCase(), toastTypes) > -1) {
this.content().prepend($("
").addClass(TOAST_ICON_CLASS))
}
this.callBase()
},
_render: function() {
this.callBase();
this.element().addClass(TOAST_CLASS);
this._wrapper().addClass(TOAST_WRAPPER_CLASS);
this._$content.addClass(TOAST_CLASS_PREFIX + String(this.option("type")).toLowerCase());
this.content().addClass(TOAST_CONTENT_CLASS);
this._toggleCloseEvents("Swipe");
this._toggleCloseEvents("Click")
},
_toggleCloseEvents: function(event) {
var dxEvent = "dx" + event.toLowerCase();
this._$content.off(dxEvent);
this.option("closeOn" + event) && this._$content.on(dxEvent, $.proxy(this.hide, this))
},
_posStringToObject: function() {
if (!commonUtils.isString(this.option("position"))) {
return
}
var verticalPosition = this.option("position").split(" ")[0],
horizontalPosition = this.option("position").split(" ")[1];
this.option("position", $.extend({}, POSITION_ALIASES[verticalPosition]));
switch (horizontalPosition) {
case "center":
case "left":
case "right":
this.option("position").at += " " + horizontalPosition;
this.option("position").my += " " + horizontalPosition
}
},
_show: function() {
if (visibleToastInstance) {
clearTimeout(visibleToastInstance._hideTimeout);
visibleToastInstance.hide()
}
visibleToastInstance = this;
return this.callBase.apply(this, arguments).done($.proxy(function() {
clearTimeout(this._hideTimeout);
this._hideTimeout = setTimeout($.proxy(this.hide, this), this.option("displayTime"))
}, this))
},
_hide: function() {
visibleToastInstance = null;
return this.callBase.apply(this, arguments)
},
_overlayStack: function() {
return TOAST_STACK
},
_zIndexInitValue: function() {
return this.callBase() + FIRST_Z_INDEX_OFFSET
},
_dispose: function() {
clearTimeout(this._hideTimeout);
visibleToastInstance = null;
this.callBase()
},
_optionChanged: function(args) {
switch (args.name) {
case "type":
this._$content.removeClass(TOAST_CLASS_PREFIX + args.previousValue);
this._$content.addClass(TOAST_CLASS_PREFIX + String(args.value).toLowerCase());
break;
case "message":
if (this._message) {
this._message.text(args.value)
}
break;
case "closeOnSwipe":
this._toggleCloseEvents("Swipe");
break;
case "closeOnClick":
this._toggleCloseEvents("Click");
break;
case "displayTime":
case "position":
break;
default:
this.callBase(args)
}
}
});
registerComponent(WIDGET_NAME, Toast);
module.exports = Toast
},
/*!************************************!*\
!*** ./Scripts/ui/action_sheet.js ***!
\************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
messageLocalization = __webpack_require__( /*! ../localization/message */ 80),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 43),
Button = __webpack_require__( /*! ./button */ 196),
CollectionWidget = __webpack_require__( /*! ./collection/ui.collection_widget.edit */ 151),
Popup = __webpack_require__( /*! ./popup */ 195),
Popover = __webpack_require__( /*! ./popover */ 202);
var ACTION_SHEET_CLASS = "dx-actionsheet",
ACTION_SHEET_CONTAINER_CLASS = "dx-actionsheet-container",
ACTION_SHEET_POPUP_WRAPPER_CLASS = "dx-actionsheet-popup-wrapper",
ACTION_SHEET_POPOVER_WRAPPER_CLASS = "dx-actionsheet-popover-wrapper",
ACTION_SHEET_CANCEL_BUTTON_CLASS = "dx-actionsheet-cancel",
ACTION_SHEET_ITEM_CLASS = "dx-actionsheet-item",
ACTION_SHEET_ITEM_DATA_KEY = "dxActionSheetItemData",
ACTION_SHEET_WITHOUT_TITLE_CLASS = "dx-actionsheet-without-title";
var ActionSheet = CollectionWidget.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
usePopover: false,
target: null,
title: "",
showTitle: true,
showCancelButton: true,
cancelText: messageLocalization.format("Cancel"),
onCancelClick: null,
visible: false,
noDataText: "",
focusStateEnabled: false,
selectionByClick: false
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: {
platform: "ios",
tablet: true
},
options: {
usePopover: true
}
}])
},
_itemContainer: function() {
return this._$itemContainer
},
_itemClass: function() {
return ACTION_SHEET_ITEM_CLASS
},
_itemDataKey: function() {
return ACTION_SHEET_ITEM_DATA_KEY
},
_toggleVisibility: $.noop,
_renderDimensions: $.noop,
_render: function() {
this.element().addClass(ACTION_SHEET_CLASS);
this._createItemContainer();
this._renderPopup()
},
_createItemContainer: function() {
this._$itemContainer = $("
").addClass(ACTION_SHEET_CONTAINER_CLASS);
this._renderDisabled()
},
_renderDisabled: function() {
this._$itemContainer.toggleClass("dx-state-disabled", this.option("disabled"))
},
_renderPopup: function() {
this._$popup = $("
").appendTo(this.element());
this._isPopoverMode() ? this._createPopover() : this._createPopup();
this._renderPopupTitle();
this._mapPopupOption("visible")
},
_mapPopupOption: function(optionName) {
this._popup.option(optionName, this.option(optionName))
},
_isPopoverMode: function() {
return this.option("usePopover") && this.option("target")
},
_renderPopupTitle: function() {
this._mapPopupOption("showTitle");
this._popup._wrapper().toggleClass(ACTION_SHEET_WITHOUT_TITLE_CLASS, !this.option("showTitle"))
},
_clean: function() {
if (this._$popup) {
this._$popup.remove()
}
this.callBase()
},
_overlayConfig: function() {
return {
onInitialized: $.proxy(function(args) {
this._popup = args.component
}, this),
disabled: false,
showTitle: true,
title: this.option("title"),
deferRendering: !window.angular,
onContentReady: $.proxy(this._popupContentReadyAction, this),
onHidden: $.proxy(this.hide, this)
}
},
_createPopover: function() {
this._createComponent(this._$popup, Popover, $.extend(this._overlayConfig(), {
width: this.option("width") || 200,
height: this.option("height") || "auto",
target: this.option("target")
}));
this._popup._wrapper().addClass(ACTION_SHEET_POPOVER_WRAPPER_CLASS)
},
_createPopup: function() {
this._createComponent(this._$popup, Popup, $.extend(this._overlayConfig(), {
dragEnabled: false,
width: this.option("width") || "100%",
height: this.option("height") || "auto",
showCloseButton: false,
position: {
my: "bottom",
at: "bottom",
of: window
},
animation: {
show: {
type: "slide",
duration: 400,
from: {
position: {
my: "top",
at: "bottom",
of: window
}
},
to: {
position: {
my: "bottom",
at: "bottom",
of: window
}
}
},
hide: {
type: "slide",
duration: 400,
from: {
position: {
my: "bottom",
at: "bottom",
of: window
}
},
to: {
position: {
my: "top",
at: "bottom",
of: window
}
}
}
}
}));
this._popup._wrapper().addClass(ACTION_SHEET_POPUP_WRAPPER_CLASS)
},
_popupContentReadyAction: function() {
this._popup.content().append(this._$itemContainer);
this._attachClickEvent();
this._attachHoldEvent();
this._renderContent();
this._renderCancelButton()
},
_renderCancelButton: function() {
if (this._isPopoverMode()) {
return
}
if (this._$cancelButton) {
this._$cancelButton.remove()
}
if (this.option("showCancelButton")) {
var cancelClickAction = this._createActionByOption("onCancelClick") || $.noop,
that = this;
this._$cancelButton = $("
").addClass(ACTION_SHEET_CANCEL_BUTTON_CLASS).appendTo(this._popup.content());
this._createComponent(this._$cancelButton, Button, {
disabled: false,
text: this.option("cancelText"),
onClick: function(e) {
var hidingArgs = {
jQueryEvent: e,
cancel: false
};
cancelClickAction(hidingArgs);
if (!hidingArgs.cancel) {
that.hide()
}
},
_templates: {}
})
}
},
_attachItemClickEvent: $.noop,
_itemClickHandler: function(e) {
this.callBase(e);
if (!$(e.target).is(".dx-state-disabled, .dx-state-disabled *")) {
this.hide()
}
},
_itemHoldHandler: function(e) {
this.callBase(e);
if (!$(e.target).is(".dx-state-disabled, .dx-state-disabled *")) {
this.hide()
}
},
_optionChanged: function(args) {
switch (args.name) {
case "width":
case "height":
case "visible":
case "title":
this._mapPopupOption(args.name);
break;
case "disabled":
this._renderDisabled();
break;
case "showTitle":
this._renderPopupTitle();
break;
case "showCancelButton":
case "onCancelClick":
case "cancelText":
this._renderCancelButton();
break;
case "target":
case "usePopover":
case "items":
this._invalidate();
break;
default:
this.callBase(args)
}
},
toggle: function(showing) {
var that = this,
d = $.Deferred();
that._popup.toggle(showing).done(function() {
that.option("visible", showing);
d.resolveWith(that)
});
return d.promise()
},
show: function() {
return this.toggle(true)
},
hide: function() {
return this.toggle(false)
}
});
registerComponent("dxActionSheet", ActionSheet);
module.exports = ActionSheet
},
/*!*******************************!*\
!*** ./Scripts/ui/popover.js ***!
\*******************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 43),
stringUtils = __webpack_require__( /*! ../core/utils/string */ 13),
translator = __webpack_require__( /*! ../animation/translator */ 60),
positionUtils = __webpack_require__( /*! ../animation/position */ 61),
commonUtils = __webpack_require__( /*! ../core/utils/common */ 14),
mathUtils = __webpack_require__( /*! ../core/utils/math */ 79),
Popup = __webpack_require__( /*! ./popup */ 195);
var POPOVER_CLASS = "dx-popover",
POPOVER_WRAPPER_CLASS = "dx-popover-wrapper",
POPOVER_ARROW_CLASS = "dx-popover-arrow",
POPOVER_WITHOUT_TITLE_CLASS = "dx-popover-without-title",
POSITION_FLIP_MAP = {
left: "right",
top: "bottom",
right: "left",
bottom: "top",
center: "center"
},
WEIGHT_OF_SIDES = {
left: -1,
top: -1,
center: 0,
right: 1,
bottom: 1
},
POSITION_ALIASES = {
top: {
my: "bottom center",
at: "top center",
collision: "fit flip"
},
bottom: {
my: "top center",
at: "bottom center",
collision: "fit flip"
},
right: {
my: "left center",
at: "right center",
collision: "flip fit"
},
left: {
my: "right center",
at: "left center",
collision: "flip fit"
}
};
var Popover = Popup.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
target: window,
shading: false,
position: "bottom",
closeOnOutsideClick: true,
animation: {
show: {
type: "fade",
from: 0,
to: 1
},
hide: {
type: "fade",
to: 0
}
},
showTitle: false,
width: "auto",
height: "auto",
dragEnabled: false,
resizeEnabled: false,
fullScreen: false,
closeOnTargetScroll: true,
arrowPosition: "",
arrowOffset: 0,
boundaryOffset: {
h: 10,
v: 10
}
})
},
_defaultOptionsRules: function() {
return [{
device: {
platform: "ios"
},
options: {
arrowPosition: {
boundaryOffset: {
h: 20,
v: -10
},
collision: "fit"
}
}
}]
},
_init: function() {
this.callBase();
this._renderArrow();
this.element().addClass(POPOVER_CLASS);
this._wrapper().addClass(POPOVER_WRAPPER_CLASS)
},
_renderArrow: function() {
this._$arrow = $("
").addClass(POPOVER_ARROW_CLASS).prependTo(this.overlayContent())
},
_documentDownHandler: function(e) {
if (this._isOutsideClick(e)) {
return this.callBase(e)
}
},
_isOutsideClick: function(e) {
return !$(e.target).closest(this.option("target")).length
},
_animate: function(animation) {
if (animation && animation.to) {
$.extend(animation.to, {
position: this._getContainerPosition()
})
}
this.callBase.apply(this, arguments)
},
_stopAnimation: function() {
this.callBase.apply(this, arguments)
},
_renderTitle: function() {
this._wrapper().toggleClass(POPOVER_WITHOUT_TITLE_CLASS, !this.option("showTitle"));
this.callBase()
},
_renderPosition: function() {
this.callBase();
this._renderOverlayPosition()
},
_renderOverlayBoundaryOffset: $.noop,
_renderOverlayPosition: function() {
this._resetOverlayPosition();
this._updateContentSize();
var contentPosition = this._getContainerPosition();
var resultLocation = positionUtils.setup(this._$content, contentPosition);
var positionSide = this._getSideByLocation(resultLocation);
this._togglePositionClass("dx-position-" + positionSide);
this._toggleFlippedClass(resultLocation.h.flip, resultLocation.v.flip);
this._renderArrowPosition(positionSide)
},
_resetOverlayPosition: function() {
this._setContentHeight(true);
this._togglePositionClass("dx-position-" + this._positionSide);
translator.move(this._$content, {
left: 0,
top: 0
});
this._$arrow.css({
top: "auto",
right: "auto",
bottom: "auto",
left: "auto"
})
},
_updateContentSize: function() {
if (!this._$popupContent) {
return
}
var containerLocation = positionUtils.calculate(this._$content, this._getContainerPosition());
if (containerLocation.h.oversize > 0 && this._isHorizontalSide() && !containerLocation.h.fit) {
var newContainerWidth = this._$content.width() - containerLocation.h.oversize;
this._$content.width(newContainerWidth)
}
if (containerLocation.v.oversize > 0 && this._isVerticalSide() && !containerLocation.v.fit) {
var newOverlayContentHeight = this._$content.height() - containerLocation.v.oversize,
newPopupContentHeight = this._$popupContent.height() - containerLocation.v.oversize;
this._$content.height(newOverlayContentHeight);
this._$popupContent.height(newPopupContentHeight)
}
},
_getContainerPosition: function() {
var offset = stringUtils.pairToObject(this._position.offset || "");
var hOffset = offset.h;
var vOffset = offset.v;
var isPopoverInside = this._isPopoverInside();
var sign = (isPopoverInside ? -1 : 1) * WEIGHT_OF_SIDES[this._positionSide];
var arrowSizeCorrection = this._getContentBorderWidth(this._positionSide);
if (this._isVerticalSide()) {
vOffset += sign * (this._$arrow.height() - arrowSizeCorrection)
} else {
if (this._isHorizontalSide()) {
hOffset += sign * (this._$arrow.width() - arrowSizeCorrection)
}
}
return $.extend({}, this._position, {
offset: hOffset + " " + vOffset
})
},
_getContentBorderWidth: function(side) {
var borderWidth = this._$content.css("border-" + side + "-width");
return parseInt(borderWidth) || 0
},
_getSideByLocation: function(location) {
var isFlippedByVertical = location.v.flip;
var isFlippedByHorizontal = location.h.flip;
return this._isVerticalSide() && isFlippedByVertical || this._isHorizontalSide() && isFlippedByHorizontal || this._isPopoverInside() ? POSITION_FLIP_MAP[this._positionSide] : this._positionSide
},
_togglePositionClass: function(positionClass) {
this._$wrapper.removeClass("dx-position-left dx-position-right dx-position-top dx-position-bottom").addClass(positionClass)
},
_toggleFlippedClass: function(isFlippedHorizontal, isFlippedVertical) {
this._$wrapper.toggleClass("dx-popover-flipped-horizontal", isFlippedHorizontal).toggleClass("dx-popover-flipped-vertical", isFlippedVertical)
},
_renderArrowPosition: function(side) {
this._$arrow.css(POSITION_FLIP_MAP[side], -(this._isVerticalSide(side) ? this._$arrow.height() : this._$arrow.width()));
var axis = this._isVerticalSide(side) ? "left" : "top";
var sizeProperty = this._isVerticalSide(side) ? "outerWidth" : "outerHeight";
var $target = $(this._position.of);
var targetOffset = $target.offset() || {
top: 0,
left: 0
};
var contentOffset = this._$content.offset();
var arrowSize = this._$arrow[sizeProperty]();
var contentLocation = contentOffset[axis];
var contentSize = this._$content[sizeProperty]();
var targetLocation = targetOffset[axis];
var targetSize = $target.get(0).preventDefault ? 0 : $target[sizeProperty]();
var min = Math.max(contentLocation, targetLocation);
var max = Math.min(contentLocation + contentSize, targetLocation + targetSize);
var arrowLocation;
if ("start" === this.option("arrowPosition")) {
arrowLocation = min - contentLocation
} else {
if ("end" === this.option("arrowPosition")) {
arrowLocation = max - contentLocation - arrowSize
} else {
arrowLocation = (min + max) / 2 - contentLocation - arrowSize / 2
}
}
var borderWidth = this._getContentBorderWidth(side);
var finalArrowLocation = mathUtils.fitIntoRange(arrowLocation - borderWidth + this.option("arrowOffset"), borderWidth, contentSize - arrowSize - 2 * borderWidth);
this._$arrow.css(axis, finalArrowLocation)
},
_isPopoverInside: function() {
var position = this._getPosition();
var my = positionUtils.setup.normalizeAlign(position.my);
var at = positionUtils.setup.normalizeAlign(position.at);
return my.h === at.h && my.v === at.v
},
_getPosition: function() {
var position = this.option("position");
if (commonUtils.isString(position)) {
position = $.extend({}, POSITION_ALIASES[position])
}
return position
},
_setContentHeight: function(fullUpdate) {
if (fullUpdate) {
this.callBase()
}
},
_renderShadingPosition: function() {
if (this.option("shading")) {
this._$wrapper.css({
top: 0,
left: 0
})
}
},
_renderShadingDimensions: function() {
if (this.option("shading")) {
this._$wrapper.css({
width: "100%",
height: "100%"
})
}
},
_normalizePosition: function() {
var position = $.extend({}, this._getPosition());
if (!position.of) {
position.of = this.option("target")
}
if (!position.collision) {
position.collision = "flip"
}
if (!position.boundaryOffset) {
position.boundaryOffset = this.option("boundaryOffset")
}
this._positionSide = this._getDisplaySide(position);
this._position = position
},
_getDisplaySide: function(position) {
var my = positionUtils.setup.normalizeAlign(position.my),
at = positionUtils.setup.normalizeAlign(position.at);
var weightSign = WEIGHT_OF_SIDES[my.h] === WEIGHT_OF_SIDES[at.h] && WEIGHT_OF_SIDES[my.v] === WEIGHT_OF_SIDES[at.v] ? -1 : 1,
horizontalWeight = Math.abs(WEIGHT_OF_SIDES[my.h] - weightSign * WEIGHT_OF_SIDES[at.h]),
verticalWeight = Math.abs(WEIGHT_OF_SIDES[my.v] - weightSign * WEIGHT_OF_SIDES[at.v]);
return horizontalWeight > verticalWeight ? at.h : at.v
},
_isVerticalSide: function(side) {
side = side || this._positionSide;
return "top" === side || "bottom" === side
},
_isHorizontalSide: function(side) {
side = side || this._positionSide;
return "left" === side || "right" === side
},
_optionChanged: function(args) {
switch (args.name) {
case "showTitle":
case "title":
case "titleTemplate":
this.callBase(args);
this._renderGeometry();
break;
case "target":
case "boundaryOffset":
case "arrowPosition":
case "arrowOffset":
this._renderGeometry();
break;
case "fullScreen":
if (args.value) {
this.option("fullScreen", false)
}
break;
default:
this.callBase(args)
}
},
show: function(target) {
if (target) {
this.option("target", target)
}
return this.callBase()
}
});
registerComponent("dxPopover", Popover);
module.exports = Popover
},
/*!************************************!*\
!*** ./Scripts/ui/autocomplete.js ***!
\************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 43),
DropDownList = __webpack_require__( /*! ./drop_down_editor/ui.drop_down_list */ 204),
themes = __webpack_require__( /*! ./themes */ 143);
var AUTOCOMPLETE_CLASS = "dx-autocomplete",
AUTOCOMPLETE_POPUP_WRAPPER_CLASS = "dx-autocomplete-popup-wrapper";
var Autocomplete = DropDownList.inherit({
_supportedKeys: function() {
var item = this._list ? this._list.option("focusedElement") : null;
return $.extend(this.callBase(), {
upArrow: function(e) {
e.preventDefault();
e.stopPropagation();
if (item && !item.prev().length) {
this._clearFocusedItem();
return false
}
return true
},
downArrow: function(e) {
e.preventDefault();
e.stopPropagation();
if (item && !item.next().length) {
this._clearFocusedItem();
return false
}
return true
},
enter: function(e) {
if (!item) {
this.close()
}
return true
}
})
},
_setDeprecatedOptions: function() {
this.callBase();
$.extend(this._deprecatedOptions, {
displayExpr: {
since: "15.2",
alias: "valueExpr"
}
})
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
minSearchLength: 1,
maxItemCount: 10,
noDataText: "",
showDropButton: false,
searchEnabled: true
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function() {
return /android5/.test(themes.current())
},
options: {
popupPosition: {
offset: {
h: -16,
v: -8
}
}
}
}])
},
_render: function() {
this.callBase();
this.element().addClass(AUTOCOMPLETE_CLASS);
this.setAria("autocomplete", "inline")
},
_loadValue: function() {
return $.Deferred().resolve(this.option("value"))
},
_displayGetterExpr: function() {
return this.option("valueExpr")
},
_setSelectedItem: function(item) {
this.callBase(item);
this.option("displayValue", this.option("value"))
},
_popupConfig: function() {
return $.extend(this.callBase(), {
closeOnOutsideClick: $.proxy(function(e) {
return !$(e.target).closest(this.element()).length
}, this)
})
},
_renderDimensions: function() {
this.callBase();
this._setPopupOption("width")
},
_popupWrapperClass: function() {
return this.callBase() + " " + AUTOCOMPLETE_POPUP_WRAPPER_CLASS
},
_listConfig: function() {
return $.extend(this.callBase(), {
pageLoadMode: "none",
indicateLoading: false
})
},
_listItemClickHandler: function(e) {
var value = this._displayGetter(e.itemData);
this.option("value", value);
this.close()
},
_setListDataSource: function() {
if (!this._list) {
return
}
this._list.option("selectedItems", []);
this.callBase()
},
_refreshSelected: $.noop,
_searchCanceled: function() {
this.callBase();
this.close()
},
_dataSourceOptions: function() {
return {
paginate: true
}
},
_searchDataSource: function() {
this._dataSource.pageSize(this.option("maxItemCount"));
this.callBase();
this._clearFocusedItem()
},
_clearFocusedItem: function() {
if (this._list) {
this._list.option("focusedElement", null);
this._list.option("selectedIndex", -1)
}
},
_renderValueEventName: function() {
return "input keyup"
},
_searchHandler: function(e) {
if (this._isControlKey(e.which || e.keyCode)) {
return
}
this.callBase(e)
},
_optionChanged: function(args) {
if ("maxItemCount" === args.name) {
this._searchDataSource()
} else {
this.callBase(args)
}
}
});
registerComponent("dxAutocomplete", Autocomplete);
module.exports = Autocomplete
},
/*!**********************************************************!*\
!*** ./Scripts/ui/drop_down_editor/ui.drop_down_list.js ***!
\**********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Guid = __webpack_require__( /*! ../../core/guid */ 153),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 43),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
DropDownEditor = __webpack_require__( /*! ./ui.drop_down_editor */ 205),
List = __webpack_require__( /*! ../list */ 213),
errors = __webpack_require__( /*! ../widget/ui.errors */ 10),
eventUtils = __webpack_require__( /*! ../../events/utils */ 62),
devices = __webpack_require__( /*! ../../core/devices */ 40),
DataExpressionMixin = __webpack_require__( /*! ../editor/ui.data_expression */ 244),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 80),
themes = __webpack_require__( /*! ../themes */ 143);
var LIST_ITEM_SELECTOR = ".dx-list-item",
LIST_ITEM_DATA_KEY = "dxListItemData",
DROPDOWNLIST_POPUP_WRAPPER_CLASS = "dx-dropdownlist-popup-wrapper",
SKIP_GESTURE_EVENT_CLASS = "dx-skip-gesture-event",
SEARCH_MODES = ["startswith", "contains", "endwith", "notcontains"];
var DropDownList = DropDownEditor.inherit({
_supportedKeys: function() {
var parent = this.callBase();
return $.extend({}, parent, {
tab: function(e) {
if (this.option("opened") && "instantly" === this.option("applyValueMode")) {
var $focusedItem = this._list.option("focusedElement");
$focusedItem && this._setSelectedElement($focusedItem)
} else {
this._focusTarget().focusout()
}
parent.tab.apply(this, arguments)
},
space: $.noop,
home: $.noop,
end: $.noop
})
},
_setSelectedElement: function($element) {
this._list.selectItem($element);
var selectedItems = this._list.option("selectedItems");
var value = this._valueGetter(selectedItems[selectedItems.length - 1]);
this._setValue(value)
},
_setValue: function(value) {
this.option("value", value)
},
_setDeprecatedOptions: function() {
this.callBase();
$.extend(this._deprecatedOptions, {
pagingEnabled: {
since: "15.1",
message: "Use the 'dataSource.paginate' option instead"
}
})
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), $.extend(DataExpressionMixin._dataExpressionDefaultOptions(), {
displayValue: void 0,
searchEnabled: false,
searchMode: "contains",
searchTimeout: 500,
minSearchLength: 0,
searchExpr: null,
valueChangeEvent: "input change keyup",
selectedItem: null,
pagingEnabled: void 0,
noDataText: messageLocalization.format("dxCollectionWidget-noDataText"),
onSelectionChanged: null,
onItemClick: $.noop,
showDataBeforeSearch: false,
popupPosition: {
my: "left top",
at: "left bottom",
offset: {
h: 0,
v: 0
},
collision: "flip"
},
popupWidthExtension: 0
}))
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function(device) {
return "win" === device.platform && device.version && 8 === device.version[0]
},
options: {
popupPosition: {
offset: {
v: -6
}
}
}
}, {
device: function() {
return /android5/.test(themes.current())
},
options: {
popupWidthExtension: 32
}
}, {
device: {
platform: "ios"
},
options: {
popupPosition: {
offset: {
v: -1
}
}
}
}, {
device: {
platform: "generic"
},
options: {
buttonsLocation: "bottom center"
}
}])
},
_setOptionsByReference: function() {
this.callBase();
$.extend(this._optionsByReference, {
value: true,
selectedItem: true,
displayValue: true
})
},
_init: function() {
this.callBase();
this._initDataExpressions();
this._initActions();
this._setListDataSource();
this._validateSearchMode();
this._clearSelectedItem()
},
_initActions: function() {
this._initContentReadyAction();
this._initSelectionChangedAction();
this._initItemClickAction()
},
_initContentReadyAction: function() {
this._contentReadyAction = this._createActionByOption("onContentReady", {
excludeValidators: ["disabled", "readOnly"]
})
},
_initSelectionChangedAction: function() {
this._selectionChangedAction = this._createActionByOption("onSelectionChanged", {
excludeValidators: ["disabled", "readOnly"]
})
},
_initItemClickAction: function() {
this._itemClickAction = this._createActionByOption("onItemClick")
},
_renderField: function() {
this.callBase();
this._input().on("input", $.proxy(this._setFocusPolicy, this))
},
_preventFocusOnPopup: function(e) {
if (this._list && this._list.initialOption("focusStateEnabled")) {
e.preventDefault()
}
},
_createPopup: function() {
this.callBase();
this._popup._wrapper().addClass(this._popupWrapperClass());
this._popup.content().off("mousedown").on("mousedown", $.proxy(this._preventFocusOnPopup, this))
},
_popupWrapperClass: function() {
return DROPDOWNLIST_POPUP_WRAPPER_CLASS
},
_renderInputValue: function() {
var callBase = $.proxy(this.callBase, this),
value = this._getCurrentValue();
return this._loadItem(value).always($.proxy(function(item) {
this._setSelectedItem(item);
callBase(value)
}, this))
},
_loadItem: function(value) {
var selectedItem = $.grep(this.option("items") || [], $.proxy(function(item) {
return this._isValueEquals(this._valueGetter(item), value)
}, this))[0];
return void 0 !== selectedItem ? $.Deferred().resolve(selectedItem).promise() : this._loadValue(value)
},
_setSelectedItem: function(item) {
var displayValue = this._displayValue(item);
this.option("selectedItem", commonUtils.ensureDefined(item, null));
this.option("displayValue", displayValue)
},
_displayValue: function(item) {
return this._displayGetter(item)
},
_refreshSelected: function() {
this._listItemElements().each($.proxy(function(_, itemElement) {
var $itemElement = $(itemElement);
var itemValue = this._valueGetter($itemElement.data(LIST_ITEM_DATA_KEY));
var isItemSelected = this._isSelectedValue(itemValue);
if (isItemSelected) {
this._list.selectItem($itemElement)
} else {
this._list.unselectItem($itemElement)
}
}, this))
},
_popupShownHandler: function() {
this.callBase();
this._setFocusPolicy()
},
_setFocusPolicy: function() {
if (!this.option("focusStateEnabled") || !this._list) {
return
}
this._list.option("focusedElement", null)
},
_isSelectedValue: function(value) {
return this._isValueEquals(value, this.option("value"))
},
_validateSearchMode: function() {
var searchMode = this.option("searchMode"),
normalizedSearchMode = searchMode.toLowerCase();
if ($.inArray(normalizedSearchMode, SEARCH_MODES) < 0) {
throw errors.Error("E1019", searchMode)
}
},
_clearSelectedItem: function() {
this.option("selectedItem", null)
},
_processDataSourceChanging: function() {
this._setListDataSource();
this._renderInputValue().fail($.proxy(function() {
if (this._isCustomValueAllowed()) {
return
}
this._clearSelectedItem()
}, this))
},
_isCustomValueAllowed: function() {
return this.option("displayCustomValue")
},
reset: function() {
this.callBase();
this._clearFilter();
this._clearSelectedItem()
},
_listItemElements: function() {
return this._$list ? this._$list.find(LIST_ITEM_SELECTOR) : $()
},
_popupConfig: function() {
var that = this;
return $.extend(this.callBase(), {
width: this.option("width"),
onShowing: function() {
that.element().addClass(SKIP_GESTURE_EVENT_CLASS)
},
onHidden: function() {
that.element().removeClass(SKIP_GESTURE_EVENT_CLASS)
},
height: "auto",
maxHeight: $.proxy(this._getMaxHeight, this)
})
},
_renderPopupContent: function() {
this._renderList()
},
_attachChildKeyboardEvents: function() {
this._childKeyboardProcessor = this._keyboardProcessor.attachChildProcessor();
this._setListOption("_keyboardProcessor", this._childKeyboardProcessor)
},
_fireContentReadyAction: $.noop,
_setAriaTargetForList: function() {
this._list._getAriaTarget = $.proxy(this._getAriaTarget, this);
this._list.setAria("role", "combobox")
},
_renderList: function() {
this._listId = (new Guid)._value;
var $list = this._$list = $("
", {
id: this._listId
}).appendTo(this._popup.content());
this._list = this._createComponent($list, List, this._listConfig());
this._refreshList();
this._setAriaTargetForList()
},
_renderOpenedState: function() {
this.callBase();
var opened = this.option("opened") || void 0;
this.setAria({
activedescendant: opened && this._list.getFocusedItemId(),
owns: opened && this._listId
})
},
_refreshList: function() {
if (this._list && this._shouldRefreshDataSource()) {
this._setListDataSource()
}
},
_shouldRefreshDataSource: function() {
var dataSourceProvided = !!this._list.option("dataSource");
return dataSourceProvided !== this._needPassDataSourceToList()
},
_isDesktopDevice: function() {
return "desktop" === devices.real().deviceType
},
_listConfig: function() {
return {
selectionMode: "single",
_templates: this.option("_templates"),
templateProvider: this.option("templateProvider"),
noDataText: this.option("noDataText"),
onContentReady: $.proxy(this._listContentReadyHandler, this),
itemTemplate: this._getTemplateByOption("itemTemplate"),
indicateLoading: false,
tabIndex: -1,
onItemClick: $.proxy(this._listItemClickAction, this),
dataSource: this._getDataSource(),
_keyboardProcessor: this._childKeyboardProcessor,
hoverStateEnabled: this._isDesktopDevice() ? this.option("hoverStateEnabled") : false,
focusStateEnabled: this._isDesktopDevice() ? this.option("focusStateEnabled") : false,
selectedItem: this.option("selectedItem")
}
},
_getDataSource: function() {
return this._needPassDataSourceToList() ? this._dataSource : null
},
_dataSourceOptions: function() {
this._suppressDeprecatedWarnings();
var pagingEnabled = this.option("pagingEnabled");
this._resumeDeprecatedWarnings();
return {
paginate: commonUtils.ensureDefined(pagingEnabled, false)
}
},
_listContentReadyHandler: function() {
this._list = this._list || this._$list.dxList("instance");
this.option().items = this._list.option("items");
this._dimensionChanged();
this._contentReadyAction()
},
_setListOption: function(optionName, value) {
this._setWidgetOption("_list", arguments)
},
_listItemClickAction: function(e) {
this._listItemClickHandler(e);
this._itemClickAction(e)
},
_listItemClickHandler: $.noop,
_setListDataSource: function() {
if (!this._list) {
return
}
this._setListOption("dataSource", this._getDataSource());
if (!this._needPassDataSourceToList()) {
this._setListOption("items", [])
}
},
_needPassDataSourceToList: function() {
return this.option("showDataBeforeSearch") || this._isMinSearchLengthExceeded()
},
_isMinSearchLengthExceeded: function() {
return this._searchValue().toString().length >= this.option("minSearchLength")
},
_searchValue: function() {
return this._input().val() || ""
},
_getSearchEvent: function() {
return eventUtils.addNamespace("keyup", this.NAME + "Search")
},
_renderEvents: function() {
this.callBase();
if (this._shouldRenderSearchEvent()) {
this._input().on(this._getSearchEvent(), $.proxy(this._searchHandler, this))
}
},
_shouldRenderSearchEvent: function() {
return this.option("searchEnabled")
},
_refreshEvents: function() {
this._input().off(this._getSearchEvent());
this.callBase()
},
_searchHandler: function(e) {
if (!this._isMinSearchLengthExceeded()) {
this._searchCanceled();
return
}
var searchTimeout = this.option("searchTimeout");
if (searchTimeout) {
if (!this._searchTimer) {
this._searchTimer = setTimeout($.proxy(this._searchDataSource, this), searchTimeout)
}
} else {
this._searchDataSource()
}
},
_searchCanceled: function() {
this._clearSearchTimer();
if (this._needPassDataSourceToList()) {
this._filterDataSource(null)
}
this._refreshList()
},
_searchDataSource: function() {
this._clearSearchTimer();
this._filterDataSource(this._searchValue())
},
_filterDataSource: function(searchValue) {
var dataSource = this._dataSource;
dataSource.searchExpr(this.option("searchExpr") || this._displayGetterExpr());
dataSource.searchOperation(this.option("searchMode"));
dataSource.searchValue(searchValue);
return dataSource.load().done($.proxy(this._dataSourceFiltered, this, searchValue))
},
_clearFilter: function() {
var dataSource = this._dataSource;
dataSource && dataSource.searchValue() && dataSource.searchValue(null)
},
_dataSourceFiltered: function() {
this._refreshList();
this._refreshPopupVisibility()
},
_refreshPopupVisibility: function() {
if (this.option("readOnly")) {
return
}
this.option("opened", this._hasItemsToShow());
if (this.option("opened")) {
this._dimensionChanged()
}
},
_hasItemsToShow: function() {
var resultItems = this._dataSource && this._dataSource.items() || [];
var resultAmount = resultItems.length;
var isMinSearchLengthExceeded = this._needPassDataSourceToList();
return isMinSearchLengthExceeded && resultAmount && this._hasFocusClass()
},
_clearSearchTimer: function() {
clearTimeout(this._searchTimer);
delete this._searchTimer
},
_popupShowingHandler: function() {
this._dimensionChanged()
},
_dimensionChanged: function() {
this._popup && this._updatePopupDimensions()
},
_updatePopupDimensions: function() {
this._updatePopupWidth();
this._updatePopupHeight()
},
_updatePopupWidth: function() {
this._setPopupOption("width", this.element().outerWidth() + this.option("popupWidthExtension"))
},
_updatePopupHeight: function() {
this._popup.repaint();
this._list && this._list.updateDimensions()
},
_getMaxHeight: function() {
var $element = this.element(),
offset = $element.offset(),
windowHeight = $(window).height(),
maxHeight = Math.max(offset.top, windowHeight - offset.top - $element.outerHeight());
return Math.min(.5 * windowHeight, maxHeight)
},
_clean: function() {
if (this._list) {
delete this._list
}
this.callBase()
},
_dispose: function() {
this._clearSearchTimer();
this.callBase()
},
_setCollectionWidgetOption: function() {
this._setListOption.apply(this, arguments)
},
_optionChanged: function(args) {
this._dataExpressionOptionChanged(args);
switch (args.name) {
case "hoverStateEnabled":
case "focusStateEnabled":
this._isDesktopDevice() && this._setListOption(args.name, args.value);
this.callBase(args);
break;
case "items":
if (!this.option("dataSource")) {
this._processDataSourceChanging()
}
break;
case "dataSource":
this._processDataSourceChanging();
break;
case "valueExpr":
case "displayExpr":
this._renderValue();
break;
case "searchMode":
this._validateSearchMode();
break;
case "minSearchLength":
this._refreshList();
break;
case "searchEnabled":
case "showDataBeforeSearch":
case "searchExpr":
case "pagingEnabled":
this._invalidate();
break;
case "onContentReady":
this._initContentReadyAction();
break;
case "onSelectionChanged":
this._initSelectionChangedAction();
break;
case "onItemClick":
this._initItemClickAction();
break;
case "noDataText":
this._setListOption("noDataText");
break;
case "displayValue":
this.option("text", args.value);
break;
case "itemTemplate":
case "searchTimeout":
case "popupWidthExtension":
break;
case "selectedItem":
this._selectionChangedAction({
selectedItem: args.value
});
break;
default:
this.callBase(args)
}
}
}).include(DataExpressionMixin);
registerComponent("dxDropDownList", DropDownList);
module.exports = DropDownList
},
/*!************************************************************!*\
!*** ./Scripts/ui/drop_down_editor/ui.drop_down_editor.js ***!
\************************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Guid = __webpack_require__( /*! ../../core/guid */ 153),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 43),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
errors = __webpack_require__( /*! ../widget/ui.errors */ 10),
positionUtils = __webpack_require__( /*! ../../animation/position */ 61),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 80),
devices = __webpack_require__( /*! ../../core/devices */ 40),
Button = __webpack_require__( /*! ../button */ 196),
eventUtils = __webpack_require__( /*! ../../events/utils */ 62),
TextBox = __webpack_require__( /*! ../text_box */ 206),
clickEvent = __webpack_require__( /*! ../../events/click */ 64),
Popup = __webpack_require__( /*! ../popup */ 195);
var DROP_DOWN_EDITOR_CLASS = "dx-dropdowneditor",
DROP_DOWN_EDITOR_INPUT_WRAPPER_CLASS = "dx-dropdowneditor-input-wrapper",
DROP_DOWN_EDITOR_BUTTON_CLASS = "dx-dropdowneditor-button",
DROP_DOWN_EDITOR_BUTTON_ICON = "dx-dropdowneditor-icon",
DROP_DOWN_EDITOR_OVERLAY = "dx-dropdowneditor-overlay",
DROP_DOWN_EDITOR_OVERLAY_FLIPPED = "dx-dropdowneditor-overlay-flipped",
DROP_DOWN_EDITOR_ACTIVE = "dx-dropdowneditor-active",
DROP_DOWN_EDITOR_BUTTON_VISIBLE = "dx-dropdowneditor-button-visible",
DROP_DOWN_EDITOR_FIELD_CLICKABLE = "dx-dropdowneditor-field-clickable";
var DropDownEditor = TextBox.inherit({
_supportedKeys: function() {
return $.extend({}, this.callBase(), {
tab: function(e) {
if (!this.option("opened")) {
return
}
if ("instantly" === this.option("applyValueMode")) {
this.close();
return
}
var $focusableElement = e.shiftKey ? this._getLastPopupElement() : this._getFirstPopupElement();
$focusableElement && $focusableElement.focus();
e.preventDefault()
},
escape: function(e) {
if (this.option("opened")) {
e.preventDefault()
}
this.close()
},
upArrow: function(e) {
e.preventDefault();
e.stopPropagation();
if (e.altKey) {
this.close();
return false
}
return true
},
downArrow: function(e) {
e.preventDefault();
e.stopPropagation();
if (e.altKey) {
this._validatedOpening();
return false
}
return true
},
enter: function(e) {
if (this.option("opened")) {
e.preventDefault();
this._valueChangeEventHandler(e)
}
return true
}
})
},
_setDeprecatedOptions: function() {
this.callBase();
$.extend(this._deprecatedOptions, {
fieldEditEnabled: {
since: "16.1",
alias: "acceptCustomValue"
}
})
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
value: null,
onOpened: null,
onClosed: null,
opened: false,
acceptCustomValue: true,
applyValueMode: "instantly",
deferRendering: true,
activeStateEnabled: true,
fieldTemplate: null,
contentTemplate: null,
openOnFieldClick: false,
showDropButton: true,
popupPosition: this._getDefaultPopupPosition(),
onPopupInitialized: null,
applyButtonText: messageLocalization.format("OK"),
cancelButtonText: messageLocalization.format("Cancel"),
buttonsLocation: "default",
showPopupTitle: false
})
},
_getDefaultPopupPosition: function() {
var position = commonUtils.getDefaultAlignment(this.option("rtlEnabled"));
return {
offset: {
h: 0,
v: -1
},
my: position + " top",
at: position + " bottom",
collision: "flip flip"
}
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function(device) {
var isGeneric = "generic" === device.platform,
isWin10 = "win" === device.platform && device.version && 10 === device.version[0];
return isGeneric || isWin10
},
options: {
popupPosition: {
offset: {
v: 0
}
}
}
}])
},
_inputWrapper: function() {
return this.element().find("." + DROP_DOWN_EDITOR_INPUT_WRAPPER_CLASS)
},
_init: function() {
this.callBase();
this._initVisibilityActions();
this._initPopupInitializedAction()
},
_initVisibilityActions: function() {
this._openAction = this._createActionByOption("onOpened", {
excludeValidators: ["disabled", "readOnly"]
});
this._closeAction = this._createActionByOption("onClosed", {
excludeValidators: ["disabled", "readOnly"]
})
},
_initPopupInitializedAction: function() {
this._popupInitializedAction = this._createActionByOption("onPopupInitialized", {
excludeValidators: ["disabled", "readOnly", "designMode"]
})
},
_render: function() {
this.callBase();
this._renderOpenHandler();
this.element().addClass(DROP_DOWN_EDITOR_CLASS);
this._renderOpenedState();
this.setAria("role", "combobox")
},
_renderContentImpl: function() {
if (!this.option("deferRendering")) {
this._createPopup()
}
},
_renderInput: function() {
this.callBase();
this.element().wrapInner($("
").addClass(DROP_DOWN_EDITOR_INPUT_WRAPPER_CLASS));
this._$container = this.element().children().eq(0);
this.setAria({
haspopup: "true",
autocomplete: "list"
})
},
_readOnlyPropValue: function() {
return !this.option("acceptCustomValue") || this.callBase()
},
_cleanFocusState: function() {
this.callBase();
if (this.option("fieldTemplate")) {
this._input().off("focusin focusout beforeactivate")
}
},
_renderField: function() {
var fieldTemplate = this._getTemplateByOption("fieldTemplate");
if (!(fieldTemplate && this.option("fieldTemplate"))) {
return
}
this._renderTemplatedField(fieldTemplate, this._fieldRenderData())
},
_renderTemplatedField: function(fieldTemplate, data) {
var isFocused = this._input().is(":focus");
this._resetFocus(isFocused);
var $container = this._$container;
$container.empty();
this._$dropButton = null;
this._$clearButton = null;
fieldTemplate.render({
model: data,
container: $container
});
if (!this._input().length) {
throw errors.Error("E1010")
}
this._refreshEvents();
this._refreshValueChangeEvent();
isFocused && this._input().focus();
this._renderFocusState()
},
_resetFocus: function(isFocused) {
this._cleanFocusState();
isFocused && this._input().focusout()
},
_fieldRenderData: function() {
return this.option("value")
},
_renderInputAddons: function() {
this._renderField();
this.callBase();
this._renderDropButton()
},
_renderDropButton: function() {
var dropButtonVisible = this.option("showDropButton");
this.element().toggleClass(DROP_DOWN_EDITOR_BUTTON_VISIBLE, dropButtonVisible);
if (!dropButtonVisible) {
this._$dropButton && this._$dropButton.remove();
this._$dropButton = null;
return
}
if (!this._$dropButton) {
this._$dropButton = this._createDropButton().addClass(DROP_DOWN_EDITOR_BUTTON_CLASS)
}
this._$dropButton.prependTo(this._buttonsContainer())
},
_createDropButton: function() {
var $button = $("
");
this._createComponent($button, Button, {
focusStateEnabled: false,
disabled: this.option("readOnly"),
_templates: {},
useInkRipple: false
});
var $buttonIcon = $("
").addClass(DROP_DOWN_EDITOR_BUTTON_ICON);
$button.append($buttonIcon).removeClass("dx-button").on("mousedown", function(e) {
e.preventDefault()
});
$button.find(".dx-button-content").remove();
return $button
},
_renderOpenHandler: function() {
var $inputWrapper = this.element().find("." + DROP_DOWN_EDITOR_INPUT_WRAPPER_CLASS);
var eventName = eventUtils.addNamespace(clickEvent.name, this.NAME);
$inputWrapper.off(eventName);
var openOnFieldClick = this.option("openOnFieldClick");
this.element().toggleClass(DROP_DOWN_EDITOR_FIELD_CLICKABLE, openOnFieldClick);
if (openOnFieldClick) {
$inputWrapper.on(eventName, $.proxy(this._openHandler, this));
return
}
if (this.option("showDropButton")) {
this._$dropButton.dxButton("option", "onClick", $.proxy(this._openHandler, this))
}
},
_openHandler: function() {
this._toggleOpenState()
},
_keyboardEventBindingTarget: function() {
return this._input()
},
_toggleOpenState: function(isVisible) {
if (this.option("disabled")) {
return
}
if (this._needFocusOnButtonClick()) {
this._input().focus()
}
if (!this.option("readOnly")) {
isVisible = arguments.length ? isVisible : !this.option("opened");
this.option("opened", isVisible)
}
},
_needFocusOnButtonClick: function() {
return "desktop" === devices.real().deviceType
},
_renderOpenedState: function() {
var opened = this.option("opened");
if (opened) {
this._createPopup()
}
this.element().toggleClass(DROP_DOWN_EDITOR_ACTIVE, opened);
this._setPopupOption("visible", opened);
this.setAria({
expanded: opened,
owns: (opened || void 0) && this._popupContentId
})
},
_createPopup: function() {
if (this._$popup) {
return
}
this._$popup = $("
").addClass(DROP_DOWN_EDITOR_OVERLAY).addClass(this.option("customOverlayCssClass")).appendTo(this.element());
this._renderPopup();
this._renderPopupContent()
},
_renderPopup: function() {
this._popup = this._createComponent(this._$popup, Popup, this._popupConfig());
this._popup.on({
showing: $.proxy(this._popupShowingHandler, this),
shown: $.proxy(this._popupShownHandler, this),
hiding: $.proxy(this._popupHidingHandler, this),
hidden: $.proxy(this._popupHiddenHandler, this)
});
this._popup.option("onContentReady", $.proxy(this._contentReadyHandler, this));
this._contentReadyHandler();
this._popupContentId = new Guid;
this.setAria("id", this._popupContentId, this._popup.content())
},
_contentReadyHandler: $.noop,
_popupConfig: function() {
return {
onInitialized: this._popupInitializedHandler(),
position: $.extend(this.option("popupPosition"), {
of: this.element()
}),
showTitle: this.option("showPopupTitle"),
width: "auto",
height: "auto",
shading: false,
closeOnTargetScroll: true,
closeOnOutsideClick: $.proxy(this._closeOutsideDropDownHandler, this),
animation: {
show: {
type: "fade",
duration: 0,
from: 0,
to: 1
},
hide: {
type: "fade",
duration: 400,
from: 1,
to: 0
}
},
deferRendering: false,
focusStateEnabled: false,
showCloseButton: false,
toolbarItems: this._getPopupToolbarItems(),
onPositioned: $.proxy(this._popupPositionedHandler, this),
fullScreen: false
}
},
_popupInitializedHandler: function() {
if (!this.option("onPopupInitialized")) {
return
}
return $.proxy(function(e) {
this._popupInitializedAction({
popup: e.component
})
}, this)
},
_popupPositionedHandler: function(e) {
this._popup.overlayContent().toggleClass(DROP_DOWN_EDITOR_OVERLAY_FLIPPED, e.position.v.flip)
},
_popupShowingHandler: $.noop,
_popupHidingHandler: function() {
this.option("opened", false)
},
_popupShownHandler: function() {
this._openAction();
if (this._$validationMessage) {
this._$validationMessage.dxOverlay("option", "position", this._getValidationMessagePosition())
}
},
_popupHiddenHandler: function() {
this._closeAction();
if (this._$validationMessage) {
this._$validationMessage.dxOverlay("option", "position", this._getValidationMessagePosition())
}
},
_getValidationMessagePosition: function() {
var positionRequest = "below";
if (this._popup && this._popup.option("visible")) {
var myTop = positionUtils.setup(this.element()).top,
popupTop = positionUtils.setup(this._popup.content()).top;
positionRequest = myTop + this.option("popupPosition").offset.v > popupTop ? "below" : "above"
}
return this.callBase(positionRequest)
},
_renderPopupContent: function() {
var contentTemplate = this._getTemplateByOption("contentTemplate");
if (!(contentTemplate && this.option("contentTemplate"))) {
return
}
var $popupContent = this._popup.content();
$popupContent.empty();
contentTemplate.render({
container: $popupContent
})
},
_closeOutsideDropDownHandler: function(e) {
var $target = $(e.target);
var isInputClicked = !!$target.closest(this.element()).length;
var isDropButtonClicked = !!$target.closest(this._$dropButton).length;
var isOutsideClick = !isInputClicked && !isDropButtonClicked;
return isOutsideClick
},
_clean: function() {
delete this._$dropButton;
if (this._$popup) {
this._$popup.remove();
delete this._$popup;
delete this._popup
}
this.callBase()
},
_setPopupOption: function(optionName, value) {
this._setWidgetOption("_popup", arguments)
},
_validatedOpening: function() {
if (!this.option("readOnly")) {
this._toggleOpenState(true)
}
},
_getPopupToolbarItems: function() {
return "useButtons" === this.option("applyValueMode") ? this._popupToolbarItemsConfig() : []
},
_getFirstPopupElement: function() {
return this._popup._wrapper().find(".dx-popup-done.dx-button")
},
_getLastPopupElement: function() {
return this._popup._wrapper().find(".dx-popup-cancel.dx-button")
},
_popupElementTabHandler: function(e) {
var $element = $(e.currentTarget);
if (e.shiftKey && $element.is(this._getFirstPopupElement()) || !e.shiftKey && $element.is(this._getLastPopupElement())) {
this._input().focus();
e.preventDefault()
}
},
_popupElementEscHandler: function(e) {
this._input().focus();
this.close()
},
_popupButtonInitializedHandler: function(e) {
e.component.registerKeyHandler("tab", $.proxy(this._popupElementTabHandler, this));
e.component.registerKeyHandler("escape", $.proxy(this._popupElementEscHandler, this))
},
_popupToolbarItemsConfig: function() {
var buttonsConfig = [{
shortcut: "done",
options: {
onClick: $.proxy(this._applyButtonHandler, this),
text: this.option("applyButtonText"),
onInitialized: $.proxy(this._popupButtonInitializedHandler, this)
}
}, {
shortcut: "cancel",
options: {
onClick: $.proxy(this._cancelButtonHandler, this),
text: this.option("cancelButtonText"),
onInitialized: $.proxy(this._popupButtonInitializedHandler, this)
}
}];
return this._applyButtonsLocation(buttonsConfig)
},
_applyButtonsLocation: function(buttonsConfig) {
var buttonsLocation = this.option("buttonsLocation"),
resultConfig = buttonsConfig;
if ("default" !== buttonsLocation) {
var position = commonUtils.splitPair(buttonsLocation);
$.each(resultConfig, function(_, element) {
$.extend(element, {
toolbar: position[0],
location: position[1]
})
})
}
return resultConfig
},
_applyButtonHandler: function() {
this.close();
this.option("focusStateEnabled") && this.focus()
},
_cancelButtonHandler: function() {
this.close();
this.option("focusStateEnabled") && this.focus()
},
_toggleReadOnlyState: function() {
this.callBase();
this._$dropButton && this._$dropButton.dxButton("option", "disabled", this.option("readOnly"))
},
_optionChanged: function(args) {
switch (args.name) {
case "opened":
this._renderOpenedState();
break;
case "onOpened":
case "onClosed":
this._initVisibilityActions();
break;
case "onPopupInitialized":
this._initPopupInitializedAction();
break;
case "fieldTemplate":
this._renderInputAddons();
break;
case "showDropButton":
case "contentTemplate":
case "acceptCustomValue":
case "openOnFieldClick":
this._invalidate();
break;
case "popupPosition":
case "deferRendering":
break;
case "applyValueMode":
case "applyButtonText":
case "cancelButtonText":
case "buttonsLocation":
this._setPopupOption("toolbarItems", this._getPopupToolbarItems());
break;
case "showPopupTitle":
this._setPopupOption("showTitle", args.value);
break;
default:
this.callBase(args)
}
},
open: function() {
this.option("opened", true)
},
close: function() {
this.option("opened", false)
},
reset: function() {
this.option("value", null)
},
field: function() {
return this._input()
},
content: function() {
return this._popup ? this._popup.content() : null
}
});
registerComponent("dxDropDownEditor", DropDownEditor);
module.exports = DropDownEditor
},
/*!********************************!*\
!*** ./Scripts/ui/text_box.js ***!
\********************************/
function(module, exports, __webpack_require__) {
module.exports = __webpack_require__( /*! ./text_box/text_box */ 207)
},
/*!*****************************************!*\
!*** ./Scripts/ui/text_box/text_box.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
devices = __webpack_require__( /*! ../../core/devices */ 40),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 43),
TextEditor = __webpack_require__( /*! ./ui.text_editor */ 208),
eventUtils = __webpack_require__( /*! ../../events/utils */ 62);
var ua = window.navigator.userAgent,
ignoreCode = [8, 9, 13, 33, 34, 35, 36, 37, 38, 39, 40, 46],
TEXTBOX_CLASS = "dx-textbox",
SEARCHBOX_CLASS = "dx-searchbox",
ICON_CLASS = "dx-icon",
SEARCH_ICON_CLASS = "dx-icon-search";
var TextBox = TextEditor.inherit({
ctor: function(element, options) {
if (options) {
this._showClearButton = options.showClearButton
}
this.callBase.apply(this, arguments)
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
mode: "text",
maxLength: null
})
},
_render: function() {
this.callBase();
this.element().addClass(TEXTBOX_CLASS);
this.setAria("role", "textbox");
this._renderMaxLengthHandlers()
},
_renderInputType: function() {
this.callBase();
this._renderSearchMode()
},
_renderMaxLengthHandlers: function() {
if (this._isAndroid()) {
this._input().on(eventUtils.addNamespace("keydown", this.NAME), $.proxy(this._onKeyDownAndroidHandler, this)).on(eventUtils.addNamespace("change", this.NAME), $.proxy(this._onChangeAndroidHandler, this))
}
},
_renderProps: function() {
this.callBase();
this._toggleMaxLengthProp()
},
_toggleMaxLengthProp: function() {
if (this._isAndroid()) {
return
}
var maxLength = this.option("maxLength");
if (maxLength > 0) {
this._input().attr("maxLength", maxLength)
} else {
this._input().removeAttr("maxLength")
}
},
_renderSearchMode: function() {
var $element = this._$element;
if ("search" === this.option("mode")) {
$element.addClass(SEARCHBOX_CLASS);
this._renderSearchIcon();
if (void 0 === this._showClearButton) {
this._showClearButton = this.option("showClearButton");
this.option("showClearButton", true)
}
} else {
$element.removeClass(SEARCHBOX_CLASS);
this._$searchIcon && this._$searchIcon.remove();
this.option("showClearButton", void 0 === this._showClearButton ? this.option("showClearButton") : this._showClearButton);
delete this._showClearButton
}
},
_renderSearchIcon: function() {
var $searchIcon = $("
").addClass(ICON_CLASS).addClass(SEARCH_ICON_CLASS);
$searchIcon.prependTo(this._input().parent());
this._$searchIcon = $searchIcon
},
_optionChanged: function(args) {
switch (args.name) {
case "maxLength":
this._toggleMaxLengthProp();
this._renderMaxLengthHandlers();
break;
default:
this.callBase(args)
}
},
_onKeyDownAndroidHandler: function(e) {
var maxLength = this.option("maxLength");
if (maxLength) {
var $input = $(e.target),
code = e.keyCode;
this._cutOffExtraChar($input);
return $input.val().length < maxLength || $.inArray(code, ignoreCode) !== -1 || "" !== window.getSelection().toString()
} else {
return true
}
},
_onChangeAndroidHandler: function(e) {
var $input = $(e.target);
if (this.option("maxLength")) {
this._cutOffExtraChar($input)
}
},
_cutOffExtraChar: function($input) {
var maxLength = this.option("maxLength"),
textInput = $input.val();
if (textInput.length > maxLength) {
$input.val(textInput.substr(0, maxLength))
}
},
_isAndroid: function() {
var realDevice = devices.real();
var version = realDevice.version.join(".");
return "android" === realDevice.platform && version && /^(2\.|4\.1)/.test(version) && !/chrome/i.test(ua)
}
});
TextBox.__internals = {
uaAccessor: function(value) {
if (!arguments.length) {
return DevExpress.ui
}
ua = value
},
SEARCHBOX_CLASS: SEARCHBOX_CLASS,
SEARCH_ICON_CLASS: SEARCH_ICON_CLASS
};
registerComponent("dxTextBox", TextBox);
module.exports = TextBox
},
/*!***********************************************!*\
!*** ./Scripts/ui/text_box/ui.text_editor.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 43),
TextEditorMask = __webpack_require__( /*! ./ui.text_editor.mask */ 209);
registerComponent("dxTextEditor", TextEditorMask);
module.exports = TextEditorMask
},
/*!****************************************************!*\
!*** ./Scripts/ui/text_box/ui.text_editor.mask.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
caret = __webpack_require__( /*! ./utils.caret */ 210),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 80),
TextEditorBase = __webpack_require__( /*! ./ui.text_editor.base */ 211),
MaskRules = __webpack_require__( /*! ./ui.text_editor.mask.rule */ 212),
eventUtils = __webpack_require__( /*! ../../events/utils */ 62);
var stubCaret = function() {
return {}
};
var EMPTY_CHAR = " ";
var EMPTY_CHAR_CODE = 32;
var ESCAPED_CHAR = "\\";
var TEXTEDITOR_MASKED_CLASS = "dx-texteditor-masked";
var MASK_EVENT_NAMESPACE = "dxMask";
var FORWARD_DIRECTION = "forward";
var BACKWARD_DIRECTION = "backward";
var buildInMaskRules = {
0: /[0-9]/,
9: /[0-9\s]/,
"#": /[-+0-9\s]/,
L: function(char) {
return isLiteralChar(char)
},
l: function(char) {
return isLiteralChar(char) || isSpaceChar(char)
},
C: /\S/,
c: /./,
A: function(char) {
return isLiteralChar(char) || isNumericChar(char)
},
a: function(char) {
return isLiteralChar(char) || isNumericChar(char) || isSpaceChar(char)
}
};
var isNumericChar = function(char) {
return /[0-9]/.test(char)
};
var isLiteralChar = function(char) {
var code = char.charCodeAt();
return 64 < code && code < 91 || 96 < code && code < 123 || code > 127
};
var isSpaceChar = function(char) {
return " " === char
};
var TextEditorMask = TextEditorBase.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
mask: "",
maskChar: "_",
maskRules: {},
maskInvalidMessage: messageLocalization.format("validation-mask"),
useMaskedValue: false
})
},
_supportedKeys: function() {
var that = this;
var keyHandlerMap = {
backspace: that._maskBackspaceHandler,
del: that._maskDelHandler,
enter: that._changeHandler
};
var result = that.callBase();
$.each(keyHandlerMap, function(key, callback) {
var parentHandler = result[key];
result[key] = function(e) {
that.option("mask") && callback.call(that, e);
parentHandler && parentHandler(e)
}
});
return result
},
_render: function() {
this.callBase();
this._renderMask()
},
_renderMask: function() {
this.element().removeClass(TEXTEDITOR_MASKED_CLASS);
this._maskRulesChain = null;
this._detachMaskEventHandlers();
if (!this.option("mask")) {
return
}
this.element().addClass(TEXTEDITOR_MASKED_CLASS);
this._attachMaskEventHandlers();
this._parseMask();
this._renderMaskedValue();
this._changedValue = this._input().val()
},
_attachMaskEventHandlers: function() {
this._input().on(eventUtils.addNamespace("focus", MASK_EVENT_NAMESPACE), $.proxy(this._maskFocusHandler, this)).on(eventUtils.addNamespace("keydown", MASK_EVENT_NAMESPACE), $.proxy(this._maskKeyDownHandler, this)).on(eventUtils.addNamespace("keypress", MASK_EVENT_NAMESPACE), $.proxy(this._maskKeyPressHandler, this)).on(eventUtils.addNamespace("input", MASK_EVENT_NAMESPACE), $.proxy(this._maskInputHandler, this)).on(eventUtils.addNamespace("paste", MASK_EVENT_NAMESPACE), $.proxy(this._maskPasteHandler, this)).on(eventUtils.addNamespace("cut", MASK_EVENT_NAMESPACE), $.proxy(this._maskCutHandler, this)).on(eventUtils.addNamespace("drop", MASK_EVENT_NAMESPACE), $.proxy(this._maskDragHandler, this));
this._attachChangeEventHandlers()
},
_detachMaskEventHandlers: function() {
this._input().off("." + MASK_EVENT_NAMESPACE)
},
_attachChangeEventHandlers: function() {
if ($.inArray("change", this.option("valueChangeEvent").split(" ")) === -1) {
return
}
this._input().on(eventUtils.addNamespace("blur", MASK_EVENT_NAMESPACE), $.proxy(function(e) {
this._suppressCaretChanging(this._changeHandler, [e]);
this._changeHandler(e)
}, this))
},
_suppressCaretChanging: function(callback, args) {
var originalCaret = caret;
caret = stubCaret;
try {
callback.apply(this, args)
} finally {
caret = originalCaret
}
},
_changeHandler: function(e) {
var $input = this._input(),
inputValue = $input.val();
if (inputValue === this._changedValue) {
return
}
this._changedValue = inputValue;
var changeEvent = eventUtils.createEvent(e, {
type: "change"
});
$input.trigger(changeEvent)
},
_parseMask: function() {
this._maskRules = $.extend({}, buildInMaskRules, this.option("maskRules"));
this._maskRulesChain = this._parseMaskRule(0)
},
_parseMaskRule: function(index) {
var mask = this.option("mask");
if (index >= mask.length) {
return new MaskRules.EmptyMaskRule
}
var currentMaskChar = mask[index];
var isEscapedChar = currentMaskChar === ESCAPED_CHAR;
var result = isEscapedChar ? new MaskRules.StubMaskRule({
maskChar: mask[index + 1]
}) : this._getMaskRule(currentMaskChar);
result.next(this._parseMaskRule(index + 1 + isEscapedChar));
return result
},
_getMaskRule: function(pattern) {
var ruleConfig;
$.each(this._maskRules, function(rulePattern, allowedChars) {
if (rulePattern === pattern) {
ruleConfig = {
pattern: rulePattern,
allowedChars: allowedChars
};
return false
}
});
return commonUtils.isDefined(ruleConfig) ? new MaskRules.MaskRule($.extend({
maskChar: this.option("maskChar")
}, ruleConfig)) : new MaskRules.StubMaskRule({
maskChar: pattern
})
},
_renderMaskedValue: function() {
if (!this._maskRulesChain) {
return
}
var value = this.option("value") || "";
this._maskRulesChain.clear(this._normalizeChainArguments());
var chainArgs = {
length: value.length
};
chainArgs[this._isMaskedValueMode() ? "text" : "value"] = value;
this._handleChain(chainArgs);
this._displayMask()
},
_isMaskedValueMode: function() {
return this.option("useMaskedValue")
},
_displayMask: function(caret) {
caret = caret || this._caret();
this._renderValue();
this._caret(caret)
},
_renderValue: function() {
if (this._maskRulesChain) {
this.option("text", this._maskRulesChain.text())
}
this.callBase()
},
_valueChangeEventHandler: function(e) {
if (!this._maskRulesChain) {
this.callBase.apply(this, arguments);
return
}
this._saveValueChangeEvent(e);
var value = this._isMaskedValueMode() ? (this._textValue || "").replace(new RegExp("[" + this.option("maskChar") + "]", "g"), " ").replace(/\s+$/, "") : (this._value || "").replace(/\s+$/, "");
this.option("value", value)
},
_maskFocusHandler: function() {
this._direction(FORWARD_DIRECTION);
this._adjustCaret()
},
_maskKeyDownHandler: function() {
this._keyPressHandled = false
},
_maskKeyPressHandler: function(e) {
if (this._keyPressHandled) {
return
}
this._keyPressHandled = true;
if (this._isControlKeyFired(e)) {
return
}
this._maskKeyHandler(e, function() {
this._handleKey(e.which);
return true
})
},
_maskInputHandler: function(e) {
if (this._keyPressHandled) {
return
}
this._keyPressHandled = true;
var inputValue = this._input().val();
var caret = this._caret();
caret.start = caret.end - 1;
var oldValue = inputValue.substring(0, caret.start) + inputValue.substring(caret.end);
var char = inputValue[caret.start];
this._input().val(oldValue);
this._inputHandlerTimer = setTimeout($.proxy(function() {
this._caret({
start: caret.start,
end: caret.start
});
this._maskKeyHandler(e, function() {
this._handleKey(char.charCodeAt());
return true
})
}, this))
},
_isControlKeyFired: function(e) {
return this._isControlKey(e.keyCode) && !e.which || e.metaKey
},
_maskBackspaceHandler: function(e) {
var that = this;
that._keyPressHandled = true;
var afterBackspaceHandler = function(needAdjustCaret, callBack) {
if (needAdjustCaret) {
that._direction(FORWARD_DIRECTION);
that._adjustCaret()
}
var currentCaret = that._caret();
clearTimeout(that._backspaceHandlerTimeout);
that._backspaceHandlerTimeout = setTimeout(function() {
callBack(currentCaret)
})
};
that._maskKeyHandler(e, function() {
if (that._hasSelection()) {
afterBackspaceHandler(true, function(currentCaret) {
that._displayMask(currentCaret);
that._maskRulesChain.reset()
});
return
}
if (that._tryMoveCaretBackward()) {
afterBackspaceHandler(false, function(currentCaret) {
that._caret(currentCaret)
});
return
}
that._handleKey(EMPTY_CHAR_CODE, BACKWARD_DIRECTION);
afterBackspaceHandler(true, function(currentCaret) {
that._displayMask(currentCaret);
that._maskRulesChain.reset()
})
})
},
_maskDelHandler: function(e) {
this._keyPressHandled = true;
this._maskKeyHandler(e, function() {
!this._hasSelection() && this._handleKey(EMPTY_CHAR_CODE);
return true
})
},
_maskPasteHandler: function(e) {
this._keyPressHandled = true;
var caret = this._caret();
this._maskKeyHandler(e, function() {
var pastingText = domUtils.clipboardText(e);
var restText = this._maskRulesChain.text().substring(caret.end);
var accepted = this._handleChain({
text: pastingText,
start: caret.start,
length: pastingText.length
});
var newCaret = caret.start + accepted;
this._handleChain({
text: restText,
start: newCaret,
length: restText.length
});
this._caret({
start: newCaret,
end: newCaret
});
return true
})
},
_handleChain: function(args) {
var handledCount = this._maskRulesChain.handle(this._normalizeChainArguments(args));
this._value = this._maskRulesChain.value();
this._textValue = this._maskRulesChain.text();
return handledCount
},
_normalizeChainArguments: function(args) {
args = args || {};
args.index = 0;
args.fullText = this._maskRulesChain.text();
return args
},
_maskCutHandler: function(e) {
var caret = this._caret();
var selectedText = this._input().val().substring(caret.start, caret.end);
this._maskKeyHandler(e, function() {
domUtils.clipboardText(e, selectedText);
return true
})
},
_maskDragHandler: function() {
this._clearDragTimer();
this._dragTimer = setTimeout($.proxy(function() {
this.option("value", this._convertToValue(this._input().val()))
}, this))
},
_convertToValue: function(text) {
return text.replace(new RegExp(this.option("maskChar"), "g"), EMPTY_CHAR)
},
_maskKeyHandler: function(e, tryHandleKeyCallback) {
if (this.option("readOnly")) {
return
}
this._direction(FORWARD_DIRECTION);
e.preventDefault();
this._handleSelection();
if (!tryHandleKeyCallback.call(this)) {
return
}
this._direction(FORWARD_DIRECTION);
this._adjustCaret();
this._displayMask();
this._maskRulesChain.reset()
},
_handleKey: function(keyCode, direction) {
var char = String.fromCharCode(keyCode);
this._direction(direction || FORWARD_DIRECTION);
this._adjustCaret(char);
this._handleKeyChain(char);
this._moveCaret()
},
_handleSelection: function() {
if (!this._hasSelection()) {
return
}
var caret = this._caret();
var emptyChars = new Array(caret.end - caret.start + 1).join(EMPTY_CHAR);
this._handleKeyChain(emptyChars)
},
_handleKeyChain: function(chars) {
var caret = this._caret();
var start = this._isForwardDirection() ? caret.start : caret.start - 1;
var end = this._isForwardDirection() ? caret.end : caret.end - 1;
var length = start === end ? 1 : end - start;
this._handleChain({
text: chars,
start: start,
length: length
})
},
_tryMoveCaretBackward: function() {
this._direction(BACKWARD_DIRECTION);
var currentCaret = this._caret().start;
this._adjustCaret();
return !currentCaret || currentCaret !== this._caret().start
},
_adjustCaret: function(char) {
var caret = this._maskRulesChain.adjustedCaret(this._caret().start, this._isForwardDirection(), char);
this._caret({
start: caret,
end: caret
})
},
_moveCaret: function() {
var currentCaret = this._caret().start;
var maskRuleIndex = currentCaret + (this._isForwardDirection() ? 0 : -1);
var caret = this._maskRulesChain.isAccepted(maskRuleIndex) ? currentCaret + (this._isForwardDirection() ? 1 : -1) : currentCaret;
this._caret({
start: caret,
end: caret
})
},
_caret: function(position) {
if (!arguments.length) {
return caret(this._input())
}
caret(this._input(), position)
},
_hasSelection: function() {
var caret = this._caret();
return caret.start !== caret.end
},
_direction: function(direction) {
if (!arguments.length) {
return this._typingDirection
}
this._typingDirection = direction
},
_isForwardDirection: function() {
return this._direction() === FORWARD_DIRECTION
},
_clearDragTimer: function() {
clearTimeout(this._dragTimer)
},
_clean: function() {
this._clearDragTimer();
this.callBase()
},
_validateMask: function() {
if (!this._maskRulesChain) {
return
}
var isValid = this._maskRulesChain.isValid(this._normalizeChainArguments());
this.option({
isValid: isValid,
validationError: isValid ? null : {
editorSpecific: true,
message: this.option("maskInvalidMessage")
}
})
},
_dispose: function() {
clearTimeout(this._inputHandlerTimer);
clearTimeout(this._backspaceHandlerTimeout);
this.callBase()
},
_optionChanged: function(args) {
switch (args.name) {
case "mask":
case "maskChar":
case "maskRules":
case "useMaskedValue":
this._renderMask();
this._validateMask();
break;
case "value":
this._renderMaskedValue();
this._validateMask();
this.callBase(args);
break;
case "maskInvalidMessage":
break;
default:
this.callBase(args)
}
}
});
module.exports = TextEditorMask
},
/*!********************************************!*\
!*** ./Scripts/ui/text_box/utils.caret.js ***!
\********************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
browser = __webpack_require__( /*! ../../core/utils/browser */ 18);
var isIE = browser.msie && parseInt(browser.version) <= 11;
var getCaret = function(input) {
if (isObsoleteBrowser(input)) {
return getCaretForObsoleteBrowser(input)
}
return {
start: input.selectionStart,
end: input.selectionEnd
}
};
var setCaret = function(input, position) {
if (isObsoleteBrowser(input)) {
setCaretForObsoleteBrowser(input, position);
return
}
if (!$.contains(document, input)) {
return
}
input.selectionStart = position.start;
input.selectionEnd = position.end
};
var isObsoleteBrowser = function(input) {
return !input.setSelectionRange
};
var getCaretForObsoleteBrowser = function(input) {
var range = document.selection.createRange();
var rangeCopy = range.duplicate();
range.move("character", -input.value.length);
range.setEndPoint("EndToStart", rangeCopy);
return {
start: range.text.length,
end: range.text.length + rangeCopy.text.length
}
};
var setCaretForObsoleteBrowser = function(input, position) {
if (!$.contains(document, input)) {
return
}
var range = input.createTextRange();
range.collapse(true);
range.moveStart("character", position.start);
range.moveEnd("character", position.end - position.start);
range.select()
};
var caret = function(input, position) {
input = $(input).get(0);
if (!commonUtils.isDefined(position)) {
return getCaret(input)
}
if (isIE && document.activeElement !== input) {
return
}
setCaret(input, position)
};
module.exports = caret
},
/*!****************************************************!*\
!*** ./Scripts/ui/text_box/ui.text_editor.base.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 50),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
themes = __webpack_require__( /*! ../themes */ 143),
Editor = __webpack_require__( /*! ../editor/editor */ 107),
eventUtils = __webpack_require__( /*! ../../events/utils */ 62),
pointerEvents = __webpack_require__( /*! ../../events/pointer */ 65),
clickEvent = __webpack_require__( /*! ../../events/click */ 64);
var TEXTEDITOR_CLASS = "dx-texteditor",
TEXTEDITOR_INPUT_CLASS = "dx-texteditor-input",
TEXTEDITOR_INPUT_SELECTOR = "." + TEXTEDITOR_INPUT_CLASS,
TEXTEDITOR_CONTAINER_CLASS = "dx-texteditor-container",
TEXTEDITOR_BUTTONS_CONTAINER_CLASS = "dx-texteditor-buttons-container",
TEXTEDITOR_PLACEHOLDER_CLASS = "dx-placeholder",
TEXTEDITOR_SHOW_CLEAR_BUTTON_CLASS = "dx-show-clear-button",
TEXTEDITOR_ICON_CLASS = "dx-icon",
TEXTEDITOR_CLEAR_ICON_CLASS = "dx-icon-clear",
TEXTEDITOR_CLEAR_BUTTON_CLASS = "dx-clear-button-area",
TEXTEDITOR_EMPTY_INPUT_CLASS = "dx-texteditor-empty";
var EVENTS_LIST = ["KeyDown", "KeyPress", "KeyUp", "Change", "Cut", "Copy", "Paste", "Input"];
var CONTROL_KEYS = {
9: "tab",
13: "enter",
16: "shift",
17: "ctrl",
18: "alt",
27: "escape",
33: "pageUp",
34: "pageDown",
35: "end",
36: "home",
37: "leftArrow",
38: "upArrow",
39: "rightArrow",
40: "downArrow"
};
var TextEditorBase = Editor.inherit({
_supportedKeys: function() {
var stop = function(e) {
e.stopPropagation()
};
return {
space: stop,
enter: stop,
leftArrow: stop,
rightArrow: stop
}
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
value: "",
spellcheck: false,
showClearButton: false,
valueChangeEvent: "change",
placeholder: "",
attr: {},
onFocusIn: null,
onFocusOut: null,
onKeyDown: null,
onKeyPress: null,
onKeyUp: null,
onChange: null,
onInput: null,
onCut: null,
onCopy: null,
onPaste: null,
onEnterKey: null,
mode: "text",
hoverStateEnabled: true,
focusStateEnabled: true,
text: void 0,
valueFormat: function(value) {
return value
}
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function() {
var currentTheme = (themes.current() || "").split(".")[0];
return "android5" === currentTheme
},
options: {
validationMessageOffset: {
v: -8
}
}
}])
},
_input: function() {
return this.element().find(TEXTEDITOR_INPUT_SELECTOR).first()
},
_inputWrapper: function() {
return this.element()
},
_buttonsContainer: function() {
return this._inputWrapper().find("." + TEXTEDITOR_BUTTONS_CONTAINER_CLASS)
},
_isControlKey: function(keyCode) {
return !!CONTROL_KEYS[keyCode]
},
_render: function() {
this.element().addClass(TEXTEDITOR_CLASS);
this._renderInput();
this._renderInputType();
this._renderValue();
this._renderProps();
this._renderPlaceholder();
this.callBase();
this._refreshValueChangeEvent();
this._renderEvents();
this._renderEnterKeyAction();
this._renderEmptinessEvent()
},
_renderInput: function() {
$("
").addClass(TEXTEDITOR_CONTAINER_CLASS).append(this._createInput()).append($("
").addClass(TEXTEDITOR_BUTTONS_CONTAINER_CLASS)).appendTo(this.element())
},
_createInput: function() {
return $("
").addClass(TEXTEDITOR_INPUT_CLASS).attr("autocomplete", "off").attr(this.option("attr"))
},
_renderValue: function() {
this._renderInputValue();
this._renderInputAddons()
},
_renderInputValue: function(value) {
value = value || this.option("value");
var text = this.option("text"),
displayValue = this.option("displayValue"),
valueFormat = this.option("valueFormat");
if (void 0 !== displayValue && null !== value) {
text = valueFormat(displayValue)
} else {
if (!commonUtils.isDefined(text)) {
text = valueFormat(value)
}
}
this.option("text", text);
if (this._input().val() !== (commonUtils.isDefined(text) ? text : "")) {
this._renderDisplayText(text)
} else {
this._toggleEmptinessEventHandler()
}
},
_renderDisplayText: function(text) {
this._input().val(text);
this._toggleEmptinessEventHandler()
},
_isValueValid: function() {
if (this._input().length) {
var validity = this._input().get(0).validity;
if (validity) {
return validity.valid
}
}
return true
},
_toggleEmptiness: function(isEmpty) {
this.element().toggleClass(TEXTEDITOR_EMPTY_INPUT_CLASS, isEmpty);
this._togglePlaceholder(isEmpty)
},
_togglePlaceholder: function(isEmpty) {
if (!this._$placeholder) {
return
}
this._$placeholder.toggleClass("dx-state-invisible", !isEmpty)
},
_renderProps: function() {
this._toggleDisabledState(this.option("disabled"));
this._toggleReadOnlyState();
this._toggleSpellcheckState()
},
_toggleDisabledState: function(value) {
this.callBase.apply(this, arguments);
var $input = this._input();
if (value) {
$input.attr("disabled", true).attr("tabindex", -1)
} else {
$input.removeAttr("disabled").removeAttr("tabindex")
}
},
_toggleReadOnlyState: function() {
this._input().prop("readOnly", this._readOnlyPropValue());
this.callBase()
},
_readOnlyPropValue: function() {
return this.option("readOnly")
},
_toggleSpellcheckState: function() {
this._input().prop("spellcheck", this.option("spellcheck"))
},
_renderPlaceholder: function() {
if (this._$placeholder) {
this._$placeholder.remove();
this._$placeholder = null
}
var that = this,
$input = that._input(),
placeholderText = that.option("placeholder"),
$placeholder = this._$placeholder = $("
").attr("data-dx_placeholder", placeholderText),
startEvent = eventUtils.addNamespace(pointerEvents.up, this.NAME);
$placeholder.on(startEvent, function() {
$input.focus()
});
$placeholder.insertAfter($input);
$placeholder.addClass(TEXTEDITOR_PLACEHOLDER_CLASS);
this._toggleEmptinessEventHandler()
},
_placeholder: function() {
return this._$placeholder || $()
},
_renderInputAddons: function() {
this._renderClearButton()
},
_renderClearButton: function() {
var clearButtonVisibility = this._clearButtonVisibility();
this.element().toggleClass(TEXTEDITOR_SHOW_CLEAR_BUTTON_CLASS, clearButtonVisibility);
if (clearButtonVisibility) {
if (!this._$clearButton || this._$clearButton && !this._$clearButton.closest(this.element()).length) {
this._$clearButton = this._createClearButton()
}
this._$clearButton.prependTo(this._buttonsContainer())
}
if (this._$clearButton) {
this._$clearButton.toggleClass("dx-state-invisible", !clearButtonVisibility)
}
},
_clearButtonVisibility: function() {
return this.option("showClearButton") && !this.option("readOnly")
},
_createClearButton: function() {
return $("
").addClass(TEXTEDITOR_CLEAR_BUTTON_CLASS).append($("").addClass(TEXTEDITOR_ICON_CLASS).addClass(TEXTEDITOR_CLEAR_ICON_CLASS)).on(eventUtils.addNamespace(pointerEvents.down, this.NAME), function(e) {
if ("mouse" === e.pointerType) {
e.preventDefault()
}
}).on(eventUtils.addNamespace(clickEvent.name, this.NAME), $.proxy(this._clearValueHandler, this))
},
_clearValueHandler: function(e) {
var $input = this._input();
e.stopPropagation();
this._valueChangeEventHandler(e);
this.reset();
!$input.is(":focus") && $input.focus()
},
_renderEvents: function() {
var that = this,
$input = that._input();
$.each(EVENTS_LIST, function(_, event) {
var eventName = event.charAt(0).toLowerCase() + event.substr(1);
if (that.option("on" + event) || that.hasEvent(eventName)) {
var action = that._createActionByOption("on" + event, {
excludeValidators: ["readOnly"]
});
$input.on(eventUtils.addNamespace(event.toLowerCase(), that.NAME), function(e) {
if (that._disposed) {
return
}
action({
jQueryEvent: e
})
})
}
})
},
_refreshEvents: function() {
var that = this,
$input = this._input();
$.each(EVENTS_LIST, function(_, event) {
$input.off(eventUtils.addNamespace(event.toLowerCase(), that.NAME))
});
this._renderEvents()
},
_keyPressHandler: function(e) {
this.option("text", this._input().val())
},
_renderValueChangeEvent: function() {
var keyPressEvent = eventUtils.addNamespace(this._renderValueEventName(), this.NAME + "TextChange"),
valueChangeEvent = eventUtils.addNamespace(this.option("valueChangeEvent"), this.NAME + "ValueChange");
this._input().on(keyPressEvent, $.proxy(this._keyPressHandler, this)).on(valueChangeEvent, $.proxy(this._valueChangeEventHandler, this))
},
_cleanValueChangeEvent: function() {
var eventNamespace = this.NAME + "ValueChange",
keyPressEvent = eventUtils.addNamespace(this._renderValueEventName(), this.NAME + "TextChange");
this._input().off("." + eventNamespace).off(keyPressEvent)
},
_refreshValueChangeEvent: function() {
this._cleanValueChangeEvent();
this._renderValueChangeEvent()
},
_renderValueEventName: function() {
return "input change keypress"
},
_focusTarget: function() {
return this._input()
},
_focusClassTarget: function() {
return this.element()
},
_toggleFocusClass: function(isFocused, $element) {
this.callBase(isFocused, this._focusClassTarget($element))
},
_hasFocusClass: function(element) {
return this.callBase($(element || this.element()))
},
_renderEmptinessEvent: function() {
var $input = this._input();
$input.on("input blur", $.proxy(this._toggleEmptinessEventHandler, this))
},
_toggleEmptinessEventHandler: function(value) {
var text = this._input().val(),
isEmpty = ("" === text || null === text) && this._isValueValid();
this._toggleEmptiness(isEmpty)
},
_valueChangeEventHandler: function(e, formattedValue) {
this._saveValueChangeEvent(e);
this.option("value", arguments.length > 1 ? formattedValue : this._input().val())
},
_renderEnterKeyAction: function() {
this._enterKeyAction = this._createActionByOption("onEnterKey", {
excludeValidators: ["readOnly"]
});
this._input().off("keyup.onEnterKey.dxTextEditor").on("keyup.onEnterKey.dxTextEditor", $.proxy(this._enterKeyHandlerUp, this))
},
_enterKeyHandlerUp: function(e) {
if (this._disposed) {
return
}
if (13 === e.which) {
this._enterKeyAction({
jQueryEvent: e
})
}
},
_updateValue: function() {
this.option("text", void 0);
this._renderValue()
},
_dispose: function() {
this._enterKeyAction = void 0;
this.callBase()
},
_optionChanged: function(args) {
var name = args.name;
if ($.inArray(name.replace("on", ""), EVENTS_LIST) > -1) {
this._refreshEvents();
return
}
switch (name) {
case "valueChangeEvent":
this._refreshValueChangeEvent();
this._refreshFocusEvent();
this._refreshEvents();
break;
case "onValueChanged":
this._createValueChangeAction();
break;
case "readOnly":
this.callBase(args);
this._renderInputAddons();
break;
case "spellcheck":
this._toggleSpellcheckState();
break;
case "mode":
this._renderInputType();
break;
case "onEnterKey":
this._renderEnterKeyAction();
break;
case "placeholder":
this._renderPlaceholder();
break;
case "showClearButton":
this._renderInputAddons();
break;
case "text":
break;
case "value":
this._updateValue();
this.callBase(args);
break;
case "attr":
this._input().attr(args.value);
break;
case "valueFormat":
this._invalidate();
break;
default:
this.callBase(args)
}
},
_renderInputType: function() {
this._setInputType(this.option("mode"))
},
_setInputType: function(type) {
var input = this._input();
if ("search" === type) {
type = "text"
}
try {
input.prop("type", type)
} catch (e) {
input.prop("type", "text")
}
},
focus: function() {
this._input().focus()
},
blur: function() {
if (this._input().is(document.activeElement)) {
domUtils.resetActiveElement()
}
},
reset: function() {
this.option("value", "")
}
});
var originalOnMethod = TextEditorBase.prototype.on;
TextEditorBase.prototype.on = function(eventName, eventHandler) {
originalOnMethod.call(this, eventName, eventHandler);
var event = eventName.charAt(0).toUpperCase() + eventName.substr(1);
if (EVENTS_LIST.indexOf(event) >= 0) {
this._refreshEvents()
}
};
module.exports = TextEditorBase
},
/*!*********************************************************!*\
!*** ./Scripts/ui/text_box/ui.text_editor.mask.rule.js ***!
\*********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14);
var EMPTY_CHAR = " ";
var BaseMaskRule = Class.inherit({
ctor: function(config) {
this._value = EMPTY_CHAR;
$.extend(this, config)
},
next: function(rule) {
if (!arguments.length) {
return this._next
}
this._next = rule
},
text: $.noop,
value: $.noop,
rawValue: $.noop,
handle: $.noop,
_prepareHandlingArgs: function(args, config) {
config = config || {};
var handlingProperty = args.hasOwnProperty("value") ? "value" : "text";
args[handlingProperty] = commonUtils.isDefined(config.str) ? config.str : args[handlingProperty];
args.start = commonUtils.isDefined(config.start) ? config.start : args.start;
args.length = commonUtils.isDefined(config.length) ? config.length : args.length;
args.index = args.index + 1;
return args
},
reset: $.noop,
clear: $.noop,
isAccepted: function() {
return false
},
adjustedCaret: function(caret, isForwardDirection, char) {
return isForwardDirection ? this._adjustedForward(caret, 0, char) : this._adjustedBackward(caret, 0, char)
},
_adjustedForward: $.noop,
_adjustedBackward: $.noop,
isValid: $.noop
});
var EmptyMaskRule = BaseMaskRule.inherit({
next: $.noop,
handle: function() {
return 0
},
text: function() {
return ""
},
value: function() {
return ""
},
rawValue: function() {
return ""
},
adjustedCaret: function() {
return 0
},
isValid: function() {
return true
}
});
var MaskRule = BaseMaskRule.inherit({
text: function() {
return (this._value !== EMPTY_CHAR ? this._value : this.maskChar) + this.next().text()
},
value: function() {
return this._value + this.next().value()
},
rawValue: function() {
return this._value + this.next().rawValue()
},
handle: function(args) {
var str = args.hasOwnProperty("value") ? args.value : args.text;
if (!str || !str.length || !args.length) {
return 0
}
if (args.start) {
return this.next().handle(this._prepareHandlingArgs(args, {
start: args.start - 1
}))
}
var char = str[0];
var rest = str.substring(1);
this._tryAcceptChar(char, args);
return this._accepted() ? this.next().handle(this._prepareHandlingArgs(args, {
str: rest,
length: args.length - 1
})) + 1 : this.handle(this._prepareHandlingArgs(args, {
str: rest,
length: args.length - 1
}))
},
clear: function(args) {
this._tryAcceptChar(EMPTY_CHAR, args);
this.next().clear(this._prepareHandlingArgs(args))
},
reset: function() {
this._accepted(false);
this.next().reset()
},
_tryAcceptChar: function(char, args) {
this._accepted(false);
if (!this._isAllowed(char, args)) {
return
}
var acceptedChar = char === EMPTY_CHAR ? this.maskChar : char;
args.fullText = args.fullText.substring(0, args.index) + acceptedChar + args.fullText.substring(args.index + 1);
this._accepted(true);
this._value = char
},
_accepted: function(value) {
if (!arguments.length) {
return !!this._isAccepted
}
this._isAccepted = !!value
},
_isAllowed: function(char, args) {
if (char === EMPTY_CHAR) {
return true
}
return this._isValid(char, args)
},
_isValid: function(char, args) {
var allowedChars = this.allowedChars;
if (allowedChars instanceof RegExp) {
return allowedChars.test(char)
}
if ($.isFunction(allowedChars)) {
return allowedChars(char, args.index, args.fullText)
}
if ($.isArray(allowedChars)) {
return $.inArray(char, allowedChars) > -1
}
return allowedChars === char
},
isAccepted: function(caret) {
return 0 === caret ? this._accepted() : this.next().isAccepted(caret - 1)
},
_adjustedForward: function(caret, index, char) {
if (index >= caret) {
return index
}
return this.next()._adjustedForward(caret, index + 1, char) || index + 1
},
_adjustedBackward: function(caret, index) {
if (index >= caret - 1) {
return caret
}
return this.next()._adjustedBackward(caret, index + 1) || index + 1
},
isValid: function(args) {
return this._isValid(this._value, args) && this.next().isValid(this._prepareHandlingArgs(args))
}
});
var StubMaskRule = MaskRule.inherit({
value: function() {
return this.next().value()
},
handle: function(args) {
var hasValueProperty = args.hasOwnProperty("value");
var str = hasValueProperty ? args.value : args.text;
if (!str.length || !args.length) {
return 0
}
if (args.start || hasValueProperty) {
return this.next().handle(this._prepareHandlingArgs(args, {
start: args.start && args.start - 1
}))
}
var char = str[0];
var rest = str.substring(1);
this._tryAcceptChar(char);
var nextArgs = this._isAllowed(char) ? this._prepareHandlingArgs(args, {
str: rest,
length: args.length - 1
}) : args;
return this.next().handle(nextArgs) + 1
},
clear: function(args) {
this._accepted(false);
this.next().clear(this._prepareHandlingArgs(args))
},
_tryAcceptChar: function(char) {
this._accepted(this._isValid(char))
},
_isValid: function(char) {
return char === this.maskChar
},
_adjustedForward: function(caret, index, char) {
if (index >= caret && char === this.maskChar) {
return index
}
if (caret === index + 1 && this._accepted()) {
return caret
}
return this.next()._adjustedForward(caret, index + 1, char)
},
_adjustedBackward: function(caret, index) {
if (index >= caret - 1) {
return 0
}
return this.next()._adjustedBackward(caret, index + 1)
},
isValid: function(args) {
return this.next().isValid(this._prepareHandlingArgs(args))
}
});
module.exports.MaskRule = MaskRule;
module.exports.StubMaskRule = StubMaskRule;
module.exports.EmptyMaskRule = EmptyMaskRule
},
/*!****************************!*\
!*** ./Scripts/ui/list.js ***!
\****************************/
function(module, exports, __webpack_require__) {
var ListEdit = __webpack_require__( /*! ./list/ui.list.edit */ 214),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 43);
/**
* @name dxList
* @publicName dxList
* @description List widget.
* @inherits CollectionWidget
* @module ui/list
*/
registerComponent("dxList", ListEdit);
module.exports = ListEdit
},
/*!*****************************************!*\
!*** ./Scripts/ui/list/ui.list.edit.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
eventUtils = __webpack_require__( /*! ../../events/utils */ 62),
GroupedEditStrategy = __webpack_require__( /*! ./ui.list.edit.strategy.grouped */ 215),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 80),
EditProvider = __webpack_require__( /*! ./ui.list.edit.provider */ 216),
ListBase = __webpack_require__( /*! ./ui.list.base */ 226);
var LIST_ITEM_SELECTED_CLASS = "dx-list-item-selected",
LIST_ITEM_RESPONSE_WAIT_CLASS = "dx-list-item-response-wait";
var ListEdit = ListBase.inherit({
_supportedKeys: function() {
var that = this,
parent = this.callBase();
var deleteFocusedItem = function(e) {
if (that.option("allowItemDeleting")) {
e.preventDefault();
that.deleteItem(that.option("focusedElement"))
}
};
var moveFocusedItemUp = function(e) {
if (e.shiftKey && that.option("allowItemReordering")) {
e.preventDefault();
var focusedItemIndex = that._editStrategy.getNormalizedIndex(that.option("focusedElement")),
$prevItem = that._editStrategy.getItemElement(focusedItemIndex - 1);
that.reorderItem(that.option("focusedElement"), $prevItem);
that.scrollToItem(that.option("focusedElement"))
} else {
parent.upArrow(e)
}
};
var moveFocusedItemDown = function(e) {
if (e.shiftKey && that.option("allowItemReordering")) {
e.preventDefault();
var focusedItemIndex = that._editStrategy.getNormalizedIndex(that.option("focusedElement")),
$nextItem = that._editStrategy.getItemElement(focusedItemIndex + 1);
that.reorderItem(that.option("focusedElement"), $nextItem);
that.scrollToItem(that.option("focusedElement"))
} else {
parent.downArrow(e)
}
};
return $.extend({}, parent, {
del: deleteFocusedItem,
upArrow: moveFocusedItemUp,
downArrow: moveFocusedItemDown
})
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
showSelectionControls: false,
selectionMode: "none",
onSelectAllValueChanged: null,
selectAllText: messageLocalization.format("dxList-selectAll"),
menuItems: [],
menuMode: "context",
allowItemDeleting: false,
itemDeleteMode: "toggle",
allowItemReordering: false
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function(device) {
return "ios" === device.platform
},
options: {
menuMode: "slide",
itemDeleteMode: "slideItem"
}
}, {
device: {
platform: "android"
},
options: {
itemDeleteMode: "swipe"
}
}, {
device: {
platform: "win"
},
options: {
itemDeleteMode: "context"
}
}, {
device: {
platform: "generic"
},
options: {
itemDeleteMode: "static"
}
}])
},
_init: function() {
this.callBase();
this._initEditProvider()
},
_initEditProvider: function() {
this._editProvider = new EditProvider(this)
},
_disposeEditProvider: function() {
if (this._editProvider) {
this._editProvider.dispose()
}
},
_refreshEditProvider: function() {
this._disposeEditProvider();
this._initEditProvider()
},
_initEditStrategy: function(grouped) {
if (this.option("grouped")) {
this._editStrategy = new GroupedEditStrategy(this)
} else {
this.callBase()
}
},
_render: function() {
this._refreshEditProvider();
this.callBase()
},
_renderItems: function() {
this.callBase.apply(this, arguments);
this._editProvider.afterItemsRendered()
},
_selectedItemClass: function() {
return LIST_ITEM_SELECTED_CLASS
},
_itemResponseWaitClass: function() {
return LIST_ITEM_RESPONSE_WAIT_CLASS
},
_itemClickHandler: function(e) {
var $itemElement = $(e.currentTarget);
if ($itemElement.is(".dx-state-disabled, .dx-state-disabled *")) {
return
}
var handledByEditProvider = this._editProvider.handleClick($itemElement, e);
if (handledByEditProvider) {
return
}
this.callBase.apply(this, arguments)
},
_shouldAttachContextMenuEvent: function() {
return this.callBase.apply(this, arguments) || this._editProvider.contextMenuHandlerExists()
},
_itemHoldHandler: function(e) {
var $itemElement = $(e.currentTarget);
if ($itemElement.is(".dx-state-disabled, .dx-state-disabled *")) {
return
}
var isTouchEvent = eventUtils.isTouchEvent(e),
handledByEditProvider = isTouchEvent && this._editProvider.handleContextMenu($itemElement, e);
if (handledByEditProvider) {
e.handledByEditProvider = true;
return
}
this.callBase.apply(this, arguments)
},
_itemContextMenuHandler: function(e) {
var $itemElement = $(e.currentTarget);
if ($itemElement.is(".dx-state-disabled, .dx-state-disabled *")) {
return
}
var handledByEditProvider = !e.handledByEditProvider && this._editProvider.handleContextMenu($itemElement, e);
if (handledByEditProvider) {
e.preventDefault();
return
}
this.callBase.apply(this, arguments)
},
_postprocessRenderItem: function(args) {
this.callBase.apply(this, arguments);
this._editProvider.modifyItemElement(args)
},
_clean: function() {
this._disposeEditProvider();
this.callBase()
},
_optionChanged: function(args) {
switch (args.name) {
case "grouped":
this._clearSelectedItems();
delete this._renderingGroupIndex;
this._initEditStrategy(args.value);
this.callBase(args);
break;
case "showSelectionControls":
case "menuItems":
case "menuMode":
case "allowItemDeleting":
case "itemDeleteMode":
case "allowItemReordering":
case "selectAllText":
this._invalidate();
break;
case "onSelectAllValueChanged":
break;
default:
this.callBase(args)
}
},
getFlatIndexByItemElement: function(itemElement) {
return this._itemElements().index(itemElement)
},
getItemElementByFlatIndex: function(flatIndex) {
var $itemElements = this._itemElements();
if (flatIndex < 0 || flatIndex >= $itemElements.length) {
return $()
}
return $itemElements.eq(flatIndex)
},
getItemByIndex: function(index) {
return this._getItemData(this._itemElements().eq(index))
}
});
module.exports = ListEdit
},
/*!**********************************************************!*\
!*** ./Scripts/ui/list/ui.list.edit.strategy.grouped.js ***!
\**********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
errors = __webpack_require__( /*! ../widget/ui.errors */ 10),
EditStrategy = __webpack_require__( /*! ../collection/ui.collection_widget.edit.strategy.plain */ 166);
var LIST_ITEM_CLASS = "dx-list-item",
LIST_GROUP_CLASS = "dx-list-group";
var SELECTION_SHIFT = 20,
SELECTION_MASK = 2303;
var combineIndex = function(indices) {
return (indices.group << SELECTION_SHIFT) + indices.item
};
var splitIndex = function(combinedIndex) {
return {
group: combinedIndex >> SELECTION_SHIFT,
item: combinedIndex & SELECTION_MASK
}
};
var createGroupSelection = function(group, selectedItems) {
var groupItems = group.items,
groupSelection = {
key: group.key,
items: []
};
$.each(selectedItems, function(_, itemIndex) {
groupSelection.items.push(groupItems[itemIndex])
});
return groupSelection
};
var groupByKey = function(groups, key) {
var length = groups.length;
for (var i = 0; i < length; i++) {
if (groups[i].key === key) {
return groups[i]
}
}
};
var GroupedEditStrategy = EditStrategy.inherit({
_groupElements: function() {
return this._collectionWidget._itemContainer().find("." + LIST_GROUP_CLASS)
},
_groupItemElements: function($group) {
return $group.find("." + LIST_ITEM_CLASS)
},
getIndexByItemData: function(itemData) {
var groups = this._collectionWidget.option("items"),
index = false;
$.each(groups, function(groupIndex, group) {
if (!group.items) {
return false
}
$.each(group.items, function(itemIndex, item) {
if (item !== itemData) {
return true
}
index = {
group: groupIndex,
item: itemIndex
};
return false
});
if (index) {
return false
}
});
return index
},
getItemDataByIndex: function(index) {
if (!index || !index.group || !index.item) {
return null
}
var items = this._collectionWidget.option("items");
return items.length && items[index.group].items[index.item] || null
},
deleteItemAtIndex: function(index) {
var indices = splitIndex(index),
itemGroup = this._collectionWidget.option("items")[indices.group].items;
itemGroup.splice(indices.item, 1)
},
updateSelectionAfterDelete: function(fromIndex) {
var deletedIndices = splitIndex(fromIndex),
selectedItemIndices = this._collectionWidget._selectedItemIndices;
$.each(selectedItemIndices, function(i, index) {
var indices = splitIndex(index);
if (indices.group === deletedIndices.group && indices.item > deletedIndices.item) {
selectedItemIndices[i] -= 1
}
})
},
fetchSelectedItems: function(indices) {
indices = indices || this._collectionWidget._selectedItemIndices;
indices.sort(function(a, b) {
return a - b
});
var items = this._collectionWidget.option("items"),
selectedItems = [];
var currentGroupIndex = 0,
groupSelectedIndices = [];
$.each(indices, function(_, combinedIndex) {
var index = splitIndex(combinedIndex);
if (index.group !== currentGroupIndex && groupSelectedIndices.length) {
selectedItems.push(createGroupSelection(items[currentGroupIndex], groupSelectedIndices));
groupSelectedIndices.length = 0
}
currentGroupIndex = index.group;
groupSelectedIndices.push(index.item)
});
if (groupSelectedIndices.length) {
selectedItems.push(createGroupSelection(items[currentGroupIndex], groupSelectedIndices))
}
return selectedItems
},
selectedItemIndices: function() {
var selectedIndices = [],
items = this._collectionWidget.option("items"),
selected = this._collectionWidget.option("selectedItems"),
dataSource = this._collectionWidget._dataSource;
$.each(selected, function(_, selectionInGroup) {
var group = groupByKey(items, selectionInGroup.key),
groupIndex = $.inArray(group, items);
if (!group) {
if (!dataSource) {
errors.log("W1003", selectionInGroup.key)
}
return
}
$.each(selectionInGroup.items, function(_, selectedGroupItem) {
var itemIndex = $.inArray(selectedGroupItem, group.items);
if (itemIndex !== -1) {
selectedIndices.push(combineIndex({
group: groupIndex,
item: itemIndex
}))
} else {
if (!dataSource) {
errors.log("W1004", selectedGroupItem, selectionInGroup.key)
}
}
})
});
return selectedIndices
},
moveItemAtIndexToIndex: function(movingIndex, destinationIndex) {
var items = this._collectionWidget.option("items"),
movingIndices = splitIndex(movingIndex),
destinationIndices = splitIndex(destinationIndex),
movingItemGroup = items[movingIndices.group].items,
destinationItemGroup = items[destinationIndices.group].items,
movedItemData = movingItemGroup[movingIndices.item];
movingItemGroup.splice(movingIndices.item, 1);
destinationItemGroup.splice(destinationIndices.item, 0, movedItemData)
},
getSelectedItemsAfterReorderItem: function(movingIndex, destinationIndex) {
if (this._itemsFromSameParent(movingIndex, destinationIndex) || $.inArray(movingIndex, this._collectionWidget._selectedItemIndices)) {
return this.callBase()
}
var items = this._collectionWidget.option("items"),
selectedItems = this._collectionWidget.option("selectedItems"),
movingIndices = splitIndex(movingIndex),
destinationIndices = splitIndex(destinationIndex),
movingSelectedItemGroup = selectedItems[movingIndices.group].items,
destinationSelectedItemGroup = selectedItems[destinationIndices.group].items,
movedItemData = items[movingIndices.group].items[movingIndices.item],
movedItemSelectedIndex = $.inArray(movedItemData, movingSelectedItemGroup);
movingSelectedItemGroup.splice(movedItemSelectedIndex, 1);
destinationSelectedItemGroup.push(movedItemData);
return selectedItems
},
_isItemIndex: function(index) {
return $.isNumeric(index.group) && $.isNumeric(index.item)
},
_getNormalizedItemIndex: function(itemElement) {
var $item = $(itemElement),
$group = $item.closest("." + LIST_GROUP_CLASS);
if (!$group.length) {
return -1
}
return combineIndex({
group: this._groupElements().index($group),
item: this._groupItemElements($group).index($item)
})
},
_normalizeItemIndex: function(index) {
return combineIndex(index)
},
_denormalizeItemIndex: function(index) {
return splitIndex(index)
},
_getItemByNormalizedIndex: function(index) {
var indices = splitIndex(index),
$group = this._groupElements().eq(indices.group);
return this._groupItemElements($group).eq(indices.item)
},
_itemsFromSameParent: function(firstIndex, secondIndex) {
return splitIndex(firstIndex).group === splitIndex(secondIndex).group
}
});
module.exports = GroupedEditStrategy
},
/*!**************************************************!*\
!*** ./Scripts/ui/list/ui.list.edit.provider.js ***!
\**************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
errors = __webpack_require__( /*! ../widget/ui.errors */ 10),
decoratorRegistry = __webpack_require__( /*! ./ui.list.edit.decorator_registry */ 217);
__webpack_require__( /*! ./ui.list.edit.decorator.static */ 218);
__webpack_require__( /*! ./ui.list.edit.decorator.switchable.button */ 220);
__webpack_require__( /*! ./ui.list.edit.decorator.switchable.slide */ 222);
__webpack_require__( /*! ./ui.list.edit.decorator.swipe */ 224);
__webpack_require__( /*! ./ui.list.edit.decorator.context */ 225);
__webpack_require__( /*! ./ui.list.edit.decorator.selection */ 240);
__webpack_require__( /*! ./ui.list.edit.decorator.reorder */ 243);
var editOptionsRegistry = [];
var registerOption = function(enabledFunc, decoratorTypeFunc, decoratorSubTypeFunc) {
editOptionsRegistry.push({
enabled: enabledFunc,
decoratorType: decoratorTypeFunc,
decoratorSubType: decoratorSubTypeFunc
})
};
registerOption(function() {
return this.option("menuItems").length
}, function() {
return "menu"
}, function() {
return this.option("menuMode")
});
registerOption(function() {
return !this.option("menuItems").length && this.option("allowItemDeleting")
}, function() {
var mode = this.option("itemDeleteMode");
return "toggle" === mode || "slideButton" === mode || "swipe" === mode || "static" === mode ? "delete" : "menu"
}, function() {
var mode = this.option("itemDeleteMode");
if ("slideItem" === mode) {
mode = "slide"
}
if ("hold" === mode) {
mode = "context"
}
return mode
});
registerOption(function() {
return "none" !== this.option("selectionMode") && this.option("showSelectionControls")
}, function() {
return "selection"
}, function() {
return "default"
});
registerOption(function() {
return this.option("allowItemReordering")
}, function() {
return "reorder"
}, function() {
return "default"
});
var LIST_ITEM_BEFORE_BAG_CLASS = "dx-list-item-before-bag",
LIST_ITEM_AFTER_BAG_CLASS = "dx-list-item-after-bag",
DECORATOR_BEFORE_BAG_CREATE_METHOD = "beforeBag",
DECORATOR_AFTER_BAG_CREATE_METHOD = "afterBag",
DECORATOR_MODIFY_ELEMENT_METHOD = "modifyElement",
DECORATOR_AFTER_RENDER_METHOD = "afterRender";
var EditProvider = Class.inherit({
ctor: function(list) {
this._list = list;
this._fetchRequiredDecorators()
},
dispose: function() {
if (this._decorators && this._decorators.length) {
$.each(this._decorators, function(_, decorator) {
decorator.dispose()
})
}
},
_fetchRequiredDecorators: function() {
this._decorators = [];
$.each(editOptionsRegistry, $.proxy(function(_, option) {
var optionEnabled = option.enabled.call(this._list);
if (optionEnabled) {
var decoratorType = option.decoratorType.call(this._list),
decoratorSubType = option.decoratorSubType.call(this._list),
decorator = this._createDecorator(decoratorType, decoratorSubType);
this._decorators.push(decorator)
}
}, this))
},
_createDecorator: function(type, subType) {
var decoratorClass = this._findDecorator(type, subType);
return new decoratorClass(this._list)
},
_findDecorator: function(type, subType) {
var foundDecorator = decoratorRegistry.registry[type][subType];
if (!foundDecorator) {
throw errors.Error("E1012", type, subType)
}
return foundDecorator
},
modifyItemElement: function(args) {
var $itemElement = $(args.itemElement);
var config = {
$itemElement: $itemElement
};
this._prependBeforeBags($itemElement, config);
this._appendAfterBags($itemElement, config);
this._applyDecorators(DECORATOR_MODIFY_ELEMENT_METHOD, config)
},
afterItemsRendered: function() {
this._applyDecorators(DECORATOR_AFTER_RENDER_METHOD)
},
_prependBeforeBags: function($itemElement, config) {
var $beforeBags = this._collectDecoratorsMarkup(DECORATOR_BEFORE_BAG_CREATE_METHOD, config, LIST_ITEM_BEFORE_BAG_CLASS);
$itemElement.prepend($beforeBags)
},
_appendAfterBags: function($itemElement, config) {
var $afterBags = this._collectDecoratorsMarkup(DECORATOR_AFTER_BAG_CREATE_METHOD, config, LIST_ITEM_AFTER_BAG_CLASS);
$itemElement.append($afterBags)
},
_collectDecoratorsMarkup: function(method, config, containerClass) {
var $collector = $("");
$.each(this._decorators, function() {
var $container = $("").addClass(containerClass);
this[method]($.extend({
$container: $container
}, config));
if ($container.children().length) {
$collector.append($container)
}
});
return $collector.children()
},
_applyDecorators: function(method, config) {
$.each(this._decorators, function() {
this[method](config)
})
},
_handlerExists: function(name) {
if (!this._decorators) {
return false
}
var decorators = this._decorators,
length = decorators.length;
for (var i = 0; i < length; i++) {
if (decorators[i][name] !== $.noop) {
return true
}
}
return false
},
_eventHandler: function(name, $itemElement, e) {
if (!this._decorators) {
return false
}
var response = false,
decorators = this._decorators,
length = decorators.length;
for (var i = 0; i < length; i++) {
response = decorators[i][name]($itemElement, e);
if (response) {
break
}
}
return response
},
handleClick: function($itemElement, e) {
return this._eventHandler("handleClick", $itemElement, e)
},
contextMenuHandlerExists: function() {
return this._handlerExists("handleContextMenu")
},
handleContextMenu: function($itemElement, e) {
return this._eventHandler("handleContextMenu", $itemElement, e)
}
});
module.exports = EditProvider
},
/*!************************************************************!*\
!*** ./Scripts/ui/list/ui.list.edit.decorator_registry.js ***!
\************************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9);
exports.registry = {};
exports.register = function(option, type, decoratorClass) {
var decoratorsRegistry = exports.registry;
var decoratorConfig = {};
decoratorConfig[option] = decoratorsRegistry[option] ? decoratorsRegistry[option] : {};
decoratorConfig[option][type] = decoratorClass;
decoratorsRegistry = $.extend(decoratorsRegistry, decoratorConfig)
}
},
/*!**********************************************************!*\
!*** ./Scripts/ui/list/ui.list.edit.decorator.static.js ***!
\**********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Button = __webpack_require__( /*! ../button */ 196),
registerDecorator = __webpack_require__( /*! ./ui.list.edit.decorator_registry */ 217).register,
EditDecorator = __webpack_require__( /*! ./ui.list.edit.decorator */ 219);
var STATIC_DELETE_BUTTON_CONTAINER_CLASS = "dx-list-static-delete-button-container",
STATIC_DELETE_BUTTON_CLASS = "dx-list-static-delete-button";
registerDecorator("delete", "static", EditDecorator.inherit({
afterBag: function(config) {
var $itemElement = config.$itemElement,
$container = config.$container;
var $button = $("").addClass(STATIC_DELETE_BUTTON_CLASS);
this._list._createComponent($button, Button, {
icon: "remove",
onClick: $.proxy(function(args) {
args.jQueryEvent.stopPropagation();
this._deleteItem($itemElement)
}, this),
_templates: {}
});
$container.addClass(STATIC_DELETE_BUTTON_CONTAINER_CLASS).append($button)
},
_deleteItem: function($itemElement) {
if ($itemElement.is(".dx-state-disabled, .dx-state-disabled *")) {
return
}
this._list.deleteItem($itemElement)
}
}))
},
/*!***************************************************!*\
!*** ./Scripts/ui/list/ui.list.edit.decorator.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
Class = __webpack_require__( /*! ../../core/class */ 20),
swipeEvents = __webpack_require__( /*! ../../events/swipe */ 178),
eventUtils = __webpack_require__( /*! ../../events/utils */ 62);
var LIST_EDIT_DECORATOR = "dxListEditDecorator",
SWIPE_START_EVENT_NAME = eventUtils.addNamespace(swipeEvents.start, LIST_EDIT_DECORATOR),
SWIPE_UPDATE_EVENT_NAME = eventUtils.addNamespace(swipeEvents.swipe, LIST_EDIT_DECORATOR),
SWIPE_END_EVENT_NAME = eventUtils.addNamespace(swipeEvents.end, LIST_EDIT_DECORATOR);
var EditDecorator = Class.inherit({
ctor: function(list) {
this._list = list;
this._init()
},
_init: $.noop,
_shouldHandleSwipe: false,
_attachSwipeEvent: function(config) {
var swipeConfig = {
itemSizeFunc: $.proxy(function() {
if (this._clearSwipeCache) {
this._itemWidthCache = this._list.element().width();
this._clearSwipeCache = false
}
return this._itemWidthCache
}, this)
};
config.$itemElement.on(SWIPE_START_EVENT_NAME, swipeConfig, $.proxy(this._itemSwipeStartHandler, this)).on(SWIPE_UPDATE_EVENT_NAME, $.proxy(this._itemSwipeUpdateHandler, this)).on(SWIPE_END_EVENT_NAME, $.proxy(this._itemSwipeEndHandler, this))
},
_itemSwipeStartHandler: function(e) {
var $itemElement = $(e.currentTarget);
if ($itemElement.is(".dx-state-disabled, .dx-state-disabled *")) {
e.cancel = true;
return
}
this._swipeStartHandler($itemElement, e)
},
_itemSwipeUpdateHandler: function(e) {
var $itemElement = $(e.currentTarget);
this._swipeUpdateHandler($itemElement, e)
},
_itemSwipeEndHandler: function(e) {
var $itemElement = $(e.currentTarget);
this._swipeEndHandler($itemElement, e);
this._clearSwipeCache = true
},
beforeBag: $.noop,
afterBag: $.noop,
_commonOptions: function() {
return {
activeStateEnabled: this._list.option("activeStateEnabled"),
hoverStateEnabled: this._list.option("hoverStateEnabled"),
focusStateEnabled: this._list.option("focusStateEnabled")
}
},
modifyElement: function(config) {
if (this._shouldHandleSwipe) {
this._attachSwipeEvent(config);
this._clearSwipeCache = true
}
},
afterRender: $.noop,
handleClick: $.noop,
handleContextMenu: $.noop,
_swipeStartHandler: $.noop,
_swipeUpdateHandler: $.noop,
_swipeEndHandler: $.noop,
visibilityChange: $.noop,
dispose: $.noop
});
module.exports = EditDecorator
},
/*!*********************************************************************!*\
!*** ./Scripts/ui/list/ui.list.edit.decorator.switchable.button.js ***!
\*********************************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
fx = __webpack_require__( /*! ../../animation/fx */ 59),
Button = __webpack_require__( /*! ../button */ 196),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 80),
registerDecorator = __webpack_require__( /*! ./ui.list.edit.decorator_registry */ 217).register,
SwitchableEditDecorator = __webpack_require__( /*! ./ui.list.edit.decorator.switchable */ 221);
var SWITCHABLE_DELETE_BUTTON_CONTAINER_CLASS = "dx-list-switchable-delete-button-container",
SWITCHABLE_DELETE_BUTTON_WRAPPER_CLASS = "dx-list-switchable-delete-button-wrapper",
SWITCHABLE_DELETE_BUTTON_INNER_WRAPPER_CLASS = "dx-list-switchable-delete-button-inner-wrapper",
SWITCHABLE_DELETE_BUTTON_CLASS = "dx-list-switchable-delete-button",
SWITCHABLE_DELETE_BUTTON_ANIMATION_DURATION = 200;
var SwitchableButtonEditDecorator = SwitchableEditDecorator.inherit({
_init: function() {
this.callBase.apply(this, arguments);
var $buttonContainer = $("
").addClass(SWITCHABLE_DELETE_BUTTON_CONTAINER_CLASS),
$buttonWrapper = $("
").addClass(SWITCHABLE_DELETE_BUTTON_WRAPPER_CLASS),
$buttonInnerWrapper = $("
").addClass(SWITCHABLE_DELETE_BUTTON_INNER_WRAPPER_CLASS),
$button = $("
").addClass(SWITCHABLE_DELETE_BUTTON_CLASS);
this._list._createComponent($button, Button, {
text: messageLocalization.format("dxListEditDecorator-delete"),
type: "danger",
onClick: $.proxy(function(e) {
this._deleteItem();
e.jQueryEvent.stopPropagation()
}, this),
_templates: {}
});
$buttonContainer.append($buttonWrapper);
$buttonWrapper.append($buttonInnerWrapper);
$buttonInnerWrapper.append($button);
this._$buttonContainer = $buttonContainer
},
_enablePositioning: function($itemElement) {
this.callBase.apply(this, arguments);
fx.stop(this._$buttonContainer, true);
this._$buttonContainer.appendTo($itemElement)
},
_disablePositioning: function() {
this.callBase.apply(this, arguments);
this._$buttonContainer.detach()
},
_animatePrepareDeleteReady: function() {
var rtl = this._isRtlEnabled(),
listWidth = this._list.element().width(),
buttonWidth = this._buttonWidth(),
fromValue = rtl ? listWidth : -buttonWidth,
toValue = rtl ? listWidth - buttonWidth : 0;
return fx.animate(this._$buttonContainer, {
type: "custom",
duration: SWITCHABLE_DELETE_BUTTON_ANIMATION_DURATION,
from: {
right: fromValue
},
to: {
right: toValue
}
})
},
_animateForgetDeleteReady: function() {
var rtl = this._isRtlEnabled(),
listWidth = this._list.element().width(),
buttonWidth = this._buttonWidth(),
fromValue = rtl ? listWidth - buttonWidth : 0,
toValue = rtl ? listWidth : -buttonWidth;
return fx.animate(this._$buttonContainer, {
type: "custom",
duration: SWITCHABLE_DELETE_BUTTON_ANIMATION_DURATION,
from: {
right: fromValue
},
to: {
right: toValue
}
})
},
_buttonWidth: function() {
if (!this._buttonContainerWidth) {
this._buttonContainerWidth = this._$buttonContainer.outerWidth()
}
return this._buttonContainerWidth
},
dispose: function() {
if (this._$buttonContainer) {
this._$buttonContainer.remove()
}
this.callBase.apply(this, arguments)
}
});
var TOGGLE_DELETE_SWITCH_CONTAINER_CLASS = "dx-list-toggle-delete-switch-container",
TOGGLE_DELETE_SWITCH_CLASS = "dx-list-toggle-delete-switch";
registerDecorator("delete", "toggle", SwitchableButtonEditDecorator.inherit({
beforeBag: function(config) {
var $itemElement = config.$itemElement,
$container = config.$container;
var $toggle = $("
").addClass(TOGGLE_DELETE_SWITCH_CLASS);
this._list._createComponent($toggle, Button, {
icon: "toggle-delete",
onClick: $.proxy(function(e) {
this._toggleDeleteReady($itemElement);
e.jQueryEvent.stopPropagation()
}, this),
_templates: {}
});
$container.addClass(TOGGLE_DELETE_SWITCH_CONTAINER_CLASS);
$container.append($toggle)
}
}));
registerDecorator("delete", "slideButton", SwitchableButtonEditDecorator.inherit({
_shouldHandleSwipe: true,
_swipeEndHandler: function($itemElement, args) {
if (0 !== args.targetOffset) {
this._toggleDeleteReady($itemElement)
}
return true
}
}));
module.exports = SwitchableButtonEditDecorator
},
/*!**************************************************************!*\
!*** ./Scripts/ui/list/ui.list.edit.decorator.switchable.js ***!
\**************************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
EditDecorator = __webpack_require__( /*! ./ui.list.edit.decorator */ 219),
abstract = EditDecorator.abstract,
eventUtils = __webpack_require__( /*! ../../events/utils */ 62),
pointerEvents = __webpack_require__( /*! ../../events/pointer */ 65),
feedbackEvents = __webpack_require__( /*! ../../events/core/emitter.feedback */ 103);
var LIST_EDIT_DECORATOR = "dxListEditDecorator",
POINTER_DOWN_EVENT_NAME = eventUtils.addNamespace(pointerEvents.down, LIST_EDIT_DECORATOR),
ACTIVE_EVENT_NAME = eventUtils.addNamespace(feedbackEvents.active, LIST_EDIT_DECORATOR),
LIST_ITEM_CONTENT_CLASS = "dx-list-item-content",
SWITCHABLE_DELETE_READY_CLASS = "dx-list-switchable-delete-ready",
SWITCHABLE_MENU_SHIELD_POSITIONING_CLASS = "dx-list-switchable-menu-shield-positioning",
SWITCHABLE_DELETE_TOP_SHIELD_CLASS = "dx-list-switchable-delete-top-shield",
SWITCHABLE_DELETE_BOTTOM_SHIELD_CLASS = "dx-list-switchable-delete-bottom-shield",
SWITCHABLE_MENU_ITEM_SHIELD_POSITIONING_CLASS = "dx-list-switchable-menu-item-shield-positioning",
SWITCHABLE_DELETE_ITEM_CONTENT_SHIELD_CLASS = "dx-list-switchable-delete-item-content-shield";
var SwitchableEditDecorator = EditDecorator.inherit({
_init: function() {
this._$topShield = $("
").addClass(SWITCHABLE_DELETE_TOP_SHIELD_CLASS);
this._$bottomShield = $("
").addClass(SWITCHABLE_DELETE_BOTTOM_SHIELD_CLASS);
this._$itemContentShield = $("
").addClass(SWITCHABLE_DELETE_ITEM_CONTENT_SHIELD_CLASS);
this._$topShield.on(POINTER_DOWN_EVENT_NAME, $.proxy(this._cancelDeleteReadyItem, this));
this._$bottomShield.on(POINTER_DOWN_EVENT_NAME, $.proxy(this._cancelDeleteReadyItem, this));
this._list.element().append(this._$topShield.toggle(false)).append(this._$bottomShield.toggle(false))
},
handleClick: function($itemElement) {
return this._cancelDeleteReadyItem()
},
_cancelDeleteReadyItem: function() {
if (!this._$readyToDeleteItem) {
return false
}
this._cancelDelete(this._$readyToDeleteItem);
return true
},
_cancelDelete: function($itemElement) {
this._toggleDeleteReady($itemElement, false)
},
_toggleDeleteReady: function($itemElement, readyToDelete) {
if (void 0 === readyToDelete) {
readyToDelete = !this._isReadyToDelete($itemElement)
}
this._toggleShields($itemElement, readyToDelete);
this._toggleScrolling(readyToDelete);
this._cacheReadyToDeleteItem($itemElement, readyToDelete);
this._animateToggleDelete($itemElement, readyToDelete)
},
_isReadyToDelete: function($itemElement) {
return $itemElement.hasClass(SWITCHABLE_DELETE_READY_CLASS)
},
_toggleShields: function($itemElement, enabled) {
this._list.element().toggleClass(SWITCHABLE_MENU_SHIELD_POSITIONING_CLASS, enabled);
this._$topShield.toggle(enabled);
this._$bottomShield.toggle(enabled);
if (enabled) {
this._updateShieldsHeight($itemElement)
}
this._toggleContentShield($itemElement, enabled)
},
_updateShieldsHeight: function($itemElement) {
var $list = this._list.element(),
listTopOffset = $list.offset().top,
listHeight = $list.outerHeight(),
itemTopOffset = $itemElement.offset().top,
itemHeight = $itemElement.outerHeight(),
dirtyTopShieldHeight = itemTopOffset - listTopOffset,
dirtyBottomShieldHeight = listHeight - itemHeight - dirtyTopShieldHeight;
this._$topShield.height(Math.max(dirtyTopShieldHeight, 0));
this._$bottomShield.height(Math.max(dirtyBottomShieldHeight, 0))
},
_toggleContentShield: function($itemElement, enabled) {
if (enabled) {
$itemElement.find("." + LIST_ITEM_CONTENT_CLASS).first().append(this._$itemContentShield)
} else {
this._$itemContentShield.detach()
}
},
_toggleScrolling: function(readyToDelete) {
var scrollView = this._list.element().dxScrollView("instance");
if (readyToDelete) {
scrollView.on("start", this._cancelScrolling)
} else {
scrollView.off("start", this._cancelScrolling)
}
},
_cancelScrolling: function(args) {
args.jQueryEvent.cancel = true
},
_cacheReadyToDeleteItem: function($itemElement, cache) {
if (cache) {
this._$readyToDeleteItem = $itemElement
} else {
delete this._$readyToDeleteItem
}
},
_animateToggleDelete: function($itemElement, readyToDelete) {
if (readyToDelete) {
this._enablePositioning($itemElement);
this._prepareDeleteReady($itemElement);
this._animatePrepareDeleteReady($itemElement)
} else {
this._forgetDeleteReady($itemElement);
this._animateForgetDeleteReady($itemElement).done($.proxy(this._disablePositioning, this, $itemElement))
}
},
_enablePositioning: function($itemElement) {
$itemElement.addClass(SWITCHABLE_MENU_ITEM_SHIELD_POSITIONING_CLASS);
$itemElement.on(ACTIVE_EVENT_NAME, $.noop)
},
_disablePositioning: function($itemElement) {
$itemElement.removeClass(SWITCHABLE_MENU_ITEM_SHIELD_POSITIONING_CLASS);
$itemElement.off(ACTIVE_EVENT_NAME)
},
_prepareDeleteReady: function($itemElement) {
$itemElement.addClass(SWITCHABLE_DELETE_READY_CLASS)
},
_forgetDeleteReady: function($itemElement) {
$itemElement.removeClass(SWITCHABLE_DELETE_READY_CLASS)
},
_animatePrepareDeleteReady: abstract,
_animateForgetDeleteReady: abstract,
_deleteItem: function($itemElement) {
$itemElement = $itemElement || this._$readyToDeleteItem;
if ($itemElement.is(".dx-state-disabled, .dx-state-disabled *")) {
return
}
this._list.deleteItem($itemElement).always($.proxy(this._cancelDelete, this, $itemElement))
},
_isRtlEnabled: function() {
return this._list.option("rtlEnabled")
},
dispose: function() {
if (this._$topShield) {
this._$topShield.remove()
}
if (this._$bottomShield) {
this._$bottomShield.remove()
}
this.callBase.apply(this, arguments)
}
});
module.exports = SwitchableEditDecorator
},
/*!********************************************************************!*\
!*** ./Scripts/ui/list/ui.list.edit.decorator.switchable.slide.js ***!
\********************************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
clickEvent = __webpack_require__( /*! ../../events/click */ 64),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 80),
translator = __webpack_require__( /*! ../../animation/translator */ 60),
eventUtils = __webpack_require__( /*! ../../events/utils */ 62),
feedbackEvents = __webpack_require__( /*! ../../events/core/emitter.feedback */ 103),
EditDecoratorMenuHelperMixin = __webpack_require__( /*! ./ui.list.edit.decorator_menu_helper */ 223),
registerDecorator = __webpack_require__( /*! ./ui.list.edit.decorator_registry */ 217).register,
SwitchableEditDecorator = __webpack_require__( /*! ./ui.list.edit.decorator.switchable */ 221),
fx = __webpack_require__( /*! ../../animation/fx */ 59),
ActionSheet = __webpack_require__( /*! ../action_sheet */ 201);
var LIST_EDIT_DECORATOR = "dxListEditDecorator",
CLICK_EVENT_NAME = eventUtils.addNamespace(clickEvent.name, LIST_EDIT_DECORATOR),
ACTIVE_EVENT_NAME = eventUtils.addNamespace(feedbackEvents.active, LIST_EDIT_DECORATOR),
SLIDE_MENU_CLASS = "dx-list-slide-menu",
SLIDE_MENU_WRAPPER_CLASS = "dx-list-slide-menu-wrapper",
SLIDE_MENU_CONTENT_CLASS = "dx-list-slide-menu-content",
SLIDE_MENU_BUTTONS_CONTAINER_CLASS = "dx-list-slide-menu-buttons-container",
SLIDE_MENU_BUTTONS_CLASS = "dx-list-slide-menu-buttons",
SLIDE_MENU_BUTTON_CLASS = "dx-list-slide-menu-button",
SLIDE_MENU_BUTTON_MENU_CLASS = "dx-list-slide-menu-button-menu",
SLIDE_MENU_BUTTON_DELETE_CLASS = "dx-list-slide-menu-button-delete",
SLIDE_MENU_ANIMATION_DURATION = 400,
SLIDE_MENU_ANIMATION_EASING = "cubic-bezier(0.075, 0.82, 0.165, 1)";
registerDecorator("menu", "slide", SwitchableEditDecorator.inherit({
_shouldHandleSwipe: true,
_init: function() {
this.callBase.apply(this, arguments);
this._$buttonsContainer = $("
").addClass(SLIDE_MENU_BUTTONS_CONTAINER_CLASS).on(ACTIVE_EVENT_NAME, $.noop);
this._$buttons = $("
").addClass(SLIDE_MENU_BUTTONS_CLASS).appendTo(this._$buttonsContainer);
this._renderMenu();
this._renderDeleteButton()
},
_renderMenu: function() {
if (!this._menuEnabled()) {
return
}
var menuItems = this._menuItems();
if (1 === menuItems.length) {
var menuItem = menuItems[0];
this._renderMenuButton(menuItem.text, $.proxy(function(e) {
e.stopPropagation();
this._fireAction(menuItem)
}, this))
} else {
var $menu = $("
").addClass(SLIDE_MENU_CLASS);
this._menu = this._list._createComponent($menu, ActionSheet, {
showTitle: false,
items: menuItems,
onItemClick: $.proxy(function(args) {
this._fireAction(args.itemData)
}, this),
_templates: {}
});
$menu.appendTo(this._list.element());
var $menuButton = this._renderMenuButton(messageLocalization.format("dxListEditDecorator-more"), $.proxy(function(e) {
e.stopPropagation();
this._menu.show()
}, this));
this._menu.option("target", $menuButton)
}
},
_renderMenuButton: function(text, action) {
var $menuButton = $("
").addClass(SLIDE_MENU_BUTTON_CLASS).addClass(SLIDE_MENU_BUTTON_MENU_CLASS).text(text);
this._$buttons.append($menuButton);
$menuButton.on(CLICK_EVENT_NAME, action);
return $menuButton
},
_renderDeleteButton: function() {
if (!this._deleteEnabled()) {
return
}
var $deleteButton = $("
").addClass(SLIDE_MENU_BUTTON_CLASS).addClass(SLIDE_MENU_BUTTON_DELETE_CLASS).text(messageLocalization.format("dxListEditDecorator-delete"));
$deleteButton.on(CLICK_EVENT_NAME, $.proxy(function(e) {
e.stopPropagation();
this._deleteItem()
}, this));
this._$buttons.append($deleteButton)
},
_fireAction: function(menuItem) {
this._fireMenuAction($(this._cachedNode), menuItem.action);
this._cancelDeleteReadyItem()
},
modifyElement: function(config) {
this.callBase.apply(this, arguments);
var $itemElement = config.$itemElement;
$itemElement.addClass(SLIDE_MENU_WRAPPER_CLASS);
var $slideMenuContent = $("
").addClass(SLIDE_MENU_CONTENT_CLASS);
$itemElement.wrapInner($slideMenuContent)
},
handleClick: function(_, e) {
if ($(e.target).closest("." + SLIDE_MENU_CONTENT_CLASS).length) {
return this.callBase.apply(this, arguments)
}
return false
},
_swipeStartHandler: function($itemElement) {
this._enablePositioning($itemElement);
this._cacheItemData($itemElement);
this._setPositions(this._getPositions(0))
},
_swipeUpdateHandler: function($itemElement, args) {
var rtl = this._isRtlEnabled(),
signCorrection = rtl ? -1 : 1,
isItemReadyToDelete = this._isReadyToDelete($itemElement),
moveJustStarted = this._getCurrentPositions().content === this._getStartPositions().content;
if (moveJustStarted && !isItemReadyToDelete && args.offset * signCorrection > 0) {
args.cancel = true;
return
}
var offset = this._cachedItemWidth * args.offset,
startOffset = isItemReadyToDelete ? -this._cachedButtonWidth * signCorrection : 0,
correctedOffset = (offset + startOffset) * signCorrection,
percent = correctedOffset < 0 ? Math.abs((offset + startOffset) / this._cachedButtonWidth) : 0;
this._setPositions(this._getPositions(percent));
return true
},
_getStartPositions: function() {
var rtl = this._isRtlEnabled(),
signCorrection = rtl ? -1 : 1;
return {
content: 0,
buttonsContainer: rtl ? -this._cachedButtonWidth : this._cachedItemWidth,
buttons: -this._cachedButtonWidth * signCorrection
}
},
_getPositions: function(percent) {
var rtl = this._isRtlEnabled(),
signCorrection = rtl ? -1 : 1,
startPositions = this._getStartPositions();
return {
content: startPositions.content - percent * this._cachedButtonWidth * signCorrection,
buttonsContainer: startPositions.buttonsContainer - Math.min(percent, 1) * this._cachedButtonWidth * signCorrection,
buttons: startPositions.buttons + Math.min(percent, 1) * this._cachedButtonWidth * signCorrection
}
},
_getCurrentPositions: function() {
return {
content: translator.locate(this._$cachedContent).left,
buttonsContainer: translator.locate(this._$buttonsContainer).left,
buttons: translator.locate(this._$buttons).left
}
},
_setPositions: function(positions) {
translator.move(this._$cachedContent, {
left: positions.content
});
translator.move(this._$buttonsContainer, {
left: positions.buttonsContainer
});
translator.move(this._$buttons, {
left: positions.buttons
})
},
_cacheItemData: function($itemElement) {
if ($itemElement[0] === this._cachedNode) {
return
}
this._$cachedContent = $itemElement.find("." + SLIDE_MENU_CONTENT_CLASS);
this._cachedItemWidth = $itemElement.outerWidth();
this._cachedButtonWidth = this._cachedButtonWidth || this._$buttons.outerWidth();
this._$buttonsContainer.width(this._cachedButtonWidth);
if (this._$cachedContent.length) {
this._cachedNode = $itemElement[0]
}
},
_minButtonContainerLeftOffset: function() {
return this._cachedItemWidth - this._cachedButtonWidth
},
_swipeEndHandler: function($itemElement, args) {
this._cacheItemData($itemElement);
var signCorrection = this._isRtlEnabled() ? 1 : -1,
offset = this._cachedItemWidth * args.offset,
endedAtReadyToDelete = !this._isReadyToDelete($itemElement) && offset * signCorrection > .2 * this._cachedButtonWidth,
readyToDelete = args.targetOffset === signCorrection && endedAtReadyToDelete;
this._toggleDeleteReady($itemElement, readyToDelete);
return true
},
_enablePositioning: function($itemElement) {
fx.stop(this._$cachedContent, true);
this.callBase.apply(this, arguments);
this._$buttonsContainer.appendTo($itemElement)
},
_disablePositioning: function($itemElement) {
this.callBase.apply(this, arguments);
this._$buttonsContainer.detach()
},
_animatePrepareDeleteReady: function() {
return this._animateToPositions(this._getPositions(1))
},
_animateForgetDeleteReady: function($itemElement) {
this._cacheItemData($itemElement);
return this._animateToPositions(this._getPositions(0))
},
_animateToPositions: function(positions) {
var that = this,
currentPosition = this._getCurrentPositions(),
durationTimePart = Math.min(Math.abs(currentPosition.content - positions.content) / this._cachedButtonWidth, 1);
return fx.animate(this._$cachedContent, {
from: currentPosition,
to: positions,
easing: SLIDE_MENU_ANIMATION_EASING,
duration: SLIDE_MENU_ANIMATION_DURATION * durationTimePart,
strategy: "frame",
draw: function(positions) {
that._setPositions(positions)
}
})
},
dispose: function() {
if (this._menu) {
this._menu.element().remove()
}
if (this._$buttonsContainer) {
this._$buttonsContainer.remove()
}
this.callBase.apply(this, arguments)
}
}).include(EditDecoratorMenuHelperMixin))
},
/*!***************************************************************!*\
!*** ./Scripts/ui/list/ui.list.edit.decorator_menu_helper.js ***!
\***************************************************************/
function(module, exports) {
var EditDecoratorMenuHelperMixin = {
_menuEnabled: function() {
return !!this._menuItems().length
},
_menuItems: function() {
return this._list.option("menuItems")
},
_deleteEnabled: function() {
return this._list.option("allowItemDeleting")
},
_fireMenuAction: function($itemElement, action) {
this._list._itemEventHandlerByHandler($itemElement, action, {}, {
excludeValidators: ["disabled", "readOnly"]
})
}
};
module.exports = EditDecoratorMenuHelperMixin
},
/*!*********************************************************!*\
!*** ./Scripts/ui/list/ui.list.edit.decorator.swipe.js ***!
\*********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
translator = __webpack_require__( /*! ../../animation/translator */ 60),
fx = __webpack_require__( /*! ../../animation/fx */ 59),
registerDecorator = __webpack_require__( /*! ./ui.list.edit.decorator_registry */ 217).register,
EditDecorator = __webpack_require__( /*! ./ui.list.edit.decorator */ 219);
registerDecorator("delete", "swipe", EditDecorator.inherit({
_shouldHandleSwipe: true,
_renderItemPosition: function($itemElement, offset, animate) {
var deferred = $.Deferred(),
itemOffset = offset * this._itemElementWidth;
if (animate) {
fx.animate($itemElement, {
to: {
left: itemOffset
},
type: "slide",
complete: function() {
deferred.resolve($itemElement, offset)
}
})
} else {
translator.move($itemElement, {
left: itemOffset
});
deferred.resolve()
}
return deferred.promise()
},
_swipeStartHandler: function($itemElement) {
this._itemElementWidth = $itemElement.width();
return true
},
_swipeUpdateHandler: function($itemElement, args) {
this._renderItemPosition($itemElement, args.offset);
return true
},
_swipeEndHandler: function($itemElement, args) {
var offset = args.targetOffset;
this._renderItemPosition($itemElement, offset, true).done($.proxy(function($itemElement, offset) {
if (Math.abs(offset)) {
this._list.deleteItem($itemElement).fail($.proxy(function() {
this._renderItemPosition($itemElement, 0, true)
}, this))
}
}, this));
return true
}
}))
},
/*!***********************************************************!*\
!*** ./Scripts/ui/list/ui.list.edit.decorator.context.js ***!
\***********************************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
EditDecoratorMenuHelperMixin = __webpack_require__( /*! ./ui.list.edit.decorator_menu_helper */ 223),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 80),
registerDecorator = __webpack_require__( /*! ./ui.list.edit.decorator_registry */ 217).register,
EditDecorator = __webpack_require__( /*! ./ui.list.edit.decorator */ 219),
Overlay = __webpack_require__( /*! ../overlay */ 109),
ListBase = __webpack_require__( /*! ./ui.list.base */ 226);
var CONTEXTMENU_CLASS = "dx-list-context-menu",
CONTEXTMENU_MENUCONTENT_CLASS = "dx-list-context-menucontent";
registerDecorator("menu", "context", EditDecorator.inherit({
_init: function() {
var $menu = $("
").addClass(CONTEXTMENU_CLASS);
this._list.element().append($menu);
this._menu = this._renderOverlay($menu)
},
_renderOverlay: function($element) {
return this._list._createComponent($element, Overlay, {
shading: false,
deferRendering: true,
closeOnTargetScroll: true,
closeOnOutsideClick: function(e) {
return !$(e.target).closest("." + CONTEXTMENU_CLASS).length
},
animation: {
show: {
type: "slide",
duration: 300,
from: {
height: 0,
opacity: 1
},
to: {
height: $.proxy(function() {
return this._$menuList.outerHeight()
}, this),
opacity: 1
}
},
hide: {
type: "slide",
duration: 0,
from: {
opacity: 1
},
to: {
opacity: 0
}
}
},
height: $.proxy(function() {
return this._$menuList ? this._$menuList.outerHeight() : 0
}, this),
width: $.proxy(function() {
return this._list.element().outerWidth()
}, this),
onContentReady: $.proxy(this._renderMenuContent, this)
})
},
_renderMenuContent: function(e) {
var $overlayContent = e.component.content();
var items = this._menuItems().slice();
if (this._deleteEnabled()) {
items.push({
text: messageLocalization.format("dxListEditDecorator-delete"),
action: $.proxy(this._deleteItem, this)
})
}
this._$menuList = $("
");
this._list._createComponent(this._$menuList, ListBase, {
items: items,
onItemClick: $.proxy(this._menuItemClickHandler, this),
height: "auto",
_templates: {}
});
$overlayContent.addClass(CONTEXTMENU_MENUCONTENT_CLASS);
$overlayContent.append(this._$menuList)
},
_menuItemClickHandler: function(args) {
this._menu.hide();
this._fireMenuAction(this._$itemWithMenu, args.itemData.action)
},
_deleteItem: function() {
this._list.deleteItem(this._$itemWithMenu)
},
handleContextMenu: function($itemElement) {
this._$itemWithMenu = $itemElement;
this._menu.option({
position: {
my: "top",
at: "bottom",
of: $itemElement,
collision: "flip"
}
});
this._menu.show();
return true
},
dispose: function() {
if (this._menu) {
this._menu.element().remove()
}
this.callBase.apply(this, arguments)
}
}).include(EditDecoratorMenuHelperMixin))
},
/*!*****************************************!*\
!*** ./Scripts/ui/list/ui.list.base.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var $ = __webpack_require__( /*! jquery */ 9),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 14),
compileGetter = __webpack_require__( /*! ../../core/utils/data */ 36).compileGetter,
clickEvent = __webpack_require__( /*! ../../events/click */ 64),
swipeEvents = __webpack_require__( /*! ../../events/swipe */ 178),
support = __webpack_require__( /*! ../../core/utils/support */ 48),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 80),
inkRipple = __webpack_require__( /*! ../widget/utils.ink_ripple */ 197),
devices = __webpack_require__( /*! ../../core/devices */ 40),
Button = __webpack_require__( /*! ../button */ 196),
eventUtils = __webpack_require__( /*! ../../events/utils */ 62),
themes = __webpack_require__( /*! ../themes */ 143),
ScrollModule = __webpack_require__( /*! ../scroll_view/ui.scroll_view */ 227),
deviceDependentOptions = __webpack_require__( /*! ../scroll_view/ui.scrollable */ 237).deviceDependentOptions,
CollectionWidget = __webpack_require__( /*! ../collection/ui.collection_widget.edit */ 151);
var LIST_CLASS = "dx-list",
LIST_ITEM_CLASS = "dx-list-item",
LIST_ITEM_SELECTOR = "." + LIST_ITEM_CLASS,
LIST_GROUP_CLASS = "dx-list-group",
LIST_GROUP_HEADER_CLASS = "dx-list-group-header",
LIST_GROUP_BODY_CLASS = "dx-list-group-body",
LIST_COLLAPSIBLE_GROUPS_CLASS = "dx-list-collapsible-groups",
LIST_GROUP_COLLAPSED_CLASS = "dx-list-group-collapsed",
LIST_HAS_NEXT_CLASS = "dx-has-next",
LIST_NEXT_BUTTON_CLASS = "dx-list-next-button",
LIST_ITEM_DATA_KEY = "dxListItemData",
LIST_FEEDBACK_SHOW_TIMEOUT = 70;
var groupItemsGetter = compileGetter("items");
var ListBase = CollectionWidget.inherit({
_activeStateUnit: LIST_ITEM_SELECTOR,
_supportedKeys: function() {
var that = this;
var moveFocusPerPage = function(direction) {
var $item = getEdgeVisibleItem(direction),
isFocusedItem = $item.is(that.option("focusedElement"));
if (isFocusedItem) {
scrollListTo($item, direction);
$item = getEdgeVisibleItem(direction)
}
that.option("focusedElement", $item);
that.scrollToItem($item)
};
var getEdgeVisibleItem = function(direction) {
var scrollTop = that.scrollTop(),
containerHeight = that.element().height();
var $item = that.option("focusedElement"),
isItemVisible = true;
if (!$item) {
return $()
}
while (isItemVisible) {
var $nextItem = $item[direction]();
if (!$nextItem.length) {
break
}
var nextItemLocation = $nextItem.position().top + $nextItem.outerHeight() / 2;
isItemVisible = nextItemLocation < containerHeight + scrollTop && nextItemLocation > scrollTop;
if (isItemVisible) {
$item = $nextItem
}
}
return $item
};
var scrollListTo = function($item, direction) {
var resultPosition = $item.position().top;
if ("prev" === direction) {
resultPosition = $item.position().top - that.element().height() + $item.outerHeight()
}
that.scrollTo(resultPosition)
};
return $.extend(this.callBase(), {
leftArrow: $.noop,
rightArrow: $.noop,
pageUp: function() {
moveFocusPerPage("prev");
return false
},
pageDown: function() {
moveFocusPerPage("next");
return false
}
})
},
_setDeprecatedOptions: function() {
this.callBase();
$.extend(this._deprecatedOptions, {
autoPagingEnabled: {
since: "15.1",
message: "Use the 'pageLoadMode' option instead"
},
showNextButton: {
since: "15.1",
message: "Use the 'pageLoadMode' option instead"
}
})
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
hoverStateEnabled: true,
pullRefreshEnabled: false,
scrollingEnabled: true,
showScrollbar: "onScroll",
useNativeScrolling: true,
bounceEnabled: true,
scrollByContent: true,
scrollByThumb: false,
pullingDownText: messageLocalization.format("dxList-pullingDownText"),
pulledDownText: messageLocalization.format("dxList-pulledDownText"),
refreshingText: messageLocalization.format("dxList-refreshingText"),
pageLoadingText: messageLocalization.format("dxList-pageLoadingText"),
onScroll: null,
onPullRefresh: null,
onPageLoading: null,
pageLoadMode: "scrollBottom",
nextButtonText: messageLocalization.format("dxList-nextButtonText"),
onItemSwipe: null,
grouped: false,
onGroupRendered: null,
collapsibleGroups: false,
groupTemplate: "group",
indicateLoading: true,
activeStateEnabled: true,
_itemAttributes: {
role: "option"
},
useInkRipple: false
})
},
_defaultOptionsRules: function() {
return this.callBase().concat(deviceDependentOptions(), [{
device: function(device) {
return !support.nativeScrolling
},
options: {
useNativeScrolling: false
}
}, {
device: function(device) {
return !support.nativeScrolling && !devices.isSimulator() && "generic" === devices.real().platform && "generic" === device.platform
},
options: {
showScrollbar: "onHover",
pageLoadMode: "nextButton"
}
}, {
device: function(device) {
return "desktop" === devices.real().deviceType && !devices.isSimulator()
},
options: {
focusStateEnabled: true
}
}, {
device: function() {
return /android5/.test(themes.current())
},
options: {
useInkRipple: true
}
}, {
device: function(device) {
return "win" === devices.current().platform && devices.isSimulator()
},
options: {
bounceEnabled: false
}
}])
},
_visibilityChanged: function(visible) {
if (visible) {
this._updateLoadingState(true)
}
},
_itemClass: function() {
return LIST_ITEM_CLASS
},
_itemDataKey: function() {
return LIST_ITEM_DATA_KEY
},
_itemContainer: function() {
return this._$container
},
_itemElements: function() {
if (!this.option("grouped")) {
return this._itemContainer().children(this._itemSelector())
}
return this._itemContainer().children("." + LIST_GROUP_CLASS).children("." + LIST_GROUP_BODY_CLASS).children(this._itemSelector())
},
_itemSelectHandler: function(e) {
if ("single" === this.option("selectionMode") && this.isItemSelected(e.currentTarget)) {
return
}
this.callBase(e)
},
_allowDynamicItemsAppend: function() {
return true
},
_init: function() {
this.callBase();
this._$container = this.element();
this._initScrollView();
this._feedbackShowTimeout = LIST_FEEDBACK_SHOW_TIMEOUT;
this._createGroupRenderAction();
this.setAria("role", "listbox")
},
_dataSourceOptions: function() {
this._suppressDeprecatedWarnings();
var pagingEnabled = this.option("autoPagingEnabled");
pagingEnabled = commonUtils.isDefined(this.option("showNextButton")) ? pagingEnabled || this.option("showNextButton") : pagingEnabled;
this._resumeDeprecatedWarnings();
return $.extend(this.callBase(), {
paginate: commonUtils.isDefined(pagingEnabled) ? pagingEnabled : true
})
},
_initScrollView: function() {
this._suppressDeprecatedWarnings();
var scrollingEnabled = this.option("scrollingEnabled"),
pullRefreshEnabled = scrollingEnabled && this.option("pullRefreshEnabled"),
autoPagingEnabled = scrollingEnabled && commonUtils.ensureDefined(this.option("autoPagingEnabled"), "scrollBottom" === this.option("pageLoadMode")) && !!this._dataSource;
this._resumeDeprecatedWarnings();
this._scrollView = this._createComponent(this.element(), ScrollModule.ScrollView, {
disabled: this.option("disabled") || !scrollingEnabled,
onScroll: $.proxy(this._scrollHandler, this),
onPullDown: pullRefreshEnabled ? $.proxy(this._pullDownHandler, this) : null,
onReachBottom: autoPagingEnabled ? $.proxy(this._scrollBottomHandler, this) : null,
showScrollbar: this.option("showScrollbar"),
useNative: this.option("useNativeScrolling"),
bounceEnabled: this.option("bounceEnabled"),
scrollByContent: this.option("scrollByContent"),
scrollByThumb: this.option("scrollByThumb"),
pullingDownText: this.option("pullingDownText"),
pulledDownText: this.option("pulledDownText"),
refreshingText: this.option("refreshingText"),
reachBottomText: this.option("pageLoadingText"),
useKeyboard: false
});
this._$container = this._scrollView.content();
this._createScrollViewActions()
},
_createScrollViewActions: function() {
this._scrollAction = this._createActionByOption("onScroll");
this._pullRefreshAction = this._createActionByOption("onPullRefresh");
this._pageLoadingAction = this._createActionByOption("onPageLoading")
},
_scrollHandler: function(e) {
this._scrollAction(e)
},
_updateLoadingState: function(tryLoadMore) {
this._suppressDeprecatedWarnings();
var isDataLoaded = !tryLoadMore || this._isLastPage(),
autoPagingEnabled = commonUtils.ensureDefined(this.option("autoPagingEnabled"), "scrollBottom" === this.option("pageLoadMode")),
stopLoading = isDataLoaded || !autoPagingEnabled,
hideLoadIndicator = stopLoading && !this._isDataSourceLoading();
this._resumeDeprecatedWarnings();
if (stopLoading || this._scrollViewIsFull()) {
this._scrollView.release(hideLoadIndicator);
this._toggleNextButton(this._shouldRenderNextButton() && !isDataLoaded);
this._loadIndicationSuppressed(false)
} else {
this._infiniteDataLoading()
}
},
_shouldRenderNextButton: function() {
this._suppressDeprecatedWarnings();
var result = commonUtils.ensureDefined(this.option("showNextButton"), "nextButton" === this.option("pageLoadMode")) && this._dataSource && this._dataSource.isLoaded();
this._resumeDeprecatedWarnings();
return result
},
_dataSourceLoadingChangedHandler: function(isLoading) {
if (this._loadIndicationSuppressed()) {
return
}
if (isLoading && this.option("indicateLoading")) {
this._showLoadingIndicatorTimer = setTimeout($.proxy(function() {
var isEmpty = !this._itemElements().length;
if (this._scrollView && !isEmpty) {
this._scrollView.startLoading()
}
}, this))
} else {
clearTimeout(this._showLoadingIndicatorTimer);
this._scrollView && this._scrollView.finishLoading()
}
},
_dataSourceChangedHandler: function(newItems) {
if (!this._shouldAppendItems()) {
this._scrollView && this._scrollView.scrollTo(0)
}
this.callBase(newItems)
},
_hideLoadingIfLoadIndicationOff: function() {
if (!this.option("indicateLoading")) {
this._dataSourceLoadingChangedHandler(false)
}
},
_loadIndicationSuppressed: function(value) {
if (!arguments.length) {
return this._isLoadIndicationSuppressed
}
this._isLoadIndicationSuppressed = value
},
_scrollViewIsFull: function() {
return !this._scrollView || this._scrollView.isFull()
},
_pullDownHandler: function(e) {
this._pullRefreshAction(e);
if (this._dataSource && !this._isDataSourceLoading()) {
this._clearSelectedItems();
this._dataSource.pageIndex(0);
this._dataSource.load()
} else {
this._updateLoadingState()
}
},
_infiniteDataLoading: function() {
var isElementVisible = this.element().is(":visible");
if (isElementVisible && !this._scrollViewIsFull() && !this._isDataSourceLoading() && !this._isLastPage()) {
clearTimeout(this._loadNextPageTimer);
this._loadNextPageTimer = setTimeout($.proxy(this._loadNextPage, this))
}
},
_scrollBottomHandler: function(e) {
this._pageLoadingAction(e);
if (!this._isDataSourceLoading() && !this._isLastPage()) {
this._loadNextPage()
} else {
this._updateLoadingState()
}
},
_renderItems: function(items) {
if (this.option("grouped")) {
$.each(items, $.proxy(this._renderGroup, this));
this._attachGroupCollapseEvent();
this._renderEmptyMessage()
} else {
this.callBase.apply(this, arguments)
}
this._updateLoadingState(true)
},
_attachGroupCollapseEvent: function() {
var eventName = eventUtils.addNamespace(clickEvent.name, this.NAME),
selector = "." + LIST_GROUP_HEADER_CLASS,
$element = this.element(),
collapsibleGroups = this.option("collapsibleGroups");
$element.toggleClass(LIST_COLLAPSIBLE_GROUPS_CLASS, collapsibleGroups);
$element.off(eventName, selector);
if (collapsibleGroups) {
$element.on(eventName, selector, $.proxy(function(e) {
this._createAction($.proxy(function(e) {
var $group = $(e.jQueryEvent.currentTarget).parent();
this._collapseGroupHandler($group);
if (this.option("focusStateEnabled")) {
this.option("focusedElement", $group.find("." + LIST_ITEM_CLASS).eq(0))
}
}, this), {
validatingTargetName: "element"
})({
jQueryEvent: e
})
}, this))
}
},
_collapseGroupHandler: function($group, toggle) {
var deferred = $.Deferred(),
$groupBody = $group.children("." + LIST_GROUP_BODY_CLASS);
$group.toggleClass(LIST_GROUP_COLLAPSED_CLASS, toggle);
var slideMethod = "slideToggle";
if (true === toggle) {
slideMethod = "slideUp"
}
if (false === toggle) {
slideMethod = "slideDown"
}
$groupBody[slideMethod]({
duration: 200,
complete: $.proxy(function() {
this.updateDimensions();
this._updateLoadingState(true);
deferred.resolve()
}, this)
});
return deferred.promise()
},
_dataSourceLoadErrorHandler: function() {
this._forgetNextPageLoading();
if (this._initialized) {
this._renderEmptyMessage();
this._updateLoadingState()
}
},
_render: function() {
this.element().addClass(LIST_CLASS);
this.callBase();
this.option("useInkRipple") && this._renderInkRipple()
},
_renderInkRipple: function() {
this._inkRipple = inkRipple.render()
},
_toggleActiveState: function($element, value, e) {
this.callBase.apply(this, arguments);
if (!this._inkRipple) {
return
}
var config = {
element: $element,
jQueryEvent: e
};
if (value) {
this._inkRipple.showWave(config)
} else {
this._inkRipple.hideWave(config)
}
},
_postprocessRenderItem: function(args) {
this.callBase.apply(this, arguments);
if (this.option("onItemSwipe")) {
this._attachSwipeEvent($(args.itemElement))
}
},
_attachSwipeEvent: function($itemElement) {
var endEventName = eventUtils.addNamespace(swipeEvents.end, this.NAME);
$itemElement.on(endEventName, $.proxy(this._itemSwipeEndHandler, this))
},
_itemSwipeEndHandler: function(e) {
this._itemJQueryEventHandler(e, "onItemSwipe", {
direction: e.offset < 0 ? "left" : "right"
})
},
_nextButtonHandler: function() {
var source = this._dataSource;
if (source && !source.isLoading()) {
this._scrollView.toggleLoading(true);
this._$nextButton.detach();
this._loadIndicationSuppressed(true);
this._loadNextPage()
}
},
_renderGroup: function(index, group) {
var $groupElement = $("
").addClass(LIST_GROUP_CLASS).appendTo(this._itemContainer());
var $groupHeaderElement = $("
").addClass(LIST_GROUP_HEADER_CLASS).appendTo($groupElement);
var groupTemplateName = this.option("groupTemplate"),
groupTemplate = this._getTemplate(group.template || groupTemplateName, group, index, $groupHeaderElement),
renderArgs = {
index: index,
itemData: group,
container: $groupHeaderElement
};
this._createItemByTemplate(groupTemplate, renderArgs);
this._renderingGroupIndex = index;
var $groupBody = $("
").addClass(LIST_GROUP_BODY_CLASS).appendTo($groupElement);
$.each(groupItemsGetter(group) || [], $.proxy(function(index, item) {
this._renderItem(index, item, $groupBody)
}, this));
this._groupRenderAction({
groupElement: $groupElement,
groupIndex: index,
groupData: group
})
},
_createGroupRenderAction: function() {
this._groupRenderAction = this._createActionByOption("onGroupRendered")
},
_clean: function() {
if (this._$nextButton) {
this._$nextButton.remove();
this._$nextButton = null
}
this.callBase.apply(this, arguments)
},
_dispose: function() {
clearTimeout(this._holdTimer);
clearTimeout(this._loadNextPageTimer);
clearTimeout(this._showLoadingIndicatorTimer);
this.callBase()
},
_toggleDisabledState: function(value) {
this.callBase(value);
this._scrollView.option("disabled", value || !this.option("scrollingEnabled"))
},
_toggleNextButton: function(value) {
var dataSource = this._dataSource,
$nextButton = this._getNextButton();
this.element().toggleClass(LIST_HAS_NEXT_CLASS, value);
if (value && dataSource && dataSource.isLoaded()) {
$nextButton.appendTo(this._itemContainer())
}
if (!value) {
$nextButton.detach()
}
},
_getNextButton: function() {
if (!this._$nextButton) {
this._$nextButton = this._createNextButton()
}
return this._$nextButton
},
_createNextButton: function() {
var $result = $("