@itrocks/list 0.27.0 → 0.28.0
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/README.md +3 -7
- package/build.d.ts +1 -1
- package/build.js +1 -1
- package/cjs/list.html +4 -9
- package/list.css +53 -50
- package/package.json +1 -1
- package/search-focus.js +15 -1
- package/toolbar.js +19 -9
- package/search-menu.d.ts +0 -1
- package/search-menu.js +0 -140
package/README.md
CHANGED
|
@@ -102,13 +102,9 @@ For `json()`, the scope is passed directly to `dataSource().search()`.
|
|
|
102
102
|
|
|
103
103
|
## Search filters
|
|
104
104
|
|
|
105
|
-
The
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
Reset clears all filters, including saved filters for hidden columns, and reloads the list without changing its sorting
|
|
109
|
-
or column configuration. The menu does not change the selection column's width.
|
|
110
|
-
Arrow Down, the context-menu key or Shift+F10 on the button also opens the menu. Use arrow keys to select an action,
|
|
111
|
-
Enter or Space to activate it, and Escape to close it. Clicking outside dismisses the menu.
|
|
105
|
+
The filter button in the first column submits the column filters, as does Enter in a filter field.
|
|
106
|
+
When the toolbar shows a filter, the reset button appears immediately to its right.
|
|
107
|
+
Reset clears all filters, including saved filters for hidden columns, and reloads the list with its current sorting and columns.
|
|
112
108
|
|
|
113
109
|
HTML list filters interpret the first hyphen as an interval separator. Spaces around the bounds are ignored:
|
|
114
110
|
|
package/build.d.ts
CHANGED
package/build.js
CHANGED
|
@@ -10,7 +10,7 @@ import { TableLink } from '@itrocks/table/link.js';
|
|
|
10
10
|
import { tableByElement } from '@itrocks/table/table.js';
|
|
11
11
|
import { xTargetCall } from '@itrocks/xtarget/xtarget.js';
|
|
12
12
|
import './column-filter.js';
|
|
13
|
-
import './search-
|
|
13
|
+
import './search-focus.js';
|
|
14
14
|
import './toolbar.js';
|
|
15
15
|
build('article[data-action="list"] > form > table.objects', table => {
|
|
16
16
|
let persistedColumns = [...table.querySelectorAll('thead th[data-property]')]
|
package/cjs/list.html
CHANGED
|
@@ -27,8 +27,10 @@
|
|
|
27
27
|
</ul>
|
|
28
28
|
<div class="list-filter">
|
|
29
29
|
<!--filterBar-->{{template}}<!--end-->
|
|
30
|
+
<button aria-label="Reset search filters" class="list-filter-reset" title="Reset search filters"
|
|
31
|
+
type="button">×</button>
|
|
30
32
|
</div>
|
|
31
|
-
<
|
|
33
|
+
<div class="summary">{count} elements</div>
|
|
32
34
|
<button class="add-column" hidden type="button" aria-label="Add column">+</button>
|
|
33
35
|
</div>
|
|
34
36
|
</header>
|
|
@@ -53,14 +55,7 @@
|
|
|
53
55
|
{./feed.html}
|
|
54
56
|
</tbody>
|
|
55
57
|
</table>
|
|
56
|
-
<
|
|
57
|
-
<button class="search" role="menuitem" tabindex="-1" type="submit">
|
|
58
|
-
Search
|
|
59
|
-
</button>
|
|
60
|
-
<button class="reset" name="reset" role="menuitem" tabindex="-1" type="submit" value="reset">
|
|
61
|
-
Reset search filters
|
|
62
|
-
</button>
|
|
63
|
-
</div>
|
|
58
|
+
<button hidden name="reset" type="submit" value="reset">Reset search filters</button>
|
|
64
59
|
<footer>
|
|
65
60
|
<ul class="selection actions">
|
|
66
61
|
<!--selection--><!--footer-->{{template}}<!--end--><!--end-->
|
package/list.css
CHANGED
|
@@ -211,15 +211,26 @@ table.objects > thead > tr.properties > th > input:not([type=checkbox]) {
|
|
|
211
211
|
width: 100%;
|
|
212
212
|
}
|
|
213
213
|
table.objects > thead > tr.properties > th > input.search-submit {
|
|
214
|
-
background: url("
|
|
214
|
+
background: url("filter.svg") center/18px no-repeat;
|
|
215
215
|
color: transparent;
|
|
216
216
|
cursor: pointer;
|
|
217
217
|
font-size: 0;
|
|
218
218
|
padding: 0;
|
|
219
219
|
touch-action: manipulation;
|
|
220
|
+
-webkit-tap-highlight-color: transparent;
|
|
220
221
|
-webkit-touch-callout: none;
|
|
221
222
|
width: 28px;
|
|
222
223
|
}
|
|
224
|
+
table.objects > thead > tr.properties > th > input.search-submit:hover, table.objects > thead > tr.properties > th > input.search-submit:focus, table.objects > thead > tr.properties > th > input.search-submit:active {
|
|
225
|
+
background-color: #e3e3e3;
|
|
226
|
+
}
|
|
227
|
+
table.objects > thead > tr.properties > th > input.search-submit:focus {
|
|
228
|
+
outline: none;
|
|
229
|
+
}
|
|
230
|
+
table.objects > thead > tr.properties > th > input.search-submit:focus-visible {
|
|
231
|
+
outline: 1px solid #808080;
|
|
232
|
+
outline-offset: -1px;
|
|
233
|
+
}
|
|
223
234
|
table.objects > thead > tr.properties > th > input[data-property-filter] {
|
|
224
235
|
border-left: 1px solid #d8d8d8;
|
|
225
236
|
margin-left: -0.6em;
|
|
@@ -240,58 +251,17 @@ table.objects > thead > tr.properties > th > input[data-property-filter][data-fi
|
|
|
240
251
|
table.objects > thead > tr.properties > th[data-sort] > input[data-property-filter] {
|
|
241
252
|
width: calc(100% + 1.2em + 16px);
|
|
242
253
|
}
|
|
243
|
-
table.objects > thead > tr.properties > th > input:focus {
|
|
254
|
+
table.objects > thead > tr.properties > th > input:focus:not(.search-submit) {
|
|
244
255
|
box-shadow: inset 0 0 0 2px Highlight, var(--column-reorder-tint, 0 0 transparent);
|
|
245
256
|
outline: none;
|
|
246
257
|
}
|
|
247
258
|
|
|
248
|
-
article[data-action=list] > form > .search-menu {
|
|
249
|
-
background: white;
|
|
250
|
-
border: 1px solid #ccc;
|
|
251
|
-
border-radius: 4px;
|
|
252
|
-
box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
|
|
253
|
-
color: #333;
|
|
254
|
-
inset: auto;
|
|
255
|
-
margin: 0;
|
|
256
|
-
max-height: calc(100dvh - 8px);
|
|
257
|
-
max-width: calc(100vw - 8px);
|
|
258
|
-
padding: 4px;
|
|
259
|
-
position: fixed;
|
|
260
|
-
}
|
|
261
|
-
article[data-action=list] > form > .search-menu > button {
|
|
262
|
-
align-items: center;
|
|
263
|
-
background: none;
|
|
264
|
-
border: 0;
|
|
265
|
-
border-radius: 2px;
|
|
266
|
-
color: inherit;
|
|
267
|
-
cursor: pointer;
|
|
268
|
-
display: flex;
|
|
269
|
-
font: inherit;
|
|
270
|
-
gap: 10px;
|
|
271
|
-
min-height: 44px;
|
|
272
|
-
padding: 8px 12px;
|
|
273
|
-
text-align: left;
|
|
274
|
-
width: 100%;
|
|
275
|
-
}
|
|
276
|
-
article[data-action=list] > form > .search-menu > button::before {
|
|
277
|
-
background: currentColor;
|
|
278
|
-
content: "";
|
|
279
|
-
flex: 0 0 24px;
|
|
280
|
-
height: 24px;
|
|
281
|
-
mask: url("search.svg") center/contain no-repeat;
|
|
282
|
-
}
|
|
283
|
-
article[data-action=list] > form > .search-menu > button.reset::before {
|
|
284
|
-
mask-image: url("filter-reset.svg");
|
|
285
|
-
}
|
|
286
|
-
article[data-action=list] > form > .search-menu > button:focus-visible, article[data-action=list] > form > .search-menu > button:hover {
|
|
287
|
-
background: #eee;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
259
|
main > article[data-action=list] > header > .list-toolbar {
|
|
260
|
+
--list-toolbar-gap: 5px;
|
|
291
261
|
align-items: center;
|
|
292
262
|
border-bottom: 1px solid #ccc;
|
|
293
263
|
display: grid;
|
|
294
|
-
gap:
|
|
264
|
+
gap: var(--list-toolbar-gap);
|
|
295
265
|
grid-template-areas: "actions filter count add";
|
|
296
266
|
grid-template-columns: auto minmax(0, 1fr) auto max-content;
|
|
297
267
|
}
|
|
@@ -300,6 +270,7 @@ main > article[data-action=list] > header > .list-toolbar:has(> .add-column[hidd
|
|
|
300
270
|
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
301
271
|
}
|
|
302
272
|
main > article[data-action=list] > header > .list-toolbar[data-filter-row] {
|
|
273
|
+
gap: 0;
|
|
303
274
|
grid-template-areas: "actions count count" "filter filter add";
|
|
304
275
|
grid-template-columns: minmax(0, 1fr) auto max-content;
|
|
305
276
|
}
|
|
@@ -307,10 +278,22 @@ main > article[data-action=list] > header > .list-toolbar[data-filter-row]:has(>
|
|
|
307
278
|
grid-template-areas: "actions count" "filter filter";
|
|
308
279
|
grid-template-columns: minmax(0, 1fr) auto;
|
|
309
280
|
}
|
|
281
|
+
main > article[data-action=list] > header > .list-toolbar[data-filter-row] > :is(.general.actions, .summary) {
|
|
282
|
+
align-self: stretch;
|
|
283
|
+
border-bottom: 1px solid #ccc;
|
|
284
|
+
}
|
|
310
285
|
main > article[data-action=list] > header > .list-toolbar[data-filter-row] > .general.actions {
|
|
311
286
|
flex-wrap: wrap;
|
|
312
287
|
overflow-x: auto;
|
|
313
288
|
}
|
|
289
|
+
main > article[data-action=list] > header > .list-toolbar[data-filter-row] > .list-filter {
|
|
290
|
+
align-self: stretch;
|
|
291
|
+
}
|
|
292
|
+
main > article[data-action=list] > header > .list-toolbar[data-filter-row] > .summary {
|
|
293
|
+
align-content: center;
|
|
294
|
+
justify-self: stretch;
|
|
295
|
+
text-align: end;
|
|
296
|
+
}
|
|
314
297
|
main > article[data-action=list] > header > .list-toolbar > .add-column {
|
|
315
298
|
align-self: stretch;
|
|
316
299
|
background: white;
|
|
@@ -342,6 +325,7 @@ main > article[data-action=list] > header > .list-toolbar > .general.actions > l
|
|
|
342
325
|
white-space: nowrap;
|
|
343
326
|
}
|
|
344
327
|
main > article[data-action=list] > header > .list-toolbar > .summary {
|
|
328
|
+
display: inline-block;
|
|
345
329
|
grid-area: count;
|
|
346
330
|
justify-self: end;
|
|
347
331
|
padding: 5px 10px;
|
|
@@ -356,16 +340,35 @@ main > article[data-action=list] > header > .list-toolbar > .summary {
|
|
|
356
340
|
min-width: 0;
|
|
357
341
|
}
|
|
358
342
|
.list-filter .list-filter-icon {
|
|
359
|
-
background: url("filter.svg") center/
|
|
360
|
-
|
|
361
|
-
|
|
343
|
+
background: url("filter.svg") center/18px no-repeat;
|
|
344
|
+
}
|
|
345
|
+
.list-filter span.list-filter-icon {
|
|
362
346
|
flex: none;
|
|
363
347
|
height: 18px;
|
|
364
|
-
padding: 0;
|
|
365
348
|
width: 18px;
|
|
366
349
|
}
|
|
367
|
-
.list-filter button.list-filter-icon {
|
|
350
|
+
.list-filter button.list-filter-icon, .list-filter > .list-filter-reset {
|
|
351
|
+
border: 0;
|
|
352
|
+
border-radius: 2px;
|
|
368
353
|
cursor: pointer;
|
|
354
|
+
flex: none;
|
|
355
|
+
height: 36px;
|
|
356
|
+
padding: 0;
|
|
357
|
+
touch-action: manipulation;
|
|
358
|
+
width: 32px;
|
|
359
|
+
}
|
|
360
|
+
.list-filter button.list-filter-icon:hover, .list-filter > .list-filter-reset:hover {
|
|
361
|
+
background-color: #eee;
|
|
362
|
+
}
|
|
363
|
+
.list-filter > .list-filter-reset {
|
|
364
|
+
background: transparent;
|
|
365
|
+
color: #666;
|
|
366
|
+
display: none;
|
|
367
|
+
font-size: 22px;
|
|
368
|
+
line-height: 1;
|
|
369
|
+
}
|
|
370
|
+
.list-filter:has(.list-filter-text:not([data-filled=false])) > .list-filter-reset {
|
|
371
|
+
display: block;
|
|
369
372
|
}
|
|
370
373
|
.list-filter .list-filter-text {
|
|
371
374
|
border-bottom: 1px dotted #888;
|
package/package.json
CHANGED
package/search-focus.js
CHANGED
|
@@ -12,9 +12,14 @@ build({
|
|
|
12
12
|
return;
|
|
13
13
|
bound.add(form);
|
|
14
14
|
let column;
|
|
15
|
+
form.querySelector('.search-submit')?.addEventListener('pointerdown', event => {
|
|
16
|
+
if (event.isPrimary && event.button === 0 && focusedColumn(form)) {
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
15
20
|
form.addEventListener('submit', event => {
|
|
16
21
|
const submitter = event.submitter;
|
|
17
|
-
column = (!submitter || submitter.matches('.search-submit
|
|
22
|
+
column = (!submitter || submitter.matches('.search-submit'))
|
|
18
23
|
? focusedColumn(form)?.name.slice('search.'.length)
|
|
19
24
|
: undefined;
|
|
20
25
|
}, { capture: true });
|
|
@@ -37,3 +42,12 @@ build({
|
|
|
37
42
|
priority: 2000,
|
|
38
43
|
selector: 'article[data-action="list"] > form'
|
|
39
44
|
});
|
|
45
|
+
build('.list-filter > .list-filter-reset', 'click', function () {
|
|
46
|
+
const form = this.closest('article[data-action="list"]')?.querySelector(':scope > form');
|
|
47
|
+
if (!form)
|
|
48
|
+
return;
|
|
49
|
+
const reset = form.querySelector('button[name="reset"]');
|
|
50
|
+
if (reset) {
|
|
51
|
+
form.requestSubmit(reset);
|
|
52
|
+
}
|
|
53
|
+
});
|
package/toolbar.js
CHANGED
|
@@ -7,24 +7,31 @@ function actionsWidth(actions) {
|
|
|
7
7
|
+ gapWidth(style, items.length)
|
|
8
8
|
+ items.reduce((width, item) => width + item.getBoundingClientRect().width, 0);
|
|
9
9
|
}
|
|
10
|
+
function contentWidth(element, style) {
|
|
11
|
+
const range = document.createRange();
|
|
12
|
+
range.selectNodeContents(element);
|
|
13
|
+
return range.getBoundingClientRect().width + inlineEdges(style);
|
|
14
|
+
}
|
|
10
15
|
function filterWidth(filter) {
|
|
11
16
|
const icon = filter.querySelector('.list-filter-icon');
|
|
12
|
-
|
|
17
|
+
const filterStyle = getComputedStyle(filter);
|
|
18
|
+
let width = inlineEdges(filterStyle);
|
|
13
19
|
if (!icon)
|
|
14
20
|
return width;
|
|
15
21
|
const text = filter.querySelector('.list-filter-text');
|
|
16
22
|
const row = icon.parentElement;
|
|
17
23
|
width += icon.getBoundingClientRect().width;
|
|
18
|
-
const rowStyle = getComputedStyle(row);
|
|
24
|
+
const rowStyle = row === filter ? filterStyle : getComputedStyle(row);
|
|
19
25
|
if (row !== filter) {
|
|
20
26
|
width += inlineEdges(rowStyle);
|
|
21
27
|
}
|
|
22
28
|
if (text) {
|
|
23
|
-
const range = document.createRange();
|
|
24
|
-
range.selectNodeContents(text);
|
|
25
29
|
const textStyle = getComputedStyle(text);
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
width += gapWidth(rowStyle, 2) + Math.max(contentWidth(text, textStyle), pixels(textStyle.minWidth));
|
|
31
|
+
}
|
|
32
|
+
const resetWidth = filter.querySelector('.list-filter-reset')?.getBoundingClientRect().width ?? 0;
|
|
33
|
+
if (resetWidth) {
|
|
34
|
+
width += gapWidth(filterStyle, 2) + resetWidth;
|
|
28
35
|
}
|
|
29
36
|
return width;
|
|
30
37
|
}
|
|
@@ -51,8 +58,9 @@ function watchToolbar(toolbar) {
|
|
|
51
58
|
frame = undefined;
|
|
52
59
|
const style = getComputedStyle(toolbar);
|
|
53
60
|
const available = toolbar.getBoundingClientRect().width - inlineEdges(style);
|
|
54
|
-
const
|
|
55
|
-
|
|
61
|
+
const gaps = (add.hidden ? 2 : 3) * pixels(style.getPropertyValue('--list-toolbar-gap'));
|
|
62
|
+
const required = actionsWidth(actions) + filterWidth(filter) + contentWidth(count, getComputedStyle(count))
|
|
63
|
+
+ add.getBoundingClientRect().width + gaps;
|
|
56
64
|
toolbar.toggleAttribute('data-filter-row', required > available);
|
|
57
65
|
}
|
|
58
66
|
function schedule() {
|
|
@@ -63,7 +71,9 @@ function watchToolbar(toolbar) {
|
|
|
63
71
|
resize.observe(element);
|
|
64
72
|
}
|
|
65
73
|
const mutations = new MutationObserver(schedule);
|
|
66
|
-
mutations.observe(toolbar, {
|
|
74
|
+
mutations.observe(toolbar, {
|
|
75
|
+
attributeFilter: ['data-filled', 'hidden'], characterData: true, childList: true, subtree: true
|
|
76
|
+
});
|
|
67
77
|
for (const event of ['focusin', 'focusout', 'input']) {
|
|
68
78
|
toolbar.addEventListener(event, schedule, { signal: abort.signal });
|
|
69
79
|
}
|
package/search-menu.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/search-menu.js
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { build } from '@itrocks/build/build.js';
|
|
2
|
-
import { focusedColumn } from './search-focus.js';
|
|
3
|
-
const bound = new WeakSet();
|
|
4
|
-
build('article[data-action="list"] > form', form => {
|
|
5
|
-
if (bound.has(form))
|
|
6
|
-
return;
|
|
7
|
-
const trigger = form.querySelector('.search-submit');
|
|
8
|
-
const menu = form.querySelector('.search-menu');
|
|
9
|
-
if (!trigger || !menu)
|
|
10
|
-
return;
|
|
11
|
-
bound.add(form);
|
|
12
|
-
const items = Array.from(menu.querySelectorAll('[role="menuitem"]'));
|
|
13
|
-
let listeners;
|
|
14
|
-
let pointer;
|
|
15
|
-
let suppressClick = false;
|
|
16
|
-
let timer;
|
|
17
|
-
const cancel = () => {
|
|
18
|
-
clearTimeout(timer);
|
|
19
|
-
pointer = undefined;
|
|
20
|
-
};
|
|
21
|
-
const dismiss = () => {
|
|
22
|
-
if (!menu.matches(':popover-open'))
|
|
23
|
-
return;
|
|
24
|
-
menu.hidePopover();
|
|
25
|
-
trigger.setAttribute('aria-expanded', 'false');
|
|
26
|
-
listeners?.abort();
|
|
27
|
-
};
|
|
28
|
-
const close = () => {
|
|
29
|
-
dismiss();
|
|
30
|
-
trigger.focus();
|
|
31
|
-
};
|
|
32
|
-
const open = () => {
|
|
33
|
-
cancel();
|
|
34
|
-
if (!trigger.isConnected || menu.matches(':popover-open'))
|
|
35
|
-
return;
|
|
36
|
-
// A manual popover stays open when the opening right-click or long press is released.
|
|
37
|
-
menu.showPopover();
|
|
38
|
-
const rect = trigger.getBoundingClientRect();
|
|
39
|
-
menu.style.left = `${Math.max(4, Math.min(rect.left, innerWidth - menu.offsetWidth - 4))}px`;
|
|
40
|
-
menu.style.top = `${Math.max(4, rect.bottom + menu.offsetHeight <= innerHeight - 4
|
|
41
|
-
? rect.bottom : rect.top - menu.offsetHeight)}px`;
|
|
42
|
-
trigger.setAttribute('aria-expanded', 'true');
|
|
43
|
-
items[0].focus();
|
|
44
|
-
listeners?.abort();
|
|
45
|
-
listeners = new AbortController();
|
|
46
|
-
const { signal } = listeners;
|
|
47
|
-
document.addEventListener('scroll', close, { capture: true, signal });
|
|
48
|
-
window.addEventListener('resize', close, { signal });
|
|
49
|
-
document.addEventListener('pointerdown', event => {
|
|
50
|
-
if ((event.target instanceof Node) && !menu.contains(event.target) && !trigger.contains(event.target))
|
|
51
|
-
dismiss();
|
|
52
|
-
}, { signal });
|
|
53
|
-
document.addEventListener('keydown', event => {
|
|
54
|
-
if ((event.key !== 'Escape') || event.defaultPrevented)
|
|
55
|
-
return;
|
|
56
|
-
event.preventDefault();
|
|
57
|
-
close();
|
|
58
|
-
}, { signal });
|
|
59
|
-
};
|
|
60
|
-
menu.addEventListener('toggle', () => {
|
|
61
|
-
if (menu.matches(':popover-open'))
|
|
62
|
-
return;
|
|
63
|
-
trigger.setAttribute('aria-expanded', 'false');
|
|
64
|
-
listeners?.abort();
|
|
65
|
-
});
|
|
66
|
-
menu.addEventListener('click', event => {
|
|
67
|
-
if ((event.target instanceof Element) && event.target.closest('button'))
|
|
68
|
-
dismiss();
|
|
69
|
-
});
|
|
70
|
-
menu.addEventListener('keydown', event => {
|
|
71
|
-
const index = items.indexOf(document.activeElement);
|
|
72
|
-
let next;
|
|
73
|
-
switch (event.key) {
|
|
74
|
-
case 'ArrowDown':
|
|
75
|
-
next = (index + 1) % items.length;
|
|
76
|
-
break;
|
|
77
|
-
case 'ArrowUp':
|
|
78
|
-
next = (index + items.length - 1) % items.length;
|
|
79
|
-
break;
|
|
80
|
-
case 'Home':
|
|
81
|
-
next = 0;
|
|
82
|
-
break;
|
|
83
|
-
case 'End':
|
|
84
|
-
next = items.length - 1;
|
|
85
|
-
break;
|
|
86
|
-
case 'Escape':
|
|
87
|
-
event.preventDefault();
|
|
88
|
-
close();
|
|
89
|
-
return;
|
|
90
|
-
case 'Tab':
|
|
91
|
-
close();
|
|
92
|
-
return;
|
|
93
|
-
default: return;
|
|
94
|
-
}
|
|
95
|
-
event.preventDefault();
|
|
96
|
-
items[next].focus();
|
|
97
|
-
});
|
|
98
|
-
trigger.addEventListener('contextmenu', event => {
|
|
99
|
-
event.preventDefault();
|
|
100
|
-
suppressClick = true;
|
|
101
|
-
open();
|
|
102
|
-
});
|
|
103
|
-
trigger.addEventListener('keydown', event => {
|
|
104
|
-
if ((event.key !== 'ArrowDown') && (event.key !== 'ContextMenu')
|
|
105
|
-
&& !((event.key === 'F10') && event.shiftKey))
|
|
106
|
-
return;
|
|
107
|
-
event.preventDefault();
|
|
108
|
-
open();
|
|
109
|
-
});
|
|
110
|
-
trigger.addEventListener('pointerdown', event => {
|
|
111
|
-
cancel();
|
|
112
|
-
suppressClick = false;
|
|
113
|
-
if (!event.isPrimary || (event.button !== 0))
|
|
114
|
-
return;
|
|
115
|
-
if (focusedColumn(form)) {
|
|
116
|
-
event.preventDefault();
|
|
117
|
-
}
|
|
118
|
-
pointer = { id: event.pointerId, x: event.clientX, y: event.clientY };
|
|
119
|
-
trigger.setPointerCapture(event.pointerId);
|
|
120
|
-
timer = setTimeout(() => {
|
|
121
|
-
suppressClick = true;
|
|
122
|
-
open();
|
|
123
|
-
}, 500);
|
|
124
|
-
});
|
|
125
|
-
trigger.addEventListener('pointermove', event => {
|
|
126
|
-
if (pointer && (pointer.id === event.pointerId)
|
|
127
|
-
&& (Math.hypot(event.clientX - pointer.x, event.clientY - pointer.y) > 10)) {
|
|
128
|
-
suppressClick = true;
|
|
129
|
-
cancel();
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
for (const type of ['pointercancel', 'pointerup', 'lostpointercapture'])
|
|
133
|
-
trigger.addEventListener(type, cancel);
|
|
134
|
-
trigger.addEventListener('click', event => {
|
|
135
|
-
if (!suppressClick || (event.detail === 0))
|
|
136
|
-
return;
|
|
137
|
-
event.preventDefault();
|
|
138
|
-
event.stopImmediatePropagation();
|
|
139
|
-
}, { capture: true });
|
|
140
|
-
});
|