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,53 +1,39 @@
|
|
|
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 "./DateTimeStyle.scss";
|
|
13
2
|
import { EventHandler } from "../../interaction/eventhandler";
|
|
14
3
|
import { DateComponent } from "../date/DateComponent";
|
|
15
4
|
import { TimeComponent } from "../time/TimeComponent";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _this = this;
|
|
5
|
+
export class DateTimeComponent {
|
|
6
|
+
constructor(options) {
|
|
19
7
|
if (options.bindMode && options.bindMode !== "toModel") {
|
|
20
8
|
throw new Error("Currently DateTimeComponent only supports toModel as bindMode");
|
|
21
9
|
}
|
|
22
|
-
this.options =
|
|
10
|
+
this.options = { ...options };
|
|
23
11
|
this.options.onChange = EventHandler.Create(this.options.onChange);
|
|
24
|
-
|
|
12
|
+
const optionsCopy = { ...options };
|
|
25
13
|
optionsCopy.bindTo = null;
|
|
26
14
|
optionsCopy.property = null;
|
|
27
15
|
optionsCopy.converter = null;
|
|
28
|
-
optionsCopy.onChange =
|
|
16
|
+
optionsCopy.onChange = () => {
|
|
29
17
|
var _a;
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
((_a =
|
|
18
|
+
const val = this.getValueAsDate();
|
|
19
|
+
if (this.options.bindTo && options.property) {
|
|
20
|
+
this.options.bindTo[options.property] =
|
|
21
|
+
((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toData) ? this.options.converter.toData(val) : val;
|
|
34
22
|
}
|
|
35
|
-
|
|
23
|
+
this.options.onChange.notify(val);
|
|
36
24
|
};
|
|
37
25
|
this.dateComp = new DateComponent(optionsCopy);
|
|
38
26
|
this.timeComp = new TimeComponent(optionsCopy);
|
|
39
27
|
}
|
|
40
|
-
|
|
28
|
+
render() {
|
|
41
29
|
return { tag: "div", attr: { class: "date-time-comp" }, children: [
|
|
42
30
|
this.dateComp, this.timeComp
|
|
43
31
|
] };
|
|
44
|
-
}
|
|
45
|
-
|
|
32
|
+
}
|
|
33
|
+
getValue() {
|
|
46
34
|
return this.dateComp.getValue() + " " + this.timeComp.getValue();
|
|
47
|
-
}
|
|
48
|
-
|
|
35
|
+
}
|
|
36
|
+
getValueAsDate() {
|
|
49
37
|
return this.timeComp.getValueAsDate(this.dateComp.getValueAsDate());
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}());
|
|
53
|
-
export { DateTimeComponent };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,113 +1,40 @@
|
|
|
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
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
1
|
import { JSLRender } from "jsl-render";
|
|
49
2
|
import { Dialog } from "../../ui/dialog";
|
|
50
3
|
import { Moveable } from "../../interaction/moveable";
|
|
51
4
|
import { EventHandler } from "../../interaction/eventhandler";
|
|
52
5
|
import { Resizable } from "../../interaction/resizable";
|
|
53
6
|
import { UILang } from "../../core/lang";
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var _this = this;
|
|
57
|
-
this.closeIcon = {
|
|
58
|
-
tag: "div", content: "✖" /*"🗙"*/, attr: {
|
|
59
|
-
class: "dlg-close-btn", click: function () {
|
|
60
|
-
_this.ref.close();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
this.resizeHandle = {
|
|
65
|
-
tag: "div", attr: { class: "dlg-res-handle rs-b rs-r" }
|
|
66
|
-
};
|
|
67
|
-
this.options = __assign({ maxHeight: "calc(100vh - 7.5rem)", width: "50vw" }, options);
|
|
68
|
-
}
|
|
69
|
-
DialogComponent.Button = function (options) {
|
|
70
|
-
var _this = this;
|
|
7
|
+
export class DialogComponent {
|
|
8
|
+
static Button(options) {
|
|
71
9
|
var _a, _b, _c;
|
|
72
|
-
|
|
10
|
+
const res = {
|
|
73
11
|
tag: "button", attr: {
|
|
74
12
|
class: "jsl-button " + ((_a = options.class) !== null && _a !== void 0 ? _a : ""),
|
|
75
|
-
click:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return [4 /*yield*/, clickRes];
|
|
85
|
-
case 1:
|
|
86
|
-
clickRes = _a.sent();
|
|
87
|
-
_a.label = 2;
|
|
88
|
-
case 2:
|
|
89
|
-
if (clickRes === false) {
|
|
90
|
-
return [2 /*return*/];
|
|
91
|
-
}
|
|
92
|
-
_a.label = 3;
|
|
93
|
-
case 3:
|
|
94
|
-
if (DialogComponent.lastRenderedDlg != null) {
|
|
95
|
-
DialogComponent.lastRenderedDlg.getRef().close();
|
|
96
|
-
}
|
|
97
|
-
return [2 /*return*/];
|
|
13
|
+
click: async () => {
|
|
14
|
+
if (options.onClick != null) {
|
|
15
|
+
let clickRes = options.onClick();
|
|
16
|
+
const isPromise = clickRes && typeof clickRes.then === "function" && typeof clickRes.catch === "function";
|
|
17
|
+
if (isPromise) {
|
|
18
|
+
clickRes = await clickRes;
|
|
19
|
+
}
|
|
20
|
+
if (clickRes === false) {
|
|
21
|
+
return;
|
|
98
22
|
}
|
|
99
|
-
}
|
|
100
|
-
|
|
23
|
+
}
|
|
24
|
+
if (DialogComponent.lastRenderedDlg != null) {
|
|
25
|
+
DialogComponent.lastRenderedDlg.getRef().close();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
101
28
|
}, content: (_b = options.content) !== null && _b !== void 0 ? _b : "OK", raw: (_c = options.raw) !== null && _c !== void 0 ? _c : false
|
|
102
29
|
};
|
|
103
30
|
return res;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return DialogComponent.Button({ content: UILang.core.Ok, onClick
|
|
107
|
-
}
|
|
108
|
-
|
|
31
|
+
}
|
|
32
|
+
static Ok(onClick) {
|
|
33
|
+
return DialogComponent.Button({ content: UILang.core.Ok, onClick, class: "dlg-ok-btn" });
|
|
34
|
+
}
|
|
35
|
+
static Cancel() {
|
|
109
36
|
return DialogComponent.Button({ content: UILang.core.Cancel, class: "dlg-cancel-btn jsl-button-outline" });
|
|
110
|
-
}
|
|
37
|
+
}
|
|
111
38
|
// does not work -> dialog still exists in background and wrong renderer is active
|
|
112
39
|
// public static closeAll() {
|
|
113
40
|
// document.querySelectorAll(".jsl-dialog-overlay").forEach((x) => {
|
|
@@ -116,20 +43,20 @@ var DialogComponent = /** @class */ (function () {
|
|
|
116
43
|
// }
|
|
117
44
|
// });
|
|
118
45
|
// }
|
|
119
|
-
|
|
120
|
-
|
|
46
|
+
static show(options) {
|
|
47
|
+
const container = document.createElement("div");
|
|
121
48
|
document.body.appendChild(container);
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
49
|
+
const oldRenderer = JSLRender.lastCreatedRenderer;
|
|
50
|
+
const oldLastDlg = DialogComponent.lastRenderedDlg;
|
|
51
|
+
const renderer = new JSLRender(container, oldRenderer != null);
|
|
125
52
|
if (oldRenderer != null) {
|
|
126
53
|
JSLRender.lastCreatedRenderer = renderer;
|
|
127
54
|
}
|
|
128
|
-
|
|
55
|
+
const o = { ...options };
|
|
129
56
|
if (o.autoOpen == null) {
|
|
130
57
|
o.autoOpen = true;
|
|
131
58
|
}
|
|
132
|
-
o.onClose =
|
|
59
|
+
o.onClose = () => {
|
|
133
60
|
if (options.onClose) {
|
|
134
61
|
if (options.onClose() === false) {
|
|
135
62
|
return;
|
|
@@ -143,17 +70,30 @@ var DialogComponent = /** @class */ (function () {
|
|
|
143
70
|
}
|
|
144
71
|
DialogComponent.lastRenderedDlg = oldLastDlg;
|
|
145
72
|
};
|
|
146
|
-
|
|
73
|
+
const dlg = new DialogComponent(o);
|
|
147
74
|
DialogComponent.lastRenderedDlg = dlg;
|
|
148
75
|
renderer.render(dlg);
|
|
149
76
|
return dlg;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
77
|
+
}
|
|
78
|
+
constructor(options) {
|
|
79
|
+
this.closeIcon = {
|
|
80
|
+
tag: "div", content: "✖" /*"🗙"*/, attr: {
|
|
81
|
+
class: "dlg-close-btn", click: () => {
|
|
82
|
+
this.ref.close();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
this.resizeHandle = {
|
|
87
|
+
tag: "div", attr: { class: "dlg-res-handle rs-b rs-r" }
|
|
88
|
+
};
|
|
89
|
+
this.options = { maxHeight: "calc(100vh - 7.5rem)", width: "50vw", ...options };
|
|
90
|
+
}
|
|
91
|
+
render() {
|
|
92
|
+
const header = this.toNode(this.options.header);
|
|
93
|
+
const body = this.toNode(this.options.content);
|
|
94
|
+
const footer = this.toNode(this.options.footer);
|
|
95
|
+
let styleW = "";
|
|
96
|
+
let styleH = "";
|
|
157
97
|
if (this.options.width != null) {
|
|
158
98
|
styleW += "width:" + this.options.width + ";";
|
|
159
99
|
}
|
|
@@ -172,16 +112,16 @@ var DialogComponent = /** @class */ (function () {
|
|
|
172
112
|
if (this.options.maxHeight != null) {
|
|
173
113
|
styleH += "max-height:" + this.options.maxHeight + ";";
|
|
174
114
|
}
|
|
175
|
-
|
|
115
|
+
const headerStyle = this.options.allowMove ? "cursor:move" : undefined;
|
|
176
116
|
return {
|
|
177
117
|
tag: "div", attr: {
|
|
178
|
-
class: "jsl-dialog-overlay", wheel:
|
|
118
|
+
class: "jsl-dialog-overlay", wheel: (e) => {
|
|
179
119
|
e.preventDefault();
|
|
180
120
|
}
|
|
181
121
|
}, children: [
|
|
182
122
|
{
|
|
183
123
|
tag: "div", attr: {
|
|
184
|
-
class: "jsl-dialog " + (this.options.class || ""), style: styleW, wheel:
|
|
124
|
+
class: "jsl-dialog " + (this.options.class || ""), style: styleW, wheel: (e) => {
|
|
185
125
|
e.stopImmediatePropagation();
|
|
186
126
|
e.stopPropagation();
|
|
187
127
|
}
|
|
@@ -200,13 +140,14 @@ var DialogComponent = /** @class */ (function () {
|
|
|
200
140
|
}
|
|
201
141
|
]
|
|
202
142
|
};
|
|
203
|
-
}
|
|
204
|
-
|
|
143
|
+
}
|
|
144
|
+
onCreate(node) {
|
|
205
145
|
this.ref = Dialog(node.dom, this.options);
|
|
206
146
|
if (this.options.allowMove) {
|
|
207
|
-
Moveable(this.ref.getOverlay(),
|
|
208
|
-
|
|
209
|
-
|
|
147
|
+
Moveable(this.ref.getOverlay(), {
|
|
148
|
+
onStart: new EventHandler((e) => {
|
|
149
|
+
let headerWasClicked = false;
|
|
150
|
+
let parent = e.evt.target;
|
|
210
151
|
while (parent != null && !parent.classList.contains("jsl-dialog-overlay")) {
|
|
211
152
|
if (parent.classList.contains("dlg-header")) {
|
|
212
153
|
headerWasClicked = true;
|
|
@@ -215,7 +156,7 @@ var DialogComponent = /** @class */ (function () {
|
|
|
215
156
|
parent = parent.parentElement;
|
|
216
157
|
}
|
|
217
158
|
if (headerWasClicked) {
|
|
218
|
-
|
|
159
|
+
const rect = e.target.getBoundingClientRect();
|
|
219
160
|
e.target.style.transform = "translate(0, 0)";
|
|
220
161
|
e.target.style.left = rect.left + "px";
|
|
221
162
|
e.target.style.top = rect.top + "px";
|
|
@@ -223,29 +164,29 @@ var DialogComponent = /** @class */ (function () {
|
|
|
223
164
|
else {
|
|
224
165
|
e.cancelEvent();
|
|
225
166
|
}
|
|
226
|
-
})
|
|
167
|
+
}),
|
|
168
|
+
...this.options.moveOptions
|
|
169
|
+
});
|
|
227
170
|
}
|
|
228
171
|
if (this.options.allowResize) {
|
|
229
|
-
|
|
172
|
+
const dlgEl = this.ref.getOverlay().querySelector(".jsl-dialog");
|
|
230
173
|
Resizable(dlgEl, this.options.resizeOptions);
|
|
231
|
-
|
|
174
|
+
const rect = dlgEl.getBoundingClientRect();
|
|
232
175
|
dlgEl.style.transform = "translate(0, 0)";
|
|
233
176
|
dlgEl.style.left = rect.left + "px";
|
|
234
177
|
dlgEl.style.top = rect.top + "px";
|
|
235
|
-
|
|
236
|
-
|
|
178
|
+
const bodyEl = dlgEl.querySelector(".dlg-body");
|
|
179
|
+
const bodyRect = bodyEl.getBoundingClientRect();
|
|
237
180
|
bodyEl.style.height = "calc(100% - " + (rect.height - bodyRect.height) + "px)";
|
|
238
181
|
}
|
|
239
|
-
}
|
|
240
|
-
|
|
182
|
+
}
|
|
183
|
+
getRef() {
|
|
241
184
|
return this.ref;
|
|
242
|
-
}
|
|
243
|
-
|
|
185
|
+
}
|
|
186
|
+
toNode(content) {
|
|
244
187
|
if (typeof content === "string") {
|
|
245
|
-
return { tag: "div", content
|
|
188
|
+
return { tag: "div", content };
|
|
246
189
|
}
|
|
247
190
|
return content;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
}());
|
|
251
|
-
export { DialogComponent };
|
|
191
|
+
}
|
|
192
|
+
}
|
|
@@ -1,20 +1,9 @@
|
|
|
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 { DropDown } from "../../ui/drop.down";
|
|
13
2
|
import { EventHandler } from "../../interaction/eventhandler";
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
export class DropDownComponent {
|
|
4
|
+
constructor(options) {
|
|
16
5
|
var _a;
|
|
17
|
-
this.options =
|
|
6
|
+
this.options = { ...{ enabled: true }, ...options };
|
|
18
7
|
this.options.onChange = EventHandler.Create(this.options.onChange);
|
|
19
8
|
if (this.options.bindTo != null && this.options.property != null && this.options.value == null) {
|
|
20
9
|
this.options.value = (((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toUI) ?
|
|
@@ -22,16 +11,15 @@ var DropDownComponent = /** @class */ (function () {
|
|
|
22
11
|
this.options.bindTo[this.options.property]);
|
|
23
12
|
}
|
|
24
13
|
}
|
|
25
|
-
|
|
14
|
+
render() {
|
|
26
15
|
return {
|
|
27
16
|
tag: "select"
|
|
28
17
|
};
|
|
29
|
-
}
|
|
30
|
-
|
|
18
|
+
}
|
|
19
|
+
getRef() {
|
|
31
20
|
return this.ref;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
var _this = this;
|
|
21
|
+
}
|
|
22
|
+
onCreate(node) {
|
|
35
23
|
this.ref = DropDown(node.dom, this.options);
|
|
36
24
|
if (!this.options.enabled) {
|
|
37
25
|
this.ref.disable();
|
|
@@ -40,35 +28,33 @@ var DropDownComponent = /** @class */ (function () {
|
|
|
40
28
|
if (this.options.width) {
|
|
41
29
|
node.dom.parentElement.style.display = "inline-block";
|
|
42
30
|
}
|
|
43
|
-
node.dom.addEventListener("change",
|
|
31
|
+
node.dom.addEventListener("change", (evt) => {
|
|
44
32
|
var _a;
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
value = Array.prototype.slice.call(node.dom.querySelectorAll("option:checked"), 0).map(
|
|
33
|
+
let value;
|
|
34
|
+
if (this.options.multiple) {
|
|
35
|
+
value = Array.prototype.slice.call(node.dom.querySelectorAll("option:checked"), 0).map((v) => v.value);
|
|
48
36
|
}
|
|
49
37
|
else {
|
|
50
38
|
value = node.dom.value;
|
|
51
39
|
}
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
((_a =
|
|
40
|
+
if (this.options.bindTo != null && this.options.property != null) {
|
|
41
|
+
this.options.bindTo[this.options.property] =
|
|
42
|
+
((_a = this.options.converter) === null || _a === void 0 ? void 0 : _a.toData) ? this.options.converter.toData(value) : value;
|
|
55
43
|
}
|
|
56
|
-
if (
|
|
57
|
-
|
|
44
|
+
if (this.options.onSelect != null) {
|
|
45
|
+
this.options.onSelect(value);
|
|
58
46
|
}
|
|
59
|
-
if (
|
|
60
|
-
|
|
47
|
+
if (this.options.onChange != null) {
|
|
48
|
+
this.options.onChange.notify(value);
|
|
61
49
|
}
|
|
62
50
|
});
|
|
63
51
|
if (this.options.value != null) {
|
|
64
52
|
this.ref.setValue(this.options.value);
|
|
65
53
|
}
|
|
66
|
-
}
|
|
67
|
-
|
|
54
|
+
}
|
|
55
|
+
onRemove() {
|
|
68
56
|
if (this.ref != null) {
|
|
69
57
|
this.ref.destroy();
|
|
70
58
|
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
}());
|
|
74
|
-
export { DropDownComponent };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./ExpanderStyle.scss";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export class ExpanderComponent {
|
|
3
|
+
constructor(optionsOrHeader, body, expanded) {
|
|
4
4
|
var _a;
|
|
5
5
|
this.State = { expanded: false, waitingForAnimation: false };
|
|
6
6
|
if (body != null) {
|
|
7
7
|
// old syntax
|
|
8
|
-
this.options = { header: optionsOrHeader, body
|
|
8
|
+
this.options = { header: optionsOrHeader, body, expanded: expanded !== null && expanded !== void 0 ? expanded : true };
|
|
9
9
|
}
|
|
10
10
|
else {
|
|
11
11
|
this.options = optionsOrHeader;
|
|
@@ -13,7 +13,7 @@ var ExpanderComponent = /** @class */ (function () {
|
|
|
13
13
|
}
|
|
14
14
|
this.State.expanded = this.options.expanded;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
getIcon(expanded) {
|
|
17
17
|
var _a, _b, _c, _d;
|
|
18
18
|
return {
|
|
19
19
|
tag: "span", attr: {
|
|
@@ -29,28 +29,27 @@ var ExpanderComponent = /** @class */ (function () {
|
|
|
29
29
|
: "<path id='curve0' fill='#FFFFFF' d='M3989 1273l3620 3621c125,124 125,328 0,452l-3620 3621c-125,124 -328,124 -453,0l-905 -905c-125,-125 -125,-328 0,-453l2489 -2489 -2489 -2489c-125,-125 -125,-328 0,-453l905 -905c125,-124 328,-124 453,0z'/>") +
|
|
30
30
|
"</svg>"
|
|
31
31
|
};
|
|
32
|
-
}
|
|
33
|
-
|
|
32
|
+
}
|
|
33
|
+
isEqual(node) {
|
|
34
34
|
return this.__proto__ === node.__proto__;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
var _this = this;
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
38
37
|
var _a, _b, _c;
|
|
39
|
-
|
|
38
|
+
const animate = this.State.waitingForAnimation;
|
|
40
39
|
this.State.waitingForAnimation = false;
|
|
41
40
|
return {
|
|
42
41
|
tag: "div", attr: { class: "expander-comp " + (this.options.class || ""), style: (_a = this.options.style) !== null && _a !== void 0 ? _a : "" }, children: [
|
|
43
42
|
{
|
|
44
43
|
tag: "div", attr: {
|
|
45
44
|
class: "header",
|
|
46
|
-
click:
|
|
45
|
+
click: (evt) => { var _a; if ((_a = this.options.isToggleOnHeader) !== null && _a !== void 0 ? _a : true) {
|
|
47
46
|
evt.stopPropagation();
|
|
48
|
-
|
|
47
|
+
this.toggleExpand();
|
|
49
48
|
} },
|
|
50
49
|
},
|
|
51
50
|
children: [
|
|
52
51
|
{
|
|
53
|
-
tag: "span", attr: { class: "toggler", click:
|
|
52
|
+
tag: "span", attr: { class: "toggler", click: (evt) => { evt.stopPropagation(); this.toggleExpand(); } },
|
|
54
53
|
children: [this.State.expanded
|
|
55
54
|
? ((_b = this.options.expandedIcon) !== null && _b !== void 0 ? _b : this.getIcon(true))
|
|
56
55
|
: ((_c = this.options.collapsedIcon) !== null && _c !== void 0 ? _c : this.getIcon(false))
|
|
@@ -66,9 +65,9 @@ var ExpanderComponent = /** @class */ (function () {
|
|
|
66
65
|
}
|
|
67
66
|
]
|
|
68
67
|
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
}
|
|
69
|
+
toggleExpand() {
|
|
70
|
+
const newVal = !this.State.expanded;
|
|
72
71
|
if (this.options.onToggle != null) {
|
|
73
72
|
if (this.options.onToggle(newVal) === false) {
|
|
74
73
|
return;
|
|
@@ -78,13 +77,11 @@ var ExpanderComponent = /** @class */ (function () {
|
|
|
78
77
|
this.State.waitingForAnimation = true;
|
|
79
78
|
}
|
|
80
79
|
this.State.expanded = newVal;
|
|
81
|
-
}
|
|
82
|
-
|
|
80
|
+
}
|
|
81
|
+
toNode(content) {
|
|
83
82
|
if (typeof content === "string") {
|
|
84
|
-
return { tag: "div", content
|
|
83
|
+
return { tag: "div", content };
|
|
85
84
|
}
|
|
86
85
|
return content;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
}());
|
|
90
|
-
export { ExpanderComponent };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export class FormComponent {
|
|
2
|
+
constructor(children, options) {
|
|
3
3
|
this.children = children;
|
|
4
4
|
this.options = options;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
render() {
|
|
7
7
|
var _a, _b;
|
|
8
8
|
return {
|
|
9
9
|
tag: "form",
|
|
10
10
|
attr: { class: (_a = this.options) === null || _a === void 0 ? void 0 : _a.class, style: (_b = this.options) === null || _b === void 0 ? void 0 : _b.style },
|
|
11
11
|
children: this.children
|
|
12
12
|
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
for (
|
|
17
|
-
var c = _a[_i];
|
|
13
|
+
}
|
|
14
|
+
validate() {
|
|
15
|
+
let valid = true;
|
|
16
|
+
for (const c of this.children) {
|
|
18
17
|
if (c.validate && !c.validate()) {
|
|
19
18
|
valid = false;
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
return valid;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
}());
|
|
26
|
-
export { FormComponent };
|
|
22
|
+
}
|
|
23
|
+
}
|