bromcom-ui 3.0.0-alpha.4 → 3.0.0-alpha.5
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/bromcom-ui/bromcom-ui.css +1 -1
- package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
- package/dist/bromcom-ui/p-01eaca9a.entry.js +5 -0
- package/dist/bromcom-ui/p-3ddd3c83.entry.js +5 -0
- package/dist/bromcom-ui/p-aa67918a.entry.js +5 -0
- package/dist/bromcom-ui/p-d5464577.entry.js +16 -0
- package/dist/cjs/bcm-accordion_69.cjs.entry.js +704 -31
- package/dist/cjs/bcm-file-upload.cjs.entry.js +578 -0
- package/dist/cjs/bcm-form-2.cjs.entry.js +1 -0
- package/dist/cjs/bcm-number-input.cjs.entry.js +8 -2
- package/dist/cjs/bromcom-ui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/atoms/button/button.js +1 -1
- package/dist/collection/components/atoms/button/types.js +7 -0
- package/dist/collection/components/molecules/dropdown/dropdown.js +36 -1
- package/dist/collection/components/molecules/linked/linked-focus-manager.js +86 -0
- package/dist/collection/components/molecules/linked/linked.js +43 -1
- package/dist/collection/components/molecules/number-input/number-input.js +8 -2
- package/dist/collection/components/molecules/number-input/react-input.js +1 -1
- package/dist/collection/components/molecules/upload/file-upload.component.js +1060 -0
- package/dist/collection/components/molecules/upload/file-upload.style.js +201 -0
- package/dist/collection/components/organism/form/form.js +1 -0
- package/dist/collection/components/organism/form-2/bcm-form-components.js +1 -0
- package/dist/collection/components/organism/list/list-focus-manager.js +344 -0
- package/dist/collection/components/organism/list/list-key-control.js +9 -4
- package/dist/collection/components/organism/list/list.css +8 -3
- package/dist/collection/components/organism/list/list.js +226 -26
- package/dist/collection/components/other_deprecated/old-tag/old-tag.js +1 -1
- package/dist/collection/components/other_deprecated/tag/tag.js +1 -1
- package/dist/collection/templates/list-item-template.js +2 -1
- package/dist/components/bcm-dropdown.js +35 -0
- package/dist/components/bcm-file-upload.d.ts +11 -0
- package/dist/components/bcm-file-upload.js +625 -0
- package/dist/components/bcm-form-2.js +1 -0
- package/dist/components/bcm-number-input.js +8 -2
- package/dist/components/button.js +7 -0
- package/dist/components/form.js +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/linked.js +105 -2
- package/dist/components/list.js +559 -31
- package/dist/esm/bcm-accordion_69.entry.js +704 -31
- package/dist/esm/bcm-file-upload.entry.js +574 -0
- package/dist/esm/bcm-form-2.entry.js +1 -0
- package/dist/esm/bcm-number-input.entry.js +8 -2
- package/dist/esm/bromcom-ui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/atoms/button/types.d.ts +8 -1
- package/dist/types/components/molecules/dropdown/dropdown.d.ts +7 -0
- package/dist/types/components/molecules/linked/linked-focus-manager.d.ts +13 -0
- package/dist/types/components/molecules/linked/linked.d.ts +3 -0
- package/dist/types/components/molecules/number-input/number-input.d.ts +1 -0
- package/dist/types/components/molecules/upload/file-upload.component.d.ts +233 -0
- package/dist/types/components/molecules/upload/file-upload.style.d.ts +548 -0
- package/dist/types/components/organism/list/list-focus-manager.d.ts +53 -0
- package/dist/types/components/organism/list/list-key-control.d.ts +1 -0
- package/dist/types/components/organism/list/list.d.ts +18 -1
- package/dist/types/components.d.ts +417 -1
- package/package.json +1 -1
- package/dist/bromcom-ui/p-8e7274e4.entry.js +0 -5
- package/dist/bromcom-ui/p-9e0dd503.entry.js +0 -16
- package/dist/bromcom-ui/p-a320cde8.entry.js +0 -5
|
@@ -21,11 +21,22 @@ import { Host, h } from "@stencil/core";
|
|
|
21
21
|
import cs from "classnames";
|
|
22
22
|
import snq from "snq";
|
|
23
23
|
import listState from "../states/bcm-list2.states";
|
|
24
|
+
import { ListFocusManager } from "./list-focus-manager";
|
|
24
25
|
import { ListKeyControl } from "./list-key-control";
|
|
25
26
|
export class BcmList {
|
|
26
27
|
constructor() {
|
|
28
|
+
var _a, _b;
|
|
27
29
|
this.debounce = null;
|
|
30
|
+
this.focusManager = new ListFocusManager();
|
|
31
|
+
this.openTriggerElement = null;
|
|
32
|
+
this.suppressScrollCloseUntil = 0;
|
|
28
33
|
this.debounceHandler = Generate.debounceInput(() => this.listenResize(), 300, false);
|
|
34
|
+
this.handleVisualViewportChange = () => {
|
|
35
|
+
if (!this.isOpen)
|
|
36
|
+
return;
|
|
37
|
+
this.preventScrollClose(400);
|
|
38
|
+
this.calculateLocation();
|
|
39
|
+
};
|
|
29
40
|
this._id = Generate.UID();
|
|
30
41
|
this.tempId = Generate.UID();
|
|
31
42
|
this.type = Bcm.ListType.listbox;
|
|
@@ -107,6 +118,8 @@ export class BcmList {
|
|
|
107
118
|
window.addEventListener("scroll", this.handleWheel.bind(this), true);
|
|
108
119
|
window.addEventListener("wheel", this.handleWheel.bind(this), true);
|
|
109
120
|
window.addEventListener("resize", this.handleResize.bind(this), true);
|
|
121
|
+
(_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.addEventListener("resize", this.handleVisualViewportChange, true);
|
|
122
|
+
(_b = window.visualViewport) === null || _b === void 0 ? void 0 : _b.addEventListener("scroll", this.handleVisualViewportChange, true);
|
|
110
123
|
}
|
|
111
124
|
connectedCallback() {
|
|
112
125
|
if (this.height != "256px") {
|
|
@@ -157,7 +170,10 @@ export class BcmList {
|
|
|
157
170
|
// }
|
|
158
171
|
}
|
|
159
172
|
disconnectedCallback() {
|
|
173
|
+
var _a, _b;
|
|
160
174
|
this.isOpen = false;
|
|
175
|
+
(_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.removeEventListener("resize", this.handleVisualViewportChange, true);
|
|
176
|
+
(_b = window.visualViewport) === null || _b === void 0 ? void 0 : _b.removeEventListener("scroll", this.handleVisualViewportChange, true);
|
|
161
177
|
if (this.stopDeepClean)
|
|
162
178
|
return;
|
|
163
179
|
listState.removeState(this._id);
|
|
@@ -216,8 +232,10 @@ export class BcmList {
|
|
|
216
232
|
}
|
|
217
233
|
async handleOpen() {
|
|
218
234
|
const isAutoSelected = this.autoFocusSelected && this.type == "select" && !this.checkboxes && this.value;
|
|
235
|
+
const isMobile = this.isMobileViewport();
|
|
219
236
|
if (this.isOpen) {
|
|
220
237
|
this.detectClone();
|
|
238
|
+
await this.prepareMobileViewportForOpen();
|
|
221
239
|
if (this.type == "select" || this.type == "autocomplete" || this.linkedComponent) {
|
|
222
240
|
const list = this.el.querySelector(`#bcm-list-${this._id}`);
|
|
223
241
|
if (list) {
|
|
@@ -228,7 +246,9 @@ export class BcmList {
|
|
|
228
246
|
this.open.emit();
|
|
229
247
|
this.calculateLocation();
|
|
230
248
|
this.onSelectSearch();
|
|
231
|
-
|
|
249
|
+
if (!isMobile) {
|
|
250
|
+
await delay(50);
|
|
251
|
+
}
|
|
232
252
|
this.isOpenAnimation = true;
|
|
233
253
|
if (isAutoSelected) {
|
|
234
254
|
this.focusSelectedElement();
|
|
@@ -286,11 +306,41 @@ export class BcmList {
|
|
|
286
306
|
this.calculateLocation();
|
|
287
307
|
}
|
|
288
308
|
}
|
|
309
|
+
else if (this.shouldKeepOpenWhileInteracting(list)) {
|
|
310
|
+
if (this.type == "select" || this.type == "autocomplete" || this.linkedComponent) {
|
|
311
|
+
this.calculateLocation();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
289
314
|
else {
|
|
290
315
|
this.hide();
|
|
291
316
|
}
|
|
292
317
|
}
|
|
293
318
|
}
|
|
319
|
+
handleTouchStart(event) {
|
|
320
|
+
if (!this.isOpen)
|
|
321
|
+
return;
|
|
322
|
+
const list = document.querySelector(`#bcm-list-${this._id}`);
|
|
323
|
+
const isInside = Generate.findEventPath(event, this.el) || (list && Generate.findEventPath(event, list));
|
|
324
|
+
if (isInside) {
|
|
325
|
+
this.preventScrollClose(1000);
|
|
326
|
+
}
|
|
327
|
+
else if (this.type == "select" || this.type == "autocomplete" || this.linkedComponent) {
|
|
328
|
+
this.isOpen = false;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
handleFocusIn(event) {
|
|
332
|
+
if (!this.isOpen)
|
|
333
|
+
return;
|
|
334
|
+
const list = document.querySelector(`#bcm-list-${this._id}`);
|
|
335
|
+
const isInside = Generate.findEventPath(event, this.el) || (list && Generate.findEventPath(event, list));
|
|
336
|
+
if (isInside) {
|
|
337
|
+
this.preventScrollClose(1000);
|
|
338
|
+
this.calculateLocation();
|
|
339
|
+
}
|
|
340
|
+
else if (this.isOverlayType()) {
|
|
341
|
+
this.isOpen = false;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
294
344
|
clearAutocomplete() {
|
|
295
345
|
if (this.type == "autocomplete") {
|
|
296
346
|
const autocompleteInput = this.getAutoCompleteInput();
|
|
@@ -386,8 +436,8 @@ export class BcmList {
|
|
|
386
436
|
var _a, _b, _c, _d, _e, _f;
|
|
387
437
|
if (((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.id) === `bcm-list-${this._id}-search` || ((_b = event === null || event === void 0 ? void 0 : event.target) === null || _b === void 0 ? void 0 : _b.id) === `bcm-list-input-tag-container-${this._id}-autocomplete-input`) {
|
|
388
438
|
this.searchGetParents = snq(() => { var _a; return (_a = event.detail) === null || _a === void 0 ? void 0 : _a.parentIndex; }, null);
|
|
389
|
-
this.searchResultLimit = 10;
|
|
390
439
|
this.searchFound = ((_c = event.detail) === null || _c === void 0 ? void 0 : _c.matching) != null ? (_d = event.detail) === null || _d === void 0 ? void 0 : _d.matching.length : null;
|
|
440
|
+
this.searchResultLimit = this.getInitialSearchResultLimit();
|
|
391
441
|
this.returnFilterData = listState.filterData(this._id, (_e = event.detail) === null || _e === void 0 ? void 0 : _e.nestedResult);
|
|
392
442
|
if (this.searchFound > 0 && this.highlight) {
|
|
393
443
|
this.highlightText = (_f = event.detail) === null || _f === void 0 ? void 0 : _f.value;
|
|
@@ -413,13 +463,51 @@ export class BcmList {
|
|
|
413
463
|
//keyboard navigation
|
|
414
464
|
handleKeyDown(ev) {
|
|
415
465
|
const keycode = ev.keyCode || ev.which;
|
|
416
|
-
|
|
417
|
-
|
|
466
|
+
const handled = this.focusManager.handleKeyDown({
|
|
467
|
+
event: ev,
|
|
468
|
+
disabled: this.disabled,
|
|
469
|
+
isOpen: this.isOpen,
|
|
470
|
+
isOverlayType: this.isOverlayType(),
|
|
471
|
+
hostElement: this.el,
|
|
472
|
+
targetElement: this.getTargetElement(),
|
|
473
|
+
listElement: document.getElementById(`bcm-list-${this._id}`),
|
|
474
|
+
openList: () => {
|
|
475
|
+
this.rememberOpenTrigger();
|
|
476
|
+
this.isOpen = true;
|
|
477
|
+
},
|
|
478
|
+
closeList: () => {
|
|
418
479
|
this.isOpen = false;
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
480
|
+
},
|
|
481
|
+
selectFocusedItem: (itemId) => {
|
|
482
|
+
if (this.checkboxes) {
|
|
483
|
+
this.checkedItem(itemId);
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
this.selectedItem(itemId);
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
openGroup: (itemId) => {
|
|
490
|
+
this.openGroup(itemId);
|
|
491
|
+
},
|
|
492
|
+
treeview: this.treeview,
|
|
493
|
+
checkboxes: this.checkboxes,
|
|
494
|
+
autocompleteInput: this.type == "autocomplete" ? this.getAutoCompleteInput() : null,
|
|
495
|
+
openTriggerElement: this.openTriggerElement,
|
|
496
|
+
});
|
|
497
|
+
if (handled)
|
|
498
|
+
return;
|
|
499
|
+
if ((ev.key === "Escape" || keycode === Bcm.KeyCode.escape) && this.isOpen) {
|
|
500
|
+
this.isOpen = false;
|
|
501
|
+
ev.preventDefault();
|
|
502
|
+
ev.stopPropagation();
|
|
503
|
+
ev.stopImmediatePropagation();
|
|
504
|
+
this.focusManager.restoreTriggerFocus({
|
|
505
|
+
hostElement: this.el,
|
|
506
|
+
targetElement: this.getTargetElement(),
|
|
507
|
+
autocompleteInput: this.type == "autocomplete" ? this.getAutoCompleteInput() : null,
|
|
508
|
+
openTriggerElement: this.openTriggerElement,
|
|
509
|
+
preferOpenTrigger: true,
|
|
510
|
+
});
|
|
423
511
|
}
|
|
424
512
|
if (this.keyControl) {
|
|
425
513
|
const keyboard = new ListKeyControl(keycode, this.el, this.treeview, this.checkboxes);
|
|
@@ -429,6 +517,9 @@ export class BcmList {
|
|
|
429
517
|
keyboard.checkedItem = checkedItemId => {
|
|
430
518
|
this.checkedItem(checkedItemId);
|
|
431
519
|
};
|
|
520
|
+
keyboard.selectedItem = itemId => {
|
|
521
|
+
this.selectedItem(itemId);
|
|
522
|
+
};
|
|
432
523
|
keyboard.keyDown();
|
|
433
524
|
}
|
|
434
525
|
}
|
|
@@ -538,7 +629,8 @@ export class BcmList {
|
|
|
538
629
|
});
|
|
539
630
|
}
|
|
540
631
|
}
|
|
541
|
-
async show() {
|
|
632
|
+
async show(openTriggerElement) {
|
|
633
|
+
this.rememberOpenTrigger(openTriggerElement);
|
|
542
634
|
this.isOpen = true;
|
|
543
635
|
return Promise.resolve();
|
|
544
636
|
}
|
|
@@ -575,11 +667,50 @@ export class BcmList {
|
|
|
575
667
|
async onSelectSearch() {
|
|
576
668
|
const searchInput = document.getElementById(`bcm-list-${this._id}-search`);
|
|
577
669
|
if (searchInput) {
|
|
670
|
+
this.preventScrollClose(1000);
|
|
578
671
|
await delay(100);
|
|
579
672
|
searchInput.onBcmFocus();
|
|
580
673
|
searchInput.onBcmSelect();
|
|
581
674
|
}
|
|
582
675
|
}
|
|
676
|
+
preventScrollClose(duration = 500) {
|
|
677
|
+
this.suppressScrollCloseUntil = Date.now() + duration;
|
|
678
|
+
}
|
|
679
|
+
isMobileViewport() {
|
|
680
|
+
return window.matchMedia("(max-width: 768px), (pointer: coarse)").matches;
|
|
681
|
+
}
|
|
682
|
+
async prepareMobileViewportForOpen() {
|
|
683
|
+
var _a;
|
|
684
|
+
if (!this.isMobileViewport() || !(this.type == "select" || this.type == "autocomplete" || this.linkedComponent)) {
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
const targetElementId = this.linkedComponent ? this.linkedComponent : `bcm-list-input-${this._id}`;
|
|
688
|
+
const targetElement = document.getElementById(targetElementId);
|
|
689
|
+
if (!targetElement)
|
|
690
|
+
return;
|
|
691
|
+
const viewportHeight = ((_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height) || window.innerHeight;
|
|
692
|
+
const rect = targetElement.getBoundingClientRect();
|
|
693
|
+
const minimumSpaceBelow = Math.min(320, viewportHeight * 0.45);
|
|
694
|
+
const shouldReposition = rect.top > viewportHeight * 0.35 || viewportHeight - rect.bottom < minimumSpaceBelow;
|
|
695
|
+
if (shouldReposition) {
|
|
696
|
+
this.preventScrollClose(1200);
|
|
697
|
+
const desiredTop = Math.max(110, Math.min(180, viewportHeight * 0.24));
|
|
698
|
+
const delta = rect.top - desiredTop;
|
|
699
|
+
window.scrollBy({
|
|
700
|
+
top: delta,
|
|
701
|
+
left: 0,
|
|
702
|
+
behavior: "auto",
|
|
703
|
+
});
|
|
704
|
+
await delay(50);
|
|
705
|
+
this.calculateLocation();
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
shouldKeepOpenWhileInteracting(list) {
|
|
709
|
+
var _a;
|
|
710
|
+
const activeElement = document.activeElement;
|
|
711
|
+
const focusedInside = !!(activeElement && (((_a = this.el) === null || _a === void 0 ? void 0 : _a.contains(activeElement)) || (list === null || list === void 0 ? void 0 : list.contains(activeElement))));
|
|
712
|
+
return focusedInside || Date.now() < this.suppressScrollCloseUntil;
|
|
713
|
+
}
|
|
583
714
|
async filterOtherList(ids) {
|
|
584
715
|
const checklist = (await this.getCheckedList()).nestedResult;
|
|
585
716
|
const filter = Generate.convertIdsToNestedData(ids, checklist);
|
|
@@ -642,8 +773,30 @@ export class BcmList {
|
|
|
642
773
|
}
|
|
643
774
|
return snq(() => listState.getData(this._id), []);
|
|
644
775
|
}
|
|
776
|
+
hasNestedItems(items = []) {
|
|
777
|
+
return items.some((item) => { var _a; return (item === null || item === void 0 ? void 0 : item.type) === "group" || ((_a = item === null || item === void 0 ? void 0 : item.items) === null || _a === void 0 ? void 0 : _a.length) > 0; });
|
|
778
|
+
}
|
|
779
|
+
getVisibleSearchItems() {
|
|
780
|
+
const visibledItems = this.returnFilterData["visibledItems"];
|
|
781
|
+
if (this.searchFound == null || !Array.isArray(visibledItems)) {
|
|
782
|
+
return null;
|
|
783
|
+
}
|
|
784
|
+
return visibledItems;
|
|
785
|
+
}
|
|
786
|
+
getInitialSearchResultLimit() {
|
|
787
|
+
if (this.searchFound === 0) {
|
|
788
|
+
return 0;
|
|
789
|
+
}
|
|
790
|
+
const initialLimit = Math.max(10, this.limit);
|
|
791
|
+
return this.searchFound == null ? initialLimit : Math.min(initialLimit, this.searchFound);
|
|
792
|
+
}
|
|
645
793
|
getLimitedItems(ids) {
|
|
646
|
-
|
|
794
|
+
const visibleSearchItems = this.getVisibleSearchItems();
|
|
795
|
+
const limit = this.searchResultLimit || this.limit;
|
|
796
|
+
if (visibleSearchItems && !this.hasNestedItems(this.getItems())) {
|
|
797
|
+
return visibleSearchItems.slice(0, limit);
|
|
798
|
+
}
|
|
799
|
+
return snq(() => listState.getDataPagination(this._id, limit, ids), []);
|
|
647
800
|
}
|
|
648
801
|
openGroup(parentId) {
|
|
649
802
|
listState.openGroup(this._id, parentId);
|
|
@@ -671,7 +824,15 @@ export class BcmList {
|
|
|
671
824
|
this.value = listState.selectedItem(this._id, itemId) ? listState.selectedItem(this._id, itemId)[0] : null;
|
|
672
825
|
this.inputText = Generate.domParser((_a = this.value) === null || _a === void 0 ? void 0 : _a.text) || null;
|
|
673
826
|
this.isOpen = false;
|
|
674
|
-
this.markForCheck();
|
|
827
|
+
await this.markForCheck();
|
|
828
|
+
if (this.isOverlayType()) {
|
|
829
|
+
await delay(10);
|
|
830
|
+
this.focusManager.restoreTriggerFocus({
|
|
831
|
+
hostElement: this.el,
|
|
832
|
+
targetElement: this.getTargetElement(),
|
|
833
|
+
autocompleteInput: this.type == "autocomplete" ? this.getAutoCompleteInput() : null,
|
|
834
|
+
});
|
|
835
|
+
}
|
|
675
836
|
if (this.type == "autocomplete" && this.value) {
|
|
676
837
|
// await delay(100)
|
|
677
838
|
// this.resetCaption()
|
|
@@ -709,15 +870,36 @@ export class BcmList {
|
|
|
709
870
|
getAutoCompleteInput() {
|
|
710
871
|
return document.getElementById(`bcm-list-input-tag-container-${this._id}-autocomplete-input`);
|
|
711
872
|
}
|
|
873
|
+
rememberOpenTrigger(openTriggerElement) {
|
|
874
|
+
const activeElement = openTriggerElement || document.activeElement;
|
|
875
|
+
this.openTriggerElement = this.isValidOpenTrigger(activeElement) ? activeElement : null;
|
|
876
|
+
}
|
|
877
|
+
isValidOpenTrigger(element) {
|
|
878
|
+
return !!(element && element.isConnected && element !== document.body && element !== document.documentElement);
|
|
879
|
+
}
|
|
880
|
+
isOverlayType() {
|
|
881
|
+
return this.type == "select" || this.type == "autocomplete" || !!this.linkedComponent;
|
|
882
|
+
}
|
|
883
|
+
getTargetElement() {
|
|
884
|
+
const targetElementId = this.linkedComponent ? this.linkedComponent : `bcm-list-input-${this._id}`;
|
|
885
|
+
return document.getElementById(targetElementId);
|
|
886
|
+
}
|
|
712
887
|
/** @description Fixes the issue where the list appears empty during fast scrolling. */
|
|
713
888
|
dataScrollEvent(event) {
|
|
714
889
|
var _a, _b;
|
|
715
890
|
const itemHeight = this.size === 'small' ? 28 : this.size === 'large' ? 48 : 36;
|
|
716
891
|
const currentScrollBottom = ((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.scrollTop) + ((_b = event === null || event === void 0 ? void 0 : event.target) === null || _b === void 0 ? void 0 : _b.clientHeight);
|
|
717
892
|
const requiredItems = Math.ceil(currentScrollBottom / itemHeight) + 20;
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
893
|
+
const isSearchActive = this.searchFound != null && !this.isSelectedOther;
|
|
894
|
+
const currentLimit = isSearchActive ? this.searchResultLimit || 0 : this.limit;
|
|
895
|
+
if (requiredItems > currentLimit) {
|
|
896
|
+
if (isSearchActive) {
|
|
897
|
+
this.searchResultLimit = Math.min(requiredItems, this.searchFound);
|
|
898
|
+
}
|
|
899
|
+
else {
|
|
900
|
+
this.limit = requiredItems;
|
|
901
|
+
this.searchResultLimit = requiredItems;
|
|
902
|
+
}
|
|
721
903
|
}
|
|
722
904
|
}
|
|
723
905
|
async calculateLocation() {
|
|
@@ -790,20 +972,20 @@ export class BcmList {
|
|
|
790
972
|
}
|
|
791
973
|
/** @description Focus selected element * BUG 282262 */
|
|
792
974
|
focusSelectedElement() {
|
|
793
|
-
var _a;
|
|
975
|
+
var _a, _b;
|
|
794
976
|
const listElement = document.querySelector(`#bcm-list-${this._id}`);
|
|
795
977
|
if (!listElement)
|
|
796
978
|
return;
|
|
797
|
-
const selectedId = (_a = this.value) === null || _a === void 0 ? void 0 : _a.id;
|
|
979
|
+
const selectedId = Array.isArray(this.value) ? (_a = this.value[0]) === null || _a === void 0 ? void 0 : _a.id : (_b = this.value) === null || _b === void 0 ? void 0 : _b.id;
|
|
798
980
|
if (selectedId) {
|
|
799
|
-
const targetItem = listElement.querySelector(`[id*="${selectedId}"]`);
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
targetItem.focus();
|
|
981
|
+
const targetItem = (listElement.querySelector(`[id="${selectedId}"]`) || listElement.querySelector(`[id*="${selectedId}"]`));
|
|
982
|
+
const scrollContainer = listElement.querySelector(".scrolling");
|
|
983
|
+
if (targetItem && scrollContainer) {
|
|
984
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
985
|
+
const itemRect = targetItem.getBoundingClientRect();
|
|
986
|
+
const relativeOffsetTop = itemRect.top - containerRect.top + scrollContainer.scrollTop;
|
|
987
|
+
scrollContainer.scrollTop = relativeOffsetTop - (containerRect.height / 2) + (itemRect.height / 2);
|
|
988
|
+
targetItem.focus({ preventScroll: true });
|
|
807
989
|
const items = listElement.querySelectorAll(".bcm-list__item");
|
|
808
990
|
items.forEach(i => i.classList.remove("focused"));
|
|
809
991
|
targetItem.classList.add("focused");
|
|
@@ -2015,11 +2197,17 @@ export class BcmList {
|
|
|
2015
2197
|
},
|
|
2016
2198
|
"show": {
|
|
2017
2199
|
"complexType": {
|
|
2018
|
-
"signature": "() => Promise<void>",
|
|
2019
|
-
"parameters": [
|
|
2200
|
+
"signature": "(openTriggerElement?: HTMLElement) => Promise<void>",
|
|
2201
|
+
"parameters": [{
|
|
2202
|
+
"tags": [],
|
|
2203
|
+
"text": ""
|
|
2204
|
+
}],
|
|
2020
2205
|
"references": {
|
|
2021
2206
|
"Promise": {
|
|
2022
2207
|
"location": "global"
|
|
2208
|
+
},
|
|
2209
|
+
"HTMLElement": {
|
|
2210
|
+
"location": "global"
|
|
2023
2211
|
}
|
|
2024
2212
|
},
|
|
2025
2213
|
"return": "Promise<void>"
|
|
@@ -2085,6 +2273,18 @@ export class BcmList {
|
|
|
2085
2273
|
"target": undefined,
|
|
2086
2274
|
"capture": false,
|
|
2087
2275
|
"passive": false
|
|
2276
|
+
}, {
|
|
2277
|
+
"name": "touchstart",
|
|
2278
|
+
"method": "handleTouchStart",
|
|
2279
|
+
"target": "window",
|
|
2280
|
+
"capture": true,
|
|
2281
|
+
"passive": true
|
|
2282
|
+
}, {
|
|
2283
|
+
"name": "focusin",
|
|
2284
|
+
"method": "handleFocusIn",
|
|
2285
|
+
"target": "window",
|
|
2286
|
+
"capture": true,
|
|
2287
|
+
"passive": false
|
|
2088
2288
|
}, {
|
|
2089
2289
|
"name": "bcm-select-other-tag",
|
|
2090
2290
|
"method": "handleSelectOtherTag",
|
|
@@ -140,7 +140,7 @@ export class BcmOldTag {
|
|
|
140
140
|
"mutable": true,
|
|
141
141
|
"complexType": {
|
|
142
142
|
"original": "ColorPaletteTypes",
|
|
143
|
-
"resolved": "\"red\" | \"default\" | \"black\" | \"white\" | \"prime-blue\" | \"prime-blue-1\" | \"prime-blue-2\" | \"prime-blue-3\" | \"prime-blue-5\" | \"prime-blue-6\" | \"prime-blue-7\" | \"prime-blue-8\" | \"prime-blue-9\" | \"prime-blue-10\" | \"grey\" | \"grey-1\" | \"grey-2\" | \"grey-3\" | \"grey-4\" | \"grey-5\" | \"grey-6\" | \"grey-7\" | \"grey-8\" | \"grey-9\" | \"grey-10\" | \"blue
|
|
143
|
+
"resolved": "\"red\" | \"blue\" | \"default\" | \"black\" | \"white\" | \"prime-blue\" | \"prime-blue-1\" | \"prime-blue-2\" | \"prime-blue-3\" | \"prime-blue-5\" | \"prime-blue-6\" | \"prime-blue-7\" | \"prime-blue-8\" | \"prime-blue-9\" | \"prime-blue-10\" | \"grey\" | \"grey-1\" | \"grey-2\" | \"grey-3\" | \"grey-4\" | \"grey-5\" | \"grey-6\" | \"grey-7\" | \"grey-8\" | \"grey-9\" | \"grey-10\" | \"blue-1\" | \"blue-2\" | \"blue-3\" | \"blue-4\" | \"blue-5\" | \"blue-6\" | \"blue-7\" | \"blue-8\" | \"blue-9\" | \"blue-10\" | \"warmyellow\" | \"warmyellow-1\" | \"warmyellow-2\" | \"warmyellow-3\" | \"warmyellow-4\" | \"warmyellow-5\" | \"warmyellow-6\" | \"warmyellow-7\" | \"warmyellow-8\" | \"warmyellow-9\" | \"warmyellow-10\" | \"yellow\" | \"yellow-1\" | \"yellow-2\" | \"yellow-3\" | \"yellow-4\" | \"yellow-5\" | \"yellow-6\" | \"yellow-7\" | \"yellow-8\" | \"yellow-9\" | \"yellow-10\" | \"limegreen\" | \"limegreen-1\" | \"limegreen-2\" | \"limegreen-3\" | \"limegreen-4\" | \"limegreen-5\" | \"limegreen-6\" | \"limegreen-7\" | \"limegreen-8\" | \"limegreen-9\" | \"limegreen-10\" | \"red-1\" | \"red-2\" | \"red-3\" | \"red-4\" | \"red-5\" | \"red-6\" | \"red-7\" | \"red-8\" | \"red-9\" | \"red-10\" | \"darkorange\" | \"darkorange-1\" | \"darkorange-2\" | \"darkorange-3\" | \"darkorange-4\" | \"darkorange-5\" | \"darkorange-6\" | \"darkorange-7\" | \"darkorange-8\" | \"darkorange-9\" | \"darkorange-10\" | \"orange\" | \"orange-1\" | \"orange-2\" | \"orange-3\" | \"orange-4\" | \"orange-5\" | \"orange-6\" | \"orange-7\" | \"orange-8\" | \"orange-9\" | \"orange-10\" | \"green\" | \"green-1\" | \"green-2\" | \"green-3\" | \"green-4\" | \"green-5\" | \"green-6\" | \"green-7\" | \"green-8\" | \"green-9\" | \"green-10\" | \"turquosie\" | \"turquosie-1\" | \"turquosie-2\" | \"turquosie-3\" | \"turquosie-4\" | \"turquosie-5\" | \"turquosie-6\" | \"turquosie-7\" | \"turquosie-8\" | \"turquosie-9\" | \"turquosie-10\" | \"cobaltblue\" | \"cobaltblue-1\" | \"cobaltblue-2\" | \"cobaltblue-3\" | \"cobaltblue-4\" | \"cobaltblue-5\" | \"cobaltblue-6\" | \"cobaltblue-7\" | \"cobaltblue-8\" | \"cobaltblue-9\" | \"cobaltblue-10\" | \"magenta\" | \"magenta-1\" | \"magenta-2\" | \"magenta-3\" | \"magenta-4\" | \"magenta-5\" | \"magenta-6\" | \"magenta-7\" | \"magenta-8\" | \"magenta-9\" | \"magenta-10\" | \"purple\" | \"purple-1\" | \"purple-2\" | \"purple-3\" | \"purple-4\" | \"purple-5\" | \"purple-6\" | \"purple-7\" | \"purple-8\" | \"purple-9\" | \"purple-10\" | \"bc-red\" | \"bc-red-1\" | \"bc-red-2\" | \"bc-red-3\" | \"bc-red-4\" | \"bc-red-5\" | \"bc-red-6\" | \"bc-red-7\" | \"bc-red-8\" | \"bc-red-9\" | \"bc-blue\" | \"bc-blue-1\" | \"bc-blue-2\" | \"bc-blue-3\" | \"bc-blue-4\" | \"bc-blue-5\" | \"bc-blue-6\" | \"bc-blue-7\" | \"bc-blue-8\" | \"bc-blue-9\" | \"bc-green\" | \"bc-green-1\" | \"bc-green-2\" | \"bc-green-3\" | \"bc-green-4\" | \"bc-green-5\" | \"bc-green-6\" | \"bc-green-7\" | \"bc-green-8\" | \"bc-green-9\" | \"bc-orange\" | \"bc-orange-1\" | \"bc-orange-2\" | \"bc-orange-3\" | \"bc-orange-4\" | \"bc-orange-5\" | \"bc-orange-6\" | \"bc-orange-7\" | \"bc-orange-8\" | \"bc-orange-9\"",
|
|
144
144
|
"references": {
|
|
145
145
|
"ColorPaletteTypes": {
|
|
146
146
|
"location": "import",
|
|
@@ -156,7 +156,7 @@ export class BcmTag {
|
|
|
156
156
|
"mutable": true,
|
|
157
157
|
"complexType": {
|
|
158
158
|
"original": "ColorPaletteTypes",
|
|
159
|
-
"resolved": "\"red\" | \"default\" | \"black\" | \"white\" | \"prime-blue\" | \"prime-blue-1\" | \"prime-blue-2\" | \"prime-blue-3\" | \"prime-blue-5\" | \"prime-blue-6\" | \"prime-blue-7\" | \"prime-blue-8\" | \"prime-blue-9\" | \"prime-blue-10\" | \"grey\" | \"grey-1\" | \"grey-2\" | \"grey-3\" | \"grey-4\" | \"grey-5\" | \"grey-6\" | \"grey-7\" | \"grey-8\" | \"grey-9\" | \"grey-10\" | \"blue
|
|
159
|
+
"resolved": "\"red\" | \"blue\" | \"default\" | \"black\" | \"white\" | \"prime-blue\" | \"prime-blue-1\" | \"prime-blue-2\" | \"prime-blue-3\" | \"prime-blue-5\" | \"prime-blue-6\" | \"prime-blue-7\" | \"prime-blue-8\" | \"prime-blue-9\" | \"prime-blue-10\" | \"grey\" | \"grey-1\" | \"grey-2\" | \"grey-3\" | \"grey-4\" | \"grey-5\" | \"grey-6\" | \"grey-7\" | \"grey-8\" | \"grey-9\" | \"grey-10\" | \"blue-1\" | \"blue-2\" | \"blue-3\" | \"blue-4\" | \"blue-5\" | \"blue-6\" | \"blue-7\" | \"blue-8\" | \"blue-9\" | \"blue-10\" | \"warmyellow\" | \"warmyellow-1\" | \"warmyellow-2\" | \"warmyellow-3\" | \"warmyellow-4\" | \"warmyellow-5\" | \"warmyellow-6\" | \"warmyellow-7\" | \"warmyellow-8\" | \"warmyellow-9\" | \"warmyellow-10\" | \"yellow\" | \"yellow-1\" | \"yellow-2\" | \"yellow-3\" | \"yellow-4\" | \"yellow-5\" | \"yellow-6\" | \"yellow-7\" | \"yellow-8\" | \"yellow-9\" | \"yellow-10\" | \"limegreen\" | \"limegreen-1\" | \"limegreen-2\" | \"limegreen-3\" | \"limegreen-4\" | \"limegreen-5\" | \"limegreen-6\" | \"limegreen-7\" | \"limegreen-8\" | \"limegreen-9\" | \"limegreen-10\" | \"red-1\" | \"red-2\" | \"red-3\" | \"red-4\" | \"red-5\" | \"red-6\" | \"red-7\" | \"red-8\" | \"red-9\" | \"red-10\" | \"darkorange\" | \"darkorange-1\" | \"darkorange-2\" | \"darkorange-3\" | \"darkorange-4\" | \"darkorange-5\" | \"darkorange-6\" | \"darkorange-7\" | \"darkorange-8\" | \"darkorange-9\" | \"darkorange-10\" | \"orange\" | \"orange-1\" | \"orange-2\" | \"orange-3\" | \"orange-4\" | \"orange-5\" | \"orange-6\" | \"orange-7\" | \"orange-8\" | \"orange-9\" | \"orange-10\" | \"green\" | \"green-1\" | \"green-2\" | \"green-3\" | \"green-4\" | \"green-5\" | \"green-6\" | \"green-7\" | \"green-8\" | \"green-9\" | \"green-10\" | \"turquosie\" | \"turquosie-1\" | \"turquosie-2\" | \"turquosie-3\" | \"turquosie-4\" | \"turquosie-5\" | \"turquosie-6\" | \"turquosie-7\" | \"turquosie-8\" | \"turquosie-9\" | \"turquosie-10\" | \"cobaltblue\" | \"cobaltblue-1\" | \"cobaltblue-2\" | \"cobaltblue-3\" | \"cobaltblue-4\" | \"cobaltblue-5\" | \"cobaltblue-6\" | \"cobaltblue-7\" | \"cobaltblue-8\" | \"cobaltblue-9\" | \"cobaltblue-10\" | \"magenta\" | \"magenta-1\" | \"magenta-2\" | \"magenta-3\" | \"magenta-4\" | \"magenta-5\" | \"magenta-6\" | \"magenta-7\" | \"magenta-8\" | \"magenta-9\" | \"magenta-10\" | \"purple\" | \"purple-1\" | \"purple-2\" | \"purple-3\" | \"purple-4\" | \"purple-5\" | \"purple-6\" | \"purple-7\" | \"purple-8\" | \"purple-9\" | \"purple-10\" | \"bc-red\" | \"bc-red-1\" | \"bc-red-2\" | \"bc-red-3\" | \"bc-red-4\" | \"bc-red-5\" | \"bc-red-6\" | \"bc-red-7\" | \"bc-red-8\" | \"bc-red-9\" | \"bc-blue\" | \"bc-blue-1\" | \"bc-blue-2\" | \"bc-blue-3\" | \"bc-blue-4\" | \"bc-blue-5\" | \"bc-blue-6\" | \"bc-blue-7\" | \"bc-blue-8\" | \"bc-blue-9\" | \"bc-green\" | \"bc-green-1\" | \"bc-green-2\" | \"bc-green-3\" | \"bc-green-4\" | \"bc-green-5\" | \"bc-green-6\" | \"bc-green-7\" | \"bc-green-8\" | \"bc-green-9\" | \"bc-orange\" | \"bc-orange-1\" | \"bc-orange-2\" | \"bc-orange-3\" | \"bc-orange-4\" | \"bc-orange-5\" | \"bc-orange-6\" | \"bc-orange-7\" | \"bc-orange-8\" | \"bc-orange-9\" | \"prime-blue-4\"",
|
|
160
160
|
"references": {
|
|
161
161
|
"ColorPaletteTypes": {
|
|
162
162
|
"location": "import",
|
|
@@ -44,10 +44,11 @@ export const ListItemTemplate = ({ item, treeview, highlight, checkboxes, size,
|
|
|
44
44
|
item.open = item.isSearching;
|
|
45
45
|
openGroup(item.id);
|
|
46
46
|
};
|
|
47
|
-
return (h("div", { id: item.id, hidden: item.hidden, "on-focus": e => !unClickable && !disabled && focusItem(e), tabIndex: unClickable || disabled ? -1 : 0, class: cs('bcm-list__item',
|
|
47
|
+
return (h("div", { id: item.id, hidden: item.hidden, "data-has-children": isHaveChildren ? "true" : "false", "data-open": item.isSearching || item.open ? "true" : "false", "data-parent-id": item.parentId || "", "on-focus": e => !unClickable && !disabled && focusItem(e), tabIndex: unClickable || disabled ? -1 : 0, class: cs('bcm-list__item',
|
|
48
48
|
// size === 'large' ? 'size-3' : 'size-2',
|
|
49
49
|
'bcm-list__item-' + size, {
|
|
50
50
|
'bcm-list__item--group': !treeview && item.type == 'group',
|
|
51
|
+
'bcm-list__item--open': item.isSearching || item.open,
|
|
51
52
|
'bcm-list__item--readonly': readonly,
|
|
52
53
|
}) }, h("div", { class: cs('bcm-list__item-content', !checkboxes && item.selected && 'selected', { disabled, readonly }) }, treeview && (h("div", { class: "bcm-list__item-content-collapse-icon", onClick: () => collapseClick() }, isHaveChildren && h("bcm-icon", { icon: cs('fas fa-caret-' + (item.isSearching || item.open ? 'down' : 'right')) }))), h("div", { class: cs('bcm-list__item-content-text', { treeview }), onClick: (e) => itemClick(e) }, checkboxes && (treeview || (!treeview && item.type != 'group')) && (h("div", { class: "bcm-list__item-content-text-checkbox" }, h(CheckboxTemplate, { indeterminate: item.indeterminate, checked: item.checked, disabled: disabled }))), h("span", Object.assign({ class: "bcm-list__item-content-text-inner" }, (item.title && { "title": item.title }), { innerHTML: text })))), (treeview || !treeview && item.type == "group") && isHaveChildren && (h("div", { class: "bcm-list__item-childs" }, (item.isSearching || item.open || (!treeview && item.type == "group")) &&
|
|
53
54
|
item.items.map((item) => (h(ListItemTemplate, { highlight: highlight, item: item, searchIsOnlyChilds: searchIsOnlyChilds, treeview: treeview, checkboxes: checkboxes, size: size, selectedItem: selectedItem, checkedItem: checkedItem, openGroup: parentId => openGroup(parentId), focusItem: itemId => focusItem(itemId) })))))));
|
|
@@ -74,6 +74,41 @@ const BcmDropdown$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
74
74
|
item.setActive(id);
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
+
componentWillLoad() {
|
|
78
|
+
this.checkContent();
|
|
79
|
+
}
|
|
80
|
+
componentDidLoad() {
|
|
81
|
+
this.observeContent();
|
|
82
|
+
}
|
|
83
|
+
disconnectedCallback() {
|
|
84
|
+
var _a;
|
|
85
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
86
|
+
}
|
|
87
|
+
observeContent() {
|
|
88
|
+
this.observer = new MutationObserver(() => {
|
|
89
|
+
this.manualSlotContent();
|
|
90
|
+
});
|
|
91
|
+
this.observer.observe(this.el, { childList: true });
|
|
92
|
+
}
|
|
93
|
+
manualSlotContent() {
|
|
94
|
+
const contentNodes = this.el.querySelectorAll(':scope > [slot="content"], :scope > bcm-content, :scope > bcm-items');
|
|
95
|
+
if (contentNodes.length > 0) {
|
|
96
|
+
const menu = document.getElementById(this.menuId);
|
|
97
|
+
if (menu) {
|
|
98
|
+
contentNodes.forEach(node => {
|
|
99
|
+
if (!menu.contains(node)) {
|
|
100
|
+
menu.appendChild(node);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
if (menu === null || menu === void 0 ? void 0 : menu.updateLayout) {
|
|
104
|
+
menu === null || menu === void 0 ? void 0 : menu.updateLayout();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
checkContent() {
|
|
110
|
+
this.manualSlotContent();
|
|
111
|
+
}
|
|
77
112
|
async getActive() {
|
|
78
113
|
return this.activeItem;
|
|
79
114
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface BcmFileUpload extends Components.BcmFileUpload, HTMLElement {}
|
|
4
|
+
export const BcmFileUpload: {
|
|
5
|
+
prototype: BcmFileUpload;
|
|
6
|
+
new (): BcmFileUpload;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|