Skip to content

Commit

Permalink
Bumped version to 1.0.51 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
fragsalat committed Aug 3, 2018
1 parent 7ee9fc6 commit 251031b
Show file tree
Hide file tree
Showing 54 changed files with 2,849 additions and 390 deletions.
8 changes: 7 additions & 1 deletion dist/amd/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['exports', './ws-header/ws-header', './ws-date-picker/ws-date-picker', './ws-dropdown/ws-dropdown', './ws-inline-edit/ws-inline-edit', './ws-notification/ws-notification', './ws-week-picker/ws-week-picker', './ws-tiles-chart/ws-tiles-chart', './ws-spinner/ws-spinner', './ws-tab-menu/ws-tab-menu', './ws-option-buttons/ws-option-buttons', './ws-multi-select/ws-multi-select'], function (exports, _wsHeader, _wsDatePicker, _wsDropdown, _wsInlineEdit, _wsNotification, _wsWeekPicker, _wsTilesChart, _wsSpinner, _wsTabMenu, _wsOptionButtons, _wsMultiSelect) {
define(['exports', './ws-header/ws-header', './ws-date-picker/ws-date-picker', './ws-overlay/ws-overlay', './ws-dropdown/ws-dropdown', './ws-inline-edit/ws-inline-edit', './ws-notification/ws-notification', './ws-week-picker/ws-week-picker', './ws-tiles-chart/ws-tiles-chart', './ws-spinner/ws-spinner', './ws-tab-menu/ws-tab-menu', './ws-option-buttons/ws-option-buttons', './ws-multi-select/ws-multi-select'], function (exports, _wsHeader, _wsDatePicker, _wsOverlay, _wsDropdown, _wsInlineEdit, _wsNotification, _wsWeekPicker, _wsTilesChart, _wsSpinner, _wsTabMenu, _wsOptionButtons, _wsMultiSelect) {
'use strict';

Object.defineProperty(exports, "__esModule", {
Expand All @@ -16,6 +16,12 @@ define(['exports', './ws-header/ws-header', './ws-date-picker/ws-date-picker', '
return _wsDatePicker.WSDatePicker;
}
});
Object.defineProperty(exports, 'WSOverlay', {
enumerable: true,
get: function () {
return _wsOverlay.WSOverlay;
}
});
Object.defineProperty(exports, 'WSDropdown', {
enumerable: true,
get: function () {
Expand Down
1 change: 1 addition & 0 deletions dist/amd/ws-date-picker/flatpickr.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ define(['module'], function (module) {
self.changeYear = changeYear;
self.clear = clear;
self.close = close;
self.documentClick = documentClick;
self._createElement = createElement;
self.destroy = destroy;
self.formatDate = formatDate;
Expand Down
35 changes: 26 additions & 9 deletions dist/amd/ws-date-picker/ws-date-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ define(['exports', '../imports', './flatpickr'], function (exports, _imports, _f

var _this = _possibleConstructorReturn(this, (WSDatePicker.__proto__ || Object.getPrototypeOf(WSDatePicker)).call(this, props));

Object.defineProperty(_this, 'onClick', {
enumerable: true,
writable: true,
value: function value(event) {
_this.stopPropagation(event);

WSDatePicker.flatpickrInstances.forEach(function (pickr) {
return pickr.documentClick(event);
});
}
});
Object.defineProperty(_this, 'stopPropagation', {
enumerable: true,
writable: true,
Expand Down Expand Up @@ -156,9 +167,10 @@ define(['exports', '../imports', './flatpickr'], function (exports, _imports, _f
}, this.props.options, {
onChange: this.onChange.bind(this)
}));
WSDatePicker.flatpickrInstances.push(this.flatpickr);

this.input.addEventListener('change', this.stopPropagation);
this.element.addEventListener('click', this.stopPropagation);
this.element.addEventListener('click', this.onClick);
}
}, {
key: 'componentWillReceiveProps',
Expand All @@ -172,13 +184,19 @@ define(['exports', '../imports', './flatpickr'], function (exports, _imports, _f
Object.keys(props.options || {}).forEach(function (key) {
_this2.flatpickr.set(key, props.options[key]);
});
this.setState({ value: props.value });
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.flatpickr.destroy();
this.input.removeEventListener('change', this.stopPropagation);
this.element.removeEventListener('click', this.stopPropagation);
this.element.removeEventListener('click', this.onClick);
this.flatpickr.destroy();

var index = WSDatePicker.flatpickrInstances.indexOf(this.flatpickr);
if (index !== -1) {
WSDatePicker.flatpickrInstances.splice(index, 1);
}
}
}, {
key: 'onChange',
Expand Down Expand Up @@ -225,12 +243,6 @@ define(['exports', '../imports', './flatpickr'], function (exports, _imports, _f
className: 'icon icon-calendar icon16 ' + className,
ref: function ref(element) {
_this3.input = element;
},
onClick: function onClick(event) {
return _this3.flatpickr.open(event);
},
onKeyDown: function onKeyDown(event) {
return _this3.flatpickr.open(event);
}
})
);
Expand Down Expand Up @@ -269,4 +281,9 @@ define(['exports', '../imports', './flatpickr'], function (exports, _imports, _f
writable: true,
value: 'd.m.Y'
});
Object.defineProperty(WSDatePicker, 'flatpickrInstances', {
enumerable: true,
writable: true,
value: []
});
});
1 change: 1 addition & 0 deletions dist/amd/ws-dropdown/ws-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ define(['exports', '../imports', './dropdown-menu', './dropdown-input', '../ws-o
writable: true,
value: function value(event) {
event.stopPropagation();
event.preventDefault();
if (!_this.props.disabled) {
_this.overlay.toggle();
}
Expand Down
53 changes: 53 additions & 0 deletions dist/amd/ws-inline-edit/types/abstract-type-strategy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
define(["exports"], function (exports) {
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});

function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}

var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}

return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();

var AbstractTypeStrategy = exports.AbstractTypeStrategy = function () {
function AbstractTypeStrategy(options) {
_classCallCheck(this, AbstractTypeStrategy);

this.options = options;
}

_createClass(AbstractTypeStrategy, [{
key: "validate",
value: function validate(value) {
return true;
}
}, {
key: "convert",
value: function convert(value) {
return value;
}
}]);

return AbstractTypeStrategy;
}();
});
125 changes: 125 additions & 0 deletions dist/amd/ws-inline-edit/types/number-strategy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
define(['exports', './abstract-type-strategy'], function (exports, _abstractTypeStrategy) {
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.NumberStrategy = undefined;

function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}

var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}

return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();

function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}

return call && (typeof call === "object" || typeof call === "function") ? call : self;
}

function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}

subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}

var english = '([0-9]*(,[0-9]{3})*)(\\.[0-9]+)?';
var german = '([0-9]*(\\.[0-9]{3})*)(,[0-9]+)?';
var strip = function strip(str) {
return str.replace(/[.,]/g, '');
};

var NumberStrategy = exports.NumberStrategy = function (_AbstractTypeStrategy) {
_inherits(NumberStrategy, _AbstractTypeStrategy);

function NumberStrategy(options) {
_classCallCheck(this, NumberStrategy);

var _this = _possibleConstructorReturn(this, (NumberStrategy.__proto__ || Object.getPrototypeOf(NumberStrategy)).call(this, options));

_this.locale = options.locale;
return _this;
}

_createClass(NumberStrategy, [{
key: 'validate',
value: function validate(value) {
if (!value) {
return false;
}

if (this.locale) {
return NumberStrategy.getPattern(this.locale).test(value);
}
return NumberStrategy.getPattern('en').test(value) || NumberStrategy.getPattern('de').test(value);
}
}, {
key: 'convert',
value: function convert(value) {
var simple = void 0;
if (this.locale) {
simple = value.replace(NumberStrategy.getPattern(this.locale), NumberStrategy.convertToDecimal);
} else if (NumberStrategy.getPattern('en').test(value)) {
simple = value.replace(NumberStrategy.getPattern('en'), NumberStrategy.convertToDecimal);
} else if (NumberStrategy.getPattern('de').test(value)) {
simple = value.replace(NumberStrategy.getPattern('de'), NumberStrategy.convertToDecimal);
}
return parseFloat(simple);
}
}], [{
key: 'getPattern',
value: function getPattern(locale) {
switch (locale) {
case 'de':
return new RegExp('^' + german + '$');
case 'en':
return new RegExp('^' + english + '$');
default:
return new RegExp('^' + english + '$');
}
}
}, {
key: 'convertToDecimal',
value: function convertToDecimal(match) {
var combined = strip((arguments.length <= 1 ? undefined : arguments[1]) || (arguments.length <= 4 ? undefined : arguments[4]));
if ((arguments.length <= 3 ? undefined : arguments[3]) || (arguments.length <= 6 ? undefined : arguments[6])) {
combined += '.' + strip((arguments.length <= 3 ? undefined : arguments[3]) || (arguments.length <= 6 ? undefined : arguments[6]));
}
return combined;
}
}]);

return NumberStrategy;
}(_abstractTypeStrategy.AbstractTypeStrategy);
});
Loading

0 comments on commit 251031b

Please sign in to comment.