@eclipse-scout/core 11.0.32 → 11.0.41
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/dist/eclipse-scout-core-f05c37a693e6abaa57dc.min.js +2 -0
- package/dist/eclipse-scout-core-f05c37a693e6abaa57dc.min.js.map +1 -0
- package/dist/eclipse-scout-core-theme.css.map +1 -1
- package/dist/eclipse-scout-core.js +2205 -1759
- package/dist/eclipse-scout-core.js.map +1 -1
- package/dist/file-list +2 -2
- package/dist/texts.json +8 -0
- package/package.json +2 -2
- package/src/encoder/PlainTextEncoder.js +4 -0
- package/src/form/fields/smartfield/ProposalField.js +0 -7
- package/src/form/fields/smartfield/SmartField.js +16 -0
- package/src/form/fields/stringfield/StringField.js +11 -89
- package/src/form/fields/tagfield/TagField.js +13 -1
- package/src/index.js +2 -0
- package/src/lookup/RestLookupCall.js +51 -11
- package/src/popup/Popup.js +35 -0
- package/src/session/Session.js +7 -0
- package/src/table/Table.js +6 -3
- package/src/table/TableHeader.js +2 -1
- package/src/util/MaxLengthHandler.js +119 -0
- package/src/util/ViewportScroller.js +156 -0
- package/src/util/arrays.js +4 -7
- package/src/util/events.js +1 -1
- package/src/util/fonts.js +1 -1
- package/src/util/strings.js +9 -3
- package/dist/eclipse-scout-core-466592e50380384291c7.min.js +0 -2
- package/dist/eclipse-scout-core-466592e50380384291c7.min.js.map +0 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2010-2021 BSI Business Systems Integration AG.
|
|
3
|
+
* All rights reserved. This program and the accompanying materials
|
|
4
|
+
* are made available under the terms of the Eclipse Public License v1.0
|
|
5
|
+
* which accompanies this distribution, and is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-v10.html
|
|
7
|
+
*
|
|
8
|
+
* Contributors:
|
|
9
|
+
* BSI Business Systems Integration AG - initial API and implementation
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export default class ViewportScroller {
|
|
13
|
+
|
|
14
|
+
static SPEED_FACTOR_SLOW = 1 / 20;
|
|
15
|
+
static SPEED_FACTOR_MEDIUM = 1 / 10;
|
|
16
|
+
static SPEED_FACTOR_FAST = 1 / 5;
|
|
17
|
+
|
|
18
|
+
constructor(model) {
|
|
19
|
+
this.viewportWidth = 0;
|
|
20
|
+
this.viewportHeight = 0;
|
|
21
|
+
/** distance from the viewport edge (in pixel) where we start to scroll automatically */
|
|
22
|
+
this.e = 30;
|
|
23
|
+
/** position of "fast scroll" area. Same dimension as e. Negative values are outside the viewport. */
|
|
24
|
+
this.f = -30;
|
|
25
|
+
/** milliseconds */
|
|
26
|
+
this.initialDelay = 500;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Function that returns "false", if the scrolling should no longer be active (e.g. because the
|
|
30
|
+
* elements were removed from the DOM) or "true" otherwise.
|
|
31
|
+
* @return {boolean}
|
|
32
|
+
*/
|
|
33
|
+
this.active = () => true;
|
|
34
|
+
/**
|
|
35
|
+
* Function that receives the computed delta scroll positions (positive or negative) when automatic scrolling is active.
|
|
36
|
+
* @param {number} dx
|
|
37
|
+
* @param {number} dy
|
|
38
|
+
*/
|
|
39
|
+
this.scroll = (dx, dy) => {
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
$.extend(this, model);
|
|
43
|
+
|
|
44
|
+
// --- Do not change the following properties manually ---
|
|
45
|
+
|
|
46
|
+
this.dx = 0;
|
|
47
|
+
this.dy = 0;
|
|
48
|
+
this.started = false;
|
|
49
|
+
this.moved = false;
|
|
50
|
+
|
|
51
|
+
this._timeoutId = null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
_tick() {
|
|
55
|
+
if (!this.active()) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (this.started && (this.dx || this.dy)) {
|
|
59
|
+
this.scroll(this.dx, this.dy);
|
|
60
|
+
this.moved = true;
|
|
61
|
+
}
|
|
62
|
+
// Reschedule for continuous scrolling
|
|
63
|
+
let delay = (this.moved ? 16 : this.initialDelay); // 16ms = 60fps
|
|
64
|
+
this._timeoutId = setTimeout(() => this._tick(), delay);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Normally, it should not be necessary to call this method manually. Use update() instead.
|
|
69
|
+
*/
|
|
70
|
+
start() {
|
|
71
|
+
clearTimeout(this._timeoutId);
|
|
72
|
+
this._tick();
|
|
73
|
+
this.started = true;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Normally, it should not be necessary to call this method manually. Use update() instead.
|
|
78
|
+
*/
|
|
79
|
+
stop() {
|
|
80
|
+
clearTimeout(this._timeoutId);
|
|
81
|
+
this._timeoutId = null;
|
|
82
|
+
this.started = false;
|
|
83
|
+
this.moved = false;
|
|
84
|
+
this.dx = 0;
|
|
85
|
+
this.dy = 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* This method is intended to be called with the current mouse position (viewport-relative coordinates in pixel)
|
|
90
|
+
* on every mouse move event. It automatically computes the required delta scroll positions in both directions.
|
|
91
|
+
*
|
|
92
|
+
* @param {Point} mouse
|
|
93
|
+
*/
|
|
94
|
+
update(mouse) {
|
|
95
|
+
let e = this.e;
|
|
96
|
+
let f = this.f;
|
|
97
|
+
// f2 = Half-way between e and f
|
|
98
|
+
let f2 = Math.floor((e + f) / 2);
|
|
99
|
+
|
|
100
|
+
let scrollAreaLeft = e;
|
|
101
|
+
let scrollAreaRight = this.viewportWidth - e;
|
|
102
|
+
let scrollAreaTop = e;
|
|
103
|
+
let scrollAreaBottom = this.viewportHeight - e;
|
|
104
|
+
|
|
105
|
+
// Slow scrolling between e and f2, medium scrolling between f2 and f, fast scrolling after f
|
|
106
|
+
const SLOW = ViewportScroller.SPEED_FACTOR_SLOW;
|
|
107
|
+
const MEDIUM = ViewportScroller.SPEED_FACTOR_MEDIUM;
|
|
108
|
+
const FAST = ViewportScroller.SPEED_FACTOR_FAST;
|
|
109
|
+
let speedFactorX = 0;
|
|
110
|
+
let speedFactorY = 0;
|
|
111
|
+
|
|
112
|
+
// dx/dy = distance (positive or negative) in pixel
|
|
113
|
+
let dx = 0;
|
|
114
|
+
let dy = 0;
|
|
115
|
+
// noinspection DuplicatedCode
|
|
116
|
+
if (mouse.x < scrollAreaLeft) {
|
|
117
|
+
dx = -(scrollAreaLeft - mouse.x);
|
|
118
|
+
speedFactorX = (mouse.x > f2 ? SLOW : (mouse.x > f ? MEDIUM : FAST));
|
|
119
|
+
} else if (mouse.x > scrollAreaRight) {
|
|
120
|
+
dx = (mouse.x - scrollAreaRight);
|
|
121
|
+
speedFactorX = (mouse.x > this.viewportWidth - f ? FAST : (mouse.x > this.viewportWidth - f2 ? MEDIUM : SLOW));
|
|
122
|
+
}
|
|
123
|
+
// noinspection DuplicatedCode
|
|
124
|
+
if (mouse.y < scrollAreaTop) {
|
|
125
|
+
dy = -(scrollAreaTop - mouse.y);
|
|
126
|
+
speedFactorY = (mouse.y > f2 ? SLOW : (mouse.y > f ? MEDIUM : FAST));
|
|
127
|
+
} else if (mouse.y > scrollAreaBottom) {
|
|
128
|
+
dy = (mouse.y - scrollAreaBottom);
|
|
129
|
+
speedFactorY = (mouse.y > this.viewportHeight - f ? FAST : (mouse.y > this.viewportHeight - f2 ? MEDIUM : SLOW));
|
|
130
|
+
}
|
|
131
|
+
// ax/ay = absolute distance in pixel
|
|
132
|
+
let ax = Math.abs(dx);
|
|
133
|
+
let ay = Math.abs(dy);
|
|
134
|
+
let a = Math.max(ax, ay);
|
|
135
|
+
|
|
136
|
+
if (a === 0) {
|
|
137
|
+
// Mouse not in scroll area -> stop previously started loop
|
|
138
|
+
this.stop();
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Compute distance to scroll
|
|
143
|
+
let speedX = 1 + Math.floor(ax * speedFactorX);
|
|
144
|
+
let speedY = 1 + Math.floor(ay * speedFactorY);
|
|
145
|
+
this.dx = Math.sign(dx) * speedX;
|
|
146
|
+
this.dy = Math.sign(dy) * speedY;
|
|
147
|
+
|
|
148
|
+
// --- Start loop ---
|
|
149
|
+
this.started || this.start();
|
|
150
|
+
|
|
151
|
+
if (!this.moved && a > e) {
|
|
152
|
+
// If mouse is outside the viewport, ensure scrolling starts immediately (by calling start() again)
|
|
153
|
+
this.start();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
package/src/util/arrays.js
CHANGED
|
@@ -242,8 +242,8 @@ export function pushAll(arr, arr2) {
|
|
|
242
242
|
* If the arrays contain objects instead of primitives, it uses their id to check for equality.
|
|
243
243
|
*/
|
|
244
244
|
export function union(array1, array2) {
|
|
245
|
-
let result = []
|
|
246
|
-
|
|
245
|
+
let result = [];
|
|
246
|
+
let map = {};
|
|
247
247
|
|
|
248
248
|
array1 = ensure(array1);
|
|
249
249
|
array2 = ensure(array2);
|
|
@@ -437,11 +437,8 @@ export function findIndexFromReverse(arr, startIndex, predicate) {
|
|
|
437
437
|
* Pushes all elements to the given array that are not null or undefined.
|
|
438
438
|
*/
|
|
439
439
|
export function pushIfDefined(arr, ...elements) {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
});
|
|
443
|
-
if (arr && elements.length) {
|
|
444
|
-
arr.push(...elements);
|
|
440
|
+
if (arr) {
|
|
441
|
+
pushAll(arr, elements.filter(element => element !== null && element !== undefined));
|
|
445
442
|
}
|
|
446
443
|
}
|
|
447
444
|
|
package/src/util/events.js
CHANGED
|
@@ -100,7 +100,7 @@ export function onScrollStartEndDuringTouch($elem, startHandler, endHandler) {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
clearTimeout(scrollTimeout);
|
|
103
|
-
// Check some ms later if a scroll event has
|
|
103
|
+
// Check some ms later if a scroll event has occurred in the mean time.
|
|
104
104
|
// If yes it (probably) is still scrolling. If no it (probably) is not scrolling anymore -> call handler
|
|
105
105
|
checkLater();
|
|
106
106
|
};
|
package/src/util/fonts.js
CHANGED
|
@@ -41,7 +41,7 @@ export function bootstrap(fonts) {
|
|
|
41
41
|
fonts: fonts,
|
|
42
42
|
onComplete: (success, badFonts) => {
|
|
43
43
|
if (!success && badFonts && badFonts.length) {
|
|
44
|
-
$.log.warn('Timeout
|
|
44
|
+
$.log.warn('Timeout occurred while pre-loading the following fonts:\n\n- ' + badFonts.join('\n- ') + '\n\n' +
|
|
45
45
|
'Rendering will now continue, but font measurements may be inaccurate. ' +
|
|
46
46
|
'To prevent unnecessary startup delays and layout problems, check the @font-face ' +
|
|
47
47
|
'definitions and the referenced "src" URLs or programmatically add additional font-specific ' +
|
package/src/util/strings.js
CHANGED
|
@@ -154,9 +154,10 @@ export function encode(text) {
|
|
|
154
154
|
* Tries to preserve the new lines. Since it does not consider the style, it won't be right in any cases.
|
|
155
155
|
* A div for example always generates a new line, even if display style is not set to block.
|
|
156
156
|
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
157
|
+
* @param {object} [options]
|
|
158
|
+
* @param {boolean} [options.compact] Multiple consecutive empty lines are reduced to a single empty line. Default is false.
|
|
159
|
+
* @param {boolean}[options.trim] Calls string.trim(). White space at the beginning and the end of the text gets removed.. Default is false.
|
|
160
|
+
* @param {boolean} [options.removeFontIcons] Removes font icons. Default is false.
|
|
160
161
|
*/
|
|
161
162
|
export function plainText(text, options) {
|
|
162
163
|
if (!plainTextEncoder) { // lazy instantiation to avoid cyclic dependency errors during webpack bootstrap
|
|
@@ -456,6 +457,7 @@ export function truncateText(text, horizontalSpace, measureText) {
|
|
|
456
457
|
return text;
|
|
457
458
|
}
|
|
458
459
|
|
|
460
|
+
// noinspection JSDeprecatedSymbols
|
|
459
461
|
export default {
|
|
460
462
|
asString,
|
|
461
463
|
box,
|
|
@@ -470,6 +472,7 @@ export default {
|
|
|
470
472
|
hasText,
|
|
471
473
|
insertAt,
|
|
472
474
|
join,
|
|
475
|
+
length,
|
|
473
476
|
/** @deprecated */
|
|
474
477
|
lowercaseFirstLetter,
|
|
475
478
|
nl2br,
|
|
@@ -483,8 +486,11 @@ export default {
|
|
|
483
486
|
repeat,
|
|
484
487
|
splitMax,
|
|
485
488
|
startsWith,
|
|
489
|
+
toLowerCase,
|
|
486
490
|
toLowerCaseFirstLetter,
|
|
491
|
+
toUpperCase,
|
|
487
492
|
toUpperCaseFirstLetter,
|
|
493
|
+
trim,
|
|
488
494
|
truncateText,
|
|
489
495
|
/** @deprecated */
|
|
490
496
|
uppercaseFirstLetter
|