@singularsystems/neo-core 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,7 +9,6 @@ export default class DatePicker {
|
|
|
9
9
|
private contentAnimationHelper;
|
|
10
10
|
private headerAnimationHelper;
|
|
11
11
|
private inputHasChanged;
|
|
12
|
-
private canAutoSetDate;
|
|
13
12
|
private input;
|
|
14
13
|
private popup;
|
|
15
14
|
private headerContainer;
|
|
@@ -61,7 +60,7 @@ export default class DatePicker {
|
|
|
61
60
|
private dayClicked;
|
|
62
61
|
private monthClicked;
|
|
63
62
|
private yearClicked;
|
|
64
|
-
private
|
|
63
|
+
private headerLabelClick;
|
|
65
64
|
private previousClick;
|
|
66
65
|
private nextClick;
|
|
67
66
|
private moveCurrent;
|
|
@@ -15,7 +15,6 @@ var DatePicker = /** @class */ (function () {
|
|
|
15
15
|
this.container = container;
|
|
16
16
|
this.isReadOnly = false;
|
|
17
17
|
this.inputHasChanged = false;
|
|
18
|
-
this.canAutoSetDate = false;
|
|
19
18
|
this.currentBindValue = null;
|
|
20
19
|
this.boundDateNoTime = null;
|
|
21
20
|
this.options = ProcessedDatePickerOptions.fromPartial(options || {});
|
|
@@ -243,13 +242,14 @@ var DatePicker = /** @class */ (function () {
|
|
|
243
242
|
};
|
|
244
243
|
DatePicker.prototype.createHeader = function () {
|
|
245
244
|
var header = this.createAndAppend(this.popup, "div", "neo-datepicker-header");
|
|
245
|
+
header.addEventListener("mousedown", function (e) { return e.preventDefault(); });
|
|
246
246
|
this.prevButton = this.createAndAppend(header, "button", "left-button");
|
|
247
247
|
this.prevButton.type = "button";
|
|
248
248
|
this.prevButton.innerText = "<";
|
|
249
249
|
this.prevButton.tabIndex = -1;
|
|
250
250
|
this.prevButton.addEventListener("mousedown", this.previousClick.bind(this));
|
|
251
251
|
this.headerContainer = this.createAndAppend(header, "div", "header-text-container");
|
|
252
|
-
this.headerContainer.addEventListener("mousedown", this.
|
|
252
|
+
this.headerContainer.addEventListener("mousedown", this.headerLabelClick.bind(this));
|
|
253
253
|
this.headerAnimationHelper = new AnimationHelper(this.headerContainer, DatePicker.AnimationClassName);
|
|
254
254
|
this.nextButton = this.createAndAppend(header, "button", "right-button");
|
|
255
255
|
this.nextButton.type = "button";
|
|
@@ -338,7 +338,6 @@ var DatePicker = /** @class */ (function () {
|
|
|
338
338
|
if (currentDate.getMonth() != this.currentViewDate.getMonth())
|
|
339
339
|
break;
|
|
340
340
|
}
|
|
341
|
-
this.canAutoSetDate = false;
|
|
342
341
|
};
|
|
343
342
|
DatePicker.prototype.createMonthsView = function () {
|
|
344
343
|
this.currentContentTable = this.createAndAppend(this.contentContainer, "table", "month-view");
|
|
@@ -421,7 +420,6 @@ var DatePicker = /** @class */ (function () {
|
|
|
421
420
|
}
|
|
422
421
|
else {
|
|
423
422
|
this.currentViewType = ViewType.Days;
|
|
424
|
-
this.canAutoSetDate = true;
|
|
425
423
|
this.populateContentContainer(false);
|
|
426
424
|
this.contentAnimationHelper.fadeAndScale(true);
|
|
427
425
|
}
|
|
@@ -437,7 +435,7 @@ var DatePicker = /** @class */ (function () {
|
|
|
437
435
|
this.contentAnimationHelper.fadeAndScale(true);
|
|
438
436
|
}
|
|
439
437
|
};
|
|
440
|
-
DatePicker.prototype.
|
|
438
|
+
DatePicker.prototype.headerLabelClick = function (e) {
|
|
441
439
|
e.preventDefault();
|
|
442
440
|
if (this.currentHeaderLabel.classList.contains("selectable")) {
|
|
443
441
|
if (this.currentViewType == ViewType.Days) {
|
|
@@ -463,7 +461,6 @@ var DatePicker = /** @class */ (function () {
|
|
|
463
461
|
};
|
|
464
462
|
DatePicker.prototype.moveCurrent = function (delta) {
|
|
465
463
|
if (this.currentViewType == ViewType.Days) {
|
|
466
|
-
this.canAutoSetDate = true;
|
|
467
464
|
this.currentViewDate.setMonth(this.currentViewDate.getMonth() + delta, 1);
|
|
468
465
|
this.autoSetDay();
|
|
469
466
|
}
|
|
@@ -125,24 +125,29 @@ var NeoTypeInfo = /** @class */ (function () {
|
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
NeoTypeInfo.prototype.addRules = function (instance) {
|
|
128
|
-
var
|
|
129
|
-
var addRulesMethod =
|
|
128
|
+
var hasStaticMethod = this.objectConstructor.hasOwnProperty("addBusinessRules");
|
|
129
|
+
var addRulesMethod = hasStaticMethod ? this.objectConstructor.addBusinessRules : instance.addBusinessRules;
|
|
130
130
|
if (addRulesMethod !== undefined) {
|
|
131
131
|
var validationRules = new ValidationRules();
|
|
132
|
-
|
|
132
|
+
if (hasStaticMethod) {
|
|
133
|
+
addRulesMethod(validationRules);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
addRulesMethod.call(instance, validationRules);
|
|
137
|
+
}
|
|
133
138
|
if (validationRules.rules.some(function (c) { return c instanceof CallbackRule && c.hasArrowFunction; })) {
|
|
134
139
|
console.error("Warning: ".concat(this.objectConstructor.name, " has rules which have been added using an arrow function."));
|
|
135
140
|
}
|
|
136
141
|
var modelProxy = new ModelProxy(instance);
|
|
137
|
-
for (var _i = 0,
|
|
138
|
-
var rule =
|
|
142
|
+
for (var _i = 0, _a = validationRules.rules; _i < _a.length; _i++) {
|
|
143
|
+
var rule = _a[_i];
|
|
139
144
|
var properties = rule.getDisplayProperties(this.propertyMap);
|
|
140
145
|
if (properties === undefined && rule instanceof ExpressionRule) {
|
|
141
146
|
properties = modelProxy.tryExtractProperties(rule);
|
|
142
147
|
}
|
|
143
148
|
if (properties && properties.length) {
|
|
144
|
-
for (var
|
|
145
|
-
var property = properties_1[
|
|
149
|
+
for (var _b = 0, properties_1 = properties; _b < properties_1.length; _b++) {
|
|
150
|
+
var property = properties_1[_b];
|
|
146
151
|
property.rules.push(rule);
|
|
147
152
|
}
|
|
148
153
|
}
|