@eclipse-scout/core 11.0.30 → 11.0.38

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/file-list CHANGED
@@ -1,5 +1,5 @@
1
- eclipse-scout-core-06e644e3652259b0b7d4.min.js
2
- eclipse-scout-core-06e644e3652259b0b7d4.min.js.map
1
+ eclipse-scout-core-6f461e156d8a9428851c.min.js
2
+ eclipse-scout-core-6f461e156d8a9428851c.min.js.map
3
3
  eclipse-scout-core-theme-d1dee22d4f9b9233a432.min.css
4
4
  eclipse-scout-core-theme-dark-7ead007f849a9c1a6ec1.min.css
5
5
  eclipse-scout-core-theme-dark.css
package/dist/texts.json CHANGED
@@ -127,6 +127,8 @@
127
127
  "ui.PleaseWait_": "Please wait",
128
128
  "ui.PopupBlockerDetected": "Opening a new window automatically was blocked by the browser.",
129
129
  "ui.Reconnecting_": "Reconnecting...",
130
+ "ui.RejectedUpload": "Rejected File Upload",
131
+ "ui.RejectedUploadMsg": "The uploaded file was rejected by the security policy.",
130
132
  "ui.Reload": "Reload",
131
133
  "ui.ReloadData": "Reload data",
132
134
  "ui.RemoveFilter": "Remove filter",
@@ -298,6 +300,8 @@
298
300
  "ui.PleaseWait_": "Veuillez attendre",
299
301
  "ui.PopupBlockerDetected": "L'ouverture d'une nouvelle fenêtre a été empêchée par la navigateur.",
300
302
  "ui.Reconnecting_": "Connexion …",
303
+ "ui.RejectedUpload": "Téléchargement de fichier rejeté",
304
+ "ui.RejectedUploadMsg": "Le fichier téléchargé a été rejeté par la politique de sécurité.",
301
305
  "ui.Reload": "Charger à nouveau",
302
306
  "ui.ReloadData": "Nouveau chargement des données",
303
307
  "ui.RemoveFilter": "Supprimer le filtre",
@@ -469,6 +473,8 @@
469
473
  "ui.PleaseWait_": "Attendere prego",
470
474
  "ui.PopupBlockerDetected": "Apertura automatica di una nuova finestra impedita dal browser.",
471
475
  "ui.Reconnecting_": "Collegamento...",
476
+ "ui.RejectedUpload": "Caricamento file rifiutato",
477
+ "ui.RejectedUploadMsg": "Il file caricato è stato rifiutato dalla politica di sicurezza.",
472
478
  "ui.Reload": "Ricarica",
473
479
  "ui.ReloadData": "Ricarica dati",
474
480
  "ui.RemoveFilter": "Rimuovere filtro",
@@ -645,6 +651,8 @@
645
651
  "ui.PleaseWait_": "Bitte warten",
646
652
  "ui.PopupBlockerDetected": "Das automatische Öffnen eines neuen Fensters wurde durch den Browser verhindert.",
647
653
  "ui.Reconnecting_": "Verbinde...",
654
+ "ui.RejectedUpload": "Abgelehnte Datei",
655
+ "ui.RejectedUploadMsg": "Die hochgeladene Datei wurde durch die Sicherheitsrichtlinie abgelehnt.",
648
656
  "ui.Reload": "Neu laden",
649
657
  "ui.ReloadData": "Daten neu laden",
650
658
  "ui.RemoveFilter": "Filter entfernen",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-scout/core",
3
- "version": "11.0.30",
3
+ "version": "11.0.38",
4
4
  "description": "Eclipse Scout runtime",
5
5
  "author": "BSI Business Systems Integration AG",
6
6
  "homepage": "https://www.eclipse.org/scout",
@@ -40,7 +40,7 @@
40
40
  "release-postdependency": "releng-scripts release-publish-dependency"
41
41
  },
