jsl-ui 9.28.2 → 9.28.4
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.
- package/lib/components/IntervalComponent.js +32 -35
- package/lib/components/auto-suggest/AutoSuggestComponent.js +19 -21
- package/lib/components/button/ButtonComponent.js +13 -30
- package/lib/components/checkbox/CheckBoxComponent.js +22 -39
- package/lib/components/date/DateComponent.js +29 -46
- package/lib/components/date-range/DateRangeComponent.js +48 -63
- package/lib/components/date-time/DateTimeComponent.js +17 -31
- package/lib/components/dialog/DialogComponent.js +75 -134
- package/lib/components/drop-down/DropDownComponent.js +23 -37
- package/lib/components/expander/ExpanderComponent.js +20 -23
- package/lib/components/form-field/FormComponent.js +9 -12
- package/lib/components/form-field/FormFieldComponent.js +28 -30
- package/lib/components/grid/GridComponent.js +46 -52
- package/lib/components/input/InputComponent.js +26 -47
- package/lib/components/loading/LoadingComponent.js +7 -9
- package/lib/components/navigation/NavigationComponent.js +20 -43
- package/lib/components/notification/Notification.js +18 -22
- package/lib/components/number/NumberComponent.js +28 -46
- package/lib/components/overlay/OverlayComponent.js +45 -60
- package/lib/components/progress/ProgressComponent.js +15 -17
- package/lib/components/ribbon-menu/RibbonMenuComponent.js +9 -20
- package/lib/components/select/SelectComponent.js +105 -122
- package/lib/components/select/SelectDDAreaComponent.js +108 -122
- package/lib/components/slider/nouislider.js +1 -1
- package/lib/components/stack-panel/SplitterComponent.js +27 -29
- package/lib/components/stack-panel/StackPanelComponent.js +17 -31
- package/lib/components/tabs/TabsComponent.js +53 -66
- package/lib/components/time/TimeComponent.js +32 -43
- package/lib/components/tree-view/TreeViewComponent.js +13 -16
- package/lib/components/virtual-render/VirtualRenderComponent.js +30 -44
- package/lib/core/culture.js +2 -2
- package/lib/core/date.js +68 -72
- package/lib/core/helper.js +30 -34
- package/lib/core/jq.js +54 -63
- package/lib/core/lang.js +24 -28
- package/lib/core/numeric.js +35 -39
- package/lib/grid/filterDialogs/dateRangeFilter.js +98 -148
- package/lib/grid/filterDialogs/excelFilter.js +205 -271
- package/lib/grid/plugins/ext.overlay.js +9 -9
- package/lib/grid/plugins/slick.cellrangedecorator.js +2 -2
- package/lib/grid/plugins/slick.cellrangeselector.js +1 -1
- package/lib/grid/plugins/slick.cellselectionmodel.js +8 -8
- package/lib/grid/plugins/slick.headerbuttons.js +1 -1
- package/lib/grid/plugins/slick.headermenu.js +1 -1
- package/lib/grid/plugins/slick.rowmovemanager.js +2 -2
- package/lib/grid/plugins/slick.rowselectionmodel.js +1 -1
- package/lib/grid/slick.core.js +1 -1
- package/lib/grid/slick.creator.js +144 -144
- package/lib/grid/slick.dataview.js +127 -138
- package/lib/grid/slick.editors.core.js +1 -1
- package/lib/grid/slick.editors.date.js +2 -2
- package/lib/grid/slick.editors.lookup.js +36 -37
- package/lib/grid/slick.editors.nav.js +1 -1
- package/lib/grid/slick.formatters.js +26 -26
- package/lib/grid/slick.grid.js +163 -166
- package/lib/grid/slick.groupitemmetadataprovider.js +4 -4
- package/lib/grid/slick.tree.js +91 -103
- package/lib/index.js.map +1 -1
- package/lib/interaction/eventhandler.js +20 -23
- package/lib/interaction/moveable.js +76 -90
- package/lib/interaction/resizable.js +58 -72
- package/lib/ui/auto.suggest.js +13 -28
- package/lib/ui/date.picker/lib/fns.js +1 -5
- package/lib/ui/dialog.js +28 -43
- package/lib/ui/drop.down.js +4 -4
- package/lib/ui/number.input.js +8 -19
- package/package.json +1 -1
|
@@ -1,68 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export class IntervalComponent {
|
|
2
|
+
constructor(fnc, options) {
|
|
3
3
|
this.fnc = fnc;
|
|
4
4
|
this.options = options;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
isEqual(node) {
|
|
7
7
|
return this.__proto__ === node.__proto__;
|
|
8
|
-
}
|
|
9
|
-
|
|
8
|
+
}
|
|
9
|
+
render() {
|
|
10
10
|
return { tag: "input", attr: { type: "hidden" } };
|
|
11
|
-
}
|
|
12
|
-
|
|
11
|
+
}
|
|
12
|
+
onInit(render) {
|
|
13
13
|
this.renderer = render;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var timeoutRef = node.dom.value;
|
|
14
|
+
}
|
|
15
|
+
onCreate(node) {
|
|
16
|
+
const timeoutRef = node.dom.value;
|
|
18
17
|
if (timeoutRef && timeoutRef !== "0") {
|
|
19
18
|
clearTimeout(parseInt(timeoutRef, 10));
|
|
20
19
|
node.dom.value = "";
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const f = () => {
|
|
22
|
+
let result;
|
|
24
23
|
try {
|
|
25
|
-
result =
|
|
24
|
+
result = this.fnc();
|
|
26
25
|
}
|
|
27
26
|
catch (e) {
|
|
28
27
|
console.error(e);
|
|
29
|
-
if (
|
|
28
|
+
if (this.options.stopOnError) {
|
|
30
29
|
return;
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
|
-
|
|
32
|
+
const isPromise = result && typeof result.then === "function" && typeof result.catch === "function";
|
|
34
33
|
if (isPromise) {
|
|
35
|
-
result.then(
|
|
36
|
-
if (!
|
|
37
|
-
|
|
34
|
+
result.then(() => {
|
|
35
|
+
if (!this.options.noRefresh) {
|
|
36
|
+
this.renderer.refresh();
|
|
38
37
|
}
|
|
39
|
-
node.dom.value = setTimeout(f,
|
|
40
|
-
}).catch(
|
|
38
|
+
node.dom.value = setTimeout(f, this.options.interval).toString();
|
|
39
|
+
}).catch((e) => {
|
|
41
40
|
console.error(e);
|
|
42
|
-
if (!
|
|
43
|
-
if (!
|
|
44
|
-
|
|
41
|
+
if (!this.options.stopOnError) {
|
|
42
|
+
if (!this.options.noRefresh) {
|
|
43
|
+
this.renderer.refresh();
|
|
45
44
|
}
|
|
46
|
-
node.dom.value = setTimeout(f,
|
|
45
|
+
node.dom.value = setTimeout(f, this.options.interval).toString();
|
|
47
46
|
}
|
|
48
47
|
});
|
|
49
48
|
}
|
|
50
49
|
else {
|
|
51
|
-
if (!
|
|
52
|
-
|
|
50
|
+
if (!this.options.noRefresh) {
|
|
51
|
+
this.renderer.refresh();
|
|
53
52
|
}
|
|
54
|
-
node.dom.value = setTimeout(f,
|
|
53
|
+
node.dom.value = setTimeout(f, this.options.interval).toString();
|
|
55
54
|
}
|
|
56
55
|
};
|
|
57
56
|
f();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
}
|
|
58
|
+
onRemove(node) {
|
|
59
|
+
const timeoutRef = node.dom.value;
|
|
61
60
|
if (timeoutRef && timeoutRef !== "0") {
|
|
62
61
|
clearTimeout(parseInt(timeoutRef, 10));
|
|
63
62
|
node.dom.value = "";
|
|
64
63
|
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
}());
|
|
68
|
-
export { IntervalComponent };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -1,49 +1,47 @@
|
|
|
1
1
|
import { AutoSuggest } from "../../ui/auto.suggest";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export class AutoSuggestComponent {
|
|
3
|
+
constructor(options) {
|
|
4
4
|
this.options = options;
|
|
5
5
|
// this.id = this.options.id ?? helper.newDomGuid();
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
render() {
|
|
8
8
|
var _a;
|
|
9
9
|
return {
|
|
10
10
|
tag: "input",
|
|
11
11
|
attr: { value: this.options.value, class: this.options.class, style: this.options.style, placeholder: (_a = this.options.placeholder) !== null && _a !== void 0 ? _a : "" }
|
|
12
12
|
};
|
|
13
|
-
}
|
|
14
|
-
|
|
13
|
+
}
|
|
14
|
+
getRef() {
|
|
15
15
|
return this.ref;
|
|
16
|
-
}
|
|
17
|
-
|
|
16
|
+
}
|
|
17
|
+
getValue() {
|
|
18
18
|
if (this.dom == null) {
|
|
19
19
|
return "";
|
|
20
20
|
}
|
|
21
21
|
return this.dom.value;
|
|
22
|
-
}
|
|
23
|
-
|
|
22
|
+
}
|
|
23
|
+
setValue(val) {
|
|
24
24
|
if (this.dom == null) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
this.dom.value = val;
|
|
28
|
-
}
|
|
29
|
-
|
|
28
|
+
}
|
|
29
|
+
focus() {
|
|
30
30
|
if (this.dom == null) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
this.dom.focus();
|
|
34
|
-
}
|
|
35
|
-
|
|
34
|
+
}
|
|
35
|
+
onCreate(node) {
|
|
36
36
|
this.dom = node.dom;
|
|
37
37
|
AutoSuggest(node.dom, this.options);
|
|
38
|
-
}
|
|
39
|
-
|
|
38
|
+
}
|
|
39
|
+
onUpdate(node) {
|
|
40
40
|
this.dom = node.dom;
|
|
41
|
-
}
|
|
42
|
-
|
|
41
|
+
}
|
|
42
|
+
onRemove() {
|
|
43
43
|
if (this.ref != null) {
|
|
44
44
|
this.ref.destroy();
|
|
45
45
|
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
}());
|
|
49
|
-
export { AutoSuggestComponent };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,31 +1,16 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { EventHandler } from "../../interaction/eventhandler";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this.options
|
|
2
|
+
export class ButtonComponent {
|
|
3
|
+
get click() {
|
|
4
|
+
return this.options.click;
|
|
5
|
+
}
|
|
6
|
+
constructor(options) {
|
|
7
|
+
this.options = { ...{ enabled: true, class: "" }, ...options };
|
|
16
8
|
this.options.click = EventHandler.Create(this.options.click);
|
|
17
9
|
}
|
|
18
|
-
|
|
19
|
-
get: function () {
|
|
20
|
-
return this.options.click;
|
|
21
|
-
},
|
|
22
|
-
enumerable: false,
|
|
23
|
-
configurable: true
|
|
24
|
-
});
|
|
25
|
-
ButtonComponent.prototype.isEqual = function (node) {
|
|
10
|
+
isEqual(node) {
|
|
26
11
|
return this.__proto__ === node.__proto__;
|
|
27
|
-
}
|
|
28
|
-
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
29
14
|
return {
|
|
30
15
|
tag: "button",
|
|
31
16
|
attr: {
|
|
@@ -35,12 +20,10 @@ var ButtonComponent = /** @class */ (function () {
|
|
|
35
20
|
content: typeof this.options.content === "string" ? this.options.content : "",
|
|
36
21
|
children: typeof this.options.content !== "string" ? [this.options.content] : []
|
|
37
22
|
};
|
|
38
|
-
}
|
|
39
|
-
|
|
23
|
+
}
|
|
24
|
+
raiseEvent(evt) {
|
|
40
25
|
if (this.options.enabled) {
|
|
41
26
|
this.options.click.notify(evt);
|
|
42
27
|
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
}());
|
|
46
|
-
export { ButtonComponent };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import "./CheckBoxStyle.scss";
|
|
13
2
|
import { EventHandler } from "../../interaction/eventhandler";
|
|
14
3
|
import { helper } from "../../core/helper";
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
export class CheckBoxComponent {
|
|
5
|
+
get onChange() {
|
|
6
|
+
return this.options.onChange;
|
|
7
|
+
}
|
|
8
|
+
constructor(options) {
|
|
17
9
|
var _a;
|
|
18
|
-
this.options =
|
|
10
|
+
this.options = { ...{ enabled: true, class: "", bindMode: "toModel" }, ...options };
|
|
19
11
|
if (!this.options.id) {
|
|
20
12
|
this.options.id = helper.newDomGuid();
|
|
21
13
|
}
|
|
@@ -26,26 +18,19 @@ var CheckBoxComponent = /** @class */ (function () {
|
|
|
26
18
|
}
|
|
27
19
|
this.options.onChange = EventHandler.Create(this.options.onChange);
|
|
28
20
|
}
|
|
29
|
-
Object.defineProperty(CheckBoxComponent.prototype, "onChange", {
|
|
30
|
-
get: function () {
|
|
31
|
-
return this.options.onChange;
|
|
32
|
-
},
|
|
33
|
-
enumerable: false,
|
|
34
|
-
configurable: true
|
|
35
|
-
});
|
|
36
21
|
// public isEqual(node: IJSLComponent): boolean {
|
|
37
22
|
// return (this as any).__proto__ === (node as any).__proto__;
|
|
38
23
|
// }
|
|
39
|
-
|
|
24
|
+
render() {
|
|
40
25
|
var _a;
|
|
41
|
-
|
|
26
|
+
let val = this.options.value;
|
|
42
27
|
if (this.options.bindMode !== "toModel" && this.options.bindTo != null && this.options.property != null) {
|
|
43
|
-
|
|
44
|
-
|
|
28
|
+
const current = this.getValue();
|
|
29
|
+
const newVal = (((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toUI) ?
|
|
45
30
|
this.options.converter.toUI(this.options.bindTo[this.options.property]) :
|
|
46
31
|
this.options.bindTo[this.options.property]);
|
|
32
|
+
val = newVal;
|
|
47
33
|
if (newVal !== current) {
|
|
48
|
-
val = newVal;
|
|
49
34
|
if (this.currentDom != null) {
|
|
50
35
|
this.currentDom.checked = val;
|
|
51
36
|
}
|
|
@@ -66,12 +51,12 @@ var CheckBoxComponent = /** @class */ (function () {
|
|
|
66
51
|
}
|
|
67
52
|
}, { tag: "label", content: this.options.label, attr: { for: this.options.id } }]
|
|
68
53
|
};
|
|
69
|
-
}
|
|
70
|
-
|
|
54
|
+
}
|
|
55
|
+
getValue() {
|
|
71
56
|
var _a;
|
|
72
57
|
return ((_a = this.currentDom) === null || _a === void 0 ? void 0 : _a.checked) || false;
|
|
73
|
-
}
|
|
74
|
-
|
|
58
|
+
}
|
|
59
|
+
setValue(val) {
|
|
75
60
|
var _a;
|
|
76
61
|
if (this.currentDom != null) {
|
|
77
62
|
this.currentDom.checked = val;
|
|
@@ -79,20 +64,18 @@ var CheckBoxComponent = /** @class */ (function () {
|
|
|
79
64
|
if (this.options.bindTo && this.options.bindMode !== "fromModel" && this.options.property) {
|
|
80
65
|
this.options.bindTo[this.options.property] = ((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toData) ? this.options.converter.toData(val) : val;
|
|
81
66
|
}
|
|
82
|
-
}
|
|
83
|
-
|
|
67
|
+
}
|
|
68
|
+
onCreate(node) {
|
|
84
69
|
this.currentDom = node.dom.querySelector("input");
|
|
85
|
-
}
|
|
86
|
-
|
|
70
|
+
}
|
|
71
|
+
raiseEvent(e, node) {
|
|
87
72
|
var _a;
|
|
88
73
|
if (this.options.enabled) {
|
|
89
|
-
|
|
74
|
+
const value = node.dom.checked;
|
|
90
75
|
if (this.options.bindTo && this.options.bindMode !== "fromModel" && this.options.property) {
|
|
91
76
|
this.options.bindTo[this.options.property] = ((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toData) ? this.options.converter.toData(value) : value;
|
|
92
77
|
}
|
|
93
78
|
this.options.onChange.notify(value);
|
|
94
79
|
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
}());
|
|
98
|
-
export { CheckBoxComponent };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { DatePicker } from "../../ui/date.picker";
|
|
13
2
|
import { date } from "../../core/date";
|
|
14
3
|
import { helper } from "../../core/helper";
|
|
15
4
|
import { EventHandler } from "../../interaction/eventhandler";
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
export class DateComponent {
|
|
6
|
+
constructor(options) {
|
|
18
7
|
var _a;
|
|
19
|
-
this.options =
|
|
8
|
+
this.options = { ...{ enabled: true, id: helper.newDomGuid(), bindMode: "toModel" }, ...options };
|
|
20
9
|
if (this.options.bindTo != null && this.options.property != null && this.options.value == null) {
|
|
21
10
|
this.options.value = (((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toUI) ?
|
|
22
11
|
this.options.converter.toUI(this.options.bindTo[this.options.property]) :
|
|
@@ -24,24 +13,20 @@ var DateComponent = /** @class */ (function () {
|
|
|
24
13
|
}
|
|
25
14
|
this.options.onChange = EventHandler.Create(this.options.onChange);
|
|
26
15
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
enumerable: false,
|
|
32
|
-
configurable: true
|
|
33
|
-
});
|
|
34
|
-
DateComponent.prototype.render = function () {
|
|
16
|
+
get onChange() {
|
|
17
|
+
return this.options.onChange;
|
|
18
|
+
}
|
|
19
|
+
render() {
|
|
35
20
|
var _a;
|
|
36
|
-
|
|
21
|
+
let val = this.options.value;
|
|
37
22
|
if (this.options.bindMode !== "toModel" && this.options.bindTo != null && this.options.property != null) {
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
const current = this.getValue();
|
|
24
|
+
const newVal = (((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toUI) ?
|
|
40
25
|
this.options.converter.toUI(this.options.bindTo[this.options.property]) :
|
|
41
26
|
this.options.bindTo[this.options.property]);
|
|
42
|
-
|
|
27
|
+
const newValStr = date.format(newVal);
|
|
28
|
+
val = newVal;
|
|
43
29
|
if (newValStr !== current) {
|
|
44
|
-
val = newVal;
|
|
45
30
|
if (this.currentDom != null) {
|
|
46
31
|
this.currentDom.value = newValStr;
|
|
47
32
|
}
|
|
@@ -59,14 +44,14 @@ var DateComponent = /** @class */ (function () {
|
|
|
59
44
|
change: this.raiseEvent,
|
|
60
45
|
}
|
|
61
46
|
};
|
|
62
|
-
}
|
|
63
|
-
|
|
47
|
+
}
|
|
48
|
+
getValue() {
|
|
64
49
|
if (this.currentDom == null) {
|
|
65
50
|
return "";
|
|
66
51
|
}
|
|
67
52
|
return this.currentDom.value;
|
|
68
|
-
}
|
|
69
|
-
|
|
53
|
+
}
|
|
54
|
+
getValueAsDate() {
|
|
70
55
|
if (this.currentDom == null) {
|
|
71
56
|
return null;
|
|
72
57
|
}
|
|
@@ -74,33 +59,31 @@ var DateComponent = /** @class */ (function () {
|
|
|
74
59
|
return this.options.parse(this.currentDom.value);
|
|
75
60
|
}
|
|
76
61
|
return date.parse(this.currentDom.value);
|
|
77
|
-
}
|
|
78
|
-
|
|
62
|
+
}
|
|
63
|
+
getRef() {
|
|
79
64
|
return this.ref;
|
|
80
|
-
}
|
|
81
|
-
|
|
65
|
+
}
|
|
66
|
+
onCreate(node) {
|
|
82
67
|
this.currentDom = node.dom;
|
|
83
68
|
this.ref = DatePicker(this.currentDom, this.options);
|
|
84
|
-
}
|
|
85
|
-
|
|
69
|
+
}
|
|
70
|
+
onUpdate(node) {
|
|
86
71
|
this.currentDom = node.dom;
|
|
87
|
-
}
|
|
88
|
-
|
|
72
|
+
}
|
|
73
|
+
onRemove() {
|
|
89
74
|
if (this.ref != null) {
|
|
90
75
|
this.ref.destroy();
|
|
91
76
|
}
|
|
92
|
-
}
|
|
93
|
-
|
|
77
|
+
}
|
|
78
|
+
raiseEvent(e, node) {
|
|
94
79
|
var _a;
|
|
95
80
|
if (this.options.enabled) {
|
|
96
|
-
|
|
81
|
+
const val = date.parse(node.dom.value);
|
|
97
82
|
if (this.options.bindTo && this.options.bindMode !== "fromModel" && this.options.property) {
|
|
98
83
|
this.options.bindTo[this.options.property] =
|
|
99
84
|
((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toData) ? this.options.converter.toData(val) : val;
|
|
100
85
|
}
|
|
101
86
|
this.options.onChange.notify(val);
|
|
102
87
|
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
}());
|
|
106
|
-
export { DateComponent };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import "./DateRangeStyle.scss";
|
|
13
2
|
import { noUiSlider } from "../slider/nouislider";
|
|
14
3
|
import { DateComponent } from "../date/DateComponent";
|
|
15
4
|
import { date } from "../../core/date";
|
|
16
5
|
import { EventHandler } from "../../interaction/eventhandler";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _this = this;
|
|
6
|
+
export class DateRangeComponent {
|
|
7
|
+
constructor(o) {
|
|
20
8
|
this.State = { currentMin: null, currentMax: null };
|
|
21
9
|
this.manualChange = false;
|
|
22
|
-
this.options =
|
|
10
|
+
this.options = { ...o };
|
|
23
11
|
if (this.options.minValue == null) {
|
|
24
12
|
this.options.minValue = this.options.min;
|
|
25
13
|
}
|
|
@@ -32,16 +20,16 @@ var DateRangeComponent = /** @class */ (function () {
|
|
|
32
20
|
max: this.options.max,
|
|
33
21
|
value: this.options.minValue,
|
|
34
22
|
style: "width:6rem;",
|
|
35
|
-
onChange:
|
|
36
|
-
if (
|
|
23
|
+
onChange: (val) => {
|
|
24
|
+
if (this.manualChange) {
|
|
37
25
|
return;
|
|
38
26
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
27
|
+
this.manualChange = true;
|
|
28
|
+
const min = this.minDate.getValueAsDate();
|
|
29
|
+
const max = this.maxDate.getValueAsDate();
|
|
30
|
+
this.slider.set([date.getDaysBetween(this.options.min, min), date.getDaysBetween(this.options.min, max)]);
|
|
31
|
+
this.manualChange = false;
|
|
32
|
+
this.triggerChange();
|
|
45
33
|
}
|
|
46
34
|
});
|
|
47
35
|
this.maxDate = new DateComponent({
|
|
@@ -49,20 +37,20 @@ var DateRangeComponent = /** @class */ (function () {
|
|
|
49
37
|
max: this.options.max,
|
|
50
38
|
value: this.options.maxValue,
|
|
51
39
|
style: "width:6rem;text-align:right;",
|
|
52
|
-
onChange:
|
|
53
|
-
if (
|
|
40
|
+
onChange: (val) => {
|
|
41
|
+
if (this.manualChange) {
|
|
54
42
|
return;
|
|
55
43
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
44
|
+
this.manualChange = true;
|
|
45
|
+
const min = this.minDate.getValueAsDate();
|
|
46
|
+
const max = this.maxDate.getValueAsDate();
|
|
47
|
+
this.slider.set([date.getDaysBetween(this.options.min, min), date.getDaysBetween(this.options.min, max)]);
|
|
48
|
+
this.manualChange = false;
|
|
49
|
+
this.triggerChange();
|
|
62
50
|
}
|
|
63
51
|
});
|
|
64
52
|
}
|
|
65
|
-
|
|
53
|
+
render() {
|
|
66
54
|
var _a;
|
|
67
55
|
return {
|
|
68
56
|
tag: "div", attr: { style: this.options.style, class: "date-range-comp " + ((_a = this.options.class) !== null && _a !== void 0 ? _a : "") }, children: [
|
|
@@ -79,58 +67,55 @@ var DateRangeComponent = /** @class */ (function () {
|
|
|
79
67
|
}
|
|
80
68
|
]
|
|
81
69
|
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var diffInDays = date.getDaysBetween(this.options.min, this.options.max);
|
|
70
|
+
}
|
|
71
|
+
onCreate(node) {
|
|
72
|
+
const diffInDays = date.getDaysBetween(this.options.min, this.options.max);
|
|
86
73
|
if (this.options.increment !== "days") {
|
|
87
74
|
console.warn(" only days as increments are currently supported");
|
|
88
75
|
}
|
|
89
|
-
|
|
90
|
-
|
|
76
|
+
const min = 0;
|
|
77
|
+
const max = diffInDays;
|
|
91
78
|
this.slider = noUiSlider.create(node.dom.querySelector(".slider-div"), {
|
|
92
79
|
start: [date.getDaysBetween(this.options.min, this.options.minValue),
|
|
93
80
|
date.getDaysBetween(this.options.min, this.options.maxValue)],
|
|
94
81
|
connect: true,
|
|
95
82
|
step: 1,
|
|
96
83
|
range: {
|
|
97
|
-
min
|
|
98
|
-
max
|
|
84
|
+
min,
|
|
85
|
+
max
|
|
99
86
|
},
|
|
100
87
|
});
|
|
101
|
-
this.slider.on("update",
|
|
102
|
-
if (
|
|
88
|
+
this.slider.on("update", (values) => {
|
|
89
|
+
if (this.manualChange) {
|
|
103
90
|
return;
|
|
104
91
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
92
|
+
this.manualChange = true;
|
|
93
|
+
this.State.currentMin = values[0];
|
|
94
|
+
this.State.currentMax = values[1];
|
|
95
|
+
const minVal = date.addDays(this.options.min, parseFloat(values[0]));
|
|
96
|
+
const maxVal = date.addDays(this.options.min, parseFloat(values[1]));
|
|
97
|
+
this.minDate.getRef().setState({ selectedDate: minVal });
|
|
98
|
+
this.maxDate.getRef().setState({ selectedDate: maxVal });
|
|
99
|
+
this.manualChange = false;
|
|
100
|
+
this.triggerChange();
|
|
114
101
|
});
|
|
115
|
-
}
|
|
116
|
-
|
|
102
|
+
}
|
|
103
|
+
onRemove() {
|
|
117
104
|
if (this.slider != null) {
|
|
118
105
|
this.slider.destroy();
|
|
119
106
|
this.slider = null;
|
|
120
107
|
}
|
|
121
|
-
}
|
|
122
|
-
|
|
108
|
+
}
|
|
109
|
+
getMin() {
|
|
123
110
|
return this.minDate.getValueAsDate();
|
|
124
|
-
}
|
|
125
|
-
|
|
111
|
+
}
|
|
112
|
+
getMax() {
|
|
126
113
|
return this.maxDate.getValueAsDate();
|
|
127
|
-
}
|
|
128
|
-
|
|
114
|
+
}
|
|
115
|
+
triggerChange() {
|
|
129
116
|
this.options.onChange.notify({
|
|
130
117
|
minValue: this.getMin(),
|
|
131
118
|
maxValue: this.getMin()
|
|
132
119
|
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
}());
|
|
136
|
-
export { DateRangeComponent };
|
|
120
|
+
}
|
|
121
|
+
}
|