@ekzo-dev/bootstrap-addons 5.2.25 → 5.2.26
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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekzo-dev/bootstrap-addons",
|
|
3
3
|
"description": "Aurelia Bootstrap additional component",
|
|
4
|
-
"version": "5.2.
|
|
4
|
+
"version": "5.2.26",
|
|
5
5
|
"homepage": "https://github.com/ekzo-dev/aurelia-components/tree/main/packages/bootstrap-addons",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@ekzo-dev/bootstrap": "^5.2.
|
|
12
|
+
"@ekzo-dev/bootstrap": "^5.2.20",
|
|
13
13
|
"@ekzo-dev/vanilla-jsoneditor": "^0.23.7",
|
|
14
14
|
"@ekzo-dev/toolkit": "^1.2.4",
|
|
15
15
|
"@fortawesome/free-solid-svg-icons": "^6.5.2",
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
"immutable-json-patch": "^5.1.3"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"
|
|
24
|
+
"aurelia": "^2.0.0-beta.8",
|
|
25
|
+
"bootstrap": "^5.2.3",
|
|
26
|
+
"@popperjs/core": "^2.11.8"
|
|
25
27
|
},
|
|
26
28
|
"main": "src/index.ts",
|
|
27
29
|
"files": [
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
type="button"
|
|
46
46
|
click.trigger="selectOption(emptyOption)"
|
|
47
47
|
></button>
|
|
48
|
-
<bs-dropdown-menu>
|
|
48
|
+
<bs-dropdown-menu popper-config.bind="popperConfig">
|
|
49
49
|
<div bs-dropdown-item="text" if.bind="optionsCount > 10">
|
|
50
50
|
<input class="form-control" placeholder="Filter options" type="search" value.bind="filter & debounce:250" />
|
|
51
51
|
</div>
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
<button
|
|
54
54
|
type="button"
|
|
55
55
|
repeat.for="option of ungroupedOptions | filter:filter:emptyOption"
|
|
56
|
-
|
|
56
|
+
class="dropdown-item ${option.value === selectedOption?.value ? 'active' : ''}"
|
|
57
|
+
disabled.bind="option.disabled"
|
|
57
58
|
click.trigger="selectOption(option)"
|
|
58
59
|
>
|
|
59
60
|
${option.text || ' '}
|
|
@@ -61,10 +62,10 @@
|
|
|
61
62
|
<template repeat.for="[k, v] of groupedOptions | filter:filter:emptyOption">
|
|
62
63
|
<h6 bs-dropdown-item="header">${k}</h6>
|
|
63
64
|
<button
|
|
64
|
-
class="ps-4"
|
|
65
65
|
type="button"
|
|
66
66
|
repeat.for="option of v"
|
|
67
|
-
|
|
67
|
+
class="ps-4 dropdown-item ${option.value === selectedOption?.value ? 'active' : ''}"
|
|
68
|
+
disabled.bind="option.disabled"
|
|
68
69
|
click.trigger="selectOption(option)"
|
|
69
70
|
>
|
|
70
71
|
${option.text || ' '}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BsButton, BsOffcanvas } from '@ekzo-dev/bootstrap';
|
|
1
2
|
import { extractArgTypes, Meta, Story } from '@storybook/aurelia';
|
|
2
3
|
|
|
3
4
|
import { selectControl } from '../../../../../.storybook/helpers';
|
|
@@ -57,5 +58,23 @@ LargeOptions.args = {
|
|
|
57
58
|
})),
|
|
58
59
|
};
|
|
59
60
|
|
|
61
|
+
const InModal: Story = (args) => ({
|
|
62
|
+
props: args,
|
|
63
|
+
template: `
|
|
64
|
+
<button bs-button click.trigger="offcanvas.toggle()">Open modal</button>
|
|
65
|
+
<bs-offcanvas component.ref="offcanvas">
|
|
66
|
+
<bs-select value.bind="value" options.bind="options" label.bind="label" style="width: 100%"></bs-select>
|
|
67
|
+
<div style="height: 2000px"></div>
|
|
68
|
+
</bs-offcanvas>`,
|
|
69
|
+
components: [BsOffcanvas, BsButton],
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
InModal.args = {
|
|
73
|
+
options: Array.from({ length: 1000 }).map((v, i) => ({
|
|
74
|
+
value: i.toString(),
|
|
75
|
+
text: `Option ${i} has long content which forces dropdown menu to scale larger that select box`,
|
|
76
|
+
})),
|
|
77
|
+
};
|
|
78
|
+
|
|
60
79
|
// eslint-disable-next-line
|
|
61
|
-
export { Overview, Multiple, LargeOptions };
|
|
80
|
+
export { Overview, Multiple, LargeOptions, InModal };
|
|
@@ -2,6 +2,9 @@ import template from './select.html';
|
|
|
2
2
|
|
|
3
3
|
import './select.scss';
|
|
4
4
|
|
|
5
|
+
import type { Options } from '@popperjs/core';
|
|
6
|
+
import type { Tooltip } from 'bootstrap';
|
|
7
|
+
|
|
5
8
|
import {
|
|
6
9
|
BsCloseButton,
|
|
7
10
|
BsDropdown,
|
|
@@ -11,7 +14,7 @@ import {
|
|
|
11
14
|
BsSelect as BaseBsSelect,
|
|
12
15
|
ISelectOption,
|
|
13
16
|
} from '@ekzo-dev/bootstrap';
|
|
14
|
-
import { bindable, customElement, ICustomElementViewModel } from 'aurelia';
|
|
17
|
+
import { bindable, customElement, ICustomElementViewModel, resolve } from 'aurelia';
|
|
15
18
|
|
|
16
19
|
import { Filter } from './filter';
|
|
17
20
|
|
|
@@ -29,6 +32,8 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
|
|
|
29
32
|
@bindable()
|
|
30
33
|
emptyValue?: unknown = null;
|
|
31
34
|
|
|
35
|
+
host = resolve(HTMLElement);
|
|
36
|
+
|
|
32
37
|
control!: HTMLFieldSetElement;
|
|
33
38
|
|
|
34
39
|
filter: string = '';
|
|
@@ -39,6 +44,8 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
|
|
|
39
44
|
|
|
40
45
|
emptyOption?: ISelectOption;
|
|
41
46
|
|
|
47
|
+
popperConfig: Partial<Options> | Tooltip.PopperConfigFunction | null = null;
|
|
48
|
+
|
|
42
49
|
binding() {
|
|
43
50
|
super.binding();
|
|
44
51
|
this.deactivating = false;
|
|
@@ -53,6 +60,8 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
|
|
|
53
60
|
this.#setHeight();
|
|
54
61
|
this.#scrollToSelected();
|
|
55
62
|
}
|
|
63
|
+
|
|
64
|
+
this.setPopperConfig();
|
|
56
65
|
}
|
|
57
66
|
|
|
58
67
|
propertyChanged(name: keyof this) {
|
|
@@ -68,6 +77,24 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
|
|
|
68
77
|
}
|
|
69
78
|
}
|
|
70
79
|
|
|
80
|
+
setPopperConfig() {
|
|
81
|
+
if (this.multiple) return;
|
|
82
|
+
|
|
83
|
+
const { host } = this;
|
|
84
|
+
const parentModal = host.closest('.modal-body,.popover-body,.offcanvas-body');
|
|
85
|
+
const dropdownMenu: HTMLElement = host.querySelector('.dropdown-menu');
|
|
86
|
+
|
|
87
|
+
if (parentModal != null) {
|
|
88
|
+
this.popperConfig = {
|
|
89
|
+
strategy: 'fixed',
|
|
90
|
+
};
|
|
91
|
+
dropdownMenu.style.minWidth = `${host.offsetWidth}px`;
|
|
92
|
+
} else {
|
|
93
|
+
this.popperConfig = null;
|
|
94
|
+
dropdownMenu.style.minWidth = undefined;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
71
98
|
selectOption(option: ISelectOption) {
|
|
72
99
|
this.value = option.value;
|
|
73
100
|
this.#dispatchEvents();
|