@vaadin/field-highlighter 23.1.0-beta2 → 23.1.0-rc1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/field-highlighter",
|
|
3
|
-
"version": "23.1.0-
|
|
3
|
+
"version": "23.1.0-rc1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -34,27 +34,27 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@polymer/polymer": "^3.0.0",
|
|
37
|
-
"@vaadin/component-base": "23.1.0-
|
|
38
|
-
"@vaadin/vaadin-lumo-styles": "23.1.0-
|
|
39
|
-
"@vaadin/vaadin-material-styles": "23.1.0-
|
|
40
|
-
"@vaadin/vaadin-overlay": "23.1.0-
|
|
41
|
-
"@vaadin/vaadin-themable-mixin": "23.1.0-
|
|
37
|
+
"@vaadin/component-base": "23.1.0-rc1",
|
|
38
|
+
"@vaadin/vaadin-lumo-styles": "23.1.0-rc1",
|
|
39
|
+
"@vaadin/vaadin-material-styles": "23.1.0-rc1",
|
|
40
|
+
"@vaadin/vaadin-overlay": "23.1.0-rc1",
|
|
41
|
+
"@vaadin/vaadin-themable-mixin": "23.1.0-rc1",
|
|
42
42
|
"lit": "^2.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@esm-bundle/chai": "^4.3.4",
|
|
46
|
-
"@vaadin/checkbox": "23.1.0-
|
|
47
|
-
"@vaadin/combo-box": "23.1.0-
|
|
48
|
-
"@vaadin/date-picker": "23.1.0-
|
|
49
|
-
"@vaadin/date-time-picker": "23.1.0-
|
|
50
|
-
"@vaadin/item": "23.1.0-
|
|
51
|
-
"@vaadin/list-box": "23.1.0-
|
|
52
|
-
"@vaadin/radio-group": "23.1.0-
|
|
53
|
-
"@vaadin/select": "23.1.0-
|
|
46
|
+
"@vaadin/checkbox": "23.1.0-rc1",
|
|
47
|
+
"@vaadin/combo-box": "23.1.0-rc1",
|
|
48
|
+
"@vaadin/date-picker": "23.1.0-rc1",
|
|
49
|
+
"@vaadin/date-time-picker": "23.1.0-rc1",
|
|
50
|
+
"@vaadin/item": "23.1.0-rc1",
|
|
51
|
+
"@vaadin/list-box": "23.1.0-rc1",
|
|
52
|
+
"@vaadin/radio-group": "23.1.0-rc1",
|
|
53
|
+
"@vaadin/select": "23.1.0-rc1",
|
|
54
54
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
55
|
-
"@vaadin/text-field": "23.1.0-
|
|
56
|
-
"@vaadin/time-picker": "23.1.0-
|
|
55
|
+
"@vaadin/text-field": "23.1.0-rc1",
|
|
56
|
+
"@vaadin/time-picker": "23.1.0-rc1",
|
|
57
57
|
"sinon": "^13.0.2"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "5ecb85e16e938df827fefca4bd2a665a1e29913e"
|
|
60
60
|
}
|
|
@@ -20,8 +20,6 @@ export interface FieldHighlighterUser {
|
|
|
20
20
|
* See https://vaadin.com/collaboration for Collaboration Engine documentation.
|
|
21
21
|
*/
|
|
22
22
|
declare class FieldHighlighterController implements ReactiveController {
|
|
23
|
-
constructor(host: HTMLElement);
|
|
24
|
-
|
|
25
23
|
/**
|
|
26
24
|
* The controller host element.
|
|
27
25
|
*/
|
|
@@ -47,6 +45,8 @@ declare class FieldHighlighterController implements ReactiveController {
|
|
|
47
45
|
*/
|
|
48
46
|
users: FieldHighlighterUser[];
|
|
49
47
|
|
|
48
|
+
constructor(host: HTMLElement);
|
|
49
|
+
|
|
50
50
|
hostConnected(): void;
|
|
51
51
|
|
|
52
52
|
redraw(): void;
|
|
@@ -4,17 +4,15 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { OverlayElement } from '@vaadin/vaadin-overlay/src/vaadin-overlay.js';
|
|
7
|
+
import { PositionMixin } from '@vaadin/vaadin-overlay/src/vaadin-overlay-position-mixin.js';
|
|
7
8
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
9
|
|
|
9
10
|
registerStyles(
|
|
10
11
|
'vaadin-user-tags-overlay',
|
|
11
12
|
css`
|
|
12
13
|
:host {
|
|
13
|
-
align-items: stretch;
|
|
14
|
-
justify-content: flex-start;
|
|
15
14
|
background: transparent;
|
|
16
15
|
box-shadow: none;
|
|
17
|
-
bottom: auto;
|
|
18
16
|
}
|
|
19
17
|
|
|
20
18
|
[part='overlay'] {
|
|
@@ -42,14 +40,6 @@ registerStyles(
|
|
|
42
40
|
padding: 0;
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
:host([dir='rtl']) {
|
|
46
|
-
left: auto;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
:host(:not([dir='rtl'])) {
|
|
50
|
-
right: auto;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
43
|
:host([opening]),
|
|
54
44
|
:host([closing]) {
|
|
55
45
|
animation: 0.14s user-tags-overlay-dummy-animation;
|
|
@@ -73,7 +63,7 @@ registerStyles(
|
|
|
73
63
|
* @extends OverlayElement
|
|
74
64
|
* @private
|
|
75
65
|
*/
|
|
76
|
-
class UserTagsOverlay extends OverlayElement {
|
|
66
|
+
class UserTagsOverlay extends PositionMixin(OverlayElement) {
|
|
77
67
|
static get is() {
|
|
78
68
|
return 'vaadin-user-tags-overlay';
|
|
79
69
|
}
|
package/src/vaadin-user-tags.js
CHANGED
|
@@ -45,6 +45,7 @@ export class UserTags extends PolymerElement {
|
|
|
45
45
|
id="overlay"
|
|
46
46
|
modeless
|
|
47
47
|
opened="[[opened]]"
|
|
48
|
+
no-vertical-overlap
|
|
48
49
|
on-vaadin-overlay-open="_onOverlayOpen"
|
|
49
50
|
></vaadin-user-tags-overlay>
|
|
50
51
|
`;
|
|
@@ -68,7 +69,6 @@ export class UserTags extends PolymerElement {
|
|
|
68
69
|
opened: {
|
|
69
70
|
type: Boolean,
|
|
70
71
|
value: false,
|
|
71
|
-
observer: '_openedChanged',
|
|
72
72
|
},
|
|
73
73
|
|
|
74
74
|
/**
|
|
@@ -85,6 +85,7 @@ export class UserTags extends PolymerElement {
|
|
|
85
85
|
*/
|
|
86
86
|
target: {
|
|
87
87
|
type: Object,
|
|
88
|
+
observer: '__targetChanged',
|
|
88
89
|
},
|
|
89
90
|
|
|
90
91
|
/**
|
|
@@ -103,23 +104,9 @@ export class UserTags extends PolymerElement {
|
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
constructor() {
|
|
107
|
-
super();
|
|
108
|
-
this._boundSetPosition = this._debounceSetPosition.bind(this);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/** @protected */
|
|
112
|
-
connectedCallback() {
|
|
113
|
-
super.connectedCallback();
|
|
114
|
-
window.addEventListener('resize', this._boundSetPosition);
|
|
115
|
-
window.addEventListener('scroll', this._boundSetPosition);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
107
|
/** @protected */
|
|
119
108
|
disconnectedCallback() {
|
|
120
109
|
super.disconnectedCallback();
|
|
121
|
-
window.removeEventListener('resize', this._boundSetPosition);
|
|
122
|
-
window.removeEventListener('scroll', this._boundSetPosition);
|
|
123
110
|
this.opened = false;
|
|
124
111
|
}
|
|
125
112
|
|
|
@@ -138,15 +125,8 @@ export class UserTags extends PolymerElement {
|
|
|
138
125
|
}
|
|
139
126
|
|
|
140
127
|
/** @private */
|
|
141
|
-
|
|
142
|
-
this.
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/** @private */
|
|
146
|
-
_openedChanged(opened) {
|
|
147
|
-
if (opened) {
|
|
148
|
-
this._setPosition();
|
|
149
|
-
}
|
|
128
|
+
__targetChanged(target) {
|
|
129
|
+
this.$.overlay.positionTarget = target;
|
|
150
130
|
}
|
|
151
131
|
|
|
152
132
|
/** @private */
|
|
@@ -156,34 +136,6 @@ export class UserTags extends PolymerElement {
|
|
|
156
136
|
}
|
|
157
137
|
}
|
|
158
138
|
|
|
159
|
-
/**
|
|
160
|
-
* Set position of the user tags overlay.
|
|
161
|
-
* TODO: use PositionMixin instead.
|
|
162
|
-
*
|
|
163
|
-
* @private
|
|
164
|
-
*/
|
|
165
|
-
_setPosition() {
|
|
166
|
-
if (!this.opened) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const targetRect = this.target.getBoundingClientRect();
|
|
171
|
-
|
|
172
|
-
const overlayRect = this.$.overlay.getBoundingClientRect();
|
|
173
|
-
|
|
174
|
-
this._translateX =
|
|
175
|
-
this.getAttribute('dir') === 'rtl'
|
|
176
|
-
? targetRect.right - overlayRect.right + (this._translateX || 0)
|
|
177
|
-
: targetRect.left - overlayRect.left + (this._translateX || 0);
|
|
178
|
-
this._translateY = targetRect.top - overlayRect.top + (this._translateY || 0) + targetRect.height;
|
|
179
|
-
|
|
180
|
-
const devicePixelRatio = window.devicePixelRatio || 1;
|
|
181
|
-
this._translateX = Math.round(this._translateX * devicePixelRatio) / devicePixelRatio;
|
|
182
|
-
this._translateY = Math.round(this._translateY * devicePixelRatio) / devicePixelRatio;
|
|
183
|
-
|
|
184
|
-
this.$.overlay.style.transform = `translate3d(${this._translateX}px, ${this._translateY}px, 0)`;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
139
|
get wrapper() {
|
|
188
140
|
return this.$.overlay.content.querySelector('[part="tags"]');
|
|
189
141
|
}
|
|
@@ -279,16 +231,25 @@ export class UserTags extends PolymerElement {
|
|
|
279
231
|
|
|
280
232
|
if (this.opened && this.hasFocus) {
|
|
281
233
|
this.updateTags(users, changedTags);
|
|
282
|
-
} else if (addedUsers.length && document.visibilityState !== 'hidden') {
|
|
234
|
+
} else if (addedUsers.length > 0 && document.visibilityState !== 'hidden') {
|
|
283
235
|
// Avoid adding to queue if window is not visible.
|
|
284
|
-
|
|
236
|
+
|
|
237
|
+
const addedTags = changedTags.added;
|
|
238
|
+
const removedTags = changedTags.removed;
|
|
239
|
+
|
|
240
|
+
// Only sync the removed user tags.
|
|
241
|
+
// The added tags are handled by the `flashTags` method.
|
|
242
|
+
this.updateTagsSync(users, {
|
|
243
|
+
added: [],
|
|
244
|
+
removed: removedTags,
|
|
245
|
+
});
|
|
246
|
+
|
|
285
247
|
if (this.flashing) {
|
|
286
248
|
// Schedule next flash later
|
|
287
|
-
this.push('_flashQueue',
|
|
249
|
+
this.push('_flashQueue', addedTags);
|
|
288
250
|
} else {
|
|
289
|
-
this.flashTags(
|
|
251
|
+
this.flashTags(addedTags);
|
|
290
252
|
}
|
|
291
|
-
this.set('users', users);
|
|
292
253
|
} else {
|
|
293
254
|
this.updateTagsSync(users, changedTags);
|
|
294
255
|
}
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import '@vaadin/vaadin-overlay/theme/lumo/vaadin-overlay.js';
|
|
6
7
|
import './vaadin-user-tags-styles.js';
|
|
7
8
|
import '../../src/vaadin-user-tags.js';
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import '@vaadin/vaadin-overlay/theme/material/vaadin-overlay.js';
|
|
6
7
|
import './vaadin-user-tags-styles.js';
|
|
7
8
|
import '../../src/vaadin-user-tags.js';
|