42
42
  "devDependencies": {
43
- "@eclipse-scout/cli": "11.0.30",
43
+ "@eclipse-scout/cli": "11.0.38",
44
44
  "@eclipse-scout/releng": "^10.0.0",
45
45
  "jasmine-core": "3.6.0",
46
46
  "jasmine-ajax": "4.0.0",
@@ -36,6 +36,10 @@ export default class PlainTextEncoder {
36
36
  // Separate td with ' '
37
37
  text = text.replace(/<\/td>/gi, ' ');
38
38
 
39
+ if (options.removeFontIcons) {
40
+ text = text.replace(/<span\s+class="[^"]*font-icon[^"]*">[^<]*<\/span>/gmi, '');
41
+ }
42
+
39
43
  // Replace remaining tags
40
44
  text = text.replace(/<[^>]+>/gi, '');
41
45
 
package/src/index.js CHANGED
@@ -69,6 +69,7 @@ export {default as HAlign} from './util/HAlign';
69
69
  export {default as aggregation} from './util/aggregation';
70
70
  export {default as webstorage} from './util/webstorage';
71
71
  export {default as cookies} from './util/cookies';
72
+ export {default as ViewportScroller} from './util/ViewportScroller';
72
73
  export {default as ajax} from './ajax/ajax';
73
74
  export {default as AjaxCall} from './ajax/AjaxCall';
74
75
  export {default as AjaxError} from './ajax/AjaxError';
@@ -104,14 +104,49 @@ export default class Popup extends Widget {
104
104
 
105
105
  // Note that these strings are also used as CSS classes
106
106
  static Alignment = {
107
+ /**
108
+ * The entire popup is positioned horizontally left of the anchor.
109
+ */
107
110
  LEFT: 'left',
111
+ /**
112
+ * With arrow: The arrow at the left edge of the popup is aligned horizontally with the center of the anchor.
113
+ * <p>
114
+ * Without arrow: The left edges of both the popup and the anchor are aligned horizontally.
115
+ */
108
116
  LEFTEDGE: 'leftedge',
117
+ /**
118
+ * The entire popup is positioned vertically above the anchor.
119
+ */
109
120
  TOP: 'top',
121
+ /**
122
+ * With arrow: The arrow at the top edge of the popup is aligned vertically with the center of the anchor.
123
+ * <p>
124
+ * Without arrow: The top edges of both the popup and the anchor are aligned vertically.
125
+ */
110
126
  TOPEDGE: 'topedge',
127
+ /**
128
+ * The centers of both the popup and the anchor are aligned in the respective dimension.
129
+ */
111
130
  CENTER: 'center',
131
+ /**
132
+ * The entire popup is positioned horizontally to the right of the anchor.
133
+ */
112
134
  RIGHT: 'right',
135
+ /**
136
+ * With arrow: The arrow at the right edge of the popup is aligned horizontally with the center of the anchor.
137
+ * <p>
138
+ * Without arrow: The right edges of both the popup and the anchor are aligned horizontally.
139
+ */
113
140
  RIGHTEDGE: 'rightedge',
141
+ /**
142
+ * The entire popup is positioned vertically below the anchor.
143
+ */
114
144
  BOTTOM: 'bottom',
145
+ /**
146
+ * With arrow: The arrow at the bottom edge of the popup is aligned vertically with the center of the anchor.
147
+ * <p>
148
+ * Without arrow: The bottom edges of both the popup and the anchor are aligned vertically.
149
+ */
115
150
  BOTTOMEDGE: 'bottomedge'
116
151
  };
117
152
 
@@ -122,6 +122,7 @@ export default class Session {
122
122
  SESSION_TIMEOUT: 10,
123
123
  UI_PROCESSING: 20,
124
124
  UNSAFE_UPLOAD: 30,
125
+ REJECTED_UPLOAD: 31,
125
126
  VERSION_MISMATCH: 40
126
127
  };
127
128
 
@@ -1048,6 +1049,12 @@ export default class Session {
1048
1049
  boxOptions.yesButtonText = this.optText('ui.Ok', 'Ok');
1049
1050
  boxOptions.yesButtonAction = () => {
1050
1051
  };
1052
+ } else if (jsonError.code === Session.JsonResponseError.REJECTED_UPLOAD) {
1053
+ boxOptions.header = this.optText('ui.RejectedUpload', boxOptions.header);
1054
+ boxOptions.body = this.optText('ui.RejectedUploadMsg', boxOptions.body);
1055
+ boxOptions.yesButtonText = this.optText('ui.Ok', 'Ok');
1056
+ boxOptions.yesButtonAction = () => {
1057
+ };
1051
1058
  }
1052
1059
  this.showFatalMessage(boxOptions, jsonError.code);
1053
1060
  }
@@ -864,13 +864,16 @@ export default class Table extends Widget {
864
864
 
865
865
  if (tooltipText) {
866
866
  return tooltipText;
867
- } else if ($row.data('aggregateRow') && $cell.text().trim() && ($cell.isContentTruncated() || ($cell.children('.table-cell-icon').length && !$cell.children('.table-cell-icon').isVisible()))) {
867
+ }
868
+ if ($row.data('aggregateRow') && $cell.text().trim() && ($cell.isContentTruncated() || ($cell.children('.table-cell-icon').length && !$cell.children('.table-cell-icon').isVisible()))) {
868
869
  $cell = $cell.clone();
869
870
  $cell.children('.table-cell-icon').setVisible(true);
870
871
  return $cell.html();
871
- } else if (this._isTruncatedCellTooltipEnabled(column) && $cell.isContentTruncated()) {
872
+ }
873
+ if (this._isTruncatedCellTooltipEnabled(column) && $cell.isContentTruncated()) {
872
874
  return strings.plainText($cell.html(), {
873
- trim: true
875
+ trim: true,
876
+ removeFontIcons: true
874
877
  });
875
878
  }
876
879
  }
@@ -294,7 +294,8 @@ export default class TableHeader extends Widget {
294
294
  $col = $col.clone();
295
295
  $col.children('.table-header-item-state').remove();
296
296
  let text = strings.plainText($col.html(), {
297
- trim: true
297
+ trim: true,
298
+ removeFontIcons: true
298
299
  });
299
300
  if (strings.hasText(text)) {
300
301
  return text;
@@ -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
+ }
@@ -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
- map = {};
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
- elements = elements.filter(element => {
441
- return element !== null && element !== undefined;
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
 
@@ -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 occured in the mean time.
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 ocurred while pre-loading the following fonts:\n\n- ' + badFonts.join('\n- ') + '\n\n' +
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 ' +
@@ -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
- * Options:
158
- * - compact: Multiple consecutive empty lines are reduced to a single empty line
159
- * - trim: Calls string.trim(). White space at the beginning and the end of the text gets removed.
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