").addClass(TRACKBAR_CONTAINER_CLASS).appendTo(this._$wrapper)
},
_renderRange: function() {
this._$range = $("
").addClass(TRACKBAR_RANGE_CLASS).appendTo(this._$bar)
},
_renderValue: function() {
var val = this.option("value"),
min = this.option("min"),
max = this.option("max");
if (min > max) {
return
}
if (val < min) {
this.option("value", min);
this._currentRatio = 0;
return
}
if (val > max) {
this.option("value", max);
this._currentRatio = 1;
return
}
var ratio = min === max ? 0 : (val - min) / (max - min);
!this._needPreventAnimation && this._setRangeStyles({
width: 100 * ratio + "%"
});
this.setAria({
valuemin: this.option("min"),
valuemax: max,
valuenow: val
});
this._currentRatio = ratio
},
_setRangeStyles: function(options) {
fx.stop(this._$range);
if (!this._needPreventAnimation) {
fx.animate(this._$range, {
type: "custom",
duration: 100,
to: options
})
}
},
_optionChanged: function(args) {
switch (args.name) {
case "value":
this._renderValue();
this.callBase(args);
break;
case "max":
case "min":
this._renderValue();
break;
default:
this.callBase(args)
}
},
_dispose: function() {
fx.stop(this._$range);
this.callBase()
}
});
registerComponent("dxTrackBar", TrackBar);
module.exports = TrackBar
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!******************************************!*\
!*** ./Scripts/ui/validation_summary.js ***!
\******************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 3),
ValidationMixin = __webpack_require__( /*! ./validation/validation_mixin */ 132),
ValidationEngine = __webpack_require__( /*! ./validation_engine */ 64),
CollectionWidget = __webpack_require__( /*! ./collection/ui.collection_widget.edit */ 27);
var VALIDATION_SUMMARY_CLASS = "dx-validationsummary",
ITEM_CLASS = VALIDATION_SUMMARY_CLASS + "-item",
ITEM_DATA_KEY = VALIDATION_SUMMARY_CLASS + "-item-data";
var ValidationSummary = CollectionWidget.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
focusStateEnabled: false,
noDataText: null
})
},
_setOptionsByReference: function() {
this.callBase();
$.extend(this._optionsByReference, {
validationGroup: true
})
},
_init: function() {
this.callBase();
this._initGroupRegistration()
},
_initGroupRegistration: function() {
var group = this._findGroup(),
groupConfig = ValidationEngine.addGroup(group);
this._unsubscribeGroup();
this._groupWasInit = true;
this._validationGroup = group;
this.groupSubscription = $.proxy(this._groupValidationHandler, this);
groupConfig.on("validated", this.groupSubscription)
},
_unsubscribeGroup: function() {
var groupConfig = ValidationEngine.getGroupConfig(this._validationGroup);
groupConfig && groupConfig.off("validated", this.groupSubscription)
},
_getOrderedItems: function(validators, items) {
var orderedItems = [];
$.each(validators, function(_, validator) {
var firstItem = $.grep(items, function(item) {
if (item.validator === validator) {
return true
}
})[0];
if (firstItem) {
orderedItems.push(firstItem)
}
});
return orderedItems
},
_groupValidationHandler: function(params) {
var that = this,
items = that._getOrderedItems(params.validators, $.map(params.brokenRules, function(rule) {
return {
text: rule.message,
validator: rule.validator
}
}));
that.validators = params.validators;
$.each(that.validators, function(_, validator) {
if (validator._validationSummary !== this) {
var handler = $.proxy(that._itemValidationHandler, that),
disposingHandler = function() {
validator.off("validated", handler);
validator._validationSummary = null;
handler = null
};
validator.on("validated", handler);
validator.on("disposing", disposingHandler);
validator._validationSummary = this
}
});
that.option("items", items)
},
_itemValidationHandler: function(itemValidationResult) {
var elementIndex, items = this.option("items"),
isValid = itemValidationResult.isValid,
replacementFound = false,
newMessage = itemValidationResult.brokenRule && itemValidationResult.brokenRule.message,
validator = itemValidationResult.validator;
$.each(items, function(index, item) {
if (item.validator === validator) {
if (isValid) {
elementIndex = index
} else {
item.text = newMessage
}
replacementFound = true;
return false
}
});
if (isValid ^ replacementFound) {
return
}
if (isValid) {
items.splice(elementIndex, 1)
} else {
items.push({
text: newMessage,
validator: validator
})
}
items = this._getOrderedItems(this.validators, items);
this.option("items", items)
},
_render: function() {
this.element().addClass(VALIDATION_SUMMARY_CLASS);
this.callBase()
},
_optionChanged: function(args) {
switch (args.name) {
case "validationGroup":
this._initGroupRegistration();
break;
default:
this.callBase(args)
}
},
_itemClass: function() {
return ITEM_CLASS
},
_itemDataKey: function() {
return ITEM_DATA_KEY
},
_postprocessRenderItem: function(params) {
params.itemElement.on("click", function() {
params.itemData.validator.focus()
})
},
_dispose: function() {
this.callBase();
this._unsubscribeGroup()
}
}).include(ValidationMixin);
registerComponent("dxValidationSummary", ValidationSummary);
module.exports = ValidationSummary
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************************!*\
!*** ./Scripts/ui/widget/ui.template.dynamic.js ***!
\**************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
TemplateBase = __webpack_require__( /*! ./ui.template_base */ 47);
var DynamicTemplate = TemplateBase.inherit({
ctor: function(compileFunction, owner) {
this.callBase($(), owner);
this._compileFunction = compileFunction
},
_renderCore: function(data, index, container) {
if (void 0 === data && void 0 === index) {
data = container;
container = void 0
}
var compiledTemplate = void 0 === index ? this._compileFunction(data, container) : this._compileFunction(data, index, container);
var renderResult = compiledTemplate.render(data, container, index);
if (compiledTemplate.owner() === this) {
compiledTemplate.dispose()
}
return renderResult
}
});
module.exports = DynamicTemplate
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/ui/widget/ui.template.move.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var TemplateBase = __webpack_require__( /*! ./ui.template_base */ 47);
var MoveTemplate = TemplateBase.inherit({
_renderCore: function() {
return this._element
}
});
module.exports = MoveTemplate
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************************!*\
!*** ./Scripts/viz/axes/numeric_tick_manager.js ***!
\**************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
vizUtils = __webpack_require__( /*! ../core/utils */ 6),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
_isDefined = commonUtils.isDefined,
_adjustValue = vizUtils.adjustValue,
_math = Math,
_abs = _math.abs,
_ceil = _math.ceil,
_floor = _math.floor,
_noop = $.noop,
MINOR_TICKS_COUNT_LIMIT = 200,
DEFAULT_MINOR_NUMBER_MULTIPLIERS = [2, 4, 5, 8, 10];
exports.continuous = {
_hasUnitBeginningTickCorrection: _noop,
_checkBoundedDatesOverlapping: _noop,
_correctInterval: function(step) {
this._tickInterval *= step
},
_correctMax: function(tickInterval) {
this._max = this._adjustNumericTickValue(_ceil(this._max / tickInterval) * tickInterval, tickInterval, this._min)
},
_correctMin: function(tickInterval) {
this._min = this._adjustNumericTickValue(_floor(this._min / tickInterval) * tickInterval, tickInterval, this._min)
},
_findBusinessDelta: function(min, max) {
return _adjustValue(_abs(min - max))
},
_findTickIntervalForCustomTicks: function() {
return _abs(this._customTicks[1] - this._customTicks[0])
},
_getBoundInterval: function() {
var that = this,
boundCoef = that._options.boundCoef;
return _isDefined(boundCoef) && isFinite(boundCoef) ? that._tickInterval * _abs(boundCoef) : that._tickInterval / 2
},
_getInterval: function(deltaCoef, numberMultipliers) {
var factor, newResult, i, interval = deltaCoef || this._getDeltaCoef(this._screenDelta, this._businessDelta, this._options.gridSpacingFactor),
multipliers = numberMultipliers || this._options.numberMultipliers,
result = 0,
hasResult = false;
if (interval > 1) {
for (factor = 1; !hasResult; factor *= 10) {
for (i = 0; i < multipliers.length; i++) {
result = multipliers[i] * factor;
if (interval <= result) {
hasResult = true;
break
}
}
}
} else {
if (interval > 0) {
result = 1;
for (factor = .1; !hasResult; factor /= 10) {
for (i = multipliers.length - 1; i >= 0; i--) {
newResult = multipliers[i] * factor;
if (interval > newResult) {
hasResult = true;
break
}
result = newResult
}
}
}
}
return _adjustValue(result)
},
_getMarginValue: function(min, max, margin) {
return vizUtils.applyPrecisionByMinDelta(min, margin, _abs(max - min) * margin)
},
_getDefaultMinorInterval: function(screenDelta, businessDelta) {
var result, deltaCoef = this._getDeltaCoef(screenDelta, businessDelta, this._options.minorGridSpacingFactor),
multipliers = DEFAULT_MINOR_NUMBER_MULTIPLIERS,
i = multipliers.length - 1;
for (i; i >= 0; i--) {
result = businessDelta / multipliers[i];
if (deltaCoef <= result) {
return _adjustValue(result)
}
}
return 0
},
_getMinorInterval: function(screenDelta, businessDelta) {
var interval, intervalsCount, count, that = this,
options = that._options,
minorTickInterval = options.minorTickInterval,
minorTickCount = options.minorTickCount;
if (isFinite(minorTickInterval) && that._isTickIntervalCorrect(minorTickInterval, MINOR_TICKS_COUNT_LIMIT, businessDelta)) {
interval = minorTickInterval;
count = interval < businessDelta ? _ceil(businessDelta / interval) - 1 : 0
} else {
if (_isDefined(minorTickCount)) {
intervalsCount = _isDefined(minorTickCount) ? minorTickCount + 1 : _floor(screenDelta / options.minorGridSpacingFactor);
count = intervalsCount - 1;
interval = count > 0 ? businessDelta / intervalsCount : 0
} else {
interval = that._getDefaultMinorInterval(screenDelta, businessDelta);
count = interval < businessDelta ? _floor(businessDelta / interval) - 1 : 0
}
}
that._minorTickInterval = interval;
that._minorTickCount = count
},
_getNextTickValue: function(value, tickInterval, isTickIntervalNegative) {
tickInterval = _isDefined(isTickIntervalNegative) && isTickIntervalNegative ? -tickInterval : tickInterval;
value += tickInterval;
return this._adjustNumericTickValue(value, tickInterval, this._min)
},
_isTickIntervalValid: function(tickInterval) {
return _isDefined(tickInterval) && isFinite(tickInterval) && 0 !== tickInterval
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************!*\
!*** ./Scripts/viz/core/layout_element.js ***!
\********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
_round = Math.round,
objectUtils = __webpack_require__( /*! ../../core/utils/object */ 30),
defaultOffset = {
horizontal: 0,
vertical: 0
},
alignFactors = {
center: .5,
right: 1,
bottom: 1,
left: 0,
top: 0
};
function LayoutElement(options) {
this._options = options
}
LayoutElement.prototype = {
constructor: LayoutElement,
position: function(options) {
var that = this,
ofBBox = options.of.getLayoutOptions(),
myBBox = that.getLayoutOptions(),
at = options.at,
my = options.my,
offset = options.offset || defaultOffset,
shiftX = -alignFactors[my.horizontal] * myBBox.width + ofBBox.x + alignFactors[at.horizontal] * ofBBox.width + parseInt(offset.horizontal),
shiftY = -alignFactors[my.vertical] * myBBox.height + ofBBox.y + alignFactors[at.vertical] * ofBBox.height + parseInt(offset.vertical);
that.shift(_round(shiftX), _round(shiftY))
},
getLayoutOptions: $.noop,
getVerticalCuttedSize: function(canvas) {
var that = this,
height = canvas.height,
top = canvas.top,
bottom = canvas.bottom,
layoutOptions = that.getLayoutOptions();
if (layoutOptions) {
that.draw(canvas.width, canvas.height);
layoutOptions = that.getLayoutOptions();
if (layoutOptions) {
height -= layoutOptions.height;
if ("bottom" === layoutOptions.position.vertical) {
bottom += layoutOptions.height
} else {
top += layoutOptions.height
}
}
}
return {
left: canvas.left,
right: canvas.right,
top: top,
bottom: bottom,
width: canvas.width,
height: height
}
}
};
function WrapperLayoutElement(renderElement, bbox) {
this._renderElement = renderElement;
this._cacheBBox = bbox
}
var wrapperLayoutElementPrototype = WrapperLayoutElement.prototype = objectUtils.clone(LayoutElement.prototype);
wrapperLayoutElementPrototype.constructor = WrapperLayoutElement;
wrapperLayoutElementPrototype.getLayoutOptions = function() {
return this._cacheBBox || this._renderElement.getBBox()
};
wrapperLayoutElementPrototype.shift = function(shiftX, shiftY) {
var bbox = this.getLayoutOptions();
this._renderElement.move(_round(shiftX - bbox.x), _round(shiftY - bbox.y))
};
exports.LayoutElement = LayoutElement;
exports.WrapperLayoutElement = WrapperLayoutElement
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************!*\
!*** ./Scripts/viz/gauges/common.js ***!
\**************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
dxBaseGauge = __webpack_require__( /*! ./base_gauge */ 128).dxBaseGauge,
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
_isDefined = commonUtils.isDefined,
_isArray = commonUtils.isArray,
_isNumber = commonUtils.isNumber,
rangeModule = __webpack_require__( /*! ../translators/range */ 89),
axisModule = __webpack_require__( /*! ../axes/base_axis */ 231),
_map = __webpack_require__( /*! ../core/utils */ 6).map,
_normalizeEnum = __webpack_require__( /*! ../core/utils */ 6).normalizeEnum,
_compareArrays = __webpack_require__( /*! ./base_gauge */ 128).compareArrays,
_isFinite = isFinite,
_Number = Number,
_min = Math.min,
_max = Math.max,
_extend = $.extend,
_each = $.each,
_noop = $.noop,
OPTION_VALUE = "value",
OPTION_SUBVALUES = "subvalues",
DEFAULT_MINOR_AXIS_DIVISION_FACTOR = 5,
DEFAULT_NUMBER_MULTIPLIERS = [1, 2, 5];
function processValue(value, fallbackValue) {
return _isFinite(value) ? _Number(value) : fallbackValue
}
function parseArrayOfNumbers(arg) {
return _isArray(arg) ? arg : _isNumber(arg) ? [arg] : null
}
exports.dxGauge = dxBaseGauge.inherit({
_initCore: function() {
var that = this,
renderer = that._renderer;
that._setupValue(that.option(OPTION_VALUE));
that.__subvalues = parseArrayOfNumbers(that.option(OPTION_SUBVALUES));
that._setupSubvalues(that.__subvalues);
selectMode(that);
that.callBase.apply(that, arguments);
that._rangeContainer = new that._factory.RangeContainer({
renderer: renderer,
container: renderer.root,
translator: that._translator,
themeManager: that._themeManager
});
that._initScale()
},
_initScale: function() {
var that = this;
that._scaleGroup = that._renderer.g().attr({
"class": "dxg-scale"
}).linkOn(that._renderer.root, "scale");
that._scale = new axisModule.Axis({
incidentOccurred: that._incidentOccurred,
renderer: that._renderer,
axesContainerGroup: that._scaleGroup,
axisType: that._scaleTypes.type,
drawingType: that._scaleTypes.drawingType,
widgetClass: "dxg"
});
that._scaleTranslator = that._initScaleTranslator(new rangeModule.Range({
axisType: "continuous",
dataType: "numeric",
stick: true
}))
},
_disposeCore: function() {
var that = this;
that.callBase.apply(that, arguments);
that._scale.dispose();
that._scaleGroup.linkOff();
that._rangeContainer.dispose();
that._disposeValueIndicators();
that._scale = that._scaleGroup = that._scaleTranslators = that._rangeContainer = null
},
_disposeValueIndicators: function() {
var that = this;
that._valueIndicator && that._valueIndicator.dispose();
that._subvalueIndicatorsSet && that._subvalueIndicatorsSet.dispose();
that._valueIndicator = that._subvalueIndicatorsSet = null
},
_setupDomainCore: function() {
var that = this,
scaleOption = that.option("scale") || {},
startValue = that.option("startValue"),
endValue = that.option("endValue");
startValue = _isNumber(startValue) ? _Number(startValue) : _isNumber(scaleOption.startValue) ? _Number(scaleOption.startValue) : 0;
endValue = _isNumber(endValue) ? _Number(endValue) : _isNumber(scaleOption.endValue) ? _Number(scaleOption.endValue) : 100;
that._baseValue = startValue < endValue ? startValue : endValue;
that._translator.setDomain(startValue, endValue)
},
_cleanContent: function() {
var that = this;
that._rangeContainer.clean();
that._cleanValueIndicators()
},
_measureScale: function(scaleOptions) {
var textParams, layoutValue, result, coefs, innerCoef, outerCoef, that = this,
majorTick = scaleOptions.tick,
majorTickEnabled = majorTick.visible && majorTick.length > 0 && majorTick.width > 0,
minorTick = scaleOptions.minorTick,
minorTickEnabled = minorTick.visible && minorTick.length > 0 && minorTick.width > 0,
label = scaleOptions.label,
indentFromTick = Number(label.indentFromTick);
if (!majorTickEnabled && !minorTickEnabled && !label.visible) {
return {}
}
textParams = that._scale.measureLabels();
layoutValue = that._getScaleLayoutValue();
result = {
min: layoutValue,
max: layoutValue
};
coefs = that._getTicksCoefficients(scaleOptions);
innerCoef = coefs.inner;
outerCoef = coefs.outer;
if (majorTickEnabled) {
result.min = _min(result.min, layoutValue - innerCoef * majorTick.length);
result.max = _max(result.max, layoutValue + outerCoef * majorTick.length)
}
if (minorTickEnabled) {
result.min = _min(result.min, layoutValue - innerCoef * minorTick.length);
result.max = _max(result.max, layoutValue + outerCoef * minorTick.length)
}
label.visible && that._correctScaleIndents(result, indentFromTick, textParams);
return result
},
_renderContent: function() {
var elements, that = this,
scaleOptions = that._prepareScaleSettings();
that._rangeContainer.render(_extend(that._getOption("rangeContainer"), {
vertical: that._area.vertical
}));
that._renderScale(scaleOptions);
elements = _map([that._rangeContainer].concat(that._prepareValueIndicators()), function(element) {
return element && element.enabled ? element : null
});
that._applyMainLayout(elements, that._measureScale(scaleOptions));
_each(elements, function(_, element) {
element.resize(that._getElementLayout(element.getOffset()))
});
that._shiftScale(that._getElementLayout(0), scaleOptions);
that._beginValueChanging();
that._updateActiveElements();
that._endValueChanging()
},
_prepareScaleSettings: function() {
var that = this,
scaleOptions = $.extend(true, {}, that._themeManager.theme("scale"), that.option("scale")),
useAutoArrangement = scaleOptions.label.overlappingBehavior.useAutoArrangement,
scaleMajorTick = scaleOptions.majorTick,
scaleMinorTick = scaleOptions.minorTick,
overlappingBehavior = scaleOptions.label.overlappingBehavior;
if (scaleMajorTick) {
scaleOptions.tick = _extend(scaleOptions.tick, scaleMajorTick);
useAutoArrangement = void 0 !== scaleMajorTick.useTickAutoArrangement ? scaleMajorTick.useTickAutoArrangement : true;
void 0 !== scaleMajorTick.tickInterval && (scaleOptions.tickInterval = scaleMajorTick.tickInterval);
void 0 !== scaleMajorTick.customTickValues && (scaleOptions.customTicks = scaleMajorTick.customTickValues);
if (scaleOptions.customTicks) {
scaleOptions.tick.showCalculatedTicks = void 0 !== scaleMajorTick.showCalculatedTicks ? scaleMajorTick.showCalculatedTicks : true
} else {
scaleOptions.tick.showCalculatedTicks = false
}
}
overlappingBehavior.hideFirstTick = scaleOptions.hideFirstTick;
overlappingBehavior.hideFirstLabel = scaleOptions.hideFirstLabel;
overlappingBehavior.hideLastTick = scaleOptions.hideLastTick;
overlappingBehavior.hideLastLabel = scaleOptions.hideLastLabel;
void 0 !== scaleMinorTick.customTickValues && (scaleOptions.customMinorTicks = scaleOptions.minorTick.customTickValues);
void 0 !== scaleMinorTick.tickInterval && (scaleOptions.minorTickInterval = scaleOptions.minorTick.tickInterval);
if (scaleOptions.customMinorTicks) {
scaleMinorTick.showCalculatedTicks = void 0 !== scaleMinorTick.showCalculatedTicks ? scaleMinorTick.showCalculatedTicks : true
} else {
scaleMinorTick.showCalculatedTicks = false
}
scaleOptions.label.indentFromAxis = 0;
scaleOptions.isHorizontal = !that._area.vertical;
overlappingBehavior.mode = useAutoArrangement ? "enlargeTickInterval" : "ignore";
scaleOptions.axisDivisionFactor = that._gridSpacingFactor;
scaleOptions.minorAxisDivisionFactor = DEFAULT_MINOR_AXIS_DIVISION_FACTOR;
scaleOptions.numberMultipliers = DEFAULT_NUMBER_MULTIPLIERS;
scaleOptions.tickOrientation = that._getTicksOrientation(scaleOptions);
if (scaleOptions.label.useRangeColors) {
scaleOptions.label.customizeColor = function() {
return that._rangeContainer.getColorForValue(this.value)
}
}
return scaleOptions
},
_renderScale: function(scaleOptions) {
var that = this,
bounds = that._translator.getDomain(),
startValue = bounds[0],
endValue = bounds[1];
scaleOptions.min = startValue;
scaleOptions.max = endValue;
that._scale.updateOptions(scaleOptions);
that._updateScaleTranslator(startValue, endValue);
that._updateScaleTickIndent(scaleOptions);
that._scaleGroup.linkAppend();
that._scale.draw()
},
_updateScaleTranslator: function(startValue, endValue) {
var that = this,
argTranslator = that._getScaleTranslatorComponent("arg");
that._updateScaleAngles();
argTranslator.updateBusinessRange(_extend(argTranslator.getBusinessRange(), {
minVisible: startValue,
maxVisible: endValue,
invert: startValue > endValue
}));
that._scale.setTranslator(argTranslator, that._getScaleTranslatorComponent("val"))
},
_updateIndicatorSettings: function(settings) {
var that = this;
settings.currentValue = settings.baseValue = _isFinite(that._translator.translate(settings.baseValue)) ? _Number(settings.baseValue) : that._baseValue;
settings.vertical = that._area.vertical;
if (settings.text && !settings.text.format && !settings.text.precision) {
settings.text.format = that._defaultFormatOptions
}
},
_prepareIndicatorSettings: function(options, defaultTypeField) {
var that = this,
theme = that._themeManager.theme("valueIndicators"),
type = _normalizeEnum(options.type || that._themeManager.theme(defaultTypeField)),
settings = _extend(true, {}, theme._default, theme[type], options);
settings.type = type;
settings.animation = that._animationSettings;
settings.containerBackgroundColor = that._containerBackgroundColor;
that._updateIndicatorSettings(settings);
return settings
},
_cleanValueIndicators: function() {
this._valueIndicator && this._valueIndicator.clean();
this._subvalueIndicatorsSet && this._subvalueIndicatorsSet.clean()
},
_prepareValueIndicators: function() {
var that = this;
that._prepareValueIndicator();
null !== that.__subvalues && that._prepareSubvalueIndicators();
return [that._valueIndicator, that._subvalueIndicatorsSet]
},
_updateActiveElements: function() {
this._updateValueIndicator();
this._updateSubvalueIndicators()
},
_prepareValueIndicator: function() {
var that = this,
target = that._valueIndicator,
settings = that._prepareIndicatorSettings(that.option("valueIndicator") || {}, "valueIndicatorType");
if (target && target.type !== settings.type) {
target.dispose();
target = null
}
if (!target) {
target = that._valueIndicator = that._createIndicator(settings.type, that._renderer.root, "dxg-value-indicator", "value-indicator")
}
target.render(settings)
},
_createSubvalueIndicatorsSet: function() {
var that = this,
root = that._renderer.root;
return new ValueIndicatorsSet({
createIndicator: function(type, i) {
return that._createIndicator(type, root, "dxg-subvalue-indicator", "subvalue-indicator", i)
},
createPalette: function(palette) {
return that._themeManager.createPalette(palette)
}
})
},
_prepareSubvalueIndicators: function() {
var isRecreate, dummy, that = this,
target = that._subvalueIndicatorsSet,
settings = that._prepareIndicatorSettings(that.option("subvalueIndicator") || {}, "subvalueIndicatorType");
if (!target) {
target = that._subvalueIndicatorsSet = that._createSubvalueIndicatorsSet()
}
isRecreate = settings.type !== target.type;
target.type = settings.type;
dummy = that._createIndicator(settings.type, that._renderer.root);
if (dummy) {
dummy.dispose();
target.render(settings, isRecreate)
}
},
_setupValue: function(value) {
this.__value = processValue(value, this.__value)
},
_setupSubvalues: function(subvalues) {
var i, ii, list, vals = void 0 === subvalues ? this.__subvalues : parseArrayOfNumbers(subvalues);
if (null === vals) {
return
}
for (i = 0, ii = vals.length, list = []; i < ii; ++i) {
list.push(processValue(vals[i], this.__subvalues[i]))
}
this.__subvalues = list
},
_updateValueIndicator: function() {
var that = this;
that._valueIndicator && that._valueIndicator.value(that.__value, that._noAnimation)
},
_updateSubvalueIndicators: function() {
var that = this;
that._subvalueIndicatorsSet && that._subvalueIndicatorsSet.values(that.__subvalues, that._noAnimation)
},
value: function(arg) {
if (void 0 !== arg) {
this._changeValue(arg);
return this
}
return this.__value
},
subvalues: function(arg) {
if (void 0 !== arg) {
this._changeSubvalues(arg);
return this
}
return null !== this.__subvalues ? this.__subvalues.slice() : void 0
},
_changeValue: function(value) {
var that = this;
that._setupValue(value);
that._beginValueChanging();
that._updateValueIndicator();
if (that.__value !== that.option(OPTION_VALUE)) {
that.option(OPTION_VALUE, that.__value)
}
that._endValueChanging()
},
_changeSubvalues: function(subvalues) {
var that = this;
if (null !== that.__subvalues) {
that._setupSubvalues(subvalues);
that._beginValueChanging();
that._updateSubvalueIndicators();
if (!_compareArrays(that.__subvalues, that.option(OPTION_SUBVALUES))) {
that.option(OPTION_SUBVALUES, that.__subvalues)
}
that._endValueChanging()
}
},
_optionChangesMap: {
scale: "DOMAIN",
rangeContainer: "MOSTLY_TOTAL",
valueIndicator: "MOSTLY_TOTAL",
subvalueIndicator: "MOSTLY_TOTAL",
containerBackgroundColor: "MOSTLY_TOTAL",
value: "VALUE",
subvalues: "SUBVALUES",
valueIndicators: "MOSTLY_TOTAL"
},
_customChangesOrder: ["VALUE", "SUBVALUES"],
_change_VALUE: function() {
this._changeValue(this.option(OPTION_VALUE))
},
_change_SUBVALUES: function() {
this._changeSubvalues(this.option(OPTION_SUBVALUES))
},
_applyMainLayout: null,
_getElementLayout: null,
_createIndicator: function(type, owner, className, trackerType, trackerIndex, _strict) {
var that = this,
indicator = that._factory.createIndicator({
renderer: that._renderer,
translator: that._translator,
owner: owner,
tracker: that._tracker,
className: className
}, type, _strict);
if (indicator) {
indicator.type = type;
indicator._trackerInfo = {
type: trackerType,
index: trackerIndex
}
}
return indicator
},
_getApproximateScreenRange: null
});
function valueGetter(arg) {
return arg ? arg.value : null
}
function setupValues(that, fieldName, optionItems) {
var currentValues = that[fieldName],
newValues = _isArray(optionItems) ? _map(optionItems, valueGetter) : [],
i = 0,
ii = newValues.length,
list = [];
for (; i < ii; ++i) {
list.push(processValue(newValues[i], currentValues[i]))
}
that[fieldName] = list
}
function selectMode(gauge) {
if (void 0 === gauge.option(OPTION_VALUE) && void 0 === gauge.option(OPTION_SUBVALUES)) {
if (void 0 !== gauge.option("valueIndicators")) {
disableDefaultMode(gauge);
selectHardMode(gauge)
}
}
}
function disableDefaultMode(that) {
that.value = that.subvalues = _noop;
that._setupValue = that._setupSubvalues = that._updateValueIndicator = that._updateSubvalueIndicators = null
}
function selectHardMode(that) {
that._indicatorValues = [];
setupValues(that, "_indicatorValues", that.option("valueIndicators"));
that._valueIndicators = [];
var _applyMostlyTotalChange = that._applyMostlyTotalChange;
that._applyMostlyTotalChange = function() {
setupValues(this, "_indicatorValues", this.option("valueIndicators"));
_applyMostlyTotalChange.call(this)
};
that._updateActiveElements = updateActiveElements_hardMode;
that._prepareValueIndicators = prepareValueIndicators_hardMode;
that._disposeValueIndicators = disposeValueIndicators_hardMode;
that._cleanValueIndicators = cleanValueIndicators_hardMode;
that.indicatorValue = indicatorValue_hardMode
}
function updateActiveElements_hardMode() {
var that = this;
_each(that._valueIndicators, function(_, valueIndicator) {
valueIndicator.value(that._indicatorValues[valueIndicator.index], that._noAnimation)
})
}
function prepareValueIndicators_hardMode() {
var ii, that = this,
valueIndicators = that._valueIndicators || [],
userOptions = that.option("valueIndicators"),
optionList = [],
i = 0;
for (ii = _isArray(userOptions) ? userOptions.length : 0; i < ii; ++i) {
optionList.push(userOptions[i])
}
for (ii = valueIndicators.length; i < ii; ++i) {
optionList.push(null)
}
var newValueIndicators = [];
_each(optionList, function(i, userSettings) {
var valueIndicator = valueIndicators[i];
if (!userSettings) {
valueIndicator && valueIndicator.dispose();
return
}
var settings = that._prepareIndicatorSettings(userSettings, "valueIndicatorType");
if (valueIndicator && valueIndicator.type !== settings.type) {
valueIndicator.dispose();
valueIndicator = null
}
if (!valueIndicator) {
valueIndicator = that._createIndicator(settings.type, that._renderer.root, "dxg-value-indicator", "value-indicator", i, true)
}
if (valueIndicator) {
valueIndicator.index = i;
valueIndicator.render(settings);
newValueIndicators.push(valueIndicator)
}
});
that._valueIndicators = newValueIndicators;
return that._valueIndicators
}
function disposeValueIndicators_hardMode() {
_each(this._valueIndicators, function(_, valueIndicator) {
valueIndicator.dispose()
});
this._valueIndicators = null
}
function cleanValueIndicators_hardMode() {
_each(this._valueIndicators, function(_, valueIndicator) {
valueIndicator.clean()
})
}
function indicatorValue_hardMode(index, value) {
return accessPointerValue(this, this._valueIndicators, this._indicatorValues, index, value)
}
function accessPointerValue(that, pointers, values, index, value) {
if (void 0 !== value) {
if (void 0 !== values[index]) {
values[index] = processValue(value, values[index]);
pointers[index] && pointers[index].value(values[index])
}
return that
} else {
return values[index]
}
}
function ValueIndicatorsSet(parameters) {
this._parameters = parameters;
this._indicators = []
}
ValueIndicatorsSet.prototype = {
constructor: ValueIndicatorsSet,
dispose: function() {
var that = this;
_each(that._indicators, function(_, indicator) {
indicator.dispose()
});
that._parameters = that._options = that._indicators = that._colorPalette = that._palette = null;
return that
},
clean: function() {
var that = this;
that._sample && that._sample.clean().dispose();
_each(that._indicators, function(_, indicator) {
indicator.clean()
});
that._sample = that._options = that._palette = null;
return that
},
render: function(options, isRecreate) {
var that = this;
that._options = options;
that._sample = that._parameters.createIndicator(that.type);
that._sample.render(options);
that.enabled = that._sample.enabled;
that._palette = _isDefined(options.palette) ? that._parameters.createPalette(options.palette) : null;
if (that.enabled) {
that._generatePalette(that._indicators.length);
that._indicators = _map(that._indicators, function(indicator, i) {
if (isRecreate) {
indicator.dispose();
indicator = that._parameters.createIndicator(that.type, i)
}
indicator.render(that._getIndicatorOptions(i));
return indicator
})
}
return that
},
getOffset: function() {
return _Number(this._options.offset) || 0
},
resize: function(layout) {
var that = this;
that._layout = layout;
_each(that._indicators, function(_, indicator) {
indicator.resize(layout)
});
return that
},
measure: function(layout) {
return this._sample.measure(layout)
},
_getIndicatorOptions: function(index) {
var result = this._options;
if (this._colorPalette) {
result = _extend({}, result, {
color: this._colorPalette[index]
})
}
return result
},
_generatePalette: function(count) {
var that = this,
colors = null;
if (that._palette) {
colors = [];
that._palette.reset();
var i = 0;
for (; i < count; ++i) {
colors.push(that._palette.getNextColor())
}
}
that._colorPalette = colors
},
_adjustIndicatorsCount: function(count) {
var i, ii, indicator, that = this,
indicators = that._indicators,
indicatorsLen = indicators.length;
if (indicatorsLen > count) {
for (i = count, ii = indicatorsLen; i < ii; ++i) {
indicators[i].clean().dispose()
}
that._indicators = indicators.slice(0, count);
that._generatePalette(indicators.length)
} else {
if (indicatorsLen < count) {
that._generatePalette(count);
for (i = indicatorsLen, ii = count; i < ii; ++i) {
indicator = that._parameters.createIndicator(that.type, i);
indicator.render(that._getIndicatorOptions(i)).resize(that._layout);
indicators.push(indicator)
}
}
}
},
values: function(arg, _noAnimation) {
var that = this;
if (!that.enabled) {
return
}
if (void 0 !== arg) {
if (!_isArray(arg)) {
arg = _isFinite(arg) ? [Number(arg)] : null
}
if (arg) {
that._adjustIndicatorsCount(arg.length);
_each(that._indicators, function(i, indicator) {
indicator.value(arg[i], _noAnimation)
})
}
return that
}
return _map(that._indicators, function(indicator) {
return indicator.value()
})
}
};
exports.createIndicatorCreator = function(indicators) {
return function(parameters, type, _strict) {
var indicatorType = indicators[_normalizeEnum(type)] || !_strict && indicators._default;
return indicatorType ? new indicatorType(parameters) : null
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**********************************************!*\
!*** ./Scripts/viz/range_selector/common.js ***!
\**********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var _format = __webpack_require__( /*! ../core/format */ 162),
isFunction = __webpack_require__( /*! ../../core/utils/common */ 2).isFunction,
HEIGHT_COMPACT_MODE = 24,
POINTER_SIZE = 4,
EMPTY_SLIDER_MARKER_TEXT = ". . .";
var utils = {
trackerSettings: {
fill: "grey",
stroke: "grey",
opacity: 1e-4
},
animationSettings: {
duration: 250
}
};
var consts = {
emptySliderMarkerText: EMPTY_SLIDER_MARKER_TEXT,
pointerSize: POINTER_SIZE
};
var formatValue = function(value, formatOptions) {
var formatObject = {
value: value,
valueText: _format(value, formatOptions)
};
return String(isFunction(formatOptions.customizeText) ? formatOptions.customizeText.call(formatObject, formatObject) : formatObject.valueText)
};
exports.utils = utils;
exports.consts = consts;
exports.formatValue = formatValue;
exports.HEIGHT_COMPACT_MODE = HEIGHT_COMPACT_MODE
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*******************************************!*\
!*** ./Scripts/viz/series/line_series.js ***!
\*******************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
series = __webpack_require__( /*! ./scatter_series */ 88),
chartScatterSeries = series.chart,
polarScatterSeries = series.polar,
objectUtils = __webpack_require__( /*! ../../core/utils/object */ 30),
vizUtils = __webpack_require__( /*! ../core/utils */ 6),
normalizeAngle = vizUtils.normalizeAngle,
CANVAS_POSITION_START = "canvas_position_start",
CANVAS_POSITION_TOP = "canvas_position_top",
DISCRETE = "discrete",
_map = vizUtils.map,
_extend = $.extend,
_each = $.each;
exports.chart = {};
exports.polar = {};
function clonePoint(point, newX, newY, newAngle) {
var p = objectUtils.clone(point);
p.x = newX;
p.y = newY;
p.angle = newAngle;
return p
}
function getTangentPoint(point, prevPoint, centerPoint, tan, nextStepAngle) {
var correctAngle = point.angle + nextStepAngle,
cossin = vizUtils.getCosAndSin(correctAngle),
x = centerPoint.x + (point.radius + tan * nextStepAngle) * cossin.cos,
y = centerPoint.y - (point.radius + tan * nextStepAngle) * cossin.sin;
return clonePoint(prevPoint, x, y, correctAngle)
}
var lineMethods = {
_applyGroupSettings: function(style, settings, group) {
var that = this;
settings = _extend(settings, style);
that._applyElementsClipRect(settings);
group.attr(settings)
},
_setGroupsSettings: function(animationEnabled) {
var that = this,
style = that._styles.normal;
that._applyGroupSettings(style.elements, {
"class": "dxc-elements"
}, that._elementsGroup);
that._bordersGroup && that._applyGroupSettings(style.border, {
"class": "dxc-borders"
}, that._bordersGroup);
chartScatterSeries._setGroupsSettings.call(that, animationEnabled);
animationEnabled && that._markersGroup && that._markersGroup.attr({
opacity: .001
})
},
_createGroups: function() {
var that = this;
that._createGroup("_elementsGroup", that, that._group);
that._areBordersVisible() && that._createGroup("_bordersGroup", that, that._group);
chartScatterSeries._createGroups.call(that)
},
_areBordersVisible: function() {
return false
},
_getDefaultSegment: function(segment) {
return {
line: _map(segment.line || [], function(pt) {
return pt.getDefaultCoords()
})
}
},
_prepareSegment: function(points) {
return {
line: points
}
},
_parseLineOptions: function(options, defaultColor) {
return {
stroke: options.color || defaultColor,
"stroke-width": options.width,
dashStyle: options.dashStyle || "solid"
}
},
_parseStyle: function(options, defaultColor) {
return {
elements: this._parseLineOptions(options, defaultColor)
}
},
_applyStyle: function(style) {
var that = this;
that._elementsGroup && that._elementsGroup.attr(style.elements);
_each(that._graphics || [], function(_, graphic) {
graphic.line && graphic.line.attr({
"stroke-width": style.elements["stroke-width"]
}).sharp()
})
},
_drawElement: function(segment, group) {
return {
line: this._createMainElement(segment.line, {
"stroke-width": this._styles.normal.elements["stroke-width"]
}).append(group)
}
},
_removeElement: function(element) {
element.line.remove()
},
_generateDefaultSegments: function() {
var that = this;
return _map(that._segments || [], function(segment) {
return that._getDefaultSegment(segment)
})
},
_updateElement: function(element, segment, animate, animateParams, complete) {
var params = {
points: segment.line
},
lineElement = element.line;
animate ? lineElement.animate(params, animateParams, complete) : lineElement.attr(params)
},
_clearingAnimation: function(translator, drawComplete) {
var that = this,
lastIndex = that._graphics.length - 1,
settings = {
opacity: .001
},
options = {
duration: that._defaultDuration,
partitionDuration: .5
};
that._labelsGroup && that._labelsGroup.animate(settings, options, function() {
that._markersGroup && that._markersGroup.animate(settings, options, function() {
_each(that._defaultSegments || [], function(i, segment) {
that._oldUpdateElement(that._graphics[i], segment, true, {
partitionDuration: .5
}, i === lastIndex ? drawComplete : void 0)
})
})
})
},
_animateComplete: function() {
var that = this;
chartScatterSeries._animateComplete.call(this);
that._markersGroup && that._markersGroup.animate({
opacity: 1
}, {
duration: that._defaultDuration
})
},
_animate: function() {
var that = this,
lastIndex = that._graphics.length - 1;
_each(that._graphics || [], function(i, elem) {
that._updateElement(elem, that._segments[i], true, {
complete: i === lastIndex ? function() {
that._animateComplete()
} : void 0
})
})
},
_drawPoint: function(options) {
chartScatterSeries._drawPoint.call(this, {
point: options.point,
groups: options.groups
})
},
_createMainElement: function(points, settings) {
return this._renderer.path(points, "line").attr(settings).sharp()
},
_drawSegment: function(points, animationEnabled, segmentCount, lastSegment) {
var that = this,
segment = that._prepareSegment(points, that._options.rotated, lastSegment);
that._segments.push(segment);
if (!that._graphics[segmentCount]) {
that._graphics[segmentCount] = that._drawElement(animationEnabled ? that._getDefaultSegment(segment) : segment, that._elementsGroup)
} else {
if (!animationEnabled) {
that._updateElement(that._graphics[segmentCount], segment)
}
}
},
_getTrackerSettings: function() {
var that = this,
defaultTrackerWidth = that._defaultTrackerWidth,
strokeWidthFromElements = that._styles.normal.elements["stroke-width"];
return {
"stroke-width": strokeWidthFromElements > defaultTrackerWidth ? strokeWidthFromElements : defaultTrackerWidth,
fill: "none"
}
},
_getMainPointsFromSegment: function(segment) {
return segment.line
},
_drawTrackerElement: function(segment) {
return this._createMainElement(this._getMainPointsFromSegment(segment), this._getTrackerSettings(segment))
},
_updateTrackerElement: function(segment, element) {
var settings = this._getTrackerSettings(segment);
settings.points = this._getMainPointsFromSegment(segment);
element.attr(settings)
}
};
exports.chart.line = _extend({}, chartScatterSeries, lineMethods);
exports.chart.stepline = _extend({}, exports.chart.line, {
_calculateStepLinePoints: function(points) {
var segment = [];
_each(points, function(i, pt) {
var stepY, point;
if (!i) {
segment.push(pt);
return
}
stepY = segment[segment.length - 1].y;
if (stepY !== pt.y) {
point = objectUtils.clone(pt);
point.y = stepY;
segment.push(point)
}
segment.push(pt)
});
return segment
},
_prepareSegment: function(points) {
return exports.chart.line._prepareSegment(this._calculateStepLinePoints(points))
}
});
exports.chart.spline = _extend({}, exports.chart.line, {
_calculateBezierPoints: function(src, rotated) {
var bezierPoints = [],
pointsCopy = src,
checkExtr = function(otherPointCoord, pointCoord, controlCoord) {
return otherPointCoord > pointCoord && controlCoord > otherPointCoord || otherPointCoord < pointCoord && controlCoord < otherPointCoord ? otherPointCoord : controlCoord
};
if (1 !== pointsCopy.length) {
_each(pointsCopy, function(i, curPoint) {
var leftControlX, leftControlY, rightControlX, rightControlY, prevPoint, nextPoint, xCur, yCur, x1, x2, y1, y2, curIsExtremum, leftPoint, rightPoint, a, b, c, xc, yc, shift, lambda = .5;
if (!i) {
bezierPoints.push(curPoint);
bezierPoints.push(curPoint);
return
}
prevPoint = pointsCopy[i - 1];
if (i < pointsCopy.length - 1) {
nextPoint = pointsCopy[i + 1];
xCur = curPoint.x;
yCur = curPoint.y;
x1 = prevPoint.x;
x2 = nextPoint.x;
y1 = prevPoint.y;
y2 = nextPoint.y;
curIsExtremum = !!(!rotated && (yCur <= prevPoint.y && yCur <= nextPoint.y || yCur >= prevPoint.y && yCur >= nextPoint.y) || rotated && (xCur <= prevPoint.x && xCur <= nextPoint.x || xCur >= prevPoint.x && xCur >= nextPoint.x));
if (curIsExtremum) {
if (!rotated) {
rightControlY = leftControlY = yCur;
rightControlX = (xCur + nextPoint.x) / 2;
leftControlX = (xCur + prevPoint.x) / 2
} else {
rightControlX = leftControlX = xCur;
rightControlY = (yCur + nextPoint.y) / 2;
leftControlY = (yCur + prevPoint.y) / 2
}
} else {
a = y2 - y1;
b = x1 - x2;
c = y1 * x2 - x1 * y2;
if (!rotated) {
xc = xCur;
yc = -1 * (a * xc + c) / b;
shift = yc - yCur || 0;
y1 -= shift;
y2 -= shift
} else {
yc = yCur;
xc = -1 * (b * yc + c) / a;
shift = xc - xCur || 0;
x1 -= shift;
x2 -= shift
}
rightControlX = (xCur + lambda * x2) / (1 + lambda);
rightControlY = (yCur + lambda * y2) / (1 + lambda);
leftControlX = (xCur + lambda * x1) / (1 + lambda);
leftControlY = (yCur + lambda * y1) / (1 + lambda)
}
if (!rotated) {
leftControlY = checkExtr(prevPoint.y, yCur, leftControlY);
rightControlY = checkExtr(nextPoint.y, yCur, rightControlY)
} else {
leftControlX = checkExtr(prevPoint.x, xCur, leftControlX);
rightControlX = checkExtr(nextPoint.x, xCur, rightControlX)
}
leftPoint = clonePoint(curPoint, leftControlX, leftControlY);
rightPoint = clonePoint(curPoint, rightControlX, rightControlY);
bezierPoints.push(leftPoint, curPoint, rightPoint)
} else {
bezierPoints.push(curPoint, curPoint);
return
}
})
} else {
bezierPoints.push(pointsCopy[0])
}
return bezierPoints
},
_prepareSegment: function(points, rotated) {
return exports.chart.line._prepareSegment(this._calculateBezierPoints(points, rotated))
},
_createMainElement: function(points, settings) {
return this._renderer.path(points, "bezier").attr(settings).sharp()
}
});
exports.polar.line = _extend({}, polarScatterSeries, lineMethods, {
_prepareSegment: function(points, rotated, lastSegment) {
var i, preparedPoints = [],
centerPoint = this.translators.translate(CANVAS_POSITION_START, CANVAS_POSITION_TOP);
lastSegment && this._closeSegment(points);
if (this.argumentAxisType !== DISCRETE && this.valueAxisType !== DISCRETE) {
for (i = 1; i < points.length; i++) {
preparedPoints = preparedPoints.concat(this._getTangentPoints(points[i], points[i - 1], centerPoint))
}
if (!preparedPoints.length) {
preparedPoints = points
}
} else {
return exports.chart.line._prepareSegment.apply(this, arguments)
}
return {
line: preparedPoints
}
},
_getRemainingAngle: function(angle) {
var normAngle = normalizeAngle(angle);
return angle >= 0 ? 360 - normAngle : -normAngle
},
_closeSegment: function(points) {
var point, differenceAngle;
if (this._segments.length) {
point = this._segments[0].line[0]
} else {
point = clonePoint(points[0], points[0].x, points[0].y, points[0].angle)
}
if (points[points.length - 1].angle !== point.angle) {
if (normalizeAngle(Math.round(points[points.length - 1].angle)) === normalizeAngle(Math.round(point.angle))) {
point.angle = points[points.length - 1].angle
} else {
differenceAngle = points[points.length - 1].angle - point.angle;
point.angle = points[points.length - 1].angle + this._getRemainingAngle(differenceAngle)
}
points.push(point)
}
},
_getTangentPoints: function(point, prevPoint, centerPoint) {
var i, tangentPoints = [],
betweenAngle = Math.round(prevPoint.angle - point.angle),
tan = (prevPoint.radius - point.radius) / betweenAngle;
if (0 === betweenAngle) {
tangentPoints = [prevPoint, point]
} else {
if (betweenAngle > 0) {
for (i = betweenAngle; i >= 0; i--) {
tangentPoints.push(getTangentPoint(point, prevPoint, centerPoint, tan, i))
}
} else {
for (i = 0; i >= betweenAngle; i--) {
tangentPoints.push(getTangentPoint(point, prevPoint, centerPoint, tan, betweenAngle - i))
}
}
}
return tangentPoints
}
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!************************************************!*\
!*** ./Scripts/viz/series/points/bar_point.js ***!
\************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
_extend = $.extend,
_math = Math,
_floor = _math.floor,
_abs = _math.abs,
_min = _math.min,
symbolPoint = __webpack_require__( /*! ./symbol_point */ 104),
CANVAS_POSITION_DEFAULT = "canvas_position_default",
DEFAULT_BAR_TRACKER_SIZE = 9,
CORRECTING_BAR_TRACKER_VALUE = 4,
RIGHT = "right",
LEFT = "left",
TOP = "top",
BOTTOM = "bottom";
module.exports = _extend({}, symbolPoint, {
correctCoordinates: function(correctOptions) {
var correction = _floor(correctOptions.offset - correctOptions.width / 2),
rotated = this._options.rotated,
valueSelector = rotated ? "height" : "width",
correctionSelector = (rotated ? "y" : "x") + "Correction";
this[valueSelector] = correctOptions.width;
this[correctionSelector] = correction
},
_getGraphicBbox: function() {
var that = this,
bbox = {};
bbox.x = that.x;
bbox.y = that.y;
bbox.width = that.width;
bbox.height = that.height;
return bbox
},
_getLabelConnector: function(location) {
return this._getGraphicBbox(location)
},
_getLabelPosition: function() {
var position, that = this,
translators = that.translators,
initialValue = that.initialValue,
invertX = translators.x.getBusinessRange().invert,
invertY = translators.y.getBusinessRange().invert,
isDiscreteValue = "discrete" === that.series.valueAxisType,
isFullStacked = that.series.isFullStackedSeries(),
notVerticalInverted = !isDiscreteValue && (initialValue >= 0 && !invertY || initialValue < 0 && invertY) || isDiscreteValue && !invertY || isFullStacked,
notHorizontalInverted = !isDiscreteValue && (initialValue >= 0 && !invertX || initialValue < 0 && invertX) || isDiscreteValue && !invertX || isFullStacked;
if (!that._options.rotated) {
position = notVerticalInverted ? TOP : BOTTOM
} else {
position = notHorizontalInverted ? RIGHT : LEFT
}
return position
},
_getLabelCoords: function(label) {
var coords, that = this;
if (0 === that.initialValue && that.series.isFullStackedSeries()) {
if (!this._options.rotated) {
coords = that._getLabelCoordOfPosition(label, TOP)
} else {
coords = that._getLabelCoordOfPosition(label, RIGHT)
}
} else {
if ("inside" === label.getLayoutOptions().position) {
coords = that._getLabelCoordOfPosition(label, "inside")
} else {
coords = symbolPoint._getLabelCoords.call(this, label)
}
}
return coords
},
_checkLabelPosition: function(label, coord) {
var that = this,
visibleArea = that._getVisibleArea();
if (that._isPointInVisibleArea(visibleArea, that._getGraphicBbox())) {
return that._moveLabelOnCanvas(coord, visibleArea, label.getBoundingRect())
}
return coord
},
_isLabelInsidePoint: function(label) {
var that = this,
graphicBbox = that._getGraphicBbox(),
labelBbox = label.getBoundingRect();
if (that._options.resolveLabelsOverlapping && "inside" === label.getLayoutOptions().position) {
if (labelBbox.width > graphicBbox.width || labelBbox.height > graphicBbox.height) {
label.hide();
return true
}
}
return false
},
_moveLabelOnCanvas: function(coord, visibleArea, labelBbox) {
var x = coord.x,
y = coord.y;
if (visibleArea.minX > x) {
x = visibleArea.minX
}
if (visibleArea.maxX < x + labelBbox.width) {
x = visibleArea.maxX - labelBbox.width
}
if (visibleArea.minY > y) {
y = visibleArea.minY
}
if (visibleArea.maxY < y + labelBbox.height) {
y = visibleArea.maxY - labelBbox.height
}
return {
x: x,
y: y
}
},
_showForZeroValues: function() {
return this._options.label.showForZeroValues || this.initialValue
},
_drawMarker: function(renderer, group, animationEnabled) {
var that = this,
style = that._getStyle(),
x = that.x,
y = that.y,
width = that.width,
height = that.height,
r = that._options.cornerRadius;
if (animationEnabled) {
if (that._options.rotated) {
width = 0;
x = that.defaultX
} else {
height = 0;
y = that.defaultY
}
}
that.graphic = renderer.rect(x, y, width, height).attr({
rx: r,
ry: r
}).attr(style).data({
"chart-data-point": that
}).append(group)
},
_getSettingsForTracker: function() {
var that = this,
y = that.y,
height = that.height,
x = that.x,
width = that.width;
if (that._options.rotated) {
if (1 === width) {
width = DEFAULT_BAR_TRACKER_SIZE;
x -= CORRECTING_BAR_TRACKER_VALUE
}
} else {
if (1 === height) {
height = DEFAULT_BAR_TRACKER_SIZE;
y -= CORRECTING_BAR_TRACKER_VALUE
}
}
return {
x: x,
y: y,
width: width,
height: height
}
},
getGraphicSettings: function() {
var graphic = this.graphic;
return {
x: graphic.attr("x"),
y: graphic.attr("y"),
height: graphic.attr("height"),
width: graphic.attr("width")
}
},
_getEdgeTooltipParams: function(x, y, width, height) {
var xCoord, yCoord, isPositive = this.value >= 0,
invertedY = this.translators.y.getBusinessRange().invert,
invertedX = this.translators.x.getBusinessRange().invert;
if (this._options.rotated) {
yCoord = y + height / 2;
if (invertedX) {
xCoord = isPositive ? x : x + width
} else {
xCoord = isPositive ? x + width : x
}
} else {
xCoord = x + width / 2;
if (invertedY) {
yCoord = isPositive ? y + height : y
} else {
yCoord = isPositive ? y : y + height
}
}
return {
x: xCoord,
y: yCoord,
offset: 0
}
},
getTooltipParams: function(location) {
var x = this.x,
y = this.y,
width = this.width,
height = this.height;
return "edge" === location ? this._getEdgeTooltipParams(x, y, width, height) : {
x: x + width / 2,
y: y + height / 2,
offset: 0
}
},
_truncateCoord: function(coord, minBounce, maxBounce) {
if (coord < minBounce) {
return minBounce
}
if (coord > maxBounce) {
return maxBounce
}
return coord
},
_translateErrorBars: function(valueTranslator, argVisibleArea) {
symbolPoint._translateErrorBars.call(this, valueTranslator);
if (this._errorBarPos < argVisibleArea.min || this._errorBarPos > argVisibleArea.max) {
this._errorBarPos = void 0
}
},
_translate: function(translators) {
var arg, minArg, val, minVal, that = this,
rotated = that._options.rotated,
valAxis = rotated ? "x" : "y",
argAxis = rotated ? "y" : "x",
valIntervalName = rotated ? "width" : "height",
argIntervalName = rotated ? "height" : "width",
argTranslator = translators[argAxis],
valTranslator = translators[valAxis],
argVisibleArea = argTranslator.getCanvasVisibleArea(),
valVisibleArea = valTranslator.getCanvasVisibleArea();
arg = minArg = argTranslator.translate(that.argument) + (that[argAxis + "Correction"] || 0);
val = valTranslator.translate(that.value);
minVal = valTranslator.translate(that.minValue);
that["v" + valAxis] = val;
that["v" + argAxis] = arg + that[argIntervalName] / 2;
that[valIntervalName] = _abs(val - minVal);
that._calculateVisibility(rotated ? _min(val, minVal) : _min(arg, minArg), rotated ? _min(arg, minArg) : _min(val, minVal), that.width, that.height);
val = that._truncateCoord(val, valVisibleArea.min, valVisibleArea.max);
minVal = that._truncateCoord(minVal, valVisibleArea.min, valVisibleArea.max);
that[argAxis] = arg;
that["min" + argAxis.toUpperCase()] = minArg;
that[valIntervalName] = _abs(val - minVal);
that[valAxis] = _min(val, minVal) + (that[valAxis + "Correction"] || 0);
that["min" + valAxis.toUpperCase()] = minVal + (that[valAxis + "Correction"] || 0);
that["default" + valAxis.toUpperCase()] = valTranslator.translate(CANVAS_POSITION_DEFAULT);
that._translateErrorBars(valTranslator, argVisibleArea);
if (that.inVisibleArea) {
if (that[argAxis] < argVisibleArea.min) {
that[argIntervalName] = that[argIntervalName] - (argVisibleArea.min - that[argAxis]);
that[argAxis] = argVisibleArea.min;
that["min" + argAxis.toUpperCase()] = argVisibleArea.min
}
if (that[argAxis] + that[argIntervalName] > argVisibleArea.max) {
that[argIntervalName] = argVisibleArea.max - that[argAxis]
}
}
},
_updateMarker: function(animationEnabled, style) {
this.graphic.attr(_extend({}, style || this._getStyle(), !animationEnabled ? this.getMarkerCoords() : {}))
},
getMarkerCoords: function() {
return {
x: this.x,
y: this.y,
width: this.width,
height: this.height
}
},
coordsIn: function(x, y) {
var that = this;
return x >= that.x && x <= that.x + that.width && y >= that.y && y <= that.y + that.height
}
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************!*\
!*** ./Scripts/ui/calendar.js ***!
\********************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
module.exports = __webpack_require__( /*! ./calendar/ui.calendar */ 355)
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*****************************************!*\
!*** ./Scripts/bundles/modules/data.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var DevExpress = __webpack_require__( /*! ./core */ 97);
module.exports = DevExpress.data = DevExpress.data || {};
Object.defineProperty(DevExpress.data, "errorHandler", {
get: function() { /*! ../../data/errors */
return __webpack_require__(25).errorHandler
},
set: function(value) {
__webpack_require__( /*! ../../data/errors */ 25).errorHandler = value
}
});
Object.defineProperty(DevExpress.data, "_errorHandler", {
get: function() { /*! ../../data/errors */
return __webpack_require__(25)._errorHandler
},
set: function(value) {
__webpack_require__( /*! ../../data/errors */ 25)._errorHandler = value
}
});
DevExpress.data.DataSource = __webpack_require__( /*! ../../data/data_source */ 269);
DevExpress.data.query = __webpack_require__( /*! ../../data/query */ 34);
DevExpress.data.Store = __webpack_require__( /*! ../../data/abstract_store */ 50);
DevExpress.data.ArrayStore = __webpack_require__( /*! ../../data/array_store */ 58);
DevExpress.data.CustomStore = __webpack_require__( /*! ../../data/custom_store */ 202);
DevExpress.data.LocalStore = __webpack_require__( /*! ../../data/local_store */ 271);
DevExpress.data.base64_encode = __webpack_require__( /*! ../../data/utils */ 28).base64_encode;
DevExpress.data.Guid = __webpack_require__( /*! ../../core/guid */ 33);
DevExpress.data.utils = {};
DevExpress.data.utils.compileGetter = __webpack_require__( /*! ../../core/utils/data */ 16).compileGetter;
DevExpress.data.utils.compileSetter = __webpack_require__( /*! ../../core/utils/data */ 16).compileSetter;
DevExpress.EndpointSelector = __webpack_require__( /*! ../../data/endpoint_selector */ 270);
DevExpress.data.queryImpl = __webpack_require__( /*! ../../data/query */ 34).queryImpl;
DevExpress.data.queryAdapters = __webpack_require__( /*! ../../data/query_adapters */ 144);
var dataUtils = __webpack_require__( /*! ../../data/utils */ 28);
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 */ 16).toComparable;
DevExpress.data.utils.multiLevelGroup = __webpack_require__( /*! ../../data/abstract_store */ 50).multiLevelGroup;
DevExpress.data.utils.arrangeSortingInfo = __webpack_require__( /*! ../../data/abstract_store */ 50).arrangeSortingInfo;
DevExpress.data.utils.normalizeDataSourceOptions = __webpack_require__( /*! ../../data/data_source/data_source */ 37).normalizeDataSourceOptions
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/client_exporter/file_saver.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
errors = __webpack_require__( /*! ../ui/widget/ui.errors */ 20),
browser = __webpack_require__( /*! ../core/utils/browser */ 22),
commonUtils = __webpack_require__( /*! ../core/utils/common */ 2),
FILE_EXTESIONS = {
EXCEL: "xlsx",
CSS: "css",
PNG: "png",
JPEG: "jpeg",
GIF: "gif",
SVG: "svg",
PDF: "pdf"
};
var MIME_TYPES = exports.MIME_TYPES = {
CSS: "text/css",
EXCEL: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
PNG: "image/png",
JPEG: "image/jpeg",
GIF: "image/gif",
SVG: "image/svg+xml",
PDF: "application/pdf"
};
exports.fileSaver = {
_getDataUri: function(format, data) {
return "data:" + MIME_TYPES[format] + ";base64," + data
},
_linkDownloader: function(fileName, href, callback) {
var exportLinkElement = document.createElement("a"),
attributes = {
download: fileName,
href: href
};
if (commonUtils.isDefined(callback)) {
attributes.onclick = callback
}
document.body.appendChild(exportLinkElement);
$(exportLinkElement).css({
display: "none"
}).text("load").attr(attributes)[0].click();
return exportLinkElement
},
_formDownloader: function(proxyUrl, fileName, contentType, data, callback) {
var formAttributes = {
method: "post",
action: proxyUrl,
enctype: "multipart/form-data"
},
exportForm = $("
").append($svgObject[0]).html();
that._prepareImages(svgElem).done(function() {
$.each(that._imageArray, function(href, dataURI) {
markup = markup.split(href).join(dataURI)
});
blob.resolve(that._svgBlob(markup))
});
return blob
},
_svgBlob: function(markup) {
return new Blob([markup], {
type: "image/svg+xml"
})
}
};
exports.getBlob = function(data, options, callback) {
exports.svgCreator.getBlob(data, options).done(callback)
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************!*\
!*** ./Scripts/core/utils/locker.js ***!
\**************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var errors = __webpack_require__( /*! ../errors */ 10);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*************************************!*\
!*** ./Scripts/data/array_query.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../core/class */ 5),
commonUtils = __webpack_require__( /*! ../core/utils/common */ 2),
compileGetter = __webpack_require__( /*! ../core/utils/data */ 16).compileGetter,
toComparable = __webpack_require__( /*! ../core/utils/data */ 16).toComparable,
errorsModule = __webpack_require__( /*! ./errors */ 25),
dataUtils = __webpack_require__( /*! ./utils */ 28);
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 -1 === toComparable(toString(getter(obj))).indexOf(value)
}
}
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************!*\
!*** ./Scripts/data/custom_store.js ***!
\**************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
dataUtils = __webpack_require__( /*! ./utils */ 28),
errors = __webpack_require__( /*! ./errors */ 25).errors,
Store = __webpack_require__( /*! ./abstract_store */ 50);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************!*\
!*** ./Scripts/data/odata/mixins.js ***!
\**************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
stringUtils = __webpack_require__( /*! ../../core/utils/string */ 26),
odataUtils = __webpack_require__( /*! ./utils */ 71);
__webpack_require__( /*! ./query_adapter */ 112);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*************************************!*\
!*** ./Scripts/data/odata/store.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
odataUtils = __webpack_require__( /*! ./utils */ 71),
proxyUrlFormatter = __webpack_require__( /*! ../proxy_url_formatter */ 205),
errorsModule = __webpack_require__( /*! ../errors */ 25),
query = __webpack_require__( /*! ../query */ 34),
Store = __webpack_require__( /*! ../abstract_store */ 50),
mixins = __webpack_require__( /*! ./mixins */ 203);
__webpack_require__( /*! ./query_adapter */ 112);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*********************************************!*\
!*** ./Scripts/data/proxy_url_formatter.js ***!
\*********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
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
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*****************************************!*\
!*** ./Scripts/events/pointer/mouse.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
BaseStrategy = __webpack_require__( /*! ./base */ 113),
Observer = __webpack_require__( /*! ./observer */ 207);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************!*\
!*** ./Scripts/events/pointer/observer.js ***!
\********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1);
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 (-1 === getPointerIndex(e)) {
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*****************************************!*\
!*** ./Scripts/events/pointer/touch.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
devices = __webpack_require__( /*! ../../core/devices */ 7),
BaseStrategy = __webpack_require__( /*! ./base */ 113);
__webpack_require__( /*! ./touch_hooks */ 277);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/framework/action_executors.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
dataCoreUtils = __webpack_require__( /*! ../core/utils/data */ 16),
Route = __webpack_require__( /*! ./router */ 116).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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!******************************************!*\
!*** ./Scripts/framework/application.js ***!
\******************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var BACK_COMMAND_TITLE, $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../core/class */ 5),
abstract = Class.abstract,
Action = __webpack_require__( /*! ../core/action */ 54),
commonUtils = __webpack_require__( /*! ../core/utils/common */ 2),
mergeCommands = __webpack_require__( /*! ./utils */ 84).utils.mergeCommands,
createActionExecutors = __webpack_require__( /*! ./action_executors */ 209).createActionExecutors,
Router = __webpack_require__( /*! ./router */ 116),
NavigationManager = __webpack_require__( /*! ./navigation_manager */ 83),
StateManager = __webpack_require__( /*! ./state_manager */ 150),
dxCommand = __webpack_require__( /*! ./command */ 145),
messageLocalization = __webpack_require__( /*! ../localization/message */ 8),
CommandMapping = __webpack_require__( /*! ./command_mapping */ 146),
ViewCache = __webpack_require__( /*! ./view_cache */ 59),
EventsMixin = __webpack_require__( /*! ../core/events_mixin */ 32),
sessionStorage = __webpack_require__( /*! ../core/utils/storage */ 122).sessionStorage,
dataUtils = __webpack_require__( /*! ../data/utils */ 28),
errors = __webpack_require__( /*! ./errors */ 44),
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/framework/browser_adapters.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../core/class */ 5),
queue = __webpack_require__( /*! ../core/utils/queue */ 143);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************************!*\
!*** ./Scripts/framework/html/command_manager.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../../core/class */ 5),
errors = __webpack_require__( /*! ../errors */ 44),
CommandMapping = __webpack_require__( /*! ../command_mapping */ 146),
commandToDXWidgetAdapters = __webpack_require__( /*! ./widget_command_adapters */ 215);
__webpack_require__( /*! ../command */ 145);
__webpack_require__( /*! ./command_container */ 147);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************************!*\
!*** ./Scripts/framework/html/html_application.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
objectUtils = __webpack_require__( /*! ../../core/utils/object */ 30),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
Component = __webpack_require__( /*! ../../core/component */ 92),
errors = __webpack_require__( /*! ../errors */ 44),
Application = __webpack_require__( /*! ../application */ 210).Application,
ConditionalViewCacheDecorator = __webpack_require__( /*! ../view_cache */ 59).ConditionalViewCacheDecorator,
html = __webpack_require__( /*! ./presets */ 114),
CommandManager = __webpack_require__( /*! ./command_manager */ 212),
ViewEngine = __webpack_require__( /*! ./view_engine */ 214).ViewEngine,
messageLocalization = __webpack_require__( /*! ../../localization/message */ 8),
viewPort = __webpack_require__( /*! ../../core/utils/view_port */ 52).value,
initMobileViewportModule = __webpack_require__( /*! ../../mobile/init_mobile_viewport/init_mobile_viewport */ 218),
devices = __webpack_require__( /*! ../../core/devices */ 7),
feedbackEvents = __webpack_require__( /*! ../../events/core/emitter.feedback */ 70),
TransitionExecutorModule = __webpack_require__( /*! ../../animation/transition_executor/transition_executor */ 91),
animationPresetsModule = __webpack_require__( /*! ../../animation/presets/presets */ 110);
__webpack_require__( /*! ./layout_controller */ 148);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/framework/html/view_engine.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
version = __webpack_require__( /*! ../../core/version */ 123),
Class = __webpack_require__( /*! ../../core/class */ 5),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
errors = __webpack_require__( /*! ../errors */ 44),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 11),
_VIEW_ROLE = "dxView",
_LAYOUT_ROLE = "dxLayout",
MARKUP_TEMPLATE_MARKER = "MarkupTemplate:";
__webpack_require__( /*! ./view_engine_components */ 45);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************************!*\
!*** ./Scripts/framework/html/widget_command_adapters.js ***!
\***********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../../core/class */ 5),
commandToContainer = __webpack_require__( /*! ../utils */ 84).utils.commandToContainer,
fx = __webpack_require__( /*! ../../animation/fx */ 21),
TransitionExecutorModule = __webpack_require__( /*! ../../animation/transition_executor/transition_executor */ 91),
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************************!*\
!*** ./Scripts/integration/knockout/template_provider.js ***!
\***********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
ko = __webpack_require__( /*! knockout */ 40),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 11),
templateProvider = __webpack_require__( /*! ../../ui/widget/jquery.template_provider */ 160),
KoTemplate = __webpack_require__( /*! ./template */ 293),
defaultTemplates = __webpack_require__( /*! ./default_templates */ 291);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************!*\
!*** ./Scripts/localization/core.js ***!
\**************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*********************************************************************!*\
!*** ./Scripts/mobile/init_mobile_viewport/init_mobile_viewport.js ***!
\*********************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
resizeCallbacks = __webpack_require__( /*! ../../core/utils/window */ 57).resizeCallbacks,
support = __webpack_require__( /*! ../../core/utils/support */ 18),
devices = __webpack_require__( /*! ../../core/devices */ 7);
var initMobileViewport = function(options) {
options = $.extend({}, options);
var realDevice = devices.real();
var allowZoom = options.allowZoom;
var allowPan = options.allowPan;
var allowSelection = "allowSelection" in options ? options.allowSelection : "generic" === realDevice.platform;
var metaSelector = "meta[name=viewport]";
if (!$(metaSelector).length) {
$("
").attr("name", "viewport").appendTo("head")
}
var metaVerbs = ["width=device-width"],
msTouchVerbs = [];
if (allowZoom) {
msTouchVerbs.push("pinch-zoom")
} else {
metaVerbs.push("initial-scale=1.0", "maximum-scale=1.0, user-scalable=no")
}
if (allowPan) {
msTouchVerbs.push("pan-x", "pan-y")
}
if (!allowPan && !allowZoom) {
$("html, body").css({
"-ms-content-zooming": "none",
"-ms-user-select": "none",
overflow: "hidden"
})
} else {
$("html").css("-ms-overflow-style", "-ms-autohiding-scrollbar")
}
if (!allowSelection && support.supportProp("user-select")) {
$(".dx-viewport").css(support.styleProp("user-select"), "none")
}
$(metaSelector).attr("content", metaVerbs.join());
$("html").css("-ms-touch-action", msTouchVerbs.join(" ") || "none");
realDevice = devices.real();
if (support.touch && !("win" === realDevice.platform && 10 === realDevice.version[0])) {
$(document).off(".dxInitMobileViewport").on("dxpointermove.dxInitMobileViewport", function(e) {
var count = e.pointers.length,
isTouchEvent = "touch" === e.pointerType,
zoomDisabled = !allowZoom && count > 1,
panDisabled = !allowPan && 1 === count && !e.isScrollingEvent;
if (isTouchEvent && (zoomDisabled || panDisabled)) {
e.preventDefault()
}
})
}
if (realDevice.ios) {
var isPhoneGap = "file:" === document.location.protocol;
if (!isPhoneGap) {
resizeCallbacks.add(function() {
var windowWidth = $(window).width();
$("body").width(windowWidth)
})
}
}
if (realDevice.android) {
resizeCallbacks.add(function() {
setTimeout(function() {
document.activeElement.scrollIntoViewIfNeeded()
})
})
}
};
exports.initMobileViewport = initMobileViewport
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************************!*\
!*** ./Scripts/mobile/process_hardware_back_button.js ***!
\********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
hardwareBack = $.Callbacks();
module.exports = function() {
hardwareBack.fire()
};
module.exports.processCallback = hardwareBack
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!******************************!*\
!*** ./Scripts/ui/dialog.js ***!
\******************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Component = __webpack_require__( /*! ../core/component */ 92),
Action = __webpack_require__( /*! ../core/action */ 54),
domUtils = __webpack_require__( /*! ../core/utils/dom */ 11),
viewPortUtils = __webpack_require__( /*! ../core/utils/view_port */ 52),
devices = __webpack_require__( /*! ../core/devices */ 7),
themes = __webpack_require__( /*! ./themes */ 23),
errors = __webpack_require__( /*! ./widget/ui.errors */ 20),
messageLocalization = __webpack_require__( /*! ../localization/message */ 8),
Popup = __webpack_require__( /*! ./popup */ 53),
config = __webpack_require__( /*! ../core/config */ 35);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/bundles/modules/parts/core.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var DevExpress = __webpack_require__( /*! ../../../bundles/modules/core */ 97);
DevExpress.framework = __webpack_require__( /*! ../../../bundles/modules/framework */ 267);
__webpack_require__( /*! ../../../integration/angular */ 279);
__webpack_require__( /*! ../../../integration/knockout */ 85);
__webpack_require__( /*! ../../../localization/globalize/core */ 86);
__webpack_require__( /*! ../../../localization/globalize/message */ 302);
__webpack_require__( /*! ../../../localization/globalize/number */ 152);
__webpack_require__( /*! ../../../localization/globalize/date */ 301);
__webpack_require__( /*! ../../../localization/globalize/currency */ 300);
__webpack_require__( /*! ../../../events/click */ 9);
__webpack_require__( /*! ../../../events/contextmenu */ 173);
__webpack_require__( /*! ../../../events/dblclick */ 178);
__webpack_require__( /*! ../../../events/drag */ 62);
__webpack_require__( /*! ../../../events/hold */ 63);
__webpack_require__( /*! ../../../events/hover */ 133);
__webpack_require__( /*! ../../../events/pointer */ 13);
__webpack_require__( /*! ../../../events/swipe */ 82);
__webpack_require__( /*! ../../../events/transform */ 278);
module.exports = DevExpress
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**********************************************!*\
!*** ./Scripts/ui/widget/jquery.template.js ***!
\**********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
errors = __webpack_require__( /*! ../../core/errors */ 10),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
TemplateBase = __webpack_require__( /*! ./ui.template_base */ 47),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 11);
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(data) {
return $("
").append(currentTemplateEngine.render(this._compiledTemplate, data)).contents()
}
});
module.exports = Template;
module.exports.setTemplateEngine = setTemplateEngine
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*************************************************************!*\
!*** ./Scripts/ui/data_grid/ui.data_grid.editor_factory.js ***!
\*************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
isWrapped = __webpack_require__( /*! ../../core/utils/variable_wrapper */ 73).isWrapped,
compileGetter = __webpack_require__( /*! ../../core/utils/data */ 16).compileGetter,
gridCore = __webpack_require__( /*! ./ui.data_grid.core */ 17),
browser = __webpack_require__( /*! ../../core/utils/browser */ 22),
devices = __webpack_require__( /*! ../../core/devices */ 7),
positionUtils = __webpack_require__( /*! ../../animation/position */ 65),
eventUtils = __webpack_require__( /*! ../../events/utils */ 4),
dateLocalization = __webpack_require__( /*! ../../localization/date */ 14),
clickEvent = __webpack_require__( /*! ../../events/click */ 9),
pointerEvents = __webpack_require__( /*! ../../events/pointer */ 13),
normalizeDataSourceOptions = __webpack_require__( /*! ../../data/data_source/data_source */ 37).normalizeDataSourceOptions,
addNamespace = eventUtils.addNamespace;
__webpack_require__( /*! ../text_box */ 96);
__webpack_require__( /*! ../number_box */ 79);
__webpack_require__( /*! ../check_box */ 101);
__webpack_require__( /*! ../select_box */ 108);
__webpack_require__( /*! ../date_box */ 169);
var DATAGRID_CHECKBOX_SIZE_CLASS = "dx-datagrid-checkbox-size",
DATAGRID_CELL_FOCUS_DISABLED_CLASS = "dx-cell-focus-disabled",
DATAGRID_EDITOR_INLINE_BLOCK = "dx-editor-inline-block",
DATAGRID_MODULE_NAMESPACE = "dxDataGridEditorFactory",
DATAGRID_UPDATE_FOCUS_EVENTS = addNamespace([pointerEvents.down, "focusin", clickEvent.name].join(" "), DATAGRID_MODULE_NAMESPACE),
DATAGRID_FOCUS_OVERLAY_CLASS = "dx-datagrid-focus-overlay",
DATAGRID_FOCUSED_ELEMENT_CLASS = "dx-focused",
DATAGRID_CONTENT_CLASS = "dx-datagrid-content",
DATAGRID_POINTER_EVENTS_TARGET_CLASS = "dx-pointer-events-target",
DATAGRID_POINTER_EVENTS_NONE_CLASS = "dx-pointer-events-none",
DX_HIDDEN = "dx-hidden",
TAB_KEY = 9;
exports.EditorFactoryController = gridCore.ViewController.inherit(function() {
var getResultConfig = function(config, options) {
return $.extend(config, {
readOnly: options.readOnly,
placeholder: options.placeholder,
attr: {
id: options.id
}
}, options.editorOptions)
};
var getTextEditorConfig = function(options) {
var isEnterBug = browser.msie && parseInt(browser.version) <= 11 || devices.real().ios,
isValueChanged = false,
data = {},
sharedData = options.sharedData || data;
return getResultConfig({
placeholder: options.placeholder,
width: options.width,
value: options.value,
onValueChanged: function(e) {
var updateValue = function(e, notFireEvent) {
isValueChanged = false;
options && options.setValue(e.value, notFireEvent)
};
window.clearTimeout(data.valueChangeTimeout);
if (e.jQueryEvent && "keyup" === e.jQueryEvent.type) {
if ("filterRow" === options.parentType || "searchPanel" === options.parentType) {
sharedData.valueChangeTimeout = data.valueChangeTimeout = window.setTimeout(function() {
updateValue(e, data.valueChangeTimeout !== sharedData.valueChangeTimeout)
}, commonUtils.isDefined(options.updateValueTimeout) ? options.updateValueTimeout : 0)
} else {
isValueChanged = true
}
} else {
updateValue(e)
}
},
onFocusOut: function(e) {
if (isEnterBug && isValueChanged) {
isValueChanged = false;
options.setValue(e.component.option("value"))
}
},
onKeyDown: function(e) {
if (isEnterBug && isValueChanged && 13 === e.jQueryEvent.keyCode) {
isValueChanged = false;
options.setValue(e.component.option("value"))
}
},
valueChangeEvent: "change" + ("filterRow" === options.parentType || isEnterBug ? " keyup" : "")
}, options)
};
var prepareDateBox = function(options) {
options.editorName = "dxDateBox";
options.editorOptions = getResultConfig({
value: options.value,
onValueChanged: function(args) {
options.setValue(args.value)
},
displayFormat: commonUtils.isString(options.format) && dateLocalization.getPatternByFormat(options.format) || options.format,
formatWidthCalculator: null,
width: "auto"
}, options)
};
var prepareTextBox = function(options) {
var config = getTextEditorConfig(options),
isSearching = "searchPanel" === options.parentType,
toString = function(value) {
return commonUtils.isDefined(value) ? value.toString() : ""
};
config.value = toString(options.value);
config.valueChangeEvent += isSearching ? " keyup search" : "";
config.mode = isSearching ? "search" : "text";
options.editorName = "dxTextBox";
options.editorOptions = config
};
var prepareNumberBox = function(options) {
var config = getTextEditorConfig(options);
config.value = commonUtils.isDefined(options.value) ? options.value : null;
options.editorName = "dxNumberBox";
options.editorOptions = config
};
var prepareBooleanEditor = function(options) {
if ("filterRow" === options.parentType) {
prepareSelectBox($.extend(options, {
lookup: {
displayExpr: function(data) {
if (true === data) {
return options.trueText || "true"
} else {
if (false === data) {
return options.falseText || "false"
}
}
},
dataSource: [true, false]
}
}))
} else {
prepareCheckBox(options)
}
};
var prepareSelectBox = function(options) {
var displayGetter, dataSource, postProcess, lookup = options.lookup,
isFilterRow = "filterRow" === options.parentType;
if (lookup) {
displayGetter = compileGetter(lookup.displayExpr);
dataSource = lookup.dataSource;
if (commonUtils.isFunction(dataSource) && !isWrapped(dataSource)) {
dataSource = dataSource(options.row || {})
}
if (commonUtils.isObject(dataSource) || commonUtils.isArray(dataSource)) {
dataSource = normalizeDataSourceOptions(dataSource);
if (isFilterRow) {
postProcess = dataSource.postProcess;
dataSource.postProcess = function(items) {
if (0 === this.pageIndex()) {
items = items.slice(0);
items.unshift(null)
}
if (postProcess) {
return postProcess.call(this, items)
}
return items
}
}
}
options.editorName = "dxSelectBox";
options.editorOptions = getResultConfig({
searchEnabled: true,
value: options.value,
valueExpr: options.lookup.valueExpr,
searchExpr: options.lookup.searchExpr || options.lookup.displayExpr,
showClearButton: Boolean(lookup.allowClearing && !isFilterRow),
displayExpr: function(data) {
if (null === data) {
return options.showAllText
}
return displayGetter(data)
},
dataSource: dataSource,
onValueChanged: function(e) {
var params = [e.value];
!isFilterRow && params.push(e.component.option("text"));
options.setValue.apply(this, params)
}
}, options)
}
};
var prepareCheckBox = function(options) {
options.editorName = "dxCheckBox";
options.editorOptions = getResultConfig({
value: options.value,
hoverStateEnabled: !options.readOnly,
focusStateEnabled: !options.readOnly,
activeStateEnabled: false,
onValueChanged: function(e) {
options.setValue && options.setValue(e.value, e)
},
tabIndex: options.tabIndex ? options.tabIndex : 0
}, options)
};
var createEditorCore = function(that, options) {
if (options.editorName && options.editorOptions && options.editorElement[options.editorName]) {
if ("dxCheckBox" === options.editorName) {
options.editorElement.addClass(DATAGRID_CHECKBOX_SIZE_CLASS);
options.editorElement.parent().addClass(DATAGRID_EDITOR_INLINE_BLOCK);
if (options.command || options.editorOptions.readOnly) {
options.editorElement.parent().addClass(DATAGRID_CELL_FOCUS_DISABLED_CLASS)
}
}
that._createComponent(options.editorElement, options.editorName, options.editorOptions);
if ("dxTextBox" === options.editorName) {
options.editorElement.dxTextBox("instance").registerKeyHandler("enter", $.noop)
}
}
};
return {
_getFocusedElement: function($dataGridElement) {
return $dataGridElement.find("[tabindex]:focus, input:focus")
},
_updateFocusCore: function() {
var $focusCell, hideBorders, $focus = this._$focusedElement,
$dataGridElement = this.component && this.component.element();
if ($dataGridElement) {
$focus = this._getFocusedElement($dataGridElement);
if ($focus.length) {
if (!$focus.hasClass(DATAGRID_CELL_FOCUS_DISABLED_CLASS)) {
$focusCell = $focus.closest(".dx-row > td, ." + DATAGRID_CELL_FOCUS_DISABLED_CLASS);
hideBorders = $focusCell.get(0) !== $focus.get(0) && $focusCell.hasClass(DATAGRID_EDITOR_INLINE_BLOCK);
$focus = $focusCell
}
if ($focus.length && !$focus.hasClass(DATAGRID_CELL_FOCUS_DISABLED_CLASS)) {
this.focus($focus, hideBorders);
return
}
}
}
this.loseFocus()
},
_updateFocus: function(e) {
var that = this,
isFocusOverlay = e && e.jQueryEvent && $(e.jQueryEvent.target).hasClass(DATAGRID_FOCUS_OVERLAY_CLASS);
that._isFocusOverlay = that._isFocusOverlay || isFocusOverlay;
clearTimeout(that._updateFocusTimeoutID);
that._updateFocusTimeoutID = setTimeout(function() {
delete that._updateFocusTimeoutID;
if (!that._isFocusOverlay) {
that._updateFocusCore()
}
that._isFocusOverlay = false
})
},
_updateFocusOverlaySize: function($element, position) {
var location = positionUtils.calculate($element, $.extend({
collision: "fit"
}, position));
if (location.h.oversize > 0) {
$element.outerWidth($element.outerWidth() - location.h.oversize)
}
if (location.v.oversize > 0) {
$element.outerHeight($element.outerHeight() - location.v.oversize)
}
},
callbackNames: function() {
return ["focused"]
},
focus: function($element, hideBorder) {
var that = this;
if (void 0 === $element) {
return that._$focusedElement
} else {
if ($element) {
setTimeout(function() {
var focusOverlayPosition, $focusOverlay = that._$focusOverlay = that._$focusOverlay || $("
").addClass(DATAGRID_FOCUS_OVERLAY_CLASS + " " + DATAGRID_POINTER_EVENTS_TARGET_CLASS);
if (hideBorder) {
that._$focusOverlay && that._$focusOverlay.addClass(DX_HIDDEN)
} else {
var align = browser.msie ? "left bottom" : browser.mozilla ? "right bottom" : "left top",
$content = $element.closest("." + DATAGRID_CONTENT_CLASS);
$focusOverlay.removeClass(DX_HIDDEN).appendTo($content).outerWidth($element.outerWidth() + 1).outerHeight($element.outerHeight() + 1);
focusOverlayPosition = {
my: align,
at: align,
of: $element,
boundary: $content.length && $content
};
that._updateFocusOverlaySize($focusOverlay, focusOverlayPosition);
positionUtils.setup($focusOverlay, focusOverlayPosition);
$focusOverlay.css("visibility", "visible")
}
that._$focusedElement && that._$focusedElement.removeClass(DATAGRID_FOCUSED_ELEMENT_CLASS);
$element.addClass(DATAGRID_FOCUSED_ELEMENT_CLASS);
that._$focusedElement = $element;
that.focused.fire($element)
})
}
}
},
resize: function() {
var $focusedElement = this._$focusedElement;
if ($focusedElement) {
this.focus($focusedElement)
}
},
loseFocus: function() {
this._$focusedElement && this._$focusedElement.removeClass(DATAGRID_FOCUSED_ELEMENT_CLASS);
this._$focusedElement = null;
this._$focusOverlay && this._$focusOverlay.addClass(DX_HIDDEN)
},
init: function() {
this.createAction("onEditorPreparing", {
excludeValidators: ["designMode", "disabled", "readOnly"],
category: "rendering"
});
this.createAction("onEditorPrepared", {
excludeValidators: ["designMode", "disabled", "readOnly"],
category: "rendering"
});
this._updateFocusHandler = this._updateFocusHandler || this.createAction($.proxy(this._updateFocus, this));
$(document).on(DATAGRID_UPDATE_FOCUS_EVENTS, this._updateFocusHandler);
this._attachContainerEventHandlers()
},
_attachContainerEventHandlers: function() {
var that = this,
$container = that.component && that.component.element(),
isIE10OrLower = browser.msie && parseInt(browser.version) < 11;
if ($container) {
$container.on(addNamespace("keydown", DATAGRID_MODULE_NAMESPACE), function(e) {
if (e.which === TAB_KEY) {
that._updateFocusHandler(e)
}
});
isIE10OrLower && $container.on([pointerEvents.down, pointerEvents.up, clickEvent.name].join(" "), "." + DATAGRID_POINTER_EVENTS_TARGET_CLASS, $.proxy(that._focusOverlayEventProxy, that))
}
},
_focusOverlayEventProxy: function(e) {
var element, $target = $(e.target),
$currentTarget = $(e.currentTarget),
needProxy = $target.hasClass(DATAGRID_POINTER_EVENTS_TARGET_CLASS) || $target.hasClass(DATAGRID_POINTER_EVENTS_NONE_CLASS),
$focusedElement = this._$focusedElement;
if (!needProxy || $currentTarget.hasClass(DX_HIDDEN)) {
return
}
$currentTarget.addClass(DX_HIDDEN);
element = $target.get(0).ownerDocument.elementFromPoint(e.clientX, e.clientY);
eventUtils.fireEvent({
originalEvent: e,
target: element
});
e.stopPropagation();
$currentTarget.removeClass(DX_HIDDEN);
$focusedElement && $focusedElement.find("input").focus()
},
dispose: function() {
clearTimeout(this._updateFocusTimeoutID);
$(document).off(DATAGRID_UPDATE_FOCUS_EVENTS, this._updateFocusHandler)
},
createEditor: function($container, options) {
options.cancel = false;
options.editorElement = $container;
if (options.lookup) {
prepareSelectBox(options)
} else {
switch (options.dataType) {
case "date":
prepareDateBox(options);
break;
case "boolean":
prepareBooleanEditor(options);
break;
case "number":
prepareNumberBox(options);
break;
default:
prepareTextBox(options)
}
}
this.executeAction("onEditorPreparing", options);
if (options.cancel) {
return
}
createEditorCore(this, options);
this.executeAction("onEditorPrepared", options)
}
}
}());
gridCore.registerModule("editorFactory", {
defaultOptions: function() {
return {}
},
controllers: {
editorFactory: exports.EditorFactoryController
},
extenders: {
controllers: {
columnsResizer: {
_startResizing: function(args) {
this.callBase(args);
if (this.isResizing()) {
this.getController("editorFactory").loseFocus()
}
}
}
}
}
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!******************************************************!*\
!*** ./Scripts/ui/grid_core/ui.grid_core.modules.js ***!
\******************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../../core/class */ 5),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
errors = __webpack_require__( /*! ../widget/ui.errors */ 20),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 8);
var CallBacks = function(options) {
options = options || {};
var firing, firingIndex, list = [],
fireCore = function(context, args) {
firing = true;
for (firingIndex = 0; firingIndex < list.length; firingIndex++) {
if (list[firingIndex] && false === list[firingIndex].apply(context, args) && options.stopOnFalse) {
break
}
}
firing = false
},
that = {
add: function(fn) {
if ("function" === typeof fn && !that.has(fn)) {
list.push(fn)
}
return this
},
has: function(fn) {
return fn ? $.inArray(fn, list) > -1 : !!list.length
},
remove: function(fn) {
var index = $.inArray(fn, list);
if (index > -1) {
list.splice(index, 1);
if (firing && index <= firingIndex) {
firingIndex--
}
}
return this
},
fireWith: function(context, args) {
args = args || [];
fireCore(context, args.slice ? args.slice() : args)
},
fire: function() {
that.fireWith(this, arguments);
return this
},
empty: function() {
list = [];
return this
}
};
return that
};
var ModuleItem = Class.inherit({
_endUpdateCore: function() {},
ctor: function(component) {
var that = this;
that._updateLockCount = 0;
that.component = component;
that._actions = {};
that._actionConfigs = {};
$.each(this.callbackNames() || [], function(index, name) {
var flags = that.callbackFlags(name);
that[this] = CallBacks(flags)
})
},
init: function() {},
callbackNames: function() {},
callbackFlags: function(name) {},
publicMethods: function() {},
beginUpdate: function() {
this._updateLockCount++
},
endUpdate: function() {
if (this._updateLockCount > 0) {
this._updateLockCount--;
if (!this._updateLockCount) {
this._endUpdateCore()
}
}
},
option: function(name) {
var component = this.component,
optionCache = component._optionCache;
if (1 === arguments.length && optionCache) {
if (!(name in optionCache)) {
optionCache[name] = component.option(name)
}
return optionCache[name]
}
return component.option.apply(component, arguments)
},
localize: function(name) {
var optionCache = this.component._optionCache;
if (optionCache) {
if (!(name in optionCache)) {
optionCache[name] = messageLocalization.format(name)
}
return optionCache[name]
}
return messageLocalization.format(name)
},
on: function() {
return this.component.on.apply(this.component, arguments)
},
off: function() {
return this.component.off.apply(this.component, arguments)
},
optionChanged: function(args) {
if (args.name in this._actions) {
this.createAction(args.name, this._actionConfigs[args.name]);
args.handled = true
}
},
getAction: function(actionName) {
return this._actions[actionName]
},
setAria: function(name, value, $target) {
var target = $target.get(0),
prefix = "role" !== name && "id" !== name ? "aria-" : "";
if (target.setAttribute) {
target.setAttribute(prefix + name, value)
} else {
$target.attr(prefix + name, value)
}
},
_createComponent: function() {
return this.component._createComponent.apply(this.component, arguments)
},
getController: function(name) {
return this.component._controllers[name]
},
createAction: function(actionName, config) {
var action;
if (commonUtils.isFunction(actionName)) {
action = this.component._createAction($.proxy(actionName, this), config);
return function(e) {
action({
jQueryEvent: e
})
}
} else {
this._actions[actionName] = this.component._createActionByOption(actionName, config);
this._actionConfigs[actionName] = config
}
},
executeAction: function(actionName, options) {
var action = this._actions[actionName];
return action && action(options)
},
dispose: function() {
var that = this;
$.each(that.callbackNames() || [], function() {
that[this].empty()
})
}
});
var Controller = ModuleItem;
var ViewController = Controller.inherit({
getView: function(name) {
return this.component._views[name]
},
getViews: function() {
return this.component._views
}
});
var View = ModuleItem.inherit({
_isReady: function() {
return this.component.isReady()
},
_endUpdateCore: function() {
this.callBase();
if (!this._isReady() && this._requireReady) {
this._requireRender = false;
this.component._requireResize = false
}
if (this._requireRender) {
this._requireRender = false;
this.render(this._$parent)
}
},
_invalidate: function(requireResize, requireReady) {
this._requireRender = true;
this.component._requireResize = this.component._requireResize || requireResize;
this._requireReady = this._requireReady || requireReady
},
_renderCore: function(options) {},
_resizeCore: function() {},
_afterRender: function($root) {},
_parentElement: function() {
return this._$parent
},
ctor: function(component) {
this.callBase(component);
this.renderCompleted = $.Callbacks();
this.resizeCompleted = $.Callbacks()
},
element: function() {
return this._$element
},
isVisible: function() {
return true
},
getTemplate: function(name) {
return this.component._getTemplate(name)
},
render: function($parent, options) {
var $element = this._$element,
isVisible = this.isVisible();
this._requireReady = false;
if (!$element) {
$element = this._$element = $("
").appendTo($parent);
this._$parent = $parent
}
$element.toggleClass("dx-hidden", !isVisible);
if (isVisible) {
this.component._optionCache = {};
this._renderCore(options);
this.component._optionCache = void 0;
this._afterRender($parent);
this.renderCompleted.fire()
}
},
resize: function() {
this.isResizing = true;
this._resizeCore();
this.resizeCompleted.fire();
this.isResizing = false
},
focus: function() {
this.element().focus()
}
});
var MODULES_ORDER_MAX_INDEX = 1e6;
var processModules = function(that, componentClass) {
var modules = componentClass.modules,
modulesOrder = componentClass.modulesOrder,
controllerTypes = componentClass.controllerTypes || {},
viewTypes = componentClass.viewTypes || {};
if (!componentClass.controllerTypes) {
if (modulesOrder) {
modules.sort(function(module1, module2) {
var orderIndex1 = $.inArray(module1.name, modulesOrder);
var orderIndex2 = $.inArray(module2.name, modulesOrder);
if (orderIndex1 < 0) {
orderIndex1 = MODULES_ORDER_MAX_INDEX
}
if (orderIndex2 < 0) {
orderIndex2 = MODULES_ORDER_MAX_INDEX
}
return orderIndex1 - orderIndex2
})
}
$.each(modules, function() {
var controllers = this.controllers,
moduleName = this.name,
views = this.views;
controllers && $.each(controllers, function(name, type) {
if (controllerTypes[name]) {
throw errors.Error("E1001", moduleName, name)
} else {
if (!(type && type.subclassOf && type.subclassOf(Controller))) {
type.subclassOf(Controller);
throw errors.Error("E1002", moduleName, name)
}
}
controllerTypes[name] = type
});
views && $.each(views, function(name, type) {
if (viewTypes[name]) {
throw errors.Error("E1003", moduleName, name)
} else {
if (!(type && type.subclassOf && type.subclassOf(View))) {
throw errors.Error("E1004", moduleName, name)
}
}
viewTypes[name] = type
})
});
$.each(modules, function() {
var extenders = this.extenders;
if (extenders) {
extenders.controllers && $.each(extenders.controllers, function(name, extender) {
if (controllerTypes[name]) {
controllerTypes[name] = controllerTypes[name].inherit(extender)
}
});
extenders.views && $.each(extenders.views, function(name, extender) {
if (viewTypes[name]) {
viewTypes[name] = viewTypes[name].inherit(extender)
}
})
}
});
componentClass.controllerTypes = controllerTypes;
componentClass.viewTypes = viewTypes
}
var registerPublicMethods = function(that, name, moduleItem) {
var publicMethods = moduleItem.publicMethods();
if (publicMethods) {
$.each(publicMethods, function(index, methodName) {
if (moduleItem[methodName]) {
if (!that[methodName]) {
that[methodName] = function() {
return moduleItem[methodName].apply(moduleItem, arguments)
}
} else {
throw errors.Error("E1005", methodName)
}
} else {
throw errors.Error("E1006", name, methodName)
}
})
}
};
var createModuleItems = function(moduleTypes) {
var moduleItems = {};
$.each(moduleTypes, function(name, moduleType) {
var moduleItem = new moduleType(that);
moduleItem.name = name;
registerPublicMethods(that, name, moduleItem);
moduleItems[name] = moduleItem
});
return moduleItems
};
that._controllers = createModuleItems(controllerTypes);
that._views = createModuleItems(viewTypes)
};
var callModuleItemsMethod = function(that, methodName, args) {
args = args || [];
if (that._controllers) {
$.each(that._controllers, function() {
this[methodName] && this[methodName].apply(this, args)
})
}
if (that._views) {
$.each(that._views, function() {
this[methodName] && this[methodName].apply(this, args)
})
}
};
$.extend(exports, function() {
return {
modules: [],
View: View,
ViewController: ViewController,
Controller: Controller,
registerModule: function(name, module) {
var i, modules = this.modules;
for (i = 0; i < modules.length; i++) {
if (modules[i].name === name) {
return
}
}
module.name = name;
modules.push(module);
delete this.controllerTypes, delete this.viewTypes
},
registerModulesOrder: function(moduleNames) {
this.modulesOrder = moduleNames
},
unregisterModule: function(name) {
this.modules = $.grep(this.modules, function(module) {
return module.name !== name
});
delete this.controllerTypes, delete this.viewTypes
},
processModules: processModules,
callModuleItemsMethod: callModuleItemsMethod
}
}());
exports.CallBacks = CallBacks
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**********************************************************!*\
!*** ./Scripts/ui/pivot_grid/ui.pivot_grid.area_item.js ***!
\**********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../../core/class */ 5),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2);
var PIVOTGRID_EXPAND_CLASS = "dx-expand";
var getRealElementWidth = function(element) {
var clientRect, width = 0;
if (element.getBoundingClientRect) {
clientRect = element.getBoundingClientRect();
width = clientRect.width;
if (!width) {
width = clientRect.right - clientRect.left
}
}
if (width > 0) {
return width
} else {
return element.offsetWidth
}
};
function getFakeTableOffset(scrollPos, elementOffset, tableSize, viewPortSize) {
var offset = 0,
halfTableCount = 0,
halfTableSize = tableSize / 2;
if (scrollPos + viewPortSize - (elementOffset + tableSize) > 1) {
if (scrollPos >= elementOffset + tableSize + halfTableSize) {
halfTableCount = parseInt((scrollPos - (elementOffset + tableSize)) / halfTableSize, 10)
}
offset = elementOffset + tableSize + halfTableSize * halfTableCount
} else {
if (scrollPos < elementOffset) {
if (scrollPos <= elementOffset - halfTableSize) {
halfTableCount = parseInt((scrollPos - (elementOffset - halfTableSize)) / halfTableSize, 10)
}
offset = elementOffset - (tableSize - halfTableSize * halfTableCount)
} else {
offset = elementOffset
}
}
return offset
}
exports.getRealElementWidth = getRealElementWidth;
exports.AreaItem = Class.inherit({
_getRowElement: function(index) {
var that = this;
if (that._tableElement && that._tableElement.length > 0) {
return that._tableElement[0].rows[index]
}
return null
},
_createGroupElement: function() {
return $("
")
},
_createTableElement: function() {
return $("
")
},
_getCellText: function(cell, encodeHtml) {
var cellText = cell.isWhiteSpace ? "" : cell.text || "";
if (encodeHtml && (-1 !== cellText.indexOf("<") || -1 !== cellText.indexOf(">"))) {
cellText = $("").text(cellText).html()
}
return cellText
},
_getRowClassNames: function() {},
_applyCustomStyles: function(options) {
if (options.cell.width) {
options.cssArray.push("min-width:" + options.cell.width + "px")
}
if (options.cell.sorted) {
options.classArray.push("dx-pivotgrid-sorted")
}
},
_getMainElementMarkup: function() {
return "
"
},
_getCloseMainElementMarkup: function() {
return ""
},
_renderTableContent: function(tableElement, data) {
var row, cell, i, j, rowElement, cellElement, cellText, rowClassNames, that = this,
rowsCount = data.length,
rtlEnabled = that.option("rtlEnabled"),
markupArray = [],
encodeHtml = that.option("encodeHtml"),
colspan = "colspan='",
rowspan = "rowspan='";
tableElement.data("area", that._getAreaName());
tableElement.data("data", data);
tableElement.css("width", "");
markupArray.push(that._getMainElementMarkup());
for (i = 0; i < rowsCount; i++) {
row = data[i];
var columnMarkupArray = [];
rowClassNames = [];
markupArray.push("
");
if (commonUtils.isDefined(cell.expanded)) {
columnMarkupArray.push("
")
}
cellText = this._getCellText(cell, encodeHtml)
} else {
cellText = ""
}
columnMarkupArray.push("" + cellText + "");
if (cell.sorted) {
columnMarkupArray.push("")
}
columnMarkupArray.push("")
}
if (rowClassNames.length) {
markupArray.push("class='");
markupArray.push(rowClassNames.join(" "));
markupArray.push("'")
}
markupArray.push(">");
markupArray.push(columnMarkupArray.join(""));
markupArray.push("
")
}
markupArray.push(this._getCloseMainElementMarkup());
tableElement.append(markupArray.join(""));
this._triggerOnCellPrepared(tableElement, data)
},
_triggerOnCellPrepared: function(tableElement, data) {
var rowElement, cellElement, onCellPreparedArgs, row, cell, rowIndex, columnIndex, that = this,
rowElements = tableElement.find("tr"),
areaName = that._getAreaName(),
onCellPrepared = that.option("onCellPrepared"),
hasEvent = that.component.hasEvent("cellPrepared"),
defaultActionArgs = this.component._defaultActionArgs();
if (onCellPrepared || hasEvent) {
for (rowIndex = 0; rowIndex < data.length; rowIndex++) {
row = data[rowIndex];
rowElement = rowElements.eq(rowIndex);
for (columnIndex = 0; columnIndex < row.length; columnIndex++) {
cell = row[columnIndex];
cellElement = rowElement.children().eq(columnIndex);
onCellPreparedArgs = {
area: areaName,
rowIndex: rowIndex,
columnIndex: columnIndex,
cellElement: cellElement,
cell: cell
};
if (hasEvent) {
that.component._trigger("onCellPrepared", onCellPreparedArgs)
} else {
onCellPrepared($.extend(onCellPreparedArgs, defaultActionArgs))
}
}
}
}
},
_getRowHeight: function(index) {
var clientRect, row = this._getRowElement(index),
height = 0;
if (row && row.lastChild) {
if (row.getBoundingClientRect) {
clientRect = row.getBoundingClientRect();
height = clientRect.height
}
if (height > 0) {
return height
} else {
return row.offsetHeight
}
}
return 0
},
_setRowHeight: function(index, value) {
var row = this._getRowElement(index);
if (row) {
row.style.height = value + "px"
}
},
ctor: function(component) {
this.component = component
},
option: function() {
return this.component.option.apply(this.component, arguments)
},
getRowsLength: function() {
var that = this;
if (that._tableElement && that._tableElement.length > 0) {
return that._tableElement[0].rows.length
}
return 0
},
getRowsHeight: function() {
var i, that = this,
result = [],
rowsLength = that.getRowsLength();
for (i = 0; i < rowsLength; i++) {
result.push(that._getRowHeight(i))
}
return result
},
setRowsHeight: function(values) {
var i, that = this,
totalHeight = 0,
valuesLength = values.length;
for (i = 0; i < valuesLength; i++) {
totalHeight += values[i];
that._setRowHeight(i, values[i])
}
this._tableHeight = totalHeight;
this._tableElement[0].style.height = totalHeight + "px"
},
getColumnsWidth: function() {
var rowIndex, row, i, columnIndex, rowsLength = this.getRowsLength(),
processedCells = [],
result = [],
fillCells = function(cells, rowIndex, columnIndex, rowSpan, colSpan) {
var rowOffset, columnOffset;
for (rowOffset = 0; rowOffset < rowSpan; rowOffset++) {
for (columnOffset = 0; columnOffset < colSpan; columnOffset++) {
cells[rowIndex + rowOffset] = cells[rowIndex + rowOffset] || [];
cells[rowIndex + rowOffset][columnIndex + columnOffset] = true
}
}
};
if (rowsLength) {
for (rowIndex = 0; rowIndex < rowsLength; rowIndex++) {
processedCells[rowIndex] = processedCells[rowIndex] || [];
row = this._getRowElement(rowIndex);
for (i = 0; i < row.cells.length; i++) {
for (columnIndex = 0; processedCells[rowIndex][columnIndex]; columnIndex++) {}
fillCells(processedCells, rowIndex, columnIndex, row.cells[i].rowSpan, row.cells[i].colSpan);
if (1 === row.cells[i].colSpan) {
result[columnIndex] = result[columnIndex] || getRealElementWidth(row.cells[i])
}
}
}
}
return result
},
setColumnsWidth: function(values) {
var i, totalWidth = 0,
tableElement = this._tableElement[0],
colgroupElementHTML = "",
columnsCount = this.getColumnsCount(),
columnWidth = [];
for (i = 0; i < columnsCount; i++) {
columnWidth.push(values[i] || 0)
}
for (i = columnsCount; i < values.length && values; i++) {
columnWidth[columnsCount - 1] += values[i]
}
for (i = 0; i < columnsCount; i++) {
totalWidth += columnWidth[i];
colgroupElementHTML += '
'
}
this._colgroupElement.html(colgroupElementHTML);
this._tableWidth = totalWidth;
tableElement.style.width = totalWidth + "px";
tableElement.style.tableLayout = "fixed"
},
resetColumnsWidth: function() {
this._colgroupElement.find("col").width("auto");
this._tableElement.css({
width: "",
tableLayout: ""
})
},
groupWidth: function(value) {
if (void 0 === value) {
return this._groupElement.width()
} else {
if (value >= 0) {
this._groupWidth = value;
return this._groupElement[0].style.width = value + "px"
} else {
return this._groupElement[0].style.width = value
}
}
},
groupHeight: function(value) {
if (void 0 === value) {
return this._groupElement.height()
}
this._groupHeight = null;
if (value >= 0) {
this._groupHeight = value;
this._groupElement[0].style.height = value + "px"
} else {
this._groupElement[0].style.height = value
}
},
groupElement: function() {
return this._groupElement
},
tableElement: function() {
return this._tableElement
},
element: function() {
return this._rootElement
},
headElement: function() {
return this._tableElement.find("thead")
},
setVirtualContentParams: function(params) {
this._virtualContent.css({
width: params.width,
height: params.height
});
this.groupElement().addClass("dx-virtual-mode")
},
disableVirtualMode: function() {
this.groupElement().removeClass("dx-virtual-mode")
},
_renderVirtualContent: function() {
var that = this;
if (!that._virtualContent && "virtual" === that.option("scrolling.mode")) {
that._virtualContent = $("
").addClass("dx-virtual-content").insertBefore(that._tableElement)
}
},
reset: function() {
var that = this,
tableElement = that._tableElement[0];
that._fakeTable && that._fakeTable.detach();
that._fakeTable = null;
that.disableVirtualMode();
that.groupWidth("100%");
that.groupHeight("auto");
that.resetColumnsWidth();
if (tableElement) {
for (var i = 0; i < tableElement.rows.length; i++) {
tableElement.rows[i].style.height = ""
}
tableElement.style.height = "";
tableElement.style.width = "100%"
}
},
_updateFakeTableVisibility: function() {
var that = this,
tableElement = that.tableElement()[0],
fakeTableElement = that._fakeTable[0];
if (tableElement.style.top === fakeTableElement.style.top && fakeTableElement.style.left === tableElement.style.left) {
that._fakeTable.addClass("dx-hidden")
} else {
that._fakeTable.removeClass("dx-hidden")
}
},
_moveFakeTableLeft: function(scrollPos) {
var that = this,
tableElementOffsetLeft = parseFloat(that.tableElement()[0].style.left),
offsetLeft = getFakeTableOffset(scrollPos, tableElementOffsetLeft, that._tableWidth, that._groupWidth);
if (parseFloat(that._fakeTable[0].style.left) !== offsetLeft) {
that._fakeTable[0].style.left = offsetLeft + "px"
}
},
_moveFakeTableTop: function(scrollPos) {
var that = this,
tableElementOffsetTop = parseFloat(that.tableElement()[0].style.top),
offsetTop = getFakeTableOffset(scrollPos, tableElementOffsetTop, that._tableHeight, that._groupHeight);
if (parseFloat(that._fakeTable[0].style.top) !== offsetTop) {
that._fakeTable[0].style.top = offsetTop + "px"
}
},
_moveFakeTable: function(scrollPos) {
this._updateFakeTableVisibility()
},
_createFakeTable: function(scrollPos) {
var that = this;
if (!that._fakeTable) {
that._fakeTable = that.tableElement().clone().addClass("dx-pivot-grid-fake-table").appendTo(that._virtualContent)
}
},
render: function(rootElement, data) {
var that = this;
if (that._tableElement) {
try {
that._tableElement[0].innerHTML = ""
} catch (e) {
that._tableElement.empty()
}
that._tableElement.attr("style", "")
} else {
that._groupElement = that._createGroupElement();
that._tableElement = that._createTableElement();
that._tableElement.appendTo(that._groupElement);
that._groupElement.appendTo(rootElement);
that._rootElement = rootElement
}
that._colgroupElement = $("
").appendTo(that._tableElement);
that._renderTableContent(that._tableElement, data);
that._renderVirtualContent()
},
_getScrollable: function() {
return this.groupElement().data("dxScrollable")
},
on: function(eventName, handler) {
var scrollable = this._getScrollable();
if (scrollable) {
scrollable.on(eventName, handler)
}
return this
},
off: function() {
var scrollable = this._getScrollable();
if (scrollable) {
scrollable.off.apply(scrollable, arguments)
}
return this
},
scrollTo: function(pos) {
var scrollable = this._getScrollable();
if (scrollable) {
scrollable.scrollTo(pos);
if (this._virtualContent) {
this._createFakeTable();
this._moveFakeTable(pos)
}
}
},
updateScrollable: function() {
var scrollable = this._getScrollable();
if (scrollable) {
scrollable.update()
}
},
getColumnsCount: function() {
var cells, columnCount = 0,
row = this._getRowElement(0);
if (row) {
cells = row.cells;
for (var i = 0, len = cells.length; i < len; ++i) {
columnCount += cells[i].colSpan
}
}
return columnCount
}
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*******************************************************************!*\
!*** ./Scripts/ui/pivot_grid/ui.pivot_grid.field_chooser_base.js ***!
\*******************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
ArrayStore = __webpack_require__( /*! ../../data/array_store */ 58),
clickEvent = __webpack_require__( /*! ../../events/click */ 9),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 8),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 3),
Widget = __webpack_require__( /*! ../widget/ui.widget */ 19),
headerFilter = __webpack_require__( /*! ../grid_core/ui.grid_core.header_filter */ 309),
gridCoreUtils = __webpack_require__( /*! ../grid_core/ui.grid_core.utils */ 42),
sorting = __webpack_require__( /*! ../grid_core/ui.grid_core.sorting */ 310),
pivotGridUtils = __webpack_require__( /*! ./ui.pivot_grid.utils */ 74),
Sortable = __webpack_require__( /*! ./ui.sortable */ 470),
inArray = $.inArray,
each = $.each,
IE_FIELD_WIDTH_CORRECTION = 1,
DIV = "",
HeaderFilterView = headerFilter.HeaderFilterView;
var processItems = function(groupItems, field) {
var filterValues = [],
isTree = !!field.groupName,
isExcludeFilterType = "exclude" === field.filterType;
if (field.filterValues) {
each(field.filterValues, function(_, filterValue) {
filterValues.push(commonUtils.isArray(filterValue) ? filterValue.join("/") : filterValue)
})
}
pivotGridUtils.foreachTree(groupItems, function(items) {
var preparedFilterValue, item = items[0],
path = pivotGridUtils.createPath(items),
preparedFilterValueByText = isTree ? $.map(items, function(item) {
return item.text
}).reverse().join("/") : item.text;
item.value = isTree ? path.slice(0) : item.key || item.value;
preparedFilterValue = isTree ? path.join("/") : item.value;
if (item.children) {
item.items = item.children;
item.children = null
}
headerFilter.updateHeaderFilterItemSelectionState(item, item.key && inArray(preparedFilterValueByText, filterValues) > -1 || inArray(preparedFilterValue, filterValues) > -1, isExcludeFilterType)
})
};
function getMainGroupField(dataSource, sourceField) {
var field = sourceField;
if (commonUtils.isDefined(sourceField.groupIndex)) {
field = dataSource.getAreaFields(sourceField.area, true)[sourceField.areaIndex]
}
return field
}
var FieldChooserBase = Widget.inherit(gridCoreUtils.columnStateMixin).inherit(sorting.sortingMixin).inherit(headerFilter.headerFilterMixin).inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
allowFieldDragging: true,
headerFilter: {
width: 252,
height: 300,
texts: {
emptyValue: messageLocalization.format("dxDataGrid-headerFilterEmptyValue"),
ok: messageLocalization.format("dxDataGrid-headerFilterOK"),
cancel: messageLocalization.format("dxDataGrid-headerFilterCancel")
}
}
})
},
_init: function() {
this.callBase();
this._headerFilterView = new HeaderFilterView(this);
this._refreshDataSource();
this.subscribeToEvents()
},
_refreshDataSource: function() {
var dataSource = this.option("dataSource");
if (dataSource && dataSource.fields && dataSource.load) {
this._dataSource = dataSource
}
},
_optionChanged: function(args) {
switch (args.name) {
case "dataSource":
this._refreshDataSource();
break;
case "headerFilter":
case "allowFieldDragging":
this._invalidate();
break;
default:
this.callBase(args)
}
},
renderField: function(field, showColumnLines) {
var that = this,
$fieldContent = $(DIV).addClass("dx-area-field-content").text(field.caption || field.dataField),
$fieldElement = $(DIV).addClass("dx-area-field").addClass("dx-area-box").data("field", field).append($fieldContent),
mainGroupField = getMainGroupField(that._dataSource, field);
if ("data" !== field.area) {
if (field.allowSorting) {
that._applyColumnState({
name: "sort",
rootElement: $fieldElement,
column: {
alignment: that.option("rtlEnabled") ? "right" : "left",
sortOrder: "desc" === field.sortOrder ? "desc" : "asc"
},
showColumnLines: showColumnLines
})
}
that._applyColumnState({
name: "headerFilter",
rootElement: $fieldElement,
column: {
alignment: that.option("rtlEnabled") ? "right" : "left",
filterValues: mainGroupField.filterValues,
allowFiltering: mainGroupField.allowFiltering && !field.groupIndex
},
showColumnLines: showColumnLines
})
}
if (field.groupName) {
$fieldElement.attr("item-group", field.groupName)
}
return $fieldElement
},
_clean: function() {},
_renderContentImpl: function() {
var element = this.element();
this.renderSortable(element);
this._headerFilterView.render(element)
},
renderSortable: function(element) {
var that = this;
that._createComponent(element, Sortable, $.extend({
allowDragging: that.option("allowFieldDragging"),
itemSelector: ".dx-area-field",
itemContainerSelector: ".dx-area-field-container",
groupSelector: ".dx-area-fields",
groupFilter: function() {
var dataSource = that._dataSource,
$sortable = $(this).closest(".dx-sortable"),
pivotGrid = $sortable.data("dxPivotGrid"),
pivotGridFieldChooser = $sortable.data("dxPivotGridFieldChooser");
if (pivotGrid) {
return pivotGrid.getDataSource() === dataSource
}
if (pivotGridFieldChooser) {
return pivotGridFieldChooser.option("dataSource") === dataSource
}
return false
},
itemRender: function($sourceItem, target) {
var $item;
if ($sourceItem.hasClass("dx-area-box")) {
$item = $sourceItem.clone();
if ("drag" === target) {
$.each($sourceItem, function(index, sourceItem) {
$item.eq(index).css("width", parseInt($(sourceItem).css("width"), 10) + IE_FIELD_WIDTH_CORRECTION)
})
}
} else {
$item = $(DIV).addClass("dx-area-field").addClass("dx-area-box").text($sourceItem.text())
}
if ("drag" === target) {
var wrapperContainer = $(DIV);
$.each($item, function(_, item) {
var wrapper = $("
").addClass("dx-pivotgrid-fields-container").addClass("dx-widget").append($(item));
wrapperContainer.append(wrapper)
});
return wrapperContainer.children()
}
return $item
},
onDragging: function(e) {
var field = e.sourceElement.data("field"),
targetGroup = e.targetGroup;
e.cancel = false;
if (true === field.isMeasure) {
if ("column" === targetGroup || "row" === targetGroup || "filter" === targetGroup) {
e.cancel = true
}
} else {
if (false === field.isMeasure && "data" === targetGroup) {
e.cancel = true
}
}
},
useIndicator: true,
onChanged: function(e) {
var dataSource = that._dataSource,
field = e.sourceElement.data("field");
e.removeSourceElement = !!e.sourceGroup;
that._adjustSortableOnChangedArgs(e);
if (field) {
dataSource.field(getMainGroupField(dataSource, field).index, {
area: e.targetGroup,
areaIndex: e.targetIndex
});
dataSource.load()
}
}
}, that._getSortableOptions()))
},
_adjustSortableOnChangedArgs: function(e) {
e.removeSourceElement = false;
e.removeTargetElement = true;
e.removeSourceClass = false
},
_getSortableOptions: function() {
return {
direction: "auto"
}
},
subscribeToEvents: function(element) {
var that = this,
func = function(e) {
var field = $(e.currentTarget).data("field"),
mainGroupField = $.extend(true, {}, getMainGroupField(that._dataSource, field)),
isHeaderFilter = $(e.target).hasClass("dx-header-filter"),
dataSource = that._dataSource;
if (isHeaderFilter) {
that._headerFilterView.showHeaderFilterMenu($(e.currentTarget), $.extend(mainGroupField, {
type: mainGroupField.groupName ? "tree" : "list",
dataSource: {
load: function(options) {
var userData = options.userData;
if (userData.store) {
return userData.store.load(options)
} else {
var d = $.Deferred();
dataSource.getFieldValues(mainGroupField.index).done(function(data) {
userData.store = new ArrayStore(data);
userData.store.load(options).done(d.resolve).fail(d.reject)
}).fail(d.reject);
return d
}
},
postProcess: function(data) {
processItems(data, mainGroupField);
return data
}
},
apply: function() {
dataSource.field(mainGroupField.index, {
filterValues: this.filterValues,
filterType: this.filterType
});
dataSource.load()
}
}))
} else {
if (field.allowSorting && "data" !== field.area) {
dataSource.field(field.index, {
sortOrder: "desc" === field.sortOrder ? "asc" : "desc"
});
dataSource.load()
}
}
};
if (element) {
element.on(clickEvent.name, ".dx-area-field.dx-area-box", func);
return
}
that.element().on(clickEvent.name, ".dx-area-field.dx-area-box", func)
},
_initTemplates: $.noop
});
registerComponent("dxPivotGridFieldChooserBase", FieldChooserBase);
module.exports = FieldChooserBase
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*************************************************************************!*\
!*** ./Scripts/ui/scheduler/ui.scheduler.appointments.strategy.base.js ***!
\*************************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../../core/class */ 5),
errors = __webpack_require__( /*! ../widget/ui.errors */ 20);
var abstract = Class.abstract;
var APPOINTMENT_DEFAULT_SIZE = 20,
COMPACT_APPOINTMENT_DEFAULT_SIZE = 15,
COMPACT_APPOINTMENT_DEFAULT_OFFSET = 3;
var BaseRenderingStrategy = Class.inherit({
ctor: function(instance) {
this.instance = instance
},
getAppointmentDefaultSize: function() {
return APPOINTMENT_DEFAULT_SIZE
},
getDeltaTime: abstract,
getAppointmentGeometry: function(coordinates) {
return coordinates
},
createTaskPositionMap: function(items) {
var length = items.length;
if (!length) {
return
}
this._defaultWidth = this.instance._cellWidth;
this._defaultHeight = this.instance._cellHeight;
this._allDayHeight = this.instance._allDayCellHeight;
var map = [];
for (var i = 0; i < length; i++) {
var coordinates = this._getItemPosition(items[i]);
if (this._isRtl()) {
coordinates = this._correctRtlCoordinates(coordinates)
}
map.push(coordinates)
}
var positionArray = this._getSortedPositions(map),
resultPositions = this._getResultPositions(positionArray);
return this._getExtendedPositionMap(map, resultPositions)
},
_getDeltaWidth: function(args, initialSize) {
var cellWidth = this._defaultWidth || this.getAppointmentDefaultSize(),
initialWidth = initialSize.width;
return Math.round((args.width - initialWidth) / cellWidth)
},
_correctRtlCoordinates: function(coordinates) {
var width = coordinates[0].width || this._getAppointmentMaxWidth();
if (!coordinates[0].appointmentReduced) {
coordinates[0].left -= width
}
this._correctRtlCoordinatesParts(coordinates, width);
return coordinates
},
_correctRtlCoordinatesParts: $.noop,
_getAppointmentMaxWidth: function() {
return this._defaultWidth
},
_getItemPosition: function(item) {
var height = this.calculateAppointmentHeight(item),
width = this.calculateAppointmentWidth(item),
sourceAppointmentWidth = width,
position = this._getAppointmentCoordinates(item),
allDay = this.isAllDay(item),
result = [],
startDate = this.instance.invoke("getField", "startDate", item);
for (var j = 0; j < position.length; j++) {
var resultWidth = width,
appointmentReduced = null,
multiWeekAppointmentParts = [];
if (this._needVerifyItemSize() || allDay) {
var currentMaxAllowedPosition = position[j].max;
if (this.isAppointmentGreaterThan(currentMaxAllowedPosition, {
left: position[j].left,
width: sourceAppointmentWidth
})) {
appointmentReduced = "head";
resultWidth = this._reduceMultiWeekAppointment(width, {
left: position[j].left,
right: currentMaxAllowedPosition
});
multiWeekAppointmentParts = this._getMultiWeekAppointmentParts({
sourceAppointmentWidth: sourceAppointmentWidth,
reducedWidth: resultWidth,
height: height
}, position[j], startDate, j);
if (this._isRtl()) {
position[j].left = currentMaxAllowedPosition
}
}
}
$.extend(position[j], {
height: height,
width: resultWidth,
allDay: allDay,
appointmentReduced: appointmentReduced
});
if (multiWeekAppointmentParts.length) {
multiWeekAppointmentParts.unshift(position[j]);
result = $.merge(result, multiWeekAppointmentParts)
} else {
result.push(position[j])
}
}
return result
},
_getAppointmentCoordinates: function(itemData) {
var coordinates = [{
top: 0,
left: 0
}],
startDate = this._startDate(itemData);
this.instance.notifyObserver("needCoordinates", {
startDate: startDate,
appointmentData: itemData,
callback: function(value) {
coordinates = value
}
});
return coordinates
},
_needVerifyItemSize: function() {
return false
},
_isRtl: function() {
return this.instance.option("rtlEnabled")
},
_getMultiWeekAppointmentParts: function() {
return []
},
_getCompactAppointmentParts: function(appointmentWidth) {
var cellWidth = this._defaultWidth || this.getAppointmentDefaultSize();
return Math.round(appointmentWidth / cellWidth)
},
_reduceMultiWeekAppointment: function(sourceAppointmentWidth, bound) {
if (this._isRtl()) {
sourceAppointmentWidth = Math.floor(bound.left - bound.right)
} else {
sourceAppointmentWidth = bound.right - Math.floor(bound.left)
}
return sourceAppointmentWidth
},
calculateAppointmentHeight: function() {
return 0
},
calculateAppointmentWidth: function() {
return 0
},
isAppointmentGreaterThan: function(etalon, comparisonParameters) {
var result = comparisonParameters.left + comparisonParameters.width - etalon;
if (this._isRtl()) {
result = etalon + comparisonParameters.width - comparisonParameters.left
}
return result > this._defaultWidth / 2
},
isAllDay: function() {
return false
},
_getSortedPositions: function(arr) {
var result = [],
__tmpIndex = 0;
for (var i = 0, arrLength = arr.length; i < arrLength; i++) {
for (var j = 0, itemLength = arr[i].length; j < itemLength; j++) {
var item = arr[i][j];
var start = {
i: i,
j: j,
top: item.top,
left: item.left,
isStart: true,
allDay: item.allDay,
__tmpIndex: __tmpIndex
};
__tmpIndex++;
var end = {
i: i,
j: j,
top: item.top + item.height,
left: item.left + item.width,
isStart: false,
allDay: item.allDay,
__tmpIndex: __tmpIndex
};
result.push(start, end);
__tmpIndex++
}
}
result.sort($.proxy(function(a, b) {
return this._sortCondition(a, b)
}, this));
return result
},
_fixUnstableSorting: function(comparisonResult, a, b) {
if (0 === comparisonResult) {
if (a.__tmpIndex < b.__tmpIndex) {
return -1
}
if (a.__tmpIndex > b.__tmpIndex) {
return 1
}
}
return comparisonResult
},
_sortCondition: abstract,
_rowCondition: function(a, b) {
var columnCondition = this._normalizeCondition(a.left, b.left),
rowCondition = this._normalizeCondition(a.top, b.top);
return columnCondition ? columnCondition : rowCondition ? rowCondition : a.isStart - b.isStart
},
_columnCondition: function(a, b) {
var columnCondition = this._normalizeCondition(a.left, b.left),
rowCondition = this._normalizeCondition(a.top, b.top);
return rowCondition ? rowCondition : columnCondition ? columnCondition : a.isStart - b.isStart
},
_normalizeCondition: function(first, second) {
var result = first - second;
return Math.abs(result) > 1.001 ? result : 0
},
_getResultPositions: function(sortedArray) {
var position, stack = [],
indexes = [],
result = [],
intersectPositions = [],
intersectPositionCount = 0,
sortedIndex = 0;
for (var i = 0; i < sortedArray.length; i++) {
var j, current = sortedArray[i];
if (current.isStart) {
position = void 0;
for (j = 0; j < indexes.length; j++) {
if (!indexes[j]) {
position = j;
indexes[j] = true;
break
}
}
if (void 0 === position) {
position = indexes.length;
indexes.push(true);
for (j = 0; j < stack.length; j++) {
stack[j].count++
}
}
stack.push({
index: position,
count: indexes.length,
i: current.i,
j: current.j,
sortedIndex: sortedIndex++
});
if (intersectPositionCount < indexes.length) {
intersectPositionCount = indexes.length
}
} else {
var removeIndex = this._findIndexByKey(stack, "i", "j", current.i, current.j),
resultItem = stack[removeIndex];
stack.splice(removeIndex, 1);
indexes[resultItem.index] = false;
intersectPositions.push(resultItem);
if (!stack.length) {
indexes = [];
for (var k = 0; k < intersectPositions.length; k++) {
intersectPositions[k].count = intersectPositionCount
}
intersectPositions = [];
intersectPositionCount = 0
}
result.push(resultItem)
}
}
return result.sort(function(a, b) {
var columnCondition = a.j - b.j,
rowCondition = a.i - b.i;
return rowCondition ? rowCondition : columnCondition
})
},
_findIndexByKey: function(arr, ikey, jkey, ivalue, jvalue) {
var result = 0;
for (var i = 0, len = arr.length; i < len; i++) {
if (arr[i][ikey] === ivalue && arr[i][jkey] === jvalue) {
result = i;
break
}
}
return result
},
_getExtendedPositionMap: function(map, positions) {
var positionCounter = 0,
result = [];
for (var i = 0, mapLength = map.length; i < mapLength; i++) {
var resultString = [];
for (var j = 0, itemLength = map[i].length; j < itemLength; j++) {
map[i][j].index = positions[positionCounter].index;
map[i][j].sortedIndex = positions[positionCounter].sortedIndex;
map[i][j].count = positions[positionCounter++].count;
map[i][j].virtualIndex = map[i][j].top + "-" + map[i][j].left;
resultString.push(map[i][j]);
this._checkLongCompactAppointment(map[i][j], resultString)
}
result.push(resultString)
}
return result
},
_checkLongCompactAppointment: $.noop,
_splitLongCompactAppointment: function(item, result) {
var compactCount = 0;
if (item.index > 1) {
item.isCompact = true;
compactCount = this._getCompactAppointmentParts(item.width);
for (var k = 1; k < compactCount; k++) {
var compactPart = $.extend(true, {}, item);
compactPart.left = this._getCompactLeftCoordinate(item.left, k);
compactPart.sortedIndex = null;
result.push(compactPart)
}
}
return result
},
_startDate: function(appointment, skipNormalize) {
var startDate = this.instance._getStartDate(appointment, skipNormalize),
text = this.instance.invoke("getField", "text", appointment);
if (isNaN(startDate.getTime())) {
throw errors.Error("E1032", text)
}
return startDate
},
_endDate: function(appointment) {
var endDate = this.instance._getEndDate(appointment),
realStartDate = this._startDate(appointment, true),
viewStartDate = this._startDate(appointment);
if (!endDate || realStartDate.getTime() >= endDate.getTime()) {
endDate = new Date(realStartDate.getTime() + 6e4 * this.instance.option("appointmentDurationInMinutes"));
this.instance.invoke("setField", "endDate", appointment, endDate)
}
if (viewStartDate >= endDate) {
var duration = endDate.getTime() - realStartDate.getTime();
endDate = new Date(viewStartDate.getTime() + duration)
}
return endDate
},
_getMaxNeighborAppointmentCount: function() {
var outerAppointmentWidth = this.getCompactAppointmentDefaultSize() + this.getCompactAppointmentDefaultOffset();
return Math.floor(this.getCompactAppointmentGroupMaxWidth() / outerAppointmentWidth)
},
_markAppointmentAsVirtual: function(coordinates, isAllDay) {
var countFullWidthAppointmentInCell = 2;
if (coordinates.count - countFullWidthAppointmentInCell > this._getMaxNeighborAppointmentCount()) {
coordinates.virtual = {
top: coordinates.top,
left: coordinates.left,
index: coordinates.virtualIndex,
isAllDay: isAllDay
}
}
},
getCompactAppointmentGroupMaxWidth: function() {
var widthInPercents = 75;
return widthInPercents * this.getDefaultCellWidth() / 100
},
getDefaultCellWidth: function() {
return this._defaultWidth
},
getCompactAppointmentDefaultSize: function() {
return COMPACT_APPOINTMENT_DEFAULT_SIZE
},
getCompactAppointmentDefaultOffset: function() {
return COMPACT_APPOINTMENT_DEFAULT_OFFSET
},
getAppointmentDataCalculator: $.noop
});
module.exports = BaseRenderingStrategy
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!************************************************************!*\
!*** ./Scripts/ui/scheduler/ui.scheduler.table_creator.js ***!
\************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1);
var SchedulerTableCreator = {
VERTICAL: "vertical",
HORIZONTAL: "horizontal",
makeTable: function(options) {
var tableBody = document.createElement("tbody");
for (var i = 0; i < options.rowCount; i++) {
var row = document.createElement("tr");
if (options.rowClass) {
row.className = options.rowClass
}
for (var j = 0; j < options.cellCount; j++) {
var td = document.createElement("td");
if (options.getCellText) {
td.innerHTML = options.getCellText(i, j)
}
if (options.cellClass) {
td.className = options.cellClass
}
if (options.dataGenerator) {
options.dataGenerator(td, i, j)
}
row.appendChild(td)
}
tableBody.appendChild(row)
}
return tableBody
},
makeGroupedTable: function(type, groups, cssClasses, cellCount) {
var rows = [];
if (type === this.VERTICAL) {
rows = this._makeVerticalGroupedRows(groups, cssClasses)
} else {
rows = this._makeHorizontalGroupedRows(groups, cssClasses, cellCount)
}
return rows
},
makeGroupedTableFromJSON: function(type, data, config) {
var table, cellStorage = [],
rowIndex = 0;
config = config || {};
var cellTag = config.cellTag || "td",
childrenField = config.childrenField || "children",
titleField = config.titleField || "title",
groupTableClass = config.groupTableClass,
groupRowClass = config.groupRowClass,
groupCellClass = config.groupCellClass,
groupCellCustomContent = config.groupCellCustomContent;
function createTable() {
table = document.createElement("table");
if (groupTableClass) {
table.className = groupTableClass
}
}
function getChildCount(item) {
if (item[childrenField]) {
return item[childrenField].length
}
return 0
}
function createCell(text, childCount) {
var cell = {
element: document.createElement(cellTag),
childCount: childCount
};
if (groupCellClass) {
cell.element.className = groupCellClass
}
var cellText = document.createTextNode(text);
if ("function" === typeof groupCellCustomContent) {
groupCellCustomContent(cell.element, cellText)
} else {
cell.element.appendChild(cellText)
}
return cell
}
function generateCells(data) {
for (var i = 0; i < data.length; i++) {
var childCount = getChildCount(data[i]),
cell = createCell(data[i][titleField], childCount);
if (!cellStorage[rowIndex]) {
cellStorage[rowIndex] = []
}
cellStorage[rowIndex].push(cell);
if (childCount) {
generateCells(data[i][childrenField])
} else {
rowIndex++
}
}
}
function putCellsToRows() {
cellStorage.forEach(function(cells) {
var row = document.createElement("tr");
if (groupRowClass) {
row.className = groupRowClass
}
var rowspans = [];
for (var i = cells.length - 1; i >= 0; i--) {
var prev = cells[i + 1],
rowspan = cells[i].childCount;
if (prev && prev.childCount) {
rowspan *= prev.childCount
}
rowspans.push(rowspan)
}
rowspans.reverse();
cells.forEach(function(cell, index) {
if (rowspans[index]) {
cell.element.setAttribute("rowspan", rowspans[index])
}
row.appendChild(cell.element)
});
table.appendChild(row)
})
}
createTable();
generateCells(data);
putCellsToRows();
return table
},
_makeVerticalGroupedRows: function(groups, cssClasses) {
var i, repeatCount = 1,
arr = [];
for (i = 0; i < groups.length; i++) {
if (i > 0) {
repeatCount = groups[i - 1].items.length * repeatCount
}
var cells = this._makeGroupedRowCells(groups[i].items, repeatCount, cssClasses);
arr.push(cells)
}
var rows = [],
groupCount = arr.length,
maxCellCount = arr[groupCount - 1].length;
for (i = 0; i < maxCellCount; i++) {
rows.push($("
").addClass(cssClasses.groupHeaderRowClass))
}
for (i = groupCount - 1; i >= 0; i--) {
var currentColumnLength = arr[i].length,
rowspan = maxCellCount / currentColumnLength;
for (var j = 0; j < currentColumnLength; j++) {
var currentRowIndex = j * rowspan,
row = rows[currentRowIndex];
row.prepend(arr[i][j].attr("rowspan", rowspan))
}
}
return rows
},
_makeHorizontalGroupedRows: function(groups, cssClasses, cellCount) {
var repeatCount = 1,
groupCount = groups.length,
rows = [];
for (var i = 0; i < groupCount; i++) {
if (i > 0) {
repeatCount = groups[i - 1].items.length * repeatCount
}
var cells = this._makeGroupedRowCells(groups[i].items, repeatCount, cssClasses);
rows.push($("
").addClass(cssClasses.groupRowClass).append(cells))
}
var maxCellCount = rows[groupCount - 1].find("th").length;
for (var j = 0; j < groupCount; j++) {
var $cell = rows[j].find("th"),
colspan = maxCellCount / $cell.length * cellCount;
if (colspan > 1) {
$cell.attr("colspan", colspan)
}
}
return rows
},
_makeGroupedRowCells: function(items, repeatCount, cssClasses) {
var cells = [],
itemCount = items.length;
for (var i = 0; i < repeatCount; i++) {
for (var j = 0; j < itemCount; j++) {
cells.push($("").addClass(cssClasses.groupHeaderClass).html(""))
}
}
return cells
}
};
module.exports = SchedulerTableCreator
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*******************************************************!*\
!*** ./Scripts/ui/scheduler/ui.scheduler.timeline.js ***!
\*******************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 3),
SchedulerWorkSpace = __webpack_require__( /*! ./ui.scheduler.work_space */ 156),
dateUtils = __webpack_require__( /*! ../../core/utils/date */ 12),
tableCreator = __webpack_require__( /*! ./ui.scheduler.table_creator */ 228);
var TIMELINE_CLASS = "dx-scheduler-timeline",
GROUP_TABLE_CLASS = "dx-scheduler-group-table";
var HORIZONTAL = "horizontal",
DATE_TABLE_CELL_HEIGHT = 75,
toMs = dateUtils.dateToMilliseconds;
var SchedulerTimeline = SchedulerWorkSpace.inherit({
_init: function() {
this.callBase();
this.element().addClass(TIMELINE_CLASS);
this._$sidebarTable = $("").addClass(GROUP_TABLE_CLASS)
},
_getCellFromNextRow: function(direction, isMultiSelection) {
if (!isMultiSelection) {
return this.callBase(direction, isMultiSelection)
}
return this._$focusedCell
},
_getRightCell: function(isMultiSelection) {
var $rightCell, $focusedCell = this._$focusedCell,
rowCellCount = this._getCellCount(),
edgeCellIndex = this._isRTL() ? 0 : rowCellCount - 1,
direction = this._isRTL() ? "prev" : "next";
if ($focusedCell.index() === edgeCellIndex) {
$rightCell = $focusedCell
} else {
$rightCell = $focusedCell[direction]();
$rightCell = this._checkForViewBounds($rightCell)
}
return $rightCell
},
_getLeftCell: function(isMultiSelection) {
var $leftCell, $focusedCell = this._$focusedCell,
rowCellCount = this._getCellCount(),
edgeCellIndex = this._isRTL() ? rowCellCount - 1 : 0,
direction = this._isRTL() ? "next" : "prev";
if ($focusedCell.index() === edgeCellIndex) {
$leftCell = $focusedCell
} else {
$leftCell = $focusedCell[direction]();
$leftCell = this._checkForViewBounds($leftCell)
}
return $leftCell
},
_getRowCount: function() {
return 1
},
_getCellCount: function() {
return this._getCellCountInDay()
},
_getTotalCellCount: function(groupCount) {
return this._getCellCount()
},
_getTotalRowCount: function(groupCount) {
groupCount = groupCount || 1;
return this._getRowCount() * groupCount
},
_getDateByIndex: function(index) {
var resultDate = new Date(this._firstViewDate),
dayIndex = Math.floor(index / this._getCellCountInDay());
resultDate.setTime(this._firstViewDate.getTime() + this._calculateCellIndex(0, index) * this._getInterval() + dayIndex * this._getHiddenInterval());
return resultDate
},
_getFormat: function() {
return "shorttime"
},
_calculateHiddenInterval: function(rowIndex, cellIndex) {
var dayIndex = Math.floor(cellIndex / this._getCellCountInDay());
return dayIndex * this._getHiddenInterval()
},
_createWorkSpaceElements: function() {
this._createWorkSpaceScrollableElements()
},
_getWorkSpaceHeight: function() {
if (this.option("crossScrollingEnabled")) {
return this._$dateTable.outerHeight()
}
return this.element().outerHeight()
},
_dateTableScrollableConfig: function() {
var that = this,
config = this.callBase(),
timelineConfig = {
direction: HORIZONTAL,
onScroll: function(e) {
that._headerScrollable.scrollTo({
left: e.scrollOffset.left
})
}
};
return this.option("crossScrollingEnabled") ? config : $.extend(config, timelineConfig)
},
_renderTimePanel: $.noop,
_renderAllDayPanel: $.noop,
_getTableAllDay: function() {
return false
},
_toggleAllDayVisibility: $.noop,
_changeAllDayVisibility: $.noop,
supportAllDayRow: function() {
return false
},
_getGroupHeaderContainer: function() {
return this._$sidebarTable
},
_renderView: function() {
this.callBase();
this._$sidebarTable.appendTo(this._sidebarScrollable.content());
this._setGroupHeaderCellsHeight()
},
_cleanView: function() {
this.callBase();
this._$sidebarTable.empty()
},
_visibilityChanged: function(visible) {
this._setGroupHeaderCellsHeight();
this.callBase(visible)
},
_setTableSizes: function() {
this.callBase();
var cellHeight = DATE_TABLE_CELL_HEIGHT,
minHeight = this._getWorkSpaceMinHeight(),
$groupCells = this._$sidebarTable.find("tr");
var height = cellHeight * $groupCells.length;
if (height < minHeight) {
height = minHeight
}
this._$sidebarTable.height(height);
this._$dateTable.height(height)
},
_getWorkSpaceMinHeight: function() {
var minHeight = this._getWorkSpaceHeight(),
workspaceContainerHeight = this.element().outerHeight(true) - this.getHeaderPanelHeight();
if (minHeight < workspaceContainerHeight) {
minHeight = workspaceContainerHeight
}
return minHeight
},
_makeGroupRows: function(groups) {
return tableCreator.makeGroupedTable(tableCreator.VERTICAL, groups, {
groupHeaderRowClass: this._getGroupRowClass(),
groupHeaderClass: this._getGroupHeaderClass(),
groupHeaderContentClass: this._getGroupHeaderContentClass()
})
},
_setGroupHeaderCellsHeight: function() {
var cellHeight = this.getCellHeight() - 1;
cellHeight = this._ensureGroupHeaderCellsHeight(cellHeight);
this._getGroupHeaderCellsContent().css("height", cellHeight)
},
_ensureGroupHeaderCellsHeight: function(cellHeight) {
var minCellHeight = this._calculateMinCellHeight();
if (cellHeight < minCellHeight) {
return minCellHeight
}
return cellHeight
},
_calculateMinCellHeight: function() {
var dateTable = this._getDateTable(),
dateTableRowSelector = "." + this._getDateTableRowClass();
return dateTable.outerHeight() / dateTable.find(dateTableRowSelector).length - 1
},
_attachGroupCountAttr: function() {
this.element().attr("dx-group-column-count", this.option("groups").length)
},
_getCellCoordinatesByIndex: function(index) {
return {
cellIndex: index % this._getCellCount(),
rowIndex: 0
}
},
_getCellByCoordinates: function(cellCoordinates, groupIndex) {
return this._$dateTable.find("tr").eq(cellCoordinates.rowIndex + groupIndex).find("td").eq(cellCoordinates.cellIndex)
},
_calculateCellIndex: function(rowIndex, cellIndex) {
return cellIndex
},
_getGroupIndex: function(rowIndex, cellIndex) {
return rowIndex
},
_getWorkSpaceWidth: function() {
return this._$dateTable.outerWidth(true)
},
_calculateHeaderCellRepeatCount: function() {
return 1
},
_getGroupIndexByCell: function($cell) {
return $cell.parent().index()
},
_getIntervalBetween: function(currentDate, allDay) {
var startDayHour = this.option("startDayHour"),
endDayHour = this.option("endDayHour"),
firstViewDate = this.getStartViewDate(),
firstViewDateTime = firstViewDate.getTime(),
hiddenInterval = (24 - endDayHour + startDayHour) * toMs("hour"),
timeZoneOffset = dateUtils.getTimezonesDifference(firstViewDate, currentDate),
apptStart = currentDate.getTime(),
fullInterval = apptStart - firstViewDateTime - timeZoneOffset,
fullDays = Math.floor(fullInterval / toMs("day")),
tailDuration = fullInterval - fullDays * toMs("day"),
tailDelta = 0,
cellCount = this._getCellCountInDay() * fullDays,
gapBeforeAppt = apptStart - dateUtils.trimTime(new Date(currentDate)).getTime(),
result = cellCount * this.option("hoursInterval") * toMs("hour");
if (!allDay) {
if (currentDate.getHours() < startDayHour) {
tailDelta = tailDuration - hiddenInterval + gapBeforeAppt
} else {
if (currentDate.getHours() >= startDayHour && currentDate.getHours() < endDayHour) {
tailDelta = tailDuration
} else {
if (currentDate.getHours() >= startDayHour && currentDate.getHours() >= endDayHour) {
tailDelta = tailDuration - (gapBeforeAppt - endDayHour * toMs("hour"))
} else {
if (!fullDays) {
result = fullInterval
}
}
}
}
result += tailDelta
}
return result
},
getAllDayContainer: function() {
return null
},
getTimePanelWidth: function() {
return 0
},
getPositionShift: function(timeShift) {
var positionShift = this.callBase(timeShift),
left = this.getCellWidth() * timeShift;
if (this.option("rtlEnabled")) {
left *= -1
}
left += positionShift.left;
return {
top: 0,
left: left
}
},
getVisibleBounds: function() {
var isRtl = this.option("rtlEnabled");
var result = {},
$scrollable = this.getScrollable().element(),
cellWidth = this.getCellWidth(),
scrollableOffset = isRtl ? this.getScrollableOuterWidth() - this.getScrollableScrollLeft() : this.getScrollableScrollLeft(),
scrolledCellCount = scrollableOffset / cellWidth,
visibleCellCount = $scrollable.width() / cellWidth,
totalCellCount = isRtl ? scrolledCellCount - visibleCellCount : scrolledCellCount + visibleCellCount,
leftDate = this._getDateByIndex(scrolledCellCount),
rightDate = this._getDateByIndex(totalCellCount);
if (isRtl) {
leftDate = this._getDateByIndex(totalCellCount), rightDate = this._getDateByIndex(scrolledCellCount)
}
result.left = {
hours: leftDate.getHours(),
minutes: leftDate.getMinutes() >= 30 ? 30 : 0,
date: dateUtils.trimTime(leftDate)
};
result.right = {
hours: rightDate.getHours(),
minutes: rightDate.getMinutes() >= 30 ? 30 : 0,
date: dateUtils.trimTime(rightDate)
};
return result
},
needUpdateScrollPosition: function(hours, minutes, bounds, date) {
var isUpdateNeeded = false;
isUpdateNeeded = this._dateWithinBounds(bounds, date);
if (hours < bounds.left.hours || hours > bounds.right.hours) {
isUpdateNeeded = true
}
if (hours === bounds.left.hours && minutes < bounds.left.minutes) {
isUpdateNeeded = true
}
if (hours === bounds.right.hours && minutes > bounds.right.minutes) {
isUpdateNeeded = true
}
return isUpdateNeeded
},
_dateWithinBounds: function(bounds, date) {
var trimmedDate = dateUtils.trimTime(new Date(date)),
isUpdateNeeded = false;
if (trimmedDate.getTime() < bounds.left.date.getTime() || trimmedDate.getTime() > bounds.right.date.getTime()) {
isUpdateNeeded = true
}
return isUpdateNeeded
},
scrollToTime: function(hours, minutes, date) {
var coordinates = this._getScrollCoordinates(hours, minutes, date),
scrollable = this.getScrollable(),
offset = this.option("rtlEnabled") ? this.getScrollableContainer().outerWidth() : 0;
scrollable.scrollBy({
left: coordinates.left - scrollable.scrollLeft() - offset,
top: 0
})
}
});
registerComponent("dxSchedulerTimeline", SchedulerTimeline);
module.exports = SchedulerTimeline
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************!*\
!*** ./Scripts/viz/axes/axes_constants.js ***!
\********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
_map = __webpack_require__( /*! ../core/utils */ 6).map,
_format = __webpack_require__( /*! ../core/format */ 162);
function getFormatObject(value, options, axisMinMax, point) {
var formatObject = {
value: value,
valueText: _format(value, options) || ""
};
if (axisMinMax) {
formatObject.min = axisMinMax.min;
formatObject.max = axisMinMax.max
}
if (point) {
formatObject.point = point
}
return formatObject
}
module.exports = {
logarithmic: "logarithmic",
discrete: "discrete",
numeric: "numeric",
left: "left",
right: "right",
top: "top",
bottom: "bottom",
center: "center",
canvasPositionPrefix: "canvas_position_",
canvasPositionTop: "canvas_position_top",
canvasPositionBottom: "canvas_position_bottom",
canvasPositionLeft: "canvas_position_left",
canvasPositionRight: "canvas_position_right",
canvasPositionStart: "canvas_position_start",
canvasPositionEnd: "canvas_position_end",
horizontal: "horizontal",
vertical: "vertical",
convertTicksToValues: function(ticks) {
return _map(ticks || [], function(item) {
return item.value
})
},
convertValuesToTicks: function(values) {
return _map(values || [], function(item) {
return {
value: item
}
})
},
validateOverlappingMode: function(mode) {
return "ignore" !== mode ? "enlargeTickInterval" : "ignore"
},
formatLabel: function(value, options, axisMinMax, point) {
var formatObject = getFormatObject(value, options, axisMinMax, point);
return $.isFunction(options.customizeText) ? options.customizeText.call(formatObject, formatObject) : formatObject.valueText
},
formatHint: function(value, options, axisMinMax) {
var formatObject = getFormatObject(value, options, axisMinMax);
return $.isFunction(options.customizeHint) ? options.customizeHint.call(formatObject, formatObject) : void 0
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************!*\
!*** ./Scripts/viz/axes/base_axis.js ***!
\***************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var Axis, $ = __webpack_require__( /*! jquery */ 1),
vizUtils = __webpack_require__( /*! ../core/utils */ 6),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
constants = __webpack_require__( /*! ./axes_constants */ 230),
parseUtils = __webpack_require__( /*! ../components/parse_utils */ 234),
tickManagerModule = __webpack_require__( /*! ./base_tick_manager */ 325),
formatLabel = constants.formatLabel,
convertTicksToValues = constants.convertTicksToValues,
convertValuesToTicks = constants.convertValuesToTicks,
_isDefined = commonUtils.isDefined,
_isNumber = commonUtils.isNumber,
_getSignificantDigitPosition = vizUtils.getSignificantDigitPosition,
_roundValue = vizUtils.roundValue,
patchFontOptions = vizUtils.patchFontOptions,
_math = Math,
_abs = _math.abs,
_round = _math.round,
_extend = $.extend,
_each = $.each,
_noop = $.noop,
DEFAULT_AXIS_LABEL_SPACING = 5,
MAX_GRID_BORDER_ADHENSION = 4,
LABEL_BACKGROUND_PADDING_X = 8,
LABEL_BACKGROUND_PADDING_Y = 4;
function hasCategories(range) {
return range.categories && range.categories.length
}
function validateAxisOptions(options) {
var labelOptions = options.label,
position = options.position,
defaultPosition = options.isHorizontal ? constants.bottom : constants.left,
secondaryPosition = options.isHorizontal ? constants.top : constants.right;
if (position !== defaultPosition && position !== secondaryPosition) {
position = defaultPosition
}
if (position === constants.right && !labelOptions.userAlignment) {
labelOptions.alignment = constants.left
}
options.position = position;
options.hoverMode = options.hoverMode ? options.hoverMode.toLowerCase() : "none";
labelOptions.minSpacing = _isDefined(labelOptions.minSpacing) ? labelOptions.minSpacing : DEFAULT_AXIS_LABEL_SPACING
}
function findSkippedIndexCategory(ticks, skippedCategory) {
var i = ticks.length;
if (void 0 !== skippedCategory) {
while (i--) {
if (ticks[i].value === skippedCategory) {
return i
}
}
}
return -1
}
Axis = exports.Axis = function(renderSettings) {
var that = this;
that._renderer = renderSettings.renderer;
that._incidentOccurred = renderSettings.incidentOccurred;
that._stripsGroup = renderSettings.stripsGroup;
that._labelAxesGroup = renderSettings.labelAxesGroup;
that._constantLinesGroup = renderSettings.constantLinesGroup;
that._axesContainerGroup = renderSettings.axesContainerGroup;
that._gridContainerGroup = renderSettings.gridGroup;
that._axisCssPrefix = renderSettings.widgetClass + "-" + (renderSettings.axisClass ? renderSettings.axisClass + "-" : "");
that._setType(renderSettings.axisType, renderSettings.drawingType);
that._createAxisGroups();
that._tickManager = that._createTickManager()
};
Axis.prototype = {
constructor: Axis,
_updateIntervalAndBounds: function() {
var i, ticks, length, minInterval, bounds, that = this,
translator = that._translator,
businessRange = translator.getBusinessRange();
if (!hasCategories(businessRange)) {
ticks = that.getMajorTicks(true);
length = ticks.length;
if (!businessRange.isSynchronized) {
bounds = this._tickManager.getTickBounds()
}
if (length > 1) {
minInterval = _abs(ticks[0].value - ticks[1].value);
for (i = 1; i < length - 1; i++) {
minInterval = Math.min(_abs(ticks[i].value - ticks[i + 1].value), minInterval)
}
bounds = _extend({
interval: minInterval
}, bounds)
}
if (bounds) {
businessRange.addRange(bounds);
translator.reinit()
}
}
},
_createAllTicks: function(businessRange) {
var that = this;
that._boundaryTicks = that._getBoundaryTicks();
that._majorTicks = that.getMajorTicks(that._options.withoutOverlappingBehavior);
that._decimatedTicks = hasCategories(businessRange) || "semidiscrete" === that._options.type ? that.getDecimatedTicks() : [];
that._minorTicks = that.getMinorTicks()
},
_drawAxis: function() {
var that = this,
options = that._options,
axis = that._createAxis({
"stroke-width": options.width,
stroke: options.color,
"stroke-opacity": options.opacity
});
axis.append(that._axisLineGroup)
},
_correctMinForTicks: function(min, max, screenDelta) {
var correctingValue, digitPosition = _getSignificantDigitPosition(_abs(max - min) / screenDelta),
newMin = _roundValue(Number(min), digitPosition);
if (newMin < min) {
correctingValue = _math.pow(10, -digitPosition);
newMin = vizUtils.applyPrecisionByMinDelta(newMin, correctingValue, newMin + correctingValue)
}
if (newMin > max) {
newMin = min
}
return newMin
},
_getTickManagerData: function() {
var that = this,
options = that._options,
screenDelta = that._getScreenDelta(),
min = that._minBound,
max = that._maxBound,
categories = that._translator.getVisibleCategories() || that._translator.getBusinessRange().categories,
customTicks = options.customTicks || (hasCategories({
categories: categories
}) ? categories : that._majorTicks && that._majorTicks.length && convertTicksToValues(that._majorTicks)),
customMinorTicks = options.customMinorTicks || that._minorTicks && that._minorTicks.length && convertTicksToValues(that._minorTicks);
if (_isNumber(min) && options.type !== constants.logarithmic) {
min = that._correctMinForTicks(min, max, screenDelta)
}
return {
min: min,
max: max,
customTicks: customTicks,
customMinorTicks: customMinorTicks,
customBoundTicks: options.customBoundTicks,
screenDelta: screenDelta
}
},
_getTickManagerTypes: function() {
return {
axisType: this._options.type,
dataType: this._options.dataType
}
},
_getTicksOptions: function() {
var options = this._options;
return {
base: options.type === constants.logarithmic ? options.logarithmBase : void 0,
tickInterval: this._translator.getBusinessRange().stubData ? null : options.tickInterval,
gridSpacingFactor: options.axisDivisionFactor,
minorGridSpacingFactor: options.minorAxisDivisionFactor,
numberMultipliers: options.numberMultipliers,
incidentOccurred: options.incidentOccurred,
setTicksAtUnitBeginning: options.setTicksAtUnitBeginning,
showMinorTicks: options.minorTick.visible || options.minorGrid.visible,
minorTickInterval: options.minorTickInterval,
minorTickCount: options.minorTickCount,
useTicksAutoArrangement: options.useTicksAutoArrangement,
showCalculatedTicks: options.tick.showCalculatedTicks,
showMinorCalculatedTicks: options.minorTick.showCalculatedTicks
}
},
_getBoundaryTicks: function() {
var categories = this._translator.getVisibleCategories() || this._translator.getBusinessRange().categories,
boundaryValues = hasCategories({
categories: categories
}) && this._tickOffset ? [categories[0], categories[categories.length - 1]] : this._tickManager.getBoundaryTicks();
return convertValuesToTicks(boundaryValues)
},
_createTickManager: function() {
return new tickManagerModule.TickManager({}, {}, {
overlappingBehaviorType: this._overlappingBehaviorType
})
},
_getMarginsOptions: function() {
var range = this._translator.getBusinessRange();
return {
stick: range.stick || this._options.stick,
minStickValue: range.minStickValue,
maxStickValue: range.maxStickValue,
percentStick: range.percentStick,
minValueMargin: this._options.minValueMargin,
maxValueMargin: this._options.maxValueMargin,
minSpaceCorrection: range.minSpaceCorrection,
maxSpaceCorrection: range.maxSpaceCorrection
}
},
_updateTickManager: function() {
var options, overlappingOptions = this._getOverlappingBehaviorOptions();
options = _extend(true, this._getMarginsOptions(), overlappingOptions, this._getTicksOptions());
this._tickManager.update(this._getTickManagerTypes(), this._getTickManagerData(), options)
},
_correctLabelAlignment: function() {
var that = this,
labelOptions = that._options.label,
overlappingBehavior = that._tickManager.getOverlappingBehavior();
if (overlappingBehavior && "rotate" === overlappingBehavior.mode) {
that._textOptions.rotate = overlappingBehavior.rotationAngle;
if (!labelOptions.userAlignment) {
that._textOptions.align = constants.left
}
} else {
if (!labelOptions.userAlignment) {
that._textOptions.align = labelOptions.alignment
}
}
},
_correctLabelFormat: function() {
this._options.label = this._tickManager.getOptions().labelOptions
},
_deleteLabels: function() {
this._axisElementsGroup && this._axisElementsGroup.clear()
},
_drawTicks: function(ticks) {
var that = this,
group = that._axisLineGroup;
_each(ticks || [], function(_, tick) {
var points, coord = that._getTickCoord(tick);
if (coord) {
points = that._isHorizontal ? [coord.x1, coord.y1, coord.x2, coord.y2] : [coord.y1, coord.x1, coord.y2, coord.x2];
tick.graphic = that._createPathElement(points, tick.tickStyle).append(group);
coord.angle && that._rotateTick(tick, coord.angle)
}
})
},
_createPathElement: function(points, attr) {
return this._renderer.path(points, "line").attr(attr).sharp(this._getSharpParam())
},
_createAxis: function(options) {
return this._createAxisElement().attr(options).sharp(this._getSharpParam(true))
},
_drawLabels: function() {
var that = this,
renderer = that._renderer,
group = that._axisElementsGroup,
emptyStrRegExp = /^\s+$/;
_each(that._majorTicks, function(_, tick) {
var xCoord, yCoord, text = tick.labelText;
if (_isDefined(text) && "" !== text && !emptyStrRegExp.test(text)) {
xCoord = that._isHorizontal ? tick.labelPos.x : tick.labelPos.y;
yCoord = that._isHorizontal ? tick.labelPos.y : tick.labelPos.x;
if (!tick.label) {
tick.label = renderer.text(text, xCoord, yCoord).css(tick.labelFontStyle).attr(tick.labelStyle).append(group)
} else {
tick.label.css(tick.labelFontStyle).attr(tick.labelStyle).attr({
text: text,
x: xCoord,
y: yCoord
})
}
tick.label.data({
"chart-data-argument": tick.value
})
}
})
},
_getGridLineDrawer: function(borderOptions) {
var that = this,
translator = that._translator,
additionalTranslator = that._additionalTranslator,
isHorizontal = that._isHorizontal,
canvasStart = isHorizontal ? constants.left : constants.top,
canvasEnd = isHorizontal ? constants.right : constants.bottom,
positionFrom = additionalTranslator.translateSpecialCase(constants.canvasPositionStart),
positionTo = additionalTranslator.translateSpecialCase(constants.canvasPositionEnd),
firstBorderLinePosition = borderOptions.visible && borderOptions[canvasStart] ? translator.translateSpecialCase(constants.canvasPositionPrefix + canvasStart) : void 0,
lastBorderLinePosition = borderOptions.visible && borderOptions[canvasEnd] ? translator.translateSpecialCase(constants.canvasPositionPrefix + canvasEnd) : void 0,
getPoints = isHorizontal ? function(tick) {
return null !== tick.posX ? [tick.posX, positionFrom, tick.posX, positionTo] : null
} : function(tick) {
return null !== tick.posX ? [positionFrom, tick.posX, positionTo, tick.posX] : null
},
minDelta = MAX_GRID_BORDER_ADHENSION + firstBorderLinePosition,
maxDelta = lastBorderLinePosition - MAX_GRID_BORDER_ADHENSION;
return function(tick) {
if (void 0 === tick.posX || tick.posX < minDelta || tick.posX > maxDelta) {
return
}
var points = getPoints(tick);
return points && that._createPathElement(points, tick.gridStyle)
}
},
_drawGrids: function(ticks, borderOptions) {
var tick, that = this,
group = that._axisGridGroup,
i = 0,
length = ticks.length,
drawLine = that._getGridLineDrawer(borderOptions || {
visible: false
});
for (i; i < length; i++) {
tick = ticks[i];
tick.grid = drawLine(tick);
tick.grid && tick.grid.append(group)
}
},
_getConstantLinePos: function(lineValue, canvasStart, canvasEnd) {
var parsedValue = this._validateUnit(lineValue, "E2105", "constantLine"),
value = this._getTranslatedCoord(parsedValue);
if (!_isDefined(value) || value < _math.min(canvasStart, canvasEnd) || value > _math.max(canvasStart, canvasEnd)) {
return {}
}
return {
value: value,
parsedValue: parsedValue
}
},
_createConstantLine: function(value, attr) {
var that = this,
additionalTranslator = this._additionalTranslator,
positionFrom = additionalTranslator.translateSpecialCase(constants.canvasPositionStart),
positionTo = additionalTranslator.translateSpecialCase(constants.canvasPositionEnd),
points = this._isHorizontal ? [value, positionTo, value, positionFrom] : [positionFrom, value, positionTo, value];
return that._createPathElement(points, attr)
},
_drawConstantLinesAndLabels: function(lineOptions, canvasStart, canvasEnd) {
if (!_isDefined(lineOptions.value)) {
return
}
var that = this,
pos = that._getConstantLinePos(lineOptions.value, canvasStart, canvasEnd),
labelOptions = lineOptions.label || {},
value = pos.value,
attr = {
stroke: lineOptions.color,
"stroke-width": lineOptions.width,
dashStyle: lineOptions.dashStyle
};
if (!_isDefined(value)) {
that._constantLines.push(null);
if (labelOptions.visible) {
that._constantLineLabels.push(null)
}
return
}
that._constantLines.push(that._createConstantLine(value, attr).append(that._axisConstantLineGroup));
that._constantLineLabels.push(labelOptions.visible ? that._drawConstantLineLabels(pos.parsedValue, labelOptions, value) : null)
},
_drawConstantLine: function() {
var that = this,
options = that._options,
data = options.constantLines,
canvas = that._getCanvasStartEnd();
if (that._translator.getBusinessRange().stubData) {
return
}
that._constantLines = [];
that._constantLineLabels = [];
_each(data, function(_, dataItem) {
that._drawConstantLinesAndLabels(dataItem, canvas.start, canvas.end)
})
},
_drawConstantLineLabels: function(parsedValue, lineLabelOptions, value) {
var coords, that = this,
text = lineLabelOptions.text,
options = that._options,
labelOptions = options.label;
that._checkAlignmentConstantLineLabels(lineLabelOptions);
text = _isDefined(text) ? text : formatLabel(parsedValue, labelOptions);
coords = that._getConstantLineLabelsCoords(value, lineLabelOptions);
return that._renderer.text(text, coords.x, coords.y).css(patchFontOptions(_extend({}, labelOptions.font, lineLabelOptions.font))).attr({
align: coords.align
}).append(that._axisConstantLineGroup)
},
_getStripPos: function(startValue, endValue, canvasStart, canvasEnd, range) {
var start, end, startCategoryIndex, endCategoryIndex, isContinuous = !!(range.minVisible || range.maxVisible),
categories = range.categories || [],
firstValue = startValue,
lastValue = endValue,
min = range.minVisible;
if (!isContinuous) {
startCategoryIndex = $.inArray(startValue, categories);
endCategoryIndex = $.inArray(endValue, categories);
if (-1 === startCategoryIndex || -1 === endCategoryIndex) {
return {
stripFrom: 0,
stripTo: 0
}
}
if (startCategoryIndex > endCategoryIndex) {
firstValue = endValue;
lastValue = startValue
}
}
firstValue = this._validateUnit(firstValue, "E2105", "strip");
lastValue = this._validateUnit(lastValue, "E2105", "strip");
start = this._getTranslatedCoord(firstValue, -1);
end = this._getTranslatedCoord(lastValue, 1);
if (!_isDefined(start) && isContinuous) {
start = firstValue < min ? canvasStart : canvasEnd
}
if (!_isDefined(end) && isContinuous) {
end = lastValue < min ? canvasStart : canvasEnd
}
return start < end ? {
stripFrom: start,
stripTo: end
} : {
stripFrom: end,
stripTo: start
}
},
_createStrip: function(fromPoint, toPoint, attr) {
var x, y, width, height, additionalTranslator = this._additionalTranslator,
positionFrom = additionalTranslator.translateSpecialCase(constants.canvasPositionStart),
positionTo = additionalTranslator.translateSpecialCase(constants.canvasPositionEnd);
if (this._isHorizontal) {
x = fromPoint;
y = _math.min(positionFrom, positionTo);
width = toPoint - fromPoint;
height = _abs(positionFrom - positionTo)
} else {
x = _math.min(positionFrom, positionTo);
y = fromPoint;
width = _abs(positionFrom - positionTo);
height = _abs(fromPoint - toPoint)
}
return this._renderer.rect(x, y, width, height).attr(attr)
},
_drawStrip: function() {
var i, stripOptions, stripPos, stripLabelOptions, attr, that = this,
options = that._options,
stripData = options.strips,
canvas = this._getCanvasStartEnd(),
range = that._translator.getBusinessRange();
if (range.stubData) {
return
}
that._strips = [];
that._stripLabels = [];
for (i = 0; i < stripData.length; i++) {
stripOptions = stripData[i];
stripLabelOptions = stripOptions.label || {};
attr = {
fill: stripOptions.color
};
if (_isDefined(stripOptions.startValue) && _isDefined(stripOptions.endValue) && _isDefined(stripOptions.color)) {
stripPos = that._getStripPos(stripOptions.startValue, stripOptions.endValue, canvas.start, canvas.end, range);
if (stripPos.stripTo - stripPos.stripFrom === 0 || !_isDefined(stripPos.stripTo) || !_isDefined(stripPos.stripFrom)) {
that._strips.push(null);
if (stripLabelOptions.text) {
that._stripLabels.push(null)
}
continue
}
that._strips.push(that._createStrip(stripPos.stripFrom, stripPos.stripTo, attr).append(that._axisStripGroup));
that._stripLabels.push(stripLabelOptions.text ? that._drawStripLabel(stripLabelOptions, stripPos.stripFrom, stripPos.stripTo) : null)
}
}
},
_drawStripLabel: function(stripLabelOptions, stripFrom, stripTo) {
var that = this,
options = that._options,
coords = that._getStripLabelCoords(stripLabelOptions, stripFrom, stripTo);
return that._renderer.text(stripLabelOptions.text, coords.x, coords.y).css(patchFontOptions(_extend({}, options.label.font, stripLabelOptions.font))).attr({
align: coords.align
}).append(that._axisLabelGroup)
},
_adjustStripLabels: function() {
var i, coords, that = this,
labels = that._stripLabels,
rects = that._strips;
if (void 0 === labels && void 0 === rects) {
return
}
for (i = 0; i < labels.length; i++) {
if (null !== labels[i]) {
coords = that._getAdjustedStripLabelCoords(that._options.strips[i], labels[i], rects[i]);
labels[i].move(coords.x, coords.y)
}
}
},
_adjustLabels: function() {
var label, labelHeight, isNeedLabelAdjustment, staggeringSpacing, i, box, that = this,
options = that._options,
majorTicks = that._majorTicks,
majorTicksLength = majorTicks.length,
isHorizontal = that._isHorizontal,
overlappingBehavior = that._tickManager ? that._tickManager.getOverlappingBehavior() : options.label.overlappingBehavior,
position = options.position,
hasLabels = false,
boxAxis = that._axisElementsGroup && that._axisElementsGroup.getBBox() || {};
_each(majorTicks, function(_, tick) {
if (tick.label) {
tick.label.attr(that._getLabelAdjustedCoord(tick, boxAxis));
hasLabels = true
}
});
isNeedLabelAdjustment = hasLabels && isHorizontal && overlappingBehavior && "stagger" === overlappingBehavior.mode;
if (isNeedLabelAdjustment) {
labelHeight = 0;
for (i = 0; i < majorTicksLength; i += 2) {
label = majorTicks[i].label;
box = label && label.getBBox() || {};
if (box.height > labelHeight) {
labelHeight = box.height
}
}
staggeringSpacing = overlappingBehavior.staggeringSpacing;
labelHeight = _round(labelHeight) + staggeringSpacing;
for (i = 1; i < majorTicksLength; i += 2) {
label = majorTicks[i].label;
if (label) {
if (position === constants.bottom) {
label.move(0, labelHeight)
} else {
if (position === constants.top) {
label.move(0, -labelHeight)
}
}
}
}
for (i = 0; i < majorTicksLength; i++) {
majorTicks[i].label && majorTicks[i].label.rotate(0)
}
}
},
_getLabelAdjustedCoord: function(tick, boxAxis) {
var x, y, that = this,
options = that._options,
box = tick.label.getBBox(),
isHorizontal = that._isHorizontal,
position = options.position,
shift = that.padding && that.padding[position] || 0,
textOptions = that._textOptions,
labelSettingsY = tick.label.attr("y");
if (isHorizontal && position === constants.bottom) {
y = 2 * labelSettingsY - box.y + shift
} else {
if (!isHorizontal) {
if (position === constants.left) {
if (textOptions.align === constants.right) {
x = box.x + box.width - shift
} else {
if (textOptions.align === constants.center) {
x = box.x + box.width / 2 - shift - (boxAxis.width / 2 || 0)
} else {
x = box.x - shift - (boxAxis.width || 0)
}
}
} else {
if (textOptions.align === constants.center) {
x = box.x + box.width / 2 + (boxAxis.width / 2 || 0) + shift
} else {
if (textOptions.align === constants.right) {
x = box.x + box.width + (boxAxis.width || 0) + shift
} else {
x = box.x + shift
}
}
}
y = labelSettingsY + ~~(labelSettingsY - box.y - box.height / 2)
} else {
if (isHorizontal && position === constants.top) {
y = 2 * labelSettingsY - box.y - box.height - shift
}
}
}
return {
x: x,
y: y
}
},
_createAxisGroups: function() {
var that = this,
renderer = that._renderer,
classSelector = that._axisCssPrefix;
that._axisGroup = renderer.g().attr({
"class": classSelector + "axis"
});
that._axisStripGroup = renderer.g().attr({
"class": classSelector + "strips"
});
that._axisGridGroup = renderer.g().attr({
"class": classSelector + "grid"
});
that._axisElementsGroup = renderer.g().attr({
"class": classSelector + "elements"
}).append(that._axisGroup);
that._axisLineGroup = renderer.g().attr({
"class": classSelector + "line"
}).append(that._axisGroup);
that._axisTitleGroup = renderer.g().attr({
"class": classSelector + "title"
}).append(that._axisGroup);
that._axisConstantLineGroup = renderer.g().attr({
"class": classSelector + "constant-lines"
});
that._axisLabelGroup = renderer.g().attr({
"class": classSelector + "axis-labels"
})
},
_clearAxisGroups: function(adjustAxis) {
var that = this,
classSelector = that._axisCssPrefix;
that._axisGroup.remove();
that._axisStripGroup.remove();
that._axisLabelGroup.remove();
that._axisConstantLineGroup.remove();
that._axisGridGroup.remove();
if (that._axisTitleGroup) {
that._axisTitleGroup.clear()
} else {
if (!adjustAxis) {
that._axisTitleGroup = that._renderer.g().attr({
"class": classSelector + "title"
}).append(that._axisGroup)
}
}
if (that._axisElementsGroup) {
that._axisElementsGroup.clear()
} else {
if (!adjustAxis) {
that._axisElementsGroup = that._renderer.g().attr({
"class": classSelector + "elements"
}).append(that._axisGroup)
}
}
that._axisLineGroup && that._axisLineGroup.clear();
that._axisStripGroup && that._axisStripGroup.clear();
that._axisGridGroup && that._axisGridGroup.clear();
that._axisConstantLineGroup && that._axisConstantLineGroup.clear();
that._axisLabelGroup && that._axisLabelGroup.clear()
},
_initTickCoord: function(tick, offset) {
var coord = this._getTranslatedValue(tick.value, this._axisPosition, offset);
tick.posX = coord.x;
tick.posY = coord.y;
tick.angle = coord.angle
},
_initTickStyle: function(tick, style) {
tick.length = style.length;
tick.tickStyle = tick.withoutPath ? {
stroke: "none",
"stroke-width": 0,
"stroke-opacity": 0
} : style.tickStyle;
tick.gridStyle = style.gridStyle
},
_initTickLabel: function(tick, position) {
var that = this,
customizeColor = that._options.label.customizeColor;
tick.labelText = formatLabel(tick.value, that._options.label, {
min: that._minBound,
max: that._maxBound
});
tick.labelPos = that._getTranslatedValue(tick.value, position);
tick.labelStyle = that._textOptions;
tick.labelFontStyle = _extend({}, that._textFontStyles);
if (customizeColor && customizeColor.call) {
tick.labelFontStyle.fill = customizeColor.call(tick, tick)
}
tick.labelHint = constants.formatHint(tick.value, that._options.label, {
min: that._minBound,
max: that._maxBound
})
},
_getTickStyle: function(tickOptions, gridOptions) {
return {
tickStyle: {
stroke: tickOptions.color,
"stroke-width": tickOptions.width,
"stroke-opacity": tickOptions.opacity
},
gridStyle: {
stroke: gridOptions.color,
"stroke-width": gridOptions.width,
"stroke-opacity": gridOptions.opacity
},
length: tickOptions.length
}
},
_initTicks: function(ticks, style, withLabels, skippedCategory, offset, labelPosition) {
var tick, that = this,
i = 0,
length = ticks.length,
indexSkippedCategory = findSkippedIndexCategory(ticks, skippedCategory);
for (i; i < length; i++) {
tick = ticks[i];
i !== indexSkippedCategory && that._initTickCoord(tick, offset);
that._initTickStyle(tick, style);
withLabels && !tick.withoutLabel && that._initTickLabel(tick, labelPosition)
}
},
_initAllTicks: function() {
var that = this,
options = that._options,
majorTickStyle = that._getTickStyle(options.tick, options.grid),
minorTickStyle = that._getTickStyle(options.minorTick, options.minorGrid),
skippedCategory = that._getSkippedCategory(),
boundaryTicks = this._boundaryTicks,
withLabels = options.label.visible && that._axisElementsGroup && !that._translator.getBusinessRange().stubData,
labelPosition = that.getLabelsParams().pos,
offset = that._tickOffset;
that._initTicks(that._majorTicks, majorTickStyle, withLabels, skippedCategory, offset, labelPosition);
that._initTicks(that._minorTicks, minorTickStyle, false, void 0, offset);
that._initTicks(that._decimatedTicks, majorTickStyle, false, skippedCategory, offset);
if (options.showCustomBoundaryTicks && boundaryTicks.length) {
that._initTicks([boundaryTicks[0]], majorTickStyle, false, -1, -1);
boundaryTicks.length > 1 && that._initTicks([boundaryTicks[1]], majorTickStyle, false, -1, 1)
}
},
_buildTicks: function() {
var that = this;
that._createAllTicks(that._translator.getBusinessRange());
that._correctLabelAlignment();
that._correctLabelFormat()
},
_setTickOffset: function() {
var options = this._options,
discreteAxisDivisionMode = options.discreteAxisDivisionMode;
this._tickOffset = +("crossLabels" !== discreteAxisDivisionMode || !discreteAxisDivisionMode)
},
_createHints: function() {
var that = this;
_each(that._majorTicks || [], function(_, tick) {
var labelHint = tick.labelHint;
if (_isDefined(labelHint) && "" !== labelHint) {
tick.label.setTitle(labelHint)
}
})
},
_setBoundingRect: function() {
var start, that = this,
options = that._options,
axisBox = that._axisElementsGroup ? that._axisElementsGroup.getBBox() : {
x: 0,
y: 0,
width: 0,
height: 0,
isEmpty: true
},
lineBox = that._axisLineGroup.getBBox(),
placeholderSize = options.placeholderSize,
isHorizontal = that._isHorizontal,
coord = isHorizontal ? "y" : "x",
side = isHorizontal ? "height" : "width",
shiftCoords = options.crosshairEnabled ? isHorizontal ? LABEL_BACKGROUND_PADDING_Y : LABEL_BACKGROUND_PADDING_X : 0,
axisTitleBox = that._title && that._axisTitleGroup ? that._axisTitleGroup.getBBox() : axisBox;
if (axisBox.isEmpty && axisTitleBox.isEmpty && !placeholderSize) {
that.boundingRect = axisBox;
return
}
start = lineBox[coord] || that._axisPosition;
if (options.position === (isHorizontal && constants.bottom || constants.right)) {
axisBox[side] = placeholderSize || axisTitleBox[coord] + axisTitleBox[side] - start + shiftCoords;
axisBox[coord] = start
} else {
axisBox[side] = placeholderSize || lineBox[side] + start - axisTitleBox[coord] + shiftCoords;
axisBox[coord] = axisTitleBox.isEmpty ? start : axisTitleBox[coord] - shiftCoords
}
that.boundingRect = axisBox
},
_validateUnit: function(unit, idError, parameters) {
var that = this;
unit = that.parser(unit);
if (void 0 === unit && idError) {
that._incidentOccurred(idError, [parameters])
}
return unit
},
_setType: function(axisType, drawingType) {
var axisTypeMethods, that = this;
switch (axisType) {
case "xyAxes":
axisTypeMethods = __webpack_require__( /*! ./xy_axes */ 326);
break;
case "polarAxes":
axisTypeMethods = __webpack_require__( /*! ./polar_axes */ 501)
}
_each(axisTypeMethods[drawingType], function(methodName, method) {
that[methodName] = method
})
},
_getSharpParam: function() {
return true
},
dispose: function() {
var that = this;
that._axisElementsGroup && that._axisElementsGroup.dispose();
that._stripLabels = that._strips = null;
that._title = null;
that._axisStripGroup = that._axisConstantLineGroup = that._axisLabelGroup = null;
that._axisLineGroup = that._axisElementsGroup = that._axisGridGroup = null;
that._axisGroup = that._axisTitleGroup = null;
that._axesContainerGroup = that._stripsGroup = that._constantLinesGroup = null;
that._renderer = that._options = that._textOptions = that._textFontStyles = null;
that._translator = that._additionalTranslator = null;
that._majorTicks = that._minorTicks = null;
that._tickManager = null
},
getOptions: function() {
return this._options
},
setPane: function(pane) {
this.pane = pane;
this._options.pane = pane
},
setTypes: function(type, axisType, typeSelector) {
this._options.type = type || this._options.type;
this._options[typeSelector] = axisType || this._options[typeSelector]
},
resetTypes: function(typeSelector) {
this._options.type = this._initTypes.type;
this._options[typeSelector] = this._initTypes[typeSelector]
},
getTranslator: function() {
return this._translator
},
updateOptions: function(options) {
var that = this,
labelOpt = options.label;
that._options = options;
options.tick = options.tick || {};
options.minorTick = options.minorTick || {};
options.grid = options.grid || {};
options.minorGrid = options.minorGrid || {};
options.title = options.title || {};
options.marker = options.marker || {};
that._initTypes = {
type: options.type,
argumentType: options.argumentType,
valueType: options.valueType
};
validateAxisOptions(options);
that._setTickOffset();
that._isHorizontal = options.isHorizontal;
that.pane = options.pane;
that.name = options.name;
that.priority = options.priority;
that._hasLabelFormat = "" !== labelOpt.format && _isDefined(labelOpt.format);
that._textOptions = {
align: labelOpt.alignment,
opacity: labelOpt.opacity
};
that._textFontStyles = vizUtils.patchFontOptions(labelOpt.font);
if (options.type === constants.logarithmic) {
if (options.logarithmBaseError) {
that._incidentOccurred("E2104");
delete options.logarithmBaseError
}
that.calcInterval = function(value, prevValue) {
return vizUtils.getLog(value / prevValue, options.logarithmBase)
}
}
},
updateSize: function(clearAxis) {
var that = this,
options = that._options,
direction = that._isHorizontal ? "horizontal" : "vertical";
if (options.title.text && that._axisTitleGroup) {
that._incidentOccurred("W2105", [direction]);
that._axisTitleGroup.dispose();
that._axisTitleGroup = null
}
if (clearAxis && that._axisElementsGroup && options.label.visible && !that._translator.getBusinessRange().stubData) {
that._incidentOccurred("W2106", [direction]);
that._axisElementsGroup.dispose();
that._axisElementsGroup = null
}
that._setBoundingRect()
},
setTranslator: function(translator, additionalTranslator) {
var that = this,
range = translator.getBusinessRange();
this._minBound = range.minVisible;
this._maxBound = range.maxVisible;
that._translator = translator;
that._additionalTranslator = additionalTranslator;
that.resetTicks();
that._updateIntervalAndBounds();
that._buildTicks()
},
resetTicks: function() {
this._deleteLabels();
this._majorTicks = this._minorTicks = null
},
getLabelsParams: function() {
var that = this,
options = that._options,
position = options.position,
labelOffset = options.label.indentFromAxis,
axisPosition = that._axisPosition,
axisElementsGroup = that._axisElementsGroup;
return {
pos: position === constants.top || position === constants.left ? axisPosition - labelOffset : axisPosition + labelOffset,
width: axisElementsGroup && axisElementsGroup.getBBox().width || 0
}
},
getFormattedValue: function(value, options, point) {
var labelOptions = this._options.label;
return _isDefined(value) ? formatLabel(value, _extend(true, {}, labelOptions, options), void 0, point) : null
},
getTicksValues: function() {
return {
majorTicksValues: convertTicksToValues(this._majorTicks || this.getMajorTicks()),
minorTicksValues: convertTicksToValues(this._minorTicks || this.getMinorTicks())
}
},
getMajorTicks: function(withoutOverlappingBehavior) {
var majorTicks, boundedOverlappedTicks, that = this,
overlappingBehavior = that._options.label.overlappingBehavior;
that._updateTickManager();
that._textOptions.rotate = 0;
majorTicks = convertValuesToTicks(that._tickManager.getTicks(withoutOverlappingBehavior));
if (majorTicks.length) {
if (overlappingBehavior.hideFirstTick || overlappingBehavior.hideLastTick || overlappingBehavior.hideFirstLabel || overlappingBehavior.hideLastLabel) {
overlappingBehavior.hideFirstLabel && (majorTicks[0].withoutLabel = true);
overlappingBehavior.hideLastLabel && (majorTicks[majorTicks.length - 1].withoutLabel = true);
overlappingBehavior.hideFirstTick && (majorTicks[0].withoutPath = true);
overlappingBehavior.hideLastTick && (majorTicks[majorTicks.length - 1].withoutPath = true)
} else {
if (!withoutOverlappingBehavior && "ignore" !== overlappingBehavior.mode) {
boundedOverlappedTicks = that._tickManager.checkBoundedTicksOverlapping();
boundedOverlappedTicks.overlappedDates && (majorTicks[1].withoutLabel = true);
if (boundedOverlappedTicks.overlappedStartEnd) {
"first" === overlappingBehavior.hideFirstOrLast ? majorTicks[0].withoutLabel = true : majorTicks[majorTicks.length - 1].withoutLabel = true
}
}
}
}
that._addBoundaryTick(majorTicks);
return majorTicks
},
getMinorTicks: function() {
return convertValuesToTicks(this._tickManager.getMinorTicks())
},
getDecimatedTicks: function() {
return convertValuesToTicks(this._tickManager.getDecimatedTicks())
},
setTicks: function(ticks) {
this.resetTicks();
this._majorTicks = convertValuesToTicks(ticks.majorTicks);
this._minorTicks = convertValuesToTicks(ticks.minorTicks)
},
setPercentLabelFormat: function() {
if (!this._hasLabelFormat) {
this._options.label.format = "percent"
}
},
resetAutoLabelFormat: function() {
if (!this._hasLabelFormat) {
delete this._options.label.format
}
},
getMultipleAxesSpacing: function() {
return this._options.multipleAxesSpacing || 0
},
drawGrids: function(borderOptions) {
var that = this,
options = that._options;
borderOptions = borderOptions || {};
that._axisGridGroup.append(that._gridContainerGroup);
if (options.grid.visible) {
that._drawGrids(that._majorTicks.concat(that._decimatedTicks), borderOptions)
}
options.minorGrid.visible && that._drawGrids(that._minorTicks, borderOptions)
},
draw: function(adjustAxis) {
var areLabelsVisible, that = this,
options = that._options;
that._axisGroup && that._clearAxisGroups(adjustAxis);
areLabelsVisible = options.label.visible && that._axisElementsGroup && !that._translator.getBusinessRange().stubData;
that._updateIntervalAndBounds();
that._buildTicks();
that._initAxisPositions();
that._initAllTicks();
options.visible && that._drawAxis();
if (options.tick.visible) {
that._drawTicks(that._majorTicks);
that._drawTicks(that._decimatedTicks)
}
options.minorTick.visible && that._drawTicks(that._minorTicks);
areLabelsVisible && that._drawLabels();
options.showCustomBoundaryTicks && this._drawTicks(that._boundaryTicks);
that._drawTitle();
options.strips && that._drawStrip();
options.constantLines && that._drawConstantLine();
that._stripsGroup && that._axisStripGroup.append(that._stripsGroup);
that._constantLinesGroup && that._axisConstantLineGroup.append(that._constantLinesGroup);
that._axisGroup.append(that._axesContainerGroup);
that._labelAxesGroup && that._axisLabelGroup.append(that._labelAxesGroup);
that._adjustConstantLineLabels();
areLabelsVisible && that._adjustLabels();
options.marker.visible && that._drawDateMarkers();
that._createHints();
that._adjustStripLabels();
that._adjustTitle();
that._setBoundingRect()
},
getBoundingRect: function() {
return this._axisElementsGroup ? this.boundingRect : {
x: 0,
y: 0,
width: 0,
height: 0
}
},
shift: function(x, y) {
this._axisGroup.attr({
translateX: x,
translateY: y
})
},
applyClipRects: function(elementsClipID, canvasClipID) {
this._axisGroup.attr({
clipId: canvasClipID
});
this._axisStripGroup.attr({
clipId: elementsClipID
})
},
validate: function(isArgumentAxis) {
var that = this,
options = that._options,
dataType = isArgumentAxis ? options.argumentType : options.valueType,
parser = dataType ? parseUtils.getParser(dataType) : function(unit) {
return unit
};
that.parser = parser;
options.dataType = dataType;
if (void 0 !== options.min) {
options.min = that._validateUnit(options.min, "E2106")
}
if (void 0 !== options.max) {
options.max = that._validateUnit(options.max, "E2106")
}
if (void 0 !== that._minBound) {
that._minBound = that._validateUnit(that._minBound)
}
if (void 0 !== that._maxBound) {
that._maxBound = that._validateUnit(that._maxBound)
}
},
zoom: function(min, max, skipAdjusting) {
var that = this,
minOpt = that._options.min,
maxOpt = that._options.max;
skipAdjusting = skipAdjusting || that._options.type === constants.discrete;
min = that._validateUnit(min);
max = that._validateUnit(max);
if (!skipAdjusting) {
if (void 0 !== minOpt) {
min = minOpt > min ? minOpt : min;
max = minOpt > max ? minOpt : max
}
if (void 0 !== maxOpt) {
max = maxOpt < max ? maxOpt : max;
min = maxOpt < min ? maxOpt : min
}
}
that._zoomArgs = {
min: min,
max: max
};
return that._zoomArgs
},
resetZoom: function() {
this._zoomArgs = null
},
getRangeData: function() {
var rangeMin, rangeMax, rangeMinVisible, rangeMaxVisible, that = this,
options = that._options,
minMax = that._getMinMax(),
min = minMax.min,
max = minMax.max,
zoomArgs = that._zoomArgs || {},
type = options.type;
if (type === constants.logarithmic) {
min = min <= 0 ? void 0 : min;
max = max <= 0 ? void 0 : max
}
if (type !== constants.discrete) {
rangeMin = min;
rangeMax = max;
if (_isDefined(min) && _isDefined(max)) {
rangeMin = min < max ? min : max;
rangeMax = max > min ? max : min
}
rangeMinVisible = _isDefined(zoomArgs.min) ? zoomArgs.min : rangeMin;
rangeMaxVisible = _isDefined(zoomArgs.max) ? zoomArgs.max : rangeMax
} else {
rangeMinVisible = _isDefined(zoomArgs.min) ? zoomArgs.min : min;
rangeMaxVisible = _isDefined(zoomArgs.max) ? zoomArgs.max : max
}
return {
min: rangeMin,
max: rangeMax,
stick: that._getStick(),
categories: options.categories,
dataType: options.dataType,
axisType: type,
base: options.logarithmBase,
invert: options.inverted,
addSpiderCategory: that._getSpiderCategoryOption(),
minVisible: rangeMinVisible,
maxVisible: rangeMaxVisible
}
},
getFullTicks: function() {
return this._tickManager.getFullTicks()
},
_addBoundaryTick: _noop,
getMarkerTrackers: _noop,
measureLabels: _noop,
_drawDateMarkers: _noop,
coordsIn: _noop,
_getSkippedCategory: _noop,
_initAxisPositions: _noop,
_drawTitle: _noop,
_adjustConstantLineLabels: _noop,
_adjustTitle: _noop,
getSpiderTicks: _noop,
setSpiderTicks: _noop,
_getTickCoord: _noop
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************************!*\
!*** ./Scripts/viz/chart_components/base_chart.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
eventUtils = __webpack_require__( /*! ../../events/utils */ 4),
BaseWidget = __webpack_require__( /*! ../core/base_widget */ 109),
legendModule = __webpack_require__( /*! ../components/legend */ 330),
dataValidatorModule = __webpack_require__( /*! ../components/data_validator */ 233),
seriesModule = __webpack_require__( /*! ../series/base_series */ 236),
chartThemeManagerModule = __webpack_require__( /*! ../components/chart_theme_manager */ 329),
LayoutManagerModule = __webpack_require__( /*! ./layout_manager */ 328),
trackerModule = __webpack_require__( /*! ./tracker */ 510),
headerBlockModule = __webpack_require__( /*! ./header_block */ 507),
REINIT_REFRESH_ACTION = "_reinit",
REINIT_DATA_SOURCE_REFRESH_ACTION = "_updateDataSource",
DATA_INIT_REFRESH_ACTION = "_dataInit",
FORCE_RENDER_REFRESH_ACTION = "_forceRender",
RESIZE_REFRESH_ACTION = "_resize",
ACTIONS_BY_PRIORITY = [REINIT_REFRESH_ACTION, REINIT_DATA_SOURCE_REFRESH_ACTION, DATA_INIT_REFRESH_ACTION, FORCE_RENDER_REFRESH_ACTION, RESIZE_REFRESH_ACTION],
vizUtils = __webpack_require__( /*! ../core/utils */ 6),
_noop = $.noop,
_map = vizUtils.map,
_each = $.each,
_extend = $.extend,
_isArray = commonUtils.isArray,
_isDefined = commonUtils.isDefined,
_setCanvasValues = vizUtils.setCanvasValues,
DEFAULT_OPACITY = .3,
REINIT_REFRESH_ACTION_OPTIONS = ["adaptiveLayout", "crosshair", "equalBarWidth", "minBubbleSize", "maxBubbleSize", "barWidth", "negativesAsZeroes", "negativesAsZeros", "resolveLabelOverlapping", "seriesSelectionMode", "pointSelectionMode", "adjustOnZoom", "synchronizeMultiAxes", "zoomingMode", "scrollingMode", "useAggregation"];
function checkHeightLabelsInCanvas(points, canvas, isRotated) {
var label, bbox, commonLabelSize = 0,
canvasSize = canvas.end - canvas.start;
for (var i = 0; i < points.length; i++) {
label = points[i].getLabel();
if (label.isVisible()) {
bbox = label.getBoundingRect();
commonLabelSize += isRotated ? bbox.width : bbox.height
} else {
points[i] = null
}
}
if (canvasSize > 0) {
while (commonLabelSize > canvasSize) {
commonLabelSize -= killSmallValues(points, isRotated)
}
}
}
function killSmallValues(points, isRotated) {
var label, bbox, indexOfPoint, smallestValuePoint = {
originalValue: 1 / 0
};
_each(points, function(index, point) {
if (point && smallestValuePoint.originalValue >= point.originalValue) {
smallestValuePoint = point;
indexOfPoint = index
}
});
if (null !== indexOfPoint) {
label = points[indexOfPoint].getLabel();
bbox = label.getBoundingRect();
label.hide();
points[indexOfPoint] = null;
return isRotated ? bbox.width : bbox.height
}
return 0
}
function resolveLabelOverlappingInOneDirection(points, canvas, isRotated, shiftFunction) {
var rollingStocks, stubCanvas = {
start: isRotated ? canvas.left : canvas.top,
end: isRotated ? canvas.width - canvas.right : canvas.height - canvas.bottom
};
checkHeightLabelsInCanvas(points, stubCanvas, isRotated);
rollingStocks = _map(points, function(p) {
return p ? new RollingStock(p, isRotated, shiftFunction) : null
});
rollingStocks.sort(function(a, b) {
return a.getPointPosition() - b.getPointPosition()
});
if (!checkStackOverlap(rollingStocks)) {
return
}
rollingStocks.reverse();
moveRollingStock(rollingStocks, stubCanvas)
}
function overlapRollingStock(firstRolling, secondRolling) {
if (!firstRolling || !secondRolling) {
return
}
return firstRolling.getBoundingRect().end > secondRolling.getBoundingRect().start
}
function checkStackOverlap(rollingStocks) {
var i, j, currentRollingStock, nextRollingStock, overlap;
for (i = 0; i < rollingStocks.length; i++) {
currentRollingStock = rollingStocks[i];
for (j = i + 1; j < rollingStocks.length; j++) {
nextRollingStock = rollingStocks[j];
if (overlapRollingStock(currentRollingStock, nextRollingStock)) {
currentRollingStock.toChain(nextRollingStock);
overlap = true;
rollingStocks[j] = null
}
}
}
return overlap
}
function moveRollingStock(rollingStocks, canvas) {
var i, j, currentRollingStock, nextRollingStock, currentBBox, nextBBox;
for (i = 0; i < rollingStocks.length; i++) {
currentRollingStock = rollingStocks[i];
if (rollingStocksIsOut(currentRollingStock, canvas)) {
currentBBox = currentRollingStock.getBoundingRect();
for (j = i + 1; j < rollingStocks.length; j++) {
nextRollingStock = rollingStocks[j];
if (!nextRollingStock) {
continue
}
nextBBox = nextRollingStock.getBoundingRect();
if (nextBBox.end > currentBBox.start - (currentBBox.end - canvas.end)) {
nextRollingStock.toChain(currentRollingStock);
rollingStocks[i] = currentRollingStock = null;
break
}
}
}
currentRollingStock && currentRollingStock.setRollingStockInCanvas(canvas)
}
}
function rollingStocksIsOut(rollingStock, canvas) {
return rollingStock && rollingStock.getBoundingRect().end > canvas.end
}
function RollingStock(point, isRotated, shiftFunction) {
var label = point.getLabel(),
bbox = label.getBoundingRect();
this.labels = [label];
this.points = [point];
this.shiftFunction = shiftFunction;
this._bbox = {
start: isRotated ? bbox.x : bbox.y,
width: isRotated ? bbox.width : bbox.height,
end: isRotated ? bbox.x + bbox.width : bbox.y + bbox.height
};
this._pointPositionInitialize = isRotated ? point.getBoundaryCoords().x : point.getBoundaryCoords().y;
return this
}
RollingStock.prototype = {
toChain: function(nextRollingStock) {
var nextRollingStockBBox = nextRollingStock.getBoundingRect();
nextRollingStock.shift(nextRollingStockBBox.start - this._bbox.end);
this._changeBoxWidth(nextRollingStockBBox.width);
this.labels = this.labels.concat(nextRollingStock.labels);
this.points = this.points.concat(nextRollingStock.points)
},
getBoundingRect: function() {
return this._bbox
},
shift: function(shiftLength) {
var shiftFunction = this.shiftFunction;
_each(this.labels, function(index, label) {
var bbox = label.getBoundingRect(),
coords = shiftFunction(bbox, shiftLength, label);
label.shift(coords.x, coords.y)
});
this._bbox.end -= shiftLength;
this._bbox.start -= shiftLength
},
setRollingStockInCanvas: function(canvas) {
if (this._bbox.end > canvas.end) {
this.shift(this._bbox.end - canvas.end)
}
},
getPointPosition: function() {
return this._pointPositionInitialize
},
_changeBoxWidth: function(width) {
this._bbox.end += width;
this._bbox.width += width
}
};
function getLegendFields(name) {
return {
nameField: name + "Name",
colorField: name + "Color",
indexField: name + "Index"
}
}
function getLegendSettings(legendDataField) {
var formatObjectFields = getLegendFields(legendDataField);
return {
getFormatObject: function(data) {
var res = {};
res[formatObjectFields.indexField] = data.id;
res[formatObjectFields.colorField] = data.states.normal.fill;
res[formatObjectFields.nameField] = data.text;
return res
},
textField: formatObjectFields.nameField
}
}
function setTemplateFields(data, templateData, series) {
_each(data, function(_, data) {
_each(series.getTemplateFields(), function(_, field) {
data[field.templateField] = data[field.originalField]
});
templateData.push(data)
});
series.updateTemplateFieldNames()
}
function checkOverlapping(firstRect, secondRect) {
return (firstRect.x <= secondRect.x && secondRect.x <= firstRect.x + firstRect.width || firstRect.x >= secondRect.x && firstRect.x <= secondRect.x + secondRect.width) && (firstRect.y <= secondRect.y && secondRect.y <= firstRect.y + firstRect.height || firstRect.y >= secondRect.y && firstRect.y <= secondRect.y + secondRect.height)
}
var overlapping = {
resolveLabelOverlappingInOneDirection: resolveLabelOverlappingInOneDirection
};
function suppressCommonLayout(layout) {
layout.forward = function(rect) {
return rect
};
layout.backward = _noop
}
var BaseChart = BaseWidget.inherit({
_eventsMap: {
onSeriesClick: {
name: "seriesClick"
},
onPointClick: {
name: "pointClick"
},
onArgumentAxisClick: {
name: "argumentAxisClick"
},
onLegendClick: {
name: "legendClick"
},
onSeriesSelectionChanged: {
name: "seriesSelectionChanged"
},
onPointSelectionChanged: {
name: "pointSelectionChanged"
},
onSeriesHoverChanged: {
name: "seriesHoverChanged"
},
onPointHoverChanged: {
name: "pointHoverChanged"
},
onTooltipShown: {
name: "tooltipShown"
},
onTooltipHidden: {
name: "tooltipHidden"
},
onDone: {
name: "done"
}
},
_rootClassPrefix: "dxc",
_rootClass: "dxc-chart",
_init: function() {
this._savedBusinessRange = {};
this.callBase.apply(this, arguments)
},
_initialChanges: ["REINIT"],
_themeDependentChanges: ["REFRESH_SERIES_REINIT"],
_createThemeManager: function() {
var option = this.option(),
themeManager = new chartThemeManagerModule.ThemeManager(option, this._chartType);
themeManager.setTheme(option.theme, option.rtlEnabled);
return themeManager
},
_initCore: function() {
var that = this;
suppressCommonLayout(that._layout);
that._canvasClipRect = that._renderer.clipRect();
that._createHtmlStructure();
that._headerBlock = new headerBlockModule.HeaderBlock;
that._createLegend();
that._createTracker();
that._needHandleRenderComplete = true;
that.layoutManager = new LayoutManagerModule.LayoutManager;
that._createScrollBar();
that._$element.on("contextmenu", function(event) {
that.eventType = "contextmenu";
if (eventUtils.isTouchEvent(event) || eventUtils.isPointerEvent(event)) {
event.preventDefault()
}
}).on("MSHoldVisual", function(event) {
that.eventType = "MSHoldVisual";
event.preventDefault()
})
},
_getLayoutItems: $.noop,
_layoutManagerOptions: function() {
return this._themeManager.getOptions("adaptiveLayout")
},
_reinit: function() {
var that = this;
_setCanvasValues(that._canvas);
that._reinitAxes();
that._skipRender = true;
that._updateDataSource();
if (!that.series) {
that._dataSpecificInit(false)
}
that._skipRender = false;
that._correctAxes();
that._forceRender()
},
_correctAxes: _noop,
_createHtmlStructure: function() {
var that = this,
renderer = that._renderer,
root = renderer.root;
that._backgroundRect = renderer.rect().attr({
fill: "gray",
opacity: 1e-4
}).append(root);
that._panesBackgroundGroup = renderer.g().attr({
"class": "dxc-background"
}).append(root);
that._stripsGroup = renderer.g().attr({
"class": "dxc-strips-group"
}).linkOn(root, "strips");
that._gridGroup = renderer.g().attr({
"class": "dxc-grids-group"
}).linkOn(root, "grids");
that._axesGroup = renderer.g().attr({
"class": "dxc-axes-group"
}).linkOn(root, "axes");
that._constantLinesGroup = renderer.g().attr({
"class": "dxc-constant-lines-group"
}).linkOn(root, "constant-lines");
that._labelAxesGroup = renderer.g().attr({
"class": "dxc-strips-labels-group"
}).linkOn(root, "strips-labels");
that._panesBorderGroup = renderer.g().attr({
"class": "dxc-border"
}).linkOn(root, "border");
that._seriesGroup = renderer.g().attr({
"class": "dxc-series-group"
}).linkOn(root, "series");
that._labelsGroup = renderer.g().attr({
"class": "dxc-labels-group"
}).linkOn(root, "labels");
that._crosshairCursorGroup = renderer.g().attr({
"class": "dxc-crosshair-cursor"
}).linkOn(root, "crosshair");
that._legendGroup = renderer.g().attr({
"class": "dxc-legend",
clipId: that._getCanvasClipRectID()
}).linkOn(root, "legend");
that._scrollBarGroup = renderer.g().attr({
"class": "dxc-scroll-bar"
}).linkOn(root, "scroll-bar")
},
_disposeObjectsInArray: function(propName, fieldNames) {
_each(this[propName] || [], function(_, item) {
if (fieldNames && item) {
_each(fieldNames, function(_, field) {
item[field] && item[field].dispose()
})
} else {
item && item.dispose()
}
});
this[propName] = null
},
_disposeCore: function() {
var that = this,
disposeObject = function(propName) {
if (that[propName]) {
that[propName].dispose();
that[propName] = null
}
},
unlinkGroup = function(name) {
that[name].linkOff()
},
disposeObjectsInArray = this._disposeObjectsInArray;
clearTimeout(that._delayedRedraw);
that._renderer.stopAllAnimations();
that.businessRanges = that.translators = null;
disposeObjectsInArray.call(that, "series");
disposeObject("_headerBlock");
disposeObject("_tracker");
disposeObject("_crosshair");
that.layoutManager = null;
that.paneAxis = null;
that._userOptions = null;
that._canvas = null;
unlinkGroup("_stripsGroup");
unlinkGroup("_gridGroup");
unlinkGroup("_axesGroup");
unlinkGroup("_constantLinesGroup");
unlinkGroup("_labelAxesGroup");
unlinkGroup("_panesBorderGroup");
unlinkGroup("_seriesGroup");
unlinkGroup("_labelsGroup");
unlinkGroup("_crosshairCursorGroup");
unlinkGroup("_legendGroup");
unlinkGroup("_scrollBarGroup");
disposeObject("_canvasClipRect");
disposeObject("_panesBackgroundGroup");
disposeObject("_stripsGroup");
disposeObject("_gridGroup");
disposeObject("_axesGroup");
disposeObject("_constantLinesGroup");
disposeObject("_labelAxesGroup");
disposeObject("_panesBorderGroup");
disposeObject("_seriesGroup");
disposeObject("_labelsGroup");
disposeObject("_crosshairCursorGroup");
disposeObject("_legendGroup");
disposeObject("_scrollBarGroup")
},
_getAnimationOptions: function() {
return this._themeManager.getOptions("animation")
},
_getDefaultSize: function() {
return {
width: 400,
height: 400
}
},
_getOption: function(name) {
return this._themeManager.getOptions(name)
},
_applySize: function() {
this._processRefreshData(RESIZE_REFRESH_ACTION)
},
_resize: function() {
this._doRender(this.__renderOptions || {
animate: false,
isResize: true
})
},
_trackerType: "ChartTracker",
_createTracker: function() {
var that = this;
that._tracker = new trackerModule[that._trackerType]({
seriesGroup: that._seriesGroup,
renderer: that._renderer,
tooltip: that._tooltip,
legend: that._legend,
eventTrigger: that._eventTrigger
})
},
_getTrackerSettings: function() {
return {
seriesSelectionMode: this._themeManager.getOptions("seriesSelectionMode"),
pointSelectionMode: this._themeManager.getOptions("pointSelectionMode")
}
},
_updateTracker: function(trackerCanvases) {
var that = this;
that._tracker.update(that._getTrackerSettings());
that._tracker.setCanvases({
left: 0,
right: that._canvas.width,
top: 0,
bottom: that._canvas.height
}, trackerCanvases)
},
_doRender: function(_options) {
var drawOptions, recreateCanvas, that = this;
if ( /*!that._initialized || */ that._skipRender) {
return
}
if (0 === that._canvas.width && 0 === that._canvas.height) {
return
}
that._resetIsReady();
drawOptions = that._prepareDrawOptions(_options);
recreateCanvas = drawOptions.recreateCanvas;
clearTimeout(that._delayedRedraw);
that.__originalCanvas = that._canvas;
that._canvas = $.extend({}, that._canvas);
if (recreateCanvas) {
that.__currentCanvas = that._canvas
} else {
that._canvas = that.__currentCanvas
}
that.DEBUG_canvas = that._canvas;
recreateCanvas && that._updateCanvasClipRect(that._canvas);
that._renderer.stopAllAnimations(true);
_setCanvasValues(that._canvas);
that._cleanGroups(drawOptions);
that._renderElements(drawOptions)
},
_saveBusinessRange: _noop,
_renderElements: function(drawOptions) {
var argBusinessRange, zoomMinArg, zoomMaxArg, that = this,
preparedOptions = that._prepareToRender(drawOptions),
isRotated = that._isRotated(),
isLegendInside = that._isLegendInside(),
trackerCanvases = [],
layoutTargets = that._getLayoutTargets(),
dirtyCanvas = $.extend({}, that._canvas),
drawElements = [],
layoutCanvas = drawOptions.drawTitle && drawOptions.drawLegend && drawOptions.adjustAxes;
that.DEBUG_dirtyCanvas = dirtyCanvas;
if (layoutCanvas) {
drawElements = that._getDrawElements(drawOptions, isLegendInside)
}
that._renderer.lock();
that._saveBusinessRange();
that.layoutManager.setOptions(that._layoutManagerOptions());
that.layoutManager.layoutElements(drawElements, that._canvas, that._getAxisDrawingMethods(drawOptions, preparedOptions, isRotated), layoutTargets, isRotated, that._getAxesForTransform(isRotated));
layoutCanvas && that._updateCanvasClipRect(dirtyCanvas);
that._applyClipRects(preparedOptions);
that._appendSeriesGroups();
that._createCrosshairCursor();
_each(layoutTargets, function() {
var canvas = this.canvas;
trackerCanvases.push({
left: canvas.left,
right: canvas.width - canvas.right,
top: canvas.top,
bottom: canvas.height - canvas.bottom
})
});
if (that._scrollBar) {
argBusinessRange = that.businessRanges[0].arg;
if ("discrete" === argBusinessRange.axisType && argBusinessRange.categories && argBusinessRange.categories.length <= 1) {
zoomMinArg = zoomMaxArg = void 0
} else {
zoomMinArg = argBusinessRange.minVisible;
zoomMaxArg = argBusinessRange.maxVisible
}
that._scrollBar.init(argBusinessRange, layoutTargets[0].canvas).setPosition(zoomMinArg, zoomMaxArg)
}
that._updateTracker(trackerCanvases);
that._updateLegendPosition(drawOptions, isLegendInside);
that._renderSeries(drawOptions, isRotated, isLegendInside);
that._renderer.unlock()
},
_createCrosshairCursor: _noop,
_appendSeriesGroups: function() {
this._seriesGroup.linkAppend();
this._labelsGroup.linkAppend();
this._appendAdditionalSeriesGroups()
},
_renderSeries: function(drawOptions, isRotated, isLegendInside) {
var that = this,
themeManager = that._themeManager,
resolveLabelOverlapping = themeManager.getOptions("resolveLabelOverlapping");
drawOptions.hideLayoutLabels = that.layoutManager.needMoreSpaceForPanesCanvas(that._getLayoutTargets(), isRotated) && !themeManager.getOptions("adaptiveLayout").keepLabels;
that._drawSeries(drawOptions, isRotated);
"none" !== resolveLabelOverlapping && that._resolveLabelOverlapping(resolveLabelOverlapping);
that._adjustSeries();
that._renderTrackers(isLegendInside);
that._tracker.repairTooltip();
that._canvas = that.__originalCanvas;
that._drawn();
that._renderCompleteHandler()
},
_drawSeries: function(drawOptions, isRotated) {
var i, singleSeries, that = this,
series = that.series,
seriesLength = series.length;
that._updateSeriesDimensions(drawOptions);
for (i = 0; i < seriesLength; i++) {
singleSeries = series[i];
that._applyExtraSettings(singleSeries, drawOptions);
singleSeries.draw(that._prepareTranslators(singleSeries, i, isRotated), drawOptions.animate && singleSeries.getPoints().length <= drawOptions.animationPointsLimit && that._renderer.animationEnabled(), drawOptions.hideLayoutLabels, that._getLegendCallBack(singleSeries))
}
},
_resolveLabelOverlapping: function(resolveLabelOverlapping) {
var func;
switch (resolveLabelOverlapping) {
case "stack":
func = this._resolveLabelOverlappingStack;
break;
case "hide":
func = this._resolveLabelOverlappingHide;
break;
case "shift":
func = this._resolveLabelOverlappingShift
}
$.isFunction(func) && func.call(this)
},
_getVisibleSeries: function() {
return $.grep(this.getAllSeries(), function(series) {
return series.isVisible()
})
},
_resolveLabelOverlappingHide: function() {
var currentLabel, nextLabel, currentLabelRect, nextLabelRect, i, j, points, labels = [],
series = this._getVisibleSeries();
for (i = 0; i < series.length; i++) {
points = series[i].getVisiblePoints();
for (j = 0; j < points.length; j++) {
labels.push(points[j].getLabel())
}
}
labels = [].concat.apply([], labels);
for (i = 0; i < labels.length; i++) {
currentLabel = labels[i];
currentLabelRect = currentLabel.getBoundingRect();
if (!currentLabel.isVisible()) {
continue
}
for (j = i + 1; j < labels.length; j++) {
nextLabel = labels[j];
nextLabelRect = nextLabel.getBoundingRect();
if (checkOverlapping(currentLabelRect, nextLabelRect)) {
nextLabel.hide()
}
}
}
},
_cleanGroups: function(drawOptions) {
var that = this;
that._stripsGroup.linkRemove().clear();
that._gridGroup.linkRemove().clear();
that._axesGroup.linkRemove().clear();
that._constantLinesGroup.linkRemove().clear();
that._labelAxesGroup.linkRemove().clear();
that._labelsGroup.linkRemove().clear();
that._crosshairCursorGroup.linkRemove().clear()
},
_createLegend: function() {
var that = this,
legendSettings = getLegendSettings(that._legendDataField);
that._legend = new legendModule.Legend({
renderer: that._renderer,
group: that._legendGroup,
backgroundClass: "dxc-border",
itemGroupClass: "dxc-item",
textField: legendSettings.textField,
getFormatObject: legendSettings.getFormatObject
})
},
_updateLegend: function() {
var that = this,
themeManager = that._themeManager,
legendOptions = themeManager.getOptions("legend"),
legendData = that._getLegendData();
legendOptions.containerBackgroundColor = themeManager.getOptions("containerBackgroundColor");
legendOptions._incidentOccurred = that._incidentOccurred;
that._legend.update(legendData, legendOptions)
},
_prepareDrawOptions: function(drawOptions) {
var options, animationOptions = this._getAnimationOptions();
options = $.extend({}, {
force: false,
adjustAxes: true,
drawLegend: true,
drawTitle: true,
animate: animationOptions.enabled,
animationPointsLimit: animationOptions.maxPointCountSupported
}, drawOptions, this.__renderOptions);
if (!_isDefined(options.recreateCanvas)) {
options.recreateCanvas = options.adjustAxes && options.drawLegend && options.drawTitle
}
return options
},
_processRefreshData: function(newRefreshAction) {
var currentRefreshActionPosition = $.inArray(this._currentRefreshData, ACTIONS_BY_PRIORITY),
newRefreshActionPosition = $.inArray(newRefreshAction, ACTIONS_BY_PRIORITY);
if (!this._currentRefreshData || currentRefreshActionPosition >= 0 && newRefreshActionPosition < currentRefreshActionPosition) {
this._currentRefreshData = newRefreshAction
}
},
_getLegendData: function() {
return _map(this._getLegendTargets(), function(item) {
var legendData = item.legendData,
style = item.getLegendStyles,
opacity = style.normal.opacity;
if (!item.visible) {
if (!_isDefined(opacity) || opacity > DEFAULT_OPACITY) {
opacity = DEFAULT_OPACITY
}
legendData.textOpacity = DEFAULT_OPACITY
}
legendData.states = {
hover: style.hover,
selection: style.selection,
normal: _extend({}, style.normal, {
opacity: opacity
})
};
return legendData
})
},
_getLegendOptions: function(item) {
return {
legendData: {
text: item[this._legendItemTextField],
argument: item.argument,
id: item.index
},
getLegendStyles: item.getLegendStyles(),
visible: item.isVisible()
}
},
_disposeSeries: function() {
var that = this;
_each(that.series || [], function(_, series) {
series.dispose()
});
that.series = null;
_each(that.seriesFamilies || [], function(_, family) {
family.dispose()
});
that.seriesFamilies = null;
that._needHandleRenderComplete = true
},
_optionChanged: function(arg) {
this._themeManager.resetOptions(arg.name);
this.callBase.apply(this, arguments)
},
_applyChanges: function() {
var that = this;
that._themeManager.update(that._options);
that.callBase.apply(that, arguments);
that._doRefresh()
},
_optionChangesMap: {
animation: "ANIMATION",
dataSource: "DATA_SOURCE",
palette: "PALETTE",
series: "REFRESH_SERIES_DATA_INIT",
commonSeriesSettings: "REFRESH_SERIES_DATA_INIT",
containerBackgroundColor: "REFRESH_SERIES_DATA_INIT",
dataPrepareSettings: "REFRESH_SERIES_DATA_INIT",
legend: "DATA_INIT",
seriesTemplate: "DATA_INIT",
"export": "FORCE_RENDER",
valueAxis: "AXES_AND_PANES",
argumentAxis: "AXES_AND_PANES",
commonAxisSettings: "AXES_AND_PANES",
panes: "AXES_AND_PANES",
defaultPane: "AXES_AND_PANES",
rotated: "ROTATED",
customizePoint: "REFRESH_SERIES_REINIT",
customizeLabel: "REFRESH_SERIES_REINIT",
scrollBar: "SCROLL_BAR"
},
_customChangesOrder: ["ANIMATION", "DATA_SOURCE", "PALETTE", "REFRESH_SERIES_DATA_INIT", "DATA_INIT", "FORCE_RENDER", "AXES_AND_PANES", "ROTATED", "REFRESH_SERIES_REINIT", "SCROLL_BAR", "CHART_TOOLTIP", "REINIT"],
_change_ANIMATION: function() {
this._renderer.updateAnimationOptions(this._getAnimationOptions())
},
_change_DATA_SOURCE: function() {
this._needHandleRenderComplete = true;
this._processRefreshData(REINIT_DATA_SOURCE_REFRESH_ACTION)
},
_change_PALETTE: function() {
this._themeManager.updatePalette(this.option("palette"));
this._refreshSeries(DATA_INIT_REFRESH_ACTION)
},
_change_REFRESH_SERIES_DATA_INIT: function() {
this._refreshSeries(DATA_INIT_REFRESH_ACTION)
},
_change_DATA_INIT: function() {
this._processRefreshData(DATA_INIT_REFRESH_ACTION)
},
_change_FORCE_RENDER: function() {
this._processRefreshData(FORCE_RENDER_REFRESH_ACTION)
},
_change_AXES_AND_PANES: function() {
this._refreshSeries(REINIT_REFRESH_ACTION);
this.paneAxis = {}
},
_change_ROTATED: function() {
this._createScrollBar();
this._refreshSeries(REINIT_REFRESH_ACTION)
},
_change_REFRESH_SERIES_REINIT: function() {
this._refreshSeries(REINIT_REFRESH_ACTION)
},
_change_SCROLL_BAR: function() {
this._createScrollBar();
this._processRefreshData(FORCE_RENDER_REFRESH_ACTION)
},
_change_CHART_TOOLTIP: function() {
this._organizeStackPoints()
},
_change_REINIT: function() {
this._processRefreshData(REINIT_REFRESH_ACTION)
},
_refreshSeries: function(actionName) {
this._disposeSeries();
this._processRefreshData(actionName)
},
_doRefresh: function() {
var methodName = this._currentRefreshData;
if (methodName) {
this._currentRefreshData = null;
this._renderer.stopAllAnimations(true);
this[methodName]()
}
},
_updateCanvasClipRect: function(canvas) {
var width, height, that = this;
width = Math.max(canvas.width - canvas.left - canvas.right, 0);
height = Math.max(canvas.height - canvas.top - canvas.bottom, 0);
that._canvasClipRect.attr({
x: canvas.left,
y: canvas.top,
width: width,
height: height
});
that._backgroundRect.attr({
x: canvas.left,
y: canvas.top,
width: width,
height: height
})
},
_getCanvasClipRectID: function() {
return this._canvasClipRect.id
},
_dataSourceChangedHandler: function() {
this._resetZoom();
this._dataInit()
},
_dataInit: function() {
clearTimeout(this._delayedRedraw);
this._dataSpecificInit(true)
},
_dataSpecificInit: function(needRedraw) {
var that = this;
that.series = that.series || that._populateSeries();
that._repopulateSeries();
that._seriesPopulatedHandlerCore();
that._populateBusinessRange();
that._collectPointsByArg();
that._tracker.updateSeries(that._getStoredSeries());
that._updateLegend();
needRedraw && that._forceRender()
},
_forceRender: function() {
this._doRender({
force: true
})
},
_repopulateSeries: function() {
var parsedData, that = this,
themeManager = that._themeManager,
data = that._dataSource.items(),
dataValidatorOptions = themeManager.getOptions("dataPrepareSettings"),
seriesTemplate = themeManager.getOptions("seriesTemplate");
if (seriesTemplate) {
that._templatedSeries = vizUtils.processSeriesTemplate(seriesTemplate, data);
that._populateSeries();
delete that._templatedSeries;
data = that.templateData || data
}
that._groupSeries();
parsedData = dataValidatorModule.validateData(data, that._groupsData, that._incidentOccurred, dataValidatorOptions);
themeManager.resetPalette();
_each(that.series, function(_, singleSeries) {
singleSeries.updateData(parsedData[singleSeries.getArgumentField()]);
that._processSingleSeries(singleSeries)
});
that._organizeStackPoints()
},
_organizeStackPoints: function() {
var that = this,
themeManager = that._themeManager,
sharedTooltip = themeManager.getOptions("tooltip").shared,
stackPoints = {};
_each(that.series || [], function(_, singleSeries) {
that._resetStackPoints(singleSeries);
sharedTooltip && that._prepareStackPoints(singleSeries, stackPoints)
})
},
_renderCompleteHandler: function() {
var that = this,
allSeriesInited = true;
if (that._needHandleRenderComplete) {
_each(that.series, function(_, s) {
allSeriesInited = allSeriesInited && s.canRenderCompleteHandle()
});
if (allSeriesInited) {
that._needHandleRenderComplete = false;
that._eventTrigger("done", {
target: that
})
}
}
},
_getDrawElements: function(drawOptions, legendHasInsidePosition) {
var that = this,
drawElements = [],
exportOptions = that._themeManager.getOptions("export"),
titleOptions = that._title.getLayoutOptions() || {},
headerElements = [];
that._exportMenu && exportOptions.enabled && headerElements.push(that._exportMenu);
if (drawOptions.drawTitle) {
"bottom" !== titleOptions.verticalAlignment && headerElements.length ? headerElements.push(that._title) : drawElements.push(that._title)
}
if (headerElements.length) {
that._headerBlock.update(headerElements, that._canvas);
drawElements.push(that._headerBlock)
}
if (drawOptions.drawLegend && that._legend) {
that._legendGroup.linkAppend();
!legendHasInsidePosition && drawElements.push(that._legend)
}
return drawElements
},
_resetZoom: _noop,
_dataIsReady: function() {
return _isDefined(this.option("dataSource")) && this._dataSource.isLoaded()
},
_populateSeries: function() {
var particularSeriesOptions, particularSeries, seriesTheme, data, i, that = this,
themeManager = that._themeManager,
hasSeriesTemplate = !!themeManager.getOptions("seriesTemplate"),
seriesOptions = hasSeriesTemplate ? that._templatedSeries : that.option("series"),
allSeriesOptions = _isArray(seriesOptions) ? seriesOptions : seriesOptions ? [seriesOptions] : [],
extraOptions = that._getExtraOptions(),
seriesVisibilityChanged = function() {
that._specialProcessSeries();
that._populateBusinessRange();
that._renderer.stopAllAnimations(true);
that._updateLegend();
that._doRender({
force: true
})
};
that._disposeSeries();
that.series = [];
that.templateData = [];
themeManager.resetPalette();
for (i = 0; i < allSeriesOptions.length; i++) {
particularSeriesOptions = _extend(true, {}, allSeriesOptions[i], extraOptions);
if (!particularSeriesOptions.name) {
particularSeriesOptions.name = "Series " + (i + 1).toString()
}
data = particularSeriesOptions.data;
particularSeriesOptions.data = null;
particularSeriesOptions.rotated = that._isRotated();
particularSeriesOptions.customizePoint = themeManager.getOptions("customizePoint");
particularSeriesOptions.customizeLabel = themeManager.getOptions("customizeLabel");
particularSeriesOptions.visibilityChanged = seriesVisibilityChanged;
particularSeriesOptions.incidentOccurred = that._incidentOccurred;
seriesTheme = themeManager.getOptions("series", particularSeriesOptions);
if (!that._checkPaneName(seriesTheme)) {
continue
}
particularSeries = new seriesModule.Series({
renderer: that._renderer,
seriesGroup: that._seriesGroup,
labelsGroup: that._labelsGroup
}, seriesTheme);
if (!particularSeries.isUpdated) {
that._incidentOccurred("E2101", [seriesTheme.type])
} else {
particularSeries.index = that.series.length;
that._processSingleSeries(particularSeries);
that.series.push(particularSeries);
if (hasSeriesTemplate) {
setTemplateFields(data, that.templateData, particularSeries)
}
}
}
return that.series
},
getAllSeries: function() {
return this.series.slice()
},
getSeriesByName: function(name) {
var found = null;
_each(this.series, function(i, singleSeries) {
if (singleSeries.name === name) {
found = singleSeries;
return false
}
});
return found
},
getSeriesByPos: function(pos) {
return this.series[pos]
},
clearSelection: function() {
this._tracker.clearSelection()
},
hideTooltip: function() {
this._tracker._hideTooltip()
},
render: function(renderOptions) {
var that = this;
that.__renderOptions = renderOptions;
that.__forceRender = renderOptions && renderOptions.force;
that.callBase.apply(that, arguments);
that.__renderOptions = that.__forceRender = null;
return that
},
getSize: function() {
var canvas = this._canvas || {};
return {
width: canvas.width,
height: canvas.height
}
}
});
_each(REINIT_REFRESH_ACTION_OPTIONS, function(_, name) {
BaseChart.prototype._optionChangesMap[name] = "REINIT"
});
exports.overlapping = overlapping;
exports.BaseChart = BaseChart;
BaseChart.addPlugin(__webpack_require__( /*! ../core/data_source */ 161).plugin);
BaseChart.addPlugin(__webpack_require__( /*! ../core/export */ 127).plugin);
BaseChart.addPlugin(__webpack_require__( /*! ../core/title */ 164).plugin);
BaseChart.addPlugin(__webpack_require__( /*! ../core/tooltip */ 165).plugin);
BaseChart.addPlugin(__webpack_require__( /*! ../core/loading_indicator */ 163).plugin);
var _change_TITLE = BaseChart.prototype._change_TITLE;
BaseChart.prototype._change_TITLE = function() {
_change_TITLE.apply(this, arguments);
this._change(["FORCE_RENDER"])
};
var _change_TOOLTIP = BaseChart.prototype._change_TOOLTIP;
BaseChart.prototype._change_TOOLTIP = function() {
_change_TOOLTIP.apply(this, arguments);
this._change(["CHART_TOOLTIP"])
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************************!*\
!*** ./Scripts/viz/components/data_validator.js ***!
\**************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
STRING = "string",
NUMERIC = "numeric",
DATETIME = "datetime",
DISCRETE = "discrete",
SEMIDISCRETE = "semidiscrete",
CONTINUOUS = "continuous",
LOGARITHMIC = "logarithmic",
VALUE_TYPE = "valueType",
ARGUMENT_TYPE = "argumentType",
axisTypeParser = __webpack_require__( /*! ../core/utils */ 6).enumParser([STRING, NUMERIC, DATETIME]),
_getParser = __webpack_require__( /*! ./parse_utils */ 234).getParser,
_isDefined = commonUtils.isDefined,
_isFunction = commonUtils.isFunction,
_isArray = commonUtils.isArray,
_isString = commonUtils.isString,
_isDate = commonUtils.isDate,
_isNumber = commonUtils.isNumber,
_isObject = commonUtils.isObject,
_each = $.each;
function groupingValues(data, others, valueField, index) {
if (index >= 0) {
_each(data.slice(index), function(_, cell) {
if (_isDefined(cell[valueField])) {
others[valueField] += cell[valueField];
cell[valueField] = cell["original" + valueField] = void 0
}
})
}
}
function processGroup(_, group) {
group.valueType = group.valueAxisType = null;
_each(group.series, processSeries);
group.valueAxis && group.valueAxis.resetTypes(VALUE_TYPE)
}
function parseCategories(categories, parser) {
var newArray = [];
_each(categories, function(_, category) {
var parsedCategory = parser(category);
void 0 !== parsedCategory && newArray.push(parsedCategory)
});
return newArray
}
function parseAxisCategories(groupsData, parsers) {
var argumentCategories = groupsData.argumentOptions && groupsData.argumentOptions.categories,
valueParser = parsers[1];
_each(groupsData.groups, function(_, valueGroup) {
var categories = valueGroup.valueOptions && valueGroup.valueOptions.categories;
if (categories) {
valueGroup.valueOptions.categories = parseCategories(categories, valueParser)
}
});
if (argumentCategories) {
groupsData.argumentOptions.categories = parseCategories(argumentCategories, parsers[0])
}
}
function processSeries(_, series) {
series.updateDataType({})
}
function resetAxisTypes(_, axis) {
axis.resetTypes(ARGUMENT_TYPE)
}
function filterForLogAxis(val, field, incidentOccurred) {
if (val <= 0) {
incidentOccurred("E2004", [field]);
val = null
}
return val
}
function eigen(x) {
return x
}
function getType(unit, type) {
var result = type;
if (type === STRING || _isString(unit)) {
result = STRING
} else {
if (type === DATETIME || _isDate(unit)) {
result = DATETIME
} else {
if (_isNumber(unit)) {
result = NUMERIC
}
}
}
return result
}
function correctAxisType(type, axisType, hasCategories, incidentOccurred) {
if (type === STRING && (axisType === CONTINUOUS || axisType === LOGARITHMIC || axisType === SEMIDISCRETE)) {
incidentOccurred("E2002")
}
return axisType === LOGARITHMIC ? LOGARITHMIC : hasCategories || axisType === DISCRETE || type === STRING ? DISCRETE : axisType === SEMIDISCRETE ? SEMIDISCRETE : CONTINUOUS
}
function validUnit(unit, field, incidentOccurred) {
if (unit) {
incidentOccurred(!_isNumber(unit) && !_isDate(unit) && !_isString(unit) ? "E2003" : "E2004", [field])
}
}
function createParserUnit(type, axisType, ignoreEmptyPoints, skipFields, incidentOccurred) {
var parser = type ? _getParser(type) : eigen,
filter = axisType === LOGARITHMIC ? filterForLogAxis : eigen;
return function(unit, field) {
var parseUnit = filter(parser(unit), field, incidentOccurred);
null === parseUnit && ignoreEmptyPoints && (parseUnit = void 0);
if (void 0 === parseUnit) {
skipFields[field] = (skipFields[field] || 0) + 1;
validUnit(unit, field, incidentOccurred)
}
return parseUnit
}
}
function prepareParsers(groupsData, skipFields, incidentOccurred) {
var sizeParser, valueParser, iep, argumentParser = createParserUnit(groupsData.argumentType, groupsData.argumentAxisType, false, skipFields, incidentOccurred),
categoryParsers = [argumentParser],
cache = {},
list = [];
_each(groupsData.groups, function(_, group) {
_each(group.series, function(_, series) {
iep = series.getOptions().ignoreEmptyPoints;
valueParser = createParserUnit(group.valueType, group.valueAxisType, iep, skipFields, incidentOccurred);
sizeParser = createParserUnit(NUMERIC, CONTINUOUS, iep, skipFields, incidentOccurred);
cache[series.getArgumentField()] = argumentParser;
_each(series.getValueFields(), function(_, field) {
!categoryParsers[1] && (categoryParsers[1] = valueParser);
cache[field] = valueParser
});
if (series.getSizeField()) {
cache[series.getSizeField()] = sizeParser
}
if (series.getTagField()) {
cache[series.getTagField()] = eigen
}
})
});
_each(cache, function(field, parser) {
list.push([field, parser])
});
list.length && parseAxisCategories(groupsData, categoryParsers);
return list
}
function getParsedCell(cell, parsers) {
var i, field, value, ii = parsers.length,
obj = {};
for (i = 0; i < ii; ++i) {
field = parsers[i][0];
value = cell[field];
obj[field] = parsers[i][1](value, field);
obj["original" + field] = value
}
return obj
}
function parse(data, parsers) {
var i, parsedData = [],
ii = data.length;
parsedData.length = ii;
for (i = 0; i < ii; ++i) {
parsedData[i] = getParsedCell(data[i], parsers)
}
return parsedData
}
function findIndexByThreshold(data, valueField, threshold) {
var i, value, ii = data.length;
for (i = 0; i < ii; ++i) {
value = data[i][valueField];
if (_isDefined(value) && threshold > value) {
break
}
}
return i
}
function groupMinSlices(originalData, argumentField, valueField, smallValuesGrouping) {
smallValuesGrouping = smallValuesGrouping || {};
var data, mode = smallValuesGrouping.mode,
others = {};
if (!mode || "none" === mode) {
return
}
others[argumentField] = String(smallValuesGrouping.groupName || "others");
others[valueField] = 0;
data = originalData.slice();
data.sort(function(a, b) {
var isA = _isDefined(a[valueField]) ? 1 : 0,
isB = _isDefined(b[valueField]) ? 1 : 0;
return isA && isB ? b[valueField] - a[valueField] : isB - isA
});
groupingValues(data, others, valueField, "smallValueThreshold" === mode ? findIndexByThreshold(data, valueField, smallValuesGrouping.threshold) : smallValuesGrouping.topCount);
others[valueField] && originalData.push(others)
}
function groupPieData(data, groupsData) {
var firstSeries = groupsData.groups[0] && groupsData.groups[0].series[0],
isPie = firstSeries && ("pie" === firstSeries.type || "doughnut" === firstSeries.type || "donut" === firstSeries.type);
if (!isPie) {
return
}
_each(groupsData.groups, function(_, group) {
_each(group.series, function(_, series) {
groupMinSlices(data, series.getArgumentField(), series.getValueFields()[0], series.getOptions().smallValuesGrouping)
})
})
}
function addUniqueItemToCollection(item, collection, itemsHash) {
if (!itemsHash[item]) {
collection.push(item);
itemsHash[item] = true
}
}
function getUniqueArgumentFields(groupsData) {
var uniqueArgumentFields = [],
hash = {};
_each(groupsData.groups, function(_, group) {
_each(group.series, function(__, series) {
addUniqueItemToCollection(series.getArgumentField(), uniqueArgumentFields, hash)
})
});
return uniqueArgumentFields
}
function discreteDataProcessing(data, groupsData, userArgumentCategories, uniqueArgumentFields) {
var categories = groupsData.categories = $.extend([], userArgumentCategories),
hash = {};
categories.length && _each(categories, function(_, currentCategory) {
hash[currentCategory] = true
});
_each(uniqueArgumentFields, function(_, field) {
_each(data, function(_, item) {
_isDefined(item[field]) && addUniqueItemToCollection(item[field], categories, hash)
})
})
}
function compareWithoutHash(argumentField) {
return function(a, b) {
var cmpResult = a[argumentField] - b[argumentField];
if (isNaN(cmpResult)) {
if (!a[argumentField]) {
return 1
}
if (!b[argumentField]) {
return -1
}
return 0
}
return cmpResult
}
}
function sort(data, groupsData, sortingMethodOption, uniqueArgumentFields) {
var getSortingMethod, itemsHash = {},
dataByArguments = {},
getSortMethodByType = function(sortingByHash, hash) {
return sortingByHash ? function(argumentField) {
return function(a, b) {
return hash[a[argumentField]] - hash[b[argumentField]]
}
} : compareWithoutHash
};
if (_isFunction(sortingMethodOption)) {
data.sort(sortingMethodOption)
} else {
if (groupsData.categories) {
_each(groupsData.categories, function(index, value) {
itemsHash[value] = index
});
getSortingMethod = getSortMethodByType(true, itemsHash)
} else {
if (true === sortingMethodOption && groupsData.argumentType !== STRING) {
getSortingMethod = getSortMethodByType(false, itemsHash)
}
}
}
_each(uniqueArgumentFields, function(_, argumentField) {
var sortMethod, currentDataItem;
if (getSortingMethod) {
sortMethod = getSortingMethod(argumentField);
currentDataItem = data.slice().sort(sortMethod)
} else {
currentDataItem = data
}
dataByArguments[argumentField] = currentDataItem
});
return dataByArguments
}
function checkValueTypeOfGroup(group, cell) {
_each(group.series, function(_, series) {
_each(series.getValueFields(), function(_, field) {
group.valueType = getType(cell[field], group.valueType)
})
});
return group.valueType
}
function checkArgumentTypeOfGroup(series, cell, groupsData) {
_each(series, function(_, currentCeries) {
groupsData.argumentType = getType(cell[currentCeries.getArgumentField()], groupsData.argumentType)
});
return groupsData.argumentType
}
function checkType(data, groupsData, checkTypeForAllData) {
var groupsWithUndefinedValueType = [],
groupsWithUndefinedArgumentType = [],
argumentTypeGroup = groupsData.argumentOptions && axisTypeParser(groupsData.argumentOptions.argumentType);
_each(groupsData.groups, function(_, group) {
if (!group.series.length) {
return null
}
var valueTypeGroup = group.valueOptions && axisTypeParser(group.valueOptions.valueType);
group.valueType = valueTypeGroup;
groupsData.argumentType = argumentTypeGroup;
!valueTypeGroup && groupsWithUndefinedValueType.push(group);
!argumentTypeGroup && groupsWithUndefinedArgumentType.push(group)
});
if (groupsWithUndefinedValueType.length || groupsWithUndefinedArgumentType.length) {
_each(data, function(_, cell) {
var defineVal, defineArg;
_each(groupsWithUndefinedValueType, function(_, group) {
defineVal = checkValueTypeOfGroup(group, cell)
});
_each(groupsWithUndefinedArgumentType, function(_, group) {
defineArg = checkArgumentTypeOfGroup(group.series, cell, groupsData)
});
if (!checkTypeForAllData && defineVal && defineArg) {
return false
}
})
}
}
function checkAxisType(groupsData, userArgumentCategories, incidentOccurred) {
var argumentOptions = groupsData.argumentOptions || {},
argumentAxisType = correctAxisType(groupsData.argumentType, argumentOptions.type, !!userArgumentCategories.length, incidentOccurred);
_each(groupsData.groups, function(_, group) {
var valueOptions = group.valueOptions || {},
valueCategories = valueOptions.categories || [],
valueAxisType = correctAxisType(group.valueType, valueOptions.type, !!valueCategories.length, incidentOccurred);
_each(group.series, function(_, series) {
var optionsSeries = {};
optionsSeries.argumentAxisType = argumentAxisType;
optionsSeries.valueAxisType = valueAxisType;
groupsData.argumentAxisType = groupsData.argumentAxisType || optionsSeries.argumentAxisType;
group.valueAxisType = group.valueAxisType || optionsSeries.valueAxisType;
optionsSeries.argumentType = groupsData.argumentType;
optionsSeries.valueType = group.valueType;
optionsSeries.showZero = valueOptions.showZero;
series.updateDataType(optionsSeries)
});
group.valueAxisType = group.valueAxisType || valueAxisType;
if (group.valueAxis) {
group.valueAxis.setTypes(group.valueAxisType, group.valueType, VALUE_TYPE);
group.valueAxis.validate(false)
}
});
groupsData.argumentAxisType = groupsData.argumentAxisType || argumentAxisType;
if (groupsData.argumentAxes) {
_each(groupsData.argumentAxes, function(_, axis) {
axis.setTypes(groupsData.argumentAxisType, groupsData.argumentType, ARGUMENT_TYPE);
axis.validate(true)
})
}
}
function verifyData(source, incidentOccurred) {
var i, ii, k, item, data = [],
hasError = !_isArray(source);
if (!hasError) {
for (i = 0, ii = source.length, k = 0; i < ii; ++i) {
item = source[i];
if (_isObject(item)) {
data[k++] = item
} else {
if (item) {
hasError = true
}
}
}
}
if (hasError) {
incidentOccurred("E2001")
}
return data
}
function validateData(data, groupsData, incidentOccurred, options) {
var parsers, dataLength, categoriesInAxisType, dataByArgumentFields, skipFields = {},
argumentOptions = groupsData.argumentOptions,
userArgumentCategories = argumentOptions && argumentOptions.categories || [],
uniqueArgumentFields = getUniqueArgumentFields(groupsData);
data = verifyData(data, incidentOccurred);
groupsData.argumentType = groupsData.argumentAxisType = null;
_each(groupsData.groups, processGroup);
if (groupsData.argumentAxes) {
_each(groupsData.argumentAxes, resetAxisTypes)
}
checkType(data, groupsData, options.checkTypeForAllData);
checkAxisType(groupsData, userArgumentCategories, incidentOccurred);
if (options.convertToAxisDataType) {
parsers = prepareParsers(groupsData, skipFields, incidentOccurred);
data = parse(data, parsers)
}
groupPieData(data, groupsData);
categoriesInAxisType = argumentOptions && argumentOptions.categories || [];
groupsData.argumentAxisType === DISCRETE && discreteDataProcessing(data, groupsData, categoriesInAxisType, uniqueArgumentFields);
dataByArgumentFields = sort(data, groupsData, options.sortingMethod, uniqueArgumentFields);
dataLength = data.length;
_each(skipFields, function(field, fieldValue) {
if (fieldValue === dataLength) {
incidentOccurred("W2002", [field])
}
});
return dataByArgumentFields
}
exports.validateData = validateData;
exports.DEBUG_validateData_sort = sort
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/viz/components/parse_utils.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
isDefined = commonUtils.isDefined,
parsers = {
string: function(val) {
return isDefined(val) ? "" + val : val
},
numeric: function(val) {
if (!isDefined(val)) {
return val
}
var parsedVal = Number(val);
if (isNaN(parsedVal)) {
parsedVal = void 0
}
return parsedVal
},
datetime: function(val) {
if (!isDefined(val)) {
return val
}
var parsedVal, numVal = Number(val);
if (!isNaN(numVal)) {
parsedVal = new Date(numVal)
} else {
parsedVal = new Date(val)
}
if (isNaN(Number(parsedVal))) {
parsedVal = void 0
}
return parsedVal
}
};
function correctValueType(type) {
return "numeric" === type || "datetime" === type || "string" === type ? type : ""
}
module.exports = {
correctValueType: correctValueType,
getParser: function(valueType) {
return parsers[correctValueType(valueType)] || $.noop
}
};
module.exports.parsers = parsers
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/viz/gauges/base_indicators.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
_isFinite = isFinite,
_Number = Number,
_round = Math.round,
baseGaugeModule = __webpack_require__( /*! ./base_gauge */ 128),
_formatValue = baseGaugeModule.formatValue,
_getSampleText = baseGaugeModule.getSampleText,
_patchFontOptions = __webpack_require__( /*! ../core/utils */ 6).patchFontOptions,
Class = __webpack_require__( /*! ../../core/class */ 5);
var BaseElement = Class.inherit({
ctor: function(parameters) {
var that = this;
$.each(parameters, function(name, value) {
that["_" + name] = value
});
that._init()
},
dispose: function() {
var that = this;
that._dispose();
$.each(that, function(name) {
that[name] = null
});
return that
},
getOffset: function() {
return _Number(this._options.offset) || 0
}
});
var BaseIndicator = BaseElement.inherit({
_init: function() {
var that = this;
that._rootElement = that._createRoot().linkOn(that._owner, {
name: "value-indicator",
after: "core"
});
that._trackerElement = that._createTracker()
},
_dispose: function() {
this._rootElement.linkOff()
},
_setupAnimation: function() {
var that = this;
if (that._options.animation) {
that._animation = {
step: function(pos) {
that._actualValue = that._animation.start + that._animation.delta * pos;
that._actualPosition = that._translator.translate(that._actualValue);
that._move()
},
duration: that._options.animation.duration > 0 ? _Number(that._options.animation.duration) : 0,
easing: that._options.animation.easing
}
}
},
_runAnimation: function(value) {
var that = this,
animation = that._animation;
animation.start = that._actualValue;
animation.delta = value - that._actualValue;
that._rootElement.animate({
_: 0
}, {
step: animation.step,
duration: animation.duration,
easing: animation.easing
})
},
_createRoot: function() {
return this._renderer.g().attr({
"class": this._className
})
},
_createTracker: function() {
return this._renderer.path([], "area")
},
_getTrackerSettings: $.noop,
clean: function() {
var that = this;
that._animation && that._rootElement.stopAnimation();
that._rootElement.linkRemove().clear();
that._clear();
that._tracker.detach(that._trackerElement);
that._options = that.enabled = that._animation = null;
return that
},
render: function(options) {
var that = this;
that.type = options.type;
that._options = options;
that._actualValue = that._currentValue = that._translator.adjust(that._options.currentValue);
that.enabled = that._isEnabled();
if (that.enabled) {
that._setupAnimation();
that._rootElement.attr({
fill: that._options.color
}).linkAppend();
that._tracker.attach(that._trackerElement, that, that._trackerInfo)
}
return that
},
resize: function(layout) {
var that = this;
that._rootElement.clear();
that._clear();
that.visible = that._isVisible(layout);
if (that.visible) {
$.extend(that._options, layout);
that._actualPosition = that._translator.translate(that._actualValue);
that._render();
that._trackerElement.attr(that._getTrackerSettings());
that._move()
}
return that
},
value: function(arg, _noAnimation) {
var val, that = this;
if (void 0 !== arg) {
val = that._translator.adjust(arg);
if (that._currentValue !== val && _isFinite(val)) {
that._currentValue = val;
if (that.visible) {
if (that._animation && !_noAnimation) {
that._runAnimation(val)
} else {
that._actualValue = val;
that._actualPosition = that._translator.translate(val);
that._move()
}
}
}
return that
}
return that._currentValue
},
_isEnabled: null,
_isVisible: null,
_render: null,
_clear: null,
_move: null
});
var COEFFICIENTS_MAP = {};
COEFFICIENTS_MAP["right-bottom"] = COEFFICIENTS_MAP.rb = [0, -1, -1, 0, 0, 1, 1, 0];
COEFFICIENTS_MAP["bottom-right"] = COEFFICIENTS_MAP.br = [-1, 0, 0, -1, 1, 0, 0, 1];
COEFFICIENTS_MAP["left-bottom"] = COEFFICIENTS_MAP.lb = [0, -1, 1, 0, 0, 1, -1, 0];
COEFFICIENTS_MAP["bottom-left"] = COEFFICIENTS_MAP.bl = [1, 0, 0, -1, -1, 0, 0, 1];
COEFFICIENTS_MAP["left-top"] = COEFFICIENTS_MAP.lt = [0, 1, 1, 0, 0, -1, -1, 0];
COEFFICIENTS_MAP["top-left"] = COEFFICIENTS_MAP.tl = [1, 0, 0, 1, -1, 0, 0, -1];
COEFFICIENTS_MAP["right-top"] = COEFFICIENTS_MAP.rt = [0, 1, -1, 0, 0, -1, 1, 0];
COEFFICIENTS_MAP["top-right"] = COEFFICIENTS_MAP.tr = [-1, 0, 0, 1, 1, 0, 0, -1];
function getTextCloudInfo(options) {
var tailWidth, tailHeight, x = options.x,
y = options.y,
type = COEFFICIENTS_MAP[options.type],
cloudWidth = options.textWidth + 2 * options.horMargin,
cloudHeight = options.textHeight + 2 * options.verMargin,
cx = x,
cy = y;
tailWidth = tailHeight = options.tailLength;
if (1 & type[0]) {
tailHeight = Math.min(tailHeight, cloudHeight / 3)
} else {
tailWidth = Math.min(tailWidth, cloudWidth / 3)
}
return {
cx: _round(cx + type[0] * tailWidth + (type[0] + type[2]) * cloudWidth / 2),
cy: _round(cy + type[1] * tailHeight + (type[1] + type[3]) * cloudHeight / 2),
points: [_round(x), _round(y), _round(x += type[0] * (cloudWidth + tailWidth)), _round(y += type[1] * (cloudHeight + tailHeight)), _round(x += type[2] * cloudWidth), _round(y += type[3] * cloudHeight), _round(x += type[4] * cloudWidth), _round(y += type[5] * cloudHeight), _round(x += type[6] * (cloudWidth - tailWidth)), _round(y += type[7] * (cloudHeight - tailHeight))]
}
}
var BaseTextCloudMarker = BaseIndicator.inherit({
_move: function() {
var bbox, info, that = this,
textCloudOptions = that._getTextCloudOptions(),
text = _formatValue(that._actualValue, that._options.text);
that._text.attr({
text: text
});
bbox = that._text.getBBox();
info = getTextCloudInfo({
x: textCloudOptions.x,
y: textCloudOptions.y,
textWidth: bbox.width || text.length * that._textUnitWidth,
textHeight: bbox.height || that._textHeight,
horMargin: that._options.horizontalOffset,
verMargin: that._options.verticalOffset,
tailLength: that._options.arrowLength,
type: textCloudOptions.type
});
that._text.attr({
x: info.cx,
y: info.cy + that._textVerticalOffset
});
that._cloud.attr({
points: info.points
});
that._trackerElement && that._trackerElement.attr({
points: info.points
})
},
_measureText: function() {
var root, text, bbox, sampleText, that = this;
if (!that._textVerticalOffset) {
root = that._createRoot().append(that._owner);
sampleText = _getSampleText(that._translator, that._options.text);
text = that._renderer.text(sampleText, 0, 0).attr({
align: "center"
}).css(_patchFontOptions(that._options.text.font)).append(root);
bbox = text.getBBox();
root.remove();
that._textVerticalOffset = -bbox.y - bbox.height / 2;
that._textWidth = bbox.width;
that._textHeight = bbox.height;
that._textUnitWidth = that._textWidth / sampleText.length;
that._textFullWidth = that._textWidth + 2 * that._options.horizontalOffset;
that._textFullHeight = that._textHeight + 2 * that._options.verticalOffset
}
},
_render: function() {
var that = this;
that._measureText();
that._cloud = that._cloud || that._renderer.path([], "area").append(that._rootElement);
that._text = that._text || that._renderer.text().append(that._rootElement);
that._text.attr({
align: "center"
}).css(_patchFontOptions(that._options.text.font))
},
_clear: function() {
delete this._cloud;
delete this._text
},
getTooltipParameters: function() {
var position = this._getTextCloudOptions();
return {
x: position.x,
y: position.y,
value: this._currentValue,
color: this._options.color
}
}
});
var BaseRangeBar = BaseIndicator.inherit({
_measureText: function() {
var root, text, bbox, that = this;
that._hasText = that._isTextVisible();
if (that._hasText && !that._textVerticalOffset) {
root = that._createRoot().append(that._owner);
text = that._renderer.text(_getSampleText(that._translator, that._options.text), 0, 0).attr({
"class": "dxg-text",
align: "center"
}).css(_patchFontOptions(that._options.text.font)).append(root);
bbox = text.getBBox();
root.remove();
that._textVerticalOffset = -bbox.y - bbox.height / 2;
that._textWidth = bbox.width;
that._textHeight = bbox.height
}
},
_move: function() {
var that = this;
that._updateBarItemsPositions();
if (that._hasText) {
that._text.attr({
text: _formatValue(that._actualValue, that._options.text)
});
that._updateTextPosition();
that._updateLinePosition()
}
},
_updateBarItems: function() {
var backgroundColor, spaceColor, that = this,
options = that._options,
translator = that._translator;
that._setBarSides();
that._startPosition = translator.translate(translator.getDomainStart());
that._endPosition = translator.translate(translator.getDomainEnd());
that._basePosition = translator.translate(options.baseValue);
that._space = that._getSpace();
backgroundColor = options.backgroundColor || "none";
if ("none" !== backgroundColor && that._space > 0) {
spaceColor = options.containerBackgroundColor || "none"
} else {
that._space = 0;
spaceColor = "none"
}
that._backItem1.attr({
fill: backgroundColor
});
that._backItem2.attr({
fill: backgroundColor
});
that._spaceItem1.attr({
fill: spaceColor
});
that._spaceItem2.attr({
fill: spaceColor
})
},
_getSpace: function() {
return 0
},
_updateTextItems: function() {
var that = this;
if (that._hasText) {
that._line = that._line || that._renderer.path([], "line").attr({
"class": "dxg-main-bar",
"stroke-linecap": "square"
}).append(that._rootElement);
that._text = that._text || that._renderer.text("", 0, 0).attr({
"class": "dxg-text"
}).append(that._rootElement);
that._text.attr({
align: that._getTextAlign()
}).css(that._getFontOptions());
that._setTextItemsSides()
} else {
if (that._line) {
that._line.remove();
delete that._line
}
if (that._text) {
that._text.remove();
delete that._text
}
}
},
_isTextVisible: function() {
return false
},
_getTextAlign: function() {
return "center"
},
_getFontOptions: function() {
var options = this._options,
font = options.text.font;
if (!font || !font.color) {
font = $.extend({}, font, {
color: options.color
})
}
return _patchFontOptions(font)
},
_updateBarItemsPositions: function() {
var that = this,
positions = that._getPositions();
that._backItem1.attr(that._buildItemSettings(positions.start, positions.back1));
that._backItem2.attr(that._buildItemSettings(positions.back2, positions.end));
that._spaceItem1.attr(that._buildItemSettings(positions.back1, positions.main1));
that._spaceItem2.attr(that._buildItemSettings(positions.main2, positions.back2));
that._mainItem.attr(that._buildItemSettings(positions.main1, positions.main2));
that._trackerElement && that._trackerElement.attr(that._buildItemSettings(positions.main1, positions.main2))
},
_render: function() {
var that = this;
that._measureText();
if (!that._backItem1) {
that._backItem1 = that._createBarItem();
that._backItem1.attr({
"class": "dxg-back-bar"
})
}
if (!that._backItem2) {
that._backItem2 = that._createBarItem();
that._backItem2.attr({
"class": "dxg-back-bar"
})
}
if (!that._spaceItem1) {
that._spaceItem1 = that._createBarItem();
that._spaceItem1.attr({
"class": "dxg-space-bar"
})
}
if (!that._spaceItem2) {
that._spaceItem2 = that._createBarItem();
that._spaceItem2.attr({
"class": "dxg-space-bar"
})
}
if (!that._mainItem) {
that._mainItem = that._createBarItem();
that._mainItem.attr({
"class": "dxg-main-bar"
})
}
that._updateBarItems();
that._updateTextItems()
},
_clear: function() {
var that = this;
delete that._backItem1;
delete that._backItem2;
delete that._spaceItem1;
delete that._spaceItem2;
delete that._mainItem;
delete that._hasText;
delete that._line;
delete that._text
},
getTooltipParameters: function() {
var position = this._getTooltipPosition();
return {
x: position.x,
y: position.y,
value: this._currentValue,
color: this._options.color,
offset: 0
}
}
});
exports.BaseElement = BaseElement;
exports.BaseIndicator = BaseIndicator;
exports.BaseTextCloudMarker = BaseTextCloudMarker;
exports.BaseRangeBar = BaseRangeBar;
exports.getTextCloudInfo = getTextCloudInfo
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*******************************************!*\
!*** ./Scripts/viz/series/base_series.js ***!
\*******************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
seriesNS = {},
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
pointModule = __webpack_require__( /*! ./points/base_point */ 544),
_isDefined = commonUtils.isDefined,
vizUtils = __webpack_require__( /*! ../core/utils */ 6),
_map = vizUtils.map,
_each = $.each,
_extend = $.extend,
_isEmptyObject = $.isEmptyObject,
_normalizeEnum = vizUtils.normalizeEnum,
_Event = $.Event,
_noop = $.noop,
_inArray = $.inArray,
states = __webpack_require__( /*! ../components/consts */ 126).states,
scatterSeries = __webpack_require__( /*! ./scatter_series */ 88),
lineSeries = __webpack_require__( /*! ./line_series */ 193),
areaSeries = __webpack_require__( /*! ./area_series */ 166),
barSeries = __webpack_require__( /*! ./bar_series */ 129),
rangeSeries = __webpack_require__( /*! ./range_series */ 549),
bubbleSeries = __webpack_require__( /*! ./bubble_series */ 541),
pieSeries = __webpack_require__( /*! ./pie_series */ 543),
financialSeries = __webpack_require__( /*! ./financial_series */ 542),
stackedSeries = __webpack_require__( /*! ./stacked_series */ 550),
DISCRETE = "discrete",
SELECTED_STATE = states.selectedMark,
HOVER_STATE = states.hoverMark,
HOVER = states.hover,
NORMAL = states.normal,
SELECTION = states.selection,
APPLY_SELECTED = states.applySelected,
APPLY_HOVER = states.applyHover,
RESET_ITEM = states.resetItem,
NONE_MODE = "none",
INCLUDE_POINTS = "includepoints",
EXLUDE_POINTS = "excludepoints",
NEAREST_POINT = "nearestpoint",
getEmptyBusinessRange = function() {
return {
arg: {},
val: {}
}
};
function triggerEvent(element, event, point) {
element && element.trigger(event, point)
}
seriesNS.mixins = {
chart: {},
pie: {},
polar: {}
};
seriesNS.mixins.chart.scatter = scatterSeries.chart;
seriesNS.mixins.polar.scatter = scatterSeries.polar;
$.extend(seriesNS.mixins.pie, pieSeries);
$.extend(seriesNS.mixins.chart, lineSeries.chart, areaSeries.chart, barSeries.chart, rangeSeries.chart, bubbleSeries.chart, financialSeries, stackedSeries.chart);
$.extend(seriesNS.mixins.polar, lineSeries.polar, areaSeries.polar, barSeries.polar, rangeSeries.polar, bubbleSeries.polar, stackedSeries.polar);
function includePointsMode(mode) {
return mode === INCLUDE_POINTS || "allseriespoints" === mode
}
function getLabelOptions(labelOptions, defaultColor) {
var opt = labelOptions || {},
labelFont = _extend({}, opt.font) || {},
labelBorder = opt.border || {},
labelConnector = opt.connector || {},
backgroundAttr = {
fill: opt.backgroundColor || defaultColor,
"stroke-width": labelBorder.visible ? labelBorder.width || 0 : 0,
stroke: labelBorder.visible && labelBorder.width ? labelBorder.color : "none",
dashStyle: labelBorder.dashStyle
},
connectorAttr = {
stroke: labelConnector.visible && labelConnector.width ? labelConnector.color || defaultColor : "none",
"stroke-width": labelConnector.visible ? labelConnector.width || 0 : 0
};
labelFont.color = "none" === opt.backgroundColor && "#ffffff" === _normalizeEnum(labelFont.color) && "inside" !== opt.position ? defaultColor : labelFont.color;
return {
alignment: opt.alignment,
format: opt.format,
argumentFormat: opt.argumentFormat,
precision: opt.precision,
argumentPrecision: opt.argumentPrecision,
percentPrecision: opt.percentPrecision,
customizeText: $.isFunction(opt.customizeText) ? opt.customizeText : void 0,
attributes: {
font: labelFont
},
visible: 0 !== labelFont.size ? opt.visible : false,
showForZeroValues: opt.showForZeroValues,
horizontalOffset: opt.horizontalOffset,
verticalOffset: opt.verticalOffset,
radialOffset: opt.radialOffset,
background: backgroundAttr,
position: opt.position,
connector: connectorAttr,
rotationAngle: opt.rotationAngle
}
}
function applyPointStyle(point, styleName) {
!point.isSelected() && !point.hasSelectedView && point.applyStyle(styleName)
}
function Series(renderSettings, options) {
var that = this;
that.fullState = 0;
that._extGroups = renderSettings;
that._renderer = renderSettings.renderer;
that._group = renderSettings.renderer.g().attr({
"class": "dxc-series"
});
that.updateOptions(options)
}
exports.Series = Series;
exports.mixins = seriesNS.mixins;
Series.prototype = {
constructor: Series,
_createLegendState: _noop,
getLegendStyles: function() {
return this._styles.legendStyles
},
_createStyles: function(options) {
var that = this,
mainSeriesColor = options.mainSeriesColor,
specialMainColor = that._getSpecialColor(mainSeriesColor);
that._styles = {
normal: that._parseStyle(options, mainSeriesColor, mainSeriesColor),
hover: that._parseStyle(options.hoverStyle || {}, specialMainColor, mainSeriesColor),
selection: that._parseStyle(options.selectionStyle || {}, specialMainColor, mainSeriesColor),
legendStyles: {
normal: that._createLegendState(options, mainSeriesColor),
hover: that._createLegendState(options.hoverStyle || {}, specialMainColor),
selection: that._createLegendState(options.selectionStyle || {}, specialMainColor)
}
}
},
setClippingParams: function(baseId, wideId, forceClipping) {
this._paneClipRectID = baseId;
this._widePaneClipRectID = wideId;
this._forceClipping = forceClipping
},
applyClip: function() {
this._group.attr({
clipId: this._paneClipRectID
})
},
resetClip: function() {
this._group.attr({
clipId: null
})
},
getTagField: function() {
return this._options.tagField || "tag"
},
getValueFields: _noop,
getSizeField: _noop,
getArgumentField: _noop,
getPoints: function() {
return this._points
},
_createPoint: function(data, pointsArray, index) {
data.index = index;
var options, arg, pba, that = this,
point = pointsArray[index],
pointsByArgument = that.pointsByArgument;
if (that._checkData(data)) {
options = that._customizePoint(data) || that._getCreatingPointOptions(data);
if (point) {
point.update(data, options)
} else {
point = new pointModule.Point(that, data, options);
pointsArray.push(point)
}
arg = point.argument.valueOf();
pba = pointsByArgument[arg];
if (pba) {
pba.push(point)
} else {
pointsByArgument[arg] = [point]
}
return true
}
},
getRangeData: function(zoomArgs, calcIntervalFunction) {
return this._visible ? _extend(true, {}, this._getRangeData(zoomArgs, calcIntervalFunction)) : getEmptyBusinessRange()
},
_deleteGroup: function(groupName) {
var group = this[groupName];
if (group) {
group.dispose();
this[groupName] = null
}
},
_saveOldAnimationMethods: function() {
var that = this;
that._oldClearingAnimation = that._clearingAnimation;
that._oldUpdateElement = that._updateElement;
that._oldgetAffineCoordOptions = that._getAffineCoordOptions
},
_deleteOldAnimationMethods: function() {
this._oldClearingAnimation = null;
this._oldUpdateElement = null;
this._oldgetAffineCoordOptions = null
},
updateOptions: function(newOptions) {
var that = this,
widgetType = newOptions.widgetType,
oldType = that.type,
newType = newOptions.type;
that.type = newType && _normalizeEnum(newType.toString());
if (!that._checkType(widgetType) || that._checkPolarBarType(widgetType, newOptions)) {
that.dispose();
that.isUpdated = false;
return
}
if (oldType !== that.type) {
that._firstDrawing = true;
that._saveOldAnimationMethods();
that._resetType(oldType, widgetType);
that._setType(that.type, widgetType)
}
that._options = newOptions;
that._pointOptions = null;
that._deletePatterns();
that.name = newOptions.name;
that.pane = newOptions.pane;
that.axis = newOptions.axis;
that.tag = newOptions.tag;
that._createStyles(newOptions);
that._updateOptions(newOptions);
that._visible = newOptions.visible;
that.isUpdated = true;
that._createGroups()
},
_disposePoints: function(points) {
_each(points || [], function(_, p) {
p.dispose()
})
},
_correctPointsLength: function(length, points) {
this._disposePoints(this._oldPoints);
this._oldPoints = points.splice(length, points.length)
},
getErrorBarRangeCorrector: _noop,
updateDataType: function(settings) {
var that = this;
that.argumentType = settings.argumentType;
that.valueType = settings.valueType;
that.argumentAxisType = settings.argumentAxisType;
that.valueAxisType = settings.valueAxisType;
that.showZero = settings.showZero;
return that
},
getOptions: function() {
return this._options
},
_resetRangeData: function() {
this._rangeData = getEmptyBusinessRange()
},
updateData: function(data) {
var curPoint, that = this,
points = that._originalPoints || [],
lastPointIndex = 0,
options = that._options,
i = 0,
len = data.length,
lastPoint = null,
rangeCorrector = that.getErrorBarRangeCorrector();
that.pointsByArgument = {};
that._resetRangeData();
if (data && data.length) {
that._canRenderCompleteHandle = true
}
that._beginUpdateData(data);
while (i < len) {
if (that._createPoint(that._getPointData(data[i], options), points, lastPointIndex)) {
curPoint = points[lastPointIndex];
that._processRange(curPoint, lastPoint, rangeCorrector);
lastPoint = curPoint;
lastPointIndex++
}
i++
}
that._disposePoints(that._aggregatedPoints);
that._aggregatedPoints = null;
that._points = that._originalPoints = points;
that._correctPointsLength(lastPointIndex, points);
that._endUpdateData()
},
getTemplateFields: function() {
return this.getValueFields().concat(this.getTagField(), this.getSizeField()).map(function(field) {
return {
templateField: field + this.name,
originalField: field
}
}, this)
},
resamplePoints: function(argTranslator, min, max) {
var categories, discreteMin, discreteMax, count, tickInterval, that = this,
sizePoint = that._getPointSize(),
pointsLength = that.getAllPoints().length,
businessRange = argTranslator.getBusinessRange();
if (pointsLength && pointsLength > 1) {
count = argTranslator.canvasLength / sizePoint;
count = count <= 1 ? 1 : count;
if (that.argumentAxisType !== DISCRETE) {
tickInterval = (businessRange.maxVisible - businessRange.minVisible) / count;
if (that.valueAxisType === DISCRETE) {
tickInterval = Math.ceil(tickInterval)
}
} else {
categories = businessRange.categories;
discreteMin = _inArray(min, categories);
discreteMax = _inArray(max, categories);
if (-1 !== discreteMin && -1 !== discreteMax) {
categories = categories.slice(discreteMin, discreteMax + 1)
}
pointsLength = categories.length;
tickInterval = Math.ceil(pointsLength / count)
}
that._points = that._resample(tickInterval, min - tickInterval, max + tickInterval, _isDefined(min) && _isDefined(max))
}
},
_removeOldSegments: function(startIndex) {
var that = this;
_each(that._graphics.splice(startIndex, that._graphics.length) || [], function(_, elem) {
that._removeElement(elem)
});
if (that._trackers) {
_each(that._trackers.splice(startIndex, that._trackers.length) || [], function(_, elem) {
elem.remove()
})
}
},
draw: function(translators, animationEnabled, hideLayoutLabels, legendCallback) {
var drawComplete, that = this;
if (that._oldClearingAnimation && animationEnabled && that._firstDrawing) {
drawComplete = function() {
that._draw(translators, true, hideLayoutLabels)
};
that._oldClearingAnimation(translators, drawComplete)
} else {
that._draw(translators, animationEnabled, hideLayoutLabels, legendCallback)
}
},
_draw: function(translators, animationEnabled, hideLayoutLabels, legendCallback) {
var groupForPoint, that = this,
points = that._points || [],
segment = [],
segmentCount = 0,
firstDrawing = that._firstDrawing,
closeSegment = points[0] && points[0].hasValue() && that._options.closed;
that._graphics = that._graphics || [];
that._prepareSeriesToDrawing();
if (!that._visible) {
animationEnabled = false;
that._group.remove();
return
}
that._appendInGroup();
that.translators = translators;
that._applyVisibleArea();
that._setGroupsSettings(animationEnabled, firstDrawing);
that._segments = [];
that._drawnPoints = [];
that._firstDrawing = points.length ? false : true;
groupForPoint = {
markers: that._markersGroup,
errorBars: that._errorBarGroup
};
_each(points, function(i, p) {
p.translate(translators);
if (p.hasValue()) {
that._drawPoint({
point: p,
groups: groupForPoint,
hasAnimation: animationEnabled,
firstDrawing: firstDrawing,
legendCallback: legendCallback
});
segment.push(p)
} else {
if (segment.length) {
that._drawSegment(segment, animationEnabled, segmentCount++);
segment = []
}
}
});
segment.length && that._drawSegment(segment, animationEnabled, segmentCount++, closeSegment);
that._removeOldSegments(segmentCount);
that._defaultSegments = that._generateDefaultSegments();
hideLayoutLabels && that.hideLabels();
animationEnabled && that._animate(firstDrawing);
if (that.isSelected()) {
that._changeStyle(legendCallback, APPLY_SELECTED)
} else {
if (that.isHovered()) {
that._changeStyle(legendCallback, APPLY_HOVER)
}
}
},
_setLabelGroupSettings: function(animationEnabled) {
var settings = {
"class": "dxc-labels"
};
this._applyElementsClipRect(settings);
this._applyClearingSettings(settings);
animationEnabled && (settings.opacity = .001);
this._labelsGroup.attr(settings).append(this._extGroups.labelsGroup)
},
_checkType: function(widgetType) {
return !!seriesNS.mixins[widgetType][this.type]
},
_checkPolarBarType: function(widgetType, options) {
return "polar" === widgetType && options.spiderWidget && -1 !== this.type.indexOf("bar")
},
_resetType: function(seriesType, widgetType) {
var methodName, methods;
if (seriesType) {
methods = seriesNS.mixins[widgetType][seriesType];
for (methodName in methods) {
delete this[methodName]
}
}
},
_setType: function(seriesType, widgetType) {
var methodName, methods = seriesNS.mixins[widgetType][seriesType];
for (methodName in methods) {
this[methodName] = methods[methodName]
}
},
setSelectedState: function(state, mode, legendCallback) {
var that = this;
that.lastSelectionMode = _normalizeEnum(mode || that._options.selectionMode);
if (state && !that.isSelected()) {
that.fullState = that.fullState | SELECTED_STATE;
that._nearestPoint && applyPointStyle(that._nearestPoint, NORMAL);
that._nearestPoint = null;
that._changeStyle(legendCallback, APPLY_SELECTED)
} else {
if (!state && that.isSelected()) {
that.fullState = that.fullState & ~SELECTED_STATE;
if (that.isHovered()) {
that._changeStyle(legendCallback, APPLY_HOVER, SELECTION)
} else {
that._changeStyle(legendCallback, RESET_ITEM)
}
}
}
},
setHoverState: function(state, mode, legendCallback) {
var that = this;
that.lastHoverMode = _normalizeEnum(mode || that._options.hoverMode);
if (state && !that.isHovered()) {
that.fullState = that.fullState | HOVER_STATE;
!that.isSelected() && that._changeStyle(legendCallback, APPLY_HOVER)
} else {
if (!state && that.isHovered()) {
that._nearestPoint = null;
that.fullState = that.fullState & ~HOVER_STATE;
!that.isSelected() && that._changeStyle(legendCallback, RESET_ITEM)
}
}
},
setHoverView: function() {
if (this._canChangeView()) {
this._applyStyle(this._styles.hover);
return this
}
return null
},
releaseHoverView: function(legendCallback) {
this._canChangeView() && this._applyStyle(this._styles.normal)
},
isFullStackedSeries: function() {
return 0 === this.type.indexOf("fullstacked")
},
isStackedSeries: function() {
return 0 === this.type.indexOf("stacked")
},
isFinancialSeries: function() {
return "stock" === this.type || "candlestick" === this.type
},
_canChangeView: function() {
return !this.isSelected() && _normalizeEnum(this._options.hoverMode) !== NONE_MODE
},
_changeStyle: function(legendCallBack, legendAction, prevStyle) {
var pointStyle, that = this,
style = that._calcStyle(prevStyle);
if (style.mode === NONE_MODE) {
return
}
legendCallBack(legendAction);
if (includePointsMode(style.mode)) {
pointStyle = style.pointStyle;
_each(that._points || [], function(_, p) {
applyPointStyle(p, pointStyle)
})
}
that._applyStyle(style.series)
},
_calcStyle: function(prevStyle) {
var result, that = this,
styles = that._styles,
pointNormalState = false;
switch (that.fullState) {
case 0:
result = {
pointStyle: NORMAL,
mode: INCLUDE_POINTS,
series: styles.normal
};
break;
case 1:
pointNormalState = prevStyle && that.lastHoverMode === EXLUDE_POINTS || that.lastHoverMode === NEAREST_POINT && includePointsMode(that.lastSelectionMode);
result = {
pointStyle: pointNormalState ? NORMAL : HOVER,
mode: pointNormalState ? INCLUDE_POINTS : that.lastHoverMode,
series: styles.hover
};
break;
case 2:
result = {
pointStyle: SELECTION,
mode: that.lastSelectionMode,
series: styles.selection
};
break;
case 3:
pointNormalState = that.lastSelectionMode === EXLUDE_POINTS && includePointsMode(that.lastHoverMode);
result = {
pointStyle: pointNormalState ? NORMAL : SELECTION,
mode: pointNormalState ? INCLUDE_POINTS : that.lastSelectionMode,
series: styles.selection
}
}
return result
},
updateHover: function(x, y) {
var that = this,
currentNearestPoint = that._nearestPoint,
point = that.isHovered() && that.lastHoverMode === NEAREST_POINT && that.getNeighborPoint(x, y);
if (point !== currentNearestPoint && !that.isSelected()) {
currentNearestPoint && applyPointStyle(currentNearestPoint, NORMAL);
if (point) {
applyPointStyle(point, HOVER);
that._nearestPoint = point
}
}
},
_getMainAxisName: function() {
return this._options.rotated ? "X" : "Y"
},
areLabelsVisible: function() {
return !_isDefined(this._options.maxLabelCount) || this._points.length <= this._options.maxLabelCount
},
getLabelVisibility: function() {
return this.areLabelsVisible() && this._options.label && this._options.label.visible
},
_customizePoint: function(pointData) {
var customizeObject, pointOptions, customLabelOptions, customOptions, useLabelCustomOptions, usePointCustomOptions, that = this,
options = that._options,
customizePoint = options.customizePoint,
customizeLabel = options.customizeLabel;
if (customizeLabel && customizeLabel.call) {
customizeObject = _extend({
seriesName: that.name
}, pointData);
customizeObject.series = that;
customLabelOptions = customizeLabel.call(customizeObject, customizeObject);
useLabelCustomOptions = customLabelOptions && !_isEmptyObject(customLabelOptions);
customLabelOptions = useLabelCustomOptions ? _extend(true, {}, options.label, customLabelOptions) : null
}
if (customizePoint && customizePoint.call) {
customizeObject = customizeObject || _extend({
seriesName: that.name
}, pointData);
customizeObject.series = that;
customOptions = customizePoint.call(customizeObject, customizeObject);
usePointCustomOptions = customOptions && !_isEmptyObject(customOptions)
}
if (useLabelCustomOptions || usePointCustomOptions) {
pointOptions = that._parsePointOptions(that._preparePointOptions(customOptions), customLabelOptions || options.label, pointData);
pointOptions.styles.useLabelCustomOptions = useLabelCustomOptions;
pointOptions.styles.usePointCustomOptions = usePointCustomOptions
}
return pointOptions
},
show: function() {
if (!this._visible) {
this._changeVisibility(true)
}
},
hide: function() {
if (this._visible) {
this._changeVisibility(false)
}
},
_changeVisibility: function(visibility) {
var that = this;
that._visible = that._options.visible = visibility;
that._updatePointsVisibility();
that.hidePointTooltip();
that._options.visibilityChanged()
},
_updatePointsVisibility: _noop,
hideLabels: function() {
_each(this._points, function(_, point) {
point._label.hide()
})
},
_parsePointOptions: function(pointOptions, labelOptions, data) {
var that = this,
options = that._options,
styles = that._createPointStyles(pointOptions, data),
parsedOptions = _extend(true, {}, pointOptions, {
type: options.type,
tag: that.tag,
rotated: options.rotated,
styles: styles,
widgetType: options.widgetType,
visibilityChanged: options.visibilityChanged
});
parsedOptions.label = getLabelOptions(labelOptions, styles.normal.fill);
if (that.areErrorBarsVisible()) {
parsedOptions.errorBars = options.valueErrorBar
}
return parsedOptions
},
_preparePointOptions: function(customOptions) {
var point = this._getOptionsForPoint();
return customOptions ? _extend(true, {}, point, customOptions) : point
},
_getMarkerGroupOptions: function() {
return _extend(false, {}, this._getOptionsForPoint(), {
hoverStyle: {},
selectionStyle: {}
})
},
_resample: function(ticksInterval, min, max, isDefinedMinMax) {
var pointData, minTick, that = this,
fusPoints = [],
nowIndexTicks = 0,
lastPointIndex = 0,
state = 0,
originalPoints = that.getAllPoints();
function addFirstFusPoint(point) {
fusPoints.push(point);
minTick = point.argument;
if (isDefinedMinMax) {
if (point.argument < min) {
state = 1
} else {
if (point.argument > max) {
state = 2
} else {
state = 0
}
}
}
}
if (that.argumentAxisType === DISCRETE || that.valueAxisType === DISCRETE) {
return _map(originalPoints, function(point, index) {
if (index % ticksInterval === 0) {
return point
}
point.setInvisibility();
return null
})
}
that._aggregatedPoints = that._aggregatedPoints || [];
_each(originalPoints, function(_, point) {
point.setInvisibility();
if (!fusPoints.length) {
addFirstFusPoint(point)
} else {
if (!state && Math.abs(minTick - point.argument) < ticksInterval) {
fusPoints.push(point)
} else {
if (!(1 === state && point.argument < min) && !(2 === state && point.argument > max)) {
pointData = that._fusionPoints(fusPoints, minTick, nowIndexTicks);
nowIndexTicks++;
if (that._createPoint(pointData, that._aggregatedPoints, lastPointIndex)) {
lastPointIndex++
}
fusPoints = [];
addFirstFusPoint(point)
}
}
}
});
if (fusPoints.length) {
pointData = that._fusionPoints(fusPoints, minTick, nowIndexTicks);
if (that._createPoint(pointData, that._aggregatedPoints, lastPointIndex)) {
lastPointIndex++
}
}
that._correctPointsLength(lastPointIndex, that._aggregatedPoints);
that._endUpdateData();
return that._aggregatedPoints
},
canRenderCompleteHandle: function() {
var result = this._canRenderCompleteHandle;
delete this._canRenderCompleteHandle;
return !!result
},
isHovered: function() {
return !!(1 & this.fullState)
},
isSelected: function() {
return !!(2 & this.fullState)
},
isVisible: function() {
return this._visible
},
getAllPoints: function() {
return (this._originalPoints || []).slice()
},
getPointByPos: function(pos) {
return (this._points || [])[pos]
},
getVisiblePoints: function() {
return (this._drawnPoints || []).slice()
},
setPointHoverState: function(data) {
var point = data.point;
if (data.setState) {
point.fullState |= HOVER_STATE
}
if (!(this.isSelected() && includePointsMode(this.lastSelectionMode)) && !point.isSelected() && !point.hasSelectedView) {
point.applyStyle(HOVER)
}
},
releasePointHoverState: function(data) {
var that = this,
point = data.point;
if (data.setState) {
point.fullState &= ~HOVER_STATE
}
if (!(that.isSelected() && includePointsMode(that.lastSelectionMode)) && !point.isSelected() && !point.hasSelectedView) {
if (!(that.isHovered() && includePointsMode(that.lastHoverMode)) || that.isSelected() && that.lastSelectionMode === EXLUDE_POINTS) {
point.applyStyle(NORMAL)
}
}
point.releaseHoverState()
},
setPointSelectedState: function(data) {
var point = data.point;
if (data.setState) {
point.fullState |= SELECTED_STATE
} else {
point.hasSelectedView = true
}
point.applyStyle(SELECTION)
},
releasePointSelectedState: function(data) {
var pointStyle, that = this,
point = data.point;
if (data.setState) {
point.fullState &= ~SELECTED_STATE
} else {
point.hasSelectedView = false
}
if (that.isHovered() && includePointsMode(that.lastHoverMode) || point.isHovered()) {
pointStyle = HOVER
} else {
if (that.isSelected() && includePointsMode(that.lastSelectionMode)) {
pointStyle = SELECTION
} else {
pointStyle = NORMAL
}
}
point.applyStyle(pointStyle)
},
selectPoint: function(point) {
triggerEvent(this._extGroups.seriesGroup, new _Event("selectpoint"), point)
},
deselectPoint: function(point) {
triggerEvent(this._extGroups.seriesGroup, new _Event("deselectpoint"), point)
},
showPointTooltip: function(point) {
triggerEvent(this._extGroups.seriesGroup, new _Event("showpointtooltip"), point)
},
hidePointTooltip: function(point) {
triggerEvent(this._extGroups.seriesGroup, new _Event("hidepointtooltip"), point)
},
select: function() {
var that = this;
triggerEvent(that._extGroups.seriesGroup, new _Event("selectseries", {
target: that
}), that._options.selectionMode);
that._group.toForeground()
},
clearSelection: function() {
var that = this;
triggerEvent(that._extGroups.seriesGroup, new _Event("deselectseries", {
target: that
}), that._options.selectionMode)
},
getPointsByArg: function(arg) {
return this.pointsByArgument[arg.valueOf()] || []
},
_deletePoints: function() {
var that = this;
that._disposePoints(that._originalPoints);
that._disposePoints(that._aggregatedPoints);
that._disposePoints(that._oldPoints);
that._points = that._oldPoints = that._aggregatedPoints = that._originalPoints = that._drawnPoints = null
},
_deletePatterns: function() {
_each(this._patterns || [], function(_, pattern) {
pattern && pattern.dispose()
});
this._patterns = []
},
_deleteTrackers: function() {
var that = this;
_each(that._trackers || [], function(_, tracker) {
tracker.remove()
});
that._trackersGroup && that._trackersGroup.dispose();
that._trackers = that._trackersGroup = null
},
dispose: function() {
var that = this;
that._deletePoints();
that._group.dispose();
that._labelsGroup && that._labelsGroup.dispose();
that._errorBarGroup && that._errorBarGroup.dispose();
that._deletePatterns();
that._deleteTrackers();
that._group = that._extGroups = that._markersGroup = that._elementsGroup = that._bordersGroup = that._labelsGroup = that._errorBarGroup = that._graphics = that._rangeData = that._renderer = that.translators = that._styles = that._options = that._pointOptions = that._drawnPoints = that._aggregatedPoints = that.pointsByArgument = that._segments = that._prevSeries = that._patterns = null
},
correctPosition: _noop,
drawTrackers: _noop,
getNeighborPoint: _noop,
areErrorBarsVisible: _noop,
getColor: function() {
return this.getLegendStyles().normal.fill
},
getOpacity: function() {
return this._options.opacity
},
getStackName: function() {
return "stackedbar" === this.type || "fullstackedbar" === this.type ? this._stackName : null
},
getPointByCoord: function(x, y) {
var point = this.getNeighborPoint(x, y);
return point && point.coordsIn(x, y) ? point : null
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*******************************************************!*\
!*** ./Scripts/viz/translators/numeric_translator.js ***!
\*******************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
isDefined = commonUtils.isDefined,
round = Math.round;
module.exports = {
translate: function(bp) {
var that = this,
canvasOptions = that._canvasOptions,
doubleError = canvasOptions.rangeDoubleError,
specialValue = that.translateSpecialCase(bp);
if (isDefined(specialValue)) {
return specialValue
}
if (isNaN(bp) || bp.valueOf() + doubleError < canvasOptions.rangeMin || bp.valueOf() - doubleError > canvasOptions.rangeMax) {
return null
}
return that._conversionValue(that._calculateProjection((bp - canvasOptions.rangeMinVisible) * canvasOptions.ratioOfCanvasRange))
},
untranslate: function(pos, _directionOffset, enableOutOfCanvas) {
var canvasOptions = this._canvasOptions,
startPoint = canvasOptions.startPoint;
if (!enableOutOfCanvas && (pos < startPoint || pos > canvasOptions.endPoint) || !isDefined(canvasOptions.rangeMin) || !isDefined(canvasOptions.rangeMax)) {
return null
}
return this._calculateUnProjection((pos - startPoint) / canvasOptions.ratioOfCanvasRange)
},
getInterval: function() {
return round(this._canvasOptions.ratioOfCanvasRange * (this._businessRange.interval || Math.abs(this._canvasOptions.rangeMax - this._canvasOptions.rangeMin)))
},
_getValue: function(val) {
return val
},
zoom: function(translate, scale) {
var that = this,
canvasOptions = that._canvasOptions,
startPoint = canvasOptions.startPoint,
endPoint = canvasOptions.endPoint,
newStart = (startPoint + translate) / scale,
newEnd = (endPoint + translate) / scale,
translatedRangeMinMax = [that.translate(that._getValue(canvasOptions.rangeMin)), that.translate(that._getValue(canvasOptions.rangeMax))],
minPoint = Math.min(translatedRangeMinMax[0], translatedRangeMinMax[1]),
maxPoint = Math.max(translatedRangeMinMax[0], translatedRangeMinMax[1]);
if (minPoint > newStart) {
newEnd -= newStart - minPoint;
newStart = minPoint
}
if (maxPoint < newEnd) {
newStart -= newEnd - maxPoint;
newEnd = maxPoint
}
if (maxPoint - minPoint < newEnd - newStart) {
newStart = minPoint;
newEnd = maxPoint
}
translate = (endPoint - startPoint) * newStart / (newEnd - newStart) - startPoint;
scale = (startPoint + translate) / newStart || 1;
return {
min: that.untranslate(newStart, void 0, true),
max: that.untranslate(newEnd, void 0, true),
translate: translate,
scale: scale
}
},
getMinScale: function(zoom) {
return zoom ? 1.1 : .9
},
getScale: function(val1, val2) {
var canvasOptions = this._canvasOptions;
val1 = isDefined(val1) ? val1 : canvasOptions.rangeMin;
val2 = isDefined(val2) ? val2 : canvasOptions.rangeMax;
return (canvasOptions.rangeMax - canvasOptions.rangeMin) / Math.abs(val1 - val2)
},
isValid: function(value) {
var co = this._canvasOptions;
return null !== value && !isNaN(value) && value.valueOf() + co.rangeDoubleError >= co.rangeMin && value.valueOf() - co.rangeDoubleError <= co.rangeMax
},
parse: function(value) {
return Number(value)
},
to: function(value) {
return this._conversionValue(this._calculateProjection((value - this._canvasOptions.rangeMinVisible) * this._canvasOptions.ratioOfCanvasRange))
},
from: function(position) {
return this._calculateUnProjection((position - this._canvasOptions.startPoint) / this._canvasOptions.ratioOfCanvasRange)
},
_add: function(value, diff, coeff) {
return value + diff * coeff
},
isValueProlonged: false
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/bundles/modules/parts/data.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var DevExpress = __webpack_require__( /*! ./core */ 221);
var data = DevExpress.data = __webpack_require__( /*! ../../../bundles/modules/data */ 196);
data.odata = __webpack_require__( /*! ../../../bundles/modules/data.odata */ 266);
module.exports = data
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************************************!*\
!*** ./Scripts/ui/date_box/ui.date_box.strategy.calendar.js ***!
\**************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Calendar = __webpack_require__( /*! ../calendar */ 195),
DateBoxStrategy = __webpack_require__( /*! ./ui.date_box.strategy */ 135),
dateUtils = __webpack_require__( /*! ../../core/utils/date */ 12),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
dateLocalization = __webpack_require__( /*! ../../localization/date */ 14),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 8);
var CalendarStrategy = DateBoxStrategy.inherit({
NAME: "Calendar",
supportedKeys: function() {
return {
rightArrow: function() {
if (this.option("opened")) {
return true
}
},
leftArrow: function() {
if (this.option("opened")) {
return true
}
},
enter: $.proxy(function(e) {
if (this.dateBox.option("opened")) {
e.preventDefault();
if (this._widget.option("zoomLevel") === this._widget.option("maxZoomLevel")) {
var contouredDate = this._widget._view.option("contouredDate");
contouredDate && this.dateBoxValue(contouredDate);
this.dateBox.close();
this.dateBox._valueChangeEventHandler(e)
} else {
return true
}
}
}, this)
}
},
getDisplayFormat: function(displayFormat) {
return displayFormat || dateLocalization.getPatternByFormat("shortdate")
},
_getWidgetName: function() {
return Calendar.publicName()
},
_getWidgetOptions: function() {
return $.extend(this.dateBox.option("calendarOptions"), {
value: this.dateBoxValue() || null,
_keyboardProcessor: this._widgetKeyboardProcessor,
min: this.dateBox.dateOption("min"),
max: this.dateBox.dateOption("max"),
onValueChanged: $.proxy(this._valueChangedHandler, this),
onCellClick: $.proxy(this._cellClickHandler, this),
tabIndex: null,
maxZoomLevel: this.dateBox.option("maxZoomLevel"),
minZoomLevel: this.dateBox.option("minZoomLevel"),
onContouredChanged: $.proxy(this._refreshActiveDescendant, this),
hasFocus: function() {
return true
}
})
},
_refreshActiveDescendant: function(e) {
this.dateBox.setAria("activedescendant", e.actionValue)
},
popupConfig: function(popupConfig) {
var toolbarItems = popupConfig.toolbarItems,
buttonsLocation = this.dateBox.option("buttonsLocation");
var position = [];
if ("default" !== buttonsLocation) {
position = commonUtils.splitPair(buttonsLocation)
} else {
position = ["bottom", "center"]
}
if ("useButtons" === this.dateBox.option("applyValueMode")) {
toolbarItems.unshift({
widget: "dxButton",
toolbar: position[0],
location: "after" === position[1] ? "before" : position[1],
options: {
onClick: $.proxy(function() {
this._widget._toTodayView()
}, this),
text: messageLocalization.format("dxCalendar-todayButtonText"),
type: "today"
}
})
}
return $.extend(true, popupConfig, {
toolbarItems: toolbarItems,
position: {
collision: "flipfit flip"
}
})
},
_valueChangedHandler: function(e) {
var dateBox = this.dateBox,
value = e.value,
prevValue = e.previousValue;
var isSameDate = dateUtils.sameMonthAndYear(value, prevValue) && value.getDate() === prevValue.getDate();
if (isSameDate) {
return
}
if ("instantly" === dateBox.option("applyValueMode")) {
this.dateBoxValue(this.getValue())
}
},
_updateValue: function() {
if (!this._widget) {
return
}
this._widget.option("value", this.dateBoxValue())
},
textChangedHandler: function() {
if (this.dateBox.option("opened") && this._widget) {
this._updateValue(true)
}
},
_cellClickHandler: function() {
var dateBox = this.dateBox;
if ("instantly" === dateBox.option("applyValueMode")) {
dateBox.option("opened", false);
this.dateBoxValue(this.getValue())
}
},
dispose: function() {
this.dateBox.off("optionChanged");
this.callBase()
}
});
module.exports = CalendarStrategy
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*************************************************!*\
!*** ./Scripts/ui/editor/ui.data_expression.js ***!
\*************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
variableWrapper = __webpack_require__( /*! ../../core/utils/variable_wrapper */ 73),
dataCoreUtils = __webpack_require__( /*! ../../core/utils/data */ 16),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
FunctionTemplate = __webpack_require__( /*! ../widget/ui.template.function */ 99),
DataHelperMixin = __webpack_require__( /*! ../collection/ui.data_helper */ 118),
DataSourceModule = __webpack_require__( /*! ../../data/data_source/data_source */ 37),
ArrayStore = __webpack_require__( /*! ../../data/array_store */ 58);
var DataExpressionMixin = $.extend(DataHelperMixin, {
_dataExpressionDefaultOptions: function() {
return {
items: [],
dataSource: null,
itemTemplate: "item",
value: null,
valueExpr: "this",
displayExpr: void 0
}
},
_initDataExpressions: function() {
this._compileValueGetter();
this._compileDisplayGetter();
this._initDynamicTemplates();
this._initDataSource();
this._itemsToDataSource()
},
_itemsToDataSource: function() {
if (!this.option("dataSource")) {
this._dataSource = new DataSourceModule.DataSource({
store: new ArrayStore(this.option("items")),
pageSize: 0
})
}
},
_compileDisplayGetter: function() {
this._displayGetter = dataCoreUtils.compileGetter(this._displayGetterExpr())
},
_displayGetterExpr: function() {
return this.option("displayExpr")
},
_compileValueGetter: function() {
this._valueGetter = dataCoreUtils.compileGetter(this._valueGetterExpr())
},
_valueGetterExpr: function() {
return this.option("valueExpr") || "this"
},
_loadValue: function(value) {
var deferred = $.Deferred();
value = this._unwrappedValue(value);
if (!commonUtils.isDefined(value)) {
return deferred.reject().promise()
}
this._loadSingle(this._valueGetterExpr(), value).done($.proxy(function(item) {
this._isValueEquals(this._valueGetter(item), value) ? deferred.resolve(item) : deferred.reject()
}, this)).fail(function() {
deferred.reject()
});
return deferred.promise()
},
_getCurrentValue: function() {
return this.option("value")
},
_unwrappedValue: function(value) {
value = commonUtils.isDefined(value) ? value : this._getCurrentValue();
if (value && this._dataSource && "this" === this._valueGetterExpr()) {
var key = this._dataSource.key();
if (key && "object" === typeof value) {
value = value[key]
}
}
return variableWrapper.unwrap(value)
},
_isValueEquals: function(value1, value2) {
var isDefined = commonUtils.isDefined;
var ensureDefined = commonUtils.ensureDefined;
var unwrapObservable = variableWrapper.unwrap;
var dataSourceKey = this._dataSource && this._dataSource.key();
var result = this._compareValues(value1, value2);
if (!result && isDefined(value1) && isDefined(value2) && dataSourceKey) {
var valueKey1 = ensureDefined(unwrapObservable(value1[dataSourceKey]), value1);
var valueKey2 = ensureDefined(unwrapObservable(value2[dataSourceKey]), value2);
result = this._compareValues(valueKey1, valueKey2)
}
return result
},
_compareValues: function(value1, value2) {
return dataCoreUtils.toComparable(value1) === dataCoreUtils.toComparable(value2)
},
_initDynamicTemplates: function() {
if (this._displayGetterExpr()) {
this._dynamicTemplates.item = new FunctionTemplate($.proxy(function(data) {
return $("").text(this._displayGetter(data)).html()
}, this))
} else {
delete this._dynamicTemplates.item
}
},
_setCollectionWidgetItemTemplate: function() {
this._initDynamicTemplates();
this._setCollectionWidgetOption("itemTemplate", this._getTemplateByOption("itemTemplate"))
},
_dataExpressionOptionChanged: function(args) {
switch (args.name) {
case "items":
this._itemsToDataSource();
this._setCollectionWidgetOption("items");
break;
case "dataSource":
this._initDataSource();
break;
case "itemTemplate":
this._setCollectionWidgetItemTemplate();
break;
case "valueExpr":
this._compileValueGetter();
break;
case "displayExpr":
this._compileDisplayGetter();
this._setCollectionWidgetItemTemplate()
}
}
});
module.exports = DataExpressionMixin
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************************************!*\
!*** ./Scripts/ui/list/ui.list.edit.decorator.switchable.js ***!
\**************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
EditDecorator = __webpack_require__( /*! ./ui.list.edit.decorator */ 93),
abstract = EditDecorator.abstract,
eventUtils = __webpack_require__( /*! ../../events/utils */ 4),
pointerEvents = __webpack_require__( /*! ../../events/pointer */ 13),
feedbackEvents = __webpack_require__( /*! ../../events/core/emitter.feedback */ 70);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************************************!*\
!*** ./Scripts/ui/list/ui.list.edit.decorator_menu_helper.js ***!
\***************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************************!*\
!*** ./Scripts/ui/map/ui.map.provider.dynamic.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Provider = __webpack_require__( /*! ./ui.map.provider */ 244),
abstract = Provider.abstract;
var DynamicProvider = Provider.inherit({
cancelEvents: true,
_geocodeLocation: function(location) {
var d = $.Deferred();
var cache = this._geocodedLocations,
cachedLocation = cache[location];
if (cachedLocation) {
d.resolve(cachedLocation)
} else {
this._geocodeLocationImpl(location).done(function(geocodedLocation) {
cache[location] = geocodedLocation;
d.resolve(geocodedLocation)
})
}
return d.promise()
},
_renderImpl: function(markerOptions, routeOptions) {
var deferred = $.Deferred();
this._load().done($.proxy(function() {
this._init().done($.proxy(function() {
var mapTypePromise = this.updateMapType(),
boundsPromise = this._isBoundsSetted() ? this.updateBounds() : this.updateCenter();
$.when(mapTypePromise, boundsPromise).done($.proxy(function() {
this._attachHandlers();
setTimeout(function() {
deferred.resolve()
})
}, this))
}, this))
}, this));
return deferred.promise()
},
_load: function() {
if (!this._mapsLoader) {
this._mapsLoader = $.Deferred();
this._loadImpl().done($.proxy(function() {
this._mapsLoader.resolve()
}, this))
}
this._markers = [];
this._routes = [];
return this._mapsLoader.promise()
},
_loadImpl: abstract,
_init: abstract,
_attachHandlers: abstract,
addMarkers: function(options) {
var deferred = $.Deferred(),
that = this;
var markerPromises = $.map(options, function(options) {
return that._addMarker(options)
});
$.when.apply($, markerPromises).done(function() {
var instances = $.map($.makeArray(arguments), function(markerObject) {
return markerObject.marker
});
deferred.resolve(false, instances)
});
deferred.done(function() {
that._fitBounds()
});
return deferred.promise()
},
_addMarker: function(options) {
var that = this;
return this._renderMarker(options).done(function(markerObject) {
that._markers.push($.extend({
options: options
}, markerObject));
that._fireMarkerAddedAction({
options: options,
originalMarker: markerObject.marker
})
})
},
_renderMarker: abstract,
removeMarkers: function(markersOptionsToRemove) {
var that = this;
$.each(markersOptionsToRemove, function(_, markerOptionToRemove) {
that._removeMarker(markerOptionToRemove)
});
return $.Deferred().resolve().promise()
},
_removeMarker: function(markersOptionToRemove) {
var that = this;
$.each(this._markers, function(markerIndex, markerObject) {
if (markerObject.options !== markersOptionToRemove) {
return true
}
that._destroyMarker(markerObject);
that._markers.splice(markerIndex, 1);
that._fireMarkerRemovedAction({
options: markerObject.options
});
return false
})
},
_destroyMarker: abstract,
_clearMarkers: function() {
while (this._markers.length > 0) {
this._removeMarker(this._markers[0].options)
}
},
addRoutes: function(options) {
var deferred = $.Deferred(),
that = this;
var routePromises = $.map(options, function(options) {
return that._addRoute(options)
});
$.when.apply($, routePromises).done(function() {
var instances = $.map($.makeArray(arguments), function(routeObject) {
return routeObject.instance
});
deferred.resolve(false, instances)
});
deferred.done(function() {
that._fitBounds()
});
return deferred.promise()
},
_addRoute: function(options) {
var that = this;
return this._renderRoute(options).done(function(routeObject) {
that._routes.push($.extend({
options: options
}, routeObject));
that._fireRouteAddedAction({
options: options,
originalRoute: routeObject.instance
})
})
},
_renderRoute: abstract,
removeRoutes: function(options) {
var that = this;
$.each(options, function(routeIndex, options) {
that._removeRoute(options)
});
return $.Deferred().resolve().promise()
},
_removeRoute: function(options) {
var that = this;
$.each(this._routes, function(routeIndex, routeObject) {
if (routeObject.options !== options) {
return true
}
that._destroyRoute(routeObject);
that._routes.splice(routeIndex, 1);
that._fireRouteRemovedAction({
options: options
});
return false
})
},
_destroyRoute: abstract,
_clearRoutes: function() {
while (this._routes.length > 0) {
this._removeRoute(this._routes[0].options)
}
},
adjustViewport: function() {
return this._fitBounds()
},
_fitBounds: abstract,
_updateBounds: function() {
var that = this;
this._clearBounds();
if (!this._option("autoAdjust")) {
return
}
$.each(this._markers, function(_, markerObject) {
that._extendBounds(markerObject.location)
});
$.each(this._routes, function(_, routeObject) {
that._extendBounds(routeObject.northEast);
that._extendBounds(routeObject.southWest)
})
},
_clearBounds: function() {
this._bounds = null
},
_extendBounds: abstract
});
module.exports = DynamicProvider
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*******************************************!*\
!*** ./Scripts/ui/map/ui.map.provider.js ***!
\*******************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../../core/class */ 5),
eventUtils = __webpack_require__( /*! ../../events/utils */ 4);
var abstract = Class.abstract;
var Provider = Class.inherit({
_defaultRouteWeight: function() {
return 5
},
_defaultRouteOpacity: function() {
return .5
},
_defaultRouteColor: function() {
return "#0000FF"
},
cancelEvents: false,
ctor: function(map, $container) {
this._mapWidget = map;
this._$container = $container
},
render: function(markerOptions, routeOptions) {
var deferred = $.Deferred();
this._renderImpl().done($.proxy(function() {
var markersPromise = this._applyFunctionIfNeeded("addMarkers", markerOptions);
var routesPromise = this._applyFunctionIfNeeded("addRoutes", routeOptions);
$.when(markersPromise, routesPromise).done(function() {
deferred.resolve(true)
})
}, this));
return deferred.promise()
},
_renderImpl: abstract,
updateDimensions: abstract,
updateMapType: abstract,
updateBounds: abstract,
updateCenter: abstract,
updateZoom: abstract,
updateControls: abstract,
updateMarkers: function(markerOptionsToRemove, markerOptionsToAdd) {
var deferred = $.Deferred(),
that = this;
this._applyFunctionIfNeeded("removeMarkers", markerOptionsToRemove).done(function() {
that._applyFunctionIfNeeded("addMarkers", markerOptionsToAdd).done(function() {
deferred.resolve.apply(deferred, arguments)
})
});
return deferred.promise()
},
addMarkers: abstract,
removeMarkers: abstract,
adjustViewport: abstract,
updateRoutes: function(routeOptionsToRemove, routeOptionsToAdd) {
var deferred = $.Deferred(),
that = this;
this._applyFunctionIfNeeded("removeRoutes", routeOptionsToRemove).done(function() {
that._applyFunctionIfNeeded("addRoutes", routeOptionsToAdd).done(function() {
deferred.resolve.apply(deferred, arguments)
})
});
return deferred.promise()
},
addRoutes: abstract,
removeRoutes: abstract,
clean: abstract,
map: function() {
return this._map
},
_option: function(name, value) {
if (void 0 === value) {
return this._mapWidget.option(name)
}
this._mapWidget.setOptionSilent(name, value)
},
_keyOption: function(providerName) {
var key = this._option("key");
return void 0 === key[providerName] ? key : key[providerName]
},
_parseTooltipOptions: function(option) {
return {
text: option.text || option,
visible: option.isShown || false
}
},
_getLatLng: function(location) {
if ("string" === typeof location) {
var coords = $.map(location.split(","), $.trim),
numericRegex = /^[-+]?[0-9]*\.?[0-9]*$/;
if (2 === coords.length && coords[0].match(numericRegex) && coords[1].match(numericRegex)) {
return {
lat: parseFloat(coords[0]),
lng: parseFloat(coords[1])
}
}
} else {
if ($.isArray(location) && 2 === location.length) {
return {
lat: location[0],
lng: location[1]
}
} else {
if ($.isPlainObject(location) && $.isNumeric(location.lat) && $.isNumeric(location.lng)) {
return location
}
}
}
return null
},
_isBoundsSetted: function() {
return this._option("bounds.northEast") && this._option("bounds.southWest")
},
_addEventNamespace: function(name) {
return eventUtils.addNamespace(name, this._mapWidget.NAME)
},
_applyFunctionIfNeeded: function(fnName, array) {
if (!array.length) {
return $.Deferred().resolve().promise()
}
return this[fnName](array)
},
_createAction: function() {
var mapWidget = this._mapWidget;
return mapWidget._createAction.apply(mapWidget, arguments)
},
_fireAction: function(name, actionArguments) {
var option = this._option(name);
if (option) {
this._createAction(option)(actionArguments)
}
},
_fireClickAction: function(actionArguments) {
this._fireAction("onClick", actionArguments)
},
_fireMarkerAddedAction: function(actionArguments) {
this._fireAction("onMarkerAdded", actionArguments)
},
_fireMarkerRemovedAction: function(actionArguments) {
this._fireAction("onMarkerRemoved", actionArguments)
},
_fireRouteAddedAction: function(actionArguments) {
this._fireAction("onRouteAdded", actionArguments)
},
_fireRouteRemovedAction: function(actionArguments) {
this._fireAction("onRouteRemoved", actionArguments)
}
});
module.exports = Provider
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**********************************!*\
!*** ./Scripts/ui/multi_view.js ***!
\**********************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
fx = __webpack_require__( /*! ../animation/fx */ 21),
translator = __webpack_require__( /*! ../animation/translator */ 15),
mathUtils = __webpack_require__( /*! ../core/utils/math */ 66),
commonUtils = __webpack_require__( /*! ../core/utils/common */ 2),
devices = __webpack_require__( /*! ../core/devices */ 7),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 3),
CollectionWidget = __webpack_require__( /*! ./collection/ui.collection_widget.edit */ 27),
Swipeable = __webpack_require__( /*! ../events/gesture/swipeable */ 76);
var MULTIVIEW_CLASS = "dx-multiview",
MULTIVIEW_WRAPPER_CLASS = "dx-multiview-wrapper",
MULTIVIEW_ITEM_CONTAINER_CLASS = "dx-multiview-item-container",
MULTIVIEW_ITEM_CLASS = "dx-multiview-item",
MULTIVIEW_ITEM_HIDDEN_CLASS = "dx-multiview-item-hidden",
MULTIVIEW_ITEM_DATA_KEY = "dxMultiViewItemData",
MULTIVIEW_ANIMATION_DURATION = 200;
var toNumber = function(value) {
return +value
};
var position = function($element) {
return translator.locate($element).left
};
var move = function($element, position) {
translator.move($element, {
left: position
})
};
var animation = {
moveTo: function($element, position, duration, completeAction) {
fx.animate($element, {
type: "slide",
to: {
left: position
},
duration: duration,
complete: completeAction
})
},
complete: function($element) {
fx.stop($element, true)
}
};
var MultiView = CollectionWidget.inherit({
_activeStateUnit: "." + MULTIVIEW_ITEM_CLASS,
_supportedKeys: function() {
return $.extend(this.callBase(), {
pageUp: $.noop,
pageDown: $.noop
})
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
selectedIndex: 0,
swipeEnabled: true,
animationEnabled: true,
loop: false,
deferRendering: true,
_itemAttributes: {
role: "tabpanel"
},
loopItemFocus: false,
selectOnFocus: true,
selectionMode: "single",
selectionRequired: true,
selectionByClick: false
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function(device) {
return "desktop" === devices.real().deviceType && !devices.isSimulator()
},
options: {
focusStateEnabled: true
}
}])
},
_itemClass: function() {
return MULTIVIEW_ITEM_CLASS
},
_itemDataKey: function() {
return MULTIVIEW_ITEM_DATA_KEY
},
_itemContainer: function() {
return this._$itemContainer
},
_itemElements: function() {
return this._itemContainer().children(this._itemSelector())
},
_itemWidth: function() {
if (!this._itemWidthValue) {
this._itemWidthValue = this._$wrapper.width()
}
return this._itemWidthValue
},
_clearItemWidthCache: function() {
delete this._itemWidthValue
},
_itemsCount: function() {
return this.option("items").length
},
_normalizeIndex: function(index) {
var count = this._itemsCount();
if (index < 0) {
index += count
}
if (index >= count) {
index -= count
}
return index
},
_getRTLSignCorrection: function() {
return this.option("rtlEnabled") ? -1 : 1
},
_init: function() {
this.callBase.apply(this, arguments);
var $element = this.element();
$element.addClass(MULTIVIEW_CLASS);
this._$wrapper = $("").addClass(MULTIVIEW_WRAPPER_CLASS);
this._$wrapper.appendTo($element);
this._$itemContainer = $(" ").addClass(MULTIVIEW_ITEM_CONTAINER_CLASS);
this._$itemContainer.appendTo(this._$wrapper);
this.option("loopItemFocus", this.option("loop"));
this._initSwipeable()
},
_render: function() {
this._deferredItems = [];
this.callBase()
},
_renderItemContent: function(args) {
var renderContentDeferred = $.Deferred();
var that = this,
callBase = this.callBase;
var deferred = $.Deferred();
deferred.done(function() {
var $itemContent = callBase.call(that, args);
renderContentDeferred.resolve($itemContent)
});
this._deferredItems.push(deferred);
this.option("deferRendering") || deferred.resolve();
return renderContentDeferred.promise()
},
_renderSelection: function(addedSelection) {
this._updateItems(addedSelection[0])
},
_updateItems: function(selectedIndex, newIndex) {
this._updateItemsPosition(selectedIndex, newIndex);
this._updateItemsVisibility(selectedIndex, newIndex)
},
_updateItemsPosition: function(selectedIndex, newIndex) {
var $itemElements = this._itemElements(),
positionSign = -this._animationDirection(newIndex, selectedIndex),
$selectedItem = $itemElements.eq(selectedIndex);
move($selectedItem, 0);
move($itemElements.eq(newIndex), 100 * positionSign + "%")
},
_updateItemsVisibility: function(selectedIndex, newIndex) {
var $itemElements = this._itemElements();
$itemElements.each($.proxy(function(itemIndex, item) {
var $item = $(item),
isHidden = itemIndex !== selectedIndex && itemIndex !== newIndex;
if (!isHidden) {
this._renderSpecificItem(itemIndex)
}
$item.toggleClass(MULTIVIEW_ITEM_HIDDEN_CLASS, isHidden);
this.setAria("hidden", isHidden || void 0, $item)
}, this))
},
_renderSpecificItem: function(index) {
var hasItemContent = this._itemElements().eq(index).find(this._itemContentClass()).length > 0;
if (commonUtils.isDefined(index) && !hasItemContent) {
this._deferredItems[index].resolve()
}
},
_setAriaSelected: $.noop,
_updateSelection: function(addedSelection, removedSelection) {
var newIndex = addedSelection[0],
prevIndex = removedSelection[0];
animation.complete(this._$itemContainer);
this._updateItems(prevIndex, newIndex);
var animationDirection = this._animationDirection(newIndex, prevIndex);
this._animateItemContainer(animationDirection * this._itemWidth(), $.proxy(function() {
move(this._$itemContainer, 0);
this._updateItems(newIndex);
this._$itemContainer.width()
}, this))
},
_animateItemContainer: function(position, completeCallback) {
var duration = this.option("animationEnabled") ? MULTIVIEW_ANIMATION_DURATION : 0;
animation.moveTo(this._$itemContainer, position, duration, completeCallback)
},
_animationDirection: function(newIndex, prevIndex) {
var containerPosition = position(this._$itemContainer),
indexDifference = (prevIndex - newIndex) * this._getRTLSignCorrection() * this._getItemFocusLoopSignCorrection(),
isSwipePresent = 0 !== containerPosition,
directionSignVariable = isSwipePresent ? containerPosition : indexDifference;
return mathUtils.sign(directionSignVariable)
},
_initSwipeable: function() {
this._createComponent(this.element(), Swipeable, {
disabled: !this.option("swipeEnabled"),
elastic: false,
itemSizeFunc: $.proxy(this._itemWidth, this),
onStart: $.proxy(function(args) {
this._swipeStartHandler(args.jQueryEvent)
}, this),
onUpdated: $.proxy(function(args) {
this._swipeUpdateHandler(args.jQueryEvent)
}, this),
onEnd: $.proxy(function(args) {
this._swipeEndHandler(args.jQueryEvent)
}, this)
})
},
_swipeStartHandler: function(e) {
animation.complete(this._$itemContainer);
var selectedIndex = this.option("selectedIndex"),
loop = this.option("loop"),
lastIndex = this._itemsCount() - 1,
rtl = this.option("rtlEnabled");
e.maxLeftOffset = toNumber(loop || (rtl ? selectedIndex > 0 : selectedIndex < lastIndex));
e.maxRightOffset = toNumber(loop || (rtl ? selectedIndex < lastIndex : selectedIndex > 0));
this._swipeDirection = null
},
_swipeUpdateHandler: function(e) {
var offset = e.offset,
swipeDirection = mathUtils.sign(offset) * this._getRTLSignCorrection();
move(this._$itemContainer, offset * this._itemWidth());
if (swipeDirection !== this._swipeDirection) {
this._swipeDirection = swipeDirection;
var selectedIndex = this.option("selectedIndex"),
newIndex = this._normalizeIndex(selectedIndex - swipeDirection);
this._updateItems(selectedIndex, newIndex)
}
},
_swipeEndHandler: function(e) {
var targetOffset = e.targetOffset * this._getRTLSignCorrection();
if (targetOffset) {
this.option("selectedIndex", this._normalizeIndex(this.option("selectedIndex") - targetOffset));
var $selectedElement = this.itemElements().filter(".dx-item-selected");
this.option("focusStateEnabled") && this.option("focusedElement", $selectedElement)
} else {
this._animateItemContainer(0, $.noop)
}
},
_getItemFocusLoopSignCorrection: function() {
return this._itemFocusLooped ? -1 : 1
},
_moveFocus: function() {
this.callBase.apply(this, arguments);
this._itemFocusLooped = false
},
_prevItem: function($items) {
var $result = this.callBase.apply(this, arguments);
this._itemFocusLooped = $result.is($items.last());
return $result
},
_nextItem: function($items) {
var $result = this.callBase.apply(this, arguments);
this._itemFocusLooped = $result.is($items.first());
return $result
},
_dimensionChanged: function() {
this._clearItemWidthCache()
},
_visibilityChanged: function(visible) {
if (visible) {
this._dimensionChanged()
}
},
_optionChanged: function(args) {
var value = args.value;
switch (args.name) {
case "loop":
this.option("loopItemFocus", value);
break;
case "animationEnabled":
break;
case "swipeEnabled":
Swipeable.getInstance(this.element()).option("disabled", !value);
break;
case "deferRendering":
this._invalidate();
break;
default:
this.callBase(args)
}
}
});
registerComponent("dxMultiView", MultiView);
module.exports = MultiView;
module.exports.animation = animation
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!************************************!*\
!*** ./Scripts/ui/progress_bar.js ***!
\************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
TrackBar = __webpack_require__( /*! ./track_bar */ 185),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 3);
var PROGRESSBAR_CLASS = "dx-progressbar",
PROGRESSBAR_CONTAINER_CLASS = "dx-progressbar-container",
PROGRESSBAR_RANGE_CONTAINER_CLASS = "dx-progressbar-range-container",
PROGRESSBAR_RANGE_CLASS = "dx-progressbar-range",
PROGRESSBAR_WRAPPER_CLASS = "dx-progressbar-wrapper",
PROGRESSBAR_STATUS_CLASS = "dx-progressbar-status",
PROGRESSBAR_INDETERMINATE_SEGMENT_CONTAINER = "dx-progressbar-animating-container",
PROGRESSBAR_INDETERMINATE_SEGMENT = "dx-progressbar-animating-segment";
var ProgressBar = TrackBar.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
statusFormat: function(ratio, value) {
return "Progress: " + Math.round(100 * ratio) + "%"
},
showStatus: true,
onComplete: null,
activeStateEnabled: false,
statusPosition: "bottom left",
_animatingSegmentCount: 0
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: {
platform: "win"
},
options: {
_animatingSegmentCount: 5
}
}, {
device: function(device) {
return "android" === device.platform
},
options: {
_animatingSegmentCount: 2
}
}])
},
_init: function() {
this.callBase()
},
_render: function() {
this._createCompleteAction();
this._renderStatus();
this.callBase();
this.element().addClass(PROGRESSBAR_CLASS);
this.setAria("role", "progressbar");
this._$wrapper.addClass(PROGRESSBAR_WRAPPER_CLASS);
this._$bar.addClass(PROGRESSBAR_CONTAINER_CLASS);
$(" ").addClass(PROGRESSBAR_RANGE_CONTAINER_CLASS).appendTo(this._$wrapper).append(this._$bar);
this._$range.addClass(PROGRESSBAR_RANGE_CLASS);
this._toggleStatus(this.option("showStatus"))
},
_createCompleteAction: function() {
this._completeAction = this._createActionByOption("onComplete")
},
_renderStatus: function() {
this._$status = $(" ").addClass(PROGRESSBAR_STATUS_CLASS)
},
_renderIndeterminateState: function() {
this._$segmentContainer = $(" ").addClass(PROGRESSBAR_INDETERMINATE_SEGMENT_CONTAINER);
var segments = this.option("_animatingSegmentCount");
for (var i = 0; i < segments; i++) {
$(" ").addClass(PROGRESSBAR_INDETERMINATE_SEGMENT).addClass(PROGRESSBAR_INDETERMINATE_SEGMENT + "-" + (i + 1)).appendTo(this._$segmentContainer)
}
this._$segmentContainer.appendTo(this._$wrapper)
},
_toggleStatus: function(value) {
var splittedPosition = this.option("statusPosition").split(" ");
if (value) {
if ("top" === splittedPosition[0] || "left" === splittedPosition[0]) {
this._$status.prependTo(this._$wrapper)
} else {
this._$status.appendTo(this._$wrapper)
}
} else {
this._$status.detach()
}
this._togglePositionClass()
},
_togglePositionClass: function() {
var position = this.option("statusPosition"),
splittedPosition = position.split(" ");
this._$wrapper.removeClass("dx-position-top-left dx-position-top-right dx-position-bottom-left dx-position-bottom-right dx-position-left dx-position-right");
var positionClass = "dx-position-" + splittedPosition[0];
if (splittedPosition[1]) {
positionClass += "-" + splittedPosition[1]
}
this._$wrapper.addClass(positionClass)
},
_toggleIndeterminateState: function(value) {
if (value) {
this._renderIndeterminateState();
this._$bar.toggle(false)
} else {
this._$bar.toggle(true);
this._$segmentContainer.remove();
delete this._$segmentContainer
}
},
_renderValue: function() {
var val = this.option("value"),
max = this.option("max");
if (!val && 0 !== val) {
this._toggleIndeterminateState(true);
return
}
if (this._$segmentContainer) {
this._toggleIndeterminateState(false)
}
if (val === max) {
this._completeAction()
}
this.callBase();
this._setStatus()
},
_setStatus: function() {
var format = this.option("statusFormat");
if ($.isFunction(format)) {
format = $.proxy(format, this)
} else {
format = function(value) {
return value
}
}
var statusText = format(this._currentRatio, this.option("value"));
this._$status.text(statusText)
},
_dispose: function() {
this._$status.remove();
this.callBase()
},
_optionChanged: function(args) {
switch (args.name) {
case "statusFormat":
this._setStatus();
break;
case "showStatus":
this._toggleStatus(args.value);
break;
case "statusPosition":
this._toggleStatus(this.option("showStatus"));
break;
case "onComplete":
this._createCompleteAction();
break;
case "_animatingSegmentCount":
break;
default:
this.callBase(args)
}
}
});
registerComponent("dxProgressBar", ProgressBar);
module.exports = ProgressBar
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************!*\
!*** ./Scripts/ui/responsive_box.js ***!
\**************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
errors = __webpack_require__( /*! ./widget/ui.errors */ 20),
windowUtils = __webpack_require__( /*! ../core/utils/window */ 57),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 3),
Box = __webpack_require__( /*! ./box */ 134),
CollectionWidget = __webpack_require__( /*! ./collection/ui.collection_widget.edit */ 27);
var RESPONSIVE_BOX_CLASS = "dx-responsivebox",
SCREEN_SIZE_CLASS_PREFIX = RESPONSIVE_BOX_CLASS + "-screen-",
BOX_ITEM_CLASS = "dx-box-item",
BOX_ITEM_DATA_KEY = "dxBoxItemData";
var ResponsiveBox = CollectionWidget.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
rows: [],
cols: [],
screenByWidth: null,
singleColumnScreen: "",
height: "100%",
width: "100%",
activeStateEnabled: false,
focusStateEnabled: false,
onLayoutChanged: null,
currentScreenFactor: void 0,
_layoutStrategy: void 0
})
},
_init: function() {
if (!this.option("screenByWidth")) {
this._options.screenByWidth = windowUtils.defaultScreenFactorFunc
}
this.callBase();
this._initLayoutChangedAction()
},
_initLayoutChangedAction: function() {
this._layoutChangedAction = this._createActionByOption("onLayoutChanged", {
excludeValidators: ["disabled", "readonly"]
})
},
_itemClass: function() {
return BOX_ITEM_CLASS
},
_itemDataKey: function() {
return BOX_ITEM_DATA_KEY
},
_render: function() {
this.callBase();
this.element().addClass(RESPONSIVE_BOX_CLASS);
this._updateRootBox()
},
_updateRootBox: function() {
clearTimeout(this._updateTimer);
this._updateTimer = setTimeout($.proxy(function() {
if (this._$root) {
this._$root.trigger("dxupdate")
}
}, this))
},
_renderItems: function() {
this._setScreenSize();
this._screenItems = this._itemsByScreen();
this._prepareGrid();
this._spreadItems();
this._layoutItems();
this._linkNodeToItem()
},
_setScreenSize: function() {
var currentScreen = this._getCurrentScreen();
this._removeScreenSizeClass();
this.element().addClass(SCREEN_SIZE_CLASS_PREFIX + currentScreen);
this.option("currentScreenFactor", currentScreen)
},
_removeScreenSizeClass: function() {
var currentScreenFactor = this.option("currentScreenFactor");
currentScreenFactor && this.element().removeClass(SCREEN_SIZE_CLASS_PREFIX + currentScreenFactor)
},
_prepareGrid: function() {
var grid = this._grid = [];
this._prepareRowsAndCols();
$.each(this._rows, $.proxy(function() {
var row = [];
grid.push(row);
$.each(this._cols, $.proxy(function() {
row.push(this._createEmptyCell())
}, this))
}, this))
},
_prepareRowsAndCols: function() {
if (this._isSingleColumnScreen()) {
this._prepareSingleColumnScreenItems();
this._rows = this._defaultSizeConfig(this._screenItems.length);
this._cols = this._defaultSizeConfig(1)
} else {
this._rows = this._sizesByScreen(this.option("rows"));
this._cols = this._sizesByScreen(this.option("cols"))
}
},
_isSingleColumnScreen: function() {
return this._screenRegExp().test(this.option("singleColumnScreen")) || !this.option("rows").length || !this.option("cols").length
},
_prepareSingleColumnScreenItems: function() {
this._screenItems.sort(function(item1, item2) {
return item1.location.row - item2.location.row || item1.location.col - item2.location.col
});
$.each(this._screenItems, function(index, item) {
$.extend(item.location, {
row: index,
col: 0,
rowspan: 1,
colspan: 1
})
})
},
_sizesByScreen: function(sizeConfigs) {
return $.map(this._filterByScreen(sizeConfigs), $.proxy(function(sizeConfig) {
return $.extend(this._defaultSizeConfig(), sizeConfig)
}, this))
},
_defaultSizeConfig: function(size) {
var defaultSizeConfig = {
ratio: 1,
baseSize: 0,
minSize: 0,
maxSize: 0
};
if (!arguments.length) {
return defaultSizeConfig
}
var result = [];
for (var i = 0; i < size; i++) {
result.push(defaultSizeConfig)
}
return result
},
_filterByScreen: function(items) {
var screenRegExp = this._screenRegExp();
return $.grep(items, function(item) {
return !item.screen || screenRegExp.test(item.screen)
})
},
_screenRegExp: function() {
var screen = this._getCurrentScreen();
return new RegExp("(^|\\s)" + screen + "($|\\s)", "i")
},
_getCurrentScreen: function() {
var width = this._screenWidth();
return this.option("screenByWidth")(width)
},
_screenWidth: function() {
return $(window).width()
},
_createEmptyCell: function() {
return {
item: {},
location: {
colspan: 1,
rowspan: 1
}
}
},
_spreadItems: function() {
$.each(this._screenItems, $.proxy(function(_, itemInfo) {
var location = itemInfo.location || {};
var itemCol = location.col;
var itemRow = location.row;
var row = this._grid[itemRow];
var itemCell = row && row[itemCol];
this._occupyCells(itemCell, itemInfo)
}, this))
},
_itemsByScreen: function() {
return $.map(this.option("items"), $.proxy(function(item) {
var locations = item.location || {};
locations = $.isPlainObject(locations) ? [locations] : locations;
return $.map(this._filterByScreen(locations), function(location) {
return {
item: item,
location: $.extend({
rowspan: 1,
colspan: 1
}, location)
}
})
}, this))
},
_occupyCells: function(itemCell, itemInfo) {
if (!itemCell || this._isItemCellOccupied(itemCell, itemInfo)) {
return
}
$.extend(itemCell, itemInfo);
this._markSpanningCell(itemCell)
},
_isItemCellOccupied: function(itemCell, itemInfo) {
if (!$.isEmptyObject(itemCell.item)) {
return true
}
var result = false;
this._loopOverSpanning(itemInfo.location, function(cell) {
result = result || !$.isEmptyObject(cell.item)
});
return result
},
_loopOverSpanning: function(location, callback) {
var rowEnd = location.row + location.rowspan - 1;
var colEnd = location.col + location.colspan - 1;
var boundRowEnd = Math.min(rowEnd, this._rows.length - 1);
var boundColEnd = Math.min(colEnd, this._cols.length - 1);
location.rowspan -= rowEnd - boundRowEnd;
location.colspan -= colEnd - boundColEnd;
for (var rowIndex = location.row; rowIndex <= boundRowEnd; rowIndex++) {
for (var colIndex = location.col; colIndex <= boundColEnd; colIndex++) {
if (rowIndex !== location.row || colIndex !== location.col) {
callback(this._grid[rowIndex][colIndex])
}
}
}
},
_markSpanningCell: function(itemCell) {
this._loopOverSpanning(itemCell.location, function(cell) {
$.extend(cell, {
item: itemCell.item,
spanningCell: itemCell
})
})
},
_linkNodeToItem: function() {
$.each(this._itemElements(), function(_, itemNode) {
var $item = $(itemNode),
item = $item.data(BOX_ITEM_DATA_KEY);
if (!item.box) {
item.node = $item.children()
}
})
},
_layoutItems: function() {
var rowsCount = this._grid.length;
var colsCount = rowsCount && this._grid[0].length;
if (!rowsCount && !colsCount) {
return
}
var result = this._layoutBlock({
direction: "col",
row: {
start: 0,
end: rowsCount - 1
},
col: {
start: 0,
end: colsCount - 1
}
});
var rootBox = this._prepareBoxConfig(result.box || {
direction: "row",
items: [$.extend(result, {
ratio: 1
})]
});
$.extend(rootBox, this._rootBoxConfig());
this._$root = $(" ").appendTo(this._itemContainer());
this._createComponent(this._$root, Box, rootBox)
},
_rootBoxConfig: function(config) {
return $.extend({
width: "100%",
height: "100%",
itemTemplate: this.option("itemTemplate"),
itemHoldTimeout: this.option("itemHoldTimeout"),
onItemHold: this.option("onItemHold"),
onItemClick: this.option("onItemClick"),
onItemContextMenu: this.option("onItemContextMenu"),
onItemRendered: this.option("onItemRendered")
}, {
_layoutStrategy: this.option("_layoutStrategy")
})
},
_prepareBoxConfig: function(config) {
return $.extend(config || {}, {
crossAlign: "stretch"
})
},
_layoutBlock: function(options) {
if (this._isSingleItem(options)) {
return this._itemByCell(options.row.start, options.col.start)
}
return this._layoutDirection(options)
},
_isSingleItem: function(options) {
var firstCellLocation = this._grid[options.row.start][options.col.start].location;
var isItemRowSpanned = options.row.end - options.row.start === firstCellLocation.rowspan - 1;
var isItemColSpanned = options.col.end - options.col.start === firstCellLocation.colspan - 1;
return isItemRowSpanned && isItemColSpanned
},
_itemByCell: function(rowIndex, colIndex) {
var itemCell = this._grid[rowIndex][colIndex];
return itemCell.spanningCell ? null : itemCell.item
},
_layoutDirection: function(options) {
var items = [];
var direction = options.direction;
var crossDirection = this._crossDirection(direction);
var block;
while (block = this._nextBlock(options)) {
if (this._isBlockIndivisible(options.prevBlockOptions, block)) {
throw errors.Error("E1025")
}
var item = this._layoutBlock({
direction: crossDirection,
row: block.row,
col: block.col,
prevBlockOptions: options
});
if (item) {
$.extend(item, this._blockSize(block, crossDirection));
items.push(item)
}
options[crossDirection].start = block[crossDirection].end + 1
}
return {
box: this._prepareBoxConfig({
direction: direction,
items: items
})
}
},
_isBlockIndivisible: function(options, block) {
return options && options.col.start === block.col.start && options.col.end === block.col.end && options.row.start === block.row.start && options.row.end === block.row.end
},
_crossDirection: function(direction) {
return "col" === direction ? "row" : "col"
},
_nextBlock: function(options) {
var direction = options.direction;
var crossDirection = this._crossDirection(direction);
var startIndex = options[direction].start;
var endIndex = options[direction].end;
var crossStartIndex = options[crossDirection].start;
if (crossStartIndex > options[crossDirection].end) {
return null
}
var crossSpan = 1;
for (var crossIndex = crossStartIndex; crossIndex < crossStartIndex + crossSpan; crossIndex++) {
var lineCrossSpan = 1;
for (var index = startIndex; index <= endIndex; index++) {
var cell = this._cellByDirection(direction, index, crossIndex);
lineCrossSpan = Math.max(lineCrossSpan, cell.location[crossDirection + "span"])
}
var lineCrossEndIndex = crossIndex + lineCrossSpan;
var crossEndIndex = crossStartIndex + crossSpan;
if (lineCrossEndIndex > crossEndIndex) {
crossSpan += lineCrossEndIndex - crossEndIndex
}
}
var result = {};
result[direction] = {
start: startIndex,
end: endIndex
};
result[crossDirection] = {
start: crossStartIndex,
end: crossStartIndex + crossSpan - 1
};
return result
},
_cellByDirection: function(direction, index, crossIndex) {
return "col" === direction ? this._grid[crossIndex][index] : this._grid[index][crossIndex]
},
_blockSize: function(block, direction) {
var sizeConfigs = "row" === direction ? this._rows : this._cols;
var result = {
ratio: 0,
baseSize: 0,
minSize: 0,
maxSize: 0
};
for (var index = block[direction].start; index <= block[direction].end; index++) {
var sizeConfig = sizeConfigs[index];
result.ratio += sizeConfig.ratio;
result.baseSize += sizeConfig.baseSize;
result.minSize += sizeConfig.minSize;
result.maxSize += sizeConfig.maxSize
}
result.minSize = result.minSize ? result.minSize : "auto";
result.maxSize = result.maxSize ? result.maxSize : "auto";
this._isSingleColumnScreen() && (result.baseSize = "auto");
return result
},
_update: function() {
var $existingRoot = this._$root;
this._renderItems();
$existingRoot && $existingRoot.detach();
this._saveAssistantRoot($existingRoot);
this._layoutChangedAction();
this._updateRootBox()
},
_saveAssistantRoot: function($root) {
this._assistantRoots = this._assistantRoots || [];
this._assistantRoots.push($root)
},
_dispose: function() {
clearTimeout(this._updateTimer);
this._cleanUnusedRoots();
this.callBase.apply(this, arguments)
},
_cleanUnusedRoots: function() {
if (!this._assistantRoots) {
return
}
$.each(this._assistantRoots, function() {
$(this).remove()
})
},
_clearItemNodeTemplates: function() {
$.each(this.option("items"), function() {
delete this.node
})
},
_toggleVisibility: function(visible) {
this.callBase(visible);
if (visible) {
this._updateRootBox()
}
},
_attachClickEvent: $.noop,
_optionChanged: function(args) {
switch (args.name) {
case "rows":
case "cols":
case "screenByWidth":
case "_layoutStrategy":
case "singleColumnScreen":
this._clearItemNodeTemplates();
this._invalidate();
break;
case "width":
case "height":
this.callBase(args);
this._update();
break;
case "onLayoutChanged":
this._initLayoutChangedAction();
break;
case "itemTemplate":
this._clearItemNodeTemplates();
this.callBase(args);
break;
case "currentScreenFactor":
break;
default:
this.callBase(args)
}
},
_dimensionChanged: function() {
if (this._getCurrentScreen() !== this.option("currentScreenFactor")) {
this._update()
}
},
repaint: function() {
this._update()
}
});
registerComponent("dxResponsiveBox", ResponsiveBox);
module.exports = ResponsiveBox
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************!*\
!*** ./Scripts/ui/scroll_view/animator.js ***!
\********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../../core/class */ 5),
abstract = Class.abstract,
animationFrame = __webpack_require__( /*! ../../animation/frame */ 75);
var Animator = Class.inherit({
ctor: function() {
this._finished = true;
this._stopped = false;
this._proxiedStepCore = $.proxy(this._stepCore, this)
},
start: function() {
this._stopped = false;
this._finished = false;
this._stepCore()
},
stop: function() {
this._stopped = true;
animationFrame.cancelAnimationFrame(this._stepAnimationFrame)
},
_stepCore: function() {
if (this._isStopped()) {
this._stop();
return
}
if (this._isFinished()) {
this._finished = true;
this._complete();
return
}
this._step();
this._stepAnimationFrame = animationFrame.requestAnimationFrame(this._proxiedStepCore)
},
_step: abstract,
_isFinished: $.noop,
_stop: $.noop,
_complete: $.noop,
_isStopped: function() {
return this._stopped
},
inProgress: function() {
return !(this._stopped || this._finished)
}
});
module.exports = Animator
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************************!*\
!*** ./Scripts/ui/scroll_view/ui.scrollable.simulated.js ***!
\***********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
math = Math,
titleize = __webpack_require__( /*! ../../core/utils/inflector */ 29).titleize,
translator = __webpack_require__( /*! ../../animation/translator */ 15),
Class = __webpack_require__( /*! ../../core/class */ 5),
Animator = __webpack_require__( /*! ./animator */ 248),
devices = __webpack_require__( /*! ../../core/devices */ 7),
eventUtils = __webpack_require__( /*! ../../events/utils */ 4),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
pointerEvents = __webpack_require__( /*! ../../events/pointer */ 13),
Scrollbar = __webpack_require__( /*! ./ui.scrollbar */ 250);
var realDevice = devices.real;
var isSluggishPlatform = "win" === realDevice.platform || "android" === realDevice.platform;
var SCROLLABLE_SIMULATED = "dxSimulatedScrollable",
SCROLLABLE_STRATEGY = "dxScrollableStrategy",
SCROLLABLE_SIMULATED_CURSOR = SCROLLABLE_SIMULATED + "Cursor",
SCROLLABLE_SIMULATED_KEYBOARD = SCROLLABLE_SIMULATED + "Keyboard",
SCROLLABLE_SIMULATED_CLASS = "dx-scrollable-simulated",
SCROLLABLE_SCROLLBARS_HIDDEN = "dx-scrollable-scrollbars-hidden",
SCROLLABLE_SCROLLBARS_ALWAYSVISIBLE = "dx-scrollable-scrollbars-alwaysvisible",
SCROLLABLE_SCROLLBAR_CLASS = "dx-scrollable-scrollbar",
VERTICAL = "vertical",
HORIZONTAL = "horizontal",
ACCELERATION = isSluggishPlatform ? .95 : .92,
OUT_BOUNDS_ACCELERATION = .5,
MIN_VELOCITY_LIMIT = 1,
FRAME_DURATION = math.round(1e3 / 60),
SCROLL_LINE_HEIGHT = 20,
BOUNCE_MIN_VELOCITY_LIMIT = MIN_VELOCITY_LIMIT / 5,
BOUNCE_DURATION = isSluggishPlatform ? 300 : 400,
BOUNCE_FRAMES = BOUNCE_DURATION / FRAME_DURATION,
BOUNCE_ACCELERATION_SUM = (1 - math.pow(ACCELERATION, BOUNCE_FRAMES)) / (1 - ACCELERATION);
var KEY_CODES = {
PAGE_UP: 33,
PAGE_DOWN: 34,
END: 35,
HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40
};
var scrollIntoViewIfNeededCallbacks = function() {
var callbacks = $.Callbacks();
var FOCUS_TIMEOUT = 50,
cancelChangeTimestamp = null;
$(window).on(eventUtils.addNamespace("focus", SCROLLABLE_STRATEGY), function() {
cancelChangeTimestamp = $.now()
});
$(document).on(eventUtils.addNamespace(pointerEvents.down, SCROLLABLE_STRATEGY), function() {
cancelChangeTimestamp = $.now()
});
var focusChange = function(e) {
var keyboardElementChange = $.now() - cancelChangeTimestamp > FOCUS_TIMEOUT,
focusedCorrectElement = e.target === document.activeElement;
if (keyboardElementChange && focusedCorrectElement) {
callbacks.fire(e.target)
}
};
if (window.addEventListener) {
var asyncFocus = "onactivate" in document;
if (asyncFocus) {
window.addEventListener("activate", focusChange, true)
} else {
window.addEventListener("focus", focusChange, true)
}
} else {
window.attachEvent("onfocusin", focusChange)
}
return callbacks
}();
var InertiaAnimator = Animator.inherit({
ctor: function(scroller) {
this.callBase();
this.scroller = scroller
},
VELOCITY_LIMIT: MIN_VELOCITY_LIMIT,
_isFinished: function() {
return math.abs(this.scroller._velocity) <= this.VELOCITY_LIMIT
},
_step: function() {
this.scroller._scrollStep(this.scroller._velocity);
this.scroller._velocity *= this._acceleration()
},
_acceleration: function() {
return this.scroller._inBounds() ? ACCELERATION : OUT_BOUNDS_ACCELERATION
},
_complete: function() {
this.scroller._scrollComplete()
},
_stop: function() {
this.scroller._stopComplete()
}
});
var BounceAnimator = InertiaAnimator.inherit({
VELOCITY_LIMIT: BOUNCE_MIN_VELOCITY_LIMIT,
_isFinished: function() {
return this.scroller._crossBoundOnNextStep() || this.callBase()
},
_acceleration: function() {
return ACCELERATION
},
_complete: function() {
this.scroller._move(this.scroller._bounceLocation);
this.callBase()
}
});
var isWheelEvent = function(e) {
return "dxmousewheel" === e.type
};
var Scroller = Class.inherit({
ctor: function(options) {
this._initOptions(options);
this._initAnimators();
this._initScrollbar()
},
_initOptions: function(options) {
this._location = 0;
this._topReached = false;
this._bottomReached = false;
this._axis = options.direction === HORIZONTAL ? "x" : "y";
this._prop = options.direction === HORIZONTAL ? "left" : "top";
this._dimension = options.direction === HORIZONTAL ? "width" : "height";
this._scrollProp = options.direction === HORIZONTAL ? "scrollLeft" : "scrollTop";
this._pushBackCorrection = options.direction === VERTICAL ? 2 * options.pushBackValue : 0;
$.each(options, $.proxy(function(optionName, optionValue) {
this["_" + optionName] = optionValue
}, this))
},
_initAnimators: function() {
this._inertiaAnimator = new InertiaAnimator(this);
this._bounceAnimator = new BounceAnimator(this)
},
_initScrollbar: function() {
this._scrollbar = new Scrollbar($(" ").appendTo(this._$container), {
direction: this._direction,
visible: this._scrollByThumb,
visibilityMode: this._visibilityModeNormalize(this._scrollbarVisible),
expandable: this._scrollByThumb
});
this._$scrollbar = this._scrollbar.element()
},
_visibilityModeNormalize: function(mode) {
return true === mode ? "onScroll" : false === mode ? "never" : mode
},
_scrollStep: function(delta) {
var prevLocation = this._location;
this._location += delta;
this._suppressBounce();
this._move();
if (Math.abs(prevLocation - this._location) < 1) {
return
}
this._scrollAction();
this._$container.triggerHandler({
type: "scroll",
simulated: true
})
},
_suppressBounce: function() {
if (this._bounceEnabled || this._inBounds(this._location)) {
return
}
this._velocity = 0;
this._location = this._boundLocation()
},
_boundLocation: function(location) {
location = void 0 !== location ? location : this._location;
return math.max(math.min(location, this._maxOffset), this._minOffset)
},
_move: function(location) {
this._location = void 0 !== location ? location : this._location;
this._moveContent();
this._moveScrollbar()
},
_moveContent: function() {
var targetLocation = {};
targetLocation[this._prop] = this._location;
translator.move(this._$content, targetLocation)
},
_moveScrollbar: function() {
this._scrollbar.moveTo(this._location)
},
_scrollComplete: function() {
if (this._inBounds()) {
this._hideScrollbar();
this._correctLocation();
if (this._completeDeferred) {
this._completeDeferred.resolve()
}
}
this._scrollToBounds()
},
_correctLocation: function() {
this._location = math.round(this._location);
this._move()
},
_scrollToBounds: function() {
if (this._inBounds()) {
return
}
this._bounceAction();
this._setupBounce();
this._bounceAnimator.start()
},
_setupBounce: function() {
var boundLocation = this._bounceLocation = this._boundLocation(),
bounceDistance = boundLocation - this._location;
this._velocity = bounceDistance / BOUNCE_ACCELERATION_SUM
},
_inBounds: function(location) {
location = void 0 !== location ? location : this._location;
return this._boundLocation(location) === location
},
_crossBoundOnNextStep: function() {
var location = this._location,
nextLocation = location + this._velocity;
return location < this._minOffset && nextLocation >= this._minOffset || location > this._maxOffset && nextLocation <= this._maxOffset
},
_initHandler: function(e) {
this._stopDeferred = $.Deferred();
this._stopScrolling();
this._prepareThumbScrolling(e);
return this._stopDeferred.promise()
},
_stopScrolling: commonUtils.deferRenderer(function() {
this._hideScrollbar();
this._inertiaAnimator.stop();
this._bounceAnimator.stop()
}),
_prepareThumbScrolling: function(e) {
if (isWheelEvent(e.originalEvent)) {
return
}
var $target = $(e.originalEvent.target);
var scrollbarClicked = this._isScrollbar($target);
if (scrollbarClicked) {
this._moveToMouseLocation(e)
}
this._thumbScrolling = scrollbarClicked || this._isThumb($target);
this._crossThumbScrolling = !this._thumbScrolling && this._isAnyThumbScrolling($target);
if (this._thumbScrolling) {
this._scrollbar.feedbackOn()
}
},
_isThumbScrollingHandler: function($target) {
return this._isThumb($target)
},
_moveToMouseLocation: function(e) {
var mouseLocation = e["page" + this._axis.toUpperCase()] - this._$element.offset()[this._prop];
var location = this._location + mouseLocation / this._containerToContentRatio() - this._$container.height() / 2;
this._scrollStep(-location)
},
_stopComplete: function() {
if (this._stopDeferred) {
this._stopDeferred.resolve()
}
},
_startHandler: function() {
this._showScrollbar()
},
_moveHandler: function(delta) {
if (this._crossThumbScrolling) {
return
}
if (this._thumbScrolling) {
delta[this._axis] = -delta[this._axis] / this._containerToContentRatio()
}
this._scrollBy(delta)
},
_scrollBy: function(delta) {
delta = delta[this._axis];
if (!this._inBounds()) {
delta *= OUT_BOUNDS_ACCELERATION
}
this._scrollStep(delta)
},
_scrollByHandler: function(delta) {
this._scrollBy(delta);
this._scrollComplete()
},
_containerToContentRatio: function() {
return this._scrollbar.containerToContentRatio()
},
_endHandler: function(velocity) {
this._completeDeferred = $.Deferred();
this._velocity = velocity[this._axis];
this._inertiaHandler();
this._resetThumbScrolling();
return this._completeDeferred.promise()
},
_inertiaHandler: function() {
this._suppressInertia();
this._inertiaAnimator.start()
},
_suppressInertia: function() {
if (!this._inertiaEnabled || this._thumbScrolling) {
this._velocity = 0
}
},
_resetThumbScrolling: function() {
this._thumbScrolling = false;
this._crossThumbScrolling = false
},
_stopHandler: function() {
if (this._thumbScrolling) {
this._scrollComplete()
}
this._resetThumbScrolling();
this._scrollToBounds()
},
_disposeHandler: function() {
this._stopScrolling();
this._$scrollbar.remove()
},
_updateHandler: function() {
this._update();
this._moveToBounds()
},
_update: function() {
var that = this;
that._stopScrolling();
commonUtils.deferUpdate(function() {
that._updateLocation();
that._updateBounds();
that._updateScrollbar();
commonUtils.deferRender(function() {
that._moveScrollbar();
that._scrollbar.update()
})
})
},
_updateLocation: function() {
this._location = translator.locate(this._$content)[this._prop]
},
_updateBounds: function() {
this._maxOffset = this._getMaxOffset();
this._minOffset = this._getMinOffset()
},
_getMaxOffset: function() {
return 0
},
_getMinOffset: function() {
return math.min(this._containerSize() - this._contentSize(), 0)
},
_updateScrollbar: commonUtils.deferUpdater(function() {
var that = this,
containerSize = that._containerSize(),
contentSize = that._contentSize();
commonUtils.deferRender(function() {
that._scrollbar.option({
containerSize: containerSize,
contentSize: contentSize
})
})
}),
_moveToBounds: commonUtils.deferRenderer(commonUtils.deferUpdater(commonUtils.deferRenderer(function() {
var location = this._boundLocation();
var locationChanged = location !== this._location;
this._location = location;
this._move();
if (locationChanged) {
this._scrollAction()
}
}))),
_createActionsHandler: function(actions) {
this._scrollAction = actions.scroll;
this._bounceAction = actions.bounce
},
_showScrollbar: function() {
this._scrollbar.option("visible", true)
},
_hideScrollbar: function() {
this._scrollbar.option("visible", false)
},
_containerSize: function() {
return this._$container[this._dimension]()
},
_contentSize: function() {
var isOverflowHidden = "hidden" === this._$content.css("overflow-" + this._axis),
contentSize = this._$content[this._dimension]();
if (!isOverflowHidden) {
var containerScrollSize = this._$content[0]["scroll" + titleize(this._dimension)];
contentSize = math.max(containerScrollSize - this._pushBackCorrection, contentSize)
}
return contentSize
},
_validateEvent: function(e) {
var $target = $(e.originalEvent.target);
if (this._isThumb($target) || this._isScrollbar($target)) {
e.preventDefault();
return true
}
return this._isContent($target)
},
_isThumb: function($element) {
return this._scrollByThumb && this._scrollbar.isThumb($element)
},
_isScrollbar: function($element) {
return this._scrollByThumb && $element && $element.is(this._$scrollbar)
},
_isContent: function($element) {
return this._scrollByContent && !!$element.closest(this._$element).length
},
_reachedMin: function() {
return this._location <= this._minOffset
},
_reachedMax: function() {
return this._location >= this._maxOffset
},
_cursorEnterHandler: function() {
this._scrollbar.cursorEnter()
},
_cursorLeaveHandler: function() {
this._scrollbar.cursorLeave()
},
dispose: $.noop
});
var hoveredScrollable, activeScrollable;
var SimulatedStrategy = Class.inherit({
ctor: function(scrollable) {
this._init(scrollable)
},
_init: function(scrollable) {
this._component = scrollable;
this._$element = scrollable.element();
this._$container = scrollable._$container;
this._$content = scrollable._$content;
this.option = $.proxy(scrollable.option, scrollable);
this._createActionByOption = $.proxy(scrollable._createActionByOption, scrollable);
this._isLocked = $.proxy(scrollable._isLocked, scrollable);
this._isDirection = $.proxy(scrollable._isDirection, scrollable);
this._allowedDirection = $.proxy(scrollable._allowedDirection, scrollable);
this._proxiedActiveElementChangeHandler = $.proxy(this._activeElementChangeHandler, this);
scrollIntoViewIfNeededCallbacks.add(this._proxiedActiveElementChangeHandler)
},
_activeElementChangeHandler: function(activeElement) {
this._component.scrollToElement(activeElement)
},
render: function() {
this._$element.addClass(SCROLLABLE_SIMULATED_CLASS);
this._createScrollers();
if (this.option("useKeyboard")) {
this._$container.prop("tabindex", 0)
}
this._attachKeyboardHandler();
this._attachCursorHandlers()
},
_createScrollers: function() {
this._scrollers = {};
if (this._isDirection(HORIZONTAL)) {
this._createScroller(HORIZONTAL)
}
if (this._isDirection(VERTICAL)) {
this._createScroller(VERTICAL)
}
this._$element.toggleClass(SCROLLABLE_SCROLLBARS_ALWAYSVISIBLE, "always" === this.option("showScrollbar"));
this._$element.toggleClass(SCROLLABLE_SCROLLBARS_HIDDEN, !this.option("showScrollbar"))
},
_createScroller: function(direction) {
this._scrollers[direction] = new Scroller(this._scrollerOptions(direction))
},
_scrollerOptions: function(direction) {
return {
direction: direction,
$content: this._$content,
$container: this._$container,
$element: this._$element,
scrollByContent: this.option("scrollByContent"),
scrollByThumb: this.option("scrollByThumb"),
scrollbarVisible: this.option("showScrollbar"),
bounceEnabled: this.option("bounceEnabled"),
inertiaEnabled: this.option("inertiaEnabled"),
isAnyThumbScrolling: $.proxy(this._isAnyThumbScrolling, this),
pushBackValue: this.option("pushBackValue")
}
},
_isAnyThumbScrolling: function($target) {
var result = false;
this._eventHandler("isThumbScrolling", $target).done(function(isThumbScrollingVertical, isThumbScrollingHorizontal) {
result = isThumbScrollingVertical || isThumbScrollingHorizontal
});
return result
},
handleInit: function(e) {
this._suppressDirections(e);
this._eventForUserAction = e;
this._eventHandler("init", e).done(this._stopAction)
},
_suppressDirections: function(e) {
if (isWheelEvent(e.originalEvent)) {
this._prepareDirections(true);
return
}
this._prepareDirections();
this._eachScroller(function(scroller, direction) {
var isValid = scroller._validateEvent(e);
this._validDirections[direction] = isValid
})
},
_prepareDirections: function(value) {
value = value || false;
this._validDirections = {};
this._validDirections[HORIZONTAL] = value;
this._validDirections[VERTICAL] = value
},
_eachScroller: function(callback) {
callback = $.proxy(callback, this);
$.each(this._scrollers, function(direction, scroller) {
callback(scroller, direction)
})
},
handleStart: function(e) {
this._eventForUserAction = e;
this._eventHandler("start").done(this._startAction)
},
_saveActive: function() {
activeScrollable = this
},
_resetActive: function() {
if (activeScrollable === this) {
activeScrollable = null
}
},
handleMove: function(e) {
if (this._isLocked()) {
e.cancel = true;
this._resetActive();
return
}
this._saveActive();
e.preventDefault && e.preventDefault();
this._adjustDistance(e.delta);
this._eventForUserAction = e;
this._eventHandler("move", e.delta)
},
_adjustDistance: function(distance) {
distance.x *= this._validDirections[HORIZONTAL];
distance.y *= this._validDirections[VERTICAL]
},
handleEnd: function(e) {
this._resetActive();
this._refreshCursorState(e.originalEvent && e.originalEvent.target);
this._adjustDistance(e.velocity);
this._eventForUserAction = e;
return this._eventHandler("end", e.velocity).done(this._endAction)
},
handleCancel: function(e) {
this._resetActive();
this._eventForUserAction = e;
return this._eventHandler("end", {
x: 0,
y: 0
})
},
handleStop: function() {
this._resetActive();
this._eventHandler("stop")
},
handleScroll: function(e) {
if (e.simulated) {
return
}
var distance = {
left: this.option("direction") !== VERTICAL ? -this._$container.scrollLeft() : 0,
top: this.option("direction") !== HORIZONTAL ? -this._$container.scrollTop() : 0
};
if (!distance.left && !distance.top) {
return
}
this._$container.scrollLeft(0);
this._$container.scrollTop(0);
this.scrollBy(distance)
},
_attachKeyboardHandler: function() {
this._$element.off("." + SCROLLABLE_SIMULATED_KEYBOARD);
if (!this.option("disabled") && this.option("useKeyboard")) {
this._$element.on(eventUtils.addNamespace("keydown", SCROLLABLE_SIMULATED_KEYBOARD), $.proxy(this._keyDownHandler, this))
}
},
_keyDownHandler: function(e) {
if (!this._$container.is(document.activeElement)) {
return
}
var handled = true;
switch (e.keyCode) {
case KEY_CODES.DOWN:
this._scrollByLine({
y: 1
});
break;
case KEY_CODES.UP:
this._scrollByLine({
y: -1
});
break;
case KEY_CODES.RIGHT:
this._scrollByLine({
x: 1
});
break;
case KEY_CODES.LEFT:
this._scrollByLine({
x: -1
});
break;
case KEY_CODES.PAGE_DOWN:
this._scrollByPage(1);
break;
case KEY_CODES.PAGE_UP:
this._scrollByPage(-1);
break;
case KEY_CODES.HOME:
this._scrollToHome();
break;
case KEY_CODES.END:
this._scrollToEnd();
break;
default:
handled = false
}
if (handled) {
e.stopPropagation();
e.preventDefault()
}
},
_scrollByLine: function(lines) {
this.scrollBy({
top: (lines.y || 0) * -SCROLL_LINE_HEIGHT,
left: (lines.x || 0) * -SCROLL_LINE_HEIGHT
})
},
_scrollByPage: function(page) {
var prop = this._wheelProp(),
dimension = this._dimensionByProp(prop);
var distance = {};
distance[prop] = page * -this._$container[dimension]();
this.scrollBy(distance)
},
_dimensionByProp: function(prop) {
return "left" === prop ? "width" : "height"
},
_scrollToHome: function() {
var prop = this._wheelProp();
var distance = {};
distance[prop] = 0;
this._component.scrollTo(distance)
},
_scrollToEnd: function() {
var prop = this._wheelProp(),
dimension = this._dimensionByProp(prop);
var distance = {};
distance[prop] = this._$content[dimension]() - this._$container[dimension]();
this._component.scrollTo(distance)
},
createActions: function() {
this._startAction = this._createActionHandler("onStart");
this._stopAction = this._createActionHandler("onStop");
this._endAction = this._createActionHandler("onEnd");
this._updateAction = this._createActionHandler("onUpdated");
this._createScrollerActions()
},
_createScrollerActions: function() {
this._eventHandler("createActions", {
scroll: this._createActionHandler("onScroll"),
bounce: this._createActionHandler("onBounce")
})
},
_createActionHandler: function(optionName) {
var that = this,
actionHandler = that._createActionByOption(optionName);
return function() {
actionHandler($.extend(that._createActionArgs(), arguments))
}
},
_createActionArgs: function() {
var scrollerX = this._scrollers[HORIZONTAL],
scrollerY = this._scrollers[VERTICAL];
return {
jQueryEvent: this._eventForUserAction,
scrollOffset: {
top: scrollerY && -scrollerY._location,
left: scrollerX && -scrollerX._location
},
reachedLeft: scrollerX && scrollerX._reachedMax(),
reachedRight: scrollerX && scrollerX._reachedMin(),
reachedTop: scrollerY && scrollerY._reachedMax(),
reachedBottom: scrollerY && scrollerY._reachedMin()
}
},
_eventHandler: function(eventName) {
var args = $.makeArray(arguments).slice(1),
deferreds = $.map(this._scrollers, function(scroller) {
return scroller["_" + eventName + "Handler"].apply(scroller, args)
});
return $.when.apply($, deferreds).promise()
},
location: function() {
return translator.locate(this._$content)
},
disabledChanged: function() {
this._attachCursorHandlers()
},
_attachCursorHandlers: function() {
this._$element.off("." + SCROLLABLE_SIMULATED_CURSOR);
if (!this.option("disabled") && this._isHoverMode()) {
this._$element.on(eventUtils.addNamespace("mouseenter", SCROLLABLE_SIMULATED_CURSOR), $.proxy(this._cursorEnterHandler, this)).on(eventUtils.addNamespace("mouseleave", SCROLLABLE_SIMULATED_CURSOR), $.proxy(this._cursorLeaveHandler, this))
}
},
_isHoverMode: function() {
return "onHover" === this.option("showScrollbar")
},
_cursorEnterHandler: function(e) {
e = e || {};
e.originalEvent = e.originalEvent || {};
if (activeScrollable || e.originalEvent._hoverHandled) {
return
}
if (hoveredScrollable) {
hoveredScrollable._cursorLeaveHandler()
}
hoveredScrollable = this;
this._eventHandler("cursorEnter");
e.originalEvent._hoverHandled = true
},
_cursorLeaveHandler: function(e) {
if (hoveredScrollable !== this || activeScrollable === hoveredScrollable) {
return
}
this._eventHandler("cursorLeave");
hoveredScrollable = null;
this._refreshCursorState(e && e.relatedTarget)
},
_refreshCursorState: function(target) {
if (!this._isHoverMode() && (!target || activeScrollable)) {
return
}
var $target = $(target);
var $scrollable = $target.closest("." + SCROLLABLE_SIMULATED_CLASS + ":not(.dx-state-disabled)");
var targetScrollable = $scrollable.length && $scrollable.data(SCROLLABLE_STRATEGY);
if (hoveredScrollable && hoveredScrollable !== targetScrollable) {
hoveredScrollable._cursorLeaveHandler()
}
if (targetScrollable) {
targetScrollable._cursorEnterHandler()
}
},
update: function() {
var that = this;
var result = this._eventHandler("update").done(this._updateAction);
return $.when(result, commonUtils.deferUpdate(function() {
var allowedDirections = that._allowedDirections();
var allowedScroll = allowedDirections.vertical || allowedDirections.horizontal;
commonUtils.deferRender(function() {
that._$container.css("touchAction", allowedScroll ? "none" : "")
});
return $.when().promise()
}))
},
_allowedDirections: function() {
var bounceEnabled = this.option("bounceEnabled"),
verticalScroller = this._scrollers[VERTICAL],
horizontalScroller = this._scrollers[HORIZONTAL];
return {
vertical: verticalScroller && (verticalScroller._minOffset < 0 || bounceEnabled),
horizontal: horizontalScroller && (horizontalScroller._minOffset < 0 || bounceEnabled)
}
},
scrollBy: function(distance) {
var verticalScroller = this._scrollers[VERTICAL],
horizontalScroller = this._scrollers[HORIZONTAL];
if (verticalScroller) {
distance.top = verticalScroller._boundLocation(distance.top + verticalScroller._location) - verticalScroller._location
}
if (horizontalScroller) {
distance.left = horizontalScroller._boundLocation(distance.left + horizontalScroller._location) - horizontalScroller._location
}
this._prepareDirections(true);
this._startAction();
this._eventHandler("scrollBy", {
x: distance.left,
y: distance.top
});
this._endAction()
},
validate: function(e) {
if (this.option("disabled")) {
return false
}
if (this.option("bounceEnabled")) {
return true
}
return isWheelEvent(e) ? this._validateWheel(e) : this._validateMove(e)
},
_validateWheel: function(e) {
var scroller = this._scrollers[this._wheelDirection(e)];
var reachedMin = scroller._reachedMin();
var reachedMax = scroller._reachedMax();
var contentGreaterThanContainer = !reachedMin || !reachedMax;
var locatedNotAtBound = !reachedMin && !reachedMax;
var scrollFromMin = reachedMin && e.delta > 0;
var scrollFromMax = reachedMax && e.delta < 0;
return contentGreaterThanContainer && (locatedNotAtBound || scrollFromMin || scrollFromMax)
},
_validateMove: function(e) {
if (!this.option("scrollByContent") && !$(e.target).closest("." + SCROLLABLE_SCROLLBAR_CLASS).length) {
return false
}
return this._allowedDirection()
},
getDirection: function(e) {
return isWheelEvent(e) ? this._wheelDirection(e) : this._allowedDirection()
},
_wheelProp: function() {
return this._wheelDirection() === HORIZONTAL ? "left" : "top"
},
_wheelDirection: function(e) {
switch (this.option("direction")) {
case HORIZONTAL:
return HORIZONTAL;
case VERTICAL:
return VERTICAL;
default:
return e && e.shiftKey ? HORIZONTAL : VERTICAL
}
},
dispose: function() {
scrollIntoViewIfNeededCallbacks.remove(this._proxiedActiveElementChangeHandler);
this._resetActive();
if (hoveredScrollable === this) {
hoveredScrollable = null
}
this._eventHandler("dispose");
this._detachEventHandlers();
this._$element.removeClass(SCROLLABLE_SIMULATED_CLASS);
this._eventForUserAction = null;
clearTimeout(this._gestureEndTimer)
},
_detachEventHandlers: function() {
this._$element.off("." + SCROLLABLE_SIMULATED_CURSOR);
this._$container.off("." + SCROLLABLE_SIMULATED_KEYBOARD)
}
});
exports.SimulatedStrategy = SimulatedStrategy;
exports.Scroller = Scroller;
exports.ACCELERATION = ACCELERATION;
exports.MIN_VELOCITY_LIMIT = MIN_VELOCITY_LIMIT;
exports.FRAME_DURATION = FRAME_DURATION;
exports.SCROLL_LINE_HEIGHT = SCROLL_LINE_HEIGHT;
exports.scrollIntoViewIfNeededCallbacks = scrollIntoViewIfNeededCallbacks
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!************************************************!*\
!*** ./Scripts/ui/scroll_view/ui.scrollbar.js ***!
\************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
translator = __webpack_require__( /*! ../../animation/translator */ 15),
Widget = __webpack_require__( /*! ../widget/ui.widget */ 19),
eventUtils = __webpack_require__( /*! ../../events/utils */ 4),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
pointerEvents = __webpack_require__( /*! ../../events/pointer */ 13);
var SCROLLBAR = "dxScrollbar",
SCROLLABLE_SCROLLBAR_CLASS = "dx-scrollable-scrollbar",
SCROLLABLE_SCROLLBAR_ACTIVE_CLASS = SCROLLABLE_SCROLLBAR_CLASS + "-active",
SCROLLABLE_SCROLL_CLASS = "dx-scrollable-scroll",
SCROLLABLE_SCROLL_CONTENT_CLASS = "dx-scrollable-scroll-content",
HOVER_ENABLED_STATE = "dx-scrollbar-hoverable",
HORIZONTAL = "horizontal",
THUMB_MIN_SIZE = 15;
var SCROLLBAR_VISIBLE = {
onScroll: "onScroll",
onHover: "onHover",
always: "always",
never: "never"
};
var Scrollbar = Widget.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
direction: null,
visible: false,
activeStateEnabled: false,
visibilityMode: SCROLLBAR_VISIBLE.onScroll,
containerSize: 0,
contentSize: 0,
expandable: true
})
},
_init: function() {
this.callBase();
this._isHovered = false
},
_render: function() {
this._renderThumb();
this.callBase();
this._renderDirection();
this._update();
this._attachPointerDownHandler();
this.option("hoverStateEnabled", this._isHoverMode());
this.element().toggleClass(HOVER_ENABLED_STATE, this.option("hoverStateEnabled"))
},
_renderThumb: function() {
this._$thumb = $(" ").addClass(SCROLLABLE_SCROLL_CLASS);
$(" ").addClass(SCROLLABLE_SCROLL_CONTENT_CLASS).appendTo(this._$thumb);
this.element().addClass(SCROLLABLE_SCROLLBAR_CLASS).append(this._$thumb)
},
isThumb: function($element) {
return !!this.element().find($element).length
},
_isHoverMode: function() {
var visibilityMode = this.option("visibilityMode");
return (visibilityMode === SCROLLBAR_VISIBLE.onHover || visibilityMode === SCROLLBAR_VISIBLE.always) && this.option("expandable")
},
_renderDirection: function() {
var direction = this.option("direction");
this.element().addClass("dx-scrollbar-" + direction);
this._dimension = direction === HORIZONTAL ? "width" : "height";
this._prop = direction === HORIZONTAL ? "left" : "top"
},
_attachPointerDownHandler: function() {
this._$thumb.on(eventUtils.addNamespace(pointerEvents.down, SCROLLBAR), $.proxy(this.feedbackOn, this))
},
feedbackOn: function() {
this.element().addClass(SCROLLABLE_SCROLLBAR_ACTIVE_CLASS);
activeScrollbar = this
},
feedbackOff: function() {
this.element().removeClass(SCROLLABLE_SCROLLBAR_ACTIVE_CLASS);
activeScrollbar = null
},
cursorEnter: function() {
this._isHovered = true;
this.option("visible", true)
},
cursorLeave: function() {
this._isHovered = false;
this.option("visible", false)
},
_renderDimensions: function() {
this._$thumb.css({
width: this.option("width"),
height: this.option("height")
})
},
_toggleVisibility: function(visible) {
if (this.option("visibilityMode") === SCROLLBAR_VISIBLE.onScroll) {
this._$thumb.css("opacity")
}
visible = this._adjustVisibility(visible);
this.option().visible = visible;
this._$thumb.toggleClass("dx-state-invisible", !visible)
},
_adjustVisibility: function(visible) {
if (this.containerToContentRatio() && !this._needScrollbar()) {
return false
}
switch (this.option("visibilityMode")) {
case SCROLLBAR_VISIBLE.onScroll:
break;
case SCROLLBAR_VISIBLE.onHover:
visible = visible || !!this._isHovered;
break;
case SCROLLBAR_VISIBLE.never:
visible = false;
break;
case SCROLLBAR_VISIBLE.always:
visible = true
}
return visible
},
moveTo: function(location) {
if (this._isHidden()) {
return
}
if ($.isPlainObject(location)) {
location = location[this._prop] || 0
}
var scrollBarLocation = {
left: 0,
top: 0
};
scrollBarLocation[this._prop] = this._calculateScrollBarPosition(location);
translator.move(this._$thumb, scrollBarLocation)
},
_calculateScrollBarPosition: function(location) {
return -location * this._thumbRatio
},
_update: function() {
var containerSize = this.option("containerSize"),
contentSize = this.option("contentSize");
this._containerToContentRatio = contentSize ? containerSize / contentSize : containerSize;
var thumbSize = Math.round(Math.max(Math.round(containerSize * this._containerToContentRatio), THUMB_MIN_SIZE));
this._thumbRatio = (containerSize - thumbSize) / (contentSize - containerSize);
this.option(this._dimension, thumbSize);
this.element().css("display", this._needScrollbar() ? "" : "none")
},
_isHidden: function() {
return this.option("visibilityMode") === SCROLLBAR_VISIBLE.never
},
_needScrollbar: function() {
return !this._isHidden() && this._containerToContentRatio < 1
},
containerToContentRatio: function() {
return this._containerToContentRatio
},
_normalizeSize: function(size) {
return $.isPlainObject(size) ? size[this._dimension] || 0 : size
},
_clean: function() {
this.callBase();
if (this === activeScrollbar) {
activeScrollbar = null
}
this._$thumb.off("." + SCROLLBAR)
},
_optionChanged: function(args) {
if (this._isHidden()) {
return
}
switch (args.name) {
case "containerSize":
case "contentSize":
this.option()[args.name] = this._normalizeSize(args.value);
this._update();
break;
case "visibilityMode":
case "direction":
this._invalidate();
break;
default:
this.callBase.apply(this, arguments)
}
},
update: commonUtils.deferRenderer(function() {
this._adjustVisibility() && this.option("visible", true)
})
});
Scrollbar.publicName(SCROLLBAR);
var activeScrollbar = null;
$(document).on(eventUtils.addNamespace(pointerEvents.up, SCROLLBAR), function() {
if (activeScrollbar) {
activeScrollbar.feedbackOff()
}
});
module.exports = Scrollbar
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!******************************!*\
!*** ./Scripts/ui/slider.js ***!
\******************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
module.exports = __webpack_require__( /*! ./slider/ui.slider */ 404)
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/ui/slider/ui.slider_handle.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Widget = __webpack_require__( /*! ../widget/ui.widget */ 19),
Tooltip = __webpack_require__( /*! ../tooltip */ 171),
translator = __webpack_require__( /*! ../../animation/translator */ 15),
positionUtils = __webpack_require__( /*! ../../animation/position */ 65),
numberLocalization = __webpack_require__( /*! ../../localization/number */ 38);
var SLIDER_CLASS = "dx-slider",
SLIDER_HANDLE_CLASS = "dx-slider-handle";
var POSITION_ALIASES = {
top: {
my: "bottom center",
at: "top center",
collision: "none"
},
bottom: {
my: "top center",
at: "bottom center",
collision: "none"
},
right: {
my: "left center",
at: "right center",
collision: "none"
},
left: {
my: "right center",
at: "left center",
collision: "none"
}
};
var SliderHandle = Widget.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
hoverStateEnabled: false,
value: 0,
tooltipEnabled: false,
tooltipFormat: function(v) {
return v
},
tooltipPosition: "top",
tooltipShowMode: "onHover",
tooltipFitIn: null
})
},
_render: function() {
this.callBase();
this.element().addClass(SLIDER_HANDLE_CLASS);
this._renderTooltip();
this.setAria({
role: "slider",
valuenow: this.option("value")
})
},
_renderTooltip: function() {
if (this.option("tooltipEnabled")) {
if (!this._$tooltip) {
this._$tooltip = $(" ").appendTo(this.element())
}
this._$slider = this.element().closest("." + SLIDER_CLASS);
this._updateTooltip()
} else {
this._removeTooltip()
}
},
_createTooltip: function() {
if (this._tooltip) {
return false
}
this._tooltip = this._createComponent(this._$tooltip, Tooltip, {
visible: true,
target: this.element(),
closeOnOutsideClick: false,
container: this.element(),
closeOnBackButton: false,
closeOnTargetScroll: false,
onPositioned: $.proxy(function(args) {
this._saveTooltipElements(args.component);
this._saveTooltipLocation();
this._centeredTooltipPosition()
}, this),
animation: null,
arrowPosition: null
});
return true
},
_removeTooltip: function() {
if (!this._$tooltip) {
return
}
this._$tooltip.remove();
delete this._$tooltip;
delete this._tooltip
},
_renderTooltipPosition: function() {
if (!this._tooltip) {
return
}
var position = this.option("tooltipPosition");
this._saveTooltipElements();
this._resetTooltipPosition();
if ("string" === $.type(position)) {
position = $.extend({
boundary: this._$slider,
boundaryOffset: {
h: 1,
v: 1
}
}, POSITION_ALIASES[position])
}
this._tooltip.option("position", position);
this._saveTooltipLocation()
},
_saveTooltipElements: function(tooltip) {
tooltip = this._tooltip || tooltip;
this._$tooltipContent = tooltip.content().parent();
this._$tooltipArrow = this._$tooltipContent.find(".dx-popover-arrow")
},
_resetTooltipPosition: function() {
translator.resetPosition(this._$tooltipContent);
translator.resetPosition(this._$tooltipArrow)
},
_saveTooltipLocation: function() {
this._contentLocate = translator.locate(this._$tooltipContent)
},
_centeredTooltipPosition: function() {
if (!this._tooltip) {
return
}
this._$tooltipContent.outerWidth("auto");
var outerWidthWithoutRounding = this._$tooltipContent.get(0).getBoundingClientRect().width;
var tooltipOuterWidth = Math.ceil(outerWidthWithoutRounding);
var roundedTooltipOuterWidth = tooltipOuterWidth % 2 + tooltipOuterWidth;
this._$tooltipContent.outerWidth(roundedTooltipOuterWidth);
var tooltipCenter = (roundedTooltipOuterWidth - this.element().width()) / 2;
this._contentLocate.left = -tooltipCenter;
this._$tooltipArrow.css({
marginLeft: -this._$tooltipArrow.outerWidth() / 2,
left: "50%"
});
this._fitTooltip()
},
_fitTooltip: function() {
if (!this._tooltip) {
return
}
var position = this.option("tooltipPosition");
if ("string" === $.type(position)) {
position = $.extend({
of: this.element(),
boundary: this._$slider,
boundaryOffset: {
h: 2,
v: 1
}
}, POSITION_ALIASES[position], {
collision: "fit none"
})
}
var calculatePosition = positionUtils.calculate(this._$tooltipContent, position);
var isLeftSide = "left" === calculatePosition.h.collisionSide;
translator.move(this._$tooltipContent, {
left: this._contentLocate.left + (isLeftSide ? 1 : -1) * calculatePosition.h.oversize
});
translator.move(this._$tooltipArrow, {
left: (isLeftSide ? -1 : 1) * calculatePosition.h.oversize
})
},
_renderValue: function() {
if (!this._tooltip) {
return
}
var formattedValue = numberLocalization.format(this.option("value"), this.option("tooltipFormat"));
this._tooltip.content().html(formattedValue);
this._fitTooltip()
},
_updateTooltip: function() {
var hoverMode = /^onhover$/i.test(this.option("tooltipShowMode"));
if (!hoverMode) {
this._createTooltip()
}
this.element().toggleClass("dx-slider-tooltip-on-hover", hoverMode);
this._renderTooltipPosition();
this._renderValue();
this._centeredTooltipPosition()
},
_clean: function() {
this.callBase();
delete this._$tooltip;
delete this._tooltip
},
_optionChanged: function(args) {
switch (args.name) {
case "tooltipFormat":
this._renderValue();
break;
case "value":
this._renderValue();
if (args.value.toString().length !== args.previousValue.toString().length) {
this._centeredTooltipPosition()
}
this.setAria("valuenow", args.value);
break;
case "tooltipEnabled":
this._renderTooltip();
break;
case "tooltipPosition":
this._renderTooltipPosition();
this._centeredTooltipPosition();
break;
case "tooltipShowMode":
this._updateTooltip();
break;
case "tooltipFitIn":
this._fitTooltip();
break;
case "_templates":
case "templateProvider":
break;
default:
this.callBase(args)
}
},
fitTooltipPosition: function() {
this._fitTooltip()
},
updateTooltip: function() {
if (!this._createTooltip()) {
return
}
this._renderTooltipPosition();
this._renderValue();
this._centeredTooltipPosition()
},
repaint: function() {
this._renderTooltipPosition();
this._centeredTooltipPosition();
if (this._tooltip) {
this._tooltip._visibilityChanged(true)
}
}
});
module.exports = SliderHandle
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*********************************!*\
!*** ./Scripts/ui/tab_panel.js ***!
\*********************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
support = __webpack_require__( /*! ../core/utils/support */ 18),
devices = __webpack_require__( /*! ../core/devices */ 7),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 3),
MultiView = __webpack_require__( /*! ./multi_view */ 245),
Tabs = __webpack_require__( /*! ./tabs */ 157);
var TABPANEL_CLASS = "dx-tabpanel",
TABPANEL_TABS_CLASS = "dx-tabpanel-tabs",
TABPANEL_CONTAINER_CLASS = "dx-tabpanel-container";
var TabPanel = MultiView.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
itemTitleTemplate: "title",
hoverStateEnabled: true,
showNavButtons: false,
scrollByContent: true,
scrollingEnabled: true,
onTitleClick: null,
onTitleHold: null,
onTitleRendered: null
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function(device) {
return "desktop" === devices.real().deviceType && !devices.isSimulator()
},
options: {
focusStateEnabled: true
}
}, {
device: function(device) {
return !support.touch
},
options: {
swipeEnabled: false
}
}, {
device: {
platform: "generic"
},
options: {
animationEnabled: false
}
}])
},
_init: function() {
this.callBase();
this.element().addClass(TABPANEL_CLASS);
this.setAria("role", "tabpanel");
this._renderLayout()
},
_renderContent: function() {
var that = this;
this.callBase();
if (this.option("templatesRenderAsynchronously")) {
this._resizeEventTimer = setTimeout(function() {
that._updateLayout()
}, 0)
}
},
_renderLayout: function() {
var $element = this.element();
this._$tabContainer = $(" ").addClass(TABPANEL_TABS_CLASS).appendTo($element);
var $tabs = $(" ").appendTo(this._$tabContainer);
this._tabs = this._createComponent($tabs, Tabs, this._tabConfig());
this._$container = $(" ").addClass(TABPANEL_CONTAINER_CLASS).appendTo($element);
this._$container.append(this._$wrapper);
this._updateLayout()
},
_updateLayout: function() {
var tabsHeight = this._$tabContainer.outerHeight();
this._$container.css({
"margin-top": -tabsHeight,
"padding-top": tabsHeight
})
},
_refreshActiveDescendant: function() {
var tabs = this._tabs,
tabItems = tabs.itemElements(),
$activeTab = $(tabItems[tabs.option("selectedIndex")]),
id = this.getFocusedItemId();
this.setAria("controls", void 0, $(tabItems));
this.setAria("controls", id, $activeTab)
},
_tabConfig: function() {
return {
selectOnFocus: true,
focusStateEnabled: this.option("focusStateEnabled"),
hoverStateEnabled: this.option("hoverStateEnabled"),
tabIndex: this.option("tabIndex"),
selectedIndex: this.option("selectedIndex"),
onItemClick: this.option("onTitleClick"),
onItemHold: this.option("onTitleHold"),
itemHoldTimeout: this.option("itemHoldTimeout"),
onSelectionChanged: $.proxy(function(e) {
this.option("selectedIndex", e.component.option("selectedIndex"));
this._refreshActiveDescendant()
}, this),
onItemRendered: this.option("onTitleRendered"),
itemTemplate: this._getTemplateByOption("itemTitleTemplate"),
items: this.option("items"),
noDataText: null,
scrollingEnabled: this.option("scrollingEnabled"),
scrollByContent: this.option("scrollByContent"),
showNavButtons: this.option("showNavButtons"),
itemTemplateProperty: "tabTemplate",
loopItemFocus: this.option("loop"),
selectionRequired: true,
onOptionChanged: $.proxy(function(args) {
var name = args.name,
value = args.value;
if ("focusedElement" === name) {
var id = value ? value.index() : value;
var newItem = value ? this._itemElements().eq(id) : value;
this.option("focusedElement", newItem)
}
}, this),
onFocusIn: $.proxy(function(args) {
this._focusInHandler(args.jQueryEvent)
}, this),
onFocusOut: $.proxy(function(args) {
this._focusOutHandler(args.jQueryEvent)
}, this)
}
},
_renderFocusTarget: function() {
this._focusTarget().attr("tabindex", -1);
this._refreshActiveDescendant()
},
_updateFocusState: function(e, isFocused) {
this.callBase(e, isFocused);
if (e.target === this._tabs._focusTarget().get(0)) {
this._toggleFocusClass(isFocused, this._focusTarget())
}
},
_setTabsOption: function(name, value) {
if (this._tabs) {
this._tabs.option(name, value)
}
},
_visibilityChanged: function(visible) {
if (visible) {
this._tabs._dimensionChanged();
this._updateLayout()
}
},
_optionChanged: function(args) {
var name = args.name,
value = args.value;
switch (name) {
case "dataSource":
this.callBase(args);
break;
case "items":
this._setTabsOption(name, value);
this._updateLayout();
this.callBase(args);
break;
case "selectedIndex":
case "selectedItem":
case "itemHoldTimeout":
case "focusStateEnabled":
case "hoverStateEnabled":
this._setTabsOption(name, value);
this.callBase(args);
break;
case "scrollingEnabled":
case "scrollByContent":
case "showNavButtons":
this._setTabsOption(name, value);
break;
case "focusedElement":
var id = value ? value.index() : value;
var newItem = value ? this._tabs._itemElements().eq(id) : value;
this._setTabsOption("focusedElement", newItem);
this.callBase(args);
this._tabs.focus();
break;
case "itemTitleTemplate":
this._setTabsOption("itemTemplate", this._getTemplateByOption("itemTitleTemplate"));
break;
case "onTitleClick":
this._setTabsOption("onItemClick", value);
break;
case "onTitleHold":
this._setTabsOption("onItemHold", value);
break;
case "onTitleRendered":
this._setTabsOption("onItemRendered", value);
break;
case "loop":
this._setTabsOption("loopItemFocus", value);
break;
default:
this.callBase(args)
}
},
_clean: function() {
clearTimeout(this._resizeEventTimer);
this.callBase()
}
});
registerComponent("dxTabPanel", TabPanel);
module.exports = TabPanel
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/ui/text_box/ui.text_editor.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 3),
TextEditorMask = __webpack_require__( /*! ./ui.text_editor.mask */ 409);
registerComponent("dxTextEditor", TextEditorMask);
module.exports = TextEditorMask
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************!*\
!*** ./Scripts/ui/text_box/utils.caret.js ***!
\********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
browser = __webpack_require__( /*! ../../core/utils/browser */ 22);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*****************************!*\
!*** ./Scripts/ui/toast.js ***!
\*****************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
commonUtils = __webpack_require__( /*! ../core/utils/common */ 2),
pointerEvents = __webpack_require__( /*! ../events/pointer */ 13),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 3),
Overlay = __webpack_require__( /*! ./overlay */ 49);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/ui/toolbar/ui.toolbar.base.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 3),
CollectionWidget = __webpack_require__( /*! ../collection/ui.collection_widget.edit */ 27);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*************************************************************!*\
!*** ./Scripts/ui/toolbar/ui.toolbar.strategy.list_base.js ***!
\*************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
ToolbarStrategy = __webpack_require__( /*! ./ui.toolbar.strategy */ 184),
translator = __webpack_require__( /*! ../../animation/translator */ 15),
hideTopOverlayCallback = __webpack_require__( /*! ../../mobile/hide_top_overlay */ 100).hideCallback,
fx = __webpack_require__( /*! ../../animation/fx */ 21),
Overlay = __webpack_require__( /*! ../overlay */ 49),
List = __webpack_require__( /*! ../list/ui.list.base */ 136);
var TOOLBAR_LIST_VISIBLE_CLASS = "dx-toolbar-list-visible",
SUBMENU_ANIMATION_EASING = "easeOutCubic",
SUBMENU_HIDE_DURATION = 200,
SUBMENU_SHOW_DURATION = 400;
var ListStrategy = ToolbarStrategy.inherit({
render: function() {
this._renderListOverlay();
this.callBase();
this._changeListVisible(this._toolbar.option("visible"))
},
_renderWidget: function() {
if (!this._hasVisibleMenuItems()) {
return
}
this.callBase()
},
_menuWidgetClass: function() {
return List
},
_menuContainer: function() {
return this._listOverlay.content()
},
_menuButtonOptions: function() {
return $.extend({}, this.callBase(), {
activeStateEnabled: false,
text: "..."
})
},
_widgetOptions: function() {
return $.extend({}, this.callBase(), {
width: "100%",
indicateLoading: false
})
},
_renderListOverlay: function() {
var $listOverlay = $(" ").appendTo(this._toolbar.element());
this._listOverlay = this._toolbar._createComponent($listOverlay, Overlay, this._listOverlayConfig())
},
_listOverlayConfig: function() {
return {
container: false,
deferRendering: false,
shading: false,
height: "auto",
width: "100%",
showTitle: false,
closeOnOutsideClick: $.proxy(this._listOutsideClickHandler, this),
position: null,
animation: null,
closeOnBackButton: false
}
},
_listOutsideClickHandler: function(e) {
if (!$(e.target).closest(this._listOverlay.content()).length) {
this._toggleMenu(false, true)
}
},
_getListHeight: function() {
var listHeight = this._listOverlay.content().find(".dx-list").height(),
semiHiddenHeight = this._toolbar._$toolbarItemsContainer.height() - this._toolbar.element().height();
return listHeight + semiHiddenHeight
},
_hideTopOverlayHandler: function() {
this._toggleMenu(false, true)
},
_toggleHideTopOverlayCallback: function() {
if (this._closeCallback) {
hideTopOverlayCallback.remove(this._closeCallback)
}
if (this._menuShown) {
this._closeCallback = $.proxy(this._hideTopOverlayHandler, this);
hideTopOverlayCallback.add(this._closeCallback)
}
},
_calculatePixelOffset: function(offset) {
offset = (offset || 0) - 1;
var maxOffset = this._getListHeight();
return offset * maxOffset
},
_renderMenuPosition: function(offset, animate) {
var pos = this._calculatePixelOffset(offset),
element = this._listOverlay.content();
if (animate) {
return this._animateMenuToggling(element, pos, this._menuShown)
}
translator.move(element, {
top: pos
});
return $.Deferred().resolve().promise()
},
_animateMenuToggling: function($element, position, isShowAnimation) {
var duration = isShowAnimation ? SUBMENU_SHOW_DURATION : SUBMENU_HIDE_DURATION;
return fx.animate($element, {
type: "slide",
to: {
top: position
},
easing: SUBMENU_ANIMATION_EASING,
duration: duration
})
},
_toggleMenu: function(visible, animate) {
this.callBase.apply(this, arguments);
this._toggleHideTopOverlayCallback();
this._renderMenuPosition(this._menuShown ? 0 : 1, animate).done($.proxy(function() {
this._toolbar.element().toggleClass(TOOLBAR_LIST_VISIBLE_CLASS, visible)
}, this))
},
_changeListVisible: function(value) {
if (this._listOverlay) {
this._listOverlay.option("visible", value);
this._toggleMenu(false, false)
}
},
handleToolbarVisibilityChange: function(value) {
this._changeListVisible(value)
}
});
module.exports = ListStrategy
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************!*\
!*** ./Scripts/ui/tooltip/tooltip.js ***!
\***************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Guid = __webpack_require__( /*! ../../core/guid */ 33),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 3),
Popover = __webpack_require__( /*! ../popover */ 95),
TOOLTIP_CLASS = "dx-tooltip",
TOOLTIP_WRAPPER_CLASS = "dx-tooltip-wrapper";
var Tooltip = Popover.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
toolbarItems: [],
showCloseButton: false,
showTitle: false,
title: null,
titleTemplate: null,
onTitleRendered: null,
bottomTemplate: null,
propagateOutsideClick: true
})
},
_render: function() {
this.element().addClass(TOOLTIP_CLASS);
this._wrapper().addClass(TOOLTIP_WRAPPER_CLASS);
this.callBase()
},
_renderContent: function() {
this.callBase();
this._contentId = new Guid;
this._$content.attr({
id: this._contentId,
role: "tooltip"
});
this._toggleAriaDescription(true)
},
_toggleAriaDescription: function(showing) {
var $target = $(this.option("target")),
label = showing ? this._contentId : void 0;
this.setAria("describedby", label, $target)
}
});
registerComponent("dxTooltip", Tooltip);
module.exports = Tooltip
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************!*\
!*** ./Scripts/ui/validation_group.js ***!
\****************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 3),
DOMComponent = __webpack_require__( /*! ../core/dom_component */ 39),
ValidationSummary = __webpack_require__( /*! ./validation_summary */ 186),
ValidationEngine = __webpack_require__( /*! ./validation_engine */ 64),
Validator = __webpack_require__( /*! ./validator */ 159);
var VALIDATION_ENGINE_CLASS = "dx-validationgroup";
var ValidationGroup = DOMComponent.inherit({
_getDefaultOptions: function() {
return this.callBase()
},
_init: function() {
this.callBase()
},
_render: function() {
var $element = this.element();
$element.addClass(VALIDATION_ENGINE_CLASS);
$element.find(".dx-validator").each(function(_, validatorContainer) {
Validator.getInstance($(validatorContainer))._initGroupRegistration()
});
$element.find(".dx-validationsummary").each(function(_, summaryContainer) {
ValidationSummary.getInstance($(summaryContainer))._initGroupRegistration()
});
this.callBase()
},
validate: function() {
return ValidationEngine.validateGroup(this)
},
reset: function() {
return ValidationEngine.resetGroup(this)
},
_optionChanged: function(args) {
switch (args.name) {
default: this.callBase(args)
}
},
_dispose: function() {
ValidationEngine.removeGroup(this);
this.element().removeClass(VALIDATION_ENGINE_CLASS);
this.callBase()
}
});
registerComponent("dxValidationGroup", ValidationGroup);
module.exports = ValidationGroup
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************************!*\
!*** ./Scripts/viz/core/renderers/svg_renderer.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
commonUtils = __webpack_require__( /*! ../../../core/utils/common */ 2),
doc = document,
animation = __webpack_require__( /*! ./animation */ 518),
math = Math,
mathMin = math.min,
mathMax = math.max,
mathFloor = math.floor,
mathRound = math.round,
mathSin = math.sin,
mathCos = math.cos,
mathAbs = math.abs,
mathPI = math.PI,
_isDefined = commonUtils.isDefined,
vizUtils = __webpack_require__( /*! ../utils */ 6),
_normalizeEnum = vizUtils.normalizeEnum,
_normalizeBBox = vizUtils.normalizeBBox,
_rotateBBox = vizUtils.rotateBBox,
PI_DIV_180 = mathPI / 180,
_parseInt = parseInt,
SHARPING_CORRECTION = .5,
ARC_COORD_PREC = 5;
var pxAddingExceptions = {
"column-count": true,
"fill-opacity": true,
"flex-grow": true,
"flex-shrink": true,
"font-weight": true,
"line-height": true,
opacity: true,
order: true,
orphans: true,
widows: true,
"z-index": true,
zoom: true
};
var KEY_TEXT = "text",
KEY_STROKE = "stroke",
KEY_STROKE_WIDTH = "stroke-width",
KEY_STROKE_OPACITY = "stroke-opacity",
KEY_FONT_SIZE = "font-size",
KEY_FONT_STYLE = "font-style",
KEY_FONT_WEIGHT = "font-weight",
KEY_TEXT_DECORATION = "text-decoration",
NONE = "none";
var objectCreate = function() {
if (!Object.create) {
return function(proto) {
var F = function() {};
F.prototype = proto;
return new F
}
} else {
return function(proto) {
return Object.create(proto)
}
}
}();
var DEFAULTS = {
scaleX: 1,
scaleY: 1
};
var backupContainer = doc.createElement("div"),
backupCounter = 0;
backupContainer.style.left = "-9999px";
backupContainer.style.position = "absolute";
function backupRoot(root) {
if (0 === backupCounter) {
doc.body.appendChild(backupContainer)
}++backupCounter;
root.append({
element: backupContainer
})
}
function restoreRoot(root, container) {
root.append({
element: container
});
--backupCounter;
if (0 === backupCounter) {
doc.body.removeChild(backupContainer)
}
}
var getNextDefsSvgId = function() {
var numDefsSvgElements = 1;
return function() {
return "DevExpress_" + numDefsSvgElements++
}
}();
function isObjectArgument(value) {
return value && "string" !== typeof value
}
function createElement(tagName) {
return doc.createElementNS("http://www.w3.org/2000/svg", tagName)
}
function getPatternUrl(id, pathModified) {
return null !== id ? "url(" + (pathModified ? window.location.href : "") + "#" + id + ")" : ""
}
function extend(target, source) {
var key;
for (key in source) {
target[key] = source[key]
}
return target
}
function roundValue(value, exp) {
value = value.toString().split("e");
value = mathRound(+(value[0] + "e" + (value[1] ? +value[1] + exp : exp)));
value = value.toString().split("e");
return +(value[0] + "e" + (value[1] ? +value[1] - exp : -exp))
}
var preserveAspectRatioMap = {
full: NONE,
lefttop: "xMinYMin",
leftcenter: "xMinYMid",
leftbottom: "xMinYMax",
centertop: "xMidYMin",
center: "xMidYMid",
centerbottom: "xMidYMax",
righttop: "xMaxYMin",
rightcenter: "xMaxYMid",
rightbottom: "xMaxYMax"
};
exports._normalizeArcParams = function(x, y, innerR, outerR, startAngle, endAngle) {
var isCircle, noArc = true,
angleDiff = roundValue(endAngle, 3) - roundValue(startAngle, 3);
if (angleDiff) {
if (mathAbs(angleDiff) % 360 === 0) {
startAngle = 0;
endAngle = 360;
isCircle = true;
endAngle -= .01
}
if (startAngle > 360) {
startAngle %= 360
}
if (endAngle > 360) {
endAngle %= 360
}
if (startAngle > endAngle) {
startAngle -= 360
}
noArc = false
}
startAngle *= PI_DIV_180;
endAngle *= PI_DIV_180;
return [x, y, mathMin(outerR, innerR), mathMax(outerR, innerR), mathCos(startAngle), mathSin(startAngle), mathCos(endAngle), mathSin(endAngle), isCircle, mathFloor(mathAbs(endAngle - startAngle) / mathPI) % 2 ? "1" : "0", noArc]
};
var applyEllipsis = getEllipsis(prepareLines, setNewText, removeTextSpan);
var buildArcPath = function(x, y, innerR, outerR, startAngleCos, startAngleSin, endAngleCos, endAngleSin, isCircle, longFlag) {
return ["M", (x + outerR * startAngleCos).toFixed(ARC_COORD_PREC), (y - outerR * startAngleSin).toFixed(ARC_COORD_PREC), "A", outerR.toFixed(ARC_COORD_PREC), outerR.toFixed(ARC_COORD_PREC), 0, longFlag, 0, (x + outerR * endAngleCos).toFixed(ARC_COORD_PREC), (y - outerR * endAngleSin).toFixed(ARC_COORD_PREC), isCircle ? "M" : "L", (x + innerR * endAngleCos).toFixed(5), (y - innerR * endAngleSin).toFixed(ARC_COORD_PREC), "A", innerR.toFixed(ARC_COORD_PREC), innerR.toFixed(ARC_COORD_PREC), 0, longFlag, 1, (x + innerR * startAngleCos).toFixed(ARC_COORD_PREC), (y - innerR * startAngleSin).toFixed(ARC_COORD_PREC), "Z"].join(" ")
};
function buildPathSegments(points, type) {
var list = [
["M", 0, 0]
];
switch (type) {
case "line":
list = buildLineSegments(points);
break;
case "area":
list = buildLineSegments(points, true);
break;
case "bezier":
list = buildCurveSegments(points);
break;
case "bezierarea":
list = buildCurveSegments(points, true)
}
return list
}
function buildLineSegments(points, close) {
return buildSegments(points, buildSimpleLineSegment, close)
}
function buildCurveSegments(points, close) {
return buildSegments(points, buildSimpleCurveSegment, close)
}
function buildSegments(points, buildSimpleSegment, close) {
var i, ii, list = [];
if (points[0] && points[0].length) {
for (i = 0, ii = points.length; i < ii; ++i) {
buildSimpleSegment(points[i], close, list)
}
} else {
buildSimpleSegment(points, close, list)
}
return list
}
function buildSimpleLineSegment(points, close, list) {
var i = 0,
k0 = list.length,
k = k0,
ii = (points || []).length;
if (ii) {
if (void 0 !== points[0].x) {
for (; i < ii;) {
list[k++] = ["L", points[i].x, points[i++].y]
}
} else {
for (; i < ii;) {
list[k++] = ["L", points[i++], points[i++]]
}
}
list[k0][0] = "M"
} else {
list[k] = ["M", 0, 0]
}
close && list.push(["Z"]);
return list
}
function buildSimpleCurveSegment(points, close, list) {
var i, k = list.length,
ii = (points || []).length;
if (ii) {
if (void 0 !== points[0].x) {
list[k++] = ["M", points[0].x, points[0].y];
for (i = 1; i < ii;) {
list[k++] = ["C", points[i].x, points[i++].y, points[i].x, points[i++].y, points[i].x, points[i++].y]
}
} else {
list[k++] = ["M", points[0], points[1]];
for (i = 2; i < ii;) {
list[k++] = ["C", points[i++], points[i++], points[i++], points[i++], points[i++], points[i++]]
}
}
} else {
list[k] = ["M", 0, 0]
}
close && list.push(["Z"]);
return list
}
function combinePathParam(segments) {
var i, segment, j, jj, d = [],
k = 0,
ii = segments.length;
for (i = 0; i < ii; ++i) {
segment = segments[i];
for (j = 0, jj = segment.length; j < jj; ++j) {
d[k++] = segment[j]
}
}
return d.join(" ")
}
function compensateSegments(oldSegments, newSegments, type) {
var i, originalNewSegments, oldLength = oldSegments.length,
newLength = newSegments.length,
makeEqualSegments = -1 !== type.indexOf("area") ? makeEqualAreaSegments : makeEqualLineSegments;
if (0 === oldLength) {
for (i = 0; i < newLength; i++) {
oldSegments.push(newSegments[i].slice(0))
}
} else {
if (oldLength < newLength) {
makeEqualSegments(oldSegments, newSegments, type)
} else {
if (oldLength > newLength) {
originalNewSegments = newSegments.slice(0);
makeEqualSegments(newSegments, oldSegments, type)
}
}
}
return originalNewSegments
}
function prepareConstSegment(constSeg, type) {
var x = constSeg[constSeg.length - 2],
y = constSeg[constSeg.length - 1];
switch (type) {
case "line":
case "area":
constSeg[0] = "L";
break;
case "bezier":
case "bezierarea":
constSeg[0] = "C";
constSeg[1] = constSeg[3] = constSeg[5] = x;
constSeg[2] = constSeg[4] = constSeg[6] = y
}
}
function makeEqualLineSegments(short, long, type) {
var constSeg = short[short.length - 1].slice(),
i = short.length;
prepareConstSegment(constSeg, type);
for (; i < long.length; i++) {
short[i] = constSeg.slice(0)
}
}
function makeEqualAreaSegments(short, long, type) {
var i, head, constsSeg1, constsSeg2, shortLength = short.length,
longLength = long.length;
if ((shortLength - 1) % 2 === 0 && (longLength - 1) % 2 === 0) {
i = (shortLength - 1) / 2 - 1;
head = short.slice(0, i + 1);
constsSeg1 = head[head.length - 1].slice(0);
constsSeg2 = short.slice(i + 1)[0].slice(0);
prepareConstSegment(constsSeg1, type);
prepareConstSegment(constsSeg2, type);
for (var j = i; j < (longLength - 1) / 2 - 1; j++) {
short.splice(j + 1, 0, constsSeg1);
short.splice(j + 3, 0, constsSeg2)
}
}
}
function baseCss(that, styles) {
var key, value, elemStyles = that._styles,
str = "";
styles = styles || {};
for (key in styles) {
value = styles[key];
if (_isDefined(value)) {
if ("number" === typeof value && !pxAddingExceptions[key]) {
value += "px"
}
elemStyles[key] = "" !== value ? value : null
}
}
for (key in elemStyles) {
value = elemStyles[key];
if (value) {
str += key + ":" + value + ";"
}
}
str && that.element.setAttribute("style", str);
return that
}
function baseAttr(that, attrs, inh) {
attrs = attrs || {};
var key, value, hasTransformations, recalculateDashStyle, sw, i, settings = that._settings,
attributes = {},
elem = that.element,
renderer = that.renderer,
rtl = renderer.rtl;
if (!isObjectArgument(attrs)) {
if (attrs in settings) {
return settings[attrs]
}
if (attrs in DEFAULTS) {
return DEFAULTS[attrs]
}
return 0
}
extend(attributes, attrs);
for (key in attributes) {
value = attributes[key];
if (void 0 === value) {
continue
}
settings[key] = value;
if ("align" === key) {
key = "text-anchor";
value = {
left: rtl ? "end" : "start",
center: "middle",
right: rtl ? "start" : "end"
}[value] || ""
} else {
if ("dashStyle" === key) {
recalculateDashStyle = true;
continue
} else {
if (key === KEY_STROKE_WIDTH) {
recalculateDashStyle = true
} else {
if ("clipId" === key) {
key = "clip-path";
value = getPatternUrl(value, renderer.pathModified)
} else {
if (/^(translate(X|Y)|rotate[XY]?|scale(X|Y)|sharp)$/i.test(key)) {
hasTransformations = true;
continue
} else {
if (/^(x|y|d)$/i.test(key)) {
hasTransformations = true
}
}
}
}
}
}
if (null === value) {
elem.removeAttribute(key)
} else {
elem.setAttribute(key, value)
}
}
if (recalculateDashStyle && "dashStyle" in settings) {
value = settings.dashStyle;
sw = ("_originalSW" in that ? that._originalSW : settings[KEY_STROKE_WIDTH]) || 1;
key = "stroke-dasharray";
value = null === value ? "" : _normalizeEnum(value);
if ("" === value || "solid" === value || value === NONE) {
that.element.removeAttribute(key)
} else {
value = value.replace(/longdash/g, "8,3,").replace(/dash/g, "4,3,").replace(/dot/g, "1,3,").replace(/,$/, "").split(",");
i = value.length;
while (i--) {
value[i] = _parseInt(value[i]) * sw
}
that.element.setAttribute(key, value.join(","))
}
}
if (hasTransformations) {
that._applyTransformation()
}
return that
}
function createPathAttr(baseAttr) {
return function(attrs, inh) {
var segments, that = this;
if (isObjectArgument(attrs)) {
attrs = extend({}, attrs);
segments = attrs.segments;
if ("points" in attrs) {
segments = buildPathSegments(attrs.points, that.type);
delete attrs.points
}
if (segments) {
attrs.d = combinePathParam(segments);
that.segments = segments;
delete attrs.segments
}
}
return baseAttr(that, attrs, inh)
}
}
function createArcAttr(baseAttr, buildArcPath) {
return function(attrs, inh) {
var x, y, innerRadius, outerRadius, startAngle, endAngle, settings = this._settings;
if (isObjectArgument(attrs)) {
attrs = extend({}, attrs);
if ("x" in attrs || "y" in attrs || "innerRadius" in attrs || "outerRadius" in attrs || "startAngle" in attrs || "endAngle" in attrs) {
settings.x = x = "x" in attrs ? attrs.x : settings.x;
delete attrs.x;
settings.y = y = "y" in attrs ? attrs.y : settings.y;
delete attrs.y;
settings.innerRadius = innerRadius = "innerRadius" in attrs ? attrs.innerRadius : settings.innerRadius;
delete attrs.innerRadius;
settings.outerRadius = outerRadius = "outerRadius" in attrs ? attrs.outerRadius : settings.outerRadius;
delete attrs.outerRadius;
settings.startAngle = startAngle = "startAngle" in attrs ? attrs.startAngle : settings.startAngle;
delete attrs.startAngle;
settings.endAngle = endAngle = "endAngle" in attrs ? attrs.endAngle : settings.endAngle;
delete attrs.endAngle;
attrs.d = buildArcPath.apply(null, exports._normalizeArcParams(x, y, innerRadius, outerRadius, startAngle, endAngle))
}
}
return baseAttr(this, attrs, inh)
}
}
function createRectAttr(baseAttr) {
return function(attrs, inh) {
var x, y, width, height, sw, maxSW, newSW, that = this;
if (isObjectArgument(attrs)) {
attrs = extend({}, attrs);
if (!inh && (void 0 !== attrs.x || void 0 !== attrs.y || void 0 !== attrs.width || void 0 !== attrs.height || void 0 !== attrs[KEY_STROKE_WIDTH])) {
void 0 !== attrs.x ? x = that._originalX = attrs.x : x = that._originalX || 0;
void 0 !== attrs.y ? y = that._originalY = attrs.y : y = that._originalY || 0;
void 0 !== attrs.width ? width = that._originalWidth = attrs.width : width = that._originalWidth || 0;
void 0 !== attrs.height ? height = that._originalHeight = attrs.height : height = that._originalHeight || 0;
void 0 !== attrs[KEY_STROKE_WIDTH] ? sw = that._originalSW = attrs[KEY_STROKE_WIDTH] : sw = that._originalSW;
maxSW = ~~((width < height ? width : height) / 2);
newSW = (sw || 0) < maxSW ? sw || 0 : maxSW;
attrs.x = x + newSW / 2;
attrs.y = y + newSW / 2;
attrs.width = width - newSW;
attrs.height = height - newSW;
((sw || 0) !== newSW || !(0 === newSW && void 0 === sw)) && (attrs[KEY_STROKE_WIDTH] = newSW)
}
if ("sharp" in attrs) {
delete attrs.sharp
}
}
return baseAttr(that, attrs, inh)
}
}
var pathAttr = createPathAttr(baseAttr),
arcAttr = createArcAttr(baseAttr, buildArcPath),
rectAttr = createRectAttr(baseAttr);
function textAttr(attrs) {
var settings, isResetRequired, wasStroked, isStroked, that = this;
if (!isObjectArgument(attrs)) {
return baseAttr(that, attrs)
}
attrs = extend({}, attrs);
settings = that._settings;
wasStroked = _isDefined(settings[KEY_STROKE]) && _isDefined(settings[KEY_STROKE_WIDTH]);
if (void 0 !== attrs[KEY_TEXT]) {
settings[KEY_TEXT] = attrs[KEY_TEXT];
delete attrs[KEY_TEXT];
isResetRequired = true
}
if (void 0 !== attrs[KEY_STROKE]) {
settings[KEY_STROKE] = attrs[KEY_STROKE];
delete attrs[KEY_STROKE]
}
if (void 0 !== attrs[KEY_STROKE_WIDTH]) {
settings[KEY_STROKE_WIDTH] = attrs[KEY_STROKE_WIDTH];
delete attrs[KEY_STROKE_WIDTH]
}
if (void 0 !== attrs[KEY_STROKE_OPACITY]) {
settings[KEY_STROKE_OPACITY] = attrs[KEY_STROKE_OPACITY];
delete attrs[KEY_STROKE_OPACITY]
}
isStroked = _isDefined(settings[KEY_STROKE]) && _isDefined(settings[KEY_STROKE_WIDTH]);
baseAttr(that, attrs);
isResetRequired = isResetRequired || isStroked !== wasStroked && settings[KEY_TEXT];
if (isResetRequired) {
createTextNodes(that, settings.text, isStroked)
}
if (isResetRequired || void 0 !== attrs.x || void 0 !== attrs.y) {
locateTextNodes(that)
}
if (isStroked) {
strokeTextNodes(that)
}
return that
}
function textCss(styles) {
styles = styles || {};
baseCss(this, styles);
if (KEY_FONT_SIZE in styles) {
locateTextNodes(this)
}
return this
}
function orderHtmlTree(list, line, node, parentStyle, parentClassName) {
var style, realStyle, i, ii, nodes;
if (void 0 !== node.wholeText) {
list.push({
value: node.wholeText,
style: parentStyle,
className: parentClassName,
line: line,
height: parentStyle[KEY_FONT_SIZE] || 0
})
} else {
if ("BR" === node.tagName) {
++line
} else {
extend(style = {}, parentStyle);
switch (node.tagName) {
case "B":
case "STRONG":
style[KEY_FONT_WEIGHT] = "bold";
break;
case "I":
case "EM":
style[KEY_FONT_STYLE] = "italic";
break;
case "U":
style[KEY_TEXT_DECORATION] = "underline"
}
realStyle = node.style;
realStyle.color && (style.fill = realStyle.color);
realStyle.fontSize && (style[KEY_FONT_SIZE] = _parseInt(realStyle.fontSize, 10));
realStyle.fontStyle && (style[KEY_FONT_STYLE] = realStyle.fontStyle);
realStyle.fontWeight && (style[KEY_FONT_WEIGHT] = realStyle.fontWeight);
realStyle.textDecoration && (style[KEY_TEXT_DECORATION] = realStyle.textDecoration);
for (i = 0, nodes = node.childNodes, ii = nodes.length; i < ii; ++i) {
line = orderHtmlTree(list, line, nodes[i], style, node.className || parentClassName)
}
}
}
return line
}
function adjustLineHeights(items) {
var i, ii, item, currentItem = items[0];
for (i = 1, ii = items.length; i < ii; ++i) {
item = items[i];
if (item.line === currentItem.line) {
currentItem.height = mathMax(currentItem.height, item.height);
currentItem.inherits = currentItem.inherits || 0 === item.height;
item.height = NaN
} else {
currentItem = item
}
}
}
function removeExtraAttrs(html) {
var regex1 = /(<\S+)(\s+(?!(style))\S+\s*=\s*['"][^'"]*['"])*/gi,
regex2 = /<([a-z]*)(?:[^>]*?((?:\s(?:style)=\s*(["'])(?:(?!\3).)*\3)))[^>]*?(\/?)>/gi;
return html.replace(regex1, "$1").replace(regex2, "<$1$2$4>")
}
function parseHTML(text) {
var items = [],
div = doc.createElement("div");
div.innerHTML = text.replace(/\r/g, "").replace(/\n/g, " ");
orderHtmlTree(items, 0, div, {}, "");
adjustLineHeights(items);
return items
}
function parseMultiline(text) {
var texts = text.replace(/\r/g, "").split("\n"),
i = 0,
items = [];
for (; i < texts.length; i++) {
items.push({
value: texts[i],
height: 0
})
}
return items
}
function createTspans(items, element, fieldName) {
var i, ii, item;
for (i = 0, ii = items.length; i < ii; ++i) {
item = items[i];
item[fieldName] = createElement("tspan");
item[fieldName].appendChild(doc.createTextNode(item.value));
item.style && baseCss({
element: item[fieldName],
_styles: {}
}, item.style);
item.className && item[fieldName].setAttribute("class", item.className);
element.appendChild(item[fieldName])
}
}
function getEllipsis(prepareLines, setNewText, removeTextSpan) {
return function(maxWidth) {
var lines, requiredLength, i, ii, lineParts, j, jj, text, element = this.element,
width = this.getBBox().width,
maxLength = 0,
hasEllipsis = false;
if (maxWidth < 0) {
maxWidth = 0
}
if (width > maxWidth) {
lines = prepareLines(element, this._texts);
for (i = 0, ii = lines.length; i < ii; ++i) {
maxLength = mathMax(maxLength, lines[i].commonLength)
}
if (1 === maxLength) {
return false
}
requiredLength = mathFloor(maxLength * maxWidth / width);
for (i = 0; i < ii; ++i) {
lineParts = lines[i].parts;
for (j = 0, jj = lineParts.length; j < jj; ++j) {
text = lineParts[j];
if (text.startIndex <= requiredLength && text.endIndex > requiredLength) {
setNewText(text, requiredLength - text.startIndex - 4);
hasEllipsis = true
} else {
if (text.startIndex > requiredLength) {
removeTextSpan(text)
}
}
}
}
}
return hasEllipsis
}
}
function prepareLines(element, texts) {
var i, ii, text, lines = [];
if (texts) {
for (i = 0, ii = texts.length; i < ii; ++i) {
text = texts[i];
if (!lines[text.line]) {
text.startIndex = 0;
text.endIndex = text.value.length;
lines.push({
commonLength: text.value.length,
parts: [text]
})
} else {
text.startIndex = lines[text.line].commonLength + 1;
text.endIndex = lines[text.line].commonLength + text.value.length;
lines[text.line].parts.push(text);
lines[text.line].commonLength += text.value.length
}
}
} else {
lines = [{
commonLength: element.textContent.length,
parts: [{
value: element.textContent,
tspan: element,
startIndex: 0,
endIndex: element.textContent.length
}]
}]
}
return lines
}
function setNewText(text, index) {
var newText = text.value.substr(0, index) + "...";
text.tspan.textContent = newText;
text.stroke && (text.stroke.textContent = newText)
}
function removeTextSpan(text) {
text.tspan.parentNode.removeChild(text.tspan);
text.stroke && text.stroke.parentNode.removeChild(text.stroke)
}
function createTextNodes(wrapper, text, isStroked) {
var items, parsedHtml;
wrapper._texts = null;
wrapper.clear();
if (null === text) {
return
}
text = "" + text;
if (!wrapper.renderer.encodeHtml && (-1 !== text.indexOf("<") || -1 !== text.indexOf("&"))) {
parsedHtml = removeExtraAttrs(text);
items = parseHTML(parsedHtml);
wrapper.DEBUG_parsedHtml = parsedHtml
} else {
if (-1 !== text.indexOf("\n")) {
items = parseMultiline(text)
} else {
if (isStroked) {
items = [{
value: text,
height: 0
}]
}
}
}
if (items) {
if (items.length) {
wrapper._texts = items;
if (isStroked) {
createTspans(items, wrapper.element, KEY_STROKE)
}
createTspans(items, wrapper.element, "tspan")
}
} else {
wrapper.element.appendChild(doc.createTextNode(text))
}
}
function setTextNodeAttribute(item, name, value) {
item.tspan.setAttribute(name, value);
item.stroke && item.stroke.setAttribute(name, value)
}
function locateTextNodes(wrapper) {
if (!wrapper._texts) {
return
}
var i, ii, items = wrapper._texts,
x = wrapper._settings.x,
lineHeight = _parseInt(wrapper._styles[KEY_FONT_SIZE], 10) || 12,
item = items[0];
setTextNodeAttribute(item, "x", x);
setTextNodeAttribute(item, "y", wrapper._settings.y);
for (i = 1, ii = items.length; i < ii; ++i) {
item = items[i];
if (item.height >= 0) {
setTextNodeAttribute(item, "x", x);
setTextNodeAttribute(item, "dy", item.inherits ? mathMax(item.height, lineHeight) : item.height || lineHeight)
}
}
}
function strokeTextNodes(wrapper) {
if (!wrapper._texts) {
return
}
var tspan, i, ii, items = wrapper._texts,
stroke = wrapper._settings[KEY_STROKE],
strokeWidth = wrapper._settings[KEY_STROKE_WIDTH],
strokeOpacity = wrapper._settings[KEY_STROKE_OPACITY] || 1;
for (i = 0, ii = items.length; i < ii; ++i) {
tspan = items[i].stroke;
tspan.setAttribute(KEY_STROKE, stroke);
tspan.setAttribute(KEY_STROKE_WIDTH, strokeWidth);
tspan.setAttribute(KEY_STROKE_OPACITY, strokeOpacity);
tspan.setAttribute("stroke-linejoin", "round")
}
}
function baseAnimate(that, params, options, complete) {
options = options || {};
var key, value, renderer = that.renderer,
settings = that._settings,
animationParams = {};
var defaults = {
translateX: 0,
translateY: 0,
scaleX: 1,
scaleY: 1,
rotate: 0,
rotateX: 0,
rotateY: 0
};
if (complete) {
options.complete = complete
}
if (renderer.animationEnabled()) {
for (key in params) {
value = params[key];
if (/^(translate(X|Y)|rotate[XY]?|scale(X|Y))$/i.test(key)) {
animationParams.transform = animationParams.transform || {
from: {},
to: {}
};
animationParams.transform.from[key] = key in settings ? Number(settings[key].toFixed(3)) : defaults[key];
animationParams.transform.to[key] = value
} else {
if ("arc" === key || "segments" === key) {
animationParams[key] = value
} else {
animationParams[key] = {
from: key in settings ? settings[key] : parseFloat(that.element.getAttribute(key) || 0),
to: value
}
}
}
}
renderer.animateElement(that, animationParams, extend(extend({}, renderer._animation), options))
} else {
options.step && options.step.call(that, 1, 1);
options.complete && options.complete.call(that);
that.attr(params)
}
return that
}
function pathAnimate(params, options, complete) {
var newSegments, endSegments, that = this,
curSegments = that.segments || [];
if (that.renderer.animationEnabled() && "points" in params) {
newSegments = buildPathSegments(params.points, that.type);
endSegments = compensateSegments(curSegments, newSegments, that.type);
params.segments = {
from: curSegments,
to: newSegments,
end: endSegments
};
delete params.points
}
return baseAnimate(that, params, options, complete)
}
function arcAnimate(params, options, complete) {
var that = this,
settings = that._settings,
arcParams = {
from: {},
to: {}
};
if (that.renderer.animationEnabled() && ("x" in params || "y" in params || "innerRadius" in params || "outerRadius" in params || "startAngle" in params || "endAngle" in params)) {
arcParams.from.x = settings.x || 0;
arcParams.from.y = settings.y || 0;
arcParams.from.innerRadius = settings.innerRadius || 0;
arcParams.from.outerRadius = settings.outerRadius || 0;
arcParams.from.startAngle = settings.startAngle || 0;
arcParams.from.endAngle = settings.endAngle || 0;
arcParams.to.x = "x" in params ? params.x : settings.x;
delete params.x;
arcParams.to.y = "y" in params ? params.y : settings.y;
delete params.y;
arcParams.to.innerRadius = "innerRadius" in params ? params.innerRadius : settings.innerRadius;
delete params.innerRadius;
arcParams.to.outerRadius = "outerRadius" in params ? params.outerRadius : settings.outerRadius;
delete params.outerRadius;
arcParams.to.startAngle = "startAngle" in params ? params.startAngle : settings.startAngle;
delete params.startAngle;
arcParams.to.endAngle = "endAngle" in params ? params.endAngle : settings.endAngle;
delete params.endAngle;
params.arc = arcParams
}
return baseAnimate(that, params, options, complete)
}
exports.DEBUG_set_getNextDefsSvgId = function(newFunction) {
getNextDefsSvgId = newFunction
};
exports.DEBUG_removeBackupContainer = function() {
if (backupCounter) {
backupCounter = 0;
doc.body.removeChild(backupContainer)
}
};
function buildLink(target, parameters) {
var obj = {
is: false,
name: parameters.name || parameters,
after: parameters.after
};
if (target) {
obj.to = target
} else {
obj.virtual = true
}
return obj
}
function SvgElement(renderer, tagName, type) {
var that = this;
that.renderer = renderer;
that.element = createElement(tagName);
that._settings = {};
that._styles = {};
if ("path" === tagName) {
that.type = type || "line"
}
}
exports.SvgElement = SvgElement;
SvgElement.prototype = {
constructor: SvgElement,
_getJQElement: function() {
return this._$element || (this._$element = $(this.element))
},
dispose: function() {
this._getJQElement().remove();
return this
},
append: function(parent) {
(parent || this.renderer.root).element.appendChild(this.element);
return this
},
remove: function() {
var element = this.element;
element.parentNode && element.parentNode.removeChild(element);
return this
},
enableLinks: function() {
this._links = [];
return this
},
checkLinks: function() {
var i, count = 0,
links = this._links,
ii = links.length;
for (i = 0; i < ii; ++i) {
if (!links[i]._link.virtual) {
++count
}
}
if (count > 0) {
throw new Error("There are non disposed links!")
}
},
virtualLink: function(parameters) {
linkItem({
_link: buildLink(null, parameters)
}, this);
return this
},
linkAfter: function(name) {
this._linkAfter = name;
return this
},
linkOn: function(target, parameters) {
this._link = buildLink(target, parameters);
linkItem(this, target);
return this
},
linkOff: function() {
unlinkItem(this);
this._link = null;
return this
},
linkAppend: function() {
var i, next, link = this._link,
items = link.to._links;
for (i = link.i + 1;
(next = items[i]) && !next._link.is; ++i) {}
this._insert(link.to, next);
link.is = true;
return this
},
_insert: function(parent, next) {
parent.element.insertBefore(this.element, next ? next.element : null)
},
linkRemove: function() {
this.remove();
this._link.is = false;
return this
},
clear: function() {
this._getJQElement().empty();
return this
},
toBackground: function() {
var elem = this.element,
parent = elem.parentNode;
parent && parent.insertBefore(elem, parent.firstChild);
return this
},
toForeground: function() {
var elem = this.element,
parent = elem.parentNode;
parent && parent.appendChild(elem);
return this
},
attr: function(attrs, inh) {
return baseAttr(this, attrs, inh)
},
smartAttr: function(attrs) {
var that = this;
if (attrs.hatching) {
attrs.fill = that._hatching = that.renderer.lockHatching(attrs.fill, attrs.hatching, that._hatching);
attrs.hatching = null
} else {
if (that._hatching) {
that.renderer.releaseHatching(that._hatching);
that._hatching = null
}
}
return baseAttr(that, attrs)
},
css: function(styles) {
return baseCss(this, styles)
},
animate: function(params, options, complete) {
return baseAnimate(this, params, options, complete)
},
sharp: function(pos) {
return this.attr({
sharp: pos || true
})
},
_applyTransformation: function() {
var scaleXDefined, scaleYDefined, rotateX, rotateY, tr = this._settings,
transformations = [],
sharpMode = tr.sharp,
strokeOdd = tr[KEY_STROKE_WIDTH] % 2,
correctionX = strokeOdd && ("h" === sharpMode || true === sharpMode) ? SHARPING_CORRECTION : 0,
correctionY = strokeOdd && ("v" === sharpMode || true === sharpMode) ? SHARPING_CORRECTION : 0;
transformations.push("translate(" + ((tr.translateX || 0) + correctionX) + "," + ((tr.translateY || 0) + correctionY) + ")");
if (tr.rotate) {
if ("rotateX" in tr) {
rotateX = tr.rotateX
} else {
rotateX = tr.x
}
if ("rotateY" in tr) {
rotateY = tr.rotateY
} else {
rotateY = tr.y
}
transformations.push("rotate(" + tr.rotate + "," + (rotateX || 0) + "," + (rotateY || 0) + ")")
}
scaleXDefined = _isDefined(tr.scaleX);
scaleYDefined = _isDefined(tr.scaleY);
if (scaleXDefined || scaleYDefined) {
transformations.push("scale(" + (scaleXDefined ? tr.scaleX : 1) + "," + (scaleYDefined ? tr.scaleY : 1) + ")")
}
if (transformations.length) {
this.element.setAttribute("transform", transformations.join(" "))
}
},
move: function(x, y, animate, animOptions) {
var obj = {};
_isDefined(x) && (obj.translateX = x);
_isDefined(y) && (obj.translateY = y);
if (!animate) {
this.attr(obj)
} else {
this.animate(obj, animOptions)
}
return this
},
rotate: function(angle, x, y, animate, animOptions) {
var obj = {
rotate: angle || 0
};
_isDefined(x) && (obj.rotateX = x);
_isDefined(y) && (obj.rotateY = y);
if (!animate) {
this.attr(obj)
} else {
this.animate(obj, animOptions)
}
return this
},
getBBox: function() {
var bBox, elem = this.element,
transformation = this._settings;
try {
bBox = elem.getBBox && elem.getBBox()
} catch (e) {}
bBox = bBox || {
x: 0,
y: 0,
width: elem.offsetWidth || 0,
height: elem.offsetHeight || 0
};
if (transformation.rotate) {
bBox = _rotateBBox(bBox, [("rotateX" in transformation ? transformation.rotateX : transformation.x) || 0, ("rotateY" in transformation ? transformation.rotateY : transformation.y) || 0], -transformation.rotate)
} else {
bBox = _normalizeBBox(bBox)
}
return bBox
},
markup: function() {
var temp = doc.createElement("div"),
node = this.element.cloneNode(true);
temp.appendChild(node);
return temp.innerHTML
},
getOffset: function() {
return this._getJQElement().offset()
},
stopAnimation: function(disableComplete) {
var animation = this.animation;
animation && animation.stop(disableComplete);
return this
},
setTitle: function(text) {
var titleElem = createElement("title");
titleElem.textContent = text || "";
this.element.appendChild(titleElem)
},
data: function(obj, val) {
var key, elem = this.element;
if (void 0 !== val) {
elem[obj] = val
} else {
for (key in obj) {
elem[key] = obj[key]
}
}
return this
},
on: function() {
$.fn.on.apply(this._getJQElement(), arguments);
return this
},
off: function() {
$.fn.off.apply(this._getJQElement(), arguments);
return this
},
trigger: function() {
$.fn.trigger.apply(this._getJQElement(), arguments);
return this
}
};
function PathSvgElement(renderer, type) {
SvgElement.call(this, renderer, "path", type)
}
exports.PathSvgElement = PathSvgElement;
PathSvgElement.prototype = objectCreate(SvgElement.prototype);
extend(PathSvgElement.prototype, {
constructor: PathSvgElement,
attr: pathAttr,
animate: pathAnimate
});
function ArcSvgElement(renderer) {
SvgElement.call(this, renderer, "path", "arc")
}
exports.ArcSvgElement = ArcSvgElement;
ArcSvgElement.prototype = objectCreate(SvgElement.prototype);
extend(ArcSvgElement.prototype, {
constructor: ArcSvgElement,
attr: arcAttr,
animate: arcAnimate
});
function RectSvgElement(renderer) {
SvgElement.call(this, renderer, "rect")
}
exports.RectSvgElement = RectSvgElement;
RectSvgElement.prototype = objectCreate(SvgElement.prototype);
extend(RectSvgElement.prototype, {
constructor: RectSvgElement,
attr: rectAttr
});
function TextSvgElement(renderer) {
SvgElement.call(this, renderer, "text")
}
exports.TextSvgElement = TextSvgElement;
TextSvgElement.prototype = objectCreate(SvgElement.prototype);
extend(TextSvgElement.prototype, {
constructor: TextSvgElement,
attr: textAttr,
css: textCss,
applyEllipsis: applyEllipsis
});
function updateIndexes(items, k) {
var i, item;
for (i = k; !!(item = items[i]); ++i) {
item._link.i = i
}
}
function linkItem(target, container) {
var i, item, items = container._links,
key = target._link.after = target._link.after || container._linkAfter;
if (key) {
for (i = 0;
(item = items[i]) && item._link.name !== key; ++i) {}
if (item) {
for (++i;
(item = items[i]) && item._link.after === key; ++i) {}
}
} else {
i = items.length
}
items.splice(i, 0, target);
updateIndexes(items, i)
}
function unlinkItem(target) {
var i, items = target._link.to._links;
for (i = 0; items[i] !== target; ++i) {}
items.splice(i, 1);
updateIndexes(items, i)
}
function SvgRenderer(options) {
var that = this;
that.root = that._createElement(that._rootTag, that._rootAttr).attr({
"class": options.cssClass
}).css(that._rootCss);
that._init();
that.pathModified = !!options.pathModified;
that._$container = $(options.container);
that.root.append({
element: options.container
});
that._locker = 0;
that._backed = false
}
exports.SvgRenderer = SvgRenderer;
SvgRenderer.prototype = {
constructor: SvgRenderer,
_rootTag: "svg",
_rootAttr: {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
version: "1.1",
fill: NONE,
stroke: NONE,
"stroke-width": 0
},
_rootCss: {
"line-height": "normal",
"-ms-user-select": NONE,
"-moz-user-select": NONE,
"-webkit-user-select": NONE,
"-webkit-tap-highlight-color": "rgba(0, 0, 0, 0)",
display: "block",
overflow: "hidden"
},
_init: function() {
var that = this;
that._defs = that._createElement("defs").append(that.root);
that._animationController = new animation.AnimationController(that.root.element);
that._animation = {
enabled: true,
duration: 1e3,
easing: "easeOutCubic"
}
},
setOptions: function(options) {
var that = this;
that.rtl = !!options.rtl;
that.encodeHtml = !!options.encodeHtml;
that.updateAnimationOptions(options.animation || {});
that.root.attr({
direction: that.rtl ? "rtl" : "ltr"
});
return that
},
_createElement: function(tagName, attr, type) {
var elem = new exports.SvgElement(this, tagName, type);
attr && elem.attr(attr);
return elem
},
lock: function() {
var that = this;
if (0 === that._locker) {
that._backed = !that._$container.is(":visible");
if (that._backed) {
backupRoot(that.root)
}
}++that._locker;
return that
},
unlock: function() {
var that = this;
--that._locker;
if (0 === that._locker) {
if (that._backed) {
restoreRoot(that.root, that._$container[0])
}
that._backed = false
}
return that
},
resize: function(width, height) {
if (width >= 0 && height >= 0) {
this.root.attr({
width: width,
height: height
})
}
return this
},
dispose: function() {
var key, that = this;
that.root.dispose();
that._defs.dispose();
that._animationController.dispose();
for (key in that) {
that[key] = null
}
return that
},
animationEnabled: function() {
return !!this._animation.enabled
},
updateAnimationOptions: function(newOptions) {
extend(this._animation, newOptions);
return this
},
stopAllAnimations: function(lock) {
this._animationController[lock ? "lock" : "stop"]();
return this
},
animateElement: function(element, params, options) {
this._animationController.animateElement(element, params, options);
return this
},
svg: function() {
return this.root.markup()
},
getRootOffset: function() {
return this.root.getOffset()
},
onEndAnimation: function(endAnimation) {
this._animationController.onEndAnimation(endAnimation)
},
rect: function(x, y, width, height) {
var elem = new exports.RectSvgElement(this);
return elem.attr({
x: x || 0,
y: y || 0,
width: width || 0,
height: height || 0
})
},
simpleRect: function() {
return this._createElement("rect")
},
circle: function(x, y, r) {
return this._createElement("circle", {
cx: x || 0,
cy: y || 0,
r: r || 0
})
},
g: function() {
return this._createElement("g")
},
image: function(x, y, w, h, href, location) {
var image = this._createElement("image", {
x: x || 0,
y: y || 0,
width: w || 0,
height: h || 0,
preserveAspectRatio: preserveAspectRatioMap[_normalizeEnum(location)] || NONE
});
image.element.setAttributeNS("http://www.w3.org/1999/xlink", "href", href || "");
return image
},
path: function(points, type) {
var elem = new exports.PathSvgElement(this, type);
return elem.attr({
points: points || []
})
},
arc: function(x, y, innerRadius, outerRadius, startAngle, endAngle) {
var elem = new exports.ArcSvgElement(this);
return elem.attr({
x: x || 0,
y: y || 0,
innerRadius: innerRadius || 0,
outerRadius: outerRadius || 0,
startAngle: startAngle || 0,
endAngle: endAngle || 0
})
},
text: function(text, x, y) {
var elem = new exports.TextSvgElement(this);
return elem.attr({
text: text,
x: x || 0,
y: y || 0
})
},
pattern: function(color, hatching, _id) {
hatching = hatching || {};
var id, d, pattern, rect, path, that = this,
step = hatching.step || 6,
stepTo2 = step / 2,
stepBy15 = 1.5 * step,
direction = _normalizeEnum(hatching.direction);
if ("right" !== direction && "left" !== direction) {
return {
id: color,
append: function() {
return this
},
clear: function() {},
dispose: function() {},
remove: function() {}
}
}
id = _id || getNextDefsSvgId();
d = "right" === direction ? "M " + stepTo2 + " " + -stepTo2 + " L " + -stepTo2 + " " + stepTo2 + " M 0 " + step + " L " + step + " 0 M " + stepBy15 + " " + stepTo2 + " L " + stepTo2 + " " + stepBy15 : "M 0 0 L " + step + " " + step + " M " + -stepTo2 + " " + stepTo2 + " L " + stepTo2 + " " + stepBy15 + " M " + stepTo2 + " " + -stepTo2 + " L " + stepBy15 + " " + stepTo2;
pattern = that._createElement("pattern", {
id: id,
width: step,
height: step,
patternUnits: "userSpaceOnUse"
}).append(that._defs);
pattern.id = getPatternUrl(id, that.pathModified);
rect = that.rect(0, 0, step, step).attr({
fill: color,
opacity: hatching.opacity
}).append(pattern);
path = new exports.PathSvgElement(this).attr({
d: d,
"stroke-width": hatching.width || 1,
stroke: color
}).append(pattern);
pattern.rect = rect;
pattern.path = path;
return pattern
},
clipRect: function(x, y, width, height) {
var that = this,
id = getNextDefsSvgId(),
clipPath = that._createElement("clipPath", {
id: id
}).append(that._defs),
rect = that.rect(x, y, width, height).append(clipPath);
rect.id = id;
rect.clipPath = clipPath;
rect.remove = function() {
throw "Not implemented"
};
rect.dispose = function() {
clipPath.dispose();
clipPath = null;
return this
};
return rect
},
shadowFilter: function(x, y, width, height, offsetX, offsetY, blur, color, opacity) {
var that = this,
id = getNextDefsSvgId(),
filter = that._createElement("filter", {
id: id,
x: x || 0,
y: y || 0,
width: width || 0,
height: height || 0
}).append(that._defs),
gaussianBlur = that._createElement("feGaussianBlur", {
"in": "SourceGraphic",
result: "gaussianBlurResult",
stdDeviation: blur || 0
}).append(filter),
offset = that._createElement("feOffset", {
"in": "gaussianBlurResult",
result: "offsetResult",
dx: offsetX || 0,
dy: offsetY || 0
}).append(filter),
flood = that._createElement("feFlood", {
result: "floodResult",
"flood-color": color || "",
"flood-opacity": opacity
}).append(filter),
composite = that._createElement("feComposite", {
"in": "floodResult",
in2: "offsetResult",
operator: "in",
result: "compositeResult"
}).append(filter),
finalComposite = that._createElement("feComposite", {
"in": "SourceGraphic",
in2: "compositeResult",
operator: "over"
}).append(filter);
filter.ref = getPatternUrl(id, that.pathModified);
filter.gaussianBlur = gaussianBlur;
filter.offset = offset;
filter.flood = flood;
filter.composite = composite;
filter.finalComposite = finalComposite;
filter.attr = function(attrs) {
var that = this,
filterAttrs = {},
offsetAttrs = {},
floodAttrs = {};
"x" in attrs && (filterAttrs.x = attrs.x);
"y" in attrs && (filterAttrs.y = attrs.y);
"width" in attrs && (filterAttrs.width = attrs.width);
"height" in attrs && (filterAttrs.height = attrs.height);
baseAttr(that, filterAttrs);
"blur" in attrs && that.gaussianBlur.attr({
stdDeviation: attrs.blur
});
"offsetX" in attrs && (offsetAttrs.dx = attrs.offsetX);
"offsetY" in attrs && (offsetAttrs.dy = attrs.offsetY);
that.offset.attr(offsetAttrs);
"color" in attrs && (floodAttrs["flood-color"] = attrs.color);
"opacity" in attrs && (floodAttrs["flood-opacity"] = attrs.opacity);
that.flood.attr(floodAttrs);
return that
};
return filter
},
brightFilter: function(type, slope) {
var that = this,
filterId = getNextDefsSvgId(),
filter = that._createElement("filter", {
id: filterId
}).append(that._defs),
feComponentTransfer = that._createElement("feComponentTransfer").append(filter),
attrs = {
type: type,
slope: slope
};
filter.ref = getPatternUrl(filterId, that.pathModified);
that._createElement("feFuncR", attrs).append(feComponentTransfer);
that._createElement("feFuncG", attrs).append(feComponentTransfer);
that._createElement("feFuncB", attrs).append(feComponentTransfer);
return filter
},
initHatching: function() {
var name, storage = this._hatchingStorage = this._hatchingStorage || {
byHash: {},
baseId: getNextDefsSvgId()
},
byHash = storage.byHash;
for (name in byHash) {
byHash[name].pattern.dispose()
}
storage.byHash = {};
storage.refToHash = {};
storage.nextId = 0
},
lockHatching: function(color, hatching, ref) {
var storageItem, pattern, storage = this._hatchingStorage,
hash = getHatchingHash(color, hatching);
if (storage.refToHash[ref] !== hash) {
if (ref) {
this.releaseHatching(ref)
}
storageItem = storage.byHash[hash];
if (!storageItem) {
pattern = this.pattern(color, hatching, storage.baseId + "-hatching-" + storage.nextId++);
storageItem = storage.byHash[hash] = {
pattern: pattern,
count: 0
};
storage.refToHash[pattern.id] = hash
}++storageItem.count;
ref = storageItem.pattern.id
}
return ref
},
releaseHatching: function(ref) {
var storage = this._hatchingStorage,
hash = storage.refToHash[ref],
storageItem = storage.byHash[hash];
if (0 === --storageItem.count) {
storageItem.pattern.dispose();
delete storage.byHash[hash];
delete storage.refToHash[ref]
}
}
};
function getHatchingHash(color, hatching) {
return "@" + color + "::" + hatching.step + ":" + hatching.width + ":" + hatching.opacity + ":" + hatching.direction
}
exports._getEllipsis = getEllipsis;
exports._createArcAttr = createArcAttr;
exports._createPathAttr = createPathAttr;
exports._createRectAttr = createRectAttr
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*********************************!*\
!*** ./Scripts/ui/draggable.js ***!
\*********************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
stringUtils = __webpack_require__( /*! ../core/utils/string */ 26),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 3),
translator = __webpack_require__( /*! ../animation/translator */ 15),
dasherize = __webpack_require__( /*! ../core/utils/inflector */ 29).dasherize,
DOMComponent = __webpack_require__( /*! ../core/dom_component */ 39),
eventUtils = __webpack_require__( /*! ../events/utils */ 4),
pointerEvents = __webpack_require__( /*! ../events/pointer */ 13),
dragEvents = __webpack_require__( /*! ../events/drag */ 62);
var DRAGGABLE = "dxDraggable",
DRAGSTART_EVENT_NAME = eventUtils.addNamespace(dragEvents.start, DRAGGABLE),
DRAG_EVENT_NAME = eventUtils.addNamespace(dragEvents.move, DRAGGABLE),
DRAGEND_EVENT_NAME = eventUtils.addNamespace(dragEvents.end, DRAGGABLE),
POINTERDOWN_EVENT_NAME = eventUtils.addNamespace(pointerEvents.down, DRAGGABLE),
DRAGGABLE_CLASS = dasherize(DRAGGABLE),
DRAGGABLE_DRAGGING_CLASS = DRAGGABLE_CLASS + "-dragging";
var Draggable = DOMComponent.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
onDragStart: $.noop,
onDrag: $.noop,
onDragEnd: $.noop,
direction: "both",
area: window,
boundOffset: 0,
allowMoveByClick: false
})
},
_init: function() {
this.callBase();
this._attachEventHandlers()
},
_attachEventHandlers: function() {
if (this.option("disabled")) {
return
}
var $element = this.element().css("position", "absolute"),
eventHandlers = {},
allowMoveByClick = this.option("allowMoveByClick");
eventHandlers[DRAGSTART_EVENT_NAME] = $.proxy(this._dragStartHandler, this);
eventHandlers[DRAG_EVENT_NAME] = $.proxy(this._dragHandler, this);
eventHandlers[DRAGEND_EVENT_NAME] = $.proxy(this._dragEndHandler, this);
if (allowMoveByClick) {
eventHandlers[POINTERDOWN_EVENT_NAME] = $.proxy(this._pointerDownHandler, this);
$element = this._getArea()
}
$element.on(eventHandlers, {
direction: this.option("direction"),
immediate: true
})
},
_detachEventHandlers: function() {
this.element().off("." + DRAGGABLE);
this._getArea().off("." + DRAGGABLE)
},
_move: function(position) {
translator.move(this.element(), position)
},
_pointerDownHandler: function(e) {
if (eventUtils.needSkipEvent(e)) {
return
}
var areaOffset = this._getAreaOffset($(e.currentTarget)),
direction = this.option("direction"),
position = {};
if ("horizontal" === direction || "both" === direction) {
position.left = e.pageX - this.element().width() / 2 - areaOffset.left
}
if ("vertical" === direction || "both" === direction) {
position.top = e.pageY - this.element().height() / 2 - areaOffset.top
}
this._move(position);
this._getAction("onDrag")({
jQueryEvent: e
})
},
_dragStartHandler: function(e) {
var $element = this.element();
if ($element.is(".dx-state-disabled, .dx-state-disabled *")) {
e.cancel = true;
return
}
var $area = this._getArea(),
areaOffset = this._getAreaOffset($area),
boundOffset = this._getBoundOffset(),
areaWidth = $area.outerWidth(),
areaHeight = $area.outerHeight(),
elementWidth = $element.width(),
elementHeight = $element.height();
this._toggleDraggingClass(true);
var startOffset = {
left: $element.offset().left - areaOffset.left,
top: $element.offset().top - areaOffset.top
};
this._startPosition = translator.locate($element);
e.maxLeftOffset = startOffset.left - boundOffset.left;
e.maxRightOffset = areaWidth - startOffset.left - elementWidth - boundOffset.right;
e.maxTopOffset = startOffset.top - boundOffset.top;
e.maxBottomOffset = areaHeight - startOffset.top - elementHeight - boundOffset.bottom;
this._getAction("onDragStart")({
jQueryEvent: e
})
},
_getAreaOffset: function($area) {
var offset = $area && $area.offset();
return offset ? offset : {
left: 0,
top: 0
}
},
_toggleDraggingClass: function(value) {
this.element().toggleClass(DRAGGABLE_DRAGGING_CLASS, value)
},
_getBoundOffset: function() {
var boundOffset = this.option("boundOffset");
if ($.isFunction(boundOffset)) {
boundOffset = boundOffset.call(this)
}
return stringUtils.quadToObject(boundOffset)
},
_getArea: function() {
var area = this.option("area");
if ($.isFunction(area)) {
area = area.call(this)
}
return $(area)
},
_dragHandler: function(e) {
var offset = e.offset,
startPosition = this._startPosition;
this._move({
left: startPosition.left + offset.x,
top: startPosition.top + offset.y
});
this._getAction("onDrag")({
jQueryEvent: e
})
},
_dragEndHandler: function(e) {
this._toggleDraggingClass(false);
this._getAction("onDragEnd")({
jQueryEvent: e
})
},
_getAction: function(name) {
return this["_" + name + "Action"] || this._createActionByOption(name)
},
_render: function() {
this.callBase();
this.element().addClass(DRAGGABLE_CLASS)
},
_optionChanged: function(args) {
var name = args.name;
switch (name) {
case "onDragStart":
case "onDrag":
case "onDragEnd":
this["_" + name + "Action"] = this._createActionByOption(name);
break;
case "allowMoveByClick":
case "direction":
case "disabled":
this._detachEventHandlers();
this._attachEventHandlers();
break;
case "boundOffset":
case "area":
break;
default:
this.callBase(args)
}
},
_dispose: function() {
this.callBase();
this._detachEventHandlers()
}
});
registerComponent(DRAGGABLE, Draggable);
module.exports = Draggable
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************!*\
!*** ./Scripts/ui/radio_group.js ***!
\***********************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
module.exports = __webpack_require__( /*! ./radio_group/radio_group */ 395)
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!******************************!*\
!*** ./Scripts/ui/switch.js ***!
\******************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
devices = __webpack_require__( /*! ../core/devices */ 7),
inkRipple = __webpack_require__( /*! ./widget/utils.ink_ripple */ 48),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 3),
Editor = __webpack_require__( /*! ./editor/editor */ 31),
eventUtils = __webpack_require__( /*! ../events/utils */ 4),
feedbackEvents = __webpack_require__( /*! ../events/core/emitter.feedback */ 70),
themes = __webpack_require__( /*! ./themes */ 23),
fx = __webpack_require__( /*! ../animation/fx */ 21),
messageLocalization = __webpack_require__( /*! ../localization/message */ 8),
clickEvent = __webpack_require__( /*! ../events/click */ 9),
Swipeable = __webpack_require__( /*! ../events/gesture/swipeable */ 76);
var SWITCH_CLASS = "dx-switch",
SWITCH_WRAPPER_CLASS = SWITCH_CLASS + "-wrapper",
SWITCH_CONTAINER_CLASS = SWITCH_CLASS + "-container",
SWITCH_INNER_CLASS = SWITCH_CLASS + "-inner",
SWITCH_HANDLE_CLASS = SWITCH_CLASS + "-handle",
SWITCH_ON_VALUE_CLASS = SWITCH_CLASS + "-on-value",
SWITCH_ON_CLASS = SWITCH_CLASS + "-on",
SWITCH_OFF_CLASS = SWITCH_CLASS + "-off",
SWITCH_ANIMATION_DURATION = 100;
var Switch = Editor.inherit({
_supportedKeys: function() {
var isRTL = this.option("rtlEnabled");
var click = function(e) {
e.preventDefault();
this._clickAction({
jQueryEvent: e
})
},
move = function(value, e) {
e.preventDefault();
e.stopPropagation();
this._animateValue(value)
};
return $.extend(this.callBase(), {
space: click,
enter: click,
leftArrow: $.proxy(move, this, isRTL ? true : false),
rightArrow: $.proxy(move, this, isRTL ? false : true)
})
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
hoverStateEnabled: true,
activeStateEnabled: true,
onText: messageLocalization.format("dxSwitch-onText"),
offText: messageLocalization.format("dxSwitch-offText"),
value: false,
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
}
}])
},
_feedbackHideTimeout: 0,
_animating: false,
_render: function() {
var element = this.element();
this._$switchInner = $(" ").addClass(SWITCH_INNER_CLASS);
this._$handle = $(" ").addClass(SWITCH_HANDLE_CLASS).appendTo(this._$switchInner);
this.option("useInkRipple") && this._renderInkRipple();
this._$labelOn = $(" ").addClass(SWITCH_ON_CLASS).prependTo(this._$switchInner);
this._$labelOff = $(" ").addClass(SWITCH_OFF_CLASS).appendTo(this._$switchInner);
this._$switchContainer = $(" ").addClass(SWITCH_CONTAINER_CLASS).append(this._$switchInner);
this._$switchWrapper = $(" ").addClass(SWITCH_WRAPPER_CLASS).append(this._$switchContainer);
element.addClass(SWITCH_CLASS).append(this._$switchWrapper);
this.setAria("role", "button");
this._createComponent(element, Swipeable, {
elastic: false,
immediate: true,
onStart: $.proxy(this._swipeStartHandler, this),
onUpdated: $.proxy(this._swipeUpdateHandler, this),
onEnd: $.proxy(this._swipeEndHandler, this),
itemSizeFunc: $.proxy(this._getMarginBound, this)
});
this._renderLabels();
this.callBase();
this._updateMarginBound();
this._renderValue();
this._renderClick()
},
_renderInkRipple: function() {
this._inkRipple = inkRipple.render({
waveSizeCoefficient: 1.7,
isCentered: true,
useHoldAnimation: false,
wavesNumber: 2
})
},
_renderInkWave: function(element, jQueryEvent, doRender, waveIndex) {
if (!this._inkRipple) {
return
}
var config = {
element: element,
jQueryEvent: jQueryEvent,
wave: waveIndex
};
if (doRender) {
this._inkRipple.showWave(config)
} else {
this._inkRipple.hideWave(config)
}
},
_updateFocusState: function(e, value) {
this.callBase.apply(this, arguments);
this._renderInkWave(this._$handle, e, value, 0)
},
_toggleActiveState: function($element, value, e) {
this.callBase.apply(this, arguments);
this._renderInkWave(this._$handle, e, value, 1)
},
_updateMarginBound: function() {
this._marginBound = this._$switchContainer.outerWidth(true) - this._$handle.outerWidth()
},
_getMarginBound: function() {
return this._marginBound
},
_marginDirection: function() {
return this.option("rtlEnabled") ? "Right" : "Left"
},
_offsetDirection: function() {
return this.option("rtlEnabled") ? -1 : 1
},
_renderPosition: function(state, swipeOffset) {
var stateInt = state ? 1 : 0,
marginDirection = this._marginDirection(),
resetMarginDirection = "Left" === marginDirection ? "Right" : "Left";
this._$switchInner.css("margin" + marginDirection, this._getMarginBound() * (stateInt + swipeOffset - 1));
this._$switchInner.css("margin" + resetMarginDirection, 0)
},
_validateValue: function() {
var check = this.option("value");
if ("boolean" !== typeof check) {
this._options.value = !!check
}
},
_renderClick: function() {
var eventName = eventUtils.addNamespace(clickEvent.name, this.NAME);
this._clickAction = this._createAction($.proxy(this._clickHandler, this));
this.element().off(eventName).on(eventName, $.proxy(function(e) {
this._clickAction({
jQueryEvent: e
})
}, this))
},
_clickHandler: function(args) {
this.time = new Date;
var e = args.jQueryEvent;
this._saveValueChangeEvent(e);
if (this._animating || this._swiping) {
return
}
this._animateValue(!this.option("value"))
},
_animateValue: function(value) {
var startValue = this.option("value"),
endValue = value;
if (startValue === endValue) {
return
}
this._animating = true;
var that = this,
marginDirection = this._marginDirection(),
resetMarginDirection = "Left" === marginDirection ? "Right" : "Left",
fromConfig = {},
toConfig = {};
this._$switchInner.css("margin" + resetMarginDirection, 0);
fromConfig["margin" + marginDirection] = (Number(startValue) - 1) * this._getMarginBound();
toConfig["margin" + marginDirection] = (Number(endValue) - 1) * this._getMarginBound();
fx.animate(this._$switchInner, {
from: fromConfig,
to: toConfig,
duration: SWITCH_ANIMATION_DURATION,
complete: function() {
that._animating = false;
that.option("value", endValue)
}
})
},
_swipeStartHandler: function(e) {
var state = this.option("value"),
rtlEnabled = this.option("rtlEnabled"),
maxOffOffset = rtlEnabled ? 0 : 1,
maxOnOffset = rtlEnabled ? 1 : 0;
e.jQueryEvent.maxLeftOffset = state ? maxOffOffset : maxOnOffset;
e.jQueryEvent.maxRightOffset = state ? maxOnOffset : maxOffOffset;
this._swiping = true;
this._feedbackDeferred = $.Deferred();
feedbackEvents.lock(this._feedbackDeferred);
this._toggleActiveState(this.element(), this.option("activeStateEnabled"))
},
_swipeUpdateHandler: function(e) {
this._renderPosition(this.option("value"), this._offsetDirection() * e.jQueryEvent.offset)
},
_swipeEndHandler: function(e) {
var that = this,
offsetDirection = this._offsetDirection(),
toConfig = {};
toConfig["margin" + this._marginDirection()] = this._getMarginBound() * (that.option("value") + offsetDirection * e.jQueryEvent.targetOffset - 1);
fx.animate(this._$switchInner, {
to: toConfig,
duration: SWITCH_ANIMATION_DURATION,
complete: function() {
that._swiping = false;
var pos = that.option("value") + offsetDirection * e.jQueryEvent.targetOffset;
that.option("value", Boolean(pos));
that._feedbackDeferred.resolve();
that._toggleActiveState(that.element(), false)
}
})
},
_renderValue: function() {
this._validateValue();
var val = this.option("value");
this._renderPosition(val, 0);
this.element().toggleClass(SWITCH_ON_VALUE_CLASS, val);
this.setAria({
pressed: val,
label: val ? this.option("onText") : this.option("offText")
})
},
_renderLabels: function() {
this._$labelOn.text(this.option("onText"));
this._$labelOff.text(this.option("offText"))
},
_visibilityChanged: function(visible) {
if (visible) {
this.repaint()
}
},
_optionChanged: function(args) {
switch (args.name) {
case "useInkRipple":
this._invalidate();
break;
case "visible":
case "width":
this._refresh();
break;
case "onText":
case "offText":
this._renderLabels();
break;
case "value":
this._renderValue();
this.callBase(args);
break;
default:
this.callBase(args)
}
}
});
registerComponent("dxSwitch", Switch);
module.exports = Switch
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*******************************!*\
!*** ./Scripts/ui/toolbar.js ***!
\*******************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
themes = __webpack_require__( /*! ./themes */ 23),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 3),
ActionSheetStrategy = __webpack_require__( /*! ./toolbar/ui.toolbar.strategy.action_sheet */ 413),
DropDownMenuStrategy = __webpack_require__( /*! ./toolbar/ui.toolbar.strategy.drop_down_menu */ 414),
ListBottomStrategy = __webpack_require__( /*! ./toolbar/ui.toolbar.strategy.list_bottom */ 415),
ListTopStrategy = __webpack_require__( /*! ./toolbar/ui.toolbar.strategy.list_top */ 416),
ToolbarBase = __webpack_require__( /*! ./toolbar/ui.toolbar.base */ 257);
var STRATEGIES = {
actionSheet: ActionSheetStrategy,
dropDownMenu: DropDownMenuStrategy,
listBottom: ListBottomStrategy,
listTop: ListTopStrategy
};
var TOOLBAR_AUTO_HIDE_ITEM_CLASS = "dx-toolbar-item-auto-hide",
TOOLBAR_AUTO_HIDE_TEXT_CLASS = "dx-toolbar-text-auto-hide",
TOOLBAR_HIDDEN_ITEM = "dx-toolbar-item-invisible";
var Toolbar = ToolbarBase.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
menuItemTemplate: "menuItem",
submenuType: "dropDownMenu"
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function() {
return /ios7.*/.test(themes.current())
},
options: {
submenuType: "actionSheet"
}
}, {
device: function() {
return /android5.*/.test(themes.current())
},
options: {
submenuType: "dropDownMenu"
}
}, {
device: function() {
return /win8.*/.test(themes.current())
},
options: {
submenuType: "listBottom"
}
}, {
device: function() {
return /win10.*/.test(themes.current())
},
options: {
submenuType: "listTop"
}
}])
},
_dimensionChanged: function() {
this._menuStrategy.toggleMenuVisibility(false, true);
this.callBase();
this._menuStrategy.renderMenuItems()
},
_render: function() {
this.callBase();
this._menuStrategy.renderMenuItems()
},
_renderContentImpl: function() {
this.callBase();
this._hideOverflowItems();
this._renderMenu()
},
_renderItem: function(index, item, itemContainer, $after) {
var itemElement = this.callBase(index, item, itemContainer, $after);
if ("auto" === item.locateInMenu) {
itemElement.addClass(TOOLBAR_AUTO_HIDE_ITEM_CLASS)
}
if ("dxButton" === item.widget && "inMenu" === item.showText) {
itemElement.toggleClass(TOOLBAR_AUTO_HIDE_TEXT_CLASS)
}
return itemElement
},
_hideOverflowItems: function(elementWidth) {
var overflowItems = this.element().find("." + TOOLBAR_AUTO_HIDE_ITEM_CLASS);
if (!overflowItems.length) {
return
}
elementWidth = elementWidth || this.element().width();
$(overflowItems).removeClass(TOOLBAR_HIDDEN_ITEM);
var beforeWidth = this._$beforeSection.outerWidth(),
centerWidth = this._$centerSection.outerWidth(),
afterWidth = this._$afterSection.outerWidth(),
itemsWidth = beforeWidth + centerWidth + afterWidth;
while (overflowItems.length && elementWidth < itemsWidth) {
var $item = overflowItems.eq(-1);
itemsWidth -= $item.outerWidth();
$item.addClass(TOOLBAR_HIDDEN_ITEM);
overflowItems.splice(-1, 1)
}
},
_getMenuItems: function() {
var that = this;
var menuItems = $.grep(this.option("items") || [], function(item) {
return that._isMenuItem(item)
});
var $hiddenItems = this._itemContainer().children("." + TOOLBAR_AUTO_HIDE_ITEM_CLASS + "." + TOOLBAR_HIDDEN_ITEM).not(".dx-state-invisible");
this._restoreItems = this._restoreItems || [];
var overflowItems = $.map($hiddenItems, function(item) {
var itemData = that._getItemData(item),
$itemContainer = $(item).children(),
$itemMarkup = $itemContainer.children();
return $.extend({
menuItemTemplate: function() {
that._restoreItems.push({
container: $itemContainer,
item: $itemMarkup
});
var $container = $(" ").addClass(TOOLBAR_AUTO_HIDE_ITEM_CLASS);
return $container.append($itemMarkup)
}
}, itemData)
});
return $.merge(overflowItems, menuItems)
},
_getToolbarItems: function() {
var that = this;
return $.grep(this.option("items") || [], function(item) {
return !that._isMenuItem(item)
})
},
_renderMenu: function() {
this._renderMenuStrategy();
this._menuStrategy.render()
},
_renderMenuStrategy: function() {
var strategyName = this.option("submenuType");
if (this._requireDropDownStrategy()) {
strategyName = "dropDownMenu"
}
var strategy = STRATEGIES[strategyName];
if (!(this._menuStrategy && this._menuStrategy.NAME === strategyName)) {
this._menuStrategy = new strategy(this)
}
},
_requireDropDownStrategy: function() {
var strategyName = this.option("submenuType");
if (("listBottom" === strategyName || "listTop" === strategyName) && "topToolbar" === this.option("renderAs")) {
return true
}
var items = this.option("items") || [],
result = false;
$.each(items, function(index, item) {
if ("auto" === item.locateInMenu) {
result = true
} else {
if ("always" === item.locateInMenu && item.widget) {
result = true
}
}
});
return result
},
_arrangeItems: function() {
if (this.element().is(":hidden")) {
return
}
this._$centerSection.css({
margin: "0 auto",
"float": "none"
});
$.each(this._restoreItems || [], function(_, obj) {
$(obj.container).append(obj.item)
});
this._restoreItems = [];
var elementWidth = this.element().width();
this._hideOverflowItems(elementWidth);
this.callBase(elementWidth)
},
_itemOptionChanged: function(item, property, value) {
if (this._isMenuItem(item)) {
this._menuStrategy.renderMenuItems()
} else {
if (this._isToolbarItem(item)) {
this.callBase(item, property, value)
} else {
this.callBase(item, property, value);
this._menuStrategy.renderMenuItems()
}
}
},
_isMenuItem: function(itemData) {
return "menu" === itemData.location || "always" === itemData.locateInMenu
},
_isToolbarItem: function(itemData) {
return void 0 === itemData.location || "never" === itemData.locateInMenu
},
_optionChanged: function(args) {
var name = args.name;
var value = args.value;
switch (name) {
case "submenuType":
this._invalidate();
break;
case "visible":
this.callBase.apply(this, arguments);
this._menuStrategy.handleToolbarVisibilityChange(value);
break;
case "menuItemTemplate":
this._changeMenuOption("itemTemplate", this._getTemplate(value));
break;
case "onItemClick":
this._changeMenuOption(name, value);
this.callBase.apply(this, arguments);
break;
default:
this.callBase.apply(this, arguments)
}
},
_changeMenuOption: function(name, value) {
this._menuStrategy.widgetOption(name, value)
}
});
registerComponent("dxToolbar", Toolbar);
module.exports = Toolbar
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/bundles/modules/data.odata.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
__webpack_require__( /*! ./data */ 196);
DevExpress.data.ODataStore = __webpack_require__( /*! ../../data/odata/store */ 204);
DevExpress.data.ODataContext = __webpack_require__( /*! ../../data/odata/context */ 272);
DevExpress.data.utils = DevExpress.data.utils || {};
DevExpress.data.utils.odata = {};
DevExpress.data.utils.odata.keyConverters = __webpack_require__( /*! ../../data/odata/utils */ 71).keyConverters;
DevExpress.data.EdmLiteral = __webpack_require__( /*! ../../data/odata/utils */ 71).EdmLiteral;
var ODataUtilsModule = __webpack_require__( /*! ../../data/odata/utils */ 71);
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 */ 112).odata
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**********************************************!*\
!*** ./Scripts/bundles/modules/framework.js ***!
\**********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
__webpack_require__( /*! ./core */ 97);
__webpack_require__( /*! ../../integration/knockout */ 85);
module.exports = DevExpress.framework = {};
DevExpress.framework.dxCommand = __webpack_require__( /*! ../../framework/command */ 145);
DevExpress.framework.Router = __webpack_require__( /*! ../../framework/router */ 116);
DevExpress.framework.StateManager = __webpack_require__( /*! ../../framework/state_manager */ 150);
DevExpress.framework.ViewCache = __webpack_require__( /*! ../../framework/view_cache */ 59);
DevExpress.framework.NullViewCache = __webpack_require__( /*! ../../framework/view_cache */ 59).NullViewCache;
DevExpress.framework.ConditionalViewCacheDecorator = __webpack_require__( /*! ../../framework/view_cache */ 59).ConditionalViewCacheDecorator;
DevExpress.framework.CapacityViewCacheDecorator = __webpack_require__( /*! ../../framework/view_cache */ 59).CapacityViewCacheDecorator;
DevExpress.framework.HistoryDependentViewCacheDecorator = __webpack_require__( /*! ../../framework/view_cache */ 59).HistoryDependentViewCacheDecorator;
DevExpress.framework.dxCommandContainer = __webpack_require__( /*! ../../framework/html/command_container */ 147);
DevExpress.framework.dxView = __webpack_require__( /*! ../../framework/html/view_engine_components */ 45).dxView;
DevExpress.framework.dxLayout = __webpack_require__( /*! ../../framework/html/view_engine_components */ 45).dxLayout;
DevExpress.framework.dxViewPlaceholder = __webpack_require__( /*! ../../framework/html/view_engine_components */ 45).dxViewPlaceholder;
DevExpress.framework.dxContentPlaceholder = __webpack_require__( /*! ../../framework/html/view_engine_components */ 45).dxContentPlaceholder;
DevExpress.framework.dxTransition = __webpack_require__( /*! ../../framework/html/view_engine_components */ 45).dxTransition;
DevExpress.framework.dxContent = __webpack_require__( /*! ../../framework/html/view_engine_components */ 45).dxContent;
DevExpress.framework.html = {};
DevExpress.framework.html.HtmlApplication = __webpack_require__( /*! ../../framework/html/html_application */ 213);
DevExpress.framework.Route = __webpack_require__( /*! ../../framework/router */ 116).Route;
DevExpress.framework.MemoryKeyValueStorage = __webpack_require__( /*! ../../framework/state_manager */ 150).MemoryKeyValueStorage;
DevExpress.framework.NavigationDevices = __webpack_require__( /*! ../../framework/navigation_devices */ 115);
DevExpress.framework.NavigationManager = __webpack_require__( /*! ../../framework/navigation_manager */ 83);
DevExpress.framework.createActionExecutors = __webpack_require__( /*! ../../framework/action_executors */ 209).createActionExecutors;
DevExpress.framework.Application = __webpack_require__( /*! ../../framework/application */ 210).Application;
var browserAdapters = __webpack_require__( /*! ../../framework/browser_adapters */ 211);
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 */ 146);
DevExpress.framework.HistoryBasedNavigationDevice = __webpack_require__( /*! ../../framework/navigation_devices */ 115).HistoryBasedNavigationDevice;
DevExpress.framework.StackBasedNavigationDevice = __webpack_require__( /*! ../../framework/navigation_devices */ 115).StackBasedNavigationDevice;
DevExpress.framework.HistoryBasedNavigationManager = __webpack_require__( /*! ../../framework/navigation_manager */ 83).HistoryBasedNavigationManager;
DevExpress.framework.StackBasedNavigationManager = __webpack_require__( /*! ../../framework/navigation_manager */ 83).StackBasedNavigationManager;
DevExpress.framework.NavigationStack = __webpack_require__( /*! ../../framework/navigation_manager */ 83).NavigationStack;
DevExpress.framework.utils = __webpack_require__( /*! ../../framework/utils */ 84).utils;
DevExpress.framework.templateProvider = __webpack_require__( /*! ../../framework/utils */ 84).templateProvider;
DevExpress.framework.html.CommandManager = __webpack_require__( /*! ../../framework/html/command_manager */ 212);
DevExpress.framework.html.HtmlApplication = __webpack_require__( /*! ../../framework/html/html_application */ 213);
DevExpress.framework.html.layoutSets = __webpack_require__( /*! ../../framework/html/presets */ 114).layoutSets;
DevExpress.framework.html.animationSets = __webpack_require__( /*! ../../framework/html/presets */ 114).animationSets;
DevExpress.framework.html.DefaultLayoutController = __webpack_require__( /*! ../../framework/html/layout_controller */ 148).DefaultLayoutController;
DevExpress.framework.html.layoutSets = __webpack_require__( /*! ../../framework/html/layout_controller */ 148).layoutSets;
DevExpress.framework.html.MarkupComponent = __webpack_require__( /*! ../../framework/html/markup_component */ 149).MarkupComponent;
DevExpress.framework.html.ViewEngine = __webpack_require__( /*! ../../framework/html/view_engine */ 214).ViewEngine;
DevExpress.framework.html.ViewEngineComponents = __webpack_require__( /*! ../../framework/html/view_engine_components */ 45);
var widgetCommandAdaptersModule = __webpack_require__( /*! ../../framework/html/widget_command_adapters */ 215);
DevExpress.framework.html.commandToDXWidgetAdapters = {
dxToolbar: widgetCommandAdaptersModule.dxToolbar,
dxList: widgetCommandAdaptersModule.dxList,
dxNavBar: widgetCommandAdaptersModule.dxNavBar,
dxPivot: widgetCommandAdaptersModule.dxPivot,
dxSlideOut: widgetCommandAdaptersModule.dxSlideOut
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************!*\
!*** ./Scripts/core/utils/weak_map.js ***!
\****************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
WeakMap = window.WeakMap;
if (!WeakMap) {
WeakMap = function() {
var keys = [],
values = [];
this.set = function(key, value) {
var index = $.inArray(key, keys);
if (-1 === index) {
keys.push(key);
values.push(value)
} else {
values[index] = value
}
};
this.get = function(key) {
var index = $.inArray(key, keys);
if (-1 === index) {
return
}
return values[index]
};
this.has = function(key) {
var index = $.inArray(key, keys);
if (-1 === index) {
return false
}
return true
}
}
}
module.exports = WeakMap
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*************************************!*\
!*** ./Scripts/data/data_source.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
module.exports = __webpack_require__( /*! ./data_source/data_source */ 37).DataSource
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*******************************************!*\
!*** ./Scripts/data/endpoint_selector.js ***!
\*******************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var errors = __webpack_require__( /*! ../core/errors */ 10),
proxyUrlFormatter = __webpack_require__( /*! ./proxy_url_formatter */ 205);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*************************************!*\
!*** ./Scripts/data/local_store.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../core/class */ 5),
abstract = Class.abstract,
errors = __webpack_require__( /*! ./errors */ 25).errors,
ArrayStore = __webpack_require__( /*! ./array_store */ 58);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************!*\
!*** ./Scripts/data/odata/context.js ***!
\***************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../../core/class */ 5),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
errorsModule = __webpack_require__( /*! ../errors */ 25),
ODataStore = __webpack_require__( /*! ./store */ 204),
mixins = __webpack_require__( /*! ./mixins */ 203);
__webpack_require__( /*! ./query_adapter */ 112);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************!*\
!*** ./Scripts/data/remote_query.js ***!
\**************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
queryAdapters = __webpack_require__( /*! ./query_adapters */ 144),
errorsModule = __webpack_require__( /*! ./errors */ 25),
arrayQueryImpl = __webpack_require__( /*! ./array_query */ 201);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************************!*\
!*** ./Scripts/events/pointer/mouse_and_touch.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
BaseStrategy = __webpack_require__( /*! ./base */ 113),
MouseStrategy = __webpack_require__( /*! ./mouse */ 206),
TouchStrategy = __webpack_require__( /*! ./touch */ 208),
eventUtils = __webpack_require__( /*! ../utils */ 4);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*********************************************!*\
!*** ./Scripts/events/pointer/mspointer.js ***!
\*********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
BaseStrategy = __webpack_require__( /*! ./base */ 113),
Observer = __webpack_require__( /*! ./observer */ 207),
browser = __webpack_require__( /*! ../../core/utils/browser */ 22);
__webpack_require__( /*! ./mspointer_hooks */ 276);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************************!*\
!*** ./Scripts/events/pointer/mspointer_hooks.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1);
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
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/events/pointer/touch_hooks.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1);
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
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*************************************!*\
!*** ./Scripts/events/transform.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
mathUtils = __webpack_require__( /*! ../core/utils/math */ 66),
errors = __webpack_require__( /*! ../core/errors */ 10),
eventUtils = __webpack_require__( /*! ./utils */ 4),
Emitter = __webpack_require__( /*! ./core/emitter */ 81),
registerEmitter = __webpack_require__( /*! ./core/emitter_registrator */ 61);
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
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************!*\
!*** ./Scripts/integration/angular.js ***!
\****************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
if (!window.angular) {
return
}
__webpack_require__( /*! ./angular/component_registrator */ 281);
__webpack_require__( /*! ./angular/event_registrator */ 284);
__webpack_require__( /*! ./angular/components */ 282);
__webpack_require__( /*! ./angular/action_executors */ 280)
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*********************************************************!*\
!*** ./Scripts/integration/angular/action_executors.js ***!
\*********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var Action = __webpack_require__( /*! ../../core/action */ 54);
Action.registerExecutor({
ngExpression: {
execute: function(e) {
if ("string" === typeof e.action) {
e.context.$eval(e.action)
}
}
}
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************************************!*\
!*** ./Scripts/integration/angular/component_registrator.js ***!
\**************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 3),
Class = __webpack_require__( /*! ../../core/class */ 5),
Locker = __webpack_require__( /*! ../../core/utils/locker */ 200),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 11),
Widget = __webpack_require__( /*! ../../ui/widget/ui.widget */ 19),
Editor = __webpack_require__( /*! ../../ui/editor/editor */ 31),
NgTemplateProvider = __webpack_require__( /*! ./template_provider */ 286),
ngModule = __webpack_require__( /*! ./module */ 151),
removeEvent = __webpack_require__( /*! ../../core/remove_event */ 141),
CollectionWidget = __webpack_require__( /*! ../../ui/collection/ui.collection_widget.edit */ 27),
compileSetter = __webpack_require__( /*! ../../core/utils/data */ 16).compileSetter,
compileGetter = __webpack_require__( /*! ../../core/utils/data */ 16).compileGetter,
extendFromObject = __webpack_require__( /*! ../../core/utils/object */ 30).extendFromObject;
var ITEM_ALIAS_ATTRIBUTE_NAME = "dxItemAlias",
DEFAULT_MODEL_ALIAS = "dxTemplateModel",
MODEL_IS_PRIMITIVE_FLAG_NAME = "dxTemplateModelIsPrimitive",
SKIP_APPLY_ACTION_CATEGORIES = ["rendering"];
var applyDeferred;
var safeApply = function(func, scope) {
if (scope.$root.$$phase) {
return func(scope)
} else {
applyDeferred = new $.Deferred;
var result = scope.$apply(function() {
return func(scope)
});
applyDeferred.resolve();
return result
}
};
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)) {
if (!applyDeferred) {
that._ngLocker.release(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 ("$digest" === that._scope.$root.$$phase || !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);
if (applyDeferred) {
applyDeferred.done(function() {
that._ngLocker.release(fullName)
})
}
})
},
_compilerByTemplate: function(template) {
var that = this,
scopeItemsPath = this._getScopeItemsPath();
return function(data, index, $container) {
var $resultMarkup = $(template).clone(),
dataIsScope = data && data.constructor === that._scope.$root.constructor,
templateScope = dataIsScope ? data : that._createScopeWithData(data);
if (scopeItemsPath) {
that._synchronizeScopes(templateScope, scopeItemsPath, index)
}
$resultMarkup.appendTo($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 {
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
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************************!*\
!*** ./Scripts/integration/angular/components.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
MemorizedCallbacks = __webpack_require__( /*! ../../core/memorized_callbacks */ 140),
ngModule = __webpack_require__( /*! ./module */ 151),
iconUtils = __webpack_require__( /*! ../../core/utils/icon */ 77),
inflector = __webpack_require__( /*! ../../core/utils/inflector */ 29),
errors = __webpack_require__( /*! ../../core/errors */ 10);
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
}
}])
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**********************************************************!*\
!*** ./Scripts/integration/angular/default_templates.js ***!
\**********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**********************************************************!*\
!*** ./Scripts/integration/angular/event_registrator.js ***!
\**********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
eventRegistrator = __webpack_require__( /*! ../../events/core/event_registrator */ 43),
ngModule = __webpack_require__( /*! ./module */ 151);
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
})
})
})
}
}])
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*************************************************!*\
!*** ./Scripts/integration/angular/template.js ***!
\*************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
TemplateBase = __webpack_require__( /*! ../../ui/widget/ui.template_base */ 47),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 11);
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(data, index, $container) {
var compiledTemplate = this._compiledTemplate,
result = $.isFunction(compiledTemplate) ? compiledTemplate(data, index, $container) : compiledTemplate;
return result
},
setCompiler: function(templateCompiler) {
if (!templateCompiler) {
return
}
this._compiledTemplate = templateCompiler(domUtils.normalizeTemplateElement(this._element))
}
});
module.exports = NgTemplate
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**********************************************************!*\
!*** ./Scripts/integration/angular/template_provider.js ***!
\**********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 11),
templateProvider = __webpack_require__( /*! ../../ui/widget/jquery.template_provider */ 160),
NgTemplate = __webpack_require__( /*! ./template */ 285),
defaultTemplates = __webpack_require__( /*! ./default_templates */ 283);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************************!*\
!*** ./Scripts/integration/knockout/clean_node.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
ko = __webpack_require__( /*! knockout */ 40),
cleanData = $.cleanData,
compareVersion = __webpack_require__( /*! ../../core/utils/version */ 56).compare;
if (compareVersion($.fn.jquery, [2, 0]) < 0) {
return
}
$.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])
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************************!*\
!*** ./Scripts/integration/knockout/clean_node_old.js ***!
\********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
ko = __webpack_require__( /*! knockout */ 40),
compareVersion = __webpack_require__( /*! ../../core/utils/version */ 56).compare;
if (compareVersion($.fn.jquery, [2, 0]) >= 0) {
return
}
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
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************************************!*\
!*** ./Scripts/integration/knockout/component_registrator.js ***!
\***************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
ko = __webpack_require__( /*! knockout */ 40),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 3),
Widget = __webpack_require__( /*! ../../ui/widget/ui.widget */ 19),
KoTemplateProvider = __webpack_require__( /*! ./template_provider */ 216),
Editor = __webpack_require__( /*! ../../ui/editor/editor */ 31),
Locker = __webpack_require__( /*! ../../core/utils/locker */ 200);
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)
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************************!*\
!*** ./Scripts/integration/knockout/components.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
errors = __webpack_require__( /*! ../../core/errors */ 10),
Action = __webpack_require__( /*! ../../core/action */ 54),
compileGetter = __webpack_require__( /*! ../../core/utils/data */ 16).compileGetter,
ko = __webpack_require__( /*! knockout */ 40),
iconUtils = __webpack_require__( /*! ../../core/utils/icon */ 77),
inflector = __webpack_require__( /*! ../../core/utils/inflector */ 29),
clickEvent = __webpack_require__( /*! ../../events/click */ 9),
dateUtils = __webpack_require__( /*! ../../core/utils/date */ 12),
dateLocalization = __webpack_require__( /*! ../../localization/date */ 14);
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)
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************************!*\
!*** ./Scripts/integration/knockout/default_templates.js ***!
\***********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************************!*\
!*** ./Scripts/integration/knockout/event_registrator.js ***!
\***********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
ko = __webpack_require__( /*! knockout */ 40),
eventRegistrator = __webpack_require__( /*! ../../events/core/event_registrator */ 43),
eventUtils = __webpack_require__( /*! ../../events/utils */ 4);
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)
})
}
}
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************************!*\
!*** ./Scripts/integration/knockout/template.js ***!
\**************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
ko = __webpack_require__( /*! knockout */ 40),
TemplateBase = __webpack_require__( /*! ../../ui/widget/ui.template_base */ 47),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 11);
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(data, index, $container) {
var $placeholder = $(" ").appendTo($container);
var $result;
ko.renderTemplate(this._template.get(0), data, {
afterRender: function(nodes) {
$result = $(nodes)
}
}, $placeholder.get(0), "replaceNode");
return $result
},
dispose: function() {
this.callBase();
this._template.remove()
}
});
module.exports = KoTemplate
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************************!*\
!*** ./Scripts/integration/knockout/validation.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../../core/class */ 5),
EventsMixin = __webpack_require__( /*! ../../core/events_mixin */ 32),
ValidationEngine = __webpack_require__( /*! ../../ui/validation_engine */ 64),
ko = __webpack_require__( /*! knockout */ 40);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************************************!*\
!*** ./Scripts/integration/knockout/variable_wrapper_utils.js ***!
\****************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var ko = __webpack_require__( /*! knockout */ 40),
variableWrapper = __webpack_require__( /*! ../../core/utils/variable_wrapper */ 73);
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)
}
}
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************!*\
!*** ./Scripts/localization/en/core.en.js ***!
\********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
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"
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************************!*\
!*** ./Scripts/localization/en/widgets-base.en.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
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"
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!******************************************************!*\
!*** ./Scripts/localization/en/widgets-mobile.en.js ***!
\******************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************************!*\
!*** ./Scripts/localization/en/widgets-web.en.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
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"
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************************!*\
!*** ./Scripts/localization/globalize/currency.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
__webpack_require__( /*! ./core */ 86);
__webpack_require__( /*! ./number */ 152);
__webpack_require__( /*! ../currency */ 117);
__webpack_require__( /*! globalize/currency */ 46);
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 */ 46),
config = __webpack_require__( /*! ../../core/config */ 35),
numberLocalization = __webpack_require__( /*! ../number */ 38);
if (!Globalize || !Globalize.formatCurrency) {
return
}
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)
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!************************************************!*\
!*** ./Scripts/localization/globalize/date.js ***!
\************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
__webpack_require__( /*! ./core */ 86);
__webpack_require__( /*! ./number */ 152);
__webpack_require__( /*! globalize/date */ 46);
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 */ 1),
Globalize = __webpack_require__( /*! globalize */ 46),
dateLocalization = __webpack_require__( /*! ../date */ 14),
errors = __webpack_require__( /*! ../../core/errors */ 10);
if (!Globalize || !Globalize.formatDate) {
return
}
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)
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************************!*\
!*** ./Scripts/localization/globalize/message.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
__webpack_require__( /*! ./core */ 86);
var Globalize = __webpack_require__( /*! globalize */ 46),
messageLocalization = __webpack_require__( /*! ../message */ 8);
__webpack_require__( /*! globalize/message */ 46);
if (!Globalize || !Globalize.formatMessage) {
return
}
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)
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!************************************************************!*\
!*** ./Scripts/ui/collection/ui.collection_widget.base.js ***!
\************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Action = __webpack_require__( /*! ../../core/action */ 54),
Guid = __webpack_require__( /*! ../../core/guid */ 33),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
domUtils = __webpack_require__( /*! ../../core/utils/dom */ 11),
Widget = __webpack_require__( /*! ../widget/ui.widget */ 19),
eventUtils = __webpack_require__( /*! ../../events/utils */ 4),
pointerEvents = __webpack_require__( /*! ../../events/pointer */ 13),
DataHelperMixin = __webpack_require__( /*! ./ui.data_helper */ 118),
selectors = __webpack_require__( /*! ../widget/jquery.selectors */ 98),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 8),
holdEvent = __webpack_require__( /*! ../../events/hold */ 63),
clickEvent = __webpack_require__( /*! ../../events/click */ 9),
contextmenuEvent = __webpack_require__( /*! ../../events/contextmenu */ 173);
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 (-1 === $.inArray(e.target, this._focusTarget())) {
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() || -1 !== this._startIndexForAppendedItems) {
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()
},
_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
}
var $target = $(e.target),
$closestItem = $target.closest(this._itemElements()),
$closestFocusable = $target.closest(selectors.focusable);
if ($closestItem.length && -1 !== $.inArray($closestFocusable.get(0), this._focusTarget())) {
this.option("focusedElement", $closestItem)
}
},
_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(commonUtils.isDefined(itemData) ? itemData : {}, $container, 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(renderArgs.itemData, renderArgs.container, renderArgs.index, "ignoreTarget")
},
_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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*********************************************************************!*\
!*** ./Scripts/ui/collection/ui.collection_widget.edit.strategy.js ***!
\*********************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../../core/class */ 5),
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*************************************************!*\
!*** ./Scripts/ui/context_menu/ui.menu_base.js ***!
\*************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
inkRipple = __webpack_require__( /*! ../widget/utils.ink_ripple */ 48),
HierarchicalCollectionWidget = __webpack_require__( /*! ../hierarchical_collection/ui.hierarchical_collection_widget */ 313),
MenuBaseEditStrategy = __webpack_require__( /*! ./ui.menu_base.edit.strategy */ 423),
devices = __webpack_require__( /*! ../../core/devices */ 7),
themes = __webpack_require__( /*! ../themes */ 23);
var DX_MENU_CLASS = "dx-menu",
DX_MENU_NO_ICONS_CLASS = DX_MENU_CLASS + "-no-icons",
DX_MENU_BASE_CLASS = "dx-menu-base",
ITEM_CLASS = DX_MENU_CLASS + "-item",
DX_MENU_SELECTED_ITEM_CLASS = ITEM_CLASS + "-selected",
DX_MENU_ITEM_WRAPPER_CLASS = ITEM_CLASS + "-wrapper",
DX_MENU_ITEMS_CONTAINER_CLASS = DX_MENU_CLASS + "-items-container",
DX_MENU_ITEM_EXPANDED_CLASS = ITEM_CLASS + "-expanded",
DX_MENU_SEPARATOR_CLASS = DX_MENU_CLASS + "-separator",
DX_MENU_ITEM_LAST_GROUP_ITEM = DX_MENU_CLASS + "-last-group-item",
DX_ITEM_HAS_TEXT = ITEM_CLASS + "-has-text",
DX_ITEM_HAS_ICON = ITEM_CLASS + "-has-icon",
DX_ITEM_HAS_SUBMENU = ITEM_CLASS + "-has-submenu",
DX_MENU_ITEM_POPOUT_CLASS = ITEM_CLASS + "-popout",
DX_MENU_ITEM_POPOUT_CONTAINER_CLASS = DX_MENU_ITEM_POPOUT_CLASS + "-container",
DX_MENU_ITEM_CAPTION_CLASS = ITEM_CLASS + "-text",
SINGLE_SELECTION_MODE = "single",
DEFAULT_DELAY = {
show: 50,
hide: 300
};
var MenuBase = HierarchicalCollectionWidget.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
items: [],
cssClass: "",
activeStateEnabled: true,
showSubmenuMode: {
name: "onHover",
delay: {
show: 50,
hide: 300
}
},
animation: {
show: {
type: "fade",
from: 0,
to: 1,
duration: 100
},
hide: {
type: "fade",
from: 1,
to: 0,
duration: 100
}
},
selectByClick: false,
focusOnSelectedItem: false,
_itemAttributes: {
role: "menuitem"
},
useInkRipple: false
})
},
_setDeprecatedOptions: function() {
this.callBase();
$.extend(this._deprecatedOptions, {
selectionByClick: {
since: "16.1",
alias: "selectByClick"
}
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function() {
return /android5/.test(themes.current())
},
options: {
useInkRipple: true
}
}])
},
_activeStateUnit: "." + ITEM_CLASS,
_itemDataKey: function() {
return "dxMenuItemDataKey"
},
_itemClass: function() {
return ITEM_CLASS
},
_setAriaSelected: $.noop,
_selectedItemClass: function() {
return DX_MENU_SELECTED_ITEM_CLASS
},
_widgetClass: function() {
return DX_MENU_BASE_CLASS
},
_focusTarget: function() {
return this._itemContainer()
},
_supportedKeys: function() {
var selectItem = function(e) {
var $item = this.option("focusedElement");
if (!$item || !this._isSelectionEnabled()) {
return
}
this.selectItem($item[0])
};
return $.extend(this.callBase(), {
space: selectItem,
pageUp: $.noop,
pageDown: $.noop
})
},
_isSelectionEnabled: function() {
return this.option("selectionMode") === SINGLE_SELECTION_MODE
},
_init: function() {
this.callBase();
this._renderSelectedItem();
this._initActions()
},
_useCustomExpressions: function() {
return this.callBase() || "items" !== this.option("itemsExpr")
},
_getTextContainer: function(itemData) {
var itemText = this._displayGetter(itemData),
$itemContainer = $(" ").addClass(DX_MENU_ITEM_CAPTION_CLASS),
itemContent = $.isPlainObject(itemData) ? itemText : String(itemData);
return itemText && $itemContainer.html(itemContent)
},
_getPopoutContainer: function(itemData) {
var $popOutContainer, items = this._itemsGetter(itemData);
if (items && items.length) {
var $popOutImage = $("").addClass(DX_MENU_ITEM_POPOUT_CLASS);
$popOutContainer = $(" ").addClass(DX_MENU_ITEM_POPOUT_CONTAINER_CLASS).append($popOutImage)
}
return $popOutContainer
},
_getDataAdapterOptions: function() {
return {
rootValue: 0,
multipleSelection: false,
recursiveSelection: false,
recursiveExpansion: false,
searchValue: ""
}
},
_selectByItem: function(selectedItem) {
if (!selectedItem) {
return
}
var nodeToSelect = this._dataAdapter.getNodeByItem(selectedItem);
this._dataAdapter.toggleSelection(nodeToSelect.internalFields.key, true)
},
_renderSelectedItem: function() {
var selectedKeys = this._dataAdapter.getSelectedNodesKeys(),
selectedKey = selectedKeys.length && selectedKeys[0],
selectedItem = this.option("selectedItem");
if (!selectedKey) {
this._selectByItem(selectedItem);
return
}
var node = this._dataAdapter.getNodeByKey(selectedKey);
if (false === node.selectable) {
return
}
if (!selectedItem) {
this.option("selectedItem", node.internalFields.item);
return
}
if (selectedItem !== node.internalFields.item) {
this._dataAdapter.toggleSelection(selectedKey, false);
this._selectByItem(selectedItem)
}
},
_initActions: $.noop,
_render: function() {
this.callBase();
this._addCustomCssClass(this.element());
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)
}
},
_getShowSubmenuMode: function() {
var defaultValue = "onClick",
optionValue = this.option("showSubmenuMode");
optionValue = commonUtils.isObject(optionValue) ? optionValue.name : optionValue;
return this._isDesktopDevice() ? optionValue : defaultValue
},
_initSelectedItems: $.noop,
_isDesktopDevice: function() {
return "desktop" === devices.real().deviceType
},
_initEditStrategy: function() {
var Strategy = MenuBaseEditStrategy;
this._editStrategy = new Strategy(this)
},
_addCustomCssClass: function($element) {
$element.addClass(this.option("cssClass"))
},
_itemWrapperSelector: function() {
return "." + DX_MENU_ITEM_WRAPPER_CLASS
},
_hoverStartHandler: function(e) {
var that = this,
$itemElement = that._getItemElementByEventArgs(e);
if (!$itemElement || that._isItemDisabled($itemElement)) {
return
}
e.stopPropagation();
that.option("focusedElement", $itemElement);
if ("onHover" === that._getShowSubmenuMode()) {
this._showSubmenusTimeout = setTimeout($.proxy(that._showSubmenu, that, $itemElement), that._getSubmenuDelay("show"))
}
},
_isItemDisabled: function($item) {
return this._disabledGetter($item.data(this._itemDataKey()))
},
_showSubmenu: function($itemElement) {
clearTimeout(this._showSubmenusTimeout);
if (this._hasFocusClass($itemElement)) {
this._addExpandedClass($itemElement)
}
},
_addExpandedClass: function($itemElement) {
$itemElement.addClass(DX_MENU_ITEM_EXPANDED_CLASS)
},
_getSubmenuDelay: function(action) {
var delay = this.option("showSubmenuMode").delay;
if (!commonUtils.isDefined(delay)) {
return DEFAULT_DELAY[action]
}
return commonUtils.isObject(delay) ? delay[action] : delay
},
_getItemElementByEventArgs: function(eventArgs) {
var $target = $(eventArgs.target);
if ($target.hasClass(this._itemClass()) || $target.get(0) === eventArgs.currentTarget) {
return $target
}
while (!$target.hasClass(this._itemClass())) {
$target = $target.parent();
if ($target.hasClass("dx-submenu")) {
return null
}
}
return $target
},
_hoverEndHandler: $.noop,
_hasSubmenu: function(node) {
return node.internalFields.childrenKeys.length
},
_renderContentImpl: function() {
this._renderItems(this._dataAdapter.getRootNodes())
},
_renderItems: function(nodes, submenuContainer) {
var $nodeContainer, that = this;
if (nodes.length) {
this.hasIcons = false;
$nodeContainer = this._renderContainer(this.element(), submenuContainer);
$.each(nodes, function(index, node) {
that._renderItem(index, node, $nodeContainer)
});
if (!this.hasIcons) {
$nodeContainer.addClass(DX_MENU_NO_ICONS_CLASS)
}
}
},
_renderContainer: function($wrapper) {
return $("").appendTo($wrapper).addClass(DX_MENU_ITEMS_CONTAINER_CLASS)
},
_createDOMElement: function($nodeContainer) {
var $node = $("- ").appendTo($nodeContainer).addClass(DX_MENU_ITEM_WRAPPER_CLASS);
return $node
},
_renderItem: function(index, node, $nodeContainer) {
var $itemFrame, items = this.option("items");
this._renderSeparator(node, index, $nodeContainer);
if (false === node.internalFields.item.visible) {
return
}
var $node = this._createDOMElement($nodeContainer);
if (items[index + 1] && items[index + 1].beginGroup) {
$node.addClass(DX_MENU_ITEM_LAST_GROUP_ITEM)
}
$itemFrame = this.callBase(index, node.internalFields.item, $node);
if (node.internalFields.item === this.option("selectedItem")) {
$itemFrame.addClass(DX_MENU_SELECTED_ITEM_CLASS)
}
this._addContentClasses(node, $itemFrame);
if (this._hasSubmenu(node)) {
this.setAria("haspopup", "true", $itemFrame)
}
},
_addContentClasses: function(node, $itemFrame) {
if (this._displayGetter(node)) {
$itemFrame.addClass(DX_ITEM_HAS_TEXT)
}
if (node.icon || node.iconSrc) {
$itemFrame.addClass(DX_ITEM_HAS_ICON);
this.hasIcons = true
}
if (this._hasSubmenu(node)) {
$itemFrame.addClass(DX_ITEM_HAS_SUBMENU)
}
},
_postprocessRenderItem: function(args) {
var node, $itemElement = $(args.itemElement),
selectedIndex = this._dataAdapter.getSelectedNodesKeys();
if (!selectedIndex.length || !this._selectedGetter(args.itemData) || !this._isItemSelectable(args.itemData)) {
this._setAriaSelected($itemElement, "false");
return
}
node = this._dataAdapter.getNodeByItem(args.itemData);
if (node.internalFields.key === selectedIndex[0]) {
$itemElement.addClass(this._selectedItemClass());
this._setAriaSelected($itemElement, "true")
} else {
this._setAriaSelected($itemElement, "false")
}
},
_isItemSelectable: function(item) {
return false !== item.selectable
},
_renderSeparator: function(node, index, $itemsContainer) {
if (node.beginGroup && index > 0) {
this._needSeparate = true
}
if (false !== node.visible && this._needSeparate) {
$("
- ").appendTo($itemsContainer).addClass(DX_MENU_SEPARATOR_CLASS);
this._needSeparate = false
}
},
_itemClickHandler: function(e) {
var itemClickActionHandler = this._createAction($.proxy(this._updateSubmenuVisibilityOnClick, this));
this._itemJQueryEventHandler(e, "onItemClick", {}, {
afterExecute: $.proxy(itemClickActionHandler, this)
})
},
_updateSubmenuVisibilityOnClick: function(actionArgs) {
this._updateSelectedItemOnClick(actionArgs);
if ("onClick" === this._getShowSubmenuMode()) {
this._addExpandedClass(actionArgs.args[0].itemElement)
}
},
_updateSelectedItemOnClick: function(actionArgs) {
var selectedItemKey, args = actionArgs.args ? actionArgs.args[0] : actionArgs;
if (!this._isItemSelectionAllowed(args.itemData)) {
return
}
selectedItemKey = this._dataAdapter.getSelectedNodesKeys();
var selectedNode = selectedItemKey.length && this._dataAdapter.getNodeByKey(selectedItemKey[0]);
if (selectedNode) {
this._toggleItemSelection(selectedNode, false)
}
if (!selectedNode || selectedNode.internalFields.item !== args.itemData) {
this.selectItem(args.itemData)
} else {
this._fireSelectionChangeEvent(null, this.option("selectedItem"));
this._setOptionSilent("selectedItem", null)
}
},
_isItemSelectionAllowed: function(item) {
var isSelectionByClickEnabled = this._isSelectionEnabled() && this.option("selectByClick");
return !this._isContainerEmpty() && isSelectionByClickEnabled && this._isItemSelectable(item) && !this._itemsGetter(item)
},
_isContainerEmpty: function() {
return this._itemContainer().is(":empty")
},
_syncSelectionOptions: $.noop,
_optionChanged: function(args) {
if (this._cancelOptionChange) {
return
}
switch (args.name) {
case "showSubmenuMode":
break;
case "selectedItem":
var itemData = args.value,
node = this._dataAdapter.getNodeByItem(itemData),
selectedKey = this._dataAdapter.getSelectedNodesKeys()[0];
if (node && node.internalFields.key !== selectedKey) {
if (false === node.selectable) {
break
}
if (selectedKey) {
this._toggleItemSelection(this._dataAdapter.getNodeByKey(selectedKey), false)
}
this._toggleItemSelection(node, true);
this._updateSelectedItems()
}
break;
case "cssClass":
case "position":
case "selectByClick":
case "animation":
case "useInkRipple":
this._invalidate();
break;
default:
this.callBase(args)
}
},
_toggleItemSelection: function(node, value) {
var itemElement = this._getElementByItem(node.internalFields.item);
itemElement && $(itemElement).toggleClass(DX_MENU_SELECTED_ITEM_CLASS);
this._dataAdapter.toggleSelection(node.internalFields.key, value)
},
_getElementByItem: function(itemData) {
var result, that = this;
$.each(this._itemContainer().find("." + ITEM_CLASS), function(_, itemElement) {
if ($(itemElement).data(that._itemDataKey()) !== itemData) {
return true
}
result = itemElement;
return false
});
return result
},
_updateSelectedItems: function(oldSelection, newSelection) {
if (oldSelection || newSelection) {
this._updateSelection(newSelection, oldSelection);
this._fireSelectionChangeEvent(newSelection, oldSelection)
}
},
_fireSelectionChangeEvent: function(addedSelection, removedSelection) {
this._createActionByOption("onSelectionChanged", {
excludeValidators: ["disabled", "readOnly"]
})({
addedItems: [addedSelection],
removedItems: [removedSelection]
})
},
selectItem: function(itemElement) {
var itemData = itemElement.nodeType ? this._getItemData(itemElement) : itemElement,
node = this._dataAdapter.getNodeByItem(itemData),
selectedKey = this._dataAdapter.getSelectedNodesKeys()[0],
selectedItem = this.option("selectedItem");
if (node.internalFields.key !== selectedKey) {
if (selectedKey) {
this._toggleItemSelection(this._dataAdapter.getNodeByKey(selectedKey), false)
}
this._toggleItemSelection(node, true);
this._updateSelectedItems(selectedItem, itemData);
this._setOptionSilent("selectedItem", itemData)
}
},
unselectItem: function(itemElement) {
var itemData = itemElement.nodeType ? this._getItemData(itemElement) : itemElement,
node = this._dataAdapter.getNodeByItem(itemData),
selectedItem = this.option("selectedItem");
if (node.internalFields.selected) {
this._toggleItemSelection(node, false);
this._updateSelectedItems(selectedItem, null);
this._setOptionSilent("selectedItem", null)
}
}
});
MenuBase.publicName("dxMenuBase");
module.exports = MenuBase
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!******************************************************!*\
!*** ./Scripts/ui/data_grid/ui.data_grid.editing.js ***!
\******************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Guid = __webpack_require__( /*! ../../core/guid */ 33),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
objectUtils = __webpack_require__( /*! ../../core/utils/object */ 30),
gridCore = __webpack_require__( /*! ./ui.data_grid.core */ 17),
clickEvent = __webpack_require__( /*! ../../events/click */ 9),
gridCoreUtils = __webpack_require__( /*! ../grid_core/ui.grid_core.utils */ 42),
getIndexByKey = gridCoreUtils.getIndexByKey,
eventUtils = __webpack_require__( /*! ../../events/utils */ 4),
addNamespace = eventUtils.addNamespace,
dialog = __webpack_require__( /*! ../dialog */ 220),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 8),
Button = __webpack_require__( /*! ../button */ 24),
errors = __webpack_require__( /*! ../widget/ui.errors */ 20),
devices = __webpack_require__( /*! ../../core/devices */ 7),
Form = __webpack_require__( /*! ../form */ 174),
holdEvent = __webpack_require__( /*! ../../events/hold */ 63);
__webpack_require__( /*! ./ui.data_grid.editor_factory */ 223);
var DATAGRID_LINK_CLASS = "dx-link",
DATAGRID_EDITOR_CELL_CLASS = "dx-editor-cell",
DATAGRID_ROW_SELECTED = "dx-selection",
DATAGRID_EDIT_ROW = "dx-edit-row",
DATAGRID_EDIT_FORM_CLASS = "dx-datagrid-edit-form",
DATAGRID_EDIT_BUTTON_CLASS = "dx-edit-button",
DATAGRID_INSERT_INDEX = "__DX_INSERT_INDEX__",
DATAGRID_ROW_CLASS = "dx-row",
DATAGRID_ROW_REMOVED = "dx-row-removed",
DATAGRID_ROW_INSERTED = "dx-row-inserted",
DATAGRID_ROW_MODIFIED = "dx-row-modified",
DATAGRID_CELL_MODIFIED = "dx-cell-modified",
DATAGRID_CELL_HIGHLIGHT_OUTLINE = "dx-highlight-outline",
DATAGRID_EDITING_NAMESPACE = "dxDataGridEditing",
DATAGRID_FOCUS_OVERLAY_CLASS = "dx-datagrid-focus-overlay",
DATAGRID_READONLY_CLASS = "dx-datagrid-readonly",
DATAGRID_DATA_ROW_CLASS = "dx-data-row",
DATAGRID_CELL_FOCUS_DISABLED_CLASS = "dx-cell-focus-disabled",
DATAGRID_EDIT_MODE_BATCH = "batch",
DATAGRID_EDIT_MODE_ROW = "row",
DATAGRID_EDIT_MODE_CELL = "cell",
DATAGRID_EDIT_MODE_FORM = "form",
DATA_EDIT_DATA_INSERT_TYPE = "insert",
DATA_EDIT_DATA_UPDATE_TYPE = "update",
DATA_EDIT_DATA_REMOVE_TYPE = "remove",
DATAGRID_POINTER_EVENTS_NONE_CLASS = "dx-pointer-events-none",
DATAGRID_POINTER_EVENTS_TARGET_CLASS = "dx-pointer-events-target";
var getEditMode = function(that) {
var editMode = that.option("editing.mode");
if (editMode === DATAGRID_EDIT_MODE_BATCH || editMode === DATAGRID_EDIT_MODE_CELL || editMode === DATAGRID_EDIT_MODE_FORM) {
return editMode
}
return DATAGRID_EDIT_MODE_ROW
};
var isRowEditMode = function(that) {
var editMode = getEditMode(that);
return editMode === DATAGRID_EDIT_MODE_ROW || editMode === DATAGRID_EDIT_MODE_FORM
};
exports.EditingController = gridCore.ViewController.inherit(function() {
var getDefaultEditorTemplate = function(that) {
return function(container, options) {
var $editor = $("").appendTo(container);
that.getController("editorFactory").createEditor($editor, $.extend({}, options.column, {
value: options.value,
setValue: options.setValue,
row: options.row,
parentType: "dataRow",
width: null,
readOnly: !options.setValue,
id: options.id
}))
}
};
return {
init: function() {
var that = this;
that._insertIndex = 1;
that._editRowIndex = -1;
that._editData = [];
that._editColumnIndex = -1;
that._columnsController = that.getController("columns");
that._dataController = that.getController("data");
if (!that._dataChangedHandler) {
that._dataChangedHandler = $.proxy(that._handleDataChanged, that);
that._dataController.changed.add(that._dataChangedHandler)
}
if (!that._saveEditorHandler) {
that.createAction("onInitNewRow", {
excludeValidators: ["disabled", "readOnly"]
});
that.createAction("onRowInserting", {
excludeValidators: ["disabled", "readOnly"]
});
that.createAction("onRowInserted", {
excludeValidators: ["disabled", "readOnly"]
});
that.createAction("onEditingStart", {
excludeValidators: ["disabled", "readOnly"]
});
that.createAction("onRowUpdating", {
excludeValidators: ["disabled", "readOnly"]
});
that.createAction("onRowUpdated", {
excludeValidators: ["disabled", "readOnly"]
});
that.createAction("onRowRemoving", {
excludeValidators: ["disabled", "readOnly"]
});
that.createAction("onRowRemoved", {
excludeValidators: ["disabled", "readOnly"]
});
that._saveEditorHandler = that.createAction(function(e) {
var isEditorPopup, isDomElement, isFocusOverlay, isAddRowButton, isCellEditMode, $target, event = e.jQueryEvent;
if (!isRowEditMode(that) && !that._editCellInProgress) {
$target = $(event.target);
isEditorPopup = $target.closest(".dx-dropdowneditor-overlay").length;
isDomElement = $target.closest(document).length;
isAddRowButton = $target.closest(".dx-datagrid-addrow-button").length;
isFocusOverlay = $target.hasClass(DATAGRID_FOCUS_OVERLAY_CLASS);
isCellEditMode = getEditMode(that) === DATAGRID_EDIT_MODE_CELL;
if (!isEditorPopup && !isFocusOverlay && !(isAddRowButton && isCellEditMode && that.isEditing()) && isDomElement) {
$.proxy(that._closeEditItem, that)($target)
}
}
});
$(document).on(clickEvent.name, that._saveEditorHandler)
}
that._updateEditColumn();
that._updateEditButtons()
},
_closeEditItem: function($targetElement) {
var isDataRow = $targetElement.closest("." + DATAGRID_DATA_ROW_CLASS).length,
$targetCell = $targetElement.closest("." + DATAGRID_ROW_CLASS + "> td"),
columnIndex = $targetCell[0] && $targetCell[0].cellIndex,
rowIndex = this.getView("rowsView").getRowIndex($targetCell.parent()),
visibleColumns = this._columnsController.getVisibleColumns(),
allowEditing = visibleColumns[columnIndex] && visibleColumns[columnIndex].allowEditing;
if (this.isEditing() && (!isDataRow || isDataRow && !allowEditing && !this.isEditCell(rowIndex, columnIndex))) {
this.closeEditCell()
}
},
_handleDataChanged: function(args) {
if ("standard" === this.option("scrolling.mode")) {
this.resetRowAndPageIndices()
}
if ("prepend" === args.changeType) {
$.each(this._editData, function(_, editData) {
editData.rowIndex += args.items.length;
if (editData.type === DATA_EDIT_DATA_INSERT_TYPE) {
editData.key.rowIndex += args.items.length
}
})
}
},
getEditMode: function() {
return getEditMode(this)
},
getFirstEditableColumnIndex: function() {
var columnIndex, columnsController = this.getController("columns"),
visibleColumns = columnsController.getVisibleColumns();
$.each(visibleColumns, function(index, column) {
if (column.allowEditing) {
columnIndex = index;
return false
}
});
return columnIndex
},
getFirstEditableCellInRow: function(rowIndex) {
return this.getView("rowsView").getCellElement(rowIndex ? rowIndex : 0, this.getFirstEditableColumnIndex())
},
getFocusedCellInRow: function(rowIndex) {
return this.getFirstEditableCellInRow(rowIndex)
},
getIndexByKey: function(key, items) {
return getIndexByKey(key, items)
},
hasChanges: function() {
var that = this,
result = false;
for (var i = 0; i < that._editData.length; i++) {
if (that._editData[i].type) {
result = true;
break
}
}
return result
},
dispose: function() {
this.callBase();
$(document).off(clickEvent.name, this._saveEditorHandler)
},
optionChanged: function(args) {
if ("editing" === args.name) {
this.init();
args.handled = true
} else {
this.callBase(args)
}
},
publicMethods: function() {
return ["insertRow", "addRow", "removeRow", "deleteRow", "undeleteRow", "editRow", "editCell", "closeEditCell", "saveEditData", "cancelEditData", "hasEditData"]
},
refresh: function() {
if (getEditMode(this) !== DATAGRID_EDIT_MODE_BATCH) {
this.init()
} else {
this._editRowIndex = -1;
this._editColumnIndex = -1
}
},
isEditing: function() {
return this._editRowIndex > -1
},
isEditRow: function(rowIndex) {
return this._editRowIndex === rowIndex && (getEditMode(this) === DATAGRID_EDIT_MODE_ROW || getEditMode(this) === DATAGRID_EDIT_MODE_FORM)
},
getEditRowKey: function() {
var items = this._dataController.items(),
item = items[this._editRowIndex];
return item && item.key
},
getEditFormRowIndex: function() {
return getEditMode(this) === DATAGRID_EDIT_MODE_FORM ? this._editRowIndex : -1
},
isEditCell: function(rowIndex, columnIndex) {
return this._editRowIndex === rowIndex && this._editColumnIndex === columnIndex
},
_needInsertItem: function(editData, changeType) {
var that = this,
dataSource = that._dataController.dataSource(),
scrollingMode = that.option("scrolling.mode"),
pageIndex = dataSource.pageIndex(),
beginPageIndex = dataSource.beginPageIndex ? dataSource.beginPageIndex() : pageIndex,
endPageIndex = dataSource.endPageIndex ? dataSource.endPageIndex() : pageIndex;
if ("standard" !== scrollingMode) {
switch (changeType) {
case "append":
return editData.key.pageIndex === endPageIndex;
case "prepend":
return editData.key.pageIndex === beginPageIndex;
case "refresh":
editData.key.rowIndex = 0;
editData.key.pageIndex = 0;
break;
default:
return editData.key.pageIndex >= beginPageIndex && editData.key.pageIndex <= endPageIndex
}
}
return editData.key.pageIndex === pageIndex
},
processItems: function(items, changeType) {
var i, key, data, that = this,
editData = that._editData;
that.update(changeType);
for (i = 0; i < editData.length; i++) {
key = editData[i].key;
data = {
key: key
};
if (editData[i].type === DATA_EDIT_DATA_INSERT_TYPE && that._needInsertItem(editData[i], changeType)) {
data[DATAGRID_INSERT_INDEX] = key[DATAGRID_INSERT_INDEX];
items.splice(key.rowIndex, 0, data)
}
}
return items
},
processDataItem: function(item, columns, generateDataValues) {
var editIndex, editData, data, editMode, that = this,
key = item.data[DATAGRID_INSERT_INDEX] ? item.data.key : item.key;
editIndex = getIndexByKey(key, that._editData);
if (editIndex >= 0) {
editMode = getEditMode(that);
editData = that._editData[editIndex];
data = editData.data;
switch (editData.type) {
case DATA_EDIT_DATA_INSERT_TYPE:
item.inserted = true;
item.key = key;
item.data = data;
break;
case DATA_EDIT_DATA_UPDATE_TYPE:
item.modified = true;
item.oldData = item.data;
item.data = $.extend(true, {}, item.data, data);
item.modifiedValues = generateDataValues(data, columns);
break;
case DATA_EDIT_DATA_REMOVE_TYPE:
if (editMode === DATAGRID_EDIT_MODE_BATCH) {
item.data = $.extend(true, {}, item.data, data)
}
item.removed = true
}
}
},
insertRow: function() {
errors.log("W0002", "dxDataGrid", "insertRow", "15.2", "Use the 'addRow' method instead");
return this.addRow()
},
addRow: function() {
var $firstCell, that = this,
dataController = that._dataController,
store = dataController.store(),
key = store && store.key(),
rowsView = that.getView("rowsView"),
param = {
data: {}
},
insertKey = {
pageIndex: dataController.pageIndex(),
rowIndex: rowsView ? rowsView.getTopVisibleItemIndex() : 0
},
oldEditRowIndex = that._editRowIndex,
editMode = getEditMode(that);
if (editMode === DATAGRID_EDIT_MODE_CELL && that.hasChanges()) {
that.saveEditData()
}
that.refresh();
if (editMode !== DATAGRID_EDIT_MODE_BATCH && that._insertIndex > 1) {
return
}
if (!key) {
param.data.__KEY__ = String(new Guid)
}
that.executeAction("onInitNewRow", param);
if (editMode !== DATAGRID_EDIT_MODE_BATCH) {
that._editRowIndex = insertKey.rowIndex
}
insertKey[DATAGRID_INSERT_INDEX] = that._insertIndex++;
that._addEditData({
key: insertKey,
data: param.data,
type: DATA_EDIT_DATA_INSERT_TYPE
});
dataController.updateItems({
changeType: "update",
rowIndices: [oldEditRowIndex, insertKey.rowIndex]
});
$firstCell = that.getFirstEditableCellInRow(insertKey.rowIndex);
that._delayedInputFocus($firstCell, function() {
var $cell = that.getFirstEditableCellInRow(insertKey.rowIndex);
$cell && $cell.trigger(clickEvent.name)
});
that._afterInsertRow({
key: insertKey,
data: param.data
})
},
_isEditingStart: function(options) {
this.executeAction("onEditingStart", options);
return options.cancel
},
_beforeEditCell: function(rowIndex, columnIndex, item) {
if (getEditMode(this) === DATAGRID_EDIT_MODE_CELL && !item.inserted && this.hasChanges()) {
this.saveEditData();
if (this.hasChanges()) {
return true
}
}
},
_beforeUpdateItems: function(rowIndices) {},
editRow: function(rowIndex) {
var $editingCell, that = this,
dataController = that._dataController,
items = dataController.items(),
item = items[rowIndex],
params = {
data: item.data,
cancel: false
},
oldEditRowIndex = that._editRowIndex;
if (rowIndex === oldEditRowIndex) {
return true
}
if (!item.inserted) {
params.key = item.key
}
if (that._isEditingStart(params)) {
return
}
that.init();
that._pageIndex = dataController.pageIndex();
that._editRowIndex = items[0].inserted ? rowIndex - 1 : rowIndex;
that._addEditData({
data: {},
key: item.key,
oldData: item.data
});
var rowIndices = [oldEditRowIndex, rowIndex];
that._beforeUpdateItems(rowIndices, rowIndex, oldEditRowIndex);
dataController.updateItems({
changeType: "update",
rowIndices: rowIndices
});
if (getEditMode(that) === DATAGRID_EDIT_MODE_ROW || getEditMode(that) === DATAGRID_EDIT_MODE_FORM) {
$editingCell = that.getFocusedCellInRow(that._editRowIndex);
that._delayedInputFocus($editingCell, function() {
$editingCell && that.component.focus($editingCell)
})
}
},
editCell: function(rowIndex, columnIndex) {
var $cell, showEditorAlways, that = this,
columnsController = that._columnsController,
dataController = that._dataController,
items = dataController.items(),
item = items[rowIndex],
params = {
data: item && item.data,
cancel: false
},
oldEditRowIndex = that._editRowIndex,
oldEditColumnIndex = that._editColumnIndex,
columns = columnsController.getVisibleColumns();
if (commonUtils.isString(columnIndex)) {
columnIndex = columnsController.columnOption(columnIndex, "index");
columnIndex = columnsController.getVisibleIndex(columnIndex)
}
params.column = columnsController.getVisibleColumns()[columnIndex];
showEditorAlways = params.column && params.column.showEditorAlways;
if (params.column && item && ("data" === item.rowType || "detailAdaptive" === item.rowType) && !item.removed && !isRowEditMode(that)) {
if (this.isEditCell(rowIndex, columnIndex)) {
return true
}
if (that._beforeEditCell(rowIndex, columnIndex, item)) {
return true
}
if (!item.inserted) {
params.key = item.key
}
if (that._isEditingStart(params)) {
return true
}
that._editRowIndex = rowIndex;
that._editColumnIndex = columnIndex;
that._pageIndex = dataController.pageIndex();
that._addEditData({
data: {},
key: item.key,
oldData: item.data
});
if (!showEditorAlways || columns[oldEditColumnIndex] && !columns[oldEditColumnIndex].showEditorAlways) {
that._editCellInProgress = true;
that.getController("editorFactory").loseFocus();
dataController.updateItems({
changeType: "update",
rowIndices: [oldEditRowIndex, that._editRowIndex]
})
}
$cell = that.getView("rowsView").getCellElement(that._editRowIndex, that._editColumnIndex);
if ($cell && !$cell.find(":focus").length) {
that._focusEditingCell(function() {
that._editCellInProgress = false
}, $cell)
} else {
that._editCellInProgress = false
}
return true
}
return false
},
_delayedInputFocus: function($cell, beforeFocusCallback) {
function inputFocus() {
if (beforeFocusCallback) {
beforeFocusCallback()
}
$cell && $cell.find("[tabindex], input").first().focus()
}
if (devices.real().ios || devices.real().android) {
inputFocus()
} else {
setTimeout(inputFocus)
}
},
_focusEditingCell: function(beforeFocusCallback, $editCell) {
var that = this;
$editCell = $editCell || that.getView("rowsView").getCellElement(that._editRowIndex, that._editColumnIndex);
that._delayedInputFocus($editCell, beforeFocusCallback)
},
removeRow: function(rowIndex) {
errors.log("W0002", "dxDataGrid", "removeRow", "15.2", "Use the 'deleteRow' method instead");
return this.deleteRow(rowIndex)
},
deleteRow: function(rowIndex) {
var removeByKey, showDialogTitle, that = this,
editingOptions = that.option("editing"),
editingTexts = editingOptions && editingOptions.texts,
confirmDeleteTitle = editingTexts && editingTexts.confirmDeleteTitle,
isBatchMode = editingOptions && editingOptions.mode === DATAGRID_EDIT_MODE_BATCH,
confirmDeleteMessage = editingTexts && editingTexts.confirmDeleteMessage,
dataController = that._dataController,
oldEditRowIndex = that._editRowIndex,
item = dataController.items()[rowIndex],
key = item && item.key;
if (item) {
removeByKey = function(key) {
that.refresh();
var editIndex = getIndexByKey(key, that._editData);
if (editIndex >= 0) {
if (that._editData[editIndex].type === DATA_EDIT_DATA_INSERT_TYPE) {
that._editData.splice(editIndex, 1)
} else {
that._editData[editIndex].type = DATA_EDIT_DATA_REMOVE_TYPE
}
} else {
that._addEditData({
key: key,
oldData: item.data,
type: DATA_EDIT_DATA_REMOVE_TYPE
})
}
if (isBatchMode) {
dataController.updateItems({
changeType: "update",
rowIndices: [oldEditRowIndex, rowIndex]
})
} else {
that.saveEditData()
}
};
if (isBatchMode || !confirmDeleteMessage) {
removeByKey(key)
} else {
showDialogTitle = commonUtils.isDefined(confirmDeleteTitle) && confirmDeleteTitle.length > 0;
dialog.confirm(confirmDeleteMessage, confirmDeleteTitle, showDialogTitle).done(function(confirmResult) {
if (confirmResult) {
removeByKey(key)
}
})
}
}
},
undeleteRow: function(rowIndex) {
var that = this,
dataController = that._dataController,
item = dataController.items()[rowIndex],
oldEditRowIndex = that._editRowIndex,
key = item && item.key;
if (item) {
var editData, editIndex = getIndexByKey(key, that._editData);
if (editIndex >= 0) {
editData = that._editData[editIndex];
if ($.isEmptyObject(editData.data)) {
that._editData.splice(editIndex, 1)
} else {
editData.type = DATA_EDIT_DATA_UPDATE_TYPE
}
dataController.updateItems({
changeType: "update",
rowIndices: [oldEditRowIndex, rowIndex]
})
}
}
},
_saveEditDataCore: function(deferreds, processedKeys) {
var that = this,
store = that._dataController.store(),
hasCanceledData = false;
function executeEditingAction(actionName, params, func) {
var deferred = $.Deferred();
that.executeAction(actionName, params);
function createFailureHandler(deferred) {
return function(arg) {
var error = arg instanceof Error ? arg : new Error(arg && String(arg) || "Unknown error");
deferred.reject(error)
}
}
$.when(params.cancel).done(function(cancel) {
if (cancel) {
deferred.resolve("cancel")
} else {
func(params).done(deferred.resolve).fail(createFailureHandler(deferred))
}
}).fail(createFailureHandler(deferred));
return deferred
}
$.each(that._editData, function(index, editData) {
var deferred, doneDeferred, params, data = editData.data,
oldData = editData.oldData,
key = editData.key,
type = editData.type;
if (that._beforeSaveEditData(editData, index)) {
return
}
switch (type) {
case DATA_EDIT_DATA_REMOVE_TYPE:
params = {
data: oldData,
key: key,
cancel: false
};
deferred = executeEditingAction("onRowRemoving", params, function() {
return store.remove(key)
});
break;
case DATA_EDIT_DATA_INSERT_TYPE:
params = {
data: data,
cancel: false
};
deferred = executeEditingAction("onRowInserting", params, function() {
return store.insert(params.data)
});
break;
case DATA_EDIT_DATA_UPDATE_TYPE:
params = {
newData: data,
oldData: oldData,
key: key,
cancel: false
};
deferred = executeEditingAction("onRowUpdating", params, function() {
return store.update(key, params.newData)
})
}
if (deferred) {
doneDeferred = $.Deferred();
deferred.always(function() {
processedKeys.push(key)
}).always(doneDeferred.resolve);
deferreds.push(doneDeferred.promise())
}
});
return hasCanceledData
},
_processSaveEditDataResult: function(results, processedKeys) {
var i, arg, editIndex, isError, that = this,
dataController = that._dataController,
editMode = getEditMode(that);
for (i = 0; i < results.length; i++) {
arg = results[i];
editIndex = getIndexByKey(processedKeys[i], that._editData);
if (that._editData[editIndex]) {
isError = arg && arg instanceof Error;
if (isError) {
that._editData[editIndex].error = arg;
dataController.dataErrorOccurred.fire(arg);
if (editMode !== DATAGRID_EDIT_MODE_BATCH) {
return false
}
} else {
if ("cancel" !== arg) {
that._editData.splice(editIndex, 1)
} else {
return false
}
}
}
}
return true
},
_fireSaveEditDataEvents: function(editData) {
var that = this;
$.each(editData, function(_, itemData) {
var data = itemData.data,
key = itemData.key,
type = itemData.type,
params = {
key: key,
data: data
};
if (itemData.error) {
params.error = itemData.error
}
switch (type) {
case DATA_EDIT_DATA_REMOVE_TYPE:
that.executeAction("onRowRemoved", $.extend({}, params, {
data: itemData.oldData
}));
break;
case DATA_EDIT_DATA_INSERT_TYPE:
that.executeAction("onRowInserted", params);
break;
case DATA_EDIT_DATA_UPDATE_TYPE:
that.executeAction("onRowUpdated", params)
}
})
},
saveEditData: function() {
var that = this,
processedKeys = [],
deferreds = [],
dataController = that._dataController,
editData = $.extend({}, that._editData),
editMode = getEditMode(that),
result = $.Deferred();
var resetEditIndices = function(that) {
that._editColumnIndex = -1;
that._editRowIndex = -1
};
if (that._beforeSaveEditData() || that._saving) {
that._afterSaveEditData();
return result.resolve().promise()
}
that._saveEditDataCore(deferreds, processedKeys);
if (deferreds.length) {
that._saving = true;
$.when.apply($, deferreds).done(function() {
if (that._processSaveEditDataResult(arguments, processedKeys)) {
resetEditIndices(that);
$.when(dataController.refresh()).always(function() {
that._fireSaveEditDataEvents(editData);
that._afterSaveEditData();
result.resolve()
})
} else {
result.resolve()
}
}).fail(result.resolve);
return result.always(function() {
that._saving = false
}).promise()
}
if (isRowEditMode(that)) {
if (!that.hasChanges()) {
that.cancelEditData()
}
} else {
if (editMode === DATAGRID_EDIT_MODE_BATCH || editMode === DATAGRID_EDIT_MODE_CELL) {
resetEditIndices(that);
dataController.updateItems()
} else {
that._focusEditingCell()
}
}
that._afterSaveEditData();
return result.resolve().promise()
},
_updateEditColumn: function() {
var that = this,
editing = that.option("editing"),
editMode = getEditMode(that),
isEditColumnVisible = editing && ((editing.allowUpdating || editing.allowAdding) && editMode === DATAGRID_EDIT_MODE_ROW || editing.allowUpdating && editMode === DATAGRID_EDIT_MODE_FORM || editing.allowDeleting);
that._columnsController.addCommandColumn({
command: "edit",
visible: isEditColumnVisible,
cssClass: "dx-command-edit",
width: "auto"
});
that._columnsController.columnOption("command:edit", "visible", isEditColumnVisible)
},
_updateEditButtons: function() {
var that = this,
headerPanel = that.getView("headerPanel"),
hasChanges = that.hasChanges();
if (headerPanel) {
headerPanel.updateToolbarItemOption("saveButton", "disabled", !hasChanges);
headerPanel.updateToolbarItemOption("cancelButton", "disabled", !hasChanges)
}
},
_applyModified: function($element) {
$element && $element.addClass(DATAGRID_CELL_MODIFIED)
},
cancelEditData: function() {
var that = this,
dataController = that._dataController;
that._beforeCancelEditData();
that.init();
dataController.updateItems()
},
hasEditData: function() {
return this.hasChanges()
},
closeEditCell: function() {
var that = this,
editMode = getEditMode(that),
oldEditRowIndex = that._editRowIndex,
dataController = that._dataController;
if (!isRowEditMode(that)) {
setTimeout(function() {
if (editMode === DATAGRID_EDIT_MODE_CELL && that.hasChanges()) {
that.saveEditData()
} else {
if (oldEditRowIndex >= 0) {
that._editRowIndex = -1;
that._editColumnIndex = -1;
dataController.updateItems({
changeType: "update",
rowIndices: [oldEditRowIndex]
})
}
}
})
}
},
update: function(changeType) {
var that = this,
dataController = that._dataController;
if (dataController && that._pageIndex !== dataController.pageIndex()) {
if ("refresh" === changeType) {
that.refresh()
}
that._pageIndex = dataController.pageIndex()
}
that._updateEditButtons()
},
updateFieldValue: function(options, value, text, forceUpdateRow) {
var params, that = this,
data = {},
rowKey = options.key,
$cellElement = options.cellElement,
editMode = getEditMode(that);
if (void 0 !== rowKey && options.column.setCellValue) {
if (editMode === DATAGRID_EDIT_MODE_BATCH) {
that._applyModified($cellElement, options)
}
options.value = value;
options.column.setCellValue(data, value, text);
if (text && options.column.displayValueMap) {
options.column.displayValueMap[value] = text
}
params = {
data: data,
key: rowKey,
oldData: options.data,
type: DATA_EDIT_DATA_UPDATE_TYPE
};
that._addEditData(params);
that._updateEditButtons();
if (options.column.showEditorAlways && getEditMode(that) === DATAGRID_EDIT_MODE_CELL && options.row && !options.row.inserted) {
that.saveEditData().always(function() {
that._editColumnIndex = options.columnIndex;
that._editRowIndex = options.row.rowIndex;
that._focusEditingCell()
})
} else {
if (options.row && (forceUpdateRow || options.column.setCellValue !== options.column.defaultSetCellValue)) {
that._dataController.updateItems({
changeType: "update",
rowIndices: [options.row.rowIndex]
})
}
}
}
},
_addEditData: function(options) {
var that = this,
editDataIndex = getIndexByKey(options.key, that._editData);
if (editDataIndex < 0) {
editDataIndex = that._editData.length;
that._editData.push(options)
}
if (that._editData[editDataIndex]) {
options.type = that._editData[editDataIndex].type || options.type;
objectUtils.deepExtendArraySafe(that._editData[editDataIndex], {
data: options.data,
type: options.type
})
}
return editDataIndex
},
_formEditorPrepared: function() {},
_getFormEditItemTemplate: function(cellOptions, column) {
return column.editCellTemplate || getDefaultEditorTemplate(this)
},
getFormEditorTemplate: function(detailCellOptions, column, item) {
var that = this;
return function(options, $container) {
var cellOptions = $.extend({}, detailCellOptions, {
cellElement: null,
item: item,
value: column.calculateCellValue(detailCellOptions.data),
column: $.extend({}, column, {
editorOptions: item.editorOptions
}),
id: options.component.getItemID(item.name || item.dataField),
columnIndex: column.index,
setValue: column.allowEditing && function(value) {
that.updateFieldValue(cellOptions, value)
}
});
var template = $.proxy(that._getFormEditItemTemplate, that)(cellOptions, column);
template && template($container, cellOptions);
that._formEditorPrepared(cellOptions, $container)
}
},
getEditFormTemplate: function() {
var that = this;
return function($container, detailOptions) {
var editFormOptions = that.option("editing.form"),
items = that.option("editing.form.items"),
userCustomizeItem = that.option("editing.form.customizeItem");
if (!items) {
var columns = that.getController("columns").getColumns();
items = [];
$.each(columns, function(_, column) {
items.push({
column: column,
name: column.name,
dataField: column.dataField
})
})
}
that._createComponent($("
").appendTo($container), Form, $.extend({}, editFormOptions, {
items: items,
formID: new Guid,
customizeItem: function(item) {
var column = item.column || that._columnsController.columnOption(item.name || item.dataField);
if (column) {
item.label = item.label || {};
item.label.text = item.label.text || column.caption;
item.template = item.template || that.getFormEditorTemplate(detailOptions, column, item);
item.column = column;
if (column.formItem) {
$.extend(item, column.formItem)
}
}
userCustomizeItem && userCustomizeItem.call(this, item)
}
}));
var $buttonsContainer = $(" ").addClass("dx-datagrid-form-buttons-container").appendTo($container);
that._createComponent($(" ").appendTo($buttonsContainer), Button, {
text: that.option("editing.texts.saveRowChanges"),
onClick: $.proxy(that.saveEditData, that)
});
that._createComponent($(" ").appendTo($buttonsContainer), Button, {
text: that.option("editing.texts.cancelRowChanges"),
onClick: $.proxy(that.cancelEditData, that)
})
}
},
getColumnTemplate: function(options) {
var template, editingOptions, editingTexts, allowUpdating, editingStartOptions, that = this,
column = options.column,
rowIndex = options.row && options.row.rowIndex,
isRowMode = isRowEditMode(that),
isRowEditing = that.isEditRow(rowIndex),
isCellEditing = that.isEditCell(rowIndex, options.columnIndex);
if ((column.showEditorAlways || column.setCellValue && (isRowEditing && column.allowEditing || isCellEditing)) && ("data" === options.rowType || "detailAdaptive" === options.rowType) && !column.command) {
allowUpdating = that.option("editing.allowUpdating");
if (((allowUpdating || isRowEditing) && column.allowEditing || isCellEditing) && (isRowMode && isRowEditing || !isRowMode)) {
if (column.showEditorAlways && !isRowMode) {
editingStartOptions = {
cancel: false,
key: options.row.key,
data: options.row.data,
column: column
};
that._isEditingStart(editingStartOptions)
}
if (!editingStartOptions || !editingStartOptions.cancel) {
options.setValue = function(value, text) {
that.updateFieldValue(options, value, text)
}
}
}
template = column.editCellTemplate || getDefaultEditorTemplate(that)
} else {
if ("edit" === column.command && "data" === options.rowType) {
template = function(container, options) {
var createLink = function(container, text, methodName, options) {
var $link = $(" ").addClass(DATAGRID_LINK_CLASS).text(text).on(addNamespace(clickEvent.name, DATAGRID_EDITING_NAMESPACE), that.createAction(function(params) {
var e = params.jQueryEvent;
e.stopPropagation();
setTimeout(function() {
options.row && that[methodName](options.row.rowIndex)
})
}));
options.rtlEnabled ? container.prepend($link, " ") : container.append($link, " ")
};
container.css("text-align", "center");
options.rtlEnabled = that.option("rtlEnabled");
editingOptions = that.option("editing") || {};
editingTexts = editingOptions.texts || {};
if (options.row && options.row.rowIndex === that._editRowIndex && isRowMode) {
createLink(container, editingTexts.saveRowChanges, "saveEditData", options);
createLink(container, editingTexts.cancelRowChanges, "cancelEditData", options)
} else {
if (editingOptions.allowUpdating && isRowMode) {
createLink(container, editingTexts.editRow, "editRow", options)
}
if (editingOptions.allowDeleting) {
if (options.row.removed) {
createLink(container, editingTexts.undeleteRow, "undeleteRow", options)
} else {
createLink(container, editingTexts.deleteRow, "deleteRow", options)
}
}
}
}
} else {
if ("detail" === column.command && "detail" === options.rowType && isRowEditing) {
template = that.getEditFormTemplate(options)
}
}
}
return template
},
prepareEditButtons: function(headerPanel) {
var that = this,
editingOptions = that.option("editing") || {},
editingTexts = that.option("editing.texts") || {},
titleButtonTextByClassNames = {
cancel: editingTexts.cancelAllChanges,
save: editingTexts.saveAllChanges,
addrow: editingTexts.addRow
},
buttonItems = [];
var prepareButtonItem = function(className, methodName) {
var onInitialized = function(e) {
e.element.addClass(headerPanel._getToolbarButtonClass(DATAGRID_EDIT_BUTTON_CLASS + " dx-datagrid-" + className + "-button"))
},
hintText = titleButtonTextByClassNames[className],
isButtonDisabled = ("save" === className || "cancel" === className) && !that.hasChanges();
return {
widget: "dxButton",
options: {
onInitialized: onInitialized,
icon: "edit-button-" + className,
disabled: isButtonDisabled,
onClick: function(options) {
that[methodName]()
},
text: hintText,
hint: hintText
},
showText: "inMenu",
name: className + "Button",
disabled: isButtonDisabled,
location: "after",
locateInMenu: "auto"
}
};
if (editingOptions.allowAdding) {
buttonItems.push(prepareButtonItem("addrow", "addRow"))
}
if ((editingOptions.allowUpdating || editingOptions.allowAdding || editingOptions.allowDeleting) && getEditMode(that) === DATAGRID_EDIT_MODE_BATCH) {
buttonItems.push(prepareButtonItem("save", "saveEditData"));
buttonItems.push(prepareButtonItem("cancel", "cancelEditData"))
}
return buttonItems
},
createHighlightCell: function($cell) {
var $highlight = $cell.find("." + DATAGRID_CELL_HIGHLIGHT_OUTLINE);
if (!$highlight.length) {
$cell.wrapInner($(" ").addClass(DATAGRID_CELL_HIGHLIGHT_OUTLINE + " " + DATAGRID_POINTER_EVENTS_TARGET_CLASS))
}
},
resetRowAndPageIndices: function(alwaysRest) {
var that = this;
$.each(that._editData, function(_, editData) {
if (editData.pageIndex !== that._pageIndex || alwaysRest) {
delete editData.pageIndex;
delete editData.rowIndex
}
})
},
_afterInsertRow: function(options) {},
_beforeSaveEditData: function(editData, editIndex) {},
_afterSaveEditData: function() {},
_beforeCancelEditData: function() {}
}
}());
gridCore.registerModule("editing", {
defaultOptions: function() {
return {
editing: {
mode: "row",
allowAdding: false,
allowUpdating: false,
allowDeleting: false,
texts: {
editRow: messageLocalization.format("dxDataGrid-editingEditRow"),
saveAllChanges: messageLocalization.format("dxDataGrid-editingSaveAllChanges"),
saveRowChanges: messageLocalization.format("dxDataGrid-editingSaveRowChanges"),
cancelAllChanges: messageLocalization.format("dxDataGrid-editingCancelAllChanges"),
cancelRowChanges: messageLocalization.format("dxDataGrid-editingCancelRowChanges"),
addRow: messageLocalization.format("dxDataGrid-editingAddRow"),
deleteRow: messageLocalization.format("dxDataGrid-editingDeleteRow"),
undeleteRow: messageLocalization.format("dxDataGrid-editingUndeleteRow"),
confirmDeleteMessage: messageLocalization.format("dxDataGrid-editingConfirmDeleteMessage"),
confirmDeleteTitle: ""
},
form: {
colCount: 2
}
}
}
},
controllers: {
editing: exports.EditingController
},
extenders: {
controllers: {
data: {
init: function() {
this._editingController = this.getController("editing");
this.callBase()
},
reload: function(full) {
var d, editingController = this.getController("editing");
this._editingController.refresh();
d = this.callBase(full);
return d && d.done(function() {
editingController.resetRowAndPageIndices(true)
})
},
_updateItemsCore: function(change) {
this.callBase(change);
var editFormItem = this.items()[this.getController("editing").getEditFormRowIndex()];
if (editFormItem) {
editFormItem.rowType = "detail"
}
},
_processItems: function(items, changeType) {
items = this._editingController.processItems(items, changeType);
return this.callBase(items, changeType)
},
_processDataItem: function(dataItem, options) {
this._editingController.processDataItem(dataItem, options.visibleColumns, this.generateDataValues);
return this.callBase(dataItem, options)
},
_processItem: function(item, options) {
item = this.callBase(item, options);
if (item.inserted) {
options.dataIndex--;
delete item.dataIndex
}
return item
}
},
columnsResizer: {
_startResizing: function(args) {
var that = this,
editingController = that.getController("editing"),
isCellEditing = function() {
var editingOptions = that.option("editing");
return editingOptions && editingOptions.mode !== DATAGRID_EDIT_MODE_ROW && editingController.isEditing()
};
that.callBase(args);
if (that.isResizing() && isCellEditing()) {
editingController.closeEditCell()
}
}
}
},
views: {
rowsView: {
publicMethods: function() {
return this.callBase().concat(["cellValue"])
},
_getCellTemplate: function(options) {
var that = this,
template = that.getController("editing").getColumnTemplate(options);
return template || that.callBase(options)
},
_isNativeClick: function() {
return (devices.real().ios || devices.real().android) && this.option("editing.allowUpdating")
},
_createTable: function() {
var that = this,
$table = that.callBase.apply(that, arguments);
if (!isRowEditMode(that) && that.option("editing.allowUpdating")) {
$table.on(addNamespace(holdEvent.name, "dxDataGridRowsView"), "td:not(." + DATAGRID_EDITOR_CELL_CLASS + ")", that.createAction(function(e) {
var editingController = that.getController("editing");
if (editingController.isEditing()) {
editingController.closeEditCell()
}
}))
}
return $table
},
_createRow: function(row) {
var editingController, isEditRow, isRowRemoved, isRowInserted, isRowModified, $row = this.callBase(row);
if (row) {
editingController = this.getController("editing");
isEditRow = editingController.isEditRow(row.rowIndex);
isRowRemoved = !!row.removed;
isRowInserted = !!row.inserted;
isRowModified = !!row.modified;
if (getEditMode(this) === DATAGRID_EDIT_MODE_BATCH) {
isRowRemoved && $row.addClass(DATAGRID_ROW_REMOVED)
} else {
isEditRow && $row.addClass(DATAGRID_EDIT_ROW)
}
isRowInserted && $row.addClass(DATAGRID_ROW_INSERTED);
isRowModified && $row.addClass(DATAGRID_ROW_MODIFIED);
if (isEditRow || isRowInserted || isRowRemoved) {
$row.removeClass(DATAGRID_ROW_SELECTED)
}
if (isEditRow && "detail" === row.rowType) {
$row.addClass(DATAGRID_EDIT_FORM_CLASS)
}
}
return $row
},
_getColumnIndexByElement: function($element) {
var $targetElement = $element.closest("." + DATAGRID_ROW_CLASS + "> td:not(.dx-master-detail-cell)");
return this.getCellIndex($targetElement)
},
_rowClick: function(e) {
var that = this,
editingController = that.getController("editing"),
$targetElement = $(e.jQueryEvent.target),
columnIndex = that._getColumnIndexByElement($targetElement),
allowUpdating = that.option("editing.allowUpdating"),
column = that._columnsController.getVisibleColumns()[columnIndex],
allowEditing = column && (column.allowEditing || editingController.isEditCell(e.rowIndex, columnIndex));
if ($targetElement.closest("." + DATAGRID_ROW_CLASS + "> td").hasClass(DATAGRID_POINTER_EVENTS_NONE_CLASS)) {
return
}
if (!(allowUpdating && allowEditing && editingController.editCell(e.rowIndex, columnIndex)) && !editingController.isEditRow(e.rowIndex)) {
that.callBase(e)
}
},
_cellPrepared: function($cell, parameters) {
var columnIndex = parameters.columnIndex,
editingController = this.getController("editing"),
isCommandCell = !!parameters.column.command,
isEditableCell = parameters.setValue;
parameters.isEditing = editingController.isEditCell(parameters.rowIndex, parameters.columnIndex) || editingController.isEditRow(parameters.rowIndex) && parameters.column.allowEditing;
if (!parameters.column.command && (parameters.isEditing || parameters.column.showEditorAlways)) {
var alignment = parameters.column.alignment;
$cell.addClass(DATAGRID_EDITOR_CELL_CLASS).toggleClass(DATAGRID_READONLY_CLASS, !isEditableCell).toggleClass(DATAGRID_CELL_FOCUS_DISABLED_CLASS, !isEditableCell);
if (alignment) {
$cell.find("input").first().css("text-align", alignment)
}
}
var modifiedValues = parameters.row && (parameters.row.inserted ? parameters.row.values : parameters.row.modifiedValues);
if (modifiedValues && void 0 !== modifiedValues[columnIndex] && parameters.column && !isCommandCell && parameters.column.setCellValue) {
editingController.createHighlightCell($cell);
$cell.addClass(DATAGRID_CELL_MODIFIED)
} else {
if (isEditableCell) {
editingController.createHighlightCell($cell, true)
}
}
this.callBase.apply(this, arguments)
},
_update: function(change) {
this.callBase(change);
if ("updateSelection" === change.changeType) {
this.getTableElements().children("tbody").children("." + DATAGRID_EDIT_ROW).removeClass(DATAGRID_ROW_SELECTED)
}
},
cellValue: function(rowIndex, columnIdentificator, value, text) {
var cellOptions = this.getCellOptions(rowIndex, columnIdentificator);
if (cellOptions) {
if (void 0 === value) {
return cellOptions.value
} else {
this.getController("editing").updateFieldValue(cellOptions, value, text, true)
}
}
}
},
headerPanel: {
_getToolbarItems: function() {
var items = this.callBase(),
editButtonItems = this.getController("editing").prepareEditButtons(this);
return editButtonItems.concat(items)
},
optionChanged: function(args) {
switch (args.name) {
case "editing":
this._invalidateToolbarItems();
this.callBase(args);
break;
default:
this.callBase(args)
}
},
isVisible: function() {
var that = this,
editingOptions = that.getController("editing").option("editing");
return that.callBase() || editingOptions && (editingOptions.allowAdding || (editingOptions.allowUpdating || editingOptions.allowDeleting) && editingOptions.mode === DATAGRID_EDIT_MODE_BATCH)
}
}
}
}
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!************************************************************!*\
!*** ./Scripts/ui/data_grid/ui.data_grid.grouping.core.js ***!
\************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../../core/class */ 5),
gridCore = __webpack_require__( /*! ./ui.data_grid.core */ 17),
normalizeSortingInfo = __webpack_require__( /*! ../../data/utils */ 28).normalizeSortingInfo;
exports.createGroupFilter = function(path, storeLoadOptions) {
var i, groups = normalizeSortingInfo(storeLoadOptions.group),
filter = [];
for (i = 0; i < path.length; i++) {
filter.push([groups[i].selector, "=", path[i]])
}
if (storeLoadOptions.filter) {
filter.push(storeLoadOptions.filter)
}
return gridCore.combineFilters(filter)
};
exports.GroupingHelper = Class.inherit(function() {
var findGroupInfoByKey = function(groupsInfo, key) {
var hash = groupsInfo.hash;
return hash && hash[key]
};
var getGroupInfoIndexByOffset = function(groupsInfo, offset) {
var index;
for (index = 0; index < groupsInfo.length; index++) {
if (groupsInfo[index].offset > offset) {
break
}
}
return index
};
var updateGroupInfoOffsets = function(groupsInfo, parents) {
var groupInfo, index, newIndex;
for (index = 0; index < groupsInfo.length; index++) {
groupInfo = groupsInfo[index];
if (groupInfo.data && groupInfo.data.offset !== groupInfo.offset) {
groupsInfo.splice(index, 1);
groupInfo.offset = groupInfo.data.offset;
if (parents) {
for (var parentIndex = 0; parentIndex < parents.length; parentIndex++) {
parents[parentIndex].offset = groupInfo.offset
}
}
newIndex = getGroupInfoIndexByOffset(groupsInfo, groupInfo.offset);
groupsInfo.splice(newIndex, 0, groupInfo);
if (newIndex > index) {
index--
}
}
}
};
var cleanGroupsInfo = function(groupsInfo, groupIndex, groupsCount) {
var i;
for (i = 0; i < groupsInfo.length; i++) {
if (groupIndex + 1 >= groupsCount) {
groupsInfo[i].children = []
} else {
cleanGroupsInfo(groupsInfo[i].children, groupIndex + 1, groupsCount)
}
}
};
return {
ctor: function(dataSourceAdapter) {
this._dataSource = dataSourceAdapter;
this.reset()
},
reset: function() {
this._groupsInfo = [];
this._totalCountCorrection = 0;
this._itemsCount = 0
},
totalCountCorrection: function() {
return this._totalCountCorrection
},
updateTotalItemsCount: function(totalCountCorrection) {
this._totalCountCorrection = totalCountCorrection || 0
},
_isGroupItemCountable: function(item) {
return !this._isVirtualPaging() || !item.isContinuation
},
_isVirtualPaging: function() {
var scrollingMode = this._dataSource.option("scrolling.mode");
return "virtual" === scrollingMode || "infinite" === scrollingMode
},
itemsCount: function() {
return this._itemsCount
},
updateItemsCount: function(data, groupsCount) {
function calculateItemsCount(that, items, groupsCount) {
var i, result = 0;
if (items) {
if (!groupsCount) {
result = items.length
} else {
for (i = 0; i < items.length; i++) {
if (that._isGroupItemCountable(items[i])) {
result++
}
result += calculateItemsCount(that, items[i].items, groupsCount - 1)
}
}
}
return result
}
this._itemsCount = calculateItemsCount(this, data, groupsCount)
},
foreachGroups: function(callback, childrenAtFirst, foreachCollapsedGroups, updateOffsets, updateParentOffsets) {
var that = this;
function foreachGroupsCore(groupsInfo, callback, childrenAtFirst, parents) {
var i, callbackResult, callbackResults = [];
function executeCallback(callback, data, parents, callbackResults) {
var callbackResult = data && callback(data, parents);
callbackResults.push(callbackResult);
return callbackResult
}
for (i = 0; i < groupsInfo.length; i++) {
parents.push(groupsInfo[i].data);
if (!childrenAtFirst && false === executeCallback(callback, groupsInfo[i].data, parents, callbackResults)) {
return false
}
if (!groupsInfo[i].data || groupsInfo[i].data.isExpanded || foreachCollapsedGroups) {
callbackResult = foreachGroupsCore(groupsInfo[i].children, callback, childrenAtFirst, parents);
callbackResults.push(callbackResult);
if (false === callbackResult) {
return false
}
}
if (childrenAtFirst && false === executeCallback(callback, groupsInfo[i].data, parents, callbackResults)) {
return false
}
if (!groupsInfo[i].data || groupsInfo[i].data.offset !== groupsInfo[i].offset) {
updateOffsets = true
}
parents.pop()
}
var currentParents = updateParentOffsets && parents.slice(0);
return updateOffsets && $.when.apply($, callbackResults).always(function() {
updateGroupInfoOffsets(groupsInfo, currentParents)
})
}
return foreachGroupsCore(that._groupsInfo, callback, childrenAtFirst, [])
},
findGroupInfo: function(path) {
var pathIndex, groupInfo, that = this,
groupsInfo = that._groupsInfo;
for (pathIndex = 0; groupsInfo && pathIndex < path.length; pathIndex++) {
groupInfo = findGroupInfoByKey(groupsInfo, path[pathIndex]);
groupsInfo = groupInfo && groupInfo.children
}
return groupInfo && groupInfo.data
},
addGroupInfo: function(groupInfoData) {
var index, groupInfo, pathIndex, that = this,
path = groupInfoData.path,
groupsInfo = that._groupsInfo;
for (pathIndex = 0; pathIndex < path.length; pathIndex++) {
groupInfo = findGroupInfoByKey(groupsInfo, path[pathIndex]);
if (!groupInfo) {
groupInfo = {
key: path[pathIndex],
offset: groupInfoData.offset,
data: {
offset: groupInfoData.offset,
isExpanded: true,
path: path.slice(0, pathIndex + 1)
},
children: []
};
index = getGroupInfoIndexByOffset(groupsInfo, groupInfoData.offset);
groupsInfo.splice(index, 0, groupInfo);
groupsInfo.hash = groupsInfo.hash || {};
groupsInfo.hash[groupInfo.key] = groupInfo
}
if (pathIndex === path.length - 1) {
groupInfo.data = groupInfoData;
if (groupInfo.offset !== groupInfoData.offset) {
updateGroupInfoOffsets(groupsInfo)
}
}
groupsInfo = groupInfo.children
}
},
allowCollapseAll: function() {
return true
},
refresh: function(options) {
var groupIndex, that = this,
storeLoadOptions = options.storeLoadOptions,
oldGroups = normalizeSortingInfo(that._group || []),
groups = normalizeSortingInfo(storeLoadOptions.group || []),
groupsCount = Math.min(oldGroups.length, groups.length);
that._group = storeLoadOptions.group;
for (groupIndex = 0; groupIndex < groupsCount; groupIndex++) {
if (oldGroups[groupIndex].selector !== groups[groupIndex].selector) {
groupsCount = groupIndex;
break
}
}
if (!groupsCount) {
that.reset()
} else {
cleanGroupsInfo(that._groupsInfo, 0, groupsCount)
}
},
handleDataLoading: function(options) {},
handleDataLoaded: function(options, callBase) {
callBase(options)
},
handleDataLoadedCore: function(options, callBase) {
callBase(options)
}
}
}())
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************************************!*\
!*** ./Scripts/ui/data_grid/ui.data_grid.grouping_module.js ***!
\**************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
gridCore = __webpack_require__( /*! ./ui.data_grid.core */ 17),
ExpandedGroupingHelper = __webpack_require__( /*! ./ui.data_grid.grouping.server */ 441).GroupingHelper,
CollapsedGroupingHelper = __webpack_require__( /*! ./ui.data_grid.grouping.client */ 440).GroupingHelper,
messageLocalization = __webpack_require__( /*! ../../localization/message */ 8),
dataSourceAdapter = __webpack_require__( /*! ./ui.data_grid.data_source_adapter */ 180),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
devices = __webpack_require__( /*! ../../core/devices */ 7);
var DATAGRID_GROUP_PANEL_CLASS = "dx-datagrid-group-panel",
DATAGRID_GROUP_PANEL_MESSAGE_CLASS = "dx-group-panel-message",
DATAGRID_GROUP_PANEL_ITEM_CLASS = "dx-group-panel-item",
DATAGRID_GROUP_OPENED_CLASS = "dx-datagrid-group-opened",
DATAGRID_GROUP_CLOSED_CLASS = "dx-datagrid-group-closed",
DATAGRID_EXPAND_CLASS = "dx-datagrid-expand",
DATAGRID_SELECTION_DISABLED_CLASS = "dx-selection-disabled",
DATAGRID_GROUP_ROW_CLASS = "dx-group-row";
var GroupingDataSourceAdapterExtender = function() {
return {
init: function() {
this.callBase.apply(this, arguments);
this._initGroupingHelper()
},
_initGroupingHelper: function(options) {
var grouping = this._grouping,
remoteOperations = options ? options.remoteOperations : this.remoteOperations();
if (remoteOperations.filtering && remoteOperations.sorting && remoteOperations.paging && !remoteOperations.grouping) {
if (!grouping || grouping instanceof CollapsedGroupingHelper) {
this._grouping = new ExpandedGroupingHelper(this)
}
} else {
if (!grouping || grouping instanceof ExpandedGroupingHelper) {
this._grouping = new CollapsedGroupingHelper(this)
}
}
},
totalItemsCount: function() {
var that = this,
totalCount = that.callBase();
return totalCount > 0 && that._dataSource.group() && that._dataSource.requireTotalCount() ? totalCount + that._grouping.totalCountCorrection() : totalCount
},
itemsCount: function() {
return this._dataSource.group() ? this._grouping.itemsCount() || 0 : this.callBase()
},
allowCollapseAll: function() {
return this._grouping.allowCollapseAll()
},
isRowExpanded: function(key) {
var groupInfo = this._grouping.findGroupInfo(key);
return groupInfo ? groupInfo.isExpanded : !this._grouping.allowCollapseAll()
},
collapseAll: function(groupIndex) {
return this._collapseExpandAll(groupIndex, false)
},
expandAll: function(groupIndex) {
return this._collapseExpandAll(groupIndex, true)
},
_collapseExpandAll: function(groupIndex, isExpand) {
var i, that = this,
dataSource = that._dataSource,
group = dataSource.group(),
groups = gridCore.normalizeSortingInfo(group || []);
if (groups.length) {
for (i = 0; i < groups.length; i++) {
if (void 0 === groupIndex || groupIndex === i) {
groups[i].isExpanded = isExpand
} else {
if (group && group[i]) {
groups[i].isExpanded = group[i].isExpanded
}
}
}
dataSource.group(groups);
that._grouping.foreachGroups(function(groupInfo, parents) {
if (void 0 === groupIndex || groupIndex === parents.length - 1) {
groupInfo.isExpanded = isExpand
}
}, false, true)
}
return true
},
refresh: function() {
this.callBase.apply(this, arguments);
return this._grouping.refresh.apply(this._grouping, arguments)
},
changeRowExpand: function(path) {
var that = this,
dataSource = that._dataSource;
if (dataSource.group()) {
dataSource._changeLoadingCount(1);
return that._changeRowExpandCore(path).always(function() {
dataSource._changeLoadingCount(-1)
})
}
},
_changeRowExpandCore: function(path) {
return this._grouping.changeRowExpand(path)
},
getGroupsInfo: function() {
return this._grouping._groupsInfo
},
_hasCollapsedGroupLevels: function(group) {
if (group && $.isArray(group)) {
for (var i = 0; i < group.length; i++) {
if (false === group[i].isExpanded) {
return true
}
}
}
},
_customizeRemoteOperations: function(options) {
var remoteOperations = options.remoteOperations;
if (options.storeLoadOptions.group) {
if (remoteOperations.grouping && !options.isCustomLoading) {
remoteOperations.paging = false
}
if (!remoteOperations.grouping && (!remoteOperations.sorting || !remoteOperations.filtering || options.isCustomLoading || this._hasCollapsedGroupLevels(options.storeLoadOptions.group))) {
remoteOperations.paging = false
}
}
this.callBase.apply(this, arguments)
},
_handleDataLoading: function(options) {
this.callBase(options);
this._initGroupingHelper(options);
return this._grouping.handleDataLoading(options)
},
_handleDataLoaded: function(options) {
return this._grouping.handleDataLoaded(options, $.proxy(this.callBase, this))
},
_handleDataLoadedCore: function(options) {
return this._grouping.handleDataLoadedCore(options, $.proxy(this.callBase, this))
}
}
}();
dataSourceAdapter.extend(GroupingDataSourceAdapterExtender);
var GroupingDataControllerExtender = function() {
return {
init: function() {
var that = this;
that.callBase();
that.createAction("onRowExpanding");
that.createAction("onRowExpanded");
that.createAction("onRowCollapsing");
that.createAction("onRowCollapsed")
},
_processItems: function(items, changeType) {
var groupColumns = this._columnsController.getGroupColumns();
if (items.length && groupColumns.length) {
items = this._processGroupItems(items, groupColumns.length)
}
return this.callBase(items, changeType)
},
_processItem: function(item, options) {
if (commonUtils.isDefined(item.groupIndex) && commonUtils.isString(item.rowType) && 0 === item.rowType.indexOf("group")) {
item = this._processGroupItem(item, options);
options.dataIndex = 0
} else {
item = this.callBase.apply(this, arguments)
}
return item
},
_processGroupItem: function(item, options) {
return item
},
_processGroupItems: function(items, groupsCount, options) {
var scrollingMode, i, item, resultItems, that = this,
groupedColumns = that._columnsController.getGroupColumns(),
column = groupedColumns[groupedColumns.length - groupsCount];
if (!options) {
scrollingMode = that.option("scrolling.mode");
options = {
collectContinuationItems: "virtual" !== scrollingMode && "infinite" !== scrollingMode,
resultItems: [],
path: [],
values: []
}
}
resultItems = options.resultItems;
if (options.data) {
if (options.collectContinuationItems || !options.data.isContinuation) {
resultItems.push({
rowType: "group",
data: options.data,
groupIndex: options.path.length - 1,
isExpanded: !!options.data.items,
key: options.path.slice(0),
values: options.values.slice(0)
})
}
}
if (items) {
if (0 === groupsCount) {
resultItems.push.apply(resultItems, items)
} else {
for (i = 0; i < items.length; i++) {
item = items[i];
if (item && "items" in item) {
options.data = item;
options.path.push(item.key);
options.values.push(column && column.deserializeValue ? column.deserializeValue(item.key) : item.key);
that._processGroupItems(item.items, groupsCount - 1, options);
options.data = void 0;
options.path.pop();
options.values.pop()
} else {
resultItems.push(item)
}
}
}
}
return resultItems
},
publicMethods: function() {
return this.callBase().concat(["collapseAll", "expandAll", "isRowExpanded", "expandRow", "collapseRow"])
},
collapseAll: function(groupIndex) {
var dataSource = this._dataSource;
if (dataSource && dataSource.collapseAll(groupIndex)) {
dataSource.pageIndex(0);
dataSource.reload()
}
},
expandAll: function(groupIndex) {
var dataSource = this._dataSource;
if (dataSource && dataSource.expandAll(groupIndex)) {
dataSource.pageIndex(0);
dataSource.reload()
}
},
changeRowExpand: function(key) {
var that = this,
expanded = that.isRowExpanded(key),
args = {
key: key,
expanded: expanded
};
that.executeAction(expanded ? "onRowCollapsing" : "onRowExpanding", args);
if (!args.cancel) {
return $.when(that._changeRowExpandCore(key)).done(function() {
args.expanded = !expanded;
that.executeAction(expanded ? "onRowCollapsed" : "onRowExpanded", args)
})
}
},
_changeRowExpandCore: function(key) {
var d, that = this,
dataSource = this._dataSource;
if (!dataSource) {
return
}
d = $.Deferred();
$.when(dataSource.changeRowExpand(key)).done(function() {
that.load().done(d.resolve).fail(d.reject)
}).fail(d.reject);
return d
},
isRowExpanded: function(key) {
var dataSource = this._dataSource;
return dataSource && dataSource.isRowExpanded(key)
},
expandRow: function(key) {
if (!this.isRowExpanded(key)) {
return this.changeRowExpand(key)
}
return $.Deferred().resolve()
},
collapseRow: function(key) {
if (this.isRowExpanded(key)) {
return this.changeRowExpand(key)
}
return $.Deferred().resolve()
},
optionChanged: function(args) {
if ("grouping" === args.name) {
args.name = "dataSource"
}
this.callBase(args)
}
}
}();
var onGroupingMenuItemClick = function(column, params) {
var columnsController = this._columnsController;
switch (params.itemData.value) {
case "group":
var groups = columnsController._dataSource.group() || [];
columnsController.columnOption(column.dataField, "groupIndex", groups.length);
break;
case "ungroup":
columnsController.columnOption(column.dataField, "groupIndex", -1);
break;
case "ungroupAll":
this.component.clearGrouping()
}
};
var GroupingHeaderPanelExtender = function() {
return {
_getToolbarItems: function() {
var items = this.callBase();
return this._appendGroupingItem(items)
},
_appendGroupingItem: function(items) {
var that = this;
if (that._isGroupPanelVisible()) {
var toolbarItem = {
template: function(data, index, $container) {
var $groupPanel = $(" ").addClass(DATAGRID_GROUP_PANEL_CLASS).appendTo($container);
that._updateGroupPanelContent($groupPanel)
},
name: "groupPanel",
location: "before",
locateInMenu: "never"
};
items.push(toolbarItem)
}
return items
},
_updateGroupPanelContent: function($groupPanel) {
var that = this,
groupColumns = that.getController("columns").getGroupColumns(),
groupPanelOptions = that.option("groupPanel");
that._renderGroupPanelItems($groupPanel, groupColumns);
if (groupPanelOptions.allowColumnDragging && !groupColumns.length) {
$(" ").addClass(DATAGRID_GROUP_PANEL_MESSAGE_CLASS).text(groupPanelOptions.emptyPanelText).appendTo($groupPanel)
}
},
_isGroupPanelVisible: function() {
var isVisible, groupPanelOptions = this.option("groupPanel");
if (groupPanelOptions) {
isVisible = groupPanelOptions.visible;
if ("auto" === isVisible) {
isVisible = "desktop" === devices.current().deviceType ? true : false
}
}
return isVisible
},
_renderGroupPanelItems: function($groupPanel, groupColumns) {
var that = this;
$groupPanel.empty();
$.each(groupColumns, function(index, groupColumn) {
that._createGroupPanelItem($groupPanel, groupColumn)
})
},
_createGroupPanelItem: function($rootElement, groupColumn) {
return $(" ").addClass(groupColumn.cssClass).addClass(DATAGRID_GROUP_PANEL_ITEM_CLASS).data("columnData", groupColumn).appendTo($rootElement).text(groupColumn.caption)
},
_renderCore: function() {
if (this._toolbar) {
var $groupPanel = this.element().find("." + DATAGRID_GROUP_PANEL_CLASS);
if ($groupPanel.length) {
this._updateGroupPanelContent($groupPanel)
}
}
this.callBase()
},
allowDragging: function(column) {
var groupPanelOptions = this.option("groupPanel");
return this._isGroupPanelVisible() && groupPanelOptions.allowColumnDragging && column && column.allowGrouping
},
getColumnElements: function() {
var $element = this.element();
return $element && $element.find("." + DATAGRID_GROUP_PANEL_ITEM_CLASS)
},
getColumns: function() {
return this.getController("columns").getGroupColumns()
},
getBoundingRect: function() {
var offset, that = this,
$element = that.element();
if ($element && $element.find("." + DATAGRID_GROUP_PANEL_CLASS).length) {
offset = $element.offset();
return {
top: offset.top,
bottom: offset.top + $element.height()
}
}
return null
},
getName: function() {
return "group"
},
getContextMenuItems: function(options) {
var items, that = this,
contextMenuEnabled = that.option("grouping.contextMenuEnabled"),
$groupedColumnElement = options.targetElement.closest("." + DATAGRID_GROUP_PANEL_ITEM_CLASS);
if ($groupedColumnElement.length) {
options.column = $groupedColumnElement.data("columnData")
}
if (contextMenuEnabled && options.column) {
var column = options.column,
isGroupingAllowed = commonUtils.isDefined(column.allowGrouping) ? column.allowGrouping : true;
if (isGroupingAllowed) {
var isColumnGrouped = commonUtils.isDefined(column.groupIndex) && column.groupIndex > -1,
groupingTexts = that.option("grouping.texts"),
onItemClick = $.proxy(onGroupingMenuItemClick, that, column);
items = [{
text: groupingTexts.ungroup,
value: "ungroup",
disabled: !isColumnGrouped,
onItemClick: onItemClick
}, {
text: groupingTexts.ungroupAll,
value: "ungroupAll",
onItemClick: onItemClick
}]
}
}
return items
},
isVisible: function() {
return this.callBase() || this._isGroupPanelVisible()
},
optionChanged: function(args) {
if ("groupPanel" === args.name) {
this._invalidateToolbarItems();
args.handled = true
} else {
this.callBase(args)
}
}
}
}();
exports.GroupingHeaderPanelExtender = GroupingHeaderPanelExtender;
var GroupingRowsViewExtender = function() {
return {
getContextMenuItems: function(options) {
var items, that = this,
contextMenuEnabled = that.option("grouping.contextMenuEnabled");
if (contextMenuEnabled && options.row && "group" === options.row.rowType) {
var columnsController = that._columnsController,
column = columnsController.columnOption("groupIndex:" + options.row.groupIndex);
if (column && column.allowGrouping) {
var groupingTexts = that.option("grouping.texts"),
onItemClick = $.proxy(onGroupingMenuItemClick, that, column);
items = [];
items.push({
text: groupingTexts.ungroup,
value: "ungroup",
onItemClick: onItemClick
}, {
text: groupingTexts.ungroupAll,
value: "ungroupAll",
onItemClick: onItemClick
})
}
}
return items
},
_rowClick: function(e) {
var that = this,
expandMode = that.option("grouping.expandMode"),
isGroupRowStateChanged = "rowClick" === expandMode && $(e.jQueryEvent.target).closest("." + DATAGRID_GROUP_ROW_CLASS).length,
isExpandButtonClicked = $(e.jQueryEvent.target).closest("." + DATAGRID_EXPAND_CLASS).length;
if (isGroupRowStateChanged || isExpandButtonClicked) {
that._changeGroupRowState(e)
}
that.callBase(e)
},
_changeGroupRowState: function(e) {
var dataController = this.getController("data"),
row = dataController.items()[e.rowIndex];
if ("detail" !== row.rowType) {
dataController.changeRowExpand(row.key);
e.jQueryEvent.preventDefault();
e.handled = true
}
},
_getCellTemplate: function(options) {
var that = this;
if ("expand" === options.column.command) {
return {
allowRenderToDetachedContainer: true,
render: function(container, options) {
if (commonUtils.isDefined(options.value) && !(options.data && options.data.isContinuation) && !options.row.inserted) {
container.addClass(DATAGRID_EXPAND_CLASS).addClass(DATAGRID_SELECTION_DISABLED_CLASS);
$(" ").addClass(options.value ? DATAGRID_GROUP_OPENED_CLASS : DATAGRID_GROUP_CLOSED_CLASS).appendTo(container);
that.setAria("label", options.value ? that.localize("dxDataGrid-ariaCollapse") : that.localize("dxDataGrid-ariaExpand"), container)
}
}
}
}
return that.callBase(options)
}
}
}();
var columnHeadersViewExtender = function() {
return {
getContextMenuItems: function(options) {
var that = this,
contextMenuEnabled = that.option("grouping.contextMenuEnabled"),
items = that.callBase(options);
if (contextMenuEnabled && options.row && "header" === options.row.rowType) {
var column = options.column;
if (!column.command && (!commonUtils.isDefined(column.allowGrouping) || column.allowGrouping)) {
var groupingTexts = that.option("grouping.texts"),
isColumnGrouped = commonUtils.isDefined(column.groupIndex) && column.groupIndex > -1,
onItemClick = $.proxy(onGroupingMenuItemClick, that, column);
items = items || [];
items.push({
text: groupingTexts.groupByThisColumn,
value: "group",
beginGroup: true,
disabled: isColumnGrouped,
onItemClick: onItemClick
});
if (column.showWhenGrouped) {
items.push({
text: groupingTexts.ungroup,
value: "ungroup",
disabled: !isColumnGrouped,
onItemClick: onItemClick
})
}
items.push({
text: groupingTexts.ungroupAll,
value: "ungroupAll",
onItemClick: onItemClick
})
}
}
return items
}
}
}();
gridCore.registerModule("grouping", {
defaultOptions: function() {
return {
grouping: {
autoExpandAll: true,
allowCollapsing: true,
contextMenuEnabled: false,
expandMode: "buttonClick",
texts: {
groupContinuesMessage: messageLocalization.format("dxDataGrid-groupContinuesMessage"),
groupContinuedMessage: messageLocalization.format("dxDataGrid-groupContinuedMessage"),
groupByThisColumn: messageLocalization.format("dxDataGrid-groupHeaderText"),
ungroup: messageLocalization.format("dxDataGrid-ungroupHeaderText"),
ungroupAll: messageLocalization.format("dxDataGrid-ungroupAllText")
}
},
groupPanel: {
visible: false,
emptyPanelText: messageLocalization.format("dxDataGrid-groupPanelEmptyText"),
allowColumnDragging: true
}
}
},
extenders: {
controllers: {
data: GroupingDataControllerExtender
},
views: {
headerPanel: GroupingHeaderPanelExtender,
rowsView: GroupingRowsViewExtender,
columnHeadersView: columnHeadersViewExtender
}
}
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!************************************************************!*\
!*** ./Scripts/ui/grid_core/ui.grid_core.header_filter.js ***!
\************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
modules = __webpack_require__( /*! ./ui.grid_core.modules */ 224),
gridCoreUtils = __webpack_require__( /*! ./ui.grid_core.utils */ 42),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
Popup = __webpack_require__( /*! ../popup */ 53),
TreeView = __webpack_require__( /*! ../tree_view */ 158),
List = __webpack_require__( /*! ../list */ 87);
var DATAGRID_HEADER_FILTER_CLASS = "dx-header-filter",
DATAGRID_HEADER_FILTER_MENU_CLASS = "dx-header-filter-menu";
function resetChildrenItemSelection(items) {
items = items || [];
for (var i = 0; i < items.length; i++) {
items[i].selected = false;
resetChildrenItemSelection(items[i].items)
}
}
exports.updateHeaderFilterItemSelectionState = function(item, filterValuesMatch, isExcludeFilter) {
if (filterValuesMatch ^ isExcludeFilter) {
item.selected = true;
if (isExcludeFilter && item.items) {
for (var j = 0; j < item.items.length; j++) {
if (!item.items[j].selected) {
item.selected = void 0;
break
}
}
}
} else {
if (isExcludeFilter) {
item.selected = false;
resetChildrenItemSelection(item.items)
}
}
};
exports.HeaderFilterView = modules.View.inherit({
getPopupContainer: function() {
return this._popupContainer
},
getListContainer: function() {
return this._listContainer
},
applyHeaderFilter: function(options) {
var that = this,
list = that.getListContainer(),
isSelectAll = list.element().find(".dx-checkbox").eq(0).hasClass("dx-checkbox-checked"),
filterValues = [];
var fillSelectedItemKeys = function(filterValues, items, isExclude) {
$.each(items, function(_, item) {
if (void 0 !== item.selected && !!item.selected ^ isExclude) {
filterValues.push(item.value)
} else {
if (item.items && item.items.length) {
fillSelectedItemKeys(filterValues, item.items, isExclude)
}
}
})
};
if (!isSelectAll) {
if ("tree" === options.type) {
fillSelectedItemKeys(filterValues, list.option("items"), "exclude" === options.filterType);
options.filterValues = filterValues
}
} else {
if (commonUtils.isArray(options.filterValues)) {
options.filterValues = []
}
}
if (options.filterValues && !options.filterValues.length) {
options.filterValues = void 0
}
options.apply();
that.hideHeaderFilterMenu()
},
showHeaderFilterMenu: function($columnElement, options) {
var popupContainer, that = this;
if (options) {
that._initializePopupContainer(options);
popupContainer = that.getPopupContainer();
that.hideHeaderFilterMenu();
that.updatePopup($columnElement, options);
popupContainer.show()
}
},
hideHeaderFilterMenu: function() {
var headerFilterMenu = this.getPopupContainer();
headerFilterMenu && headerFilterMenu.hide()
},
updatePopup: function($element, options) {
var that = this,
alignment = "right" === options.alignment ? "left" : "right";
if (that._popupContainer) {
that._cleanPopupContent();
that._popupContainer.option("position", {
my: alignment + " top",
at: alignment + " bottom",
of: $element,
collision: "flip fit"
})
}
},
_cleanPopupContent: function() {
this._popupContainer && this._popupContainer.content().empty()
},
_initializePopupContainer: function(options) {
var that = this,
$element = that.element(),
headerFilterOptions = that.option("headerFilter"),
width = options.headerFilter && options.headerFilter.width || headerFilterOptions && headerFilterOptions.width,
height = options.headerFilter && options.headerFilter.height || headerFilterOptions && headerFilterOptions.height,
dxPopupOptions = {
width: width,
height: height,
visible: false,
shading: false,
showTitle: false,
showCloseButton: false,
closeOnTargetScroll: true,
dragEnabled: false,
closeOnOutsideClick: true,
toolbarItems: [{
toolbar: "bottom",
location: "after",
widget: "dxButton",
options: {
text: headerFilterOptions.texts.ok,
onClick: function() {
that.applyHeaderFilter(options)
}
}
}, {
toolbar: "bottom",
location: "after",
widget: "dxButton",
options: {
text: headerFilterOptions.texts.cancel,
onClick: function() {
that.hideHeaderFilterMenu()
}
}
}],
resizeEnabled: true,
onShowing: function(e) {
that._initializeListContainer(options);
options.onShowing && options.onShowing(e)
},
onInitialized: function(e) {
var component = e.component;
component.option("animation", component._getDefaultOptions().animation)
}
};
if (!commonUtils.isDefined(that._popupContainer)) {
that._popupContainer = that._createComponent($element, Popup, dxPopupOptions)
} else {
that._popupContainer.option(dxPopupOptions)
}
},
_initializeListContainer: function(options) {
var that = this,
$content = that._popupContainer.content(),
widgetOptions = {
dataSource: options.dataSource,
onContentReady: function() {
that.renderCompleted.fire()
}
};
if ("tree" === options.type) {
that._listContainer = that._createComponent($(" ").appendTo($content), TreeView, $.extend(widgetOptions, {
showCheckBoxesMode: "selectAll",
keyExpr: "id"
}))
} else {
that._listContainer = that._createComponent($(" ").appendTo($content), List, $.extend(widgetOptions, {
pageLoadMode: "scrollBottom",
showSelectionControls: true,
selectionMode: "all",
itemTemplate: function(data, _, elem) {
return elem.text(data.text)
},
onSelectionChanged: function(e) {
var items = e.component.option("items"),
selectedItems = e.component.option("selectedItems");
if (!e.component._selectedItemsUpdating) {
if (0 === selectedItems.length && items.length) {
options.filterType = "include";
options.filterValues = []
} else {
if (selectedItems.length === items.length) {
options.filterType = "exclude";
options.filterValues = []
}
}
}
$.each(items, function(index, item) {
var filterValueIndex, selected = gridCoreUtils.getIndexByKey(item, selectedItems, null) >= 0,
oldSelected = !!item.selected;
if (oldSelected !== selected) {
item.selected = selected;
options.filterValues = options.filterValues || [];
filterValueIndex = gridCoreUtils.getIndexByKey(item.value, options.filterValues, null);
if (filterValueIndex >= 0) {
options.filterValues.splice(filterValueIndex, 1)
}
if (selected ^ "exclude" === options.filterType) {
options.filterValues.push(item.value)
}
}
})
},
onContentReady: function(e) {
var component = e.component,
items = component.option("items"),
selectedItems = [],
selectAllCheckBox = e.element.find(".dx-list-select-all-checkbox").dxCheckBox("instance");
$.each(items, function() {
if (this.selected) {
selectedItems.push(this)
}
});
component._selectedItemsUpdating = true;
component.option("selectedItems", selectedItems);
component._selectedItemsUpdating = false;
if (options.filterValues && options.filterValues.length) {
selectAllCheckBox.option("value", void 0)
}
}
}))
}
},
_renderCore: function(options) {
this.element().addClass(DATAGRID_HEADER_FILTER_MENU_CLASS)
}
});
var allowHeaderFiltering = exports.allowHeaderFiltering = function(column) {
return commonUtils.isDefined(column.allowHeaderFiltering) ? column.allowHeaderFiltering : column.allowFiltering
};
exports.headerFilterMixin = {
_applyColumnState: function(options) {
var $headerFilterIndicator, rootElement = options.rootElement,
column = options.column;
if ("headerFilter" === options.name) {
rootElement.find("." + DATAGRID_HEADER_FILTER_CLASS).remove();
if (allowHeaderFiltering(column)) {
$headerFilterIndicator = this.callBase(options).toggleClass("dx-header-filter-empty", !column.filterValues || !column.filterValues.length)
}
return $headerFilterIndicator
}
return this.callBase(options)
},
_getIndicatorClassName: function(name) {
if ("headerFilter" === name) {
return DATAGRID_HEADER_FILTER_CLASS
}
return this.callBase(name)
},
_renderIndicator: function(options) {
var rtlEnabled, $container = options.container,
$indicator = options.indicator;
if ("headerFilter" === options.name) {
rtlEnabled = this.option("rtlEnabled");
if ($container.children().length && (!rtlEnabled && "right" === options.columnAlignment || rtlEnabled && "left" === options.columnAlignment)) {
$container.prepend($indicator);
return
}
}
this.callBase(options)
},
optionChanged: function(args) {
if ("headerFilter" === args.name) {
this._invalidate();
args.handled = true
} else {
this.callBase(args)
}
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!******************************************************!*\
!*** ./Scripts/ui/grid_core/ui.grid_core.sorting.js ***!
\******************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2);
var DATAGRID_SORT_CLASS = "dx-sort",
DATAGRID_SORT_NONE_CLASS = "dx-sort-none",
DATAGRID_SORTUP_CLASS = "dx-sort-up",
DATAGRID_SORTDOWN_CLASS = "dx-sort-down",
DATAGRID_HEADERS_ACTION_CLASS = "dx-datagrid-action",
DATAGRID_COLUMN_INDICATORS_CLASS = "dx-column-indicators",
DATAGRID_CELL_CONTENT_CLASS = "dx-datagrid-text-content";
exports.sortingMixin = {
_applyColumnState: function(options) {
var side, ariaSortState, $sortIndicator, that = this,
sortingMode = that.option("sorting.mode"),
rootElement = options.rootElement,
column = options.column,
$indicatorsContainer = rootElement.find("." + DATAGRID_COLUMN_INDICATORS_CLASS);
if ("sort" === options.name) {
side = that.option("rtlEnabled") ? "right" : "left", rootElement.find("." + DATAGRID_SORT_CLASS).remove();
!$indicatorsContainer.children().length && $indicatorsContainer.remove();
rootElement.children("." + DATAGRID_CELL_CONTENT_CLASS).css("margin-" + side, "");
if (("single" === sortingMode || "multiple" === sortingMode) && column.allowSorting || commonUtils.isDefined(column.sortOrder)) {
ariaSortState = "asc" === column.sortOrder ? "ascending" : "descending", $sortIndicator = that.callBase(options).toggleClass(DATAGRID_SORTUP_CLASS, "asc" === column.sortOrder).toggleClass(DATAGRID_SORTDOWN_CLASS, "desc" === column.sortOrder);
options.rootElement.addClass(DATAGRID_HEADERS_ACTION_CLASS);
if ("center" === column.alignment) {
rootElement.children("." + DATAGRID_CELL_CONTENT_CLASS).css("margin-" + side, $sortIndicator.outerWidth(true))
}
}
if (!commonUtils.isDefined(column.sortOrder)) {
$sortIndicator && $sortIndicator.addClass(DATAGRID_SORT_NONE_CLASS);
that.setAria("sort", "none", rootElement)
} else {
that.setAria("sort", ariaSortState, rootElement)
}
return $sortIndicator
} else {
return that.callBase(options)
}
},
_getIndicatorClassName: function(name) {
if ("sort" === name) {
return DATAGRID_SORT_CLASS
}
return this.callBase(name)
},
_renderIndicator: function(options) {
var rtlEnabled, $container = options.container,
$indicator = options.indicator;
if ("sort" === options.name) {
rtlEnabled = this.option("rtlEnabled");
if ($container.children().length && (!rtlEnabled && "left" === options.columnAlignment || rtlEnabled && "right" === options.columnAlignment)) {
$container.prepend($indicator);
return
}
}
this.callBase(options)
},
_updateIndicator: function($cell, column, indicatorName) {
if ("sort" === indicatorName && commonUtils.isDefined(column.groupIndex)) {
return
}
this.callBase.apply(this, arguments)
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!************************************************************!*\
!*** ./Scripts/ui/grid_core/ui.grid_core.state_storing.js ***!
\************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
modules = __webpack_require__( /*! ./ui.grid_core.modules */ 224),
errors = __webpack_require__( /*! ../widget/ui.errors */ 20),
browser = __webpack_require__( /*! ../../core/utils/browser */ 22),
sessionStorage = __webpack_require__( /*! ../../core/utils/storage */ 122).sessionStorage,
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2);
var DATE_REGEX = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/;
var parseDates = function(state) {
if (!state) {
return
}
$.each(state, function(key, value) {
var date;
if ($.isPlainObject(value) || $.isArray(value)) {
parseDates(value)
} else {
if ("string" === typeof value) {
date = DATE_REGEX.exec(value);
if (date) {
state[key] = new Date(Date.UTC(+date[1], +date[2] - 1, +date[3], +date[4], +date[5], +date[6]))
}
}
}
})
};
exports.StateStoringController = modules.ViewController.inherit(function() {
var getStorage = function(options) {
var storage = "sessionStorage" === options.type ? sessionStorage() : localStorage;
if (!storage) {
if ("file:" === window.location.protocol && browser.msie) {
throw new Error("E1038")
} else {
throw new Error("E1007")
}
}
return storage
};
var getUniqueStorageKey = function(options) {
return commonUtils.isDefined(options.storageKey) ? options.storageKey : "storage"
};
return {
_loadState: function() {
var options = this.option("stateStoring");
if ("custom" === options.type) {
return options.customLoad && options.customLoad()
}
try {
return JSON.parse(getStorage(options).getItem(getUniqueStorageKey(options)))
} catch (e) {
errors.log(e.message)
}
},
_saveState: function(state) {
var options = this.option("stateStoring");
if ("custom" === options.type) {
options.customSave && options.customSave(state);
return
}
try {
getStorage(options).setItem(getUniqueStorageKey(options), JSON.stringify(state))
} catch (e) {}
},
publicMethods: function() {
return ["state"]
},
isEnabled: function() {
return this.option("stateStoring.enabled")
},
init: function() {
var that = this;
that._state = {};
that._isLoaded = false;
that._isLoading = false;
that._windowUnloadHandler = function() {
if (void 0 !== that._savingTimeoutID) {
that._saveState(that.state())
}
}, $(window).on("unload", that._windowUnloadHandler);
return that
},
isLoaded: function() {
return this._isLoaded
},
isLoading: function() {
return this._isLoading
},
load: function() {
var loadResult, that = this;
that._isLoading = true;
loadResult = that._loadState();
if (!loadResult || !$.isFunction(loadResult.done)) {
loadResult = $.Deferred().resolve(loadResult)
}
loadResult.done(function(state) {
that._isLoaded = true;
that._isLoading = false;
that.state(state)
});
return loadResult
},
state: function(state) {
var that = this;
if (!arguments.length) {
return $.extend(true, {}, that._state)
} else {
that._state = $.extend({}, state);
parseDates(that._state)
}
},
save: function() {
var that = this;
clearTimeout(that._savingTimeoutID);
that._savingTimeoutID = setTimeout(function() {
that._saveState(that.state());
that._savingTimeoutID = void 0
}, that.option("stateStoring.savingTimeout"))
},
optionChanged: function(args) {
var that = this;
switch (args.name) {
case "stateStoring":
if (that.isEnabled() && that.isLoaded()) {
that.load()
}
args.handled = true;
break;
default:
that.callBase(args)
}
},
dispose: function() {
clearTimeout(this._savingTimeoutID);
$(window).off("unload", this._windowUnloadHandler)
}
}
}())
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************************************!*\
!*** ./Scripts/ui/grid_core/ui.grid_core.virtual_scrolling.js ***!
\****************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
browser = __webpack_require__( /*! ../../core/utils/browser */ 22),
Class = __webpack_require__( /*! ../../core/class */ 5);
var SCROLLING_MODE_INFINITE = "infinite",
SCROLLING_MODE_VIRTUAL = "virtual",
CONTENT_HEIHGT_LIMIT = browser.msie ? 4e6 : 15e6;
var isVirtualMode = function(that) {
return that.option("scrolling.mode") === SCROLLING_MODE_VIRTUAL
};
var isAppendMode = function(that) {
return that.option("scrolling.mode") === SCROLLING_MODE_INFINITE
};
exports.subscribeToExternalScrollers = function($element, scrollChangedHandler, $targetElement) {
var $scrollElement, scrollableArray = [],
scrollToArray = [],
disposeArray = [];
$targetElement = $targetElement || $element;
function getElementOffset(scrollable) {
var $scrollableElement = scrollable.element ? scrollable.element() : scrollable,
scrollableOffset = $scrollableElement.offset();
if (!scrollableOffset) {
return $element.offset().top
}
return scrollable.scrollTop() - (scrollableOffset.top - $element.offset().top)
}
function createWindowScrollHandler(scrollable) {
return function(e) {
var scrollTop = scrollable.scrollTop() - getElementOffset(scrollable);
scrollTop = scrollTop > 0 ? scrollTop : 0;
scrollChangedHandler(scrollTop)
}
}
function subscribeToScrollEvents($scrollElement) {
var handler, isDocument = "#document" === $scrollElement.get(0).nodeName,
scrollable = $scrollElement.data("dxScrollable") || isDocument && $(window) || "auto" === $scrollElement.css("overflow-y") && $scrollElement;
if (scrollable) {
handler = createWindowScrollHandler(scrollable);
scrollable.on("scroll", handler);
scrollToArray.push(function(pos) {
var topOffset = getElementOffset(scrollable),
scrollMethod = scrollable.scrollTo ? "scrollTo" : "scrollTop";
if (pos - topOffset >= 0) {
scrollable[scrollMethod](pos + topOffset)
}
});
scrollableArray.push(scrollable);
disposeArray.push(function() {
scrollable.off("scroll", handler)
})
}
}
for ($scrollElement = $targetElement.parent(); $scrollElement.length; $scrollElement = $scrollElement.parent()) {
subscribeToScrollEvents($scrollElement)
}
return {
scrollTo: function(pos) {
$.each(scrollToArray, function(_, scrollTo) {
scrollTo(pos)
})
},
dispose: function() {
$.each(disposeArray, function(_, dispose) {
dispose()
})
}
}
};
exports.VirtualScrollController = Class.inherit(function() {
var getViewportPageCount = function(that) {
var pageSize = that._dataSource.pageSize();
return pageSize && that._viewportSize >= 0 ? Math.ceil(that._viewportSize / pageSize) : 1
};
var getPreloadPageCount = function(that) {
var preloadEnabled = that.option("scrolling.preloadEnabled"),
pageCount = getViewportPageCount(that);
if (pageCount) {
if (preloadEnabled) {
pageCount++
}
if (isAppendMode(that)) {
pageCount--
}
}
return pageCount
};
var getBeginPageIndex = function(that) {
return that._cache.length ? that._cache[0].pageIndex : -1
};
var getEndPageIndex = function(that) {
return that._cache.length ? that._cache[that._cache.length - 1].pageIndex : -1
};
var fireChanged = function(that, changed, args) {
that._isChangedFiring = true;
changed(args);
that._isChangedFiring = false
};
var processDelayChanged = function(that, changed) {
if (that._isDelayChanged) {
that._isDelayChanged = false;
fireChanged(that, changed);
return true
}
};
var processChanged = function(that, changed, changeType, isDelayChanged) {
var change, dataSource = that._dataSource,
items = dataSource.items();
if (changeType && !that._isDelayChanged) {
change = {
changeType: changeType,
items: items
}
}
var viewportItems = that._dataSource.viewportItems();
if ("append" === changeType) {
viewportItems.push.apply(viewportItems, items)
} else {
if ("prepend" === changeType) {
viewportItems.unshift.apply(viewportItems, items)
} else {
that._dataSource.viewportItems(items)
}
}
dataSource.updateLoading();
that._lastPageIndex = that.pageIndex();
that._isDelayChanged = isDelayChanged;
if (!isDelayChanged) {
fireChanged(that, changed, change)
}
};
return {
ctor: function(component, dataSource) {
var that = this;
that._dataSource = dataSource;
that.component = component;
that._pageIndex = that._lastPageIndex = dataSource.pageIndex();
that._viewportSize = 0;
that._viewportItemSize = 20;
that._viewportItemIndex = -1;
that._sizeRatio = 1;
that._items = [];
that._cache = []
},
option: function(name) {
return this.component.option.apply(this.component, arguments)
},
virtualItemsCount: function() {
var pageIndex, beginItemsCount, endItemsCount, that = this,
itemsCount = 0;
if (isVirtualMode(that)) {
pageIndex = getBeginPageIndex(that);
if (pageIndex < 0) {
pageIndex = 0
}
beginItemsCount = pageIndex * that._dataSource.pageSize();
itemsCount = that._cache.length * that._dataSource.pageSize();
endItemsCount = Math.max(0, that._dataSource.totalItemsCount() - itemsCount - beginItemsCount);
return {
begin: beginItemsCount,
end: endItemsCount
}
}
},
_setViewportPositionCore: function(position, isNear) {
var that = this,
scrollingTimeout = Math.min(that.option("scrolling.timeout") || 0, that._dataSource.changingDuration());
if (isNear && scrollingTimeout < that.option("scrolling.renderingThreshold")) {
scrollingTimeout = 10
}
clearTimeout(that._scrollTimeoutID);
if (scrollingTimeout > 0) {
that._scrollTimeoutID = setTimeout(function() {
that.setViewportItemIndex(position)
}, scrollingTimeout)
} else {
that.setViewportItemIndex(position)
}
},
getViewportPosition: function() {
return this._position || 0
},
setViewportPosition: function(position) {
var that = this,
virtualItemsCount = that.virtualItemsCount(),
sizeRatio = that._sizeRatio || 1,
itemSize = that._viewportItemSize,
offset = virtualItemsCount ? Math.floor(virtualItemsCount.begin * itemSize * sizeRatio) : 0;
that._position = position;
if (virtualItemsCount && position >= offset && position <= offset + that._contentSize) {
that._setViewportPositionCore(virtualItemsCount.begin + (position - offset) / itemSize, true)
} else {
that._setViewportPositionCore(position / (itemSize * sizeRatio))
}
},
setContentSize: function(size) {
var that = this,
virtualItemsCount = that.virtualItemsCount();
that._contentSize = size;
if (virtualItemsCount) {
var virtualContentSize = (virtualItemsCount.begin + virtualItemsCount.end + that.itemsCount()) * that._viewportItemSize;
if (virtualContentSize > CONTENT_HEIHGT_LIMIT) {
that._sizeRatio = CONTENT_HEIHGT_LIMIT / virtualContentSize
} else {
that._sizeRatio = 1
}
}
},
getContentOffset: function() {
var that = this,
virtualItemsCount = that.virtualItemsCount();
return virtualItemsCount ? Math.floor(virtualItemsCount.begin * that._viewportItemSize * that._sizeRatio) : 0
},
getVirtualContentSize: function() {
var that = this,
virtualItemsCount = that.virtualItemsCount();
return virtualItemsCount ? (virtualItemsCount.begin + virtualItemsCount.end) * that._viewportItemSize * that._sizeRatio + that._contentSize : 0
},
getViewportItemIndex: function() {
return this._viewportItemIndex
},
setViewportItemIndex: function(itemIndex) {
var lastPageSize, maxPageIndex, newPageIndex, that = this,
pageSize = that._dataSource.pageSize(),
pageCount = that._dataSource.pageCount(),
virtualMode = isVirtualMode(that),
appendMode = isAppendMode(that),
totalItemsCount = that._dataSource.totalItemsCount(),
needLoad = that._viewportItemIndex < 0;
that._viewportItemIndex = itemIndex;
if (pageSize && (virtualMode || appendMode) && totalItemsCount >= 0) {
if (that._viewportSize && itemIndex + that._viewportSize >= totalItemsCount) {
if (that._dataSource.hasKnownLastPage()) {
newPageIndex = pageCount - 1;
lastPageSize = totalItemsCount % pageSize;
if (newPageIndex > 0 && lastPageSize > 0 && lastPageSize < pageSize / 2) {
newPageIndex--
}
} else {
newPageIndex = pageCount
}
} else {
newPageIndex = Math.floor(itemIndex / pageSize);
maxPageIndex = pageCount - 1;
newPageIndex = Math.max(newPageIndex, 0);
newPageIndex = Math.min(newPageIndex, maxPageIndex)
}
if (that.pageIndex() !== newPageIndex || needLoad) {
that.pageIndex(newPageIndex);
that.load()
}
}
},
viewportItemSize: function(size) {
if (void 0 !== size) {
this._viewportItemSize = size
}
return this._viewportItemSize
},
viewportSize: function(size) {
if (void 0 !== size) {
this._viewportSize = size
}
return this._viewportSize
},
pageIndex: function(pageIndex) {
if (isVirtualMode(this) || isAppendMode(this)) {
if (void 0 !== pageIndex) {
this._pageIndex = pageIndex
}
return this._pageIndex
} else {
return this._dataSource.pageIndex(pageIndex)
}
},
beginPageIndex: function(defaultPageIndex) {
var beginPageIndex = getBeginPageIndex(this);
if (beginPageIndex < 0) {
beginPageIndex = void 0 !== defaultPageIndex ? defaultPageIndex : this.pageIndex()
}
return beginPageIndex
},
endPageIndex: function() {
var endPageIndex = getEndPageIndex(this);
return endPageIndex > 0 ? endPageIndex : this._lastPageIndex
},
load: function() {
var result, beginPageIndex = getBeginPageIndex(this),
pageIndexForLoad = -1,
dataSource = this._dataSource;
var loadCore = function(that, pageIndex) {
var dataSource = that._dataSource;
if (pageIndex === that.pageIndex() || !dataSource.isLoading() && pageIndex < dataSource.pageCount() || !dataSource.hasKnownLastPage() && pageIndex === dataSource.pageCount()) {
dataSource.pageIndex(pageIndex);
return dataSource.load()
}
};
if (isVirtualMode(this) || isAppendMode(this)) {
if (beginPageIndex < 0 || !this._cache[this._pageIndex - beginPageIndex]) {
pageIndexForLoad = this._pageIndex
}
if (beginPageIndex >= 0 && pageIndexForLoad < 0 && this._viewportSize >= 0) {
if (beginPageIndex > 0 && getEndPageIndex(this) + 1 === dataSource.pageCount() && this._cache.length < getPreloadPageCount(this) + 1) {
pageIndexForLoad = beginPageIndex - 1
} else {
if (beginPageIndex + this._cache.length <= this._pageIndex + getPreloadPageCount(this)) {
pageIndexForLoad = beginPageIndex + this._cache.length
}
}
}
if (pageIndexForLoad >= 0) {
result = loadCore(this, pageIndexForLoad)
}
dataSource.updateLoading()
} else {
result = dataSource.load()
}
if (!result && this._lastPageIndex !== this.pageIndex()) {
this._dataSource.onChanged({
changeType: "pageIndex"
})
}
return result || $.Deferred().resolve()
},
loadIfNeed: function() {
var that = this;
if ((isVirtualMode(that) || isAppendMode(that)) && !that._dataSource.isLoading() && !that._isChangedFiring) {
that.load()
}
},
handleDataChanged: function(callBase) {
var beginPageIndex, changeType, removeInvisiblePages, cacheItem, that = this,
dataSource = that._dataSource,
lastCacheLength = that._cache.length;
if (isVirtualMode(that) || isAppendMode(that)) {
beginPageIndex = getBeginPageIndex(that);
if (beginPageIndex >= 0) {
if (isVirtualMode(that) && beginPageIndex + that._cache.length !== dataSource.pageIndex() && beginPageIndex - 1 !== dataSource.pageIndex()) {
that._cache = []
}
if (isAppendMode(that)) {
if (0 === dataSource.pageIndex()) {
that._cache = []
} else {
if (dataSource.pageIndex() < getEndPageIndex(that)) {
fireChanged(that, callBase, {
changeType: "append",
items: []
});
return
}
}
}
}
cacheItem = {
pageIndex: dataSource.pageIndex(),
itemsCount: that.itemsCount(true)
};
if (that.option("scrolling.removeInvisiblePages")) {
removeInvisiblePages = that._cache.length > Math.max(getPreloadPageCount(this), 2)
} else {
processDelayChanged(that, callBase)
}
if (beginPageIndex === dataSource.pageIndex() + 1) {
if (removeInvisiblePages) {
that._cache.pop()
} else {
changeType = "prepend"
}
that._cache.unshift(cacheItem)
} else {
if (removeInvisiblePages) {
that._cache.shift()
} else {
changeType = "append"
}
that._cache.push(cacheItem)
}
processChanged(that, callBase, that._cache.length > 1 ? changeType : void 0, 0 === lastCacheLength);
that.load().done(function() {
if (processDelayChanged(that, callBase)) {
that.load()
}
})
} else {
processChanged(that, callBase)
}
},
itemsCount: function(isBase) {
var itemsCount = 0;
if (!isBase && isVirtualMode(this)) {
$.each(this._cache, function() {
itemsCount += this.itemsCount
})
} else {
itemsCount = this._dataSource.itemsCount()
}
return itemsCount
},
reset: function() {
this._cache = []
},
subscribeToWindowScrollEvents: function($element) {
var that = this;
that._windowScroll = that._windowScroll || exports.subscribeToExternalScrollers($element, function(scrollTop) {
if (that.viewportItemSize()) {
that.setViewportPosition(scrollTop)
}
})
},
dispose: function() {
clearTimeout(this._scrollTimeoutID);
this._windowScroll && this._windowScroll.dispose();
this._windowScroll = null
},
scrollTo: function(pos) {
this._windowScroll && this._windowScroll.scrollTo(pos)
}
}
}())
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*********************************************************************************!*\
!*** ./Scripts/ui/hierarchical_collection/ui.hierarchical_collection_widget.js ***!
\*********************************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
dataCoreUtils = __webpack_require__( /*! ../../core/utils/data */ 16),
devices = __webpack_require__( /*! ../../core/devices */ 7),
FunctionTemplate = __webpack_require__( /*! ../widget/ui.template.function */ 99),
iconUtils = __webpack_require__( /*! ../../core/utils/icon */ 77),
HierarchicalDataAdapter = __webpack_require__( /*! ./ui.data_adapter */ 456),
CollectionWidget = __webpack_require__( /*! ../collection/ui.collection_widget.edit */ 27);
var DISABLED_STATE_CLASS = "dx-state-disabled";
var HierarchicalCollectionWidget = CollectionWidget.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
keyExpr: "id",
displayExpr: "text",
selectedExpr: "selected",
disabledExpr: "disabled",
itemsExpr: "items",
hoverStateEnabled: true,
parentIdExpr: "parentId",
expandedExpr: "expanded"
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function(device) {
return "desktop" === devices.real().deviceType && !devices.isSimulator()
},
options: {
focusStateEnabled: true
}
}])
},
_init: function() {
this.callBase();
this._initAccessors();
this._initDataAdapter();
this._initDynamicTemplates()
},
_initDataSource: function() {
this.callBase();
this._dataSource && this._dataSource.paginate(false)
},
_initDataAdapter: function() {
var accessors = this._createDataAdapterAccessors();
this._dataAdapter = new HierarchicalDataAdapter($.extend({
dataAccessors: {
getters: accessors.getters,
setters: accessors.setters
},
items: this.option("items")
}, this._getDataAdapterOptions()))
},
_getDataAdapterOptions: $.noop,
_initDynamicTemplates: function() {
if (!this._useCustomExpressions()) {
delete this._dynamicTemplates.item;
return
}
this._dynamicTemplates.item = new FunctionTemplate($.proxy(function(itemData) {
return $(" ").append(this._getIconContainer(itemData)).append(this._getTextContainer(itemData)).append(this._getPopoutContainer(itemData))
}, this))
},
_useCustomExpressions: function() {
return "text" !== this.option("displayExpr") && "html" !== this.option("displayExpr")
},
_getIconContainer: function(itemData) {
var icon = itemData.icon || itemData.iconSrc;
return icon ? iconUtils.getImageContainer(icon) : void 0
},
_getTextContainer: function(itemData) {
return $(" ").text(this._displayGetter(itemData))
},
_getPopoutContainer: $.noop,
_initAccessors: function() {
var that = this;
$.each(this._getAccessors(), function(_, accessor) {
that._compileAccessor(accessor)
})
},
_getAccessors: function() {
return ["key", "display", "selected", "items", "disabled", "parentId", "expanded"]
},
_getChildNodes: function(node) {
var that = this,
arr = [];
$.each(node.internalFields.childrenKeys, function(_, key) {
var childNode = that._dataAdapter.getNodeByKey(key);
arr.push(childNode)
});
return arr
},
_hasChildren: function(node) {
return node && node.internalFields.childrenKeys.length
},
_compileAccessor: function(optionName) {
var getter = "_" + optionName + "Getter",
setter = "_" + optionName + "Setter",
optionExpr = this.option(optionName + "Expr");
if ($.isFunction(optionExpr)) {
this[setter] = function(obj, value) {
obj[optionExpr()] = value
};
this[getter] = function(obj) {
return obj[optionExpr()]
};
return
}
this[getter] = dataCoreUtils.compileGetter(optionExpr);
this[setter] = dataCoreUtils.compileSetter(optionExpr)
},
_createDataAdapterAccessors: function() {
var that = this,
accessors = {
getters: {},
setters: {}
};
$.each(this._getAccessors(), function(_, accessor) {
var getterName = "_" + accessor + "Getter",
setterName = "_" + accessor + "Setter",
newAccessor = "parentId" === accessor ? "parentKey" : accessor;
accessors.getters[newAccessor] = that[getterName];
accessors.setters[newAccessor] = that[setterName]
});
return accessors
},
_render: function() {
this.callBase();
this._focusTarget().addClass(this._widgetClass())
},
_widgetClass: $.noop,
_renderItemFrame: function(index, itemData) {
var $itemFrame = this.callBase.apply(this, arguments);
$itemFrame.toggleClass(DISABLED_STATE_CLASS, !!this._disabledGetter(itemData));
return $itemFrame
},
_optionChanged: function(args) {
switch (args.name) {
case "displayExpr":
case "keyExpr":
if (!this._dynamicTemplates.item) {
this._initDynamicTemplates()
}
this._initAccessors();
this.repaint();
break;
case "itemsExpr":
case "selectedExpr":
case "disabledExpr":
case "expandedExpr":
case "parentIdExpr":
this._initAccessors();
this._initDataAdapter();
this.repaint();
break;
case "items":
this._initDataAdapter();
this.callBase(args);
break;
default:
this.callBase(args)
}
}
});
module.exports = HierarchicalCollectionWidget
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************!*\
!*** ./Scripts/ui/menu.js ***!
\****************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
module.exports = __webpack_require__( /*! ./menu/ui.menu */ 458)
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************************************!*\
!*** ./Scripts/ui/pivot_grid/ui.pivot_grid.field_chooser.js ***!
\**************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
iconUtils = __webpack_require__( /*! ../../core/utils/icon */ 77),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 8),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 3),
pivotGridUtils = __webpack_require__( /*! ./ui.pivot_grid.utils */ 74),
TreeView = __webpack_require__( /*! ../tree_view */ 158),
ContextMenu = __webpack_require__( /*! ../context_menu */ 124),
BaseFieldChooser = __webpack_require__( /*! ./ui.pivot_grid.field_chooser_base */ 226),
inArray = $.inArray,
each = $.each,
DIV = "";
__webpack_require__( /*! ./data_source */ 182);
var FIELDCHOOSER_CLASS = "dx-pivotgridfieldchooser",
FIELDCHOOSER_CONTAINER_CLASS = "dx-pivotgridfieldchooser-container",
FIELDS_CONTAINER_CLASS = "dx-pivotgrid-fields-container";
function getDimensionFields(item, fields) {
var result = [];
if (item.items) {
for (var i = 0; i < item.items.length; i++) {
result.push.apply(result, getDimensionFields(item.items[i], fields))
}
} else {
if (commonUtils.isDefined(item.index)) {
result.push(fields[item.index])
}
}
return result
}
function getFirstItem(item, condition) {
if (item.items) {
for (var i = 0; i < item.items.length; i++) {
var childrenItem = getFirstItem(item.items[i], condition);
if (childrenItem) {
return childrenItem
}
}
}
if (condition(item)) {
return item
}
}
var compareOrder = [function(a, b) {
var aValue = -!!a.isMeasure,
bValue = +!!b.isMeasure;
return aValue + bValue
}, function(a, b) {
var aValue = -!!(a.items && a.items.length),
bValue = +!!(b.items && b.items.length);
return aValue + bValue
}, function(a, b) {
var aValue = +!!(a.field && a.field.levels && a.field.levels.length),
bValue = -!!(b.field && b.field.levels && b.field.levels.length);
return aValue + bValue
}, pivotGridUtils.getCompareFunction(function(item) {
return item.text
})];
function compareItems(a, b) {
var result = 0,
i = 0;
while (!result && compareOrder[i]) {
result = compareOrder[i++](a, b)
}
return result
}
function getScrollable(container) {
return container.find(".dx-scrollable").dxScrollable("instance")
}
var FieldChooser = BaseFieldChooser.inherit({
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
height: 400,
layout: 0,
dataSource: null,
onContextMenuPreparing: null,
texts: {
columnFields: messageLocalization.format("dxPivotGrid-columnFields"),
rowFields: messageLocalization.format("dxPivotGrid-rowFields"),
dataFields: messageLocalization.format("dxPivotGrid-dataFields"),
filterFields: messageLocalization.format("dxPivotGrid-filterFields"),
allFields: messageLocalization.format("dxPivotGrid-allFields")
}
})
},
_refreshDataSource: function() {
var that = this;
that._expandedPaths = [];
that._changedHandler = that._changedHandler || function() {
each(that._dataChangedHandlers, function(_, func) {
func()
})
};
if (that._dataSource) {
that._dataSource.off("changed", that._changedHandler);
that._dataSource = void 0
}
that.callBase();
that._dataSource && that._dataSource.on("changed", that._changedHandler)
},
_init: function() {
this.callBase();
this._refreshDataSource();
this._dataChangedHandlers = [];
this._initActions()
},
_initActions: function() {
this._actions = {
onContextMenuPreparing: this._createActionByOption("onContextMenuPreparing")
}
},
_trigger: function(eventName, eventArg) {
this._actions[eventName](eventArg)
},
_setOptionsByReference: function() {
this.callBase();
$.extend(this._optionsByReference, {
dataSource: true
})
},
_optionChanged: function(args) {
var that = this;
switch (args.name) {
case "dataSource":
that._refreshDataSource();
that._invalidate();
break;
case "layout":
case "texts":
that._invalidate();
break;
case "onContextMenuPreparing":
that._actions[args.name] = that._createActionByOption(args.name);
break;
default:
that.callBase(args)
}
},
_clean: function() {
this.element().children("." + FIELDCHOOSER_CONTAINER_CLASS).remove()
},
_renderContentImpl: function() {
var $col1, $col2, that = this,
element = this.element(),
$container = $(DIV).addClass(FIELDCHOOSER_CONTAINER_CLASS).appendTo(element),
layout = that.option("layout");
element.addClass(FIELDCHOOSER_CLASS).addClass(FIELDS_CONTAINER_CLASS);
that._dataChangedHandlers = [];
that.callBase();
if (0 === layout) {
$col1 = $(DIV).addClass("dx-col").appendTo($container);
$col2 = $(DIV).addClass("dx-col").appendTo($container);
that._renderArea($col1, "all");
that._renderArea($col1, "filter");
that._renderArea($col2, "row");
that._renderArea($col2, "column");
that._renderArea($col2, "data")
} else {
if (1 === layout) {
$col1 = $(DIV).addClass("dx-col").appendTo($container);
$col2 = $(DIV).addClass("dx-col").appendTo($container);
that._renderArea($col1, "all");
that._renderArea($col2, "filter");
that._renderArea($col2, "row");
that._renderArea($col2, "column");
that._renderArea($col2, "data")
} else {
this._renderArea($container, "all");
$col1 = $(DIV).addClass("dx-col").appendTo($container);
$col2 = $(DIV).addClass("dx-col").appendTo($container);
that._renderArea($col1, "filter");
that._renderArea($col1, "row");
that._renderArea($col2, "column");
that._renderArea($col2, "data")
}
}
that.updateDimensions();
that._renderContextMenu()
},
_getContextMenuArgs: function(jQueryEvent) {
var field, area, targetFieldElement = $(jQueryEvent.target).closest(".dx-area-field"),
targetGroupElement = $(jQueryEvent.target).closest(".dx-area-fields");
if (targetFieldElement.length) {
field = targetFieldElement.data("field")
}
if (targetGroupElement.length) {
area = targetGroupElement.attr("group")
}
return {
jQueryEvent: jQueryEvent,
field: field,
area: area,
items: []
}
},
_renderContextMenu: function() {
var that = this,
$container = that.element();
if (that._contextMenu) {
that._contextMenu.element().remove()
}
that._contextMenu = that._createComponent($(DIV).appendTo($container), ContextMenu, {
onPositioning: function(actionArgs) {
var args, event = actionArgs.jQueryEvent;
if (!event) {
return
}
args = that._getContextMenuArgs(event);
that._trigger("onContextMenuPreparing", args);
if (args.items && args.items.length) {
actionArgs.component.option("items", args.items)
} else {
actionArgs.cancel = true
}
},
target: $container,
onItemClick: function(params) {
params.itemData.onItemClick && params.itemData.onItemClick(params)
},
cssClass: "dx-pivotgridfieldchooser-context-menu"
})
},
_createTreeItems: function(fields, groupFieldNames, path) {
var isMeasure, that = this,
resultItems = [],
groupedItems = [],
groupFieldName = groupFieldNames[0],
fieldsByGroup = {};
if (!groupFieldName) {
each(fields, function(index, field) {
var icon;
if (true === field.isMeasure) {
icon = "measure"
}
if (false === field.isMeasure) {
icon = field.groupName ? "hierarchy" : "dimension"
}
resultItems.push({
index: field.index,
field: field,
key: field.dataField,
selected: commonUtils.isDefined(field.area),
text: field.caption || field.dataField,
icon: icon,
isMeasure: field.isMeasure,
isDefault: field.isDefault
})
})
} else {
each(fields, function(index, field) {
var groupName = field[groupFieldName] || "";
fieldsByGroup[groupName] = fieldsByGroup[groupName] || [];
fieldsByGroup[groupName].push(field);
if (void 0 === isMeasure) {
isMeasure = true
}
isMeasure = isMeasure && true === field.isMeasure
});
each(fieldsByGroup, function(groupName, fields) {
var currentPath = path ? path + "." + groupName : groupName;
var items = that._createTreeItems(fields, groupFieldNames.slice(1), currentPath);
if (groupName) {
groupedItems.push({
key: groupName,
text: groupName,
path: currentPath,
isMeasure: items.isMeasure,
expanded: inArray(currentPath, that._expandedPaths) >= 0,
items: items
})
} else {
resultItems = items
}
});
resultItems = groupedItems.concat(resultItems);
resultItems.isMeasure = isMeasure
}
return resultItems
},
_createFieldsDataSource: function(dataSource) {
var treeItems, fields = dataSource && dataSource.fields() || [];
fields = $.map(fields, function(field) {
return false === field.visible || commonUtils.isDefined(field.groupIndex) ? null : field
});
treeItems = this._createTreeItems(fields, ["dimension", "displayFolder"]);
pivotGridUtils.foreachDataLevel(treeItems, function(items) {
items.sort(compareItems)
}, 0, "items");
return treeItems
},
_renderFieldsTreeView: function(container) {
var that = this,
dataSource = that._dataSource,
treeView = that._createComponent(container, TreeView, {
dataSource: that._createFieldsDataSource(dataSource),
showCheckBoxesMode: "normal",
itemTemplate: function(itemData, itemIndex, itemElement) {
if (itemData.icon) {
iconUtils.getImageContainer(itemData.icon).appendTo(itemElement)
}
$(" ").toggleClass("dx-area-field", !itemData.items).data("field", itemData.field).text(itemData.text).appendTo(itemElement)
},
onItemCollapsed: function(e) {
var index = inArray(e.itemData.path, that._expandedPaths);
if (index >= 0) {
that._expandedPaths.splice(index, 1)
}
},
onItemExpanded: function(e) {
var index = inArray(e.itemData.path, that._expandedPaths);
if (index < 0) {
that._expandedPaths.push(e.itemData.path)
}
},
onItemSelectionChanged: function(e) {
var field, fields, area, data = e.itemData,
needSelectDefaultItem = true;
if (data.items) {
if (data.selected) {
treeView.unselectItem(data);
return
}
fields = getDimensionFields(data, dataSource.fields());
for (var i = 0; i < fields.length; i++) {
if (fields[i].area) {
needSelectDefaultItem = false;
break
}
}
if (needSelectDefaultItem) {
var item = getFirstItem(data, function(item) {
return item.isDefault
}) || getFirstItem(data, function(item) {
return commonUtils.isDefined(item.index)
});
item && treeView.selectItem(item);
return
}
} else {
field = dataSource.fields()[data.index];
if (data.selected) {
area = field.isMeasure ? "data" : "column"
}
if (field) {
fields = [field]
}
}
each(fields, function(_, field) {
dataSource.field(field.index, {
area: area,
areaIndex: void 0
})
});
dataSource.load()
}
}),
dataChanged = function() {
var scrollable = getScrollable(container),
scrollTop = scrollable ? scrollable.scrollTop() : 0;
treeView.option({
dataSource: that._createFieldsDataSource(dataSource)
});
scrollable = getScrollable(container);
if (scrollable) {
scrollable.scrollTo({
y: scrollTop
});
scrollable.update()
}
};
that._dataChangedHandlers.push(dataChanged)
},
_renderAreaFields: function($container, area) {
var that = this,
dataSource = that._dataSource,
fields = dataSource ? dataSource.getAreaFields(area, true) : [];
$container.empty();
each(fields, function() {
that.renderField(this, true).appendTo($container)
})
},
_renderArea: function(container, area) {
var $fieldsContainer, $fieldsContent, render, that = this,
$areaContainer = $(DIV).addClass("dx-area").appendTo(container),
caption = that.option("texts." + area + "Fields");
$("").addClass("dx-area-icon").addClass("dx-area-icon-" + area).appendTo($areaContainer);
$("").html(" ").appendTo($areaContainer);
$("").addClass("dx-area-caption").text(caption).appendTo($areaContainer);
$fieldsContainer = $(DIV).addClass("dx-area-fields").height(0).appendTo($areaContainer);
if ("all" !== area) {
$fieldsContent = $(DIV).addClass("dx-area-field-container").appendTo($fieldsContainer);
render = function() {
that._renderAreaFields($fieldsContent, area)
};
that._dataChangedHandlers.push(render);
render();
$fieldsContainer.attr("group", area).dxScrollable()
} else {
$fieldsContainer.addClass("dx-treeview-border-visible");
that._renderFieldsTreeView($fieldsContainer)
}
},
_getSortableOptions: function() {
return {}
},
_adjustSortableOnChangedArgs: function(e) {},
getDataSource: function() {
return this._dataSource
},
updateDimensions: function() {
var areaHeight, $element = this.element(),
$container = $element.children(".dx-pivotgridfieldchooser-container"),
$cols = $element.find(".dx-col"),
$areaElements = $element.find(".dx-area-fields"),
$scrollableElements = $element.find(".dx-area .dx-scrollable");
$areaElements.height(0);
if (0 === this.option("layout")) {
areaHeight = Math.floor(($element.height() - $container.height()) / 3);
$areaElements.height(areaHeight);
$areaElements.eq(0).height($cols.eq(1).height() - $cols.eq(0).height() + areaHeight)
} else {
if (1 === this.option("layout")) {
areaHeight = Math.floor(($element.height() - $container.height()) / 4);
$areaElements.height(areaHeight);
$areaElements.eq(0).height($cols.eq(1).height() - $cols.eq(0).height() + areaHeight)
} else {
areaHeight = Math.floor(($element.height() - $container.height()) / 4);
$areaElements.height(areaHeight);
$areaElements.eq(0).height(2 * areaHeight)
}
}
$scrollableElements.dxScrollable("update")
},
_visibilityChanged: function(visible) {
if (visible) {
this.updateDimensions()
}
}
});
registerComponent("dxPivotGridFieldChooser", FieldChooser);
module.exports = FieldChooser
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************************!*\
!*** ./Scripts/ui/pivot_grid/xmla_store/xmla_store.js ***!
\********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../../../core/class */ 5),
stringFormat = __webpack_require__( /*! ../../../core/utils/string */ 26).format,
errors = __webpack_require__( /*! ../../../data/errors */ 25).errors,
commonUtils = __webpack_require__( /*! ../../../core/utils/common */ 2),
pivotGridUtils = __webpack_require__( /*! ../ui.pivot_grid.utils */ 74);
exports.XmlaStore = Class.inherit(function() {
var discover = '{2}{0}{1}{0}',
execute = '{0}{1}TrueMicrosoft SQL Server Management Studio3600',
mdx = "SELECT {2} FROM {0} {1} CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS",
mdxFilterSelect = "(SELECT {0} FROM {1})",
mdxWith = "{0} {1} as {2}",
mdxSlice = "WHERE ({0})",
mdxNonEmpty = "NonEmpty({0}, {1})",
mdxAxis = "{0} DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME, MEMBER_VALUE ON {1}",
mdxCrossJoin = "CrossJoin({0})",
mdxSet = "{{0}}",
each = $.each,
MEASURE_DEMENSION_KEY = "DX_MEASURES",
MD_DIMTYPE_MEASURE = "2";
function execXMLA(requestOptions, data) {
var deferred = $.Deferred(),
beforeSend = requestOptions.beforeSend,
ajaxSettings = {
url: requestOptions.url,
dataType: "text",
data: data,
headers: {
"Content-Type": "text/xml"
},
xhrFields: {},
method: "POST"
};
if (commonUtils.isFunction(beforeSend)) {
beforeSend(ajaxSettings)
}
pivotGridUtils.sendRequest(ajaxSettings).fail(function() {
deferred.reject(arguments)
}).done(function(text) {
var xml;
try {
xml = $.parseXML(text)
} catch (e) {
deferred.reject({
statusText: e.message,
stack: e.stack,
responseText: text
})
}
deferred.resolve(xml)
});
return deferred
}
function mdxDescendants(level, levelMember, nextLevel) {
levelMember = levelMember ? "." + levelMember : "";
return "Descendants({" + level + levelMember + "}, " + nextLevel + ", SELF_AND_BEFORE)"
}
function getAllMember(dimension) {
return (dimension.hierarchyName || dimension.dataField) + ".[All]"
}
function getAllMembers(field) {
return field.dataField + ".allMembers"
}
function crossJoinElements(elements) {
var elementsString = elements.join(",");
return elements.length > 1 ? stringFormat(mdxCrossJoin, elementsString) : elementsString
}
function union(elements) {
var elementsString = elements.join(",");
return elements.length > 1 ? "Union(" + elementsString + ")" : elementsString
}
function generateCrossJoin(path, expandLevel, expandAllCount, expandIndex, slicePath, options, axisName) {
var dataField, allMember, hierarchyName, arg, prevDimension, prevHierarchyName, isLastDimensionInGroup, isFirstDimensionInGroup, expandAllIndex, field, member, i, crossJoinArgs = [],
dimensions = options[axisName],
fields = [];
for (i = expandIndex; i <= expandLevel; i++) {
field = dimensions[i];
dataField = field.dataField;
prevHierarchyName = dimensions[i - 1] && dimensions[i - 1].hierarchyName;
hierarchyName = field.hierarchyName;
isLastDimensionInGroup = !hierarchyName || !dimensions[i + 1] || dimensions[i + 1].hierarchyName !== hierarchyName;
expandAllIndex = path.length + expandAllCount + expandIndex;
arg = null;
fields.push(field);
if (i < path.length) {
if (isLastDimensionInGroup) {
arg = "(" + dataField + "." + preparePathValue(path[i]) + ")"
}
} else {
if (i <= expandAllIndex) {
if (0 === i && 0 === expandAllCount) {
allMember = getAllMember(dimensions[expandIndex]);
if (!hierarchyName) {
arg = getAllMembers(dimensions[expandIndex])
} else {
arg = allMember + "," + dimensions[expandIndex].dataField
}
} else {
if (hierarchyName) {
member = preparePathValue(slicePath[slicePath.length - 1]);
if (isLastDimensionInGroup || i === expandAllIndex) {
if (prevHierarchyName === hierarchyName) {
if (slicePath.length) {
prevDimension = dimensions[slicePath.length - 1]
}
if (!prevDimension || prevDimension.hierarchyName !== hierarchyName) {
prevDimension = dimensions[i - 1];
member = ""
}
arg = mdxDescendants(prevDimension.dataField, member, dataField)
} else {
arg = getAllMembers(field)
}
}
} else {
arg = getAllMembers(field)
}
}
} else {
isFirstDimensionInGroup = !hierarchyName || prevHierarchyName !== hierarchyName;
if (isFirstDimensionInGroup) {
arg = "(" + getAllMember(field) + ")"
}
}
}
if (arg) {
arg = stringFormat(mdxSet, arg);
crossJoinArgs.push(arg)
}
}
return crossJoinElements(crossJoinArgs)
}
function fillCrossJoins(crossJoins, path, expandLevel, expandIndex, slicePath, options, axisName, cellsString) {
var dimensionIndex, expandAllCount = -1,
dimensions = options[axisName];
do {
expandAllCount++;
dimensionIndex = path.length + expandAllCount + expandIndex;
crossJoins.push(stringFormat(mdxNonEmpty, generateCrossJoin(path, expandLevel, expandAllCount, expandIndex, slicePath, options, axisName), cellsString))
} while (dimensions[dimensionIndex] && dimensions[dimensionIndex + 1] && dimensions[dimensionIndex].expanded)
}
function declare(expression, withArray, name, type) {
name = name || "[DX_Set_" + withArray.length + "]";
type = type || "set";
withArray.push(stringFormat(mdxWith, type, name, expression));
return name
}
function generateAxisMdx(options, axisName, cells, withArray, parseOptions) {
var dimensions = options[axisName],
crossJoins = [],
path = [],
expandedPaths = [],
expandIndex = 0,
expandLevel = 0,
result = [],
cellsString = stringFormat(mdxSet, cells.join(","));
if (dimensions && dimensions.length) {
if (options.headerName === axisName) {
path = options.path;
expandLevel = expandIndex = path.length
} else {
expandedPaths = ("columns" === axisName ? options.columnExpandedPaths : options.rowExpandedPaths) || expandedPaths;
each(expandedPaths, function(_, path) {
expandLevel = Math.max(expandLevel, path.length)
})
}
while (dimensions[expandLevel + 1] && dimensions[expandLevel].expanded) {
expandLevel++
}
fillCrossJoins(crossJoins, [], expandLevel, expandIndex, path, options, axisName, cellsString);
each(expandedPaths, function(_, expandedPath) {
fillCrossJoins(crossJoins, expandedPath, expandLevel, expandIndex, expandedPath, options, axisName, cellsString)
});
for (var i = expandLevel; i >= path.length; i--) {
if (dimensions[i].hierarchyName) {
parseOptions.visibleLevels[dimensions[i].hierarchyName] = parseOptions.visibleLevels[dimensions[i].hierarchyName] || [];
parseOptions.visibleLevels[dimensions[i].hierarchyName].push(dimensions[i].dataField)
}
}
}
if (crossJoins.length) {
result.push(declare(union(crossJoins), withArray, "[DX_" + axisName + "]"))
}
if ("columns" === axisName && cells.length) {
result.push(cellsString)
}
return stringFormat(mdxAxis, crossJoinElements(result), axisName)
}
function generateAxisFieldsFilter(fields) {
var filterMembers = [];
each(fields, function(_, field) {
var filterStringExpression, dataField = field.dataField,
filterExpression = [],
filterValues = field.filterValues || [];
if (field.hierarchyName && commonUtils.isNumber(field.groupIndex)) {
return
}
each(filterValues, function(_, filterValue) {
var filterMdx = dataField + "." + preparePathValue(commonUtils.isArray(filterValue) ? filterValue[filterValue.length - 1] : filterValue);
if ("exclude" === field.filterType) {
filterExpression.push(filterMdx + ".parent");
filterMdx = "Descendants(" + filterMdx + ")"
}
filterExpression.push(filterMdx)
});
if (filterValues.length) {
filterStringExpression = stringFormat(mdxSet, filterExpression.join(","));
if ("exclude" === field.filterType) {
filterStringExpression = "Except(" + getAllMembers(field) + "," + filterStringExpression + ")"
}
filterMembers.push(filterStringExpression)
}
});
return filterMembers.length ? crossJoinElements(filterMembers) : ""
}
function generateFrom(columnsFilter, rowsFilter, filter, cubeName) {
var from = "[" + cubeName + "]";
each([columnsFilter, rowsFilter, filter], function(_, filter) {
if (filter) {
from = stringFormat(mdxFilterSelect, filter + "on 0", from)
}
});
return from
}
function generateMdxCore(axisStrings, withArray, columns, rows, filters, slice, cubeName) {
var mdxString = "",
withString = (withArray.length ? "with " + withArray.join(" ") : "") + " ";
if (axisStrings.length) {
mdxString = withString + stringFormat(mdx, generateFrom(generateAxisFieldsFilter(columns), generateAxisFieldsFilter(rows), generateAxisFieldsFilter(filters || []), cubeName), slice.length ? stringFormat(mdxSlice, slice.join(",")) : "", axisStrings.join(","))
}
return mdxString
}
function prepareDataFields(withArray, valueFields) {
return $.map(valueFields, function(cell) {
if (commonUtils.isString(cell.expression)) {
declare(cell.expression, withArray, cell.dataField, "member")
}
return cell.dataField
})
}
function generateMDX(options, cubeName, parseOptions) {
var columns = options.columns || [],
rows = options.rows || [],
values = options.values && options.values.length ? options.values : [{
dataField: "[Measures]"
}],
slice = [],
withArray = [],
axisStrings = [],
dataFields = prepareDataFields(withArray, values);
parseOptions.measureCount = values.length;
parseOptions.visibleLevels = {};
if (options.headerName && options.path) {
each(options.path, function(index, value) {
var dimension = options[options.headerName][index];
if (!dimension.hierarchyName || dimension.hierarchyName !== options[options.headerName][index + 1].hierarchyName) {
slice.push(dimension.dataField + "." + preparePathValue(value))
}
})
}
if (columns.length || dataFields.length) {
axisStrings.push(generateAxisMdx(options, "columns", dataFields, withArray, parseOptions))
}
if (rows.length) {
axisStrings.push(generateAxisMdx(options, "rows", dataFields, withArray, parseOptions))
}
return generateMdxCore(axisStrings, withArray, columns, rows, options.filters, slice, cubeName)
}
function createDrillDownAxisSlice(slice, fields, path) {
each(path, function(index, value) {
var field = fields[index];
if (field.hierarchyName && (fields[index + 1] || {}).hierarchyName === field.hierarchyName) {
return
}
slice.push(field.dataField + "." + preparePathValue(value))
})
}
function generateDrillDownMDX(options, cubeName, params) {
var coreMDX, columns = options.columns || [],
rows = options.rows || [],
values = options.values && options.values.length ? options.values : [{
dataField: "[Measures]"
}],
slice = [],
withArray = [],
axisStrings = [],
dataFields = prepareDataFields(withArray, values),
maxRowCount = params.maxRowCount,
customColumns = params.customColumns || [],
customColumnsString = customColumns.length > 0 ? " return " + customColumns.join(",") : "";
createDrillDownAxisSlice(slice, columns, params.columnPath || []);
createDrillDownAxisSlice(slice, rows, params.rowPath || []);
if (columns.length || columns.length || dataFields.length) {
axisStrings.push([(dataFields[params.dataIndex] || dataFields[0]) + " on 0"])
}
coreMDX = generateMdxCore(axisStrings, withArray, columns, rows, options.filters, slice, cubeName);
return coreMDX ? "drillthrough" + (maxRowCount > 0 ? " maxrows " + maxRowCount : "") + coreMDX + customColumnsString : coreMDX
}
function getNumber(str) {
return parseInt(str, 10)
}
function parseValue(valueText) {
return $.isNumeric(valueText) ? parseFloat(valueText) : valueText
}
function getFirstChild(node, tagName) {
return (node.getElementsByTagName(tagName) || [])[0]
}
function getFirstChildText(node, childTagName) {
return getNodeText(getFirstChild(node, childTagName))
}
function parseAxes(xml) {
var axes = [];
each(xml.getElementsByTagName("Axis"), function(_, axisElement) {
var name = axisElement.getAttribute("name"),
axis = [],
index = 0;
if (0 === name.indexOf("Axis") && commonUtils.isNumber(getNumber(name.substr(4)))) {
axes.push(axis);
each(axisElement.getElementsByTagName("Tuple"), function(_, tupleElement) {
var tuple, level, i, tupleMembers = tupleElement.childNodes,
levelSum = 0,
members = [],
membersCount = tupleMembers.length - 1,
isAxisWithMeasure = 1 === axes.length;
if (isAxisWithMeasure) {
membersCount--
}
axis.push(members);
for (i = membersCount; i >= 0; i--) {
tuple = tupleMembers[i];
level = getNumber(getFirstChildText(tuple, "LNum"));
members[i] = {
caption: getFirstChildText(tuple, "Caption"),
value: parseValue(getFirstChildText(tuple, "MEMBER_VALUE")),
level: level,
index: index++,
hasValue: !levelSum && (!!level || 0 === i),
name: getFirstChildText(tuple, "UName"),
hierarchyName: tupleMembers[i].getAttribute("Hierarchy"),
parentName: getFirstChildText(tuple, "PARENT_UNIQUE_NAME"),
levelName: getFirstChildText(tuple, "LName")
};
levelSum += level
}
})
}
});
while (axes.length < 2) {
axes.push([
[{
level: 0
}]
])
}
return axes
}
function getNodeText(node) {
return node && node && (node.textContent || node.text || node.innerHTML) || ""
}
function parseCells(xml, axes, measureCount) {
var measureIndex, row, cells = [],
cell = [],
index = 0,
cellsOriginal = [],
cellElements = xml.getElementsByTagName("Cell");
for (var i = 0; i < cellElements.length; i++) {
var xmlCell = cellElements[i],
valueElement = xmlCell.getElementsByTagName("Value")[0],
value = parseFloat(getNodeText(valueElement));
cellsOriginal[getNumber(xmlCell.getAttribute("CellOrdinal"))] = {
value: isNaN(value) ? null : value
}
}
each(axes[1], function() {
row = [];
cells.push(row);
each(axes[0], function() {
measureIndex = index % measureCount;
if (0 === measureIndex) {
cell = [];
row.push(cell)
}
cell.push(cellsOriginal[index] ? cellsOriginal[index].value : null);
index++
})
});
return cells
}
function preparePathValue(pathValue) {
if (pathValue) {
return commonUtils.isString(pathValue) && -1 !== pathValue.indexOf("&[") ? pathValue : "[" + pathValue + "]"
}
}
function getItem(hash, name, member, index) {
var item = hash[name];
if (!item) {
item = {};
hash[name] = item
}
if (!item.value && member) {
item.text = member.caption;
item.value = member.value;
item.key = name ? name.slice(name.indexOf("&[")) : "";
item.levelName = member.levelName;
item.hierarchyName = member.hierarchyName;
item.parentName = member.parentName;
item.index = index;
item.level = member.level
}
return item
}
function getVisibleChildren(item, visibleLevels) {
var result = [],
children = item.children && (item.children.length ? item.children : $.map(item.children.grandTotalHash || [], function(e) {
return e.children
})),
firstChild = children && children[0];
if (firstChild && (visibleLevels[firstChild.hierarchyName] && -1 !== $.inArray(firstChild.levelName, visibleLevels[firstChild.hierarchyName]) || !visibleLevels[firstChild.hierarchyName] || 0 === firstChild.level)) {
var newChildren = $.map(children, function(child) {
return child.hierarchyName === firstChild.hierarchyName ? child : null
});
newChildren.grandTotalHash = children.grandTotalHash;
return newChildren
} else {
if (firstChild) {
for (var i = 0; i < children.length; i++) {
if (children[i].hierarchyName === firstChild.hierarchyName) {
result.push.apply(result, getVisibleChildren(children[i], visibleLevels))
}
}
}
}
return result
}
function processMember(dataIndex, member, parentItem) {
var currentItem, children = parentItem.children = parentItem.children || [],
hash = children.hash = children.hash || {},
grandTotalHash = children.grandTotalHash = children.grandTotalHash || {};
if (member.parentName) {
parentItem = getItem(hash, member.parentName);
children = parentItem.children = parentItem.children || []
}
currentItem = getItem(hash, member.name, member, dataIndex);
if (member.hasValue && !currentItem.added) {
currentItem.index = dataIndex;
currentItem.added = true;
children.push(currentItem)
}
if ((!parentItem.value || !parentItem.parentName) && member.parentName) {
grandTotalHash[member.parentName] = parentItem
} else {
if (grandTotalHash[parentItem.name]) {
delete grandTotalHash[member.parentName]
}
}
return currentItem
}
function getGrandTotalIndex(parentItem, visibleLevels) {
var grandTotalIndex;
if (1 === parentItem.children.length && "" === parentItem.children[0].parentName) {
grandTotalIndex = parentItem.children[0].index;
var grandTotalHash = parentItem.children.grandTotalHash;
parentItem.children = parentItem.children[0].children || [];
parentItem.children.grandTotalHash = grandTotalHash;
parentItem.children = getVisibleChildren(parentItem, visibleLevels)
} else {
if (0 === parentItem.children.length) {
grandTotalIndex = 0
}
}
return grandTotalIndex
}
function fillDataSourceAxes(dataSourceAxis, axisTuples, measureCount, visibleLevels) {
var grandTotalIndex, result = [];
each(axisTuples, function(tupleIndex, members) {
var parentItem = {
children: result
},
dataIndex = commonUtils.isDefined(measureCount) ? Math.floor(tupleIndex / measureCount) : tupleIndex;
each(members, function(_, member) {
parentItem = processMember(dataIndex, member, parentItem)
})
});
var parentItem = {
children: result
};
parentItem.children = getVisibleChildren(parentItem, visibleLevels);
grandTotalIndex = getGrandTotalIndex(parentItem, visibleLevels);
pivotGridUtils.foreachTree(parentItem.children, function(items) {
var item = items[0],
children = getVisibleChildren(item, visibleLevels);
if (children.length) {
item.children = children
} else {
delete item.children
}
delete item.levelName;
delete item.hierarchyName;
delete item.added;
delete item.parentName;
delete item.level
}, true);
each(parentItem.children || [], function(_, e) {
dataSourceAxis.push(e)
});
return grandTotalIndex
}
function checkError(xml) {
var description, error, errorElement = $(xml).find("Error");
if (errorElement.length) {
description = errorElement.attr("Description");
error = new errors.Error("E4000", description);
errors.log("E4000", description);
return error
}
return null
}
function parseResult(xml, parseOptions) {
var axes, dataSource = {
columns: [],
rows: []
},
measureCount = parseOptions.measureCount;
axes = parseAxes(xml);
dataSource.grandTotalColumnIndex = fillDataSourceAxes(dataSource.columns, axes[0], measureCount, parseOptions.visibleLevels);
dataSource.grandTotalRowIndex = fillDataSourceAxes(dataSource.rows, axes[1], void 0, parseOptions.visibleLevels);
dataSource.values = parseCells(xml, axes, measureCount);
return dataSource
}
function parseDiscoverRowSet(xml, schema, dimensions) {
var result = [],
isMeasure = "MEASURE" === schema,
displayFolderField = isMeasure ? "MEASUREGROUP_NAME" : schema + "_DISPLAY_FOLDER";
each(xml.getElementsByTagName("row"), function(_, row) {
var hierarchyName = "LEVEL" === schema ? getFirstChildText(row, "HIERARCHY_UNIQUE_NAME") : void 0,
levelNumber = getFirstChildText(row, "LEVEL_NUMBER");
if (("0" !== levelNumber || "true" !== getFirstChildText(row, schema + "_IS_VISIBLE")) && getFirstChildText(row, "DIMENSION_TYPE") !== MD_DIMTYPE_MEASURE) {
var dimension = isMeasure ? MEASURE_DEMENSION_KEY : getFirstChildText(row, "DIMENSION_UNIQUE_NAME"),
dataField = getFirstChildText(row, schema + "_UNIQUE_NAME");
result.push({
dimension: dimensions.names[dimension] || dimension,
groupIndex: levelNumber ? getNumber(levelNumber) - 1 : void 0,
dataField: dataField,
caption: getFirstChildText(row, schema + "_CAPTION"),
hierarchyName: hierarchyName,
groupName: hierarchyName,
displayFolder: getFirstChildText(row, displayFolderField),
isMeasure: isMeasure,
isDefault: !!dimensions.defaultHierarchies[dataField]
})
}
});
return result
}
function parseDimensionsDiscoverRowSet(xml) {
var result = {
names: {},
defaultHierarchies: {}
};
each($(xml).find("row"), function() {
var $row = $(this),
type = $row.children("DIMENSION_TYPE").text(),
dimensionName = type === MD_DIMTYPE_MEASURE ? MEASURE_DEMENSION_KEY : $row.children("DIMENSION_UNIQUE_NAME").text();
result.names[dimensionName] = $row.children("DIMENSION_CAPTION").text();
result.defaultHierarchies[$row.children("DEFAULT_HIERARCHY").text()] = true
});
return result
}
function parseStringWithUnicodeSymbols(str) {
str = str.replace(/_x(....)_/g, function(whole, group1) {
return String.fromCharCode(parseInt(group1, 16))
});
var stringArray = str.match(/\[.+?\]/gi);
if (stringArray && stringArray.length) {
str = stringArray[stringArray.length - 1]
}
return str.replace(/\[/gi, "").replace(/\]/gi, "").replace(/\$/gi, "").replace(/\./gi, " ")
}
function parseDrillDownRowset(xml) {
var rows = xml.getElementsByTagName("row"),
result = [],
columnNames = {};
for (var i = 0; i < rows.length; i++) {
var children = rows[i].childNodes,
item = {};
for (var j = 0; j < children.length; j++) {
var tagName = children[j].tagName,
name = columnNames[tagName] = columnNames[tagName] || parseStringWithUnicodeSymbols(tagName);
item[name] = getNodeText(children[j])
}
result.push(item)
}
return result
}
function sendQuery(storeOptions, mdxString) {
mdxString = $("").text(mdxString).html();
return execXMLA(storeOptions, stringFormat(execute, mdxString, storeOptions.catalog))
}
return {
ctor: function(options) {
this._options = options
},
getFields: function() {
var options = this._options,
catalog = options.catalog,
cube = options.cube,
dimensionsRequest = execXMLA(options, stringFormat(discover, catalog, cube, "MDSCHEMA_DIMENSIONS")),
measuresRequest = execXMLA(options, stringFormat(discover, catalog, cube, "MDSCHEMA_MEASURES")),
hierarchiesRequest = execXMLA(options, stringFormat(discover, catalog, cube, "MDSCHEMA_HIERARCHIES")),
levelsRequest = execXMLA(options, stringFormat(discover, catalog, cube, "MDSCHEMA_LEVELS")),
result = $.Deferred();
$.when(dimensionsRequest, measuresRequest, hierarchiesRequest, levelsRequest).done(function(dimensionsResponse, measuresResponse, hierarchiesResponse, levelsResponse) {
var dimensions = parseDimensionsDiscoverRowSet(dimensionsResponse),
hierarchies = parseDiscoverRowSet(hierarchiesResponse, "HIERARCHY", dimensions),
levels = parseDiscoverRowSet(levelsResponse, "LEVEL", dimensions),
fields = parseDiscoverRowSet(measuresResponse, "MEASURE", dimensions).concat(hierarchies),
levelsByHierarchy = {};
each(levels, function(_, level) {
levelsByHierarchy[level.hierarchyName] = levelsByHierarchy[level.hierarchyName] || [];
levelsByHierarchy[level.hierarchyName].push(level)
});
each(hierarchies, function(_, hierarchy) {
if (levelsByHierarchy[hierarchy.dataField] && levelsByHierarchy[hierarchy.dataField].length > 1) {
hierarchy.groupName = hierarchy.hierarchyName = hierarchy.dataField;
fields.push.apply(fields, levelsByHierarchy[hierarchy.hierarchyName])
}
});
result.resolve(fields)
}).fail(result.reject);
return result
},
load: function(options) {
var result = $.Deferred(),
storeOptions = this._options,
parseOptions = {},
mdxString = generateMDX(options, storeOptions.cube, parseOptions);
if (mdxString) {
$.when(sendQuery(storeOptions, mdxString)).done(function(executeXml) {
var error = checkError(executeXml);
if (!error) {
result.resolve(parseResult(executeXml, parseOptions))
} else {
result.reject(error)
}
}).fail(result.reject)
} else {
result.resolve({
columns: [],
rows: [],
values: [],
grandTotalColumnIndex: 0,
grandTotalRowIndex: 0
})
}
return result
},
supportSorting: function() {
return true
},
getDrillDownItems: function(options, params) {
var result = $.Deferred(),
storeOptions = this._options,
mdxString = generateDrillDownMDX(options, storeOptions.cube, params);
if (mdxString) {
$.when(sendQuery(storeOptions, mdxString)).done(function(executeXml) {
var error = checkError(executeXml);
if (!error) {
result.resolve(parseDrillDownRowset(executeXml))
} else {
result.reject(error)
}
}).fail(result.reject)
} else {
result.resolve([])
}
return result
},
key: $.noop,
filter: $.noop
}
}())
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*******************************************************************************!*\
!*** ./Scripts/ui/scheduler/ui.scheduler.appointments.strategy.horizontal.js ***!
\*******************************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var BaseAppointmentsStrategy = __webpack_require__( /*! ./ui.scheduler.appointments.strategy.base */ 227),
dateUtils = __webpack_require__( /*! ../../core/utils/date */ 12);
var MAX_APPOINTMENT_HEIGHT = 100,
BOTTOM_CELL_GAP = 20,
toMs = dateUtils.dateToMilliseconds;
var HorizontalRenderingStrategy = BaseAppointmentsStrategy.inherit({
_needVerifyItemSize: function() {
return true
},
calculateAppointmentWidth: function(appointment) {
var width, cellWidth = this._defaultWidth || this.getAppointmentDefaultSize(),
allDay = this.instance.invoke("getField", "allDay", appointment),
minWidth = this.getAppointmentDefaultSize(),
durationInCells = 0;
var dayDuration = toMs("day"),
startDate = this._startDate(appointment),
endDate = this._endDate(appointment),
appointmentDuration = endDate.getTime() - startDate.getTime();
if (allDay) {
var ceilQuantityOfDays = Math.ceil(appointmentDuration / dayDuration);
durationInCells = ceilQuantityOfDays * (60 * this.instance.option("dayDuration") / this.instance.option("appointmentDurationInMinutes"))
} else {
var floorQuantityOfDays = Math.floor(appointmentDuration / dayDuration),
tailDuration = appointmentDuration % dayDuration,
visibleDayDuration = this.instance.option("dayDuration") * toMs("hour");
if (tailDuration > visibleDayDuration) {
tailDuration = visibleDayDuration
}
var cellDuration = this.instance.option("appointmentDurationInMinutes") * toMs("minute");
durationInCells = (floorQuantityOfDays * visibleDayDuration + tailDuration) / cellDuration
}
width = durationInCells * cellWidth;
if (width < minWidth) {
width = minWidth
}
return width
},
getAppointmentGeometry: function(coordinates) {
var result = this._customizeAppointmentGeometry(coordinates);
return this.callBase(result)
},
_customizeAppointmentGeometry: function(coordinates) {
var cellHeight = (this._defaultHeight || this.getAppointmentDefaultSize()) - BOTTOM_CELL_GAP,
height = cellHeight / coordinates.count;
if (height > MAX_APPOINTMENT_HEIGHT) {
height = MAX_APPOINTMENT_HEIGHT
}
var top = coordinates.top + coordinates.index * height;
return {
height: height,
width: coordinates.width,
top: top,
left: coordinates.left
}
},
_correctRtlCoordinatesParts: function(coordinates, width) {
for (var i = 1; i < coordinates.length; i++) {
coordinates[i].left -= width
}
return coordinates
},
_sortCondition: function(a, b) {
var result = this._columnCondition(a, b);
return this._fixUnstableSorting(result, a, b)
},
_getMaxAppointmentWidth: function(startDate) {
var result;
this.instance.notifyObserver("getMaxAppointmentWidth", {
date: startDate,
callback: function(width) {
result = width
}
});
return result
},
getDeltaTime: function(args, initialSize) {
var deltaWidth = this._getDeltaWidth(args, initialSize);
return this.instance.option("appointmentDurationInMinutes") * toMs("minute") * deltaWidth
},
isAllDay: function(appointmentData) {
return this.instance.invoke("getField", "allDay", appointmentData)
}
});
module.exports = HorizontalRenderingStrategy
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!******************************************************************************************!*\
!*** ./Scripts/ui/scheduler/ui.scheduler.appointments.strategy.horizontal_month_line.js ***!
\******************************************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var HorizontalAppointmentsStrategy = __webpack_require__( /*! ./ui.scheduler.appointments.strategy.horizontal */ 317),
dateUtils = __webpack_require__( /*! ../../core/utils/date */ 12),
query = __webpack_require__( /*! ../../data/query */ 34);
var HorizontalMonthLineRenderingStrategy = HorizontalAppointmentsStrategy.inherit({
calculateAppointmentWidth: function(appointment) {
var startDate = new Date(this._startDate(appointment)),
endDate = new Date(this._endDate(appointment)),
cellWidth = this._defaultWidth || this.getAppointmentDefaultSize();
startDate = dateUtils.trimTime(startDate);
var durationInHours = (endDate.getTime() - startDate.getTime()) / 36e5;
return Math.ceil(durationInHours / 24) * cellWidth
},
getDeltaTime: function(args, initialSize) {
var deltaWidth = this._getDeltaWidth(args, initialSize);
return 864e5 * deltaWidth
},
isAllDay: function() {
return false
},
createTaskPositionMap: function(items) {
this.instance._sortAppointmentsByStartDate(items);
return this.callBase(items)
},
_getSortedPositions: function(map, skipSorting) {
var result = this.callBase(map);
if (!skipSorting) {
result = query(result).sortBy("top").thenBy("left").thenBy("i").toArray()
}
return result
}
});
module.exports = HorizontalMonthLineRenderingStrategy
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!************************************************************!*\
!*** ./Scripts/ui/scheduler/ui.scheduler.timeline_week.js ***!
\************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 3),
SchedulerTimeline = __webpack_require__( /*! ./ui.scheduler.timeline */ 229),
dateLocalization = __webpack_require__( /*! ../../localization/date */ 14);
var TIMELINE_CLASS = "dx-scheduler-timeline-week",
HEADER_PANEL_CELL_CLASS = "dx-scheduler-header-panel-cell",
HEADER_ROW_CLASS = "dx-scheduler-header-row",
CELL_WIDTH = 200;
var SchedulerTimelineWeek = SchedulerTimeline.inherit({
_getElementClass: function() {
return TIMELINE_CLASS
},
_getCellCount: function() {
return this.callBase() * this._getWeekDuration()
},
_renderDateHeader: function() {
var $headerRow = this.callBase(),
firstViewDate = new Date(this._firstViewDate),
$cells = [],
colspan = this._getCellCountInDay(),
headerCellWidth = colspan * CELL_WIDTH;
for (var i = 0; i < this._getWeekDuration(); i++) {
$cells.push($(" ").addClass(HEADER_PANEL_CELL_CLASS).text(dateLocalization.format(firstViewDate, "E d")).attr("colspan", colspan).width(headerCellWidth));
firstViewDate.setDate(firstViewDate.getDate() + 1)
}
var $row = $(" | ").addClass(HEADER_ROW_CLASS).append($cells);
$headerRow.before($row)
},
_getWeekDuration: function() {
return 7
}
});
registerComponent("dxSchedulerTimelineWeek", SchedulerTimelineWeek);
module.exports = SchedulerTimelineWeek
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************************!*\
!*** ./Scripts/ui/scheduler/ui.scheduler.timezones.js ***!
\********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var query = __webpack_require__( /*! ../../data/query */ 34),
errors = __webpack_require__( /*! ../../core/errors */ 10),
tzData = __webpack_require__( /*! ./ui.scheduler.timezones_data */ 495);
var SchedulerTimezones = {
_displayNames: tzData.displayNames,
_list: tzData.timezones,
getTimezones: function() {
return this._list
},
getDisplayNames: function() {
return this._displayNames
},
queryableTimezones: function() {
return query(this.getTimezones())
},
getTimezoneById: function(id) {
var result, i = 0,
tzList = this.getTimezones();
if (id) {
while (!result) {
if (!tzList[i]) {
errors.log("W0009", id);
return
}
var currentId = tzList[i].id;
if (currentId === id) {
result = tzList[i]
}
i++
}
}
return result
},
getTimezoneOffsetById: function(id, dateTimeStamp) {
var offsets, offsetIndices, untils, result, tz = this.getTimezoneById(id);
if (tz) {
if (tz.link) {
var rootTz = this.getTimezones()[tz.link];
offsets = rootTz.offsets;
untils = rootTz.untils;
offsetIndices = rootTz.offsetIndices
} else {
offsets = tz.offsets;
untils = tz.untils;
offsetIndices = tz.offsetIndices
}
result = this.getUtcOffset(offsets, offsetIndices, untils, dateTimeStamp)
}
return result
},
getUtcOffset: function(offsets, offsetIndices, untils, dateTimeStamp) {
var index = 0;
var offsetIndicesList = offsetIndices.split("");
var untilsList = untils.split("|").map(function(until) {
if ("Infinity" === until) {
return null
}
return 1e3 * parseInt(until, 36)
});
var currentUntil = 0;
for (var i = 0, listLength = untilsList.length; i < listLength; i++) {
currentUntil += untilsList[i];
if (dateTimeStamp >= currentUntil) {
index = i;
continue
} else {
break
}
}
if (untilsList[index + 1]) {
index++
}
return offsets[Number(offsetIndicesList[index])]
},
getTimezoneShortDisplayNameById: function(id) {
var result, tz = this.getTimezoneById(id);
if (tz) {
result = tz.DisplayName.substring(0, 11)
}
return result
},
getTimezonesDisplayName: function() {
return query(this.getDisplayNames()).sortBy().toArray()
},
getTimezoneDisplayNameById: function(id) {
var tz = this.getTimezoneById(id);
return tz ? this.getDisplayNames()[tz.winIndex] : ""
},
getSimilarTimezones: function(id) {
if (!id) {
return []
}
var tz = this.getTimezoneById(id);
return this.getTimezonesIdsByWinIndex(tz.winIndex)
},
getTimezonesIdsByWinIndex: function(winIndex) {
return this.queryableTimezones().filter(["winIndex", winIndex]).sortBy("title").toArray().map(function(item) {
return {
id: item.id,
displayName: item.title
}
})
},
getTimezonesIdsByDisplayName: function(displayName) {
var displayNameIndex = this.getDisplayNames().indexOf(displayName);
return this.getTimezonesIdsByWinIndex(displayNameIndex)
},
getClientTimezoneOffset: function() {
return 6e4 * (new Date).getTimezoneOffset()
},
processDateDependOnTimezone: function(date, tzOffset) {
var result = new Date(date);
if (tzOffset) {
var tzDiff = tzOffset + this.getClientTimezoneOffset() / 36e5;
result = new Date(result.setHours(result.getHours() + tzDiff))
}
return result
}
};
module.exports = SchedulerTimezones
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************************************!*\
!*** ./Scripts/ui/scheduler/ui.scheduler.work_space_week.js ***!
\**************************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 3),
SchedulerWorkSpace = __webpack_require__( /*! ./ui.scheduler.work_space */ 156);
var WEEK_CLASS = "dx-scheduler-work-space-week";
var SchedulerWorkSpaceWeek = SchedulerWorkSpace.inherit({
_getElementClass: function() {
return WEEK_CLASS
},
_getRowCount: function() {
return this._getCellCountInDay()
},
_getCellCount: function() {
return 7
},
_getDateByIndex: function(headerIndex) {
var resultDate = new Date(this._firstViewDate);
resultDate.setDate(this._firstViewDate.getDate() + headerIndex);
return resultDate
},
_getFormat: function() {
return "E d"
},
_getCellsBetween: function($first, $last) {
if (this._hasAllDayClass($last)) {
return this.callBase($first, $last)
}
var $cells = this._getCells(),
firstColumn = $first.index(),
firstRow = $first.parent().index(),
lastColumn = $last.index(),
lastRow = $last.parent().index(),
groupCount = this._getGroupCount(),
cellCount = groupCount > 0 ? this._getTotalCellCount(groupCount) : this._getCellCount(),
rowCount = this._getTotalRowCount(groupCount),
result = [];
for (var i = 0; i < cellCount; i++) {
for (var j = 0; j < rowCount; j++) {
var cell = $cells.get(cellCount * j + i);
result.push(cell)
}
}
var newFirstIndex = rowCount * firstColumn + firstRow,
newLastIndex = rowCount * lastColumn + lastRow;
if (newFirstIndex > newLastIndex) {
var buffer = newFirstIndex;
newFirstIndex = newLastIndex;
newLastIndex = buffer
}
$cells = $(result).slice(newFirstIndex, newLastIndex + 1);
if (!!this._getGroupCount()) {
var arr = [],
focusedGroupIndex = this._getGroupIndexByCell($first);
$.each($cells, $.proxy(function(_, cell) {
var groupIndex = this._getGroupIndexByCell($(cell));
if (focusedGroupIndex === groupIndex) {
arr.push(cell)
}
}, this));
$cells = $(arr)
}
return $cells
},
_getRightCell: function(isMultiSelection) {
if (!isMultiSelection) {
return this.callBase(isMultiSelection)
}
var $rightCell, $focusedCell = this._$focusedCell,
groupCount = this._getGroupCount(),
rowCellCount = isMultiSelection ? this._getCellCount() : this._getTotalCellCount(groupCount),
edgeCellIndex = this._isRTL() ? 0 : rowCellCount - 1,
direction = this._isRTL() ? "prev" : "next";
if ($focusedCell.index() === edgeCellIndex || this._isGroupEndCell($focusedCell)) {
$rightCell = $focusedCell
} else {
$rightCell = $focusedCell[direction]();
$rightCell = this._checkForViewBounds($rightCell)
}
return $rightCell
},
_getLeftCell: function(isMultiSelection) {
if (!isMultiSelection) {
return this.callBase(isMultiSelection)
}
var $leftCell, $focusedCell = this._$focusedCell,
groupCount = this._getGroupCount(),
rowCellCount = isMultiSelection ? this._getCellCount() : this._getTotalCellCount(groupCount),
edgeCellIndex = this._isRTL() ? rowCellCount - 1 : 0,
direction = this._isRTL() ? "next" : "prev";
if ($focusedCell.index() === edgeCellIndex || this._isGroupStartCell($focusedCell)) {
$leftCell = $focusedCell
} else {
$leftCell = $focusedCell[direction]();
$leftCell = this._checkForViewBounds($leftCell)
}
return $leftCell
}
});
registerComponent("dxSchedulerWorkSpaceWeek", SchedulerWorkSpaceWeek);
module.exports = SchedulerWorkSpaceWeek
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*******************************************************!*\
!*** ./Scripts/ui/widget/jquery.default_templates.js ***!
\*******************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
inflector = __webpack_require__( /*! ../../core/utils/inflector */ 29),
iconUtils = __webpack_require__( /*! ../../core/utils/icon */ 77),
dateUtils = __webpack_require__( /*! ../../core/utils/date */ 12),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
errors = __webpack_require__( /*! ../../core/errors */ 10),
dateLocalization = __webpack_require__( /*! ../../localization/date */ 14);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!************************************************!*\
!*** ./Scripts/ui/widget/ui.template.empty.js ***!
\************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
TemplateBase = __webpack_require__( /*! ./ui.template_base */ 47);
var EmptyTemplate = TemplateBase.inherit({
ctor: function(owner) {
this.callBase($(), owner)
},
_renderCore: function() {
return $()
}
});
module.exports = EmptyTemplate
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************************!*\
!*** ./Scripts/ui/widget/ui.template_provider_base.js ***!
\********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Class = __webpack_require__( /*! ../../core/class */ 5);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***********************************************!*\
!*** ./Scripts/viz/axes/base_tick_manager.js ***!
\***********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var TickManager, $ = __webpack_require__( /*! jquery */ 1),
coreTickManager = __webpack_require__( /*! ./numeric_tick_manager */ 189),
dateTimeManager = __webpack_require__( /*! ./datetime_tick_manager */ 499),
overlappingMethods = __webpack_require__( /*! ./tick_overlapping_manager */ 502),
logarithmicMethods = __webpack_require__( /*! ./logarithmic_tick_manager */ 500),
dateUtils = __webpack_require__( /*! ../../core/utils/date */ 12),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
formatHelper = __webpack_require__( /*! ../../format_helper */ 68),
_isDefined = commonUtils.isDefined,
_isNumber = commonUtils.isNumber,
_addInterval = dateUtils.addInterval,
utils = __webpack_require__( /*! ../core/utils */ 6),
_adjustValue = utils.adjustValue,
_map = utils.map,
_each = $.each,
_inArray = $.inArray,
_noop = $.noop,
DEFAULT_GRID_SPACING_FACTOR = 30,
DEFAULT_MINOR_GRID_SPACING_FACTOR = 15,
DEFAULT_NUMBER_MULTIPLIERS = [1, 2, 3, 5],
TICKS_COUNT_LIMIT = 2e3,
MIN_ARRANGEMENT_TICKS_COUNT = 2;
function getUniqueValues(array) {
var currentValue, lastValue = array[0],
result = [lastValue.obj],
length = array.length,
i = 1;
for (i; i < length; i++) {
currentValue = array[i];
if (lastValue.value !== currentValue.value) {
result.push(currentValue.obj);
lastValue = currentValue
}
}
return result
}
function concatAndSort(array1, array2) {
if (!array1.length && !array2.length) {
return []
}
var array = array1.concat(array2),
values = [],
length = array.length,
hasNull = false,
i = 0;
for (i; i < length; i++) {
if (null !== array[i]) {
values.push({
obj: array[i],
value: array[i].valueOf()
})
} else {
hasNull = true
}
}
values.sort(function(x, y) {
return x.value - y.value
});
values = getUniqueValues(values);
hasNull && values.push(null);
return values
}
exports.discrete = $.extend({}, coreTickManager.continuous, {
_calculateMinorTicks: _noop,
_findTickInterval: _noop,
_createTicks: function() {
return []
},
_getMarginValue: _noop,
_generateBounds: _noop,
_correctMin: _noop,
_correctMax: _noop,
_findBusinessDelta: _noop,
_addBoundedTicks: _noop,
getFullTicks: function() {
return this._customTicks
},
getMinorTicks: function() {
return this._decimatedTicks || []
},
_findTickIntervalForCustomTicks: function() {
return 1
}
});
TickManager = exports.TickManager = function(types, data, options) {
options = options || {};
this.update(types || {}, data || {}, options);
this._initOverlappingMethods(options.overlappingBehaviorType)
};
TickManager.prototype = {
constructor: TickManager,
dispose: function() {
this._ticks = null;
this._minorTicks = null;
this._decimatedTicks = null;
this._boundaryTicks = null;
this._options = null
},
update: function(types, data, options) {
this._updateOptions(options || {});
this._min = data.min;
this._updateTypes(types || {});
this._updateData(data || {})
},
_updateMinMax: function(data) {
var min = data.min || 0,
max = data.max || 0,
newMinMax = this._applyMinMaxMargins(min, max);
this._min = this._originalMin = newMinMax.min;
this._max = this._originalMax = newMinMax.max;
this._updateBusinessDelta()
},
_updateBusinessDelta: function() {
this._businessDelta = this._findBusinessDelta && this._findBusinessDelta(this._min, this._max)
},
_updateTypes: function(types) {
var that = this,
axisType = that._validateAxisType(types.axisType),
dataType = that._validateDataType(types.dataType);
that._resetMethods();
this._axisType = axisType;
this._dataType = dataType;
this._initMethods()
},
_updateData: function(data) {
data = $.extend({}, data);
data.min = _isDefined(data.min) ? data.min : this._originalMin;
data.max = _isDefined(data.max) ? data.max : this._originalMax;
this._updateMinMax(data);
this._customTicks = data.customTicks && data.customTicks.slice();
this._customMinorTicks = data.customMinorTicks;
this._customBoundTicks = data.customBoundTicks;
this._screenDelta = data.screenDelta || 0
},
_updateOptions: function(options) {
var opt;
this._options = opt = options;
this._useAutoArrangement = !!this._options.useTicksAutoArrangement;
opt.gridSpacingFactor = opt.gridSpacingFactor || DEFAULT_GRID_SPACING_FACTOR;
opt.minorGridSpacingFactor = opt.minorGridSpacingFactor || DEFAULT_MINOR_GRID_SPACING_FACTOR;
opt.numberMultipliers = opt.numberMultipliers || DEFAULT_NUMBER_MULTIPLIERS
},
getTickBounds: function() {
return {
minVisible: this._minBound,
maxVisible: this._maxBound
}
},
getTicks: function(withoutOverlappingBehavior) {
var that = this,
options = that._options;
that._ticks = that._calculateMajorTicks();
that._checkLabelFormat();
that._decimatedTicks = [];
that._applyAutoArrangement();
!withoutOverlappingBehavior && that._applyOverlappingBehavior();
that._generateBounds();
if (options.showMinorTicks) {
that._minorTicks = that._calculateMinorTicks()
}
that._addBoundedTicks();
return that._ticks
},
getMinorTicks: function() {
var that = this,
decimatedTicks = that.getDecimatedTicks(),
options = that._options || {},
hasDecimatedTicks = decimatedTicks.length,
hasMinorTickOptions = _isDefined(options.minorTickInterval) || _isDefined(options.minorTickCount),
hasCustomMinorTicks = that._customMinorTicks && that._customMinorTicks.length,
hasMinorTicks = options.showMinorTicks && (hasMinorTickOptions || hasCustomMinorTicks),
ticks = hasDecimatedTicks && !hasMinorTicks ? decimatedTicks : that._minorTicks || [];
return concatAndSort(ticks, [])
},
getDecimatedTicks: function() {
return this._decimatedTicks || []
},
getFullTicks: function() {
var that = this,
needCalculateMinorTicks = that._ticks && !that._minorTicks,
minorTicks = needCalculateMinorTicks ? that._calculateMinorTicks() : that._minorTicks || [];
return concatAndSort(that._ticks || [], minorTicks.concat(that.getBoundaryTicks()))
},
getBoundaryTicks: function() {
return this._boundaryTicks || []
},
getTickInterval: function() {
return this._tickInterval
},
getMinorTickInterval: function() {
return this._minorTickInterval
},
getOverlappingBehavior: function() {
return this._options.overlappingBehavior
},
getOptions: function() {
return this._options
},
_calculateMajorTicks: function() {
var ticks, that = this;
if (that._options.showCalculatedTicks || !that._customTicks) {
ticks = that._createTicks(that._options.showCalculatedTicks ? that._customTicks || [] : [], that._findTickInterval(), that._min, that._max)
} else {
ticks = that._customTicks.slice();
that._tickInterval = ticks.length > 1 ? that._findTickIntervalForCustomTicks() : 0
}
return ticks
},
_applyMargin: function(margin, min, max, isNegative) {
var coef, value = min;
if (isFinite(margin)) {
coef = this._getMarginValue(min, max, margin);
if (coef) {
value = this._getNextTickValue(min, coef, isNegative, false)
}
}
return value
},
_applyMinMaxMargins: function(min, max) {
var options = this._options,
newMin = min > max ? max : min,
newMax = max > min ? max : min;
this._minCorrectionEnabled = this._getCorrectionEnabled(min, "min");
this._maxCorrectionEnabled = this._getCorrectionEnabled(max, "max");
if (options && !options.stick) {
newMin = this._applyMargin(options.minValueMargin, min, max, true);
newMax = this._applyMargin(options.maxValueMargin, max, min, false)
}
return {
min: newMin,
max: newMax
}
},
_checkBoundedTickInArray: function(value, array) {
var arrayValues = _map(array || [], function(item) {
return item.valueOf()
}),
minorTicksIndex = _inArray(value.valueOf(), arrayValues);
if (-1 !== minorTicksIndex) {
array.splice(minorTicksIndex, 1)
}
},
_checkLabelFormat: function() {
var options = this._options;
if ("datetime" === this._dataType && !options.hasLabelFormat && this._ticks.length) {
options.labelOptions.format = options.isMarkersVisible ? dateUtils.getDateFormatByTickInterval(this._tickInterval) : formatHelper.getDateFormatByTicks(this._ticks)
}
},
_generateBounds: function() {
var that = this,
interval = that._getBoundInterval(),
stick = that._options.stick,
minStickValue = that._options.minStickValue,
maxStickValue = that._options.maxStickValue,
minBound = that._minCorrectionEnabled && !stick ? that._getNextTickValue(that._min, interval, true) : that._originalMin,
maxBound = that._maxCorrectionEnabled && !stick ? that._getNextTickValue(that._max, interval) : that._originalMax;
that._minBound = minBound < minStickValue ? minStickValue : minBound;
that._maxBound = maxBound > maxStickValue ? maxStickValue : maxBound
},
_initOverlappingMethods: function(type) {
this._initMethods(overlappingMethods[type || "linear"])
},
_addBoundedTicks: function() {
var that = this,
tickValues = _map(that._ticks, function(tick) {
return tick.valueOf()
}),
customBounds = that._customBoundTicks,
min = that._originalMin,
max = that._originalMax,
addMinMax = that._options.addMinMax || {};
function processTick(tick) {
that._boundaryTicks.push(tick);
that._checkBoundedTickInArray(tick, that._minorTicks);
that._checkBoundedTickInArray(tick, that._decimatedTicks)
}
that._boundaryTicks = [];
if (customBounds) {
if (addMinMax.min && _isDefined(customBounds[0])) {
processTick(customBounds[0])
}
if (addMinMax.max && _isDefined(customBounds[1])) {
processTick(customBounds[1])
}
} else {
if (addMinMax.min && -1 === _inArray(min.valueOf(), tickValues)) {
processTick(min)
}
if (addMinMax.max && -1 === _inArray(max.valueOf(), tickValues)) {
processTick(max)
}
}
},
_getCorrectionEnabled: function(value, marginSelector) {
var options = this._options || {},
hasPercentStick = options.percentStick && 1 === Math.abs(value),
hasValueMargin = options[marginSelector + "ValueMargin"];
return !hasPercentStick && !hasValueMargin
},
_validateAxisType: function(type) {
var defaultType = "continuous",
allowedTypes = {
continuous: true,
discrete: true,
logarithmic: true
};
return allowedTypes[type] ? type : defaultType
},
_validateDataType: function(type) {
var allowedTypes = {
numeric: true,
datetime: true,
string: true
};
if (!allowedTypes[type]) {
type = _isDefined(this._min) ? this._getDataType(this._min) : "numeric"
}
return type
},
_getDataType: function(value) {
return commonUtils.isDate(value) ? "datetime" : "numeric"
},
_getMethods: function() {
var methods;
if ("continuous" === this._axisType) {
methods = "datetime" === this._dataType ? dateTimeManager.datetime : coreTickManager.continuous
} else {
switch (this._axisType) {
case "discrete":
methods = exports.discrete;
break;
case "logarithmic":
methods = logarithmicMethods.logarithmic;
break;
default:
methods = coreTickManager.continuous
}
}
return methods
},
_resetMethods: function() {
var that = this,
methods = that._getMethods();
_each(methods, function(name) {
if (that[name]) {
delete that[name]
}
})
},
_initMethods: function(methods) {
var that = this;
methods = methods || that._getMethods();
_each(methods, function(name, func) {
that[name] = func
})
},
_getDeltaCoef: function(screenDelta, businessDelta, gridSpacingFactor) {
var count;
gridSpacingFactor = gridSpacingFactor || this._options.gridSpacingFactor;
screenDelta = screenDelta || this._screenDelta;
businessDelta = businessDelta || this._businessDelta;
count = screenDelta / gridSpacingFactor;
count = count <= 1 ? MIN_ARRANGEMENT_TICKS_COUNT : count;
return businessDelta / count
},
_adjustNumericTickValue: function(value, interval, min) {
return commonUtils.isExponential(value) ? _adjustValue(value) : utils.applyPrecisionByMinDelta(min, interval, value)
},
_isTickIntervalCorrect: function(tickInterval, tickCountLimit, businessDelta) {
var date;
businessDelta = businessDelta || this._businessDelta;
if (!_isNumber(tickInterval)) {
date = new Date;
tickInterval = _addInterval(date, tickInterval) - date;
if (!tickInterval) {
return false
}
}
if (_isNumber(tickInterval)) {
if (tickInterval > 0 && businessDelta / tickInterval > tickCountLimit) {
if (this._options.incidentOccurred) {
this._options.incidentOccurred("W2003")
}
} else {
return true
}
}
return false
},
_correctValue: function(valueTypeSelector, tickInterval, correctionMethod) {
var that = this,
correctionEnabledSelector = "_" + valueTypeSelector + "CorrectionEnabled",
spaceCorrectionSelector = valueTypeSelector + "SpaceCorrection",
valueSelector = "_" + valueTypeSelector,
minStickValue = that._options.minStickValue,
maxStickValue = that._options.maxStickValue;
if (that[correctionEnabledSelector]) {
if (that._options[spaceCorrectionSelector]) {
that[valueSelector] = that._getNextTickValue(that[valueSelector], tickInterval, "min" === valueTypeSelector)
}
correctionMethod.call(this, tickInterval)
}
if ("min" === valueTypeSelector) {
that[valueSelector] = that[valueSelector] < minStickValue ? minStickValue : that[valueSelector]
}
if ("max" === valueTypeSelector) {
that[valueSelector] = that[valueSelector] > maxStickValue ? maxStickValue : that[valueSelector]
}
},
_findTickInterval: function() {
var tickInterval, that = this,
options = that._options,
calculatedTickInterval = that._getInterval(),
userTickInterval = that._isTickIntervalValid(options.tickInterval) && that._isTickIntervalCorrect(options.tickInterval, TICKS_COUNT_LIMIT) && options.tickInterval;
tickInterval = that.checkUserTickInterval(userTickInterval, calculatedTickInterval);
if (that._isTickIntervalValid(tickInterval)) {
that._correctValue("min", tickInterval, that._correctMin);
that._correctValue("max", tickInterval, that._correctMax);
that._updateBusinessDelta()
}
that._tickInterval = tickInterval;
return tickInterval
},
_findMinorTickInterval: function(firstTick, secondTick) {
var that = this,
ticks = that._ticks,
intervals = that._options.stick ? ticks.length - 1 : ticks.length;
if (intervals < 1) {
intervals = 1
}
that._getMinorInterval(that._screenDelta / intervals, that._findBusinessDelta(firstTick, secondTick, false));
return that._minorTickInterval
},
_createMinorTicks: function(ticks, firstTick, secondTick) {
var that = this,
tickInterval = that._findMinorTickInterval(firstTick, secondTick),
isTickIntervalNegative = false,
isTickIntervalWithPow = false,
needCorrectTick = false,
startTick = that._getNextTickValue(firstTick, tickInterval, isTickIntervalNegative, isTickIntervalWithPow, needCorrectTick);
if (that._isTickIntervalValid(tickInterval)) {
ticks = that._createCountedTicks(ticks, tickInterval, startTick, secondTick, that._minorTickCount, isTickIntervalNegative, isTickIntervalWithPow, needCorrectTick)
}
return ticks
},
_calculateMinorTicks: function() {
var that = this,
options = that._options,
minorTicks = [],
ticks = that._ticks,
ticksLength = ticks.length,
hasUnitBeginningTick = that._hasUnitBeginningTickCorrection(),
i = hasUnitBeginningTick ? 1 : 0;
if (options.showMinorCalculatedTicks || !that._customMinorTicks) {
if (ticks.length) {
minorTicks = that._getBoundedMinorTicks(minorTicks, that._minBound, ticks[0], true);
if (hasUnitBeginningTick) {
minorTicks = that._getUnitBeginningMinorTicks(minorTicks)
}
for (i; i < ticksLength - 1; i++) {
minorTicks = that._createMinorTicks(minorTicks, ticks[i], ticks[i + 1])
}
minorTicks = that._getBoundedMinorTicks(minorTicks, that._maxBound, ticks[ticksLength - 1])
} else {
minorTicks = that._createMinorTicks(minorTicks, that._minBound, that._maxBound)
}
options.showMinorCalculatedTicks && (minorTicks = minorTicks.concat(that._customMinorTicks || []))
} else {
minorTicks = that._customMinorTicks
}
return minorTicks
},
_createCountedTicks: function(ticks, tickInterval, min, max, count, isTickIntervalWithPow, needMax) {
var i, value = min;
for (i = 0; i < count; i++) {
if (!(false === needMax && value.valueOf() === max.valueOf())) {
ticks.push(value)
}
value = this._getNextTickValue(value, tickInterval, false, isTickIntervalWithPow, false)
}
return ticks
},
_createTicks: function(ticks, tickInterval, min, max, isTickIntervalNegative, isTickIntervalWithPow, withCorrection) {
var leftBound, rightBound, boundedRule, that = this,
value = min,
newValue = min;
if (that._isTickIntervalValid(tickInterval)) {
boundedRule = min - max < 0;
do {
value = newValue;
if (that._options.stick) {
if (value >= that._originalMin && value <= that._originalMax) {
ticks.push(value)
}
} else {
ticks.push(value)
}
newValue = that._getNextTickValue(value, tickInterval, isTickIntervalNegative, isTickIntervalWithPow, withCorrection);
if (value.valueOf() === newValue.valueOf()) {
break
}
leftBound = newValue - min >= 0;
rightBound = max - newValue >= 0
} while (boundedRule === leftBound && boundedRule === rightBound)
} else {
ticks.push(value)
}
return ticks
},
_getBoundedMinorTicks: function(minorTicks, boundedTick, tick, isNegative) {
var startTick, endTick, that = this,
needCorrectTick = false,
nextTick = that._tickInterval ? this._getNextTickValue(tick, that._tickInterval, isNegative, true, needCorrectTick) : boundedTick,
tickInterval = that._findMinorTickInterval(tick, nextTick),
isTickIntervalCorrect = that._isTickIntervalCorrect(tickInterval, TICKS_COUNT_LIMIT, that._findBusinessDelta(tick, boundedTick, false)),
boundedTickValue = boundedTick.valueOf();
if (isTickIntervalCorrect && that._isTickIntervalValid(tickInterval) && that._minorTickCount > 0) {
if (isNegative) {
if (tick.valueOf() <= boundedTickValue) {
return minorTicks
}
while (nextTick.valueOf() < boundedTickValue) {
nextTick = this._getNextTickValue(nextTick, tickInterval, false, false, needCorrectTick)
}
startTick = nextTick;
endTick = that._getNextTickValue(tick, tickInterval, true, false, false)
} else {
startTick = that._getNextTickValue(tick, tickInterval, false, false, false);
endTick = boundedTick
}
minorTicks = that._createTicks(minorTicks, tickInterval, startTick, endTick, false, false, needCorrectTick)
}
return minorTicks
},
getTypes: function() {
return {
axisType: this._axisType,
dataType: this._dataType
}
},
getData: function() {
return {
min: this._min,
max: this._max,
customTicks: this._customTicks,
customMinorTicks: this._customMinorTicks,
screenDelta: this._screenDelta
}
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*************************************!*\
!*** ./Scripts/viz/axes/xy_axes.js ***!
\*************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
formatHelper = __webpack_require__( /*! ../../format_helper */ 68),
dateUtils = __webpack_require__( /*! ../../core/utils/date */ 12),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
vizUtils = __webpack_require__( /*! ../core/utils */ 6),
_isDefined = commonUtils.isDefined,
constants = __webpack_require__( /*! ./axes_constants */ 230),
_extend = $.extend,
CANVAS_POSITION_PREFIX = constants.canvasPositionPrefix,
TOP = constants.top,
BOTTOM = constants.bottom,
LEFT = constants.left,
RIGHT = constants.right,
CENTER = constants.center;
var dateSetters = {
millisecond: function(date) {
date.setMilliseconds(0)
},
second: function(date) {
date.setSeconds(0, 0)
},
minute: function(date) {
date.setMinutes(0, 0, 0)
},
hour: function(date) {
date.setHours(0, 0, 0, 0)
},
month: function(date) {
date.setMonth(0);
dateSetters.day(date)
},
quarter: function(date) {
date.setMonth(dateUtils.getFirstQuarterMonth(date.getMonth()));
dateSetters.day(date)
}
};
dateSetters.week = dateSetters.day = function(date) {
date.setDate(1);
dateSetters.hour(date)
};
function getMarkerDate(date, tickInterval) {
var markerDate = new Date(date.getTime()),
setter = dateSetters[tickInterval];
setter && setter(markerDate);
return markerDate
}
module.exports = {
linear: {
measureLabels: function() {
return this._tickManager.getMaxLabelParams()
},
getMarkerTrackers: function() {
return this._markerTrackers
},
_prepareDatesDifferences: function(datesDifferences, tickInterval) {
var dateUnitInterval, i;
if ("week" === tickInterval) {
tickInterval = "day"
}
if ("quarter" === tickInterval) {
tickInterval = "month"
}
if (datesDifferences[tickInterval]) {
for (i = 0; i < dateUtils.dateUnitIntervals.length; i++) {
dateUnitInterval = dateUtils.dateUnitIntervals[i];
if (datesDifferences[dateUnitInterval]) {
datesDifferences[dateUnitInterval] = false;
datesDifferences.count--
}
if (dateUnitInterval === tickInterval) {
break
}
}
}
},
_getSharpParam: function(opposite) {
return this._isHorizontal ^ opposite ? "h" : "v"
},
_createAxisElement: function() {
var axisCoord = this._axisPosition,
canvas = this._getCanvasStartEnd(),
points = this._isHorizontal ? [canvas.start, axisCoord, canvas.end, axisCoord] : [axisCoord, canvas.start, axisCoord, canvas.end];
return this._renderer.path(points, "line")
},
_getTranslatedCoord: function(value, offset) {
return this._translator.translate(value, offset)
},
_getCanvasStartEnd: function() {
return {
start: this._translator.translateSpecialCase(constants.canvasPositionStart),
end: this._translator.translateSpecialCase(constants.canvasPositionEnd)
}
},
_getScreenDelta: function() {
return Math.abs(this._translator.translateSpecialCase(constants.canvasPositionStart) - this._translator.translateSpecialCase(constants.canvasPositionEnd))
},
_initAxisPositions: function() {
var that = this,
position = that._options.position,
delta = 0;
if (that.delta) {
delta = that.delta[position] || 0
}
that._axisPosition = that._additionalTranslator.translateSpecialCase(CANVAS_POSITION_PREFIX + position) + delta
},
_getTickCoord: function(tick) {
var coords, corrections = {
top: -1,
middle: -.5,
bottom: 0,
left: -1,
center: -.5,
right: 0
},
tickCorrection = corrections[this._options.tickOrientation || "center"];
if (_isDefined(tick.posX) && _isDefined(tick.posY)) {
coords = {
x1: tick.posX,
y1: tick.posY + tickCorrection * tick.length,
x2: tick.posX,
y2: tick.posY + tickCorrection * tick.length + tick.length
}
} else {
coords = null
}
return coords
},
_drawTitle: function() {
var that = this,
options = that._options,
titleOptions = options.title,
attr = {
opacity: titleOptions.opacity,
align: CENTER
};
if (!titleOptions.text || !that._axisTitleGroup) {
return
}
that._title = that._renderer.text(titleOptions.text, 0, 0).css(vizUtils.patchFontOptions(titleOptions.font)).attr(attr).append(that._axisTitleGroup)
},
_drawDateMarker: function(dateMarker, options) {
var labelPosX, labelPosY, textElement, textSize, textIndent, pathElement, that = this,
markerOptions = that._options.marker;
if (null === options.x) {
return
}
if (!options.withoutStick) {
pathElement = that._renderer.path([options.x, options.y, options.x, options.y + markerOptions.separatorHeight], "line").attr({
"stroke-width": markerOptions.width,
stroke: markerOptions.color,
"stroke-opacity": markerOptions.opacity,
sharp: "h"
}).append(that._axisElementsGroup)
}
textElement = that._renderer.text(String(constants.formatLabel(dateMarker, options.labelFormat)), 0, 0).attr({
align: "left"
}).css(vizUtils.patchFontOptions(markerOptions.label.font)).append(that._axisElementsGroup);
textSize = textElement.getBBox();
textIndent = markerOptions.width + markerOptions.textLeftIndent;
labelPosX = this._translator.getBusinessRange().invert ? options.x - textIndent - textSize.width : options.x + textIndent;
labelPosY = options.y + markerOptions.textTopIndent + textSize.height / 2;
textElement.move(labelPosX, labelPosY);
return {
labelStartPosX: labelPosX,
labelEndPosX: labelPosX + textSize.width,
path: pathElement,
text: textElement,
date: dateMarker,
dateMarkerStartPosX: options.x
}
},
_disposeDateMarker: function(marker) {
marker.path && marker.path.dispose();
marker.path = null;
marker.text.dispose();
marker.text = null
},
_getDiff: function(currentValue, previousValue) {
var datesDifferences = dateUtils.getDatesDifferences(previousValue, currentValue);
this._prepareDatesDifferences(datesDifferences, this._dateUnitInterval);
return datesDifferences
},
_drawDateMarkers: function() {
var prevDateMarker, markersAreaTop, dateMarker, markerDate, diff, that = this,
options = that._options,
ticks = that._majorTicks,
boundaryTicks = that._boundaryTicks,
lastIndexOfBoundaryTicks = boundaryTicks.length - 1,
length = ticks.length,
dateMarkers = [],
i = 1;
boundaryTicks[0] && ticks[0].value > boundaryTicks[0].value && ticks.unshift(boundaryTicks[0]);
boundaryTicks[lastIndexOfBoundaryTicks] && ticks[length - 1].value < boundaryTicks[lastIndexOfBoundaryTicks].value && ticks.push(boundaryTicks[lastIndexOfBoundaryTicks]);
length = ticks.length;
if ("datetime" !== options.argumentType || "discrete" === options.type || length <= 1) {
return
}
markersAreaTop = that._axisPosition + this._axisElementsGroup.getBBox().height + options.label.indentFromAxis + options.marker.topIndent;
that._dateUnitInterval = dateUtils.getDateUnitInterval(this._tickManager.getTickInterval());
for (i; i < length; i++) {
diff = that._getDiff(ticks[i].value, ticks[i - 1].value);
if (diff.count > 0) {
markerDate = getMarkerDate(ticks[i].value, that._dateUnitInterval);
dateMarker = that._drawDateMarker(markerDate, {
x: that._translator.translate(markerDate),
y: markersAreaTop,
labelFormat: that._getLabelFormatOptions(formatHelper.getDateFormatByDifferences(diff))
});
if (dateMarker) {
if (that._checkMarkersPosition(dateMarker, prevDateMarker)) {
dateMarkers.push(dateMarker);
prevDateMarker = dateMarker
} else {
that._disposeDateMarker(dateMarker)
}
}
}
}
if (dateMarkers.length) {
dateMarker = that._drawDateMarker(ticks[0].value, {
x: that._translator.translate(ticks[0].value),
y: markersAreaTop,
labelFormat: that._getLabelFormatOptions(formatHelper.getDateFormatByDifferences(that._getDiff(ticks[0].value, dateMarkers[0].date))),
withoutStick: true
});
if (dateMarker) {
!that._checkMarkersPosition(dateMarker, dateMarkers[0]) && that._disposeDateMarker(dateMarker);
dateMarkers.unshift(dateMarker)
}
}
that._initializeMarkersTrackers(dateMarkers, that._axisElementsGroup, that._axisGroup.getBBox().width, markersAreaTop)
},
_initializeMarkersTrackers: function(dateMarkers, group, axisWidth, markersAreaTop) {
var markerTracker, nextMarker, i, x, currentMarker, that = this,
separatorHeight = that._options.marker.separatorHeight,
renderer = that._renderer,
length = dateMarkers.length,
businessRange = this._translator.getBusinessRange();
that._markerTrackers = [];
for (i = 0; i < length; i++) {
currentMarker = dateMarkers[i];
nextMarker = dateMarkers[i + 1] || {
dateMarkerStartPosX: businessRange.invert ? this._translator.translateSpecialCase("canvas_position_end") : axisWidth,
date: businessRange.max
};
x = currentMarker.dateMarkerStartPosX;
markerTracker = renderer.path([x, markersAreaTop, x, markersAreaTop + separatorHeight, nextMarker.dateMarkerStartPosX, markersAreaTop + separatorHeight, nextMarker.dateMarkerStartPosX, markersAreaTop, x, markersAreaTop]).attr({
"stroke-width": 1,
stroke: "grey",
fill: "grey",
"fill-opacity": 1e-4,
"stroke-opacity": 1e-4
}).append(group);
markerTracker.data("range", {
startValue: currentMarker.date,
endValue: nextMarker.date
});
that._markerTrackers.push(markerTracker)
}
},
_checkMarkersPosition: function(dateMarker, prevDateMarker) {
return void 0 === prevDateMarker || dateMarker.labelStartPosX > prevDateMarker.labelEndPosX || dateMarker.labelEndPosX < prevDateMarker.labelStartPosX
},
_getLabelFormatOptions: function(formatString) {
var that = this,
markerLabelOptions = that._markerLabelOptions;
if (!markerLabelOptions) {
that._markerLabelOptions = markerLabelOptions = _extend(true, {}, that._options.marker.label)
}
if (!_isDefined(that._options.marker.label.format)) {
markerLabelOptions.format = formatString
}
return markerLabelOptions
},
_adjustConstantLineLabels: function() {
var label, line, lineBox, linesOptions, labelOptions, box, x, y, i, paddingTopBottom, paddingLeftRight, labelVerticalAlignment, labelHorizontalAlignment, labelIsInside, labelHeight, labelWidth, that = this,
options = that._options,
isHorizontal = that._isHorizontal,
lines = that._constantLines,
labels = that._constantLineLabels,
padding = isHorizontal ? {
top: 0,
bottom: 0
} : {
left: 0,
right: 0
},
delta = 0;
if (void 0 === labels && void 0 === lines) {
return
}
for (i = 0; i < labels.length; i++) {
x = y = 0;
linesOptions = options.constantLines[i];
paddingTopBottom = linesOptions.paddingTopBottom;
paddingLeftRight = linesOptions.paddingLeftRight;
labelOptions = linesOptions.label;
labelVerticalAlignment = labelOptions.verticalAlignment;
labelHorizontalAlignment = labelOptions.horizontalAlignment;
labelIsInside = "inside" === labelOptions.position;
label = labels[i];
if (null !== label) {
line = lines[i];
box = label.getBBox();
lineBox = line.getBBox();
labelHeight = box.height;
labelWidth = box.width;
if (isHorizontal) {
if (labelIsInside) {
if (labelHorizontalAlignment === LEFT) {
x -= paddingLeftRight
} else {
x += paddingLeftRight
}
switch (labelVerticalAlignment) {
case CENTER:
y += lineBox.y + lineBox.height / 2 - box.y - labelHeight / 2;
break;
case BOTTOM:
y += lineBox.y + lineBox.height - box.y - labelHeight - paddingTopBottom;
break;
default:
y += lineBox.y - box.y + paddingTopBottom
}
} else {
if (labelVerticalAlignment === BOTTOM) {
delta = that.delta && that.delta[BOTTOM] || 0;
y += paddingTopBottom - box.y + that._additionalTranslator.translateSpecialCase(CANVAS_POSITION_PREFIX + BOTTOM) + delta;
if (padding[BOTTOM] < labelHeight + paddingTopBottom) {
padding[BOTTOM] = labelHeight + paddingTopBottom
}
} else {
delta = that.delta && that.delta[TOP] || 0;
y -= paddingTopBottom + box.y + labelHeight - that._additionalTranslator.translateSpecialCase(CANVAS_POSITION_PREFIX + TOP) - delta;
if (padding[TOP] < paddingTopBottom + labelHeight) {
padding[TOP] = paddingTopBottom + labelHeight
}
}
}
} else {
if (labelIsInside) {
switch (labelHorizontalAlignment) {
case CENTER:
x += lineBox.x + lineBox.width / 2 - box.x - labelWidth / 2;
break;
case RIGHT:
x -= paddingLeftRight;
break;
default:
x += paddingLeftRight
}
if (labelVerticalAlignment === BOTTOM) {
y += lineBox.y - box.y + paddingTopBottom
} else {
y += lineBox.y - box.y - labelHeight - paddingTopBottom
}
} else {
y += lineBox.y + lineBox.height / 2 - box.y - labelHeight / 2;
if (labelHorizontalAlignment === RIGHT) {
x += paddingLeftRight;
if (padding[RIGHT] < paddingLeftRight + labelWidth) {
padding[RIGHT] = paddingLeftRight + labelWidth
}
} else {
x -= paddingLeftRight;
if (padding[LEFT] < paddingLeftRight + labelWidth) {
padding[LEFT] = paddingLeftRight + labelWidth
}
}
}
}
label.move(x, y)
}
}
that.padding = padding
},
_checkAlignmentConstantLineLabels: function(labelOptions) {
var position = labelOptions.position,
verticalAlignment = (labelOptions.verticalAlignment || "").toLowerCase(),
horizontalAlignment = (labelOptions.horizontalAlignment || "").toLowerCase();
if (this._isHorizontal) {
if ("outside" === position) {
verticalAlignment = verticalAlignment === BOTTOM ? BOTTOM : TOP;
horizontalAlignment = CENTER
} else {
verticalAlignment = verticalAlignment === CENTER ? CENTER : verticalAlignment === BOTTOM ? BOTTOM : TOP;
horizontalAlignment = horizontalAlignment === LEFT ? LEFT : RIGHT
}
} else {
if ("outside" === position) {
verticalAlignment = CENTER;
horizontalAlignment = horizontalAlignment === LEFT ? LEFT : RIGHT
} else {
verticalAlignment = verticalAlignment === BOTTOM ? BOTTOM : TOP;
horizontalAlignment = horizontalAlignment === RIGHT ? RIGHT : horizontalAlignment === CENTER ? CENTER : LEFT
}
}
labelOptions.verticalAlignment = verticalAlignment;
labelOptions.horizontalAlignment = horizontalAlignment
},
_getConstantLineLabelsCoords: function(value, lineLabelOptions) {
var that = this,
additionalTranslator = that._additionalTranslator,
align = CENTER,
x = value,
y = value;
if (that._isHorizontal) {
y = additionalTranslator.translateSpecialCase(CANVAS_POSITION_PREFIX + lineLabelOptions.verticalAlignment)
} else {
x = additionalTranslator.translateSpecialCase(CANVAS_POSITION_PREFIX + lineLabelOptions.horizontalAlignment)
}
switch (lineLabelOptions.horizontalAlignment) {
case LEFT:
align = !that._isHorizontal && "inside" === lineLabelOptions.position ? LEFT : RIGHT;
break;
case CENTER:
align = CENTER;
break;
case RIGHT:
align = !that._isHorizontal && "inside" === lineLabelOptions.position ? RIGHT : LEFT
}
return {
x: x,
y: y,
align: align
}
},
_getAdjustedStripLabelCoords: function(stripOptions, label, rect) {
var x = 0,
y = 0,
horizontalAlignment = stripOptions.label.horizontalAlignment,
verticalAlignment = stripOptions.label.verticalAlignment,
box = label.getBBox(),
rectBox = rect.getBBox();
if (horizontalAlignment === LEFT) {
x += stripOptions.paddingLeftRight
} else {
if (horizontalAlignment === RIGHT) {
x -= stripOptions.paddingLeftRight
}
}
if (verticalAlignment === TOP) {
y += rectBox.y - box.y + stripOptions.paddingTopBottom
} else {
if (verticalAlignment === CENTER) {
y += rectBox.y + rectBox.height / 2 - box.y - box.height / 2
} else {
if (verticalAlignment === BOTTOM) {
y -= stripOptions.paddingTopBottom
}
}
}
return {
x: x,
y: y
}
},
_adjustTitle: function() {
var boxGroup, boxTitle, params, heightTitle, noLabels, that = this,
options = that._options,
position = options.position,
title = that._title,
margin = options.title.margin,
centerPosition = that._translator.translateSpecialCase(CANVAS_POSITION_PREFIX + CENTER),
axisElementsGroup = that._axisElementsGroup,
axisPosition = that._axisPosition;
if (!title || !axisElementsGroup) {
return
}
boxTitle = title.getBBox();
boxGroup = axisElementsGroup.getBBox();
noLabels = boxGroup.isEmpty;
heightTitle = boxTitle.height;
if (that._isHorizontal) {
if (position === BOTTOM) {
params = {
y: (noLabels ? axisPosition : boxGroup.y + boxGroup.height) - boxTitle.y + margin,
x: centerPosition
}
} else {
params = {
y: (noLabels ? axisPosition : boxGroup.y) - heightTitle - boxTitle.y - margin,
x: centerPosition
}
}
} else {
if (position === LEFT) {
params = {
x: (noLabels ? axisPosition : boxGroup.x) - heightTitle - boxTitle.y - margin,
y: centerPosition
}
} else {
params = {
x: (noLabels ? axisPosition : boxGroup.x + boxGroup.width) + heightTitle + boxTitle.y + margin,
y: centerPosition
}
}
params.rotate = options.position === LEFT ? 270 : 90
}
title.attr(params)
},
coordsIn: function(x, y) {
var rect = this.getBoundingRect();
return x >= rect.x && x <= rect.x + rect.width && y >= rect.y && y <= rect.y + rect.height
},
_boundaryTicksVisibility: {
min: true,
max: true
},
_getOverlappingBehaviorOptions: function() {
var that = this,
options = that._options,
getText = function() {
return ""
},
overlappingBehavior = options.label.overlappingBehavior ? _extend({}, options.label.overlappingBehavior) : null;
if (overlappingBehavior) {
if (!that._isHorizontal) {
overlappingBehavior.mode = constants.validateOverlappingMode(overlappingBehavior.mode)
}
if ("rotate" !== overlappingBehavior.mode) {
overlappingBehavior.rotationAngle = 0
}
}
if (!that._translator.getBusinessRange().stubData) {
getText = function(value, labelOptions) {
return constants.formatLabel(value, labelOptions, {
min: options.min,
max: options.max
})
}
}
return {
hasLabelFormat: that._hasLabelFormat,
labelOptions: options.label,
isMarkersVisible: "discrete" === options.type ? false : options.marker.visible,
overlappingBehavior: overlappingBehavior,
isHorizontal: that._isHorizontal,
textOptions: that._textOptions,
textFontStyles: that._textFontStyles,
textSpacing: options.label.minSpacing,
getText: getText,
renderText: function(text, x, y, options) {
return that._renderer.text(text, x, y, options).append(that._renderer.root)
},
translate: function(value, useAdditionalTranslator) {
return useAdditionalTranslator ? that._additionalTranslator.translate(value) : that._translator.translate(value)
},
addMinMax: options.showCustomBoundaryTicks ? that._boundaryTicksVisibility : void 0
}
},
_getMinMax: function() {
return {
min: this._options.min,
max: this._options.max
}
},
_getStick: function() {
return !this._options.valueMarginsEnabled
},
_getStripLabelCoords: function(stripLabelOptions, stripFrom, stripTo) {
var x, y, that = this,
additionalTranslator = that._additionalTranslator,
isHorizontal = that._isHorizontal,
align = isHorizontal ? CENTER : LEFT;
if (isHorizontal) {
if (stripLabelOptions.horizontalAlignment === CENTER) {
x = stripFrom + (stripTo - stripFrom) / 2;
align = CENTER
} else {
if (stripLabelOptions.horizontalAlignment === LEFT) {
x = stripFrom;
align = LEFT
} else {
if (stripLabelOptions.horizontalAlignment === RIGHT) {
x = stripTo;
align = RIGHT
}
}
}
y = additionalTranslator.translateSpecialCase(CANVAS_POSITION_PREFIX + stripLabelOptions.verticalAlignment)
} else {
x = additionalTranslator.translateSpecialCase(CANVAS_POSITION_PREFIX + stripLabelOptions.horizontalAlignment);
align = stripLabelOptions.horizontalAlignment;
if (stripLabelOptions.verticalAlignment === TOP) {
y = stripFrom
} else {
if (stripLabelOptions.verticalAlignment === CENTER) {
y = stripTo + (stripFrom - stripTo) / 2
} else {
if (stripLabelOptions.verticalAlignment === BOTTOM) {
y = stripTo
}
}
}
}
return {
x: x,
y: y,
align: align
}
},
_getTranslatedValue: function(value, y, offset) {
return {
x: this._translator.translate(value, offset, "semidiscrete" === this._options.type && this._options.tickInterval),
y: y
}
},
_getSkippedCategory: function() {
var skippedCategory, categories = this._translator.getVisibleCategories() || this._translator.getBusinessRange().categories;
if (categories && categories.length && !!this._tickOffset) {
skippedCategory = categories[categories.length - 1]
}
return skippedCategory
},
_getSpiderCategoryOption: $.noop
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************************!*\
!*** ./Scripts/viz/chart_components/advanced_chart.js ***!
\********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
rangeModule = __webpack_require__( /*! ../translators/range */ 89),
dateUtils = __webpack_require__( /*! ../../core/utils/date */ 12),
DEFAULT_AXIS_NAME = "defaultAxisName",
axisModule = __webpack_require__( /*! ../axes/base_axis */ 231),
seriesFamilyModule = __webpack_require__( /*! ../core/series_family */ 331),
BaseChart = __webpack_require__( /*! ./base_chart */ 232).BaseChart,
_isArray = commonUtils.isArray,
_isDefined = commonUtils.isDefined,
_each = $.each,
_noop = $.noop,
_extend = $.extend,
vizUtils = __webpack_require__( /*! ../core/utils */ 6),
_map = vizUtils.map,
MIN = "min",
MAX = "max";
function prepareAxis(axisOptions) {
return _isArray(axisOptions) ? 0 === axisOptions.length ? [{}] : axisOptions : [axisOptions]
}
function prepareVisibleArea(visibleArea, aggregationRange, axisRange, argRange) {
visibleArea.minVal = axisRange.min;
visibleArea.maxVal = axisRange.max;
visibleArea.minArg = !_isDefined(visibleArea.minArg) ? _isDefined(argRange.minVisible) ? argRange.minVisible : aggregationRange.arg.min : visibleArea.minArg;
visibleArea.maxArg = !_isDefined(visibleArea.maxArg) ? _isDefined(argRange.maxVisible) ? argRange.maxVisible : aggregationRange.arg.max : visibleArea.maxArg
}
var AdvancedChart = BaseChart.inherit({
_dispose: function() {
var that = this,
disposeObjectsInArray = this._disposeObjectsInArray;
that.callBase();
that.panes = null;
if (that._legend) {
that._legend.dispose();
that._legend = null
}
disposeObjectsInArray.call(that, "panesBackground");
disposeObjectsInArray.call(that, "seriesFamilies");
that._disposeAxes()
},
_reinitAxes: function() {
this.translators = {};
this.panes = this._createPanes();
this._populateAxes()
},
_populateAxes: function() {
var argumentAxes, paneWithNonVirtualAxis, that = this,
valueAxes = [],
panes = that.panes,
rotated = that._isRotated(),
valueAxisOptions = that.option("valueAxis") || {},
argumentOption = that.option("argumentAxis") || {},
argumentAxesOptions = prepareAxis(argumentOption)[0],
valueAxesOptions = prepareAxis(valueAxisOptions),
axisNames = [],
valueAxesCounter = 0,
crosshairOptions = that._getCrosshairOptions() || {},
crosshairEnabled = crosshairOptions.enabled,
horCrosshairEnabled = crosshairEnabled && crosshairOptions.horizontalLine.visible,
verCrosshairEnabled = crosshairEnabled && crosshairOptions.verticalLine.visible;
function getNextAxisName() {
return DEFAULT_AXIS_NAME + valueAxesCounter++
}
that._disposeAxes();
if (rotated) {
paneWithNonVirtualAxis = "right" === argumentAxesOptions.position ? panes[panes.length - 1].name : panes[0].name
} else {
paneWithNonVirtualAxis = "top" === argumentAxesOptions.position ? panes[0].name : panes[panes.length - 1].name
}
argumentAxes = _map(panes, function(pane, index) {
return that._createAxis("argumentAxis", argumentAxesOptions, {
pane: pane.name,
crosshairEnabled: rotated ? horCrosshairEnabled : verCrosshairEnabled
}, rotated, pane.name !== paneWithNonVirtualAxis, index)
});
_each(valueAxesOptions, function(priority, axisOptions) {
var axisPanes = [],
name = axisOptions.name;
if (name && -1 !== $.inArray(name, axisNames)) {
that._incidentOccurred("E2102");
return
}
name && axisNames.push(name);
if (axisOptions.pane) {
axisPanes.push(axisOptions.pane)
}
if (axisOptions.panes && axisOptions.panes.length) {
axisPanes = axisPanes.concat(axisOptions.panes.slice(0))
}
axisPanes = vizUtils.unique(axisPanes);
if (!axisPanes.length) {
axisPanes.push(void 0)
}
_each(axisPanes, function(_, pane) {
valueAxes.push(that._createAxis("valueAxis", axisOptions, {
name: name || getNextAxisName(),
pane: pane,
priority: priority,
crosshairEnabled: rotated ? verCrosshairEnabled : horCrosshairEnabled
}, rotated))
})
});
that._valueAxes = valueAxes;
that._argumentAxes = argumentAxes
},
_prepareStackPoints: function(singleSeries, stackPoints) {
var points = singleSeries.getPoints(),
stackName = singleSeries.getStackName();
_each(points, function(_, point) {
var argument = point.argument;
if (!stackPoints[argument]) {
stackPoints[argument] = {};
stackPoints[argument][null] = []
}
if (stackName && !_isArray(stackPoints[argument][stackName])) {
stackPoints[argument][stackName] = [];
_each(stackPoints[argument][null], function(_, point) {
if (!point.stackName) {
stackPoints[argument][stackName].push(point)
}
})
}
if (stackName) {
stackPoints[argument][stackName].push(point);
stackPoints[argument][null].push(point)
} else {
_each(stackPoints[argument], function(_, stack) {
stack.push(point)
})
}
point.stackPoints = stackPoints[argument][stackName];
point.stackName = stackName
})
},
_resetStackPoints: function(singleSeries) {
_each(singleSeries.getPoints(), function(_, point) {
point.stackPoints = null;
point.stackName = null
})
},
_disposeAxes: function() {
var that = this,
disposeObjectsInArray = that._disposeObjectsInArray;
disposeObjectsInArray.call(that, "_argumentAxes");
disposeObjectsInArray.call(that, "_valueAxes")
},
_drawAxes: function(panesBorderOptions, drawOptions, adjustUnits) {
var that = this,
drawAxes = function(axes) {
_each(axes, function(_, axis) {
axis.draw(adjustUnits)
})
},
drawStaticAxisElements = function(axes) {
_each(axes, function(_i, axis) {
axis.drawGrids(panesBorderOptions[axis.pane])
})
};
that._restoreOriginalBusinessRange();
that._reinitTranslators();
that._prepareAxesAndDraw(drawAxes, drawStaticAxisElements, drawOptions)
},
_restoreOriginalBusinessRange: _noop,
_appendAdditionalSeriesGroups: function() {
this._crosshairCursorGroup.linkAppend();
this._scrollBar && this._scrollBarGroup.linkAppend()
},
_getLegendTargets: function() {
var that = this;
return _map(that.series, function(item) {
if (item.getOptions().showInLegend) {
return that._getLegendOptions(item)
}
return null
})
},
_legendItemTextField: "name",
_seriesPopulatedHandlerCore: function() {
this._processSeriesFamilies();
this._processValueAxisFormat()
},
_renderTrackers: function() {
var i, that = this;
for (i = 0; i < that.series.length; ++i) {
that.series[i].drawTrackers()
}
},
_specialProcessSeries: function() {
this._processSeriesFamilies()
},
_processSeriesFamilies: function() {
var paneSeries, that = this,
types = [],
families = [],
themeManager = that._themeManager,
negativesAsZeroes = themeManager.getOptions("negativesAsZeroes"),
negativesAsZeros = themeManager.getOptions("negativesAsZeros"),
familyOptions = {
equalBarWidth: themeManager.getOptions("equalBarWidth"),
minBubbleSize: themeManager.getOptions("minBubbleSize"),
maxBubbleSize: themeManager.getOptions("maxBubbleSize"),
barWidth: themeManager.getOptions("barWidth"),
negativesAsZeroes: _isDefined(negativesAsZeroes) ? negativesAsZeroes : negativesAsZeros
};
if (that.seriesFamilies && that.seriesFamilies.length) {
_each(that.seriesFamilies, function(_, family) {
family.updateOptions(familyOptions);
family.adjustSeriesValues()
});
return
}
_each(that.series, function(_, item) {
if (-1 === $.inArray(item.type, types)) {
types.push(item.type)
}
});
_each(that._getLayoutTargets(), function(_, pane) {
paneSeries = that._getSeriesForPane(pane.name);
_each(types, function(_, type) {
var family = new seriesFamilyModule.SeriesFamily({
type: type,
pane: pane.name,
equalBarWidth: familyOptions.equalBarWidth,
minBubbleSize: familyOptions.minBubbleSize,
maxBubbleSize: familyOptions.maxBubbleSize,
barWidth: familyOptions.barWidth,
negativesAsZeroes: familyOptions.negativesAsZeroes,
rotated: that._isRotated()
});
family.add(paneSeries);
family.adjustSeriesValues();
families.push(family)
})
});
that.seriesFamilies = families
},
_updateSeriesDimensions: function() {
var i, that = this,
seriesFamilies = that.seriesFamilies || [];
for (i = 0; i < seriesFamilies.length; i++) {
var family = seriesFamilies[i],
translators = that._getTranslator(family.pane) || {};
family.updateSeriesValues(translators);
family.adjustSeriesDimensions(translators)
}
},
_getLegendCallBack: function(series) {
return this._legend && this._legend.getActionCallback(series)
},
_appendAxesGroups: function() {
var that = this;
that._stripsGroup.linkAppend();
that._gridGroup.linkAppend();
that._axesGroup.linkAppend();
that._constantLinesGroup.linkAppend();
that._labelAxesGroup.linkAppend()
},
_populateBusinessRange: function(visibleArea) {
var argBusinessRange, that = this,
businessRanges = [],
rotated = that._isRotated(),
argAxes = that._argumentAxes,
lastArgAxis = argAxes[argAxes.length - 1],
calcInterval = lastArgAxis.calcInterval,
argRange = new rangeModule.Range({
rotated: !!rotated
}),
groupsData = that._groupsData;
that.businessRanges = null;
_each(argAxes, function(_, axis) {
argRange.addRange(axis.getRangeData())
});
_each(groupsData.groups, function(_, group) {
var groupRange = new rangeModule.Range({
rotated: !!rotated,
pane: group.valueAxis.pane,
axis: group.valueAxis.name
}),
groupAxisRange = group.valueAxis.getRangeData();
groupRange.addRange(groupAxisRange);
_each(group.series, function(_, series) {
visibleArea && prepareVisibleArea(visibleArea, series.getRangeData(), groupAxisRange, argRange);
var seriesRange = series.getRangeData(visibleArea, calcInterval);
groupRange.addRange(seriesRange.val);
argRange.addRange(seriesRange.arg)
});
if (!groupRange.isDefined()) {
groupRange.setStubData(group.valueAxis.getOptions().valueType)
}
if (group.valueAxis.getOptions().showZero) {
groupRange.correctValueZeroLevel()
}
groupRange.checkZeroStick();
businessRanges.push({
val: groupRange,
arg: argRange
})
});
argRange.addRange({
categories: groupsData.categories
});
if (!argRange.isDefined()) {
argRange.setStubData(argAxes[0].getOptions().argumentType)
}
if (visibleArea && visibleArea.notApplyMargins && "discrete" !== argRange.axisType) {
argBusinessRange = argAxes[0].getTranslator().getBusinessRange();
argRange.addRange({
min: argBusinessRange.min,
max: argBusinessRange.max,
stick: true
})
}
that._correctBusinessRange(argRange, lastArgAxis);
that.businessRanges = businessRanges
},
_correctBusinessRange: function(range, lastArgAxis) {
var setTicksAtUnitBeginning = lastArgAxis.getOptions().setTicksAtUnitBeginning,
tickIntervalRange = {},
tickInterval = lastArgAxis.getOptions().tickInterval,
originInterval = tickInterval;
tickInterval = $.isNumeric(tickInterval) ? tickInterval : dateUtils.dateToMilliseconds(tickInterval);
if (tickInterval && _isDefined(range[MIN]) && _isDefined(range[MAX]) && tickInterval >= Math.abs(range[MAX] - range[MIN])) {
if (commonUtils.isDate(range[MIN])) {
if (!$.isNumeric(originInterval)) {
tickIntervalRange[MIN] = dateUtils.addInterval(range[MIN], originInterval, true);
tickIntervalRange[MAX] = dateUtils.addInterval(range[MAX], originInterval, false)
} else {
tickIntervalRange[MIN] = new Date(range[MIN].valueOf() - tickInterval);
tickIntervalRange[MAX] = new Date(range[MAX].valueOf() + tickInterval)
}
if (setTicksAtUnitBeginning) {
dateUtils.correctDateWithUnitBeginning(tickIntervalRange[MAX], originInterval);
dateUtils.correctDateWithUnitBeginning(tickIntervalRange[MIN], originInterval)
}
} else {
tickIntervalRange[MIN] = range[MIN] - tickInterval;
tickIntervalRange[MAX] = range[MAX] + tickInterval
}
range.addRange(tickIntervalRange)
}
},
_getArgumentAxes: function() {
return this._argumentAxes
},
_getValueAxes: function() {
return this._valueAxes
},
_processValueAxisFormat: function() {
var that = this,
valueAxes = that._valueAxes,
axesWithFullStackedFormat = [];
_each(that.series, function() {
if (this.isFullStackedSeries() && -1 === $.inArray(this.axis, axesWithFullStackedFormat)) {
axesWithFullStackedFormat.push(this.axis)
}
});
_each(valueAxes, function() {
if (-1 !== $.inArray(this.name, axesWithFullStackedFormat)) {
this.setPercentLabelFormat()
} else {
this.resetAutoLabelFormat()
}
})
},
_createAxis: function(typeSelector, userOptions, axisOptions, rotated, virtual, index) {
var axis, that = this,
renderingSettings = _extend({
renderer: that._renderer,
incidentOccurred: that._incidentOccurred,
axisClass: "argumentAxis" === typeSelector ? "arg" : "val",
widgetClass: "dxc",
stripsGroup: that._stripsGroup,
labelAxesGroup: that._labelAxesGroup,
constantLinesGroup: that._constantLinesGroup,
axesContainerGroup: that._axesGroup,
gridGroup: that._gridGroup
}, that._getAxisRenderingOptions(typeSelector)),
preparedUserOptions = that._prepareStripsAndConstantLines(typeSelector, userOptions, rotated),
options = _extend(true, {}, preparedUserOptions, axisOptions, that._prepareAxisOptions(typeSelector, preparedUserOptions, rotated));
if (virtual) {
options.visible = options.tick.visible = options.minorTick.visible = options.label.visible = false;
options.title = {}
}
axis = new axisModule.Axis(renderingSettings);
axis.updateOptions(options);
if (!virtual && _isDefined(index)) {
that._displayedArgumentAxisIndex = index
}
return axis
},
_getTrackerSettings: function() {
return _extend(this.callBase(), {
argumentAxis: this._argumentAxes[this._displayedArgumentAxisIndex]
})
},
_prepareStripsAndConstantLines: function(typeSelector, userOptions, rotated) {
userOptions = this._themeManager.getOptions(typeSelector, userOptions, rotated);
if (userOptions.strips) {
_each(userOptions.strips, function(i) {
userOptions.strips[i] = _extend(true, {}, userOptions.stripStyle, userOptions.strips[i])
})
}
if (userOptions.constantLines) {
_each(userOptions.constantLines, function(i, line) {
userOptions.constantLines[i] = _extend(true, {}, userOptions.constantLineStyle, line)
})
}
return userOptions
},
_legendDataField: "series",
_getStoredSeries: function() {
return this.series
},
_adjustSeries: _noop,
_collectPointsByArg: _noop
});
exports.AdvancedChart = AdvancedChart
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************************!*\
!*** ./Scripts/viz/chart_components/layout_manager.js ***!
\********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
layoutElementModule = __webpack_require__( /*! ../core/layout_element */ 190),
_isNumber = commonUtils.isNumber,
_min = Math.min,
_max = Math.max,
_floor = Math.floor,
_sqrt = Math.sqrt,
_each = $.each,
_extend = $.extend,
consts = __webpack_require__( /*! ../components/consts */ 126),
pieLabelIndent = consts.pieLabelIndent,
pieLabelSpacing = consts.pieLabelSpacing;
function updateAxis(axes, side, needRemoveSpace) {
if (axes && needRemoveSpace[side] > 0) {
_each(axes, function(i, axis) {
var bbox = axis.getBoundingRect();
axis.updateSize();
needRemoveSpace[side] -= bbox[side] - axis.getBoundingRect()[side]
});
if (needRemoveSpace[side] > 0) {
_each(axes, function(_, axis) {
axis.updateSize(true)
})
}
}
}
function getNearestCoord(firstCoord, secondCoord, pointCenterCoord) {
var nearestCoord;
if (pointCenterCoord < firstCoord) {
nearestCoord = firstCoord
} else {
if (secondCoord < pointCenterCoord) {
nearestCoord = secondCoord
} else {
nearestCoord = pointCenterCoord
}
}
return nearestCoord
}
function getLabelLayout(point) {
if (point._label.isVisible() && "inside" !== point._label.getLayoutOptions().position) {
return point._label.getBoundingRect()
}
}
function getPieRadius(series, paneCenterX, paneCenterY, accessibleRadius, minR) {
var radiusIsFound = false;
_each(series, function(_, singleSeries) {
if (radiusIsFound) {
return false
}
_each(singleSeries.getVisiblePoints(), function(_, point) {
var labelBBox = getLabelLayout(point);
if (labelBBox) {
var xCoords = getNearestCoord(labelBBox.x, labelBBox.x + labelBBox.width, paneCenterX),
yCoords = getNearestCoord(labelBBox.y, labelBBox.y + labelBBox.height, paneCenterY);
accessibleRadius = _min(_max(getLengthFromCenter(xCoords, yCoords, paneCenterX, paneCenterY) - pieLabelIndent, minR), accessibleRadius);
radiusIsFound = true
}
})
});
return accessibleRadius
}
function getSizeLabels(series) {
var sizes = [],
commonWidth = 0;
_each(series, function(_, singleSeries) {
var maxWidth = 0;
_each(singleSeries.getVisiblePoints(), function(_, point) {
var labelBBox = getLabelLayout(point);
if (labelBBox) {
maxWidth = _max(labelBBox.width + pieLabelSpacing, maxWidth)
}
});
sizes.push(maxWidth);
commonWidth += maxWidth
});
return {
sizes: sizes,
common: commonWidth
}
}
function correctLabelRadius(sizes, radius, series, canvas, averageWidthLabels) {
var curRadius, i, centerX = (canvas.width - canvas.left - canvas.right) / 2;
for (i = 0; i < series.length; i++) {
if (0 === sizes[i]) {
curRadius && (curRadius += sizes[i - 1]);
continue
}
curRadius = _floor(curRadius ? curRadius + sizes[i - 1] : radius);
series[i].correctLabelRadius(curRadius);
if (averageWidthLabels && i !== series.length - 1) {
sizes[i] = averageWidthLabels;
series[i].setVisibleArea({
left: centerX - radius - averageWidthLabels * (i + 1),
right: canvas.width - (centerX + radius + averageWidthLabels * (i + 1)),
top: canvas.top,
bottom: canvas.bottom,
width: canvas.width,
height: canvas.height
})
}
}
}
function getLengthFromCenter(x, y, paneCenterX, paneCenterY) {
return _sqrt((x - paneCenterX) * (x - paneCenterX) + (y - paneCenterY) * (y - paneCenterY))
}
function getInnerRadius(series) {
var innerRadius;
if ("pie" === series.type) {
innerRadius = 0
} else {
innerRadius = _isNumber(series.innerRadius) ? Number(series.innerRadius) : .5;
innerRadius = innerRadius < .2 ? .2 : innerRadius;
innerRadius = innerRadius > .8 ? .8 : innerRadius
}
return innerRadius
}
function isValidBox(box) {
return !!(box.x || box.y || box.width || box.height)
}
function correctDeltaMarginValue(panes, marginSides) {
var canvas, deltaSide, requireAxesRedraw = false;
_each(panes, function(_, pane) {
canvas = pane.canvas;
_each(marginSides, function(_, side) {
deltaSide = "delta" + side;
canvas[deltaSide] = _max(canvas[deltaSide] - (canvas[side.toLowerCase()] - canvas["original" + side]), 0);
if (canvas[deltaSide] > 0) {
requireAxesRedraw = true
}
})
});
return requireAxesRedraw
}
function getPane(name, panes) {
var findPane = panes[0];
_each(panes, function(_, pane) {
if (name === pane.name) {
findPane = pane
}
});
return findPane
}
function applyFoundExceedings(panes, rotated) {
var stopDrawAxes = false,
maxLeft = 0,
maxRight = 0,
maxTop = 0,
maxBottom = 0;
_each(panes, function(_, pane) {
maxLeft = _max(maxLeft, pane.canvas.deltaLeft);
maxRight = _max(maxRight, pane.canvas.deltaRight);
maxTop = _max(maxTop, pane.canvas.deltaTop);
maxBottom = _max(maxBottom, pane.canvas.deltaBottom)
});
if (rotated) {
_each(panes, function(_, pane) {
pane.canvas.top += maxTop;
pane.canvas.bottom += maxBottom;
pane.canvas.right += pane.canvas.deltaRight;
pane.canvas.left += pane.canvas.deltaLeft
})
} else {
_each(panes, function(_, pane) {
pane.canvas.top += pane.canvas.deltaTop;
pane.canvas.bottom += pane.canvas.deltaBottom;
pane.canvas.right += maxRight;
pane.canvas.left += maxLeft
})
}
_each(panes, function(_, pane) {
if (pane.canvas.top + pane.canvas.bottom > pane.canvas.height) {
stopDrawAxes = true
}
if (pane.canvas.left + pane.canvas.right > pane.canvas.width) {
stopDrawAxes = true
}
});
return stopDrawAxes
}
var inverseAlign = {
left: "right",
right: "left",
top: "bottom",
bottom: "top",
center: "center"
};
function downSize(canvas, layoutOptions) {
canvas[layoutOptions.cutLayoutSide] += "horizontal" === layoutOptions.cutSide ? layoutOptions.width : layoutOptions.height
}
function getOffset(layoutOptions, offsets) {
var side = layoutOptions.cutLayoutSide,
offset = {
horizontal: 0,
vertical: 0
};
switch (side) {
case "top":
case "left":
offset[layoutOptions.cutSide] = -offsets[side];
break;
case "bottom":
case "right":
offset[layoutOptions.cutSide] = offsets[side]
}
return offset
}
function LayoutManager() {}
function toLayoutElementCoords(canvas) {
return new layoutElementModule.WrapperLayoutElement(null, {
x: canvas.left,
y: canvas.top,
width: canvas.width - canvas.left - canvas.right,
height: canvas.height - canvas.top - canvas.bottom
})
}
LayoutManager.prototype = {
constructor: LayoutManager,
setOptions: function(options) {
this._options = options
},
applyVerticalAxesLayout: function(axes, panes, rotated) {
this._applyAxesLayout(axes, panes, rotated)
},
applyHorizontalAxesLayout: function(axes, panes, rotated) {
axes.reverse();
this._applyAxesLayout(axes, panes, rotated);
axes.reverse()
},
_applyAxesLayout: function(axes, panes, rotated) {
var canvas, axisPosition, box, delta, axis, axisLength, direction, directionMultiplier, pane, i, that = this,
someDirection = [];
_each(panes, function(_, pane) {
_extend(pane.canvas, {
deltaLeft: 0,
deltaRight: 0,
deltaTop: 0,
deltaBottom: 0
})
});
for (i = 0; i < axes.length; i++) {
axis = axes[i];
axisPosition = axis.getOptions().position || "left";
axis.delta = {};
box = axis.getBoundingRect();
pane = getPane(axis.pane, panes);
canvas = pane.canvas;
if (!isValidBox(box)) {
continue
}
direction = "delta" + axisPosition.slice(0, 1).toUpperCase() + axisPosition.slice(1);
switch (axisPosition) {
case "right":
directionMultiplier = 1;
canvas.deltaLeft += axis.padding ? axis.padding.left : 0;
break;
case "left":
directionMultiplier = -1;
canvas.deltaRight += axis.padding ? axis.padding.right : 0;
break;
case "top":
directionMultiplier = -1;
canvas.deltaBottom += axis.padding ? axis.padding.bottom : 0;
break;
case "bottom":
directionMultiplier = 1;
canvas.deltaTop += axis.padding ? axis.padding.top : 0
}
switch (axisPosition) {
case "right":
case "left":
if (!box.isEmpty) {
delta = box.y + box.height - (canvas.height - canvas.originalBottom);
if (delta > 0) {
that.requireAxesRedraw = true;
canvas.deltaBottom += delta
}
delta = canvas.originalTop - box.y;
if (delta > 0) {
that.requireAxesRedraw = true;
canvas.deltaTop += delta
}
}
axisLength = box.width;
someDirection = ["Left", "Right"];
break;
case "top":
case "bottom":
if (!box.isEmpty) {
delta = box.x + box.width - (canvas.width - canvas.originalRight);
if (delta > 0) {
that.requireAxesRedraw = true;
canvas.deltaRight += delta
}
delta = canvas.originalLeft - box.x;
if (delta > 0) {
that.requireAxesRedraw = true;
canvas.deltaLeft += delta
}
}
someDirection = ["Bottom", "Top"];
axisLength = box.height
}
if (!axis.delta[axisPosition] && canvas[direction] > 0) {
canvas[direction] += axis.getMultipleAxesSpacing()
}
axis.delta[axisPosition] = axis.delta[axisPosition] || 0;
axis.delta[axisPosition] += canvas[direction] * directionMultiplier;
canvas[direction] += axisLength
}
that.requireAxesRedraw = correctDeltaMarginValue(panes, someDirection) || that.requireAxesRedraw;
that.stopDrawAxes = applyFoundExceedings(panes, rotated)
},
applyPieChartSeriesLayout: function(canvas, series, hideLayoutLabels) {
var sizeLabels, averageWidthLabels, fullRadiusWithLabels, paneSpaceHeight = canvas.height - canvas.top - canvas.bottom,
paneSpaceWidth = canvas.width - canvas.left - canvas.right,
paneCenterX = paneSpaceWidth / 2 + canvas.left,
paneCenterY = paneSpaceHeight / 2 + canvas.top,
piePercentage = this._options.piePercentage,
accessibleRadius = _isNumber(piePercentage) ? piePercentage * _min(canvas.height, canvas.width) / 2 : _min(paneSpaceWidth, paneSpaceHeight) / 2,
minR = .7 * accessibleRadius,
countSeriesWithOuterLabels = 0,
innerRadius = getInnerRadius(series[0]);
if (!hideLayoutLabels && !_isNumber(piePercentage)) {
sizeLabels = getSizeLabels(series);
fullRadiusWithLabels = paneCenterX - sizeLabels.common + canvas.left;
if (fullRadiusWithLabels < minR) {
accessibleRadius = minR;
_each(sizeLabels.sizes, function(_, size) {
0 !== size && countSeriesWithOuterLabels++
});
averageWidthLabels = (paneCenterX - accessibleRadius - canvas.left) / countSeriesWithOuterLabels
} else {
accessibleRadius = _min(getPieRadius(series, paneCenterX, paneCenterY, accessibleRadius, minR), fullRadiusWithLabels)
}
correctLabelRadius(sizeLabels.sizes, accessibleRadius, series, canvas, averageWidthLabels)
}
return {
centerX: _floor(paneCenterX),
centerY: _floor(paneCenterY),
radiusInner: _floor(accessibleRadius * innerRadius),
radiusOuter: _floor(accessibleRadius),
canvas: canvas
}
},
needMoreSpaceForPanesCanvas: function(panes, rotated) {
var options = this._options,
width = options.width,
height = options.height,
piePercentage = options.piePercentage,
percentageIsValid = _isNumber(piePercentage),
needHorizontalSpace = 0,
needVerticalSpace = 0;
_each(panes, function(_, pane) {
var paneCanvas = pane.canvas,
minSize = percentageIsValid ? _min(paneCanvas.width, paneCanvas.height) * piePercentage : void 0,
needPaneHorizontalSpace = (percentageIsValid ? minSize : width) - (paneCanvas.width - paneCanvas.left - paneCanvas.right),
needPaneVerticalSpace = (percentageIsValid ? minSize : height) - (paneCanvas.height - paneCanvas.top - paneCanvas.bottom);
if (rotated) {
needHorizontalSpace += needPaneHorizontalSpace > 0 ? needPaneHorizontalSpace : 0;
needVerticalSpace = _max(needPaneVerticalSpace > 0 ? needPaneVerticalSpace : 0, needVerticalSpace)
} else {
needHorizontalSpace = _max(needPaneHorizontalSpace > 0 ? needPaneHorizontalSpace : 0, needHorizontalSpace);
needVerticalSpace += needPaneVerticalSpace > 0 ? needPaneVerticalSpace : 0
}
});
return needHorizontalSpace > 0 || needVerticalSpace > 0 ? {
width: needHorizontalSpace,
height: needVerticalSpace
} : false
},
layoutElements: function(elements, canvas, funcAxisDrawer, panes, rotated, axes) {
this._elements = elements;
this._probeDrawing(canvas);
this._drawElements(canvas);
funcAxisDrawer && funcAxisDrawer();
this._processAdaptiveLayout(panes, rotated, canvas, axes, funcAxisDrawer);
this._positionElements(canvas)
},
_processAdaptiveLayout: function(panes, rotated, canvas, axes, funcAxisDrawer) {
var that = this,
size = that.needMoreSpaceForPanesCanvas(panes, rotated),
items = this._elements;
if (!size) {
return
}
function processCanvases(item, layoutOptions, side) {
if (!item.getLayoutOptions()[side]) {
canvas[layoutOptions.cutLayoutSide] -= layoutOptions[side];
size[side] = Math.max(size[side] - layoutOptions[side], 0)
}
}
$.each(items.slice().reverse(), function(_, item) {
var sizeObject, layoutOptions = _extend({}, item.getLayoutOptions());
if (!layoutOptions) {
return
}
sizeObject = $.extend({}, layoutOptions);
if ("vertical" === layoutOptions.cutSide && size.height) {
item.draw(sizeObject.width, sizeObject.height - size.height);
processCanvases(item, layoutOptions, "height")
}
if ("horizontal" === layoutOptions.cutSide && size.width) {
item.draw(sizeObject.width - size.width, sizeObject.height);
processCanvases(item, layoutOptions, "width")
}
});
updateAxis(axes.verticalAxes, "width", size);
updateAxis(axes.horizontalAxes, "height", size);
funcAxisDrawer && funcAxisDrawer(true)
},
_probeDrawing: function(canvas) {
var that = this;
$.each(this._elements, function(_, item) {
var sizeObject, layoutOptions = item.getLayoutOptions();
if (!layoutOptions) {
return
}
sizeObject = {
width: canvas.width - canvas.left - canvas.right,
height: canvas.height - canvas.top - canvas.bottom
};
if ("vertical" === layoutOptions.cutSide) {
sizeObject.height -= that._options.height
} else {
sizeObject.width -= that._options.width
}
item.probeDraw(sizeObject.width, sizeObject.height);
downSize(canvas, item.getLayoutOptions())
})
},
_drawElements: function(canvas) {
$.each(this._elements.slice().reverse(), function(_, item) {
var sizeObject, cutSide, length, layoutOptions = item.getLayoutOptions();
if (!layoutOptions) {
return
}
sizeObject = {
width: canvas.width - canvas.left - canvas.right,
height: canvas.height - canvas.top - canvas.bottom
};
cutSide = layoutOptions.cutSide;
length = "horizontal" === cutSide ? "width" : "height";
sizeObject[length] = layoutOptions[length];
item.draw(sizeObject.width, sizeObject.height)
})
},
_positionElements: function(canvas) {
var offsets = {
left: 0,
right: 0,
top: 0,
bottom: 0
};
$.each(this._elements.slice().reverse(), function(_, item) {
var position, cutSide, my, layoutOptions = item.getLayoutOptions();
if (!layoutOptions) {
return
}
position = layoutOptions.position;
cutSide = layoutOptions.cutSide;
my = {
horizontal: position.horizontal,
vertical: position.vertical
};
my[cutSide] = inverseAlign[my[cutSide]];
item.position({
of: toLayoutElementCoords(canvas),
my: my,
at: position,
offset: getOffset(layoutOptions, offsets)
});
offsets[layoutOptions.cutLayoutSide] += layoutOptions["horizontal" === layoutOptions.cutSide ? "width" : "height"]
})
}
};
exports.LayoutManager = LayoutManager
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*******************************************************!*\
!*** ./Scripts/viz/components/chart_theme_manager.js ***!
\*******************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
rendererModule = __webpack_require__( /*! ../core/renderers/renderer */ 176),
isIE8 = !rendererModule.isSvg(),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
BaseThemeManager = __webpack_require__( /*! ../core/base_theme_manager */ 103).BaseThemeManager,
_isString = commonUtils.isString,
_isDefined = commonUtils.isDefined,
_normalizeEnum = __webpack_require__( /*! ../core/utils */ 6).normalizeEnum,
FONT = "font",
COMMON_AXIS_SETTINGS = "commonAxisSettings",
PIE_FONT_FIELDS = ["legend." + FONT, "title." + FONT, "title.subtitle." + FONT, "tooltip." + FONT, "loadingIndicator." + FONT, "export." + FONT, "commonSeriesSettings.label." + FONT],
POLAR_FONT_FIELDS = PIE_FONT_FIELDS.concat([COMMON_AXIS_SETTINGS + ".label." + FONT, COMMON_AXIS_SETTINGS + ".title." + FONT]),
CHART_FONT_FIELDS = POLAR_FONT_FIELDS.concat(["crosshair.label." + FONT]),
chartToFontFieldsMap = {
pie: PIE_FONT_FIELDS,
chart: CHART_FONT_FIELDS,
polar: POLAR_FONT_FIELDS
};
var ThemeManager = BaseThemeManager.inherit(function() {
var ctor = function(options, themeGroupName) {
var that = this;
that.callBase.apply(that, arguments);
options = options || {};
that._userOptions = options;
that._mergeAxisTitleOptions = [];
that._multiPieColors = {};
that._themeSection = themeGroupName;
that._fontFields = chartToFontFieldsMap[themeGroupName];
that._IE8 = isIE8;
that._callback = $.noop
};
var dispose = function() {
var that = this;
that.palette && that.palette.dispose();
that.palette = that._userOptions = that._mergedSettings = that._multiPieColors = null;
return that.callBase.apply(that, arguments)
};
var resetPalette = function() {
this.palette.reset();
this._multiPieColors = {}
};
var updatePalette = function(palette) {
this.palette = this.createPalette(palette, {
useHighlight: true
})
};
var processTitleOptions = function(options) {
return _isString(options) ? {
text: options
} : options
};
var processAxisOptions = function(axisOptions) {
if (!axisOptions) {
return
}
axisOptions = $.extend(true, {}, axisOptions);
axisOptions.title = processTitleOptions(axisOptions.title);
if ("logarithmic" === axisOptions.type && axisOptions.logarithmBase <= 0 || axisOptions.logarithmBase && !$.isNumeric(axisOptions.logarithmBase)) {
axisOptions.logarithmBase = void 0;
axisOptions.logarithmBaseError = true
}
if (axisOptions.label) {
if (axisOptions.label.alignment) {
axisOptions.label.userAlignment = true
}
if (_isString(axisOptions.label.overlappingBehavior)) {
axisOptions.label.overlappingBehavior = {
mode: axisOptions.label.overlappingBehavior
}
}
if (!axisOptions.label.overlappingBehavior || !axisOptions.label.overlappingBehavior.mode) {
axisOptions.label.overlappingBehavior = axisOptions.label.overlappingBehavior || {}
}
}
return axisOptions
};
var applyParticularAxisOptions = function(name, userOptions, rotated) {
var theme = this._theme,
position = !(rotated ^ "valueAxis" === name) ? "horizontalAxis" : "verticalAxis",
commonAxisSettings = processAxisOptions(this._userOptions.commonAxisSettings, name);
return $.extend(true, {}, theme.commonAxisSettings, theme[position], theme[name], commonAxisSettings, processAxisOptions(userOptions, name))
};
var mergeOptions = function(name, userOptions) {
userOptions = userOptions || this._userOptions[name];
var theme = this._theme[name],
result = this._mergedSettings[name];
if (result) {
return result
}
if ($.isPlainObject(theme) && $.isPlainObject(userOptions)) {
result = $.extend(true, {}, theme, userOptions)
} else {
result = _isDefined(userOptions) ? userOptions : theme
}
this._mergedSettings[name] = result;
return result
};
var applyParticularTheme = {
base: mergeOptions,
argumentAxis: applyParticularAxisOptions,
valueAxisRangeSelector: function() {
return mergeOptions.call(this, "valueAxis")
},
valueAxis: applyParticularAxisOptions,
series: function(name, userOptions) {
var settings, mainSeriesColor, seriesVisibility, that = this,
theme = that._theme,
userCommonSettings = that._userOptions.commonSeriesSettings || {},
themeCommonSettings = theme.commonSeriesSettings,
widgetType = that._themeSection.split(".").slice(-1)[0],
type = _normalizeEnum(userOptions.type || userCommonSettings.type || themeCommonSettings.type || "pie" === widgetType && theme.type),
palette = that.palette,
isBar = ~type.indexOf("bar"),
isLine = ~type.indexOf("line"),
isArea = ~type.indexOf("area"),
isBubble = "bubble" === type,
resolveLabelsOverlapping = that.getOptions("resolveLabelsOverlapping"),
resolveLabelOverlapping = that.getOptions("resolveLabelOverlapping"),
containerBackgroundColor = that.getOptions("containerBackgroundColor");
if (isBar || isBubble) {
userOptions = $.extend(true, {}, userCommonSettings, userCommonSettings[type], userOptions);
seriesVisibility = userOptions.visible;
userCommonSettings = {
type: {}
};
$.extend(true, userOptions, userOptions.point);
userOptions.visible = seriesVisibility
}
settings = $.extend(true, {}, themeCommonSettings, themeCommonSettings[type], userCommonSettings, userCommonSettings[type], userOptions);
settings.type = type;
settings.widgetType = widgetType;
settings.containerBackgroundColor = containerBackgroundColor;
if ("pie" !== widgetType) {
mainSeriesColor = settings.color || palette.getNextColor()
} else {
mainSeriesColor = function(argument, index) {
var cat = argument + index;
if (!that._multiPieColors[cat]) {
that._multiPieColors[cat] = palette.getNextColor()
}
return that._multiPieColors[cat]
}
}
settings.mainSeriesColor = mainSeriesColor;
settings._IE8 = isIE8;
settings.resolveLabelOverlapping = resolveLabelOverlapping;
settings.resolveLabelsOverlapping = resolveLabelsOverlapping;
if (settings.label && (isLine || isArea && "rangearea" !== type || "scatter" === type)) {
settings.label.position = "outside"
}
return settings
},
animation: function(name) {
var userOptions = this._userOptions[name];
userOptions = $.isPlainObject(userOptions) ? userOptions : _isDefined(userOptions) ? {
enabled: !!userOptions
} : {};
return mergeOptions.call(this, name, userOptions)
}
};
return {
_themeSection: "chart",
ctor: ctor,
dispose: dispose,
resetPalette: resetPalette,
getOptions: function(name) {
return (applyParticularTheme[name] || applyParticularTheme.base).apply(this, arguments)
},
refresh: function() {
this._mergedSettings = {};
return this.callBase.apply(this, arguments)
},
_initializeTheme: function() {
var that = this;
that.callBase.apply(that, arguments);
that.updatePalette(that.getOptions("palette"))
},
resetOptions: function(name) {
this._mergedSettings[name] = null
},
update: function(options) {
this._userOptions = options
},
updatePalette: updatePalette
}
}());
exports.ThemeManager = ThemeManager;
exports._setIE8Mode = function(isIE8Mode) {
var initIEMode = isIE8;
isIE8 = isIE8Mode;
return initIEMode
};
exports._resetIE8Mode = function(initIEMode) {
isIE8 = initIEMode
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!******************************************!*\
!*** ./Scripts/viz/components/legend.js ***!
\******************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
vizUtils = __webpack_require__( /*! ../core/utils */ 6),
layoutElementModule = __webpack_require__( /*! ../core/layout_element */ 190),
_Number = Number,
_math = Math,
_round = _math.round,
_max = _math.max,
_min = _math.min,
_ceil = _math.ceil,
objectUtils = __webpack_require__( /*! ../../core/utils/object */ 30),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
_isDefined = commonUtils.isDefined,
_isFunction = commonUtils.isFunction,
_enumParser = vizUtils.enumParser,
_normalizeEnum = vizUtils.normalizeEnum,
_extend = $.extend,
_each = $.each,
DEFAULT_MARGIN = 10,
DEFAULT_MARKER_HATCHING_WIDTH = 2,
DEFAULT_MARKER_HATCHING_STEP = 5,
CENTER = "center",
RIGHT = "right",
LEFT = "left",
TOP = "top",
BOTTOM = "bottom",
HORIZONTAL = "horizontal",
VERTICAL = "vertical",
INSIDE = "inside",
OUTSIDE = "outside",
NONE = "none",
HEIGHT = "height",
WIDTH = "width",
parseHorizontalAlignment = _enumParser([LEFT, CENTER, RIGHT]),
parseVerticalAlignment = _enumParser([TOP, BOTTOM]),
parseOrientation = _enumParser([VERTICAL, HORIZONTAL]),
parseItemTextPosition = _enumParser([LEFT, RIGHT, TOP, BOTTOM]),
parsePosition = _enumParser([OUTSIDE, INSIDE]),
parseItemsAlignment = _enumParser([LEFT, CENTER, RIGHT]);
function getPattern(renderer, states, action, color) {
if (!states || !states[action]) {
return
}
var hatching, direction = states[action].hatching.direction,
colorFromAction = states[action].fill;
color = colorFromAction === NONE ? color : colorFromAction;
direction = !direction || direction === NONE ? RIGHT : direction;
hatching = _extend({}, states[action].hatching, {
direction: direction,
step: DEFAULT_MARKER_HATCHING_STEP,
width: DEFAULT_MARKER_HATCHING_WIDTH
});
return renderer.pattern(color, hatching)
}
function parseMargins(options) {
var margin = options.margin;
if (margin >= 0) {
margin = _Number(options.margin);
margin = {
top: margin,
bottom: margin,
left: margin,
right: margin
}
} else {
margin = {
top: margin.top >= 0 ? _Number(margin.top) : DEFAULT_MARGIN,
bottom: margin.bottom >= 0 ? _Number(margin.bottom) : DEFAULT_MARGIN,
left: margin.left >= 0 ? _Number(margin.left) : DEFAULT_MARGIN,
right: margin.right >= 0 ? _Number(margin.right) : DEFAULT_MARGIN
}
}
options.margin = margin
}
function getSizeItem(options, markerSize, labelBBox) {
var width, height, defaultXMargin = 7,
defaultTopMargin = 4;
switch (options.itemTextPosition) {
case LEFT:
case RIGHT:
width = markerSize + defaultXMargin + labelBBox.width;
height = _max(markerSize, labelBBox.height);
break;
case TOP:
case BOTTOM:
width = _max(markerSize, labelBBox.width);
height = markerSize + defaultTopMargin + labelBBox.height
}
return {
width: width,
height: height
}
}
function calculateBboxLabelAndMarker(markerBBox, labelBBox) {
var bbox = {};
bbox.left = _min(markerBBox.x, labelBBox.x);
bbox.top = _min(markerBBox.y, labelBBox.y);
bbox.right = _max(markerBBox.x + markerBBox.width, labelBBox.x + labelBBox.width);
bbox.bottom = _max(markerBBox.y + markerBBox.height, labelBBox.y + labelBBox.height);
return bbox
}
function applyMarkerState(id, idToIndexMap, items, stateName) {
var item = idToIndexMap && items[idToIndexMap[id]];
if (item) {
item.marker.attr(item.states[stateName])
}
}
function parseOptions(options, textField) {
if (!options) {
return null
}
var debug = __webpack_require__( /*! ../../core/utils/console */ 36).debug;
debug.assertParam(options.visible, "Visibility was not passed");
debug.assertParam(options.markerSize, "markerSize was not passed");
debug.assertParam(options.font.color, "fontColor was not passed");
debug.assertParam(options.font.family, "fontFamily was not passed");
debug.assertParam(options.font.size, "fontSize was not passed");
debug.assertParam(options.paddingLeftRight, "paddingLeftRight was not passed");
debug.assertParam(options.paddingTopBottom, "paddingTopBottom was not passed");
debug.assertParam(options.columnItemSpacing, "columnItemSpacing was not passed");
debug.assertParam(options.rowItemSpacing, "rowItemSpacing was not passed");
parseMargins(options);
options.horizontalAlignment = parseHorizontalAlignment(options.horizontalAlignment, RIGHT);
options.verticalAlignment = parseVerticalAlignment(options.verticalAlignment, options.horizontalAlignment === CENTER ? BOTTOM : TOP);
options.orientation = parseOrientation(options.orientation, options.horizontalAlignment === CENTER ? HORIZONTAL : VERTICAL);
options.itemTextPosition = parseItemTextPosition(options.itemTextPosition, options.orientation === HORIZONTAL ? BOTTOM : RIGHT);
options.position = parsePosition(options.position, OUTSIDE);
options.itemsAlignment = parseItemsAlignment(options.itemsAlignment, null);
options.hoverMode = _normalizeEnum(options.hoverMode);
options.customizeText = _isFunction(options.customizeText) ? options.customizeText : function() {
return this[textField]
};
options.customizeHint = _isFunction(options.customizeHint) ? options.customizeHint : $.noop;
options._incidentOccurred = options._incidentOccurred || $.noop;
return options
}
function createSquareMarker(renderer, size) {
return renderer.rect(0, 0, size, size)
}
function createCircleMarker(renderer, size) {
return renderer.circle(size / 2, size / 2, size / 2)
}
function isCircle(type) {
return "circle" === _normalizeEnum(type)
}
function getMarkerCreator(type) {
return isCircle(type) ? createCircleMarker : createSquareMarker
}
function inRect(rect, x, y) {
return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom
}
function checkLinesSize(lines, layoutOptions, countItems) {
var position = {
x: 0,
y: 0
},
maxMeasureLength = 0,
maxOrtMeasureLength = 0;
_each(lines, function(i, line) {
var firstItem = line[0];
_each(line, function(_, item) {
var offset = item.offset || layoutOptions.spacing;
position[layoutOptions.direction] += item[layoutOptions.measure] + offset;
maxMeasureLength = _max(maxMeasureLength, position[layoutOptions.direction])
});
position[layoutOptions.direction] = 0;
position[layoutOptions.ortDirection] += firstItem[layoutOptions.ortMeasure] + firstItem.ortOffset || layoutOptions.ortSpacing;
maxOrtMeasureLength = _max(maxOrtMeasureLength, position[layoutOptions.ortDirection])
});
if (maxMeasureLength > layoutOptions.length) {
layoutOptions.countItem = decreaseItemCount(layoutOptions, countItems);
return true
}
}
function decreaseItemCount(layoutOptions, countItems) {
layoutOptions.ortCountItem++;
return _ceil(countItems / layoutOptions.ortCountItem)
}
function getLineLength(line, layoutOptions) {
var lineLength = 0;
_each(line, function(_, item) {
var offset = item.offset || layoutOptions.spacing;
lineLength += item[layoutOptions.measure] + offset
});
return lineLength
}
function getMaxLineLength(lines, layoutOptions) {
var maxLineLength = 0;
_each(lines, function(_, line) {
maxLineLength = _max(maxLineLength, getLineLength(line, layoutOptions))
});
return maxLineLength
}
function getInitPositionForDirection(line, layoutOptions, maxLineLength) {
var initPosition, lineLength = getLineLength(line, layoutOptions);
switch (layoutOptions.itemsAlignment) {
case RIGHT:
initPosition = maxLineLength - lineLength;
break;
case CENTER:
initPosition = (maxLineLength - lineLength) / 2;
break;
default:
initPosition = 0
}
return initPosition
}
function getPos(layoutOptions) {
switch (layoutOptions.itemTextPosition) {
case BOTTOM:
return {
horizontal: CENTER,
vertical: TOP
};
case TOP:
return {
horizontal: CENTER,
vertical: BOTTOM
};
case LEFT:
return {
horizontal: RIGHT,
vertical: CENTER
};
case RIGHT:
return {
horizontal: LEFT,
vertical: CENTER
}
}
}
function getLines(lines, layoutOptions, itemIndex) {
var tableLine = {};
if (itemIndex % layoutOptions.countItem === 0) {
if (layoutOptions.markerOffset) {
lines.push([], [])
} else {
lines.push([])
}
}
if (layoutOptions.markerOffset) {
tableLine.firstLine = lines[lines.length - 1];
tableLine.secondLine = lines[lines.length - 2]
} else {
tableLine.firstLine = tableLine.secondLine = lines[lines.length - 1]
}
return tableLine
}
function setMaxInLine(line, measure) {
var maxLineSize = 0;
_each(line, function(_, item) {
if (!item) {
return
}
maxLineSize = _max(maxLineSize, item[measure])
});
_each(line, function(_, item) {
if (!item) {
return
}
item[measure] = maxLineSize
})
}
function transpose(array) {
var i, j, width = array.length,
height = array[0].length,
transposeArray = [];
for (i = 0; i < height; i++) {
transposeArray[i] = [];
for (j = 0; j < width; j++) {
transposeArray[i][j] = array[j][i]
}
}
return transposeArray
}
function getAlign(position) {
switch (position) {
case TOP:
case BOTTOM:
return CENTER;
case LEFT:
return RIGHT;
case RIGHT:
return LEFT
}
}
var _Legend = exports.Legend = function(settings) {
var that = this;
that._renderer = settings.renderer;
that._legendGroup = settings.group;
that._backgroundClass = settings.backgroundClass;
that._itemGroupClass = settings.itemGroupClass;
that._textField = settings.textField;
that._getCustomizeObject = settings.getFormatObject;
that._patterns = []
};
var legendPrototype = _Legend.prototype = objectUtils.clone(layoutElementModule.LayoutElement.prototype);
$.extend(legendPrototype, {
constructor: _Legend,
update: function(data, options) {
var that = this;
that._data = data;
that._boundingRect = {
width: 0,
height: 0,
x: 0,
y: 0
};
that._options = parseOptions(options, that._textField);
return that
},
draw: function(width, height) {
var that = this,
options = that._options,
renderer = that._renderer,
items = that._data;
this._size = {
width: width,
height: height
};
that.erase();
if (!(options && options.visible && items && items.length)) {
return that
}
that._insideLegendGroup = renderer.g().append(that._legendGroup);
that._createBackground();
that._createItems(that._getItemData());
that._locateElements(options);
that._finalUpdate(options);
if (that.getLayoutOptions().width > width || that.getLayoutOptions().height > height) {
that._options._incidentOccurred("W2104");
that.erase()
}
return that
},
probeDraw: function(width, height) {
return this.draw(width, height)
},
_createItems: function(items) {
var bbox, that = this,
options = that._options,
initMarkerSize = options.markerSize,
renderer = that._renderer,
i = 0,
maxBboxHeight = 0,
createMarker = getMarkerCreator(options.markerShape || options.markerType);
that._markersId = {};
for (; i < that._patterns.length; i++) {
that._patterns[i].dispose()
}
that._patterns = [];
that._items = vizUtils.map(items, function(dataItem, i) {
var group = that._insideLegendGroup,
markerSize = _Number(dataItem.size > 0 ? dataItem.size : initMarkerSize),
stateOfDataItem = dataItem.states,
normalState = stateOfDataItem.normal,
normalStateFill = normalState.fill,
marker = createMarker(renderer, markerSize).attr({
fill: normalStateFill || options.markerColor,
opacity: normalState.opacity
}).append(group),
label = that._createLabel(dataItem, group),
hoverPattern = getPattern(renderer, stateOfDataItem, "hover", normalStateFill),
selectionPattern = getPattern(renderer, stateOfDataItem, "selection", normalStateFill),
states = {
normal: {
fill: normalStateFill
}
},
labelBBox = label.getBBox();
if (hoverPattern) {
states.hovered = {
fill: hoverPattern.id
};
that._patterns.push(hoverPattern)
}
if (selectionPattern) {
states.selected = {
fill: selectionPattern.id
};
that._patterns.push(selectionPattern)
}
if (void 0 !== dataItem.id) {
that._markersId[dataItem.id] = i
}
bbox = getSizeItem(options, markerSize, labelBBox);
maxBboxHeight = _max(maxBboxHeight, bbox.height);
that._createHint(dataItem, label);
return {
label: label,
labelBBox: labelBBox,
group: group,
bbox: bbox,
marker: marker,
markerSize: markerSize,
tracker: {
id: dataItem.id,
argument: dataItem.argument
},
states: states,
itemTextPosition: options.itemTextPosition,
markerOffset: 0,
bboxs: []
}
});
if (options.equalRowHeight) {
_each(that._items, function(_, item) {
item.bbox.height = maxBboxHeight
})
}
},
_getItemData: function() {
var items = this._data;
if (this._options.inverted) {
items = items.slice().reverse()
}
return items
},
_finalUpdate: function(options) {
this._adjustBackgroundSettings(options);
this._setBoundingRect(options.margin)
},
erase: function() {
var that = this,
insideLegendGroup = that._insideLegendGroup;
insideLegendGroup && insideLegendGroup.dispose();
that._insideLegendGroup = that._x1 = that._x2 = that._y2 = that._y2 = null;
return that
},
_locateElements: function(locationOptions) {
this._moveInInitialValues();
this._locateRowsColumns(locationOptions)
},
_moveInInitialValues: function() {
var that = this;
that._legendGroup && that._legendGroup.move(0, 0);
that._background && that._background.attr({
x: 0,
y: 0,
width: 0,
height: 0
})
},
applySelected: function(id) {
applyMarkerState(id, this._markersId, this._items, "selected");
return this
},
applyHover: function(id) {
applyMarkerState(id, this._markersId, this._items, "hovered");
return this
},
resetItem: function(id) {
applyMarkerState(id, this._markersId, this._items, "normal");
return this
},
_createLabel: function(data, group) {
var labelFormatObject = this._getCustomizeObject(data),
align = getAlign(this._options.itemTextPosition),
text = this._options.customizeText.call(labelFormatObject, labelFormatObject),
fontStyle = _isDefined(data.textOpacity) ? _extend({}, this._options.font, {
opacity: data.textOpacity
}) : this._options.font;
return this._renderer.text(text, 0, 0).css(vizUtils.patchFontOptions(fontStyle)).attr({
align: align
}).append(group)
},
_createHint: function(data, label) {
var labelFormatObject = this._getCustomizeObject(data),
text = this._options.customizeHint.call(labelFormatObject, labelFormatObject);
if (_isDefined(text) && "" !== text) {
label.setTitle(text)
}
},
_createBackground: function() {
var that = this,
isInside = that._options.position === INSIDE,
color = that._options.backgroundColor,
fill = color || (isInside ? that._options.containerBackgroundColor : NONE);
if (that._options.border.visible || (isInside || color) && color !== NONE) {
that._background = that._renderer.rect(0, 0, 0, 0).attr({
fill: fill,
"class": that._backgroundClass
}).append(that._insideLegendGroup)
}
},
_locateRowsColumns: function() {
var lines, that = this,
iteration = 0,
layoutOptions = that._getItemsLayoutOptions(),
countItems = that._items.length;
do {
lines = [];
that._createLines(lines, layoutOptions);
that._alignLines(lines, layoutOptions);
iteration++
} while (checkLinesSize(lines, layoutOptions, countItems) && iteration < countItems);
that._applyItemPosition(lines, layoutOptions)
},
_createLines: function(lines, layoutOptions) {
_each(this._items, function(i, item) {
var firstItem, secondItem, tableLine = getLines(lines, layoutOptions, i),
labelBox = {
width: item.labelBBox.width,
height: item.labelBBox.height,
element: item.label,
bbox: item.labelBBox,
pos: getPos(layoutOptions),
itemIndex: i
},
markerBox = {
width: item.markerSize,
height: item.markerSize,
element: item.marker,
pos: {
horizontal: CENTER,
vertical: CENTER
},
bbox: {
width: item.markerSize,
height: item.markerSize,
x: 0,
y: 0
},
itemIndex: i
},
offsetDirection = layoutOptions.markerOffset ? "ortOffset" : "offset";
if (layoutOptions.inverseLabelPosition) {
firstItem = labelBox;
secondItem = markerBox
} else {
firstItem = markerBox;
secondItem = labelBox
}
firstItem[offsetDirection] = layoutOptions.labelOffset;
tableLine.secondLine.push(firstItem);
tableLine.firstLine.push(secondItem)
})
},
_alignLines: function(lines, layoutOptions) {
var i, measure = layoutOptions.ortMeasure;
_each(lines, processLine);
measure = layoutOptions.measure;
if (layoutOptions.itemsAlignment) {
if (layoutOptions.markerOffset) {
for (i = 0; i < lines.length;) {
_each(transpose([lines[i++], lines[i++]]), processLine)
}
}
} else {
_each(transpose(lines), processLine)
}
function processLine(_, line) {
setMaxInLine(line, measure)
}
},
_applyItemPosition: function(lines, layoutOptions) {
var that = this,
position = {
x: 0,
y: 0
},
maxLineLength = getMaxLineLength(lines, layoutOptions),
itemIndex = 0;
_each(lines, function(i, line) {
var firstItem = line[0],
ortOffset = firstItem.ortOffset || layoutOptions.ortSpacing;
position[layoutOptions.direction] = getInitPositionForDirection(line, layoutOptions, maxLineLength);
_each(line, function(_, item) {
var offset = item.offset || layoutOptions.spacing,
wrap = new layoutElementModule.WrapperLayoutElement(item.element, item.bbox),
itemBBox = new layoutElementModule.WrapperLayoutElement(null, {
x: position.x,
y: position.y,
width: item.width,
height: item.height
}),
itemLegend = that._items[item.itemIndex];
wrap.position({
of: itemBBox,
my: item.pos,
at: item.pos
});
itemLegend.bboxs.push(itemBBox);
position[layoutOptions.direction] += item[layoutOptions.measure] + offset;
itemIndex++
});
position[layoutOptions.ortDirection] += firstItem[layoutOptions.ortMeasure] + ortOffset
});
_each(this._items, function(_, item) {
var itemBBox = calculateBboxLabelAndMarker(item.bboxs[0].getLayoutOptions(), item.bboxs[1].getLayoutOptions()),
horizontal = that._options.columnItemSpacing / 2,
vertical = that._options.rowItemSpacing / 2;
item.tracker.left = itemBBox.left - horizontal;
item.tracker.right = itemBBox.right + horizontal;
item.tracker.top = itemBBox.top - vertical;
item.tracker.bottom = itemBBox.bottom + vertical
})
},
_getItemsLayoutOptions: function() {
var that = this,
options = that._options,
orientation = options.orientation,
layoutOptions = {
itemsAlignment: options.itemsAlignment,
orientation: options.orientation
},
width = that._size.width - 2 * options.paddingLeftRight,
height = that._size.height - 2 * options.paddingTopBottom;
if (orientation === HORIZONTAL) {
layoutOptions.length = width;
layoutOptions.ortLength = height;
layoutOptions.spacing = options.columnItemSpacing;
layoutOptions.direction = "x";
layoutOptions.measure = WIDTH;
layoutOptions.ortMeasure = HEIGHT;
layoutOptions.ortDirection = "y";
layoutOptions.ortSpacing = options.rowItemSpacing;
layoutOptions.countItem = options.columnCount;
layoutOptions.ortCountItem = options.rowCount;
layoutOptions.marginTextLabel = 4;
layoutOptions.labelOffset = 7;
if (options.itemTextPosition === BOTTOM || options.itemTextPosition === TOP) {
layoutOptions.labelOffset = 4;
layoutOptions.markerOffset = true
}
} else {
layoutOptions.length = height;
layoutOptions.ortLength = width;
layoutOptions.spacing = options.rowItemSpacing;
layoutOptions.direction = "y";
layoutOptions.measure = HEIGHT;
layoutOptions.ortMeasure = WIDTH;
layoutOptions.ortDirection = "x";
layoutOptions.ortSpacing = options.columnItemSpacing;
layoutOptions.countItem = options.rowCount;
layoutOptions.ortCountItem = options.columnCount;
layoutOptions.marginTextLabel = 7;
layoutOptions.labelOffset = 4;
if (options.itemTextPosition === RIGHT || options.itemTextPosition === LEFT) {
layoutOptions.labelOffset = 7;
layoutOptions.markerOffset = true
}
}
if (!layoutOptions.countItem) {
if (layoutOptions.ortCountItem) {
layoutOptions.countItem = _ceil(that._items.length / layoutOptions.ortCountItem)
} else {
layoutOptions.countItem = that._items.length
}
}
if (options.itemTextPosition === TOP || options.itemTextPosition === LEFT) {
layoutOptions.inverseLabelPosition = true
}
layoutOptions.itemTextPosition = options.itemTextPosition;
layoutOptions.ortCountItem = layoutOptions.ortCountItem || _ceil(that._items.length / layoutOptions.countItem);
return layoutOptions
},
_adjustBackgroundSettings: function(locationOptions) {
if (!this._background) {
return
}
var border = locationOptions.border,
legendBox = this._insideLegendGroup.getBBox(),
backgroundSettings = {
x: _round(legendBox.x - locationOptions.paddingLeftRight),
y: _round(legendBox.y - locationOptions.paddingTopBottom),
width: _round(legendBox.width) + 2 * locationOptions.paddingLeftRight,
height: _round(legendBox.height) + 2 * locationOptions.paddingTopBottom,
opacity: locationOptions.backgroundOpacity
};
if (border.visible && border.width && border.color && border.color !== NONE) {
backgroundSettings["stroke-width"] = border.width;
backgroundSettings.stroke = border.color;
backgroundSettings["stroke-opacity"] = border.opacity;
backgroundSettings.dashStyle = border.dashStyle;
backgroundSettings.rx = border.cornerRadius || 0;
backgroundSettings.ry = border.cornerRadius || 0
}
this._background.attr(backgroundSettings)
},
_setBoundingRect: function(margin) {
if (!this._insideLegendGroup) {
return
}
var box = this._insideLegendGroup.getBBox();
box.height += margin.top + margin.bottom;
box.width += margin.left + margin.right;
box.x -= margin.left;
box.y -= margin.top;
this._boundingRect = box
},
getActionCallback: function(point) {
var that = this;
if (that._options.visible) {
return function(act) {
that[act](point.index)
}
} else {
return $.noop
}
},
getLayoutOptions: function() {
var options = this._options,
boundingRect = this._insideLegendGroup ? this._boundingRect : {
width: 0,
height: 0,
x: 0,
y: 0
};
if (options) {
boundingRect.verticalAlignment = options.verticalAlignment;
boundingRect.horizontalAlignment = options.horizontalAlignment;
if (options.orientation === HORIZONTAL) {
boundingRect.cutLayoutSide = options.verticalAlignment;
boundingRect.cutSide = "vertical"
} else {
if (options.horizontalAlignment === CENTER) {
boundingRect.cutLayoutSide = options.verticalAlignment;
boundingRect.cutSide = "vertical"
} else {
boundingRect.cutLayoutSide = options.horizontalAlignment;
boundingRect.cutSide = "horizontal"
}
}
boundingRect.position = {
horizontal: options.horizontalAlignment,
vertical: options.verticalAlignment
};
return boundingRect
}
return null
},
shift: function(x, y) {
var that = this,
box = {};
if (that._insideLegendGroup) {
that._insideLegendGroup.attr({
translateX: x - that._boundingRect.x,
translateY: y - that._boundingRect.y
});
box = that._legendGroup.getBBox()
}
that._x1 = box.x;
that._y1 = box.y;
that._x2 = box.x + box.width;
that._y2 = box.y + box.height;
return that
},
getPosition: function() {
return this._options.position
},
coordsIn: function(x, y) {
return x >= this._x1 && x <= this._x2 && y >= this._y1 && y <= this._y2
},
getItemByCoord: function(x, y) {
var items = this._items,
legendGroup = this._insideLegendGroup;
x -= legendGroup.attr("translateX");
y -= legendGroup.attr("translateY");
for (var i = 0; i < items.length; i++) {
if (inRect(items[i].tracker, x, y)) {
return items[i].tracker
}
}
return null
},
dispose: function() {
var that = this;
that._legendGroup = that._insideLegendGroup = that._renderer = that._options = that._data = that._items = null;
return that
}
});
var __getMarkerCreator = getMarkerCreator;
exports._DEBUG_stubMarkerCreator = function(callback) {
getMarkerCreator = function() {
return callback
}
};
exports._DEBUG_restoreMarkerCreator = function() {
getMarkerCreator = __getMarkerCreator
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*******************************************!*\
!*** ./Scripts/viz/core/series_family.js ***!
\*******************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
_math = Math,
_round = _math.round,
_abs = _math.abs,
_pow = _math.pow,
_each = $.each,
_noop = $.noop,
vizUtils = __webpack_require__( /*! ./utils */ 6),
_normalizeEnum = vizUtils.normalizeEnum;
function getStacksWithArgument(stackKeepers, argument) {
var stacksWithArgument = [];
_each(stackKeepers, function(stackName, seriesInStack) {
_each(seriesInStack, function(_, singleSeries) {
var i, points = singleSeries.getPointsByArg(argument),
pointsLength = points.length;
for (i = 0; i < pointsLength; ++i) {
if (points[i].value) {
stacksWithArgument.push(stackName);
return false
}
}
})
});
return stacksWithArgument
}
function correctPointCoordinatesForStacks(stackKeepers, stacksWithArgument, argument, parameters) {
_each(stackKeepers, function(stackName, seriesInStack) {
var offset, stackIndex = $.inArray(stackName, stacksWithArgument);
if (-1 === stackIndex) {
return
}
offset = getOffset(stackIndex, parameters);
_each(seriesInStack, function(_, singleSeries) {
correctPointCoordinates(singleSeries.getPointsByArg(argument) || [], parameters.width, offset)
})
})
}
function adjustBarSeriesDimensionsCore(series, interval, stackCount, options, seriesStackIndexCallback) {
var percentWidth, stackIndex, i, points, stackName, stacksWithArgument, parameters, argumentsKeeper = {},
stackKeepers = {},
barsArea = .7 * interval,
barWidth = options.barWidth;
if (options.equalBarWidth) {
percentWidth = barWidth && (barWidth < 0 || barWidth > 1) ? 0 : barWidth;
parameters = calculateParams(barsArea, stackCount, percentWidth);
for (i = 0; i < series.length; i++) {
stackIndex = seriesStackIndexCallback(i, stackCount);
points = series[i].getPoints();
correctPointCoordinates(points, parameters.width, getOffset(stackIndex, parameters))
}
} else {
_each(series, function(i, singleSeries) {
stackName = singleSeries.getStackName && singleSeries.getStackName();
stackName = stackName || i.toString();
if (!stackKeepers[stackName]) {
stackKeepers[stackName] = []
}
stackKeepers[stackName].push(singleSeries);
_each(singleSeries.getPoints(), function(_, point) {
var argument = point.argument;
if (!argumentsKeeper.hasOwnProperty(argument)) {
argumentsKeeper[argument.valueOf()] = 1
}
})
});
for (var argument in argumentsKeeper) {
stacksWithArgument = getStacksWithArgument(stackKeepers, argument);
parameters = calculateParams(barsArea, stacksWithArgument.length);
correctPointCoordinatesForStacks(stackKeepers, stacksWithArgument, argument, parameters)
}
}
}
function calculateParams(barsArea, count, percentWidth) {
var spacing, width, middleIndex = count / 2;
if (!percentWidth) {
spacing = _round(barsArea / count * .2);
width = _round((barsArea - spacing * (count - 1)) / count);
width < 2 && (width = 2)
} else {
width = _round(barsArea * percentWidth / count);
spacing = _round(count > 1 ? (barsArea - barsArea * percentWidth) / (count - 1) : 0)
}
return {
width: width,
spacing: spacing,
middleIndex: middleIndex
}
}
function getOffset(stackIndex, parameters) {
return (stackIndex - parameters.middleIndex + .5) * parameters.width - (parameters.middleIndex - stackIndex - .5) * parameters.spacing
}
function correctPointCoordinates(points, width, offset) {
_each(points, function(_, point) {
point.correctCoordinates({
width: width,
offset: offset
})
})
}
function checkMinBarSize(value, minShownValue) {
return _abs(value) < minShownValue ? value >= 0 ? minShownValue : -minShownValue : value
}
function getValueType(value) {
return value >= 0 ? "positive" : "negative"
}
function getVisibleSeries(that) {
return vizUtils.map(that.series, function(s) {
return s.isVisible() ? s : null
})
}
function getAbsStackSumByArg(stackKeepers, stackName, argument) {
var positiveStackValue = (stackKeepers.positive[stackName] || {})[argument] || 0,
negativeStackValue = -(stackKeepers.negative[stackName] || {})[argument] || 0;
return positiveStackValue + negativeStackValue
}
function getSeriesStackIndexCallback(rotated, series, stackIndexes) {
if (!rotated) {
return function(seriesIndex, stackCount) {
return stackIndexes ? stackIndexes[series[seriesIndex].getStackName()] : seriesIndex
}
} else {
return function(seriesIndex, stackCount) {
return stackCount - (stackIndexes ? stackIndexes[series[seriesIndex].getStackName()] : seriesIndex) - 1
}
}
}
function adjustBarSeriesDimensions(translators) {
var debug = __webpack_require__( /*! ../../core/utils/console */ 36).debug;
debug.assert(translators, "translator was not passed or empty");
var that = this,
series = getVisibleSeries(that);
adjustBarSeriesDimensionsCore(series, translators.arg.getInterval(), series.length, that._options, getSeriesStackIndexCallback(that.rotated, series))
}
function adjustStackedBarSeriesDimensions(translators) {
var debug = __webpack_require__( /*! ../../core/utils/console */ 36).debug;
debug.assert(translators, "translators was not passed or empty");
var that = this,
series = getVisibleSeries(that),
stackIndexes = {},
stackCount = 0;
_each(series, function() {
var stackName = this.getStackName();
if (!stackIndexes.hasOwnProperty(stackName)) {
stackIndexes[stackName] = stackCount++
}
});
adjustBarSeriesDimensionsCore(series, translators.arg.getInterval(), stackCount, that._options, getSeriesStackIndexCallback(that.rotated, series, stackIndexes))
}
function adjustStackedSeriesValues() {
var that = this,
negativesAsZeroes = that._options.negativesAsZeroes,
series = getVisibleSeries(that),
stackKeepers = {
positive: {},
negative: {}
},
holesStack = {
left: {},
right: {}
};
_each(series, function(seriesIndex, singleSeries) {
var points = singleSeries.getPoints(),
hole = false;
singleSeries._prevSeries = series[seriesIndex - 1];
singleSeries.holes = $.extend(true, {}, holesStack);
_each(points, function(index, point) {
var currentStack, value = point.initialValue,
argument = point.argument.valueOf(),
stackName = singleSeries.getStackName(),
stacks = value >= 0 ? stackKeepers.positive : stackKeepers.negative;
if (negativesAsZeroes && value < 0) {
stacks = stackKeepers.positive;
value = 0;
point.resetValue()
}
stacks[stackName] = stacks[stackName] || {};
currentStack = stacks[stackName];
if (currentStack[argument]) {
point.correctValue(currentStack[argument]);
currentStack[argument] += value
} else {
currentStack[argument] = value;
point.resetCorrection()
}
if (!point.hasValue()) {
var prevPoint = points[index - 1];
if (!hole && prevPoint && prevPoint.hasValue()) {
argument = prevPoint.argument.valueOf();
prevPoint._skipSetRightHole = true;
holesStack.right[argument] = (holesStack.right[argument] || 0) + (prevPoint.value - (isFinite(prevPoint.minValue) ? prevPoint.minValue : 0))
}
hole = true
} else {
if (hole) {
hole = false;
holesStack.left[argument] = (holesStack.left[argument] || 0) + (point.value - (isFinite(point.minValue) ? point.minValue : 0));
point._skipSetLeftHole = true
}
}
})
});
_each(series, function(seriesIndex, singleSeries) {
var points = singleSeries.getPoints(),
holes = singleSeries.holes;
_each(points, function(index, point) {
var argument = point.argument.valueOf();
point.resetHoles();
!point._skipSetLeftHole && point.setHole(holes.left[argument] || holesStack.left[argument] && 0, "left");
!point._skipSetRightHole && point.setHole(holes.right[argument] || holesStack.right[argument] && 0, "right");
point._skipSetLeftHole = null;
point._skipSetRightHole = null
})
});
that._stackKeepers = stackKeepers;
_each(series, function(_, singleSeries) {
_each(singleSeries.getPoints(), function(_, point) {
var argument = point.argument.valueOf();
point.setPercentValue(getAbsStackSumByArg(stackKeepers, singleSeries.getStackName(), argument), that.fullStacked, holesStack.left[argument], holesStack.right[argument])
})
})
}
function updateStackedSeriesValues(translators) {
var that = this,
series = getVisibleSeries(that),
stack = that._stackKeepers,
stackKeepers = {
positive: {},
negative: {}
};
_each(series, function(_, singleSeries) {
var minBarSize = singleSeries.getOptions().minBarSize,
tr = singleSeries.axis ? translators.axesTrans[singleSeries.axis] : translators,
minShownBusinessValue = minBarSize && tr.val.getMinBarSize(minBarSize),
stackName = singleSeries.getStackName();
_each(singleSeries.getPoints(), function(index, point) {
if (!point.hasValue()) {
return
}
var updateValue, valueType, currentStack, value = point.initialValue,
argument = point.argument.valueOf();
if (that.fullStacked) {
value = value / getAbsStackSumByArg(stack, stackName, argument) || 0
}
updateValue = checkMinBarSize(value, minShownBusinessValue);
valueType = getValueType(updateValue);
currentStack = stackKeepers[valueType][stackName] = stackKeepers[valueType][stackName] || {};
if (currentStack[argument]) {
point.minValue = currentStack[argument];
currentStack[argument] += updateValue
} else {
currentStack[argument] = updateValue
}
point.value = currentStack[argument]
})
});
if (that.fullStacked) {
updateFullStackedSeriesValues(series, stackKeepers)
}
}
function updateFullStackedSeriesValues(series, stackKeepers) {
_each(series, function(_, singleSeries) {
var stackName = singleSeries.getStackName ? singleSeries.getStackName() : "default";
_each(singleSeries.getPoints(), function(index, point) {
var stackSum = getAbsStackSumByArg(stackKeepers, stackName, point.argument.valueOf());
point.value = point.value / stackSum;
if (commonUtils.isNumber(point.minValue)) {
point.minValue = point.minValue / stackSum
}
})
})
}
function updateBarSeriesValues(translators) {
_each(this.series, function(_, singleSeries) {
var minBarSize = singleSeries.getOptions().minBarSize,
tr = singleSeries.axis ? translators.axesTrans[singleSeries.axis] : translators,
minShownBusinessValue = minBarSize && tr.val.getMinBarSize(minBarSize);
if (minShownBusinessValue) {
_each(singleSeries.getPoints(), function(index, point) {
if (point.hasValue()) {
point.value = checkMinBarSize(point.initialValue, minShownBusinessValue)
}
})
}
})
}
function adjustCandlestickSeriesDimensions(translators) {
var debug = __webpack_require__( /*! ../../core/utils/console */ 36).debug;
debug.assert(translators, "translator was not passed or empty");
var series = getVisibleSeries(this);
adjustBarSeriesDimensionsCore(series, translators.arg.getInterval(), series.length, {
barWidth: null,
equalBarWidth: true
}, getSeriesStackIndexCallback(this.rotated, series))
}
function adjustBubbleSeriesDimensions(translators) {
var debug = __webpack_require__( /*! ../../core/utils/console */ 36).debug;
debug.assert(translators, "translator was not passed or empty");
var pointSize, bubbleArea, sizeProportion, sizeDispersion, areaDispersion, that = this,
series = getVisibleSeries(that),
options = that._options,
visibleAreaX = translators.arg.getCanvasVisibleArea(),
visibleAreaY = translators.val.getCanvasVisibleArea(),
min = _math.min(visibleAreaX.max - visibleAreaX.min, visibleAreaY.max - visibleAreaY.min),
minBubbleArea = _pow(options.minBubbleSize, 2),
maxBubbleArea = _pow(min * options.maxBubbleSize, 2),
equalBubbleSize = (min * options.maxBubbleSize + options.minBubbleSize) / 2,
minPointSize = 1 / 0,
maxPointSize = 0;
_each(series, function(_, seriesItem) {
_each(seriesItem.getPoints(), function(_, point) {
maxPointSize = maxPointSize > point.size ? maxPointSize : point.size;
minPointSize = minPointSize < point.size ? minPointSize : point.size
})
});
sizeDispersion = maxPointSize - minPointSize;
areaDispersion = _abs(maxBubbleArea - minBubbleArea);
minPointSize = minPointSize < 0 ? 0 : minPointSize;
_each(series, function(_, seriesItem) {
_each(seriesItem.getPoints(), function(_, point) {
if (maxPointSize === minPointSize) {
pointSize = _round(equalBubbleSize)
} else {
sizeProportion = _abs(point.size - minPointSize) / sizeDispersion;
bubbleArea = areaDispersion * sizeProportion + minBubbleArea;
pointSize = _round(_math.sqrt(bubbleArea))
}
point.correctCoordinates(pointSize)
})
})
}
function SeriesFamily(options) {
var debug = __webpack_require__( /*! ../../core/utils/console */ 36).debug;
debug.assert(options.type, "type was not passed or empty");
var that = this;
that.type = _normalizeEnum(options.type);
that.pane = options.pane;
that.rotated = options.rotated;
that.series = [];
that.updateOptions(options);
switch (that.type) {
case "bar":
that.adjustSeriesDimensions = adjustBarSeriesDimensions;
that.updateSeriesValues = updateBarSeriesValues;
break;
case "rangebar":
that.adjustSeriesDimensions = adjustBarSeriesDimensions;
break;
case "fullstackedbar":
that.fullStacked = true;
that.adjustSeriesDimensions = adjustStackedBarSeriesDimensions;
that.adjustSeriesValues = adjustStackedSeriesValues;
that.updateSeriesValues = updateStackedSeriesValues;
break;
case "stackedbar":
that.adjustSeriesDimensions = adjustStackedBarSeriesDimensions;
that.adjustSeriesValues = adjustStackedSeriesValues;
that.updateSeriesValues = updateStackedSeriesValues;
break;
case "fullstackedarea":
case "fullstackedline":
case "fullstackedspline":
case "fullstackedsplinearea":
that.fullStacked = true;
that.adjustSeriesValues = adjustStackedSeriesValues;
break;
case "stackedarea":
case "stackedsplinearea":
case "stackedline":
case "stackedspline":
that.adjustSeriesValues = adjustStackedSeriesValues;
break;
case "candlestick":
case "stock":
that.adjustSeriesDimensions = adjustCandlestickSeriesDimensions;
break;
case "bubble":
that.adjustSeriesDimensions = adjustBubbleSeriesDimensions
}
}
exports.SeriesFamily = SeriesFamily;
SeriesFamily.prototype = {
constructor: SeriesFamily,
adjustSeriesDimensions: _noop,
adjustSeriesValues: _noop,
updateSeriesValues: _noop,
updateOptions: function(options) {
this._options = options
},
dispose: function() {
this.series = this.translators = null
},
add: function(series) {
var type = this.type;
this.series = vizUtils.map(series, function(singleSeries) {
return singleSeries.type === type ? singleSeries : null
})
},
getStackPoints: function() {
var stackPoints = {};
$.each(this.series, function(_, singleSeries) {
var points = singleSeries.getPoints(),
stackName = singleSeries.getStackName() || null;
if (!singleSeries.isVisible()) {
return
}
_each(points, function(_, point) {
var argument = point.argument;
if (!stackPoints[argument]) {
stackPoints[argument] = {}
}
if (!stackPoints[argument][stackName]) {
stackPoints[argument][stackName] = []
}
stackPoints[argument][stackName].push(point)
})
});
return stackPoints
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************************!*\
!*** ./Scripts/viz/gauges/base_range_container.js ***!
\****************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
BaseElement = __webpack_require__( /*! ./base_indicators */ 235).BaseElement,
_Number = Number,
_abs = Math.abs,
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
_isString = commonUtils.isString,
_isArray = commonUtils.isArray,
_isFinite = isFinite,
_each = $.each,
_map = $.map;
var BaseRangeContainer = BaseElement.inherit({
_init: function() {
this._root = this._renderer.g().attr({
"class": "dxg-range-container"
}).linkOn(this._container, "range-container")
},
_dispose: function() {
this._root.linkOff()
},
clean: function() {
this._root.linkRemove().clear();
this._options = this.enabled = null;
return this
},
_getRanges: function() {
var that = this,
options = that._options,
translator = that._translator,
totalStart = translator.getDomain()[0],
totalEnd = translator.getDomain()[1],
totalDelta = totalEnd - totalStart,
isNotEmptySegment = totalDelta >= 0 ? isNotEmptySegmentAsc : isNotEmptySegmentDes,
subtractSegment = totalDelta >= 0 ? subtractSegmentAsc : subtractSegmentDes,
list = [],
ranges = [],
backgroundRanges = [{
start: totalStart,
end: totalEnd
}],
threshold = _abs(totalDelta) / 1e4,
palette = that._themeManager.createPalette(options.palette, {
type: "indicatingSet"
}),
backgroundColor = _isString(options.backgroundColor) ? options.backgroundColor : "none",
width = options.width || {},
startWidth = _Number(width > 0 ? width : width.start),
endWidth = _Number(width > 0 ? width : width.end),
deltaWidth = endWidth - startWidth;
if (void 0 !== options.ranges && !_isArray(options.ranges)) {
return null
}
if (!(startWidth >= 0 && endWidth >= 0 && startWidth + endWidth > 0)) {
return null
}
list = _map(_isArray(options.ranges) ? options.ranges : [], function(rangeOptions, i) {
rangeOptions = rangeOptions || {};
var start = translator.adjust(rangeOptions.startValue),
end = translator.adjust(rangeOptions.endValue);
return _isFinite(start) && _isFinite(end) && isNotEmptySegment(start, end, threshold) ? {
start: start,
end: end,
color: rangeOptions.color,
classIndex: i
} : null
});
_each(list, function(i, item) {
var paletteColor = palette.getNextColor();
item.color = _isString(item.color) && item.color || paletteColor || "none";
item.className = "dxg-range dxg-range-" + item.classIndex;
delete item.classIndex
});
_each(list, function(_, item) {
var i, ii, sub, subs, range, newRanges = [],
newBackgroundRanges = [];
for (i = 0, ii = ranges.length; i < ii; ++i) {
range = ranges[i];
subs = subtractSegment(range.start, range.end, item.start, item.end);
(sub = subs[0]) && (sub.color = range.color) && (sub.className = range.className) && newRanges.push(sub);
(sub = subs[1]) && (sub.color = range.color) && (sub.className = range.className) && newRanges.push(sub)
}
newRanges.push(item);
ranges = newRanges;
for (i = 0, ii = backgroundRanges.length; i < ii; ++i) {
range = backgroundRanges[i];
subs = subtractSegment(range.start, range.end, item.start, item.end);
(sub = subs[0]) && newBackgroundRanges.push(sub);
(sub = subs[1]) && newBackgroundRanges.push(sub)
}
backgroundRanges = newBackgroundRanges
});
_each(backgroundRanges, function(_, range) {
range.color = backgroundColor;
range.className = "dxg-range dxg-background-range";
ranges.push(range)
});
_each(ranges, function(_, range) {
range.startWidth = (range.start - totalStart) / totalDelta * deltaWidth + startWidth;
range.endWidth = (range.end - totalStart) / totalDelta * deltaWidth + startWidth
});
return ranges
},
render: function(options) {
var that = this;
that._options = options;
that._processOptions();
that._ranges = that._getRanges();
if (that._ranges) {
that.enabled = true;
that._root.linkAppend()
}
return that
},
resize: function(layout) {
var that = this;
that._root.clear();
if (that._isVisible(layout)) {
_each(that._ranges, function(_, range) {
that._createRange(range, layout).attr({
fill: range.color,
"class": range.className
}).append(that._root)
})
}
return that
},
_processOptions: null,
_isVisible: null,
_createRange: null,
getColorForValue: function(value) {
var color = null;
_each(this._ranges, function(_, range) {
if (range.start <= value && value <= range.end || range.start >= value && value >= range.end) {
color = range.color;
return false
}
});
return color
}
});
function subtractSegmentAsc(segmentStart, segmentEnd, otherStart, otherEnd) {
var result;
if (otherStart > segmentStart && otherEnd < segmentEnd) {
result = [{
start: segmentStart,
end: otherStart
}, {
start: otherEnd,
end: segmentEnd
}]
} else {
if (otherStart >= segmentEnd || otherEnd <= segmentStart) {
result = [{
start: segmentStart,
end: segmentEnd
}]
} else {
if (otherStart <= segmentStart && otherEnd >= segmentEnd) {
result = []
} else {
if (otherStart > segmentStart) {
result = [{
start: segmentStart,
end: otherStart
}]
} else {
if (otherEnd < segmentEnd) {
result = [{
start: otherEnd,
end: segmentEnd
}]
}
}
}
}
}
return result
}
function subtractSegmentDes(segmentStart, segmentEnd, otherStart, otherEnd) {
var result;
if (otherStart < segmentStart && otherEnd > segmentEnd) {
result = [{
start: segmentStart,
end: otherStart
}, {
start: otherEnd,
end: segmentEnd
}]
} else {
if (otherStart <= segmentEnd || otherEnd >= segmentStart) {
result = [{
start: segmentStart,
end: segmentEnd
}]
} else {
if (otherStart >= segmentStart && otherEnd <= segmentEnd) {
result = []
} else {
if (otherStart < segmentStart) {
result = [{
start: segmentStart,
end: otherStart
}]
} else {
if (otherEnd > segmentEnd) {
result = [{
start: otherEnd,
end: segmentEnd
}]
}
}
}
}
}
return result
}
function isNotEmptySegmentAsc(start, end, threshold) {
return end - start >= threshold
}
function isNotEmptySegmentDes(start, end, threshold) {
return start - end >= threshold
}
module.exports = BaseRangeContainer
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**********************************************!*\
!*** ./Scripts/viz/gauges/circular_gauge.js ***!
\**********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
_isFinite = isFinite,
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 3),
objectUtils = __webpack_require__( /*! ../../core/utils/object */ 30),
dxBaseGauge = __webpack_require__( /*! ./base_gauge */ 128).dxBaseGauge,
dxGauge = __webpack_require__( /*! ./common */ 191).dxGauge,
vizUtils = __webpack_require__( /*! ../core/utils */ 6),
_normalizeAngle = vizUtils.normalizeAngle,
_getCosAndSin = vizUtils.getCosAndSin,
polarTranslatorModule = __webpack_require__( /*! ../translators/polar_translator */ 340),
circularIndicatorsModule = __webpack_require__( /*! ./circular_indicators */ 523),
createIndicatorCreator = __webpack_require__( /*! ./common */ 191).createIndicatorCreator,
CircularRangeContainer = __webpack_require__( /*! ./circular_range_container */ 524),
ThemeManager = __webpack_require__( /*! ./theme_manager */ 334),
_abs = Math.abs,
_max = Math.max,
_min = Math.min,
_round = Math.round,
_each = $.each,
SHIFT_ANGLE = 90,
PI = Math.PI;
function getSides(startAngle, endAngle) {
var startCosSin = _getCosAndSin(startAngle),
endCosSin = _getCosAndSin(endAngle),
startCos = startCosSin.cos,
startSin = startCosSin.sin,
endCos = endCosSin.cos,
endSin = endCosSin.sin;
return {
left: startSin <= 0 && endSin >= 0 || startSin <= 0 && endSin <= 0 && startCos <= endCos || startSin >= 0 && endSin >= 0 && startCos >= endCos ? -1 : _min(startCos, endCos, 0),
right: startSin >= 0 && endSin <= 0 || startSin >= 0 && endSin >= 0 && startCos >= endCos || startSin <= 0 && endSin <= 0 && startCos <= endCos ? 1 : _max(startCos, endCos, 0),
up: startCos <= 0 && endCos >= 0 || startCos <= 0 && endCos <= 0 && startSin >= endSin || startCos >= 0 && endCos >= 0 && startSin <= endSin ? -1 : -_max(startSin, endSin, 0),
down: startCos >= 0 && endCos <= 0 || startCos >= 0 && endCos >= 0 && startSin <= endSin || startCos <= 0 && endCos <= 0 && startSin >= endSin ? 1 : -_min(startSin, endSin, 0)
}
}
var dxCircularGauge = dxGauge.inherit({
_rootClass: "dxg-circular-gauge",
_factoryMethods: {
rangeContainer: "createCircularRangeContainer",
indicator: "createCircularIndicator"
},
_gridSpacingFactor: 17,
_scaleTypes: {
type: "polarAxes",
drawingType: "circular"
},
_initScaleTranslator: function(range) {
return new polarTranslatorModule.PolarTranslator({
arg: range,
val: {}
}, this._canvas, {})
},
_getScaleTranslatorComponent: function(name) {
return this._scaleTranslator.getComponent(name)
},
_updateScaleTickIndent: function(scaleOptions) {
var indentFromTick = scaleOptions.label.indentFromTick,
length = scaleOptions.tick.length,
textParams = this._scale.measureLabels(),
tickCorrection = length;
if ("inside" === scaleOptions.orientation) {
tickCorrection = 0
} else {
if ("center" === scaleOptions.orientation) {
tickCorrection = .5 * length
}
}
scaleOptions.label.indentFromAxis = indentFromTick >= 0 ? indentFromTick + tickCorrection : indentFromTick - tickCorrection - _max(textParams.width, textParams.height);
this._scale.updateOptions(scaleOptions)
},
_updateScaleAngles: function() {
var angles = this._translator.getCodomain();
this._scaleTranslator.setAngles(SHIFT_ANGLE - angles[0], SHIFT_ANGLE - angles[1])
},
_setupCodomain: function() {
var sides, that = this,
geometry = that.option("geometry") || {},
startAngle = geometry.startAngle,
endAngle = geometry.endAngle;
startAngle = _isFinite(startAngle) ? _normalizeAngle(startAngle) : 225;
endAngle = _isFinite(endAngle) ? _normalizeAngle(endAngle) : -45;
if (_abs(startAngle - endAngle) < 1) {
endAngle -= 360;
sides = {
left: -1,
up: -1,
right: 1,
down: 1
}
} else {
startAngle < endAngle && (endAngle -= 360);
sides = getSides(startAngle, endAngle)
}
that._area = {
x: 0,
y: 0,
radius: 100,
startCoord: startAngle,
endCoord: endAngle,
sides: sides
};
that._translator.setCodomain(startAngle, endAngle)
},
_shiftScale: function(layout) {
var centerCoords, scaleTranslator = this._scaleTranslator,
scale = this._scale;
scaleTranslator.setCanvasDimension(2 * layout.radius);
scale.setTranslator(scaleTranslator.getComponent("arg"), scaleTranslator.getComponent("val"));
scale.draw();
centerCoords = scaleTranslator.getCenter();
scale.shift(layout.x - centerCoords.x, layout.y - centerCoords.y)
},
_getScaleLayoutValue: function() {
return this._area.radius
},
_getTicksOrientation: function(scaleOptions) {
return scaleOptions.orientation
},
_getTicksCoefficients: function(options) {
var coefs = {
inner: 0,
outer: 1
};
if ("inside" === options.orientation) {
coefs.inner = 1;
coefs.outer = 0
} else {
if ("center" === options.orientation) {
coefs.inner = coefs.outer = .5
}
}
return coefs
},
_correctScaleIndents: function(result, indentFromTick, textParams) {
if (indentFromTick >= 0) {
result.horizontalOffset = indentFromTick + textParams.width;
result.verticalOffset = indentFromTick + textParams.height
} else {
result.horizontalOffset = result.verticalOffset = 0;
result.min -= -indentFromTick + _max(textParams.width, textParams.height)
}
result.inverseHorizontalOffset = textParams.width / 2;
result.inverseVerticalOffset = textParams.height / 2
},
_measureMainElements: function(elements, scaleMeasurement) {
var that = this,
radius = that._area.radius,
maxRadius = 0,
minRadius = 1 / 0,
maxHorizontalOffset = 0,
maxVerticalOffset = 0,
maxInverseHorizontalOffset = 0,
maxInverseVerticalOffset = 0,
scale = that._scale;
_each(elements.concat(scale), function(_, element) {
var bounds = element.measure ? element.measure({
radius: radius - element.getOffset()
}) : scaleMeasurement;
bounds.min > 0 && (minRadius = _min(minRadius, bounds.min));
bounds.max > 0 && (maxRadius = _max(maxRadius, bounds.max));
bounds.horizontalOffset > 0 && (maxHorizontalOffset = _max(maxHorizontalOffset, bounds.max + bounds.horizontalOffset));
bounds.verticalOffset > 0 && (maxVerticalOffset = _max(maxVerticalOffset, bounds.max + bounds.verticalOffset));
bounds.inverseHorizontalOffset > 0 && (maxInverseHorizontalOffset = _max(maxInverseHorizontalOffset, bounds.inverseHorizontalOffset));
bounds.inverseVerticalOffset > 0 && (maxInverseVerticalOffset = _max(maxInverseVerticalOffset, bounds.inverseVerticalOffset))
});
maxHorizontalOffset = _max(maxHorizontalOffset - maxRadius, 0);
maxVerticalOffset = _max(maxVerticalOffset - maxRadius, 0);
return {
minRadius: minRadius,
maxRadius: maxRadius,
horizontalMargin: maxHorizontalOffset,
verticalMargin: maxVerticalOffset,
inverseHorizontalMargin: maxInverseHorizontalOffset,
inverseVerticalMargin: maxInverseVerticalOffset
}
},
_applyMainLayout: function(elements, scaleMeasurement) {
var x, y, measurements = this._measureMainElements(elements, scaleMeasurement),
area = this._area,
sides = area.sides,
margins = {
left: (sides.left < -.1 ? measurements.horizontalMargin : measurements.inverseHorizontalMargin) || 0,
right: (sides.right > .1 ? measurements.horizontalMargin : measurements.inverseHorizontalMargin) || 0,
top: (sides.up < -.1 ? measurements.verticalMargin : measurements.inverseVerticalMargin) || 0,
bottom: (sides.down > .1 ? measurements.verticalMargin : measurements.inverseVerticalMargin) || 0
},
rect = selectRectByAspectRatio(this._innerRect, (sides.down - sides.up) / (sides.right - sides.left), margins),
radius = _min(getWidth(rect) / (sides.right - sides.left), getHeight(rect) / (sides.down - sides.up));
radius = radius - measurements.maxRadius + area.radius;
x = rect.left - getWidth(rect) * sides.left / (sides.right - sides.left);
y = rect.top - getHeight(rect) * sides.up / (sides.down - sides.up);
area.x = _round(x);
area.y = _round(y);
area.radius = radius;
rect.left -= margins.left;
rect.right += margins.right;
rect.top -= margins.top;
rect.bottom += margins.bottom;
this._innerRect = rect
},
_getElementLayout: function(offset) {
return {
x: this._area.x,
y: this._area.y,
radius: _round(this._area.radius - offset)
}
},
_getApproximateScreenRange: function() {
var that = this,
area = that._area,
r = _min(that._canvas.width / (area.sides.right - area.sides.left), that._canvas.height / (area.sides.down - area.sides.up));
r > area.totalRadius && (r = area.totalRadius);
r = .8 * r;
return -that._translator.getCodomainRange() * r * PI / 180
},
_getDefaultSize: function() {
return {
width: 300,
height: 300
}
},
_factory: objectUtils.clone(dxBaseGauge.prototype._factory)
});
function getWidth(rect) {
return rect.right - rect.left
}
function getHeight(rect) {
return rect.bottom - rect.top
}
function selectRectByAspectRatio(srcRect, aspectRatio, margins) {
var selfAspectRatio, rect = $.extend({}, srcRect),
width = 0,
height = 0;
margins = margins || {};
if (aspectRatio > 0) {
rect.left += margins.left || 0;
rect.right -= margins.right || 0;
rect.top += margins.top || 0;
rect.bottom -= margins.bottom || 0;
if (getWidth(rect) > 0 && getHeight(rect) > 0) {
selfAspectRatio = getHeight(rect) / getWidth(rect);
if (selfAspectRatio > 1) {
aspectRatio < selfAspectRatio ? width = getWidth(rect) : height = getHeight(rect)
} else {
aspectRatio > selfAspectRatio ? height = getHeight(rect) : width = getWidth(rect)
}
width > 0 || (width = height / aspectRatio);
height > 0 || (height = width * aspectRatio);
width = (getWidth(rect) - width) / 2;
height = (getHeight(rect) - height) / 2;
rect.left += width;
rect.right -= width;
rect.top += height;
rect.bottom -= height
} else {
rect.left = rect.right = (rect.left + rect.right) / 2;
rect.top = rect.bottom = (rect.top + rect.bottom) / 2
}
}
return rect
}
dxCircularGauge._TESTS_selectRectByAspectRatio = selectRectByAspectRatio;
var indicators = dxCircularGauge.prototype._factory.indicators = {};
dxCircularGauge.prototype._factory.createIndicator = createIndicatorCreator(indicators);
indicators._default = circularIndicatorsModule._default;
indicators.rectangleneedle = circularIndicatorsModule.rectangleneedle;
indicators.triangleneedle = circularIndicatorsModule.triangleneedle;
indicators.twocolorneedle = circularIndicatorsModule.twocolorneedle;
indicators.trianglemarker = circularIndicatorsModule.trianglemarker;
indicators.textcloud = circularIndicatorsModule.textcloud;
indicators.rangebar = circularIndicatorsModule.rangebar;
dxCircularGauge.prototype._factory.RangeContainer = CircularRangeContainer;
dxCircularGauge.prototype._factory.ThemeManager = ThemeManager.inherit({
_subTheme: "_circular"
});
registerComponent("dxCircularGauge", dxCircularGauge);
module.exports = dxCircularGauge
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*********************************************!*\
!*** ./Scripts/viz/gauges/theme_manager.js ***!
\*********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
_extend = $.extend,
BaseThemeManager = __webpack_require__( /*! ../core/base_theme_manager */ 103).BaseThemeManager;
var ThemeManager = BaseThemeManager.inherit({
_themeSection: "gauge",
_fontFields: ["scale.label.font", "valueIndicators.rangebar.text.font", "valueIndicators.textcloud.text.font", "title.font", "title.subtitle.font", "tooltip.font", "indicator.text.font", "loadingIndicator.font", "export.font"],
_initializeTheme: function() {
var subTheme, that = this;
if (that._subTheme) {
subTheme = _extend(true, {}, that._theme[that._subTheme], that._theme);
_extend(true, that._theme, subTheme)
}
that.callBase.apply(that, arguments)
}
});
module.exports = ThemeManager
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************************!*\
!*** ./Scripts/viz/series/points/candlestick_point.js ***!
\********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
symbolPoint = __webpack_require__( /*! ./symbol_point */ 104),
barPoint = __webpack_require__( /*! ./bar_point */ 194),
_isNumeric = $.isNumeric,
_extend = $.extend,
_math = Math,
_abs = _math.abs,
_min = _math.min,
_max = _math.max,
_round = _math.round,
DEFAULT_FINANCIAL_TRACKER_MARGIN = 2;
module.exports = _extend({}, barPoint, {
_getContinuousPoints: function(minValueName, maxValueName) {
var points, that = this,
x = that.x,
createPoint = that._options.rotated ? function(x, y) {
return [y, x]
} : function(x, y) {
return [x, y]
},
width = that.width,
min = that[minValueName],
max = that[maxValueName];
if (min === max) {
points = [].concat(createPoint(x, that.highY)).concat(createPoint(x, that.lowY)).concat(createPoint(x, that.closeY)).concat(createPoint(x - width / 2, that.closeY)).concat(createPoint(x + width / 2, that.closeY)).concat(createPoint(x, that.closeY))
} else {
points = [].concat(createPoint(x, that.highY)).concat(createPoint(x, max)).concat(createPoint(x + width / 2, max)).concat(createPoint(x + width / 2, min)).concat(createPoint(x, min)).concat(createPoint(x, that.lowY)).concat(createPoint(x, min)).concat(createPoint(x - width / 2, min)).concat(createPoint(x - width / 2, max)).concat(createPoint(x, max))
}
return points
},
_getCategoryPoints: function(y) {
var that = this,
x = that.x,
createPoint = that._options.rotated ? function(x, y) {
return [y, x]
} : function(x, y) {
return [x, y]
};
return [].concat(createPoint(x, that.highY)).concat(createPoint(x, that.lowY)).concat(createPoint(x, y)).concat(createPoint(x - that.width / 2, y)).concat(createPoint(x + that.width / 2, y)).concat(createPoint(x, y))
},
_getPoints: function() {
var points, minValueName, maxValueName, that = this,
openValue = that.openValue,
closeValue = that.closeValue;
if (_isNumeric(openValue) && _isNumeric(closeValue)) {
minValueName = openValue > closeValue ? "closeY" : "openY";
maxValueName = openValue > closeValue ? "openY" : "closeY";
points = that._getContinuousPoints(minValueName, maxValueName)
} else {
if (openValue === closeValue) {
points = [that.x, that.highY, that.x, that.lowY]
} else {
points = that._getCategoryPoints(_isNumeric(openValue) ? that.openY : that.closeY)
}
}
return points
},
getColor: function() {
var that = this;
return that._isReduction ? that._options.reduction.color : that._styles.normal.stroke || that.series.getColor()
},
_drawMarkerInGroup: function(group, attributes, renderer) {
var that = this;
that.graphic = renderer.path(that._getPoints(), "area").attr({
"stroke-linecap": "square"
}).attr(attributes).data({
"chart-data-point": that
}).sharp().append(group)
},
_fillStyle: function() {
var that = this,
styles = that._options.styles;
if (that._isReduction && that._isPositive) {
that._styles = styles.reductionPositive
} else {
if (that._isReduction) {
that._styles = styles.reduction
} else {
if (that._isPositive) {
that._styles = styles.positive
} else {
that._styles = styles
}
}
}
},
_getMinTrackerWidth: function() {
return 2 + 2 * this._styles.normal["stroke-width"]
},
correctCoordinates: function(correctOptions) {
var minWidth = this._getMinTrackerWidth(),
maxWidth = 10,
width = correctOptions.width;
width = width < minWidth ? minWidth : width > maxWidth ? maxWidth : width;
this.width = width + width % 2;
this.xCorrection = correctOptions.offset
},
_getMarkerGroup: function(group) {
var markerGroup, that = this;
if (that._isReduction && that._isPositive) {
markerGroup = group.reductionPositiveMarkersGroup
} else {
if (that._isReduction) {
markerGroup = group.reductionMarkersGroup
} else {
if (that._isPositive) {
markerGroup = group.defaultPositiveMarkersGroup
} else {
markerGroup = group.defaultMarkersGroup
}
}
}
return markerGroup
},
_drawMarker: function(renderer, group) {
this._drawMarkerInGroup(this._getMarkerGroup(group), this._getStyle(), renderer)
},
_getSettingsForTracker: function() {
var x, y, width, height, that = this,
highY = that.highY,
lowY = that.lowY,
rotated = that._options.rotated;
if (highY === lowY) {
highY = rotated ? highY + DEFAULT_FINANCIAL_TRACKER_MARGIN : highY - DEFAULT_FINANCIAL_TRACKER_MARGIN;
lowY = rotated ? lowY - DEFAULT_FINANCIAL_TRACKER_MARGIN : lowY + DEFAULT_FINANCIAL_TRACKER_MARGIN
}
if (rotated) {
x = _min(lowY, highY);
y = that.x - that.width / 2;
width = _abs(lowY - highY);
height = that.width
} else {
x = that.x - that.width / 2;
y = _min(lowY, highY);
width = that.width;
height = _abs(lowY - highY)
}
return {
x: x,
y: y,
width: width,
height: height
}
},
_getGraphicBbox: function() {
var that = this,
rotated = that._options.rotated,
x = that.x,
width = that.width,
lowY = that.lowY,
highY = that.highY;
return {
x: !rotated ? x - _round(width / 2) : lowY,
y: !rotated ? highY : x - _round(width / 2),
width: !rotated ? width : highY - lowY,
height: !rotated ? lowY - highY : width
}
},
getTooltipParams: function(location) {
var that = this;
if (that.graphic) {
var x, y, min, max, minValue = _min(that.lowY, that.highY),
maxValue = _max(that.lowY, that.highY),
visibleAreaX = that.translators.x.getCanvasVisibleArea(),
visibleAreaY = that.translators.y.getCanvasVisibleArea(),
edgeLocation = "edge" === location;
if (!that._options.rotated) {
min = _max(visibleAreaY.min, minValue);
max = _min(visibleAreaY.max, maxValue);
x = that.x;
y = edgeLocation ? min : min + (max - min) / 2
} else {
min = _max(visibleAreaX.min, minValue);
max = _min(visibleAreaX.max, maxValue);
y = that.x;
x = edgeLocation ? max : min + (max - min) / 2
}
return {
x: x,
y: y,
offset: 0
}
}
},
hasValue: function() {
return null !== this.highValue && null !== this.lowValue
},
_translate: function() {
var centerValue, height, that = this,
rotated = that._options.rotated,
translators = that.translators,
argTranslator = rotated ? translators.y : translators.x,
valTranslator = rotated ? translators.x : translators.y;
that.vx = that.vy = that.x = argTranslator.translate(that.argument) + (that.xCorrection || 0);
that.openY = null !== that.openValue ? valTranslator.translate(that.openValue) : null;
that.highY = valTranslator.translate(that.highValue);
that.lowY = valTranslator.translate(that.lowValue);
that.closeY = null !== that.closeValue ? valTranslator.translate(that.closeValue) : null;
height = _abs(that.lowY - that.highY);
centerValue = _min(that.lowY, that.highY) + _abs(that.lowY - that.highY) / 2;
that._calculateVisibility(!rotated ? that.x : centerValue, !rotated ? centerValue : that.x)
},
getCrosshairData: function(x, y) {
var yValue, coords, that = this,
rotated = that._options.rotated,
origY = rotated ? x : y,
argument = that.argument,
coord = "low";
if (_abs(that.lowY - origY) < _abs(that.closeY - origY)) {
yValue = that.lowY
} else {
yValue = that.closeY;
coord = "close"
}
if (_abs(yValue - origY) >= _abs(that.openY - origY)) {
yValue = that.openY;
coord = "open"
}
if (_abs(yValue - origY) >= _abs(that.highY - origY)) {
yValue = that.highY;
coord = "high"
}
if (rotated) {
coords = {
y: that.vy,
x: yValue,
xValue: that[coord + "Value"],
yValue: argument
}
} else {
coords = {
x: that.vx,
y: yValue,
xValue: argument,
yValue: that[coord + "Value"]
}
}
coords.axis = that.series.axis;
return coords
},
_updateData: function(data) {
var that = this,
label = that._label,
reductionColor = this._options.reduction.color;
that.value = that.initialValue = data.reductionValue;
that.originalValue = data.value;
that.lowValue = that.originalLowValue = data.lowValue;
that.highValue = that.originalHighValue = data.highValue;
that.openValue = that.originalOpenValue = data.openValue;
that.closeValue = that.originalCloseValue = data.closeValue;
that._isPositive = data.openValue < data.closeValue;
that._isReduction = data.isReduction;
if (that._isReduction) {
label.setColor(reductionColor)
}
},
_updateMarker: function(animationEnabled, style, group) {
var that = this,
graphic = that.graphic;
graphic.attr({
points: that._getPoints()
}).attr(style || that._getStyle()).sharp();
group && graphic.append(that._getMarkerGroup(group))
},
_getLabelFormatObject: function() {
var that = this;
return {
openValue: that.openValue,
highValue: that.highValue,
lowValue: that.lowValue,
closeValue: that.closeValue,
reductionValue: that.initialValue,
argument: that.initialArgument,
value: that.initialValue,
seriesName: that.series.name,
originalOpenValue: that.originalOpenValue,
originalCloseValue: that.originalCloseValue,
originalLowValue: that.originalLowValue,
originalHighValue: that.originalHighValue,
originalArgument: that.originalArgument,
point: that
}
},
_getFormatObject: function(tooltip) {
var that = this,
highValue = tooltip.formatValue(that.highValue),
openValue = tooltip.formatValue(that.openValue),
closeValue = tooltip.formatValue(that.closeValue),
lowValue = tooltip.formatValue(that.lowValue),
symbolMethods = symbolPoint,
formatObject = symbolMethods._getFormatObject.call(that, tooltip);
return _extend({}, formatObject, {
valueText: "h: " + highValue + ("" !== openValue ? " o: " + openValue : "") + ("" !== closeValue ? " c: " + closeValue : "") + " l: " + lowValue,
highValueText: highValue,
openValueText: openValue,
closeValueText: closeValue,
lowValueText: lowValue
})
}
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************!*\
!*** ./Scripts/viz/series/points/label.js ***!
\********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
_format = __webpack_require__( /*! ../../core/format */ 162),
vizUtils = __webpack_require__( /*! ../../core/utils */ 6),
_degreesToRadians = vizUtils.degreesToRadians,
_patchFontOptions = vizUtils.patchFontOptions,
_round = Math.round,
_getCosAndSin = vizUtils.getCosAndSin,
_rotateBBox = vizUtils.rotateBBox,
LABEL_BACKGROUND_PADDING_X = 8,
LABEL_BACKGROUND_PADDING_Y = 4;
function getClosestCoord(point, coords) {
var closestCoord, closestDistance = 1 / 0;
$.each(coords, function(_, coord) {
var x = point[0] - coord[0],
y = point[1] - coord[1],
distance = x * x + y * y;
if (distance < closestDistance) {
closestDistance = distance;
closestCoord = coord
}
});
return closestCoord
}
var barPointStrategy = {
isLabelInside: function(labelPoint, figure) {
return labelPoint.x >= figure.x && labelPoint.x <= figure.x + figure.width && labelPoint.y >= figure.y && labelPoint.y <= figure.y + figure.height
},
prepareLabelPoints: function(points) {
return points
},
getFigureCenter: function(figure) {
return [figure.x + figure.width / 2, figure.y + figure.height / 2]
},
findFigurePoint: function(figure, labelPoint) {
var figureCenter = barPointStrategy.getFigureCenter(figure),
point = getClosestCoord(labelPoint, [
[figure.x, figureCenter[1]],
[figureCenter[0], figure.y + figure.height],
[figure.x + figure.width, figureCenter[1]],
[figureCenter[0], figure.y]
]);
return [_round(point[0]), _round(point[1])]
}
};
var symbolPointStrategy = {
isLabelInside: function() {
return false
},
prepareLabelPoints: barPointStrategy.prepareLabelPoints,
getFigureCenter: function(figure) {
return [figure.x, figure.y]
},
findFigurePoint: function(figure, labelPoint) {
var angle = Math.atan2(figure.y - labelPoint[1], labelPoint[0] - figure.x);
return [_round(figure.x + figure.r * Math.cos(angle)), _round(figure.y - figure.r * Math.sin(angle))]
}
};
var piePointStrategy = {
isLabelInside: function(_0, _1, isOutside) {
return !isOutside
},
prepareLabelPoints: function(points, center, angle) {
var rotatedPoints = [],
x0 = center[0],
y0 = center[1],
cossin = _getCosAndSin(angle || 0);
$.each(points, function(_, point) {
rotatedPoints.push([_round((point[0] - x0) * cossin.cos + (point[1] - y0) * cossin.sin + x0), _round(-(point[0] - x0) * cossin.sin + (point[1] - y0) * cossin.cos + y0)])
});
return rotatedPoints
},
getFigureCenter: symbolPointStrategy.getFigureCenter,
findFigurePoint: function(figure, labelPoint) {
var x = figure.x + (figure.y - labelPoint[1]) / Math.tan(_degreesToRadians(figure.angle)),
point = [figure.x, figure.y];
if (figure.x <= x && x <= labelPoint[0] || figure.x >= x && x >= labelPoint[0]) {
point.push(_round(x), labelPoint[1])
}
return point
}
};
function selectStrategy(figure) {
return void 0 !== figure.angle && piePointStrategy || void 0 !== figure.r && symbolPointStrategy || barPointStrategy
}
function disposeItem(obj, field) {
obj[field] && obj[field].dispose();
obj[field] = null
}
function checkBackground(background) {
return background && (background.fill && "none" !== background.fill || background["stroke-width"] > 0 && background.stroke && "none" !== background.stroke)
}
function checkConnector(connector) {
return connector && connector["stroke-width"] > 0 && connector.stroke && "none" !== connector.stroke
}
function formatText(data, options) {
data.valueText = _format(data.value, options);
data.argumentText = _format(data.argument, {
format: options.argumentFormat,
precision: options.argumentPrecision
});
if (void 0 !== data.percent) {
data.percentText = _format(data.percent, {
format: {
type: "percent",
precision: options.format && options.format.percentPrecision || options.percentPrecision
}
})
}
if (void 0 !== data.total) {
data.totalText = _format(data.total, options)
}
if (void 0 !== data.openValue) {
data.openValueText = _format(data.openValue, options)
}
if (void 0 !== data.closeValue) {
data.closeValueText = _format(data.closeValue, options)
}
if (void 0 !== data.lowValue) {
data.lowValueText = _format(data.lowValue, options)
}
if (void 0 !== data.highValue) {
data.highValueText = _format(data.highValue, options)
}
if (void 0 !== data.reductionValue) {
data.reductionValueText = _format(data.reductionValue, options)
}
return options.customizeText ? options.customizeText.call(data, data) : data.valueText
}
function Label(renderSettings) {
this._renderer = renderSettings.renderer;
this._container = renderSettings.labelsGroup;
this._point = renderSettings.point
}
Label.prototype = {
constructor: Label,
_setVisibility: function(value, state) {
this._group && this._group.attr({
visibility: value
});
this._visible = state
},
clearVisibility: function() {
this._setVisibility(null, true)
},
hide: function() {
this._setVisibility("hidden", false)
},
show: function() {
var that = this;
if (that._point.hasValue()) {
that._draw();
that._point.correctLabelPosition(that)
}
},
isVisible: function() {
return this._visible
},
setColor: function(color) {
this._color = color
},
setOptions: function(options) {
this._options = options
},
setData: function(data) {
this._data = data
},
setDataField: function(fieldName, fieldValue) {
this._data = this._data || {};
this._data[fieldName] = fieldValue
},
getData: function() {
return this._data
},
setFigureToDrawConnector: function(figure) {
this._figure = figure
},
dispose: function() {
var that = this;
disposeItem(that, "_group");
that._data = that._options = that._textContent = that._visible = that._insideGroup = that._text = that._background = that._connector = that._figure = null
},
_draw: function() {
var that = this,
renderer = that._renderer,
container = that._container,
options = that._options || {},
text = that._textContent = formatText(that._data, that._options) || null;
that.clearVisibility();
if (text) {
if (!that._group) {
that._group = renderer.g().append(container);
that._insideGroup = renderer.g().append(that._group);
that._text = renderer.text("", 0, 0).append(that._insideGroup)
}
that._text.css(options.attributes ? _patchFontOptions(options.attributes.font) : {});
if (checkBackground(options.background)) {
that._background = that._background || renderer.rect().append(that._insideGroup).toBackground();
that._background.attr(options.background);
that._color && that._background.attr({
fill: that._color
})
} else {
disposeItem(that, "_background")
}
if (checkConnector(options.connector)) {
that._connector = that._connector || renderer.path([], "line").sharp().append(that._group).toBackground();
that._connector.attr(options.connector);
that._color && that._connector.attr({
stroke: that._color
})
} else {
disposeItem(that, "_connector")
}
that._text.attr({
text: text
});
that._updateBackground(that._text.getBBox());
that._setVisibility("visible", true)
} else {
that.hide()
}
return that
},
_updateBackground: function(bbox) {
var that = this;
that._textSize = [bbox.width, bbox.height];
if (that._background) {
bbox.x -= LABEL_BACKGROUND_PADDING_X;
bbox.y -= LABEL_BACKGROUND_PADDING_Y;
bbox.width += 2 * LABEL_BACKGROUND_PADDING_X;
bbox.height += 2 * LABEL_BACKGROUND_PADDING_Y;
that._background.attr(bbox)
}
if (that._options.rotationAngle) {
that._insideGroup.rotate(that._options.rotationAngle, bbox.x + bbox.width / 2, bbox.y + bbox.height / 2);
bbox = _rotateBBox(bbox, [bbox.x + bbox.width / 2, bbox.y + bbox.height / 2], -that._options.rotationAngle)
}
that._bbox = bbox
},
_getConnectorPoints: function() {
var labelPoint, figurePoint, xc, yc, that = this,
figure = that._figure,
strategy = selectStrategy(figure),
bbox = that.getBoundingRect(),
points = [];
if (!strategy.isLabelInside(bbox, figure, "inside" !== that._options.position)) {
xc = bbox.x + bbox.width / 2;
yc = bbox.y + bbox.height / 2;
points = strategy.prepareLabelPoints([
[xc, yc - that._textSize[1] / 2],
[xc + that._textSize[0] / 2, yc],
[xc, yc + that._textSize[1] / 2],
[xc - that._textSize[0] / 2, yc]
], [xc, yc], -that._options.rotationAngle || 0);
labelPoint = getClosestCoord(strategy.getFigureCenter(figure), points);
labelPoint = [_round(labelPoint[0]), _round(labelPoint[1])];
figurePoint = strategy.findFigurePoint(figure, labelPoint);
points = figurePoint.concat(labelPoint)
}
return points
},
fit: function(maxWidth) {
this._text && this._text.applyEllipsis(maxWidth);
this._updateBackground(this._text.getBBox())
},
setTrackerData: function(point) {
this._text.data({
"chart-data-point": point
});
this._background && this._background.data({
"chart-data-point": point
})
},
shift: function(x, y) {
var that = this;
if (that._textContent) {
that._insideGroup.attr({
translateX: that._x = _round(x - that._bbox.x),
translateY: that._y = _round(y - that._bbox.y)
});
if (that._connector) {
that._connector.attr({
points: that._getConnectorPoints()
})
}
}
return that
},
getBoundingRect: function() {
var bbox = this._bbox;
return this._textContent ? {
x: bbox.x + this._x,
y: bbox.y + this._y,
width: bbox.width,
height: bbox.height
} : {}
},
getLayoutOptions: function() {
var options = this._options;
return {
alignment: options.alignment,
background: checkBackground(options.background),
horizontalOffset: options.horizontalOffset,
verticalOffset: options.verticalOffset,
radialOffset: options.radialOffset,
position: options.position
}
}
};
exports.Label = Label;
Label._DEBUG_formatText = formatText
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!************************************************!*\
!*** ./Scripts/viz/series/points/pie_point.js ***!
\************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
CONNECTOR_LENGTH = 20,
symbolPoint = __webpack_require__( /*! ./symbol_point */ 104),
_extend = $.extend,
_round = Math.round,
_sqrt = Math.sqrt,
_acos = Math.acos,
DEG = 180 / Math.PI,
_abs = Math.abs,
vizUtils = __webpack_require__( /*! ../../core/utils */ 6),
_normalizeAngle = vizUtils.normalizeAngle,
_getCosAndSin = vizUtils.getCosAndSin,
commonUtils = __webpack_require__( /*! ../../../core/utils/common */ 2),
_isDefined = commonUtils.isDefined,
getVerticallyShiftedAngularCoords = vizUtils.getVerticallyShiftedAngularCoords,
INDENT_FROM_PIE = __webpack_require__( /*! ../../components/consts */ 126).pieLabelIndent;
module.exports = _extend({}, symbolPoint, {
_updateData: function(data) {
var that = this;
symbolPoint._updateData.call(this, data);
that._visible = true;
that.minValue = that.initialMinValue = that.originalMinValue = _isDefined(data.minValue) ? data.minValue : 0
},
animate: function(complete, duration, step) {
var that = this;
that.graphic.animate({
x: that.centerX,
y: that.centerY,
outerRadius: that.radiusOuter,
innerRadius: that.radiusInner,
startAngle: that.toAngle,
endAngle: that.fromAngle
}, {
partitionDuration: duration,
step: step
}, complete)
},
correctPosition: function(correction) {
var that = this;
that.correctRadius(correction);
that.correctLabelRadius(correction.radiusOuter);
that.centerX = correction.centerX;
that.centerY = correction.centerY
},
correctRadius: function(correction) {
this.radiusInner = correction.radiusInner;
this.radiusOuter = correction.radiusOuter
},
correctLabelRadius: function(radiusLabels) {
this.radiusLabels = radiusLabels
},
correctValue: function(correction, percent, base) {
var that = this;
that.value = (base || that.initialValue) + correction;
that.minValue = correction;
that.percent = percent;
that._label.setDataField("percent", percent)
},
setMaxLabelLength: function(maxLabelLength) {
this._maxLabelLength = maxLabelLength
},
_updateLabelData: function() {
this._label.setData(this._getLabelFormatObject())
},
_getShiftLabelCoords: function() {
var that = this,
bbox = that._label.getBoundingRect(),
coord = that._getLabelCoords(that._label),
visibleArea = that._getVisibleArea();
if (that._isLabelDrawingWithoutPoints) {
return that._checkLabelPosition(coord, bbox, visibleArea)
} else {
return that._getLabelExtraCoord(coord, that._checkVerticalLabelPosition(coord, bbox, visibleArea), bbox)
}
},
_getLabelPosition: function(options) {
return options.position
},
_getLabelCoords: function(label) {
var rad, x, that = this,
bbox = label.getBoundingRect(),
options = label.getLayoutOptions(),
angleFunctions = _getCosAndSin(that.middleAngle),
position = that._getLabelPosition(options),
radiusInner = that.radiusInner,
radiusOuter = that.radiusOuter,
radiusLabels = that.radiusLabels;
if ("inside" === position) {
rad = radiusInner + (radiusOuter - radiusInner) / 2 + options.radialOffset;
x = that.centerX + rad * angleFunctions.cos - bbox.width / 2
} else {
rad = radiusLabels + options.radialOffset + INDENT_FROM_PIE;
if (angleFunctions.cos > .1) {
x = that.centerX + rad * angleFunctions.cos
} else {
if (angleFunctions.cos < -.1) {
x = that.centerX + rad * angleFunctions.cos - bbox.width
} else {
x = that.centerX + rad * angleFunctions.cos - bbox.width / 2
}
}
}
return {
x: x,
y: _round(that.centerY - rad * angleFunctions.sin - bbox.height / 2)
}
},
_getColumnsCoord: function(coord) {
var x, that = this,
label = that._label,
bbox = label.getBoundingRect(),
options = label.getLayoutOptions(),
rad = that.radiusLabels + options.radialOffset,
visibleArea = that._getVisibleArea(),
rightBorderX = visibleArea.maxX - bbox.width,
leftBorderX = visibleArea.minX,
angleOfPoint = _normalizeAngle(that.middleAngle);
if ("columns" !== options.position) {
return coord
}
rad += CONNECTOR_LENGTH;
if (angleOfPoint < 90 || angleOfPoint >= 270) {
x = that._maxLabelLength ? that.centerX + rad + that._maxLabelLength - bbox.width : rightBorderX;
x = x > rightBorderX ? rightBorderX : x
} else {
x = that._maxLabelLength ? that.centerX - rad - that._maxLabelLength : leftBorderX;
x = x < leftBorderX ? leftBorderX : x
}
coord.x = x;
return coord
},
drawLabel: function(translators) {
this.translate(translators);
this._isLabelDrawingWithoutPoints = true;
this._drawLabel();
this._isLabelDrawingWithoutPoints = false
},
updateLabelCoord: function() {
var that = this,
bbox = that._label.getBoundingRect(),
coord = that._getColumnsCoord(bbox);
coord = that._checkHorizontalLabelPosition(coord, bbox, that._getVisibleArea());
that._label.shift(_round(coord.x), _round(bbox.y))
},
_checkVerticalLabelPosition: function(coord, box, visibleArea) {
var x = coord.x,
y = coord.y;
if (coord.y + box.height > visibleArea.maxY) {
y = visibleArea.maxY - box.height
} else {
if (coord.y < visibleArea.minY) {
y = visibleArea.minY
}
}
return {
x: x,
y: y
}
},
_getLabelExtraCoord: function(coord, shiftCoord, box) {
return coord.y !== shiftCoord.y ? getVerticallyShiftedAngularCoords({
x: coord.x,
y: coord.y,
width: box.width,
height: box.height
}, shiftCoord.y - coord.y, {
x: this.centerX,
y: this.centerY
}) : coord
},
_checkHorizontalLabelPosition: function(coord, box, visibleArea) {
var x = coord.x,
y = coord.y;
if (coord.x + box.width > visibleArea.maxX) {
x = visibleArea.maxX - box.width
} else {
if (coord.x < visibleArea.minX) {
x = visibleArea.minX
}
}
return {
x: x,
y: y
}
},
setLabelEllipsis: function() {
var that = this,
bbox = that._label.getBoundingRect(),
coord = that._checkHorizontalLabelPosition(bbox, bbox, that._getVisibleArea());
that._label.fit(bbox.width - _abs(coord.x - bbox.x))
},
setLabelTrackerData: function() {
this._label.setTrackerData(this)
},
_checkLabelPosition: function(coord, bbox, visibleArea) {
coord = this._checkHorizontalLabelPosition(coord, bbox, visibleArea);
return this._checkVerticalLabelPosition(coord, bbox, visibleArea)
},
getBoundaryCoords: function() {
var that = this,
rad = that.radiusOuter,
seriesStyle = that._options.styles.normal,
strokeWidthBy2 = seriesStyle["stroke-width"] / 2,
borderWidth = that.series.getOptions().containerBackgroundColor === seriesStyle.stroke ? _round(strokeWidthBy2) : _round(-strokeWidthBy2),
angleFunctions = _getCosAndSin(_round(that.middleAngle));
return {
x: _round(that.centerX + (rad - borderWidth) * angleFunctions.cos),
y: _round(that.centerY - (rad - borderWidth) * angleFunctions.sin)
}
},
_getLabelConnector: function() {
var coords = this.getBoundaryCoords();
coords.angle = this.middleAngle;
return coords
},
_drawMarker: function(renderer, group, animationEnabled, firstDrawing) {
var that = this,
radiusOuter = that.radiusOuter,
radiusInner = that.radiusInner,
fromAngle = that.fromAngle,
toAngle = that.toAngle;
if (animationEnabled) {
radiusInner = radiusOuter = 0;
if (!firstDrawing) {
fromAngle = toAngle = that.shiftedAngle
}
}
that.graphic = renderer.arc(that.centerX, that.centerY, radiusInner, radiusOuter, toAngle, fromAngle).attr({
"stroke-linejoin": "round"
}).attr(that._getStyle()).data({
"chart-data-point": that
}).sharp().append(group)
},
getTooltipParams: function() {
var that = this,
angleFunctions = _getCosAndSin(that.middleAngle),
radiusInner = that.radiusInner,
radiusOuter = that.radiusOuter;
return {
x: that.centerX + (radiusInner + (radiusOuter - radiusInner) / 2) * angleFunctions.cos,
y: that.centerY - (radiusInner + (radiusOuter - radiusInner) / 2) * angleFunctions.sin,
offset: 0
}
},
_translate: function(translator) {
var that = this,
angle = that.shiftedAngle || 0,
value = that.value,
minValue = that.minValue;
that.fromAngle = translator.translate(minValue) + angle;
that.toAngle = translator.translate(value) + angle;
that.middleAngle = translator.translate((value - minValue) / 2 + minValue) + angle;
if (!that.isVisible()) {
that.middleAngle = that.toAngle = that.fromAngle = that.fromAngle || angle
}
},
_getMarkerVisibility: function() {
return true
},
_updateMarker: function(animationEnabled, style) {
var that = this;
style = style || that._getStyle();
if (!animationEnabled) {
style = _extend({
x: that.centerX,
y: that.centerY,
outerRadius: that.radiusOuter,
innerRadius: that.radiusInner,
startAngle: that.toAngle,
endAngle: that.fromAngle
}, style)
}
that.graphic.attr(style).sharp()
},
getLegendStyles: function() {
return this._styles.legendStyles
},
isInVisibleArea: function() {
return true
},
hide: function() {
var that = this;
if (that._visible) {
that._visible = false;
that.hideTooltip();
that._options.visibilityChanged(that)
}
},
show: function() {
var that = this;
if (!that._visible) {
that._visible = true;
that._options.visibilityChanged(that)
}
},
setInvisibility: function() {
this._label.hide()
},
isVisible: function() {
return this._visible
},
_getFormatObject: function(tooltip) {
var formatObject = symbolPoint._getFormatObject.call(this, tooltip),
percent = this.percent;
formatObject.percent = percent;
formatObject.percentText = tooltip.formatValue(percent, "percent");
return formatObject
},
getColor: function() {
return this._styles.normal.fill
},
coordsIn: function(x, y) {
var angle, that = this,
lx = x - that.centerX,
ly = y - that.centerY,
r = _sqrt(lx * lx + ly * ly),
fromAngle = that.fromAngle % 360,
toAngle = that.toAngle % 360;
if (r < that.radiusInner || r > that.radiusOuter || 0 === r) {
return false
}
angle = _acos(lx / r) * DEG * (ly > 0 ? -1 : 1);
if (angle < 0) {
angle += 360
}
if (fromAngle === toAngle && _abs(that.toAngle - that.fromAngle) > 1e-4) {
return true
} else {
return fromAngle >= toAngle ? angle <= fromAngle && angle >= toAngle : !(angle >= fromAngle && angle <= toAngle)
}
}
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*********************************************************!*\
!*** ./Scripts/viz/series/points/range_symbol_point.js ***!
\*********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
commonUtils = __webpack_require__( /*! ../../../core/utils/common */ 2),
labelModule = __webpack_require__( /*! ./label */ 336),
symbolPoint = __webpack_require__( /*! ./symbol_point */ 104),
_extend = $.extend,
_isDefined = commonUtils.isDefined,
_math = Math,
_abs = _math.abs,
_min = _math.min,
_max = _math.max,
_round = _math.round,
DEFAULT_IMAGE_WIDTH = 20,
DEFAULT_IMAGE_HEIGHT = 20;
module.exports = _extend({}, symbolPoint, {
deleteLabel: function() {
var that = this;
that._topLabel.dispose();
that._topLabel = null;
that._bottomLabel.dispose();
that._bottomLabel = null
},
hideMarker: function(type) {
var graphic = this.graphic,
marker = graphic && graphic[type + "Marker"],
label = this["_" + type + "Label"];
if (marker && "hidden" !== marker.attr("visibility")) {
marker.attr({
visibility: "hidden"
})
}
label.hide()
},
setInvisibility: function() {
this.hideMarker("top");
this.hideMarker("bottom")
},
clearVisibility: function() {
var that = this,
graphic = that.graphic,
topMarker = graphic && graphic.topMarker,
bottomMarker = graphic && graphic.bottomMarker;
if (topMarker && topMarker.attr("visibility")) {
topMarker.attr({
visibility: null
})
}
if (bottomMarker && bottomMarker.attr("visibility")) {
bottomMarker.attr({
visibility: null
})
}
that._topLabel.clearVisibility();
that._bottomLabel.clearVisibility()
},
clearMarker: function() {
var that = this,
graphic = that.graphic,
topMarker = graphic && graphic.topMarker,
bottomMarker = graphic && graphic.bottomMarker,
emptySettings = that._emptySettings;
topMarker && topMarker.attr(emptySettings);
bottomMarker && bottomMarker.attr(emptySettings)
},
_getLabelPosition: function(markerType) {
var position, labelsInside = "inside" === this._options.label.position;
if (!this._options.rotated) {
position = "top" === markerType ^ labelsInside ? "top" : "bottom"
} else {
position = "top" === markerType ^ labelsInside ? "right" : "left"
}
return position
},
_getLabelMinFormatObject: function() {
var that = this;
return {
index: 0,
argument: that.initialArgument,
value: that.initialMinValue,
seriesName: that.series.name,
originalValue: that.originalMinValue,
originalArgument: that.originalArgument,
point: that
}
},
_updateLabelData: function() {
var maxFormatObject = this._getLabelFormatObject();
maxFormatObject.index = 1;
this._topLabel.setData(maxFormatObject);
this._bottomLabel.setData(this._getLabelMinFormatObject())
},
_updateLabelOptions: function() {
var that = this,
options = this._options.label;
(!that._topLabel || !that._bottomLabel) && that._createLabel();
that._topLabel.setOptions(options);
that._bottomLabel.setOptions(options)
},
_createLabel: function() {
var options = {
renderer: this.series._renderer,
labelsGroup: this.series._labelsGroup,
point: this
};
this._topLabel = new labelModule.Label(options);
this._bottomLabel = new labelModule.Label(options)
},
_getGraphicBbox: function(location) {
var bbox, options = this._options,
images = this._getImage(options.image),
image = "top" === location ? this._checkImage(images.top) : this._checkImage(images.bottom),
coord = this._getPositionFromLocation(location);
if (options.visible) {
bbox = image ? this._getImageBbox(coord.x, coord.y) : this._getSymbolBbox(coord.x, coord.y, options.styles.normal.r)
} else {
bbox = {
x: coord.x,
y: coord.y,
width: 0,
height: 0
}
}
return bbox
},
_getPositionFromLocation: function(location) {
var x, y, isTop = "top" === location;
if (!this._options.rotated) {
x = this.x;
y = isTop ? _min(this.y, this.minY) : _max(this.y, this.minY)
} else {
x = isTop ? _max(this.x, this.minX) : _min(this.x, this.minX);
y = this.y
}
return {
x: x,
y: y
}
},
_checkOverlay: function(bottomCoord, topCoord, topValue) {
return bottomCoord < topCoord + topValue
},
_getOverlayCorrections: function(type, topCoords, bottomCoords) {
var isVertical = "vertical" === type,
coordSelector = isVertical ? "y" : "x",
valueSelector = isVertical ? "height" : "width",
visibleArea = this.translators[coordSelector].getCanvasVisibleArea(),
minBound = visibleArea.min,
maxBound = visibleArea.max,
delta = _round((topCoords[coordSelector] + topCoords[valueSelector] - bottomCoords[coordSelector]) / 2),
coord1 = topCoords[coordSelector] - delta,
coord2 = bottomCoords[coordSelector] + delta;
if (coord1 < minBound) {
delta = minBound - topCoords[coordSelector];
coord1 += delta;
coord2 += delta
} else {
if (coord2 + bottomCoords[valueSelector] > maxBound) {
delta = -(bottomCoords[coordSelector] + bottomCoords[valueSelector] - maxBound);
coord1 += delta;
coord2 += delta
}
}
return {
coord1: coord1,
coord2: coord2
}
},
_checkLabelsOverlay: function(topLocation) {
var that = this,
topCoords = that._topLabel.getBoundingRect(),
bottomCoords = that._bottomLabel.getBoundingRect(),
corrections = {};
if (!that._options.rotated) {
if ("top" === topLocation) {
if (this._checkOverlay(bottomCoords.y, topCoords.y, topCoords.height)) {
corrections = this._getOverlayCorrections("vertical", topCoords, bottomCoords);
that._topLabel.shift(topCoords.x, corrections.coord1);
that._bottomLabel.shift(bottomCoords.x, corrections.coord2)
}
} else {
if (this._checkOverlay(topCoords.y, bottomCoords.y, bottomCoords.height)) {
corrections = this._getOverlayCorrections("vertical", bottomCoords, topCoords);
that._topLabel.shift(topCoords.x, corrections.coord2);
that._bottomLabel.shift(bottomCoords.x, corrections.coord1)
}
}
} else {
if ("top" === topLocation) {
if (this._checkOverlay(topCoords.x, bottomCoords.x, bottomCoords.width)) {
corrections = this._getOverlayCorrections("horizontal", bottomCoords, topCoords);
that._topLabel.shift(corrections.coord2, topCoords.y);
that._bottomLabel.shift(corrections.coord1, bottomCoords.y)
}
} else {
if (this._checkOverlay(bottomCoords.x, topCoords.x, topCoords.width)) {
corrections = this._getOverlayCorrections("horizontal", topCoords, bottomCoords);
that._topLabel.shift(corrections.coord1, topCoords.y);
that._bottomLabel.shift(corrections.coord2, bottomCoords.y)
}
}
}
},
_drawLabel: function() {
var that = this,
labels = [],
notInverted = that._options.rotated ? that.x >= that.minX : that.y < that.minY,
customVisibility = that._getCustomLabelVisibility(),
topLabel = that._topLabel,
bottomLabel = that._bottomLabel;
topLabel.pointPosition = notInverted ? "top" : "bottom";
bottomLabel.pointPosition = notInverted ? "bottom" : "top";
if ((that.series.getLabelVisibility() || customVisibility) && that.hasValue()) {
false !== that.visibleTopMarker && labels.push(topLabel);
false !== that.visibleBottomMarker && labels.push(bottomLabel);
$.each(labels, function(_, label) {
label.show()
});
that._checkLabelsOverlay(that._topLabel.pointPosition)
} else {
topLabel.hide();
bottomLabel.hide()
}
},
_getImage: function(imageOption) {
var image = {};
if (_isDefined(imageOption)) {
if ("string" === typeof imageOption) {
image.top = image.bottom = imageOption
} else {
image.top = {
url: "string" === typeof imageOption.url ? imageOption.url : imageOption.url && imageOption.url.rangeMaxPoint,
width: "number" === typeof imageOption.width ? imageOption.width : imageOption.width && imageOption.width.rangeMaxPoint,
height: "number" === typeof imageOption.height ? imageOption.height : imageOption.height && imageOption.height.rangeMaxPoint
};
image.bottom = {
url: "string" === typeof imageOption.url ? imageOption.url : imageOption.url && imageOption.url.rangeMinPoint,
width: "number" === typeof imageOption.width ? imageOption.width : imageOption.width && imageOption.width.rangeMinPoint,
height: "number" === typeof imageOption.height ? imageOption.height : imageOption.height && imageOption.height.rangeMinPoint
}
}
}
return image
},
_checkSymbol: function(oldOptions, newOptions) {
var that = this,
oldSymbol = oldOptions.symbol,
newSymbol = newOptions.symbol,
symbolChanged = "circle" === oldSymbol && "circle" !== newSymbol || "circle" !== oldSymbol && "circle" === newSymbol,
oldImages = that._getImage(oldOptions.image),
newImages = that._getImage(newOptions.image),
topImageChanged = that._checkImage(oldImages.top) !== that._checkImage(newImages.top),
bottomImageChanged = that._checkImage(oldImages.bottom) !== that._checkImage(newImages.bottom);
return symbolChanged || topImageChanged || bottomImageChanged
},
_getSettingsForTwoMarkers: function(style) {
var that = this,
options = that._options,
settings = {},
x = options.rotated ? _min(that.x, that.minX) : that.x,
y = options.rotated ? that.y : _min(that.y, that.minY),
radius = style.r,
points = that._populatePointShape(options.symbol, radius);
settings.top = _extend({
translateX: x + that.width,
translateY: y,
r: radius
}, style);
settings.bottom = _extend({
translateX: x,
translateY: y + that.height,
r: radius
}, style);
if (points) {
settings.top.points = settings.bottom.points = points
}
return settings
},
_hasGraphic: function() {
return this.graphic && this.graphic.topMarker && this.graphic.bottomMarker
},
_drawOneMarker: function(renderer, markerType, imageSettings, settings) {
var that = this,
graphic = that.graphic;
if (graphic[markerType]) {
that._updateOneMarker(markerType, settings)
} else {
graphic[markerType] = that._createMarker(renderer, graphic, imageSettings, settings)
}
},
_drawMarker: function(renderer, group, animationEnabled, firstDrawing, style) {
var that = this,
settings = that._getSettingsForTwoMarkers(style || that._getStyle()),
image = that._getImage(that._options.image);
if (that._checkImage(image.top)) {
settings.top = that._getImageSettings(settings.top, image.top)
}
if (that._checkImage(image.bottom)) {
settings.bottom = that._getImageSettings(settings.bottom, image.bottom)
}
that.graphic = that.graphic || renderer.g().append(group);
that.visibleTopMarker && that._drawOneMarker(renderer, "topMarker", image.top, settings.top);
that.visibleBottomMarker && that._drawOneMarker(renderer, "bottomMarker", image.bottom, settings.bottom)
},
_getSettingsForTracker: function(radius) {
var that = this,
rotated = that._options.rotated;
return {
translateX: rotated ? _min(that.x, that.minX) - radius : that.x - radius,
translateY: rotated ? that.y - radius : _min(that.y, that.minY) - radius,
width: that.width + 2 * radius,
height: that.height + 2 * radius
}
},
isInVisibleArea: function() {
var notVisibleByArg, notVisibleByVal, tmp, visibleArgArea, visibleValArea, that = this,
rotated = that._options.rotated,
argument = !rotated ? that.x : that.y,
maxValue = !rotated ? _max(that.minY, that.y) : _max(that.minX, that.x),
minValue = !rotated ? _min(that.minY, that.y) : _min(that.minX, that.x),
translators = that.translators,
visibleTopMarker = true,
visibleBottomMarker = true,
visibleRangeArea = true;
if (translators) {
visibleArgArea = translators[!rotated ? "x" : "y"].getCanvasVisibleArea();
visibleValArea = translators[!rotated ? "y" : "x"].getCanvasVisibleArea();
notVisibleByArg = visibleArgArea.max < argument || visibleArgArea.min > argument;
notVisibleByVal = visibleValArea.min > minValue && visibleValArea.min > maxValue || visibleValArea.max < minValue && visibleValArea.max < maxValue;
if (notVisibleByArg || notVisibleByVal) {
visibleTopMarker = visibleBottomMarker = visibleRangeArea = false
} else {
visibleTopMarker = visibleValArea.min <= minValue && visibleValArea.max > minValue;
visibleBottomMarker = visibleValArea.min < maxValue && visibleValArea.max >= maxValue;
if (rotated) {
tmp = visibleTopMarker;
visibleTopMarker = visibleBottomMarker;
visibleBottomMarker = tmp
}
}
}
that.visibleTopMarker = visibleTopMarker;
that.visibleBottomMarker = visibleBottomMarker;
return visibleRangeArea
},
getTooltipParams: function() {
var x, y, min, max, minValue, that = this,
translators = that.translators,
visibleAreaX = translators.x.getCanvasVisibleArea(),
visibleAreaY = translators.y.getCanvasVisibleArea();
if (!that._options.rotated) {
minValue = _min(that.y, that.minY);
x = that.x;
min = visibleAreaY.min > minValue ? visibleAreaY.min : minValue;
max = visibleAreaY.max < minValue + that.height ? visibleAreaY.max : minValue + that.height;
y = min + (max - min) / 2
} else {
minValue = _min(that.x, that.minX);
y = that.y;
min = visibleAreaX.min > minValue ? visibleAreaX.min : minValue;
max = visibleAreaX.max < minValue + that.width ? visibleAreaX.max : minValue + that.width;
x = min + (max - min) / 2
}
return {
x: x,
y: y,
offset: 0
}
},
_translate: function(translators) {
var that = this,
rotated = that._options.rotated;
that.minX = that.minY = translators.y.translate(that.minValue);
symbolPoint._translate.call(that, translators);
that.height = rotated ? 0 : _abs(that.minY - that.y);
that.width = rotated ? _abs(that.x - that.minX) : 0
},
_updateData: function(data) {
var that = this;
symbolPoint._updateData.call(that, data);
that.minValue = that.initialMinValue = that.originalMinValue = data.minValue
},
_getImageSettings: function(settings, image) {
return {
href: image.url || image.toString(),
width: image.width || DEFAULT_IMAGE_WIDTH,
height: image.height || DEFAULT_IMAGE_HEIGHT,
translateX: settings.translateX,
translateY: settings.translateY
}
},
getCrosshairData: function(x, y) {
var that = this,
rotated = that._options.rotated,
minX = that.minX,
minY = that.minY,
vx = that.vx,
vy = that.vy,
value = that.value,
minValue = that.minValue,
argument = that.argument,
coords = {
axis: that.series.axis,
x: vx,
y: vy,
yValue: value,
xValue: argument
};
if (rotated) {
coords.yValue = argument;
if (_abs(vx - x) < _abs(minX - x)) {
coords.xValue = value
} else {
coords.x = minX;
coords.xValue = minValue
}
} else {
if (_abs(vy - y) >= _abs(minY - y)) {
coords.y = minY;
coords.yValue = minValue
}
}
return coords
},
_updateOneMarker: function(markerType, settings) {
this.graphic && this.graphic[markerType] && this.graphic[markerType].attr(settings)
},
_updateMarker: function(animationEnabled, style) {
this._drawMarker(void 0, void 0, false, false, style)
},
_getFormatObject: function(tooltip) {
var that = this,
initialMinValue = that.initialMinValue,
initialValue = that.initialValue,
initialArgument = that.initialArgument,
minValue = tooltip.formatValue(initialMinValue),
value = tooltip.formatValue(initialValue);
return {
argument: initialArgument,
argumentText: tooltip.formatValue(initialArgument, "argument"),
valueText: minValue + " - " + value,
rangeValue1Text: minValue,
rangeValue2Text: value,
rangeValue1: initialMinValue,
rangeValue2: initialValue,
seriesName: that.series.name,
point: that,
originalMinValue: that.originalMinValue,
originalValue: that.originalValue,
originalArgument: that.originalArgument
}
},
getLabel: function() {
return [this._topLabel, this._bottomLabel]
},
getBoundingRect: $.noop,
coordsIn: function(x, y) {
var trackerRadius = this._storeTrackerR(),
xCond = x >= this.x - trackerRadius && x <= this.x + trackerRadius,
yCond = y >= this.y - trackerRadius && y <= this.y + trackerRadius;
if (this._options.rotated) {
return yCond && (xCond || x >= this.minX - trackerRadius && x <= this.minX + trackerRadius)
} else {
return xCond && (yCond || y >= this.minY - trackerRadius && y <= this.minY + trackerRadius)
}
}
})
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**************************************************!*\
!*** ./Scripts/viz/sparklines/base_sparkline.js ***!
\**************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
BaseWidget = __webpack_require__( /*! ../core/base_widget */ 109),
DEFAULT_LINE_SPACING = 2,
DEFAULT_EVENTS_DELAY = 200,
TOUCH_EVENTS_DELAY = 1e3,
eventUtils = __webpack_require__( /*! ../../events/utils */ 4),
wheelEvent = __webpack_require__( /*! ../../events/core/wheel */ 78),
baseThemeManagerModule = __webpack_require__( /*! ../core/base_theme_manager */ 103),
translator2DModule = __webpack_require__( /*! ../translators/translator2d */ 105),
_abs = Math.abs,
_extend = $.extend,
_noop = $.noop;
function generateDefaultCustomizeTooltipCallback(fontOptions, rtlEnabled) {
var lineSpacing = fontOptions.lineSpacing,
lineHeight = (void 0 !== lineSpacing && null !== lineSpacing ? lineSpacing : DEFAULT_LINE_SPACING) + fontOptions.size;
return function(customizeObject) {
var html = "",
vt = customizeObject.valueText;
for (var i = 0; i < vt.length; i += 2) {
html += "| " + vt[i] + " | | " + vt[i + 1] + " | "
}
return {
html: ""
}
}
}
function generateCustomizeTooltipCallback(customizeTooltip, fontOptions, rtlEnabled) {
var defaultCustomizeTooltip = generateDefaultCustomizeTooltipCallback(fontOptions, rtlEnabled);
if ($.isFunction(customizeTooltip)) {
return function(customizeObject) {
var res = customizeTooltip.call(customizeObject, customizeObject);
if (!("html" in res) && !("text" in res)) {
_extend(res, defaultCustomizeTooltip.call(customizeObject, customizeObject))
}
return res
}
} else {
return defaultCustomizeTooltip
}
}
var BaseSparkline = BaseWidget.inherit({
_setDeprecatedOptions: function() {
this.callBase();
_extend(this._deprecatedOptions, {
"tooltip.verticalAlignment": {
since: "15.1",
message: "Now tootips are aligned automatically"
},
"tooltip.horizontalAlignment": {
since: "15.1",
message: "Now tootips are aligned automatically"
}
})
},
_getLayoutItems: _noop,
_useLinks: false,
_themeDependentChanges: ["OPTIONS"],
_initCore: function() {
var that = this;
that._tooltipTracker = that._renderer.root;
that._tooltipTracker.attr({
"pointer-events": "visible"
});
that._createHtmlElements();
that._initTooltipEvents()
},
_getDefaultSize: function() {
return this._defaultSize
},
_disposeCore: function() {
this._disposeWidgetElements();
this._disposeTooltipEvents();
this._ranges = null
},
_optionChangesOrder: ["OPTIONS"],
_change_OPTIONS: function() {
this._prepareOptions();
this._change(["UPDATE"])
},
_customChangesOrder: ["UPDATE"],
_change_UPDATE: function() {
this._update()
},
_update: function() {
var that = this;
if (that._tooltipShown) {
that._tooltipShown = false;
that._tooltip.hide()
}
that._cleanWidgetElements();
that._cleanTranslators();
that._updateWidgetElements();
that._drawWidgetElements()
},
_updateWidgetElements: function() {
this._updateRange();
this._updateTranslator()
},
_applySize: function(rect) {
this._allOptions.size = {
width: rect[2] - rect[0],
height: rect[3] - rect[1]
};
this._change(["UPDATE"])
},
_cleanTranslators: function() {
this._translatorX = null;
this._translatorY = null
},
_setupResizeHandler: _noop,
_prepareOptions: function() {
return _extend(true, {}, this._themeManager.theme(), this.option())
},
_createThemeManager: function() {
var themeManager = new baseThemeManagerModule.BaseThemeManager;
themeManager._themeSection = this._widgetType;
themeManager._fontFields = ["tooltip.font"];
return themeManager
},
_getTooltipCoords: function() {
var canvas = this._canvas,
rootOffset = this._renderer.getRootOffset();
return {
x: canvas.width / 2 + rootOffset.left,
y: canvas.height / 2 + rootOffset.top
}
},
_initTooltipEvents: function() {
var that = this,
data = {
widget: that
};
that._showTooltipCallback = function() {
var tooltip;
that._showTooltipTimeout = null;
if (!that._tooltipShown) {
that._tooltipShown = true;
tooltip = that._getTooltip();
tooltip.isEnabled() && that._tooltip.show(that._getTooltipData(), that._getTooltipCoords(), {})
}
that._DEBUG_showCallback && that._DEBUG_showCallback()
};
that._hideTooltipCallback = function() {
var tooltipWasShown = that._tooltipShown;
that._hideTooltipTimeout = null;
if (that._tooltipShown) {
that._tooltipShown = false;
that._tooltip.hide()
}
that._DEBUG_hideCallback && that._DEBUG_hideCallback(tooltipWasShown)
};
that._disposeCallbacks = function() {
that = that._showTooltipCallback = that._hideTooltipCallback = that._disposeCallbacks = null
};
that._tooltipTracker.on(mouseEvents, data).on(touchEvents, data).on(mouseWheelEvents, data);
that._tooltipTracker.on(menuEvents)
},
_disposeTooltipEvents: function() {
var that = this;
clearTimeout(that._showTooltipTimeout);
clearTimeout(that._hideTooltipTimeout);
that._tooltipTracker.off();
that._disposeCallbacks()
},
_updateTranslator: function() {
var that = this,
canvas = this._canvas,
ranges = this._ranges;
that._translatorX = new translator2DModule.Translator2D(ranges.arg, canvas, {
isHorizontal: true
});
that._translatorY = new translator2DModule.Translator2D(ranges.val, canvas)
},
_getTooltip: function() {
var that = this;
if (!that._tooltip) {
_initTooltip.apply(this, arguments);
that._setTooltipRendererOptions(that._tooltipRendererOptions);
that._tooltipRendererOptions = null;
that._setTooltipOptions()
}
return that._tooltip
}
});
var menuEvents = {
"contextmenu.sparkline-tooltip": function(event) {
if (eventUtils.isTouchEvent(event) || eventUtils.isPointerEvent(event)) {
event.preventDefault()
}
},
"MSHoldVisual.sparkline-tooltip": function(event) {
event.preventDefault()
}
};
var mouseEvents = {
"mouseover.sparkline-tooltip": function(event) {
isPointerDownCalled = false;
var widget = event.data.widget;
widget._x = event.pageX;
widget._y = event.pageY;
widget._tooltipTracker.off(mouseMoveEvents).on(mouseMoveEvents, event.data);
widget._showTooltip(DEFAULT_EVENTS_DELAY)
},
"mouseout.sparkline-tooltip": function(event) {
if (isPointerDownCalled) {
return
}
var widget = event.data.widget;
widget._tooltipTracker.off(mouseMoveEvents);
widget._hideTooltip(DEFAULT_EVENTS_DELAY)
}
};
var mouseWheelEvents = {};
mouseWheelEvents[wheelEvent.name + ".sparkline-tooltip"] = function(event) {
event.data.widget._hideTooltip()
};
var mouseMoveEvents = {
"mousemove.sparkline-tooltip": function(event) {
var widget = event.data.widget;
if (widget._showTooltipTimeout && (_abs(widget._x - event.pageX) > 3 || _abs(widget._y - event.pageY) > 3)) {
widget._x = event.pageX;
widget._y = event.pageY;
widget._showTooltip(DEFAULT_EVENTS_DELAY)
}
}
};
var active_touch_tooltip_widget = null,
touchstartTooltipProcessing = function(event) {
event.preventDefault();
var widget = active_touch_tooltip_widget;
if (widget && widget !== event.data.widget) {
widget._hideTooltip(DEFAULT_EVENTS_DELAY)
}
widget = active_touch_tooltip_widget = event.data.widget;
widget._showTooltip(TOUCH_EVENTS_DELAY);
widget._touch = true
},
touchstartDocumentProcessing = function() {
var widget = active_touch_tooltip_widget;
if (widget) {
if (!widget._touch) {
widget._hideTooltip(DEFAULT_EVENTS_DELAY);
active_touch_tooltip_widget = null
}
widget._touch = null
}
},
touchendDocumentProcessing = function() {
var widget = active_touch_tooltip_widget;
if (widget) {
if (widget._showTooltipTimeout) {
widget._hideTooltip(DEFAULT_EVENTS_DELAY);
active_touch_tooltip_widget = null
}
}
},
isPointerDownCalled = false;
var touchEvents = {
"pointerdown.sparkline-tooltip": touchstartTooltipProcessing,
"touchstart.sparkline-tooltip": touchstartTooltipProcessing
};
$(document).on({
"pointerdown.sparkline-tooltip": function() {
isPointerDownCalled = true;
touchstartDocumentProcessing()
},
"touchstart.sparkline-tooltip": touchstartDocumentProcessing,
"pointerup.sparkline-tooltip": touchendDocumentProcessing,
"touchend.sparkline-tooltip": touchendDocumentProcessing
});
module.exports = BaseSparkline;
module.exports._DEBUG_reset = function() {
active_touch_tooltip_widget = null
};
BaseSparkline.addPlugin(__webpack_require__( /*! ../core/tooltip */ 165).plugin);
var _initTooltip = BaseSparkline.prototype._initTooltip;
BaseSparkline.prototype._initTooltip = _noop;
var _disposeTooltip = BaseSparkline.prototype._disposeTooltip;
BaseSparkline.prototype._disposeTooltip = function() {
if (this._tooltip) {
_disposeTooltip.apply(this, arguments)
}
};
BaseSparkline.prototype._setTooltipRendererOptions = function() {
var options = this._getRendererOptions();
if (this._tooltip) {
this._tooltip.setRendererOptions(options)
} else {
this._tooltipRendererOptions = options
}
};
BaseSparkline.prototype._setTooltipOptions = function() {
var tooltip = this._tooltip,
options = tooltip && this._getOption("tooltip");
tooltip && tooltip.update(_extend({}, options, {
customizeTooltip: generateCustomizeTooltipCallback(options.customizeTooltip, options.font, this.option("rtlEnabled")),
enabled: options.enabled && this._isTooltipEnabled()
}))
};
BaseSparkline.prototype._showTooltip = function(delay) {
var that = this;
++that._DEBUG_clearHideTooltipTimeout;
clearTimeout(that._hideTooltipTimeout);
that._hideTooltipTimeout = null;
clearTimeout(that._showTooltipTimeout);
++that._DEBUG_showTooltipTimeoutSet;
that._showTooltipTimeout = setTimeout(that._showTooltipCallback, delay)
};
BaseSparkline.prototype._hideTooltip = function(delay) {
var that = this;
++that._DEBUG_clearShowTooltipTimeout;
clearTimeout(that._showTooltipTimeout);
that._showTooltipTimeout = null;
clearTimeout(that._hideTooltipTimeout);
if (delay) {
++that._DEBUG_hideTooltipTimeoutSet;
that._hideTooltipTimeout = setTimeout(that._hideTooltipCallback, delay)
} else {
that._hideTooltipCallback()
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*****************************************************!*\
!*** ./Scripts/viz/translators/polar_translator.js ***!
\*****************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
vizUtils = __webpack_require__( /*! ../core/utils */ 6),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
translator2DModule = __webpack_require__( /*! ./translator2d */ 105),
SHIFT_ANGLE = 90,
_round = Math.round;
function PolarTranslator(businessRange, canvas, options) {
var that = this;
that._startAngle = options.startAngle;
that._endAngle = options.endAngle;
that._argCanvas = {
left: 0,
right: 0,
width: this._getAngle()
};
that._valCanvas = {
left: 0,
right: 0
};
that.canvas = $.extend({}, canvas);
that._init();
that._arg = new translator2DModule.Translator2D(businessRange.arg, that._argCanvas, {
isHorizontal: true,
conversionValue: true
});
that._val = new translator2DModule.Translator2D(businessRange.val, that._valCanvas, {
isHorizontal: true
});
that._businessRange = businessRange
}
PolarTranslator.prototype = {
constructor: PolarTranslator,
_init: function() {
var canvas = this.canvas;
this._setCoords({
x: canvas.left + (canvas.width - canvas.right - canvas.left) / 2,
y: canvas.top + (canvas.height - canvas.top - canvas.bottom) / 2,
r: Math.min(canvas.width - canvas.left - canvas.right, canvas.height - canvas.top - canvas.bottom) / 2
});
this._valCanvas.width = this._rad
},
reinit: function() {
this._init();
this._arg.reinit();
this._val.reinit()
},
_setCoords: function(coord) {
this._x0 = coord.x;
this._y0 = coord.y;
this._rad = coord.r < 0 ? 0 : coord.r
},
getBusinessRange: function() {
return this._businessRange
},
translate: function(arg, val, offsets) {
var x, y, that = this,
argTranslate = that._arg.translate(arg, offsets && offsets[0]),
radius = that._val.translate(val, offsets && offsets[1]),
angle = commonUtils.isDefined(argTranslate) ? argTranslate + that._startAngle - SHIFT_ANGLE : null,
cossin = vizUtils.getCosAndSin(angle);
y = _round(that._y0 + radius * cossin.sin);
x = _round(that._x0 + radius * cossin.cos);
return {
x: x,
y: y,
angle: angle,
radius: radius
}
},
setCanvasDimension: function(dimension) {
this.canvas.width = this.canvas.height = dimension;
this.reinit()
},
setAngles: function(startAngle, endAngle) {
var that = this;
that._startAngle = startAngle;
that._endAngle = endAngle;
that._argCanvas.width = that._getAngle();
that._arg.update(that._arg.getBusinessRange(), that._argCanvas)
},
getAngles: function() {
return [this._startAngle, this._endAngle]
},
getValLength: function() {
return this._rad
},
getCenter: function() {
return {
x: this._x0,
y: this._y0
}
},
getBaseAngle: function() {
return this._startAngle - SHIFT_ANGLE
},
getInterval: function() {
return this._arg.getInterval()
},
getValInterval: function() {
return this._val.getInterval()
},
_getAngle: function() {
return Math.abs(this._endAngle - this._startAngle)
},
getComponent: function(type) {
var that = this,
translator = this["_" + type];
translator.getRadius = function() {
return that.getValLength()
};
translator.getCenter = function() {
return that.getCenter()
};
translator.getAngles = function() {
return that.getAngles()
};
return translator
},
_untranslate: function(x, y) {
var radius = vizUtils.getDistance(this._x0, this._y0, x, y),
angle = Math.atan2(y - this._y0, x - this._x0);
return {
r: radius,
phi: angle
}
},
untranslate: function(x, y) {
var pos = this._untranslate(x, y);
pos.phi = _round(vizUtils.normalizeAngle(180 * pos.phi / Math.PI));
pos.r = _round(pos.r);
return pos
},
getVisibleCategories: $.noop,
getCanvasVisibleArea: function() {
return {}
},
getMinBarSize: function(minBarSize) {
return this._val.getMinBarSize(minBarSize)
}
};
exports.PolarTranslator = PolarTranslator
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*************************************************!*\
!*** ./Scripts/viz/translators/translator1d.js ***!
\*************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var _Number = Number;
function Translator1D() {
this.setDomain(arguments[0], arguments[1]).setCodomain(arguments[2], arguments[3])
}
Translator1D.prototype = {
constructor: Translator1D,
setDomain: function(domain1, domain2) {
var that = this;
that._domain1 = _Number(domain1);
that._domain2 = _Number(domain2);
that._domainDelta = that._domain2 - that._domain1;
return that
},
setCodomain: function(codomain1, codomain2) {
var that = this;
that._codomain1 = _Number(codomain1);
that._codomain2 = _Number(codomain2);
that._codomainDelta = that._codomain2 - that._codomain1;
return that
},
getDomain: function() {
return [this._domain1, this._domain2]
},
getCodomain: function() {
return [this._codomain1, this._codomain2]
},
getDomainStart: function() {
return this._domain1
},
getDomainEnd: function() {
return this._domain2
},
getCodomainStart: function() {
return this._codomain1
},
getCodomainEnd: function() {
return this._codomain2
},
getDomainRange: function() {
return this._domainDelta
},
getCodomainRange: function() {
return this._codomainDelta
},
translate: function(value) {
var ratio = (_Number(value) - this._domain1) / this._domainDelta;
return 0 <= ratio && ratio <= 1 ? this._codomain1 + ratio * this._codomainDelta : NaN
},
adjust: function(value) {
var ratio = (_Number(value) - this._domain1) / this._domainDelta,
result = NaN;
if (ratio < 0) {
result = this._domain1
} else {
if (ratio > 1) {
result = this._domain2
} else {
if (0 <= ratio && ratio <= 1) {
result = _Number(value)
}
}
}
return result
}
};
exports.Translator1D = Translator1D
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*****************************************************!*\
!*** ./Scripts/viz/tree_map/colorizing.discrete.js ***!
\*****************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
function discreteColorizer(options, themeManager, root) {
var palette = themeManager.createPalette(options.palette, {
useHighlight: true
});
return (options.colorizeGroups ? discreteGroupColorizer : discreteLeafColorizer)(palette, root)
}
function generateColors(palette, colors, count) {
var i;
for (i = colors.length; i < count; ++i) {
colors.push(palette.getNextColor())
}
}
function discreteLeafColorizer(palette) {
var colors = [];
generateColors(palette, colors, 4);
return function(node) {
if (node.index >= colors.length) {
generateColors(palette, colors, 2 * colors.length)
}
return colors[node.index]
}
}
function prepareDiscreteGroupColors(palette, root) {
var i, node, colors = {},
allNodes = root.nodes.slice(),
ii = allNodes.length;
for (i = 0; i < ii; ++i) {
node = allNodes[i];
if (node.isNode()) {
allNodes = allNodes.concat(node.nodes);
ii = allNodes.length
} else {
if (!colors[node.parent._id]) {
colors[node.parent._id] = palette.getNextColor()
}
}
}
return colors
}
function discreteGroupColorizer(palette, root) {
var colors = prepareDiscreteGroupColors(palette, root);
return function(node) {
return colors[node._id]
}
}
__webpack_require__( /*! ./colorizing */ 106).addColorizer("discrete", discreteColorizer);
module.exports = discreteColorizer
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************!*\
!*** ./Scripts/viz/tree_map/hover.js ***!
\***************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var proto = __webpack_require__( /*! ./tree_map.base */ 51).prototype,
nodeProto = __webpack_require__( /*! ./node */ 168).prototype,
common = __webpack_require__( /*! ./common */ 90),
_parseScalar = __webpack_require__( /*! ../core/utils */ 6).parseScalar,
_buildRectAppearance = common.buildRectAppearance,
STATE_CODE = 1;
__webpack_require__( /*! ./api */ 130);
__webpack_require__( /*! ./states */ 344);
proto._eventsMap.onHoverChanged = {
name: "hoverChanged"
};
common.expand(proto._handlers, "calculateAdditionalStates", function(states, options) {
states[1] = options.hoverStyle ? _buildRectAppearance(options.hoverStyle) : {}
});
__webpack_require__( /*! ./tree_map.base */ 51).addChange({
code: "HOVER_ENABLED",
handler: function() {
var hoverEnabled = _parseScalar(this._getOption("hoverEnabled", true), true);
if (!hoverEnabled) {
this.clearHover()
}
this._hoverEnabled = hoverEnabled
},
isThemeDependent: true,
isOptionChange: true,
option: "hoverEnabled"
});
nodeProto.statesMap[1] = 1;
nodeProto.additionalStates.push(1);
common.expand(proto, "_extendProxyType", function(proto) {
var that = this;
proto.setHover = function() {
that._hoverNode(this._id)
};
proto.isHovered = function() {
return that._hoverIndex === this._id
}
});
common.expand(proto, "_onNodesCreated", function() {
this._hoverIndex = -1
});
proto._applyHoverState = function(index, state) {
setNodeStateRecursive(this._nodes[index], STATE_CODE, state);
this._eventTrigger("hoverChanged", {
node: this._nodes[index].proxy
})
};
function setNodeStateRecursive(node, code, state) {
var i, nodes = node.isNode() && node.nodes,
ii = nodes && nodes.length;
node.setState(code, state);
for (i = 0; i < ii; ++i) {
setNodeStateRecursive(nodes[i], code, state)
}
}
proto._hoverNode = function(index) {
var that = this,
currentIndex = that._hoverIndex;
if (that._hoverEnabled && currentIndex !== index) {
that._context.suspend();
that._hoverIndex = -1;
if (currentIndex >= 0) {
that._applyHoverState(currentIndex, false)
}
that._hoverIndex = index;
if (index >= 0) {
that._applyHoverState(index, true)
}
that._context.resume()
}
};
proto.clearHover = function() {
this._hoverNode(-1)
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!****************************************!*\
!*** ./Scripts/viz/tree_map/states.js ***!
\****************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var proto = __webpack_require__( /*! ./tree_map.base */ 51).prototype,
nodeProto = __webpack_require__( /*! ./node */ 168).prototype,
handlers = proto._handlers,
_calculateState = handlers.calculateState,
_buildState = nodeProto._buildState,
_extend = __webpack_require__( /*! jquery */ 1).extend;
handlers.calculateState = function(options) {
var states = {
0: _calculateState(options)
};
handlers.calculateAdditionalStates(states, options);
return states
};
handlers.calculateAdditionalStates = __webpack_require__( /*! ./common */ 90).empty;
nodeProto.code = 0;
nodeProto.statesMap = {
0: 0
};
nodeProto.additionalStates = [];
nodeProto._buildState = function(state, extra) {
var states = {
0: _buildState(state[0], extra)
};
if (this.additionalStates.length) {
buildAdditionalStates(states, states[0], state, this.additionalStates)
}
return states
};
nodeProto._getState = function() {
return this.state[this.statesMap[this.code]]
};
nodeProto.setState = function(code, state) {
if (state) {
this.code |= code
} else {
this.code &= ~code
}
this.ctx.change(["TILES"])
};
function buildAdditionalStates(states, base, source, list) {
var i, ii = list.length;
for (i = 0; i < ii; ++i) {
states[list[i]] = _extend({}, base, source[list[i]])
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************************!*\
!*** ./Scripts/viz/tree_map/tiling.squarified.base.js ***!
\********************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var _max = Math.max,
_round = Math.round,
_calculateRectangles = __webpack_require__( /*! ./tiling */ 107).calculateRectangles,
_buildSidesData = __webpack_require__( /*! ./tiling */ 107).buildSidesData;
function compare(a, b) {
return b.value - a.value
}
function getAspectRatio(value) {
return _max(value, 1 / value)
}
function findAppropriateCollection(nodes, head, context) {
var nextAspectRatio, nextSum, i, j, totalAspectRatio, bestAspectRatio = 1 / 0,
sum = 0,
ii = nodes.length,
coeff = context.areaToValue / context.staticSide;
for (i = head; i < ii;) {
nextSum = sum + nodes[i].value;
totalAspectRatio = context.staticSide / coeff / nextSum;
nextAspectRatio = 0;
for (j = head; j <= i; ++j) {
nextAspectRatio = context.accumulate(nextAspectRatio, getAspectRatio(totalAspectRatio * nodes[j].value / nextSum), j - head + 1)
}
if (nextAspectRatio < bestAspectRatio) {
bestAspectRatio = nextAspectRatio;
sum = nextSum;
++i
} else {
break
}
}
return {
sum: sum,
count: i - head,
side: _round(coeff * sum)
}
}
function getArea(rect) {
return (rect[2] - rect[0]) * (rect[3] - rect[1])
}
function doStep(nodes, head, context) {
var sidesData = context.sides || _buildSidesData(context.rect, context.directions),
rowData = sidesData.staticSide > 0 ? findAppropriateCollection(nodes, head, {
areaToValue: getArea(context.rect) / context.sum,
accumulate: context.accumulate,
staticSide: sidesData.staticSide
}) : {
sum: 1,
side: sidesData.variedSide,
count: nodes.length - head
};
_calculateRectangles(nodes, head, context.rect, sidesData, rowData);
context.sum -= rowData.sum;
return head + rowData.count
}
module.exports = function(data, accumulate, isFixedStaticSide) {
var i, items = data.items,
ii = items.length,
context = {
sum: data.sum,
rect: data.rect,
directions: data.directions,
accumulate: accumulate
};
if (isFixedStaticSide) {
context.sides = _buildSidesData(context.rect, context.directions)
}
items.sort(compare);
for (i = 0; i < ii;) {
i = doStep(items, i, context)
}
}
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************************!*\
!*** ./Scripts/viz/tree_map/tiling.squarified.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var _max = Math.max,
_squarify = __webpack_require__( /*! ./tiling.squarified.base */ 345);
function accumulate(total, current) {
return _max(total, current)
}
function squarified(data) {
return _squarify(data, accumulate, false)
}
__webpack_require__( /*! ./tiling */ 107).addAlgorithm("squarified", squarified);
module.exports = squarified
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*****************************************!*\
!*** ./Scripts/viz/tree_map/tooltip.js ***!
\*****************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var proto = __webpack_require__( /*! ./tree_map.base */ 51).prototype,
common = __webpack_require__( /*! ./common */ 90);
__webpack_require__( /*! ./api */ 130);
common.expand(proto, "_extendProxyType", function(proto) {
var that = this;
proto.showTooltip = function(coords) {
that._showTooltip(this._id, coords)
}
});
common.expand(proto, "_onNodesCreated", function() {
if (this._tooltipIndex >= 0) {
this._tooltip.hide()
}
this._tooltipIndex = -1
});
common.expand(proto, "_onTilingPerformed", function() {
if (this._tooltipIndex >= 0) {
this._moveTooltip(this._nodes[this._tooltipIndex])
}
});
function getCoords(rect, renderer) {
var offset = renderer.getRootOffset();
return [(rect[0] + rect[2]) / 2 + offset.left, (rect[1] + rect[3]) / 2 + offset.top]
}
proto._showTooltip = function(index, coords) {
var node, state, that = this,
tooltip = that._tooltip;
if (tooltip.isEnabled()) {
node = that._nodes[index];
state = that._tooltipIndex === index || tooltip.show({
value: node.value,
valueText: tooltip.formatValue(node.value),
node: node.proxy
}, {
x: 0,
y: 0,
offset: 0
}, {
node: node.proxy
});
if (state) {
that._moveTooltip(node, coords)
} else {
tooltip.hide()
}
that._tooltipIndex = state ? index : -1
}
};
proto._moveTooltip = function(node, coords) {
var xy = coords || node.rect && getCoords(node.rect, this._renderer) || [-1e3, -1e3];
this._tooltip.move(xy[0], xy[1], 0)
};
proto.hideTooltip = function() {
if (this._tooltipIndex >= 0) {
this._tooltipIndex = -1;
this._tooltip.hide()
}
};
__webpack_require__( /*! ./tree_map.base */ 51).addPlugin(__webpack_require__( /*! ../core/tooltip */ 165).plugin)
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*************************************************!*\
!*** ./Scripts/viz/vector_map/event_emitter.js ***!
\*************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1);
var eventEmitterMethods = {
_initEvents: function() {
var i, names = this._eventNames,
ii = names.length,
events = this._events = {};
for (i = 0; i < ii; ++i) {
events[names[i]] = $.Callbacks()
}
},
_disposeEvents: function() {
var name, events = this._events;
for (name in events) {
events[name].empty()
}
this._events = null
},
on: function(handlers) {
var name, events = this._events;
for (name in handlers) {
events[name].add(handlers[name])
}
return dispose;
function dispose() {
for (name in handlers) {
events[name].remove(handlers[name])
}
}
},
_fire: function(name, arg) {
this._events[name].fire(arg)
}
};
exports.makeEventEmitter = function(target) {
var name, prot = target.prototype;
for (name in eventEmitterMethods) {
prot[name] = eventEmitterMethods[name]
}
};
exports._TESTS_eventEmitterMethods = eventEmitterMethods
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!**********************************************!*\
!*** ./Scripts/viz/vector_map/projection.js ***!
\**********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var projectionModule = __webpack_require__( /*! ./projection.main */ 350),
projection = projectionModule.projection,
_min = Math.min,
_max = Math.max,
_sin = Math.sin,
_asin = Math.asin,
_tan = Math.tan,
_atan = Math.atan,
_exp = Math.exp,
_log = Math.log,
PI = Math.PI,
PI_DIV_4 = PI / 4,
GEO_LON_BOUND = 180,
GEO_LAT_BOUND = 90,
RADIANS = PI / 180,
MERCATOR_LAT_BOUND = (2 * _atan(_exp(PI)) - PI / 2) / RADIANS,
MILLER_LAT_BOUND = (2.5 * _atan(_exp(.8 * PI)) - .625 * PI) / RADIANS;
function clamp(value, threshold) {
return _max(_min(value, +threshold), -threshold)
}
projection.add("mercator", projection({
aspectRatio: 1,
to: function(coordinates) {
return [coordinates[0] / GEO_LON_BOUND, _log(_tan(PI_DIV_4 + clamp(coordinates[1], MERCATOR_LAT_BOUND) * RADIANS / 2)) / PI]
},
from: function(coordinates) {
return [coordinates[0] * GEO_LON_BOUND, (2 * _atan(_exp(coordinates[1] * PI)) - PI / 2) / RADIANS]
}
}));
projection.add("equirectangular", projection({
aspectRatio: 2,
to: function(coordinates) {
return [coordinates[0] / GEO_LON_BOUND, coordinates[1] / GEO_LAT_BOUND]
},
from: function(coordinates) {
return [coordinates[0] * GEO_LON_BOUND, coordinates[1] * GEO_LAT_BOUND]
}
}));
projection.add("lambert", projection({
aspectRatio: 2,
to: function(coordinates) {
return [coordinates[0] / GEO_LON_BOUND, _sin(clamp(coordinates[1], GEO_LAT_BOUND) * RADIANS)]
},
from: function(coordinates) {
return [coordinates[0] * GEO_LON_BOUND, _asin(clamp(coordinates[1], 1)) / RADIANS]
}
}));
projection.add("miller", projection({
aspectRatio: 1,
to: function(coordinates) {
return [coordinates[0] / GEO_LON_BOUND, 1.25 * _log(_tan(PI_DIV_4 + clamp(coordinates[1], MILLER_LAT_BOUND) * RADIANS * .4)) / PI]
},
from: function(coordinates) {
return [coordinates[0] * GEO_LON_BOUND, (2.5 * _atan(_exp(.8 * coordinates[1] * PI)) - .625 * PI) / RADIANS]
}
}));
exports.projection = projection
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!***************************************************!*\
!*** ./Scripts/viz/vector_map/projection.main.js ***!
\***************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
eventEmitterModule = __webpack_require__( /*! ./event_emitter */ 348);
var _Number = Number,
_min = Math.min,
_max = Math.max,
_abs = Math.abs,
_round = Math.round,
_ln = Math.log,
_pow = Math.pow,
TWO_TO_LN2 = 2 / Math.LN2,
MIN_BOUNDS_RANGE = 1 / 3600 / 180 / 10,
DEFAULT_MIN_ZOOM = 1,
DEFAULT_MAX_ZOOM = 256,
DEFAULT_CENTER = [NaN, NaN],
DEFAULT_ENGINE_NAME = "mercator";
function floatsEqual(f1, f2) {
return _abs(f1 - f2) < 1e-8
}
function arraysEqual(a1, a2) {
return floatsEqual(a1[0], a2[0]) && floatsEqual(a1[1], a2[1])
}
function parseAndClamp(value, minValue, maxValue, defaultValue) {
var val = _Number(value);
return isFinite(val) ? _min(_max(val, minValue), maxValue) : defaultValue
}
function parseAndClampArray(value, minValue, maxValue, defaultValue) {
return [parseAndClamp(value[0], minValue[0], maxValue[0], defaultValue[0]), parseAndClamp(value[1], minValue[1], maxValue[1], defaultValue[1])]
}
function getEngine(engine) {
return engine instanceof Engine && engine || projection.get(engine) || projection.get(DEFAULT_ENGINE_NAME)
}
function Projection(parameters) {
var that = this;
that._initEvents();
that._params = parameters;
that._engine = getEngine();
that._center = that._engine.center();
that._adjustCenter()
}
Projection.prototype = {
constructor: Projection,
_minZoom: DEFAULT_MIN_ZOOM,
_maxZoom: DEFAULT_MAX_ZOOM,
_zoom: DEFAULT_MIN_ZOOM,
_center: DEFAULT_CENTER,
_canvas: {},
_scale: [],
dispose: function() {
this._disposeEvents()
},
setEngine: function(value) {
var that = this,
engine = getEngine(value);
if (that._engine !== engine) {
that._engine = engine;
that._fire("engine");
if (that._changeCenter(engine.center())) {
that._triggerCenterChanged()
}
if (that._changeZoom(that._minZoom)) {
that._triggerZoomChanged()
}
that._adjustCenter();
that._setupScreen()
}
},
setBounds: function(bounds) {
if (void 0 !== bounds) {
this.setEngine(this._engine.original().bounds(bounds))
}
},
_setupScreen: function() {
var that = this,
canvas = that._canvas,
width = canvas.width,
height = canvas.height,
aspectRatio = that._engine.ar();
that._x0 = canvas.left + width / 2;
that._y0 = canvas.top + height / 2;
if (width / height <= aspectRatio) {
that._xradius = width / 2;
that._yradius = width / 2 / aspectRatio
} else {
that._xradius = height / 2 * aspectRatio;
that._yradius = height / 2
}
that._fire("screen")
},
setSize: function(canvas) {
var that = this;
that._canvas = canvas;
that._setupScreen()
},
_toScreen: function(coordinates) {
return [this._x0 + this._xradius * coordinates[0], this._y0 + this._yradius * coordinates[1]]
},
_fromScreen: function(coordinates) {
return [(coordinates[0] - this._x0) / this._xradius, (coordinates[1] - this._y0) / this._yradius]
},
_toTransformed: function(coordinates) {
return [coordinates[0] * this._zoom + this._dxcenter, coordinates[1] * this._zoom + this._dycenter]
},
_toTransformedFast: function(coordinates) {
return [coordinates[0] * this._zoom, coordinates[1] * this._zoom]
},
_fromTransformed: function(coordinates) {
return [(coordinates[0] - this._dxcenter) / this._zoom, (coordinates[1] - this._dycenter) / this._zoom]
},
_adjustCenter: function() {
var that = this,
center = that._engine.project(that._center);
that._dxcenter = -center[0] * that._zoom || 0;
that._dycenter = -center[1] * that._zoom || 0
},
project: function(coordinates) {
return this._engine.project(coordinates)
},
transform: function(coordinates) {
return this._toScreen(this._toTransformedFast(coordinates))
},
isInvertible: function() {
return this._engine.isinv()
},
getSquareSize: function(size) {
return [size[0] * this._zoom * this._xradius, size[1] * this._zoom * this._yradius]
},
getZoom: function() {
return this._zoom
},
_changeZoom: function(value) {
var that = this,
oldZoom = that._zoom,
newZoom = that._zoom = parseAndClamp(value, that._minZoom, that._maxZoom, that._minZoom),
isChanged = !floatsEqual(oldZoom, newZoom);
if (isChanged) {
that._adjustCenter();
that._fire("zoom")
}
return isChanged
},
setZoom: function(value) {
if (this._engine.isinv() && this._changeZoom(value)) {
this._triggerZoomChanged()
}
},
getScaledZoom: function() {
return _round((this._scale.length - 1) * _ln(this._zoom) / _ln(this._maxZoom))
},
setScaledZoom: function(scaledZoom) {
this.setZoom(this._scale[_round(scaledZoom)])
},
changeScaledZoom: function(deltaZoom) {
this.setZoom(this._scale[_max(_min(_round(this.getScaledZoom() + deltaZoom), this._scale.length - 1), 0)])
},
getZoomScalePartition: function() {
return this._scale.length - 1
},
_setupScaling: function() {
var step, zoom, that = this,
k = _round(TWO_TO_LN2 * _ln(that._maxZoom)),
i = 1;
k = k > 4 ? k : 4;
step = _pow(that._maxZoom, 1 / k);
zoom = that._minZoom;
that._scale = [zoom];
for (; i <= k; ++i) {
that._scale.push(zoom *= step)
}
},
setMaxZoom: function(maxZoom) {
var that = this;
that._minZoom = DEFAULT_MIN_ZOOM;
that._maxZoom = parseAndClamp(maxZoom, that._minZoom, _Number.MAX_VALUE, DEFAULT_MAX_ZOOM);
that._setupScaling();
if (that._zoom > that._maxZoom) {
that.setZoom(that._maxZoom)
}
that._fire("max-zoom")
},
getCenter: function() {
return this._center.slice()
},
setCenter: function(value) {
if (this._engine.isinv() && this._changeCenter(value || [])) {
this._triggerCenterChanged()
}
},
_changeCenter: function(value) {
var that = this,
engine = that._engine,
oldCenter = that._center,
newCenter = that._center = parseAndClampArray(value, engine.min(), engine.max(), engine.center()),
isChanged = !arraysEqual(oldCenter, newCenter);
if (isChanged) {
that._adjustCenter();
that._fire("center")
}
return isChanged
},
_triggerCenterChanged: function() {
this._params.centerChanged(this.getCenter())
},
_triggerZoomChanged: function() {
this._params.zoomChanged(this.getZoom())
},
setCenterByPoint: function(coordinates, screenPosition) {
var that = this,
p = that._engine.project(coordinates),
q = that._fromScreen(screenPosition);
that.setCenter(that._engine.unproject([-q[0] / that._zoom + p[0], -q[1] / that._zoom + p[1]]))
},
beginMoveCenter: function() {
if (this._engine.isinv()) {
this._moveCenter = this._center
}
},
endMoveCenter: function() {
var that = this;
if (that._moveCenter) {
if (!arraysEqual(that._moveCenter, that._center)) {
that._triggerCenterChanged()
}
that._moveCenter = null
}
},
moveCenter: function(shift) {
var current, center, that = this;
if (that._moveCenter) {
current = that._toScreen(that._toTransformed(that._engine.project(that._center)));
center = that._engine.unproject(that._fromTransformed(that._fromScreen([current[0] + shift[0], current[1] + shift[1]])));
that._changeCenter(center)
}
},
getViewport: function() {
var that = this,
unproject = that._engine.unproject,
lt = unproject(that._fromTransformed([-1, -1])),
lb = unproject(that._fromTransformed([-1, 1])),
rt = unproject(that._fromTransformed([1, -1])),
rb = unproject(that._fromTransformed([1, 1])),
minmax = findMinMax([selectFarthestPoint(lt[0], lb[0], rt[0], rb[0]), selectFarthestPoint(lt[1], rt[1], lb[1], rb[1])], [selectFarthestPoint(rt[0], rb[0], lt[0], lb[0]), selectFarthestPoint(lb[1], rb[1], lt[1], rt[1])]);
return [].concat(minmax.min, minmax.max)
},
setViewport: function(viewport) {
var engine = this._engine,
data = viewport ? getZoomAndCenterFromViewport(engine.project, engine.unproject, viewport) : [this._minZoom, engine.center()];
this.setZoom(data[0]);
this.setCenter(data[1])
},
getTransform: function() {
return {
translateX: this._dxcenter * this._xradius,
translateY: this._dycenter * this._yradius
}
},
fromScreenPoint: function(coordinates) {
return this._engine.unproject(this._fromTransformed(this._fromScreen(coordinates)))
},
_eventNames: ["engine", "screen", "center", "zoom", "max-zoom"]
};
eventEmitterModule.makeEventEmitter(Projection);
function selectFarthestPoint(point1, point2, basePoint1, basePoint2) {
var basePoint = (basePoint1 + basePoint2) / 2;
return _abs(point1 - basePoint) > _abs(point2 - basePoint) ? point1 : point2
}
function selectClosestPoint(point1, point2, basePoint1, basePoint2) {
var basePoint = (basePoint1 + basePoint2) / 2;
return _abs(point1 - basePoint) < _abs(point2 - basePoint) ? point1 : point2
}
function getZoomAndCenterFromViewport(project, unproject, viewport) {
var lt = project([viewport[0], viewport[3]]),
lb = project([viewport[0], viewport[1]]),
rt = project([viewport[2], viewport[3]]),
rb = project([viewport[2], viewport[1]]),
l = selectClosestPoint(lt[0], lb[0], rt[0], rb[0]),
r = selectClosestPoint(rt[0], rb[0], lt[0], lb[0]),
t = selectClosestPoint(lt[1], rt[1], lb[1], rb[1]),
b = selectClosestPoint(lb[1], rb[1], lt[1], rt[1]);
return [2 / _max(_abs(l - r), _abs(t - b)), unproject([(l + r) / 2, (t + b) / 2])]
}
function Engine(parameters, _original) {
var that = this,
aspectRatio = parameters.aspectRatio > 0 ? _Number(parameters.aspectRatio) : 1,
project = createProjectMethod(parameters.to),
unproject = parameters.from ? createUnprojectMethod(parameters.from) : returnValue(DEFAULT_CENTER),
center = unproject([0, 0]),
minmax = findMinMax([unproject([-1, 0])[0], unproject([0, 1])[1]], [unproject([1, 0])[0], unproject([0, -1])[1]]);
that.project = project;
that.unproject = unproject;
that.original = returnValue(_original || that);
that.source = function() {
return $.extend({}, parameters)
};
that.isinv = returnValue(!!parameters.from);
that.ar = returnValue(aspectRatio);
that.center = returnArray(center);
that.min = returnArray(minmax.min);
that.max = returnArray(minmax.max)
}
Engine.prototype.aspectRatio = function(aspectRatio) {
var parameters = this.source();
parameters.aspectRatio = aspectRatio;
return new Engine(parameters, this)
};
Engine.prototype.bounds = function(bounds) {
bounds = bounds || [];
var parameters = this.source(),
min = this.min(),
max = this.max(),
p1 = parameters.to(parseAndClampArray([bounds[0], bounds[1]], min, max, min)),
p2 = parameters.to(parseAndClampArray([bounds[2], bounds[3]], min, max, max)),
delta = _min(_abs(p2[0] - p1[0]) > MIN_BOUNDS_RANGE ? _abs(p2[0] - p1[0]) : 2, _abs(p2[1] - p1[1]) > MIN_BOUNDS_RANGE ? _abs(p2[1] - p1[1]) : 2);
if (delta < 2) {
$.extend(parameters, createProjectUnprojectMethods(parameters.to, parameters.from, p1, p2, delta))
}
return new Engine(parameters, this)
};
function isEngine(engine) {
return engine instanceof Engine
}
function invertVerticalAxis(pair) {
return [pair[0], -pair[1]]
}
function createProjectMethod(method) {
return function(arg) {
return invertVerticalAxis(method(arg))
}
}
function createUnprojectMethod(method) {
return function(arg) {
return method(invertVerticalAxis(arg))
}
}
function returnValue(value) {
return function() {
return value
}
}
function returnArray(value) {
return function() {
return value.slice()
}
}
function projection(parameters) {
return parameters && parameters.to ? new Engine(parameters) : null
}
function findMinMax(p1, p2) {
return {
min: [_min(p1[0], p2[0]), _min(p1[1], p2[1])],
max: [_max(p1[0], p2[0]), _max(p1[1], p2[1])]
}
}
var projectionsCache = {};
projection.get = function(name) {
return projectionsCache[name] || null
};
projection.add = function(name, engine) {
if (!projectionsCache[name] && isEngine(engine)) {
projectionsCache[name] = engine
}
return projection
};
function createProjectUnprojectMethods(project, unproject, p1, p2, delta) {
var x0 = (p1[0] + p2[0]) / 2 - delta / 2,
y0 = (p1[1] + p2[1]) / 2 - delta / 2,
k = 2 / delta;
return {
to: function(coordinates) {
var p = project(coordinates);
return [-1 + (p[0] - x0) * k, -1 + (p[1] - y0) * k]
},
from: function(coordinates) {
var p = [x0 + (coordinates[0] + 1) / k, y0 + (coordinates[1] + 1) / k];
return unproject(p)
}
}
}
exports.Projection = Projection;
exports.projection = projection;
exports._TESTS_Engine = Engine
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!*******************************!*\
!*** external "window.JSZip" ***!
\*******************************/
function(module, exports) {
module.exports = window.JSZip
},
/*!***************************************!*\
!*** ./Scripts/bundles/modules/ui.js ***!
\***************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
__webpack_require__( /*! ./core */ 97);
module.exports = DevExpress.ui = {};
DevExpress.ui.templateRendered = __webpack_require__( /*! ../../ui/widget/ui.template_base */ 47).renderedCallbacks
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!************************************!*\
!*** ./Scripts/ui/autocomplete.js ***!
\************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
registerComponent = __webpack_require__( /*! ../core/component_registrator */ 3),
DropDownList = __webpack_require__( /*! ./drop_down_editor/ui.drop_down_list */ 181),
themes = __webpack_require__( /*! ./themes */ 23);
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
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!******************************************************!*\
!*** ./Scripts/ui/calendar/ui.calendar.base_view.js ***!
\******************************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Widget = __webpack_require__( /*! ../widget/ui.widget */ 19),
dateUtils = __webpack_require__( /*! ../../core/utils/date */ 12),
dateLocalization = __webpack_require__( /*! ../../localization/date */ 14),
eventUtils = __webpack_require__( /*! ../../events/utils */ 4),
clickEvent = __webpack_require__( /*! ../../events/click */ 9);
var abstract = Widget.abstract,
CALENDAR_OTHER_VIEW_CLASS = "dx-calendar-other-view",
CALENDAR_CELL_CLASS = "dx-calendar-cell",
CALENDAR_EMPTY_CELL_CLASS = "dx-calendar-empty-cell",
CALENDAR_TODAY_CLASS = "dx-calendar-today",
CALENDAR_SELECTED_DATE_CLASS = "dx-calendar-selected-date",
CALENDAR_CONTOURED_DATE_CLASS = "dx-calendar-contoured-date",
CALENDAR_DXCLICK_EVENT_NAME = eventUtils.addNamespace(clickEvent.name, "dxCalendar"),
CALENDAR_DATE_VALUE_KEY = "dxDateValueKey";
var BaseView = Widget.inherit({
_getViewName: function() {
return "base"
},
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
date: new Date,
focusStateEnabled: false,
cellTemplate: null,
onCellClick: null,
rowCount: 3,
colCount: 4,
allowValueSelection: true
})
},
_init: function() {
this.callBase();
var value = this.option("value");
this.option("value", new Date(value));
if (!this.option("value").valueOf()) {
this.option("value", new Date(0, 0, 0, 0, 0, 0))
}
},
_render: function() {
this.callBase();
this._renderImpl()
},
_renderImpl: function() {
this._$table = $("");
this.element().append(this._$table);
this._renderBody();
this._renderContouredDate();
this._renderValue();
this._renderEvents()
},
_renderBody: function() {
this.$body = $("").appendTo(this._$table);
var that = this,
cellTemplate = this.option("cellTemplate");
var appendChild = this.option("rtl") ? function(row, cell) {
row.insertBefore(cell, row.firstChild)
} : function(row, cell) {
row.appendChild(cell)
};
function renderCell(cellIndex) {
var cell = document.createElement("td"),
className = CALENDAR_CELL_CLASS;
if (that._isTodayCell(cellDate)) {
className = className + " " + CALENDAR_TODAY_CLASS
}
if (that._isDateOutOfRange(cellDate)) {
className = className + " " + CALENDAR_EMPTY_CELL_CLASS
}
if (that._isOtherView(cellDate)) {
className = className + " " + CALENDAR_OTHER_VIEW_CLASS
}
cell.className = className;
cell.setAttribute("data-value", dateLocalization.format(cellDate, dateUtils.getShortDateFormat()));
$.data(cell, CALENDAR_DATE_VALUE_KEY, cellDate);
that.setAria({
role: "option",
label: that.getCellAriaLabel(cellDate)
}, $(cell));
appendChild(row, cell);
if (cellTemplate) {
cellTemplate.render({
text: that._getCellText(cellDate),
date: cellDate,
view: that._getViewName()
}, $(cell), cellIndex)
} else {
cell.innerHTML = that._getCellText(cellDate)
}
cellDate = that._getNextCellData(cellDate)
}
var cellDate = this._getFirstCellData(),
colCount = this.option("colCount");
for (var indexRow = 0, len = this.option("rowCount"); indexRow < len; indexRow++) {
var row = document.createElement("tr");
this.$body.get(0).appendChild(row);
this._iterateCells(colCount, renderCell)
}
},
_iterateCells: function(colCount, delegate) {
var i = 0;
while (i < colCount) {
delegate(i);
++i
}
},
_renderEvents: function() {
this._createCellClickAction();
this._$table.off(CALENDAR_DXCLICK_EVENT_NAME).on(CALENDAR_DXCLICK_EVENT_NAME, "td", $.proxy(function(e) {
if (!$(e.currentTarget).hasClass(CALENDAR_EMPTY_CELL_CLASS)) {
this._cellClickAction({
jQueryEvent: e,
value: $(e.currentTarget).data(CALENDAR_DATE_VALUE_KEY)
})
}
}, this))
},
_createCellClickAction: function(e) {
this._cellClickAction = this._createActionByOption("onCellClick")
},
_isTodayCell: abstract,
_isDateOutOfRange: abstract,
_isOtherView: abstract,
_getCellText: abstract,
_getFirstCellData: abstract,
_getNextCellData: abstract,
_renderContouredDate: function(contouredDate) {
if (!this.option("focusStateEnabled")) {
return
}
contouredDate = contouredDate || this.option("contouredDate");
var $oldContouredCell = this._$table.find("." + CALENDAR_CONTOURED_DATE_CLASS);
var $newContouredCell = this._getCellByDate(contouredDate);
$oldContouredCell.removeClass(CALENDAR_CONTOURED_DATE_CLASS);
$newContouredCell.addClass(CALENDAR_CONTOURED_DATE_CLASS)
},
_dispose: function() {
this._keyboardProcessor = void 0;
this.callBase()
},
_changeValue: function(cellDate) {
if (cellDate) {
var value = this.option("value"),
newValue = value ? new Date(value) : new Date;
newValue.setDate(cellDate.getDate());
newValue.setMonth(cellDate.getMonth());
newValue.setFullYear(cellDate.getFullYear());
newValue.setDate(cellDate.getDate());
this.option("value", newValue)
} else {
this.option("value", null)
}
},
_renderValue: function() {
if (!this.option("allowValueSelection")) {
return
}
var value = this.option("value"),
selectedCell = this._getCellByDate(value);
if (this._selectedCell) {
this._selectedCell.removeClass(CALENDAR_SELECTED_DATE_CLASS)
}
selectedCell.addClass(CALENDAR_SELECTED_DATE_CLASS);
this._selectedCell = selectedCell
},
getCellAriaLabel: function(date) {
return this._getCellText(date)
},
_getFirstAvailableDate: function() {
var date = this.option("date"),
min = this.option("min");
date = dateUtils.getFirstDateView(this._getViewName(), date);
return new Date(min && date < min ? min : date)
},
_getCellByDate: abstract,
isBoundary: abstract,
_optionChanged: function(args) {
var name = args.name;
switch (name) {
case "value":
this._renderValue();
break;
case "contouredDate":
this._renderContouredDate(args.value);
break;
case "onCellClick":
this._createCellClickAction();
break;
case "cellTemplate":
this._invalidate();
break;
default:
this.callBase(args)
}
}
});
module.exports = BaseView
}.call(exports, __webpack_require__, exports, module), void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
},
/*!********************************************!*\
!*** ./Scripts/ui/calendar/ui.calendar.js ***!
\********************************************/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require, exports, module) {
var $ = __webpack_require__( /*! jquery */ 1),
Guid = __webpack_require__( /*! ../../core/guid */ 33),
registerComponent = __webpack_require__( /*! ../../core/component_registrator */ 3),
commonUtils = __webpack_require__( /*! ../../core/utils/common */ 2),
Button = __webpack_require__( /*! ../button */ 24),
Editor = __webpack_require__( /*! ../editor/editor */ 31),
Swipeable = __webpack_require__( /*! ../../events/gesture/swipeable */ 76),
Navigator = __webpack_require__( /*! ./ui.calendar.navigator */ 356),
Views = __webpack_require__( /*! ./ui.calendar.views */ 357),
translator = __webpack_require__( /*! ../../animation/translator */ 15),
browser = __webpack_require__( /*! ../../core/utils/browser */ 22),
dateUtils = __webpack_require__( /*! ../../core/utils/date */ 12),
devices = __webpack_require__( /*! ../../core/devices */ 7),
fx = __webpack_require__( /*! ../../animation/fx */ 21),
dateLocalization = __webpack_require__( /*! ../../localization/date */ 14),
config = __webpack_require__( /*! ../../core/config */ 35),
messageLocalization = __webpack_require__( /*! ../../localization/message */ 8);
var CALENDAR_CLASS = "dx-calendar",
CALENDAR_BODY_CLASS = "dx-calendar-body",
CALENDAR_CELL_CLASS = "dx-calendar-cell",
CALENDAR_FOOTER_CLASS = "dx-calendar-footer",
CALENDAR_TODAY_BUTTON_CLASS = "dx-calendar-today-button",
CALENDAR_HAS_FOOTER_CLASS = "dx-calendar-with-footer",
CALENDAR_VIEWS_WRAPPER_CLASS = "dx-calendar-views-wrapper",
CALENDAR_VIEW_CLASS = "dx-calendar-view",
FOCUSED_STATE_CLASS = "dx-state-focused",
ANIMATION_DURATION_SHOW_VIEW = 250,
POP_ANIMATION_FROM = .6,
POP_ANIMATION_TO = 1,
CALENDAR_DATE_VALUE_KEY = "dxDateValueKey",
LEVEL_COMPARE_MAP = {
month: 3,
year: 2,
decade: 1,
century: 0
};
var Calendar = Editor.inherit({
_activeStateUnit: "." + CALENDAR_CELL_CLASS,
_getDefaultOptions: function() {
return $.extend(this.callBase(), {
hoverStateEnabled: true,
activeStateEnabled: true,
currentDate: new Date,
value: null,
min: new Date(1e3, 0),
max: new Date(3e3, 0),
firstDayOfWeek: void 0,
zoomLevel: "month",
maxZoomLevel: "month",
minZoomLevel: "century",
showTodayButton: false,
cellTemplate: "cell",
onCellClick: null,
onContouredChanged: null,
hasFocus: function(element) {
return element.hasClass(FOCUSED_STATE_CLASS)
}
})
},
_defaultOptionsRules: function() {
return this.callBase().concat([{
device: function() {
return "desktop" === devices.real().deviceType && !devices.isSimulator()
},
options: {
focusStateEnabled: true
}
}])
},
_supportedKeys: function() {
return $.extend(this.callBase(), {
rightArrow: function(e) {
e.preventDefault();
if (e.ctrlKey) {
this._waitRenderView(1)
} else {
this._moveCurrentDate(1 * this._getRtlCorrection())
}
},
leftArrow: function(e) {
e.preventDefault();
if (e.ctrlKey) {
this._waitRenderView(-1)
} else {
this._moveCurrentDate(-1 * this._getRtlCorrection())
}
},
upArrow: function(e) {
e.preventDefault();
if (e.ctrlKey) {
this._navigateUp()
} else {
if (fx.isAnimating(this._view.element())) {
return
}
this._moveCurrentDate(-1 * this._view.option("colCount"))
}
},
downArrow: function(e) {
e.preventDefault();
if (e.ctrlKey) {
this._navigateDown()
} else {
if (fx.isAnimating(this._view.element())) {
return
}
this._moveCurrentDate(1 * this._view.option("colCount"))
}
},
home: function(e) {
e.preventDefault();
var zoomLevel = this.option("zoomLevel");
var currentDate = this.option("currentDate");
var min = this._dateOption("min");
var date = dateUtils.sameView(zoomLevel, currentDate, min) ? min : dateUtils.getViewFirstCellDate(zoomLevel, currentDate);
this.option("currentDate", date)
},
end: function(e) {
e.preventDefault();
var zoomLevel = this.option("zoomLevel");
var currentDate = this.option("currentDate");
var max = this._dateOption("max");
var date = dateUtils.sameView(zoomLevel, currentDate, max) ? max : dateUtils.getViewLastCellDate(zoomLevel, currentDate);
this.option("currentDate", date)
},
pageUp: function(e) {
e.preventDefault();
this._waitRenderView(-1)
},
pageDown: function(e) {
e.preventDefault();
this._waitRenderView(1)
},
tab: $.noop,
enter: function(e) {
if (!this._isMaxZoomLevel()) {
this._navigateDown()
} else {
var value = this._updateTimeComponent(this.option("currentDate"));
this._dateOption("value", value)
}
}
})
},
_getSerializationFormat: function() {
var value = this.option("value");
if (commonUtils.isNumber(value)) {
return "number"
}
if (!commonUtils.isString(value)) {
return
}
return dateUtils.getDateSerializationFormat(value)
},
_convertToDate: function(value) {
var serializationFormat = this._getSerializationFormat();
var date = dateUtils.deserializeDate(value, serializationFormat, $.proxy(dateLocalization.parse, dateLocalization));
return date
},
_dateOption: function(optionName, optionValue) {
if (1 === arguments.length) {
return this._convertToDate(this.option(optionName))
}
var serializationFormat = this._getSerializationFormat();
this.option(optionName, dateUtils.serializeDate(optionValue, serializationFormat, $.proxy(dateLocalization.format, dateLocalization)))
},
_moveCurrentDate: function(offset) {
var currentDate = new Date(this.option("currentDate"));
var newDate = new Date(currentDate);
var zoomLevel = this.option("zoomLevel");
switch (zoomLevel) {
case "month":
newDate.setDate(currentDate.getDate() + offset);
break;
case "year":
newDate.setMonth(currentDate.getMonth() + offset);
break;
case "decade":
newDate.setFullYear(currentDate.getFullYear() + offset);
break;
case "century":
newDate.setFullYear(currentDate.getFullYear() + 10 * offset)
}
var offsetCorrection = 2 * offset / Math.abs(offset);
if (Math.abs(offset) > 1 && !dateUtils.sameView(zoomLevel, currentDate, newDate)) {
if ("decade" === zoomLevel) {
newDate.setFullYear(currentDate.getFullYear() + offset - offsetCorrection)
}
if ("century" === zoomLevel) {
newDate.setFullYear(currentDate.getFullYear() + 10 * (offset - offsetCorrection))
}
}
this.option("currentDate", newDate)
},
_init: function() {
this.callBase();
this._correctZoomLevel();
this._initCurrentDate();
this._initActions()
},
_correctZoomLevel: function() {
var minZoomLevel = this.option("minZoomLevel"),
maxZoomLevel = this.option("maxZoomLevel"),
zoomLevel = this.option("zoomLevel");
if (LEVEL_COMPARE_MAP[maxZoomLevel] < LEVEL_COMPARE_MAP[minZoomLevel]) {
return
}
if (LEVEL_COMPARE_MAP[zoomLevel] > LEVEL_COMPARE_MAP[maxZoomLevel]) {
this.option("zoomLevel", maxZoomLevel)
} else {
if (LEVEL_COMPARE_MAP[zoomLevel] < LEVEL_COMPARE_MAP[minZoomLevel]) {
this.option("zoomLevel", minZoomLevel)
}
}
},
_initCurrentDate: function() {
var currentDate = this._getNormalizedDate(this._dateOption("value")) || this._getNormalizedDate(this.option("currentDate"));
this.option("currentDate", currentDate)
},
_getNormalizedDate: function(date) {
date = dateUtils.normalizeDate(date, this._getMinDate(), this._getMaxDate());
return commonUtils.isDefined(date) ? new Date(date) : date
},
_initActions: function() {
this._cellClickAction = this._createActionByOption("onCellClick");
this._onContouredChanged = this._createActionByOption("onContouredChanged")
},
_updateCurrentDate: function(date) {
if (fx.isAnimating(this._$viewsWrapper)) {
fx.stop(this._$viewsWrapper, true)
}
var min = this._getMinDate(),
max = this._getMaxDate();
if (min > max) {
this.option("currentDate", new Date);
return
}
var normalizedDate = this._getNormalizedDate(date);
if (date.getTime() !== normalizedDate.getTime()) {
this.option("currentDate", new Date(normalizedDate));
return
}
var offset = this._getViewsOffset(this._view.option("date"), normalizedDate);
if (0 !== offset && !this._isMaxZoomLevel() && this._isOtherViewCellClicked) {
offset = 0
}
if (this._view && 0 !== offset && !this._suppressNavigation) {
this._navigate(offset, normalizedDate)
} else {
this._renderNavigator();
this._setViewContoured(normalizedDate);
this._updateAriaId(normalizedDate)
}
},
_setViewContoured: function(date) {
if (this.option("hasFocus")(this._focusTarget())) {
this._view.option("contouredDate", date)
}
},
_getMinDate: function() {
if (this.min) {
return this.min
}
this.min = this._dateOption("min") || new Date(1e3, 0);
return this.min
},
_getMaxDate: function() {
if (this.max) {
return this.max
}
this.max = this._dateOption("max") || new Date(3e3, 0);
return this.max
},
_getViewsOffset: function(startDate, endDate) {
var zoomLevel = this.option("zoomLevel");
if ("month" === zoomLevel) {
return this._getMonthsOffset(startDate, endDate)
}
var zoomCorrection;
switch (zoomLevel) {
case "century":
zoomCorrection = 100;
break;
case "decade":
zoomCorrection = 10;
break;
default:
zoomCorrection = 1
}
return parseInt(endDate.getFullYear() / zoomCorrection) - parseInt(startDate.getFullYear() / zoomCorrection)
},
_getMonthsOffset: function(startDate, endDate) {
var yearOffset = endDate.getFullYear() - startDate.getFullYear(),
monthOffset = endDate.getMonth() - startDate.getMonth();
return 12 * yearOffset + monthOffset
},
_waitRenderView: function(offset) {
if (this._alreadyViewRender) {
return
}
this._alreadyViewRender = true;
var date = this._getDateByOffset(offset * this._getRtlCorrection());
this.option("currentDate", date);
setTimeout($.proxy(function() {
this._alreadyViewRender = false
}, this))
},
_getRtlCorrection: function() {
return this.option("rtlEnabled") ? -1 : 1
},
_getDateByOffset: function(offset, date) {
date = new Date(date || this.option("currentDate"));
var currentDay = date.getDate();
var difference = dateUtils.getDifferenceInMonth(this.option("zoomLevel")) * offset;
date.setDate(1);
date.setMonth(date.getMonth() + difference);
var lastDay = dateUtils.getLastMonthDate(date).getDate();
date.setDate(currentDay > lastDay ? lastDay : currentDay);
return date
},
_focusTarget: function() {
return this.element()
},
_render: function() {
this.callBase();
this.element().addClass(CALENDAR_CLASS);
this._renderBody();
this.element().append(this.$body);
this._renderViews();
this._renderNavigator();
this._renderSwipeable();
this._renderFooter();
this.setAria({
role: "listbox",
label: messageLocalization.format("dxCalendar-ariaWidgetName")
});
this._updateAriaSelected();
this._updateAriaId();
this._setViewContoured(this.option("currentDate"));
this.element().append(this._navigator.element())
},
_renderBody: function() {
if (!this._$viewsWrapper) {
this.$body = $(" |