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,34 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
this.handlers = [];
|
|
4
|
-
if (fnc != null) {
|
|
5
|
-
this.handlers.push(fnc);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
EventHandler.Create = function (click) {
|
|
1
|
+
export class EventHandler {
|
|
2
|
+
static Create(click) {
|
|
9
3
|
if (click == null) {
|
|
10
4
|
return new EventHandler();
|
|
11
5
|
}
|
|
12
6
|
if (typeof click === "function") {
|
|
13
|
-
|
|
7
|
+
const res = new EventHandler();
|
|
14
8
|
res.subscribe(click);
|
|
15
9
|
return res;
|
|
16
10
|
}
|
|
17
11
|
return click;
|
|
18
|
-
}
|
|
19
|
-
|
|
12
|
+
}
|
|
13
|
+
constructor(fnc) {
|
|
14
|
+
this.handlers = [];
|
|
15
|
+
if (fnc != null) {
|
|
16
|
+
this.handlers.push(fnc);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
subscribe(fnc) {
|
|
20
20
|
this.handlers.push(fnc);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
for (
|
|
24
|
-
var h = _a[_i];
|
|
21
|
+
}
|
|
22
|
+
notify(val, val2) {
|
|
23
|
+
for (const h of this.handlers) {
|
|
25
24
|
h(val, val2);
|
|
26
25
|
}
|
|
27
|
-
}
|
|
28
|
-
|
|
26
|
+
}
|
|
27
|
+
count() {
|
|
29
28
|
return this.handlers.length;
|
|
30
|
-
}
|
|
31
|
-
|
|
29
|
+
}
|
|
30
|
+
unSubscribe(fnc) {
|
|
32
31
|
if (this.handlers.indexOf(fnc) >= 0) {
|
|
33
32
|
this.handlers.splice(this.handlers.indexOf(fnc), 1);
|
|
34
33
|
}
|
|
@@ -36,7 +35,5 @@ var EventHandler = /** @class */ (function () {
|
|
|
36
35
|
// TODO? throw exception?
|
|
37
36
|
console.warn("handler not found in EventHandler.unSubscribe");
|
|
38
37
|
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
}());
|
|
42
|
-
export { EventHandler };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,18 +1,7 @@
|
|
|
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 "./moveable.css";
|
|
13
2
|
import "../core/polyfills";
|
|
14
3
|
import { EventHandler } from "./eventhandler";
|
|
15
|
-
|
|
4
|
+
const defaultOptions = {
|
|
16
5
|
onStart: new EventHandler(),
|
|
17
6
|
onStop: new EventHandler(),
|
|
18
7
|
onMove: new EventHandler(),
|
|
@@ -20,9 +9,8 @@ var defaultOptions = {
|
|
|
20
9
|
moveDelta: 0,
|
|
21
10
|
containInParent: true
|
|
22
11
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var _this = this;
|
|
12
|
+
export class MoveableContainer {
|
|
13
|
+
constructor(container, options) {
|
|
26
14
|
this.container = container;
|
|
27
15
|
this.options = options;
|
|
28
16
|
this.resizeX = false;
|
|
@@ -30,11 +18,11 @@ var MoveableContainer = /** @class */ (function () {
|
|
|
30
18
|
this.initialX = null;
|
|
31
19
|
this.initialY = null;
|
|
32
20
|
this.startSize = { x: null, y: null };
|
|
33
|
-
this.mouseDownContainer =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
while (directChild.parentElement != null && directChild.parentElement !==
|
|
37
|
-
if (
|
|
21
|
+
this.mouseDownContainer = (evt) => {
|
|
22
|
+
const target = evt.target;
|
|
23
|
+
let directChild = target;
|
|
24
|
+
while (directChild.parentElement != null && directChild.parentElement !== this.container) {
|
|
25
|
+
if (this.options.selector != null && directChild.matches(this.options.selector)) {
|
|
38
26
|
break;
|
|
39
27
|
}
|
|
40
28
|
directChild = directChild.parentElement;
|
|
@@ -42,112 +30,112 @@ var MoveableContainer = /** @class */ (function () {
|
|
|
42
30
|
if (directChild.parentElement == null) {
|
|
43
31
|
return;
|
|
44
32
|
}
|
|
45
|
-
if (
|
|
33
|
+
if (this.options.selector != null && !directChild.matches(this.options.selector)) {
|
|
46
34
|
return;
|
|
47
35
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
evt
|
|
52
|
-
target:
|
|
53
|
-
x:
|
|
54
|
-
y:
|
|
55
|
-
cancelEvent:
|
|
36
|
+
this.element = directChild;
|
|
37
|
+
let canceled = false;
|
|
38
|
+
const args = {
|
|
39
|
+
evt,
|
|
40
|
+
target: this.element,
|
|
41
|
+
x: this.element.offsetLeft,
|
|
42
|
+
y: this.element.offsetTop,
|
|
43
|
+
cancelEvent: () => { canceled = true; }
|
|
56
44
|
};
|
|
57
|
-
|
|
45
|
+
this.options.onStart.notify(args);
|
|
58
46
|
if (canceled) {
|
|
59
47
|
return;
|
|
60
48
|
}
|
|
61
49
|
evt.preventDefault();
|
|
62
50
|
evt.stopPropagation();
|
|
63
51
|
evt.stopImmediatePropagation();
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
this.initialX = this.extractArg(evt, "clientX") - this.element.offsetLeft;
|
|
53
|
+
this.initialY = this.extractArg(evt, "clientY") - this.element.offsetTop;
|
|
66
54
|
// register event listeners
|
|
67
|
-
window.addEventListener("mousemove",
|
|
68
|
-
window.addEventListener("mouseup",
|
|
69
|
-
window.addEventListener("touchmove",
|
|
70
|
-
window.addEventListener("touchend",
|
|
55
|
+
window.addEventListener("mousemove", this.mouseMove, false);
|
|
56
|
+
window.addEventListener("mouseup", this.mouseUp, false);
|
|
57
|
+
window.addEventListener("touchmove", this.mouseMove, false);
|
|
58
|
+
window.addEventListener("touchend", this.mouseUp, false);
|
|
71
59
|
};
|
|
72
|
-
this.mouseMove =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
if (
|
|
78
|
-
|
|
60
|
+
this.mouseMove = (evt) => {
|
|
61
|
+
let raiseEvt = false;
|
|
62
|
+
let x = 0;
|
|
63
|
+
if (this.resizeX) {
|
|
64
|
+
const val = this.extractArg(evt, "clientX");
|
|
65
|
+
if (this.startSize != null && this.startSize.x == null) {
|
|
66
|
+
this.startSize.x = val;
|
|
79
67
|
}
|
|
80
|
-
if (
|
|
68
|
+
if (this.startSize == null || Math.abs(this.startSize.x - val) >= this.options.moveDelta) {
|
|
81
69
|
//if (!this.options.gridX || Math.round(val) % this.options.gridX === 0) {
|
|
82
|
-
x = val -
|
|
83
|
-
if (
|
|
84
|
-
x = Math.round(x /
|
|
70
|
+
x = val - this.initialX;
|
|
71
|
+
if (this.options.gridX) {
|
|
72
|
+
x = Math.round(x / this.options.gridX) * this.options.gridX;
|
|
85
73
|
}
|
|
86
|
-
if (
|
|
74
|
+
if (this.options.containInParent) {
|
|
87
75
|
if (x < 0) {
|
|
88
76
|
x = 0;
|
|
89
77
|
}
|
|
90
|
-
|
|
78
|
+
const maxX = this.container.clientWidth - this.element.offsetWidth;
|
|
91
79
|
if (x > maxX) {
|
|
92
80
|
x = maxX;
|
|
93
81
|
}
|
|
94
82
|
}
|
|
95
|
-
|
|
83
|
+
this.element.style.left = x + "px";
|
|
96
84
|
raiseEvt = true;
|
|
97
|
-
|
|
85
|
+
this.startSize = null;
|
|
98
86
|
//}
|
|
99
87
|
}
|
|
100
88
|
}
|
|
101
|
-
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
|
|
89
|
+
let y = 0;
|
|
90
|
+
if (this.resizeY) {
|
|
91
|
+
const val = this.extractArg(evt, "clientY");
|
|
92
|
+
if (this.startSize != null && this.startSize.y == null) {
|
|
93
|
+
this.startSize.y = val;
|
|
106
94
|
}
|
|
107
|
-
if (
|
|
95
|
+
if (this.startSize == null || Math.abs(this.startSize.y - val) >= this.options.moveDelta) {
|
|
108
96
|
//if (!this.options.gridY || Math.round(val) % this.options.gridY === 0) {
|
|
109
|
-
y = val -
|
|
110
|
-
if (
|
|
111
|
-
y = Math.round(y /
|
|
97
|
+
y = val - this.initialY;
|
|
98
|
+
if (this.options.gridY) {
|
|
99
|
+
y = Math.round(y / this.options.gridY) * this.options.gridY;
|
|
112
100
|
}
|
|
113
|
-
if (
|
|
101
|
+
if (this.options.containInParent) {
|
|
114
102
|
if (y < 0) {
|
|
115
103
|
y = 0;
|
|
116
104
|
}
|
|
117
|
-
|
|
105
|
+
const maxY = this.container.clientHeight - this.element.offsetHeight;
|
|
118
106
|
if (y > maxY) {
|
|
119
107
|
y = maxY;
|
|
120
108
|
}
|
|
121
109
|
}
|
|
122
|
-
|
|
110
|
+
this.element.style.top = y + "px";
|
|
123
111
|
raiseEvt = true;
|
|
124
|
-
|
|
112
|
+
this.startSize = null;
|
|
125
113
|
//}
|
|
126
114
|
}
|
|
127
115
|
}
|
|
128
116
|
if (raiseEvt) {
|
|
129
|
-
|
|
130
|
-
evt
|
|
131
|
-
target:
|
|
132
|
-
x
|
|
133
|
-
y
|
|
134
|
-
cancelEvent:
|
|
117
|
+
this.options.onMove.notify({
|
|
118
|
+
evt,
|
|
119
|
+
target: this.element,
|
|
120
|
+
x,
|
|
121
|
+
y,
|
|
122
|
+
cancelEvent: () => { }
|
|
135
123
|
});
|
|
136
124
|
}
|
|
137
125
|
};
|
|
138
|
-
this.mouseUp =
|
|
139
|
-
window.removeEventListener("mousemove",
|
|
140
|
-
window.removeEventListener("mouseup",
|
|
141
|
-
window.removeEventListener("touchmove",
|
|
142
|
-
window.removeEventListener("touchend",
|
|
143
|
-
|
|
144
|
-
evt
|
|
145
|
-
target:
|
|
146
|
-
x:
|
|
147
|
-
y:
|
|
148
|
-
cancelEvent:
|
|
126
|
+
this.mouseUp = (evt) => {
|
|
127
|
+
window.removeEventListener("mousemove", this.mouseMove, false);
|
|
128
|
+
window.removeEventListener("mouseup", this.mouseUp, false);
|
|
129
|
+
window.removeEventListener("touchmove", this.mouseMove, false);
|
|
130
|
+
window.removeEventListener("touchend", this.mouseUp, false);
|
|
131
|
+
this.options.onStop.notify({
|
|
132
|
+
evt,
|
|
133
|
+
target: this.element,
|
|
134
|
+
x: this.element.offsetLeft,
|
|
135
|
+
y: this.element.offsetTop,
|
|
136
|
+
cancelEvent: () => { }
|
|
149
137
|
});
|
|
150
|
-
|
|
138
|
+
this.startSize = { x: null, y: null };
|
|
151
139
|
};
|
|
152
140
|
if (options.direction === "x" || options.direction === "both") {
|
|
153
141
|
this.resizeX = true;
|
|
@@ -157,18 +145,16 @@ var MoveableContainer = /** @class */ (function () {
|
|
|
157
145
|
}
|
|
158
146
|
this.init();
|
|
159
147
|
}
|
|
160
|
-
|
|
148
|
+
init() {
|
|
161
149
|
this.container.addEventListener("mousedown", this.mouseDownContainer, false);
|
|
162
150
|
this.container.addEventListener("touchstart", this.mouseDownContainer, false);
|
|
163
|
-
}
|
|
164
|
-
|
|
151
|
+
}
|
|
152
|
+
extractArg(evt, key) {
|
|
165
153
|
return evt[key] != null ? evt[key] : (evt.touches.length > 0 ? evt.touches : evt.changedTouches)[0][key];
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
}());
|
|
169
|
-
export { MoveableContainer };
|
|
154
|
+
}
|
|
155
|
+
}
|
|
170
156
|
export function Moveable(selector, options) {
|
|
171
157
|
return new MoveableContainer(typeof selector === "string" ?
|
|
172
158
|
document.querySelector(selector) :
|
|
173
|
-
selector,
|
|
159
|
+
selector, { ...defaultOptions, ...options });
|
|
174
160
|
}
|
|
@@ -1,123 +1,109 @@
|
|
|
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 "./resizable.css";
|
|
13
2
|
import "../core/polyfills";
|
|
14
3
|
import { EventHandler } from "./eventhandler";
|
|
15
|
-
|
|
4
|
+
const defaultOptions = {
|
|
16
5
|
resizeHandlePrefix: "rs-",
|
|
17
6
|
onStart: new EventHandler(),
|
|
18
7
|
onStop: new EventHandler(),
|
|
19
8
|
onResize: new EventHandler(),
|
|
20
9
|
resizeDelta: 0
|
|
21
10
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var _this = this;
|
|
11
|
+
export class ResizeContainer {
|
|
12
|
+
constructor(container, options) {
|
|
25
13
|
this.container = container;
|
|
26
14
|
this.options = options;
|
|
27
15
|
this.startSize = { x: null, y: null };
|
|
28
|
-
this.mouseDownContainer =
|
|
29
|
-
|
|
30
|
-
if ((" " + target.className).indexOf(" " +
|
|
16
|
+
this.mouseDownContainer = (evt) => {
|
|
17
|
+
const target = evt.target;
|
|
18
|
+
if ((" " + target.className).indexOf(" " + this.options.resizeHandlePrefix) < 0) {
|
|
31
19
|
return; // not a resize handle
|
|
32
20
|
}
|
|
33
21
|
evt.preventDefault();
|
|
34
22
|
evt.stopPropagation();
|
|
35
23
|
evt.stopImmediatePropagation();
|
|
36
|
-
|
|
37
|
-
target.classList.contains(
|
|
38
|
-
|
|
39
|
-
target.classList.contains(
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
this.resizeX = target.classList.contains(this.options.resizeHandlePrefix + "r") ||
|
|
25
|
+
target.classList.contains(this.options.resizeHandlePrefix + "l");
|
|
26
|
+
this.resizeY = target.classList.contains(this.options.resizeHandlePrefix + "t") ||
|
|
27
|
+
target.classList.contains(this.options.resizeHandlePrefix + "b");
|
|
28
|
+
this.element = target.parentElement; // TODO change to closest class
|
|
29
|
+
this.options.onStart.notify({ evt, target: this.element, x: this.extractArg(evt, "pageX"), y: this.extractArg(evt, "pageY") });
|
|
42
30
|
// register event listeners
|
|
43
|
-
window.addEventListener("mousemove",
|
|
44
|
-
window.addEventListener("mouseup",
|
|
45
|
-
window.addEventListener("touchmove",
|
|
46
|
-
window.addEventListener("touchend",
|
|
31
|
+
window.addEventListener("mousemove", this.mouseMove, false);
|
|
32
|
+
window.addEventListener("mouseup", this.mouseUp, false);
|
|
33
|
+
window.addEventListener("touchmove", this.mouseMove, false);
|
|
34
|
+
window.addEventListener("touchend", this.mouseUp, false);
|
|
47
35
|
};
|
|
48
|
-
this.mouseMove =
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
val =
|
|
36
|
+
this.mouseMove = (evt) => {
|
|
37
|
+
let raiseEvt = false;
|
|
38
|
+
if (this.resizeX) {
|
|
39
|
+
let val = this.extractArg(evt, "clientX") - this.element.getBoundingClientRect().left;
|
|
40
|
+
if (this.options.minWidth && val < this.options.minWidth) {
|
|
41
|
+
val = this.options.minWidth;
|
|
54
42
|
}
|
|
55
|
-
else if (
|
|
56
|
-
val =
|
|
43
|
+
else if (this.options.maxWidth && val > this.options.maxWidth) {
|
|
44
|
+
val = this.options.maxWidth;
|
|
57
45
|
}
|
|
58
|
-
if (
|
|
59
|
-
|
|
46
|
+
if (this.startSize != null && this.startSize.x == null) {
|
|
47
|
+
this.startSize.x = val;
|
|
60
48
|
}
|
|
61
|
-
if (
|
|
49
|
+
if (this.startSize == null || Math.abs(this.startSize.x - val) >= this.options.resizeDelta) {
|
|
62
50
|
// if (!this.options.gridX || Math.round(val) % this.options.gridX === 0) {
|
|
63
|
-
if (
|
|
64
|
-
val = Math.round(val /
|
|
51
|
+
if (this.options.gridX) {
|
|
52
|
+
val = Math.round(val / this.options.gridX) * this.options.gridX;
|
|
65
53
|
}
|
|
66
|
-
|
|
54
|
+
this.element.style.width = Math.round(val) + "px";
|
|
67
55
|
raiseEvt = true;
|
|
68
|
-
|
|
56
|
+
this.startSize = null;
|
|
69
57
|
// }
|
|
70
58
|
}
|
|
71
59
|
}
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
if (
|
|
75
|
-
val =
|
|
60
|
+
if (this.resizeY) {
|
|
61
|
+
let val = this.extractArg(evt, "clientY") - this.element.getBoundingClientRect().top;
|
|
62
|
+
if (this.options.minHeight && val < this.options.minHeight) {
|
|
63
|
+
val = this.options.minHeight;
|
|
76
64
|
}
|
|
77
|
-
else if (
|
|
78
|
-
val =
|
|
65
|
+
else if (this.options.maxHeight && val > this.options.maxHeight) {
|
|
66
|
+
val = this.options.maxHeight;
|
|
79
67
|
}
|
|
80
|
-
if (
|
|
81
|
-
|
|
68
|
+
if (this.startSize != null && this.startSize.y == null) {
|
|
69
|
+
this.startSize.y = val;
|
|
82
70
|
}
|
|
83
|
-
if (
|
|
71
|
+
if (this.startSize == null || Math.abs(this.startSize.y - val) >= this.options.resizeDelta) {
|
|
84
72
|
// if (!this.options.gridY || Math.round(val) % this.options.gridY === 0) {
|
|
85
|
-
if (
|
|
86
|
-
val = Math.round(val /
|
|
73
|
+
if (this.options.gridY) {
|
|
74
|
+
val = Math.round(val / this.options.gridY) * this.options.gridY;
|
|
87
75
|
}
|
|
88
|
-
|
|
76
|
+
this.element.style.height = Math.round(val) + "px";
|
|
89
77
|
raiseEvt = true;
|
|
90
|
-
|
|
78
|
+
this.startSize = null;
|
|
91
79
|
// }
|
|
92
80
|
}
|
|
93
81
|
}
|
|
94
82
|
if (raiseEvt) {
|
|
95
|
-
|
|
83
|
+
this.options.onResize.notify({ evt, target: this.element, x: this.extractArg(evt, "pageX"), y: this.extractArg(evt, "pageY") });
|
|
96
84
|
}
|
|
97
85
|
};
|
|
98
|
-
this.mouseUp =
|
|
99
|
-
window.removeEventListener("mousemove",
|
|
100
|
-
window.removeEventListener("mouseup",
|
|
101
|
-
window.removeEventListener("touchmove",
|
|
102
|
-
window.removeEventListener("touchend",
|
|
103
|
-
|
|
104
|
-
|
|
86
|
+
this.mouseUp = (evt) => {
|
|
87
|
+
window.removeEventListener("mousemove", this.mouseMove, false);
|
|
88
|
+
window.removeEventListener("mouseup", this.mouseUp, false);
|
|
89
|
+
window.removeEventListener("touchmove", this.mouseMove, false);
|
|
90
|
+
window.removeEventListener("touchend", this.mouseUp, false);
|
|
91
|
+
this.options.onStop.notify({ evt, target: this.element, x: this.extractArg(evt, "pageX"), y: this.extractArg(evt, "pageY") });
|
|
92
|
+
this.startSize = { x: null, y: null };
|
|
105
93
|
};
|
|
106
94
|
this.init();
|
|
107
95
|
}
|
|
108
|
-
|
|
96
|
+
init() {
|
|
109
97
|
this.container.classList.add("resizable");
|
|
110
98
|
this.container.addEventListener("mousedown", this.mouseDownContainer, false);
|
|
111
99
|
this.container.addEventListener("touchstart", this.mouseDownContainer, false);
|
|
112
|
-
}
|
|
113
|
-
|
|
100
|
+
}
|
|
101
|
+
extractArg(evt, key) {
|
|
114
102
|
return evt[key] != null ? evt[key] : (evt.touches.length > 0 ? evt.touches : evt.changedTouches)[0][key];
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
}());
|
|
118
|
-
export { ResizeContainer };
|
|
103
|
+
}
|
|
104
|
+
}
|
|
119
105
|
export function Resizable(selector, options) {
|
|
120
106
|
return new ResizeContainer(typeof selector === "string" ?
|
|
121
107
|
document.querySelector(selector) :
|
|
122
|
-
selector,
|
|
108
|
+
selector, { ...defaultOptions, ...options });
|
|
123
109
|
}
|
package/lib/ui/auto.suggest.js
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
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 "./auto.suggest.css";
|
|
13
|
-
|
|
2
|
+
let autoComplete = (function () {
|
|
14
3
|
function autoComplete(options) {
|
|
15
4
|
// helpers
|
|
16
5
|
function hasClass(el, className) { return el.classList.contains(className); }
|
|
@@ -23,8 +12,8 @@ var autoComplete = (function () {
|
|
|
23
12
|
}
|
|
24
13
|
function live(elClass, event, cb, context) {
|
|
25
14
|
addEvent(context || document, event, function (e) {
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
let found;
|
|
16
|
+
let el = e.target || e.srcElement;
|
|
28
17
|
while (el && !(found = hasClass(el, elClass))) {
|
|
29
18
|
el = el.parentElement;
|
|
30
19
|
}
|
|
@@ -33,7 +22,7 @@ var autoComplete = (function () {
|
|
|
33
22
|
}
|
|
34
23
|
});
|
|
35
24
|
}
|
|
36
|
-
|
|
25
|
+
const o = {
|
|
37
26
|
selector: "",
|
|
38
27
|
source: function (val, s) { return []; },
|
|
39
28
|
minChars: 0,
|
|
@@ -50,15 +39,15 @@ var autoComplete = (function () {
|
|
|
50
39
|
},
|
|
51
40
|
onSelect: function (e, term, item) { }
|
|
52
41
|
};
|
|
53
|
-
for (
|
|
42
|
+
for (const k in options) {
|
|
54
43
|
if (options.hasOwnProperty(k)) {
|
|
55
44
|
o[k] = options[k];
|
|
56
45
|
}
|
|
57
46
|
}
|
|
58
47
|
// init
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
48
|
+
let elems = typeof o.selector === 'object' ? [o.selector] : document.querySelectorAll(o.selector);
|
|
49
|
+
for (let i = 0; i < elems.length; i++) {
|
|
50
|
+
let that = elems[i];
|
|
62
51
|
// create suggestions container "sc"
|
|
63
52
|
that.sc = document.createElement('div');
|
|
64
53
|
that.sc.className = 'autocomplete-suggestions ' + o.menuClass;
|
|
@@ -98,13 +87,13 @@ var autoComplete = (function () {
|
|
|
98
87
|
addEvent(window, 'resize', that.updateSC);
|
|
99
88
|
document.body.appendChild(that.sc);
|
|
100
89
|
live('autocomplete-suggestion', 'mouseleave', function (e) {
|
|
101
|
-
|
|
90
|
+
const sel = that.sc.querySelector('.autocomplete-suggestion.selected');
|
|
102
91
|
if (sel) {
|
|
103
92
|
setTimeout(function () { sel.className = sel.className.replace('selected', ''); }, 20);
|
|
104
93
|
}
|
|
105
94
|
}, that.sc);
|
|
106
95
|
live('autocomplete-suggestion', 'mouseover', function (e) {
|
|
107
|
-
|
|
96
|
+
const sel = that.sc.querySelector('.autocomplete-suggestion.selected');
|
|
108
97
|
if (sel) {
|
|
109
98
|
sel.className = sel.className.replace('selected', '');
|
|
110
99
|
}
|
|
@@ -113,7 +102,7 @@ var autoComplete = (function () {
|
|
|
113
102
|
live('autocomplete-suggestion', 'mousedown', function (e) {
|
|
114
103
|
// window.setTimeout(() => {
|
|
115
104
|
if (hasClass(this, 'autocomplete-suggestion')) { // else outside click
|
|
116
|
-
|
|
105
|
+
const v = this.getAttribute('data-val');
|
|
117
106
|
that.value = v;
|
|
118
107
|
o.onSelect(e, v, this);
|
|
119
108
|
that.sc.style.display = 'none';
|
|
@@ -134,7 +123,7 @@ var autoComplete = (function () {
|
|
|
134
123
|
options.onChange(that.value);
|
|
135
124
|
};
|
|
136
125
|
addEvent(that, 'input', that.inputHandler);
|
|
137
|
-
suggest = function (data) {
|
|
126
|
+
var suggest = function (data) {
|
|
138
127
|
var val = that.value;
|
|
139
128
|
that.cache[val] = data;
|
|
140
129
|
if (data.length && val.length >= o.minChars) {
|
|
@@ -227,10 +216,6 @@ var autoComplete = (function () {
|
|
|
227
216
|
if (!o.minChars) {
|
|
228
217
|
addEvent(that, 'focus', that.focusHandler);
|
|
229
218
|
}
|
|
230
|
-
};
|
|
231
|
-
var suggest;
|
|
232
|
-
for (var i = 0; i < elems.length; i++) {
|
|
233
|
-
_loop_1(i);
|
|
234
219
|
}
|
|
235
220
|
// public destroy method
|
|
236
221
|
this.destroy = function () {
|
|
@@ -255,5 +240,5 @@ var autoComplete = (function () {
|
|
|
255
240
|
return autoComplete;
|
|
256
241
|
})();
|
|
257
242
|
export function AutoSuggest(input, opts) {
|
|
258
|
-
return new autoComplete(
|
|
243
|
+
return new autoComplete({ selector: input, ...opts });
|
|
259
244
|
}
|
|
@@ -26,11 +26,7 @@ export function noop() { }
|
|
|
26
26
|
* @params {Object} o2
|
|
27
27
|
* @returns {Object}
|
|
28
28
|
*/
|
|
29
|
-
export function cp() {
|
|
30
|
-
var params = [];
|
|
31
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
32
|
-
params[_i] = arguments[_i];
|
|
33
|
-
}
|
|
29
|
+
export function cp(...params) {
|
|
34
30
|
var args = arguments;
|
|
35
31
|
var o1 = args[0];
|
|
36
32
|
for (var i = 1; i < args.length; ++i) {
|