@ekzo-dev/bootstrap-addons 5.3.18 → 5.3.20
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 +3 -3
- package/src/forms/duration-input/duration-input.html +2 -8
- package/src/forms/duration-input/duration-input.ts +6 -9
- package/src/forms/select-dropdown/index.ts +1 -0
- package/src/forms/{select/select.scss → select-dropdown/select-dropdown.scss} +8 -5
- package/src/forms/{select/select.ts → select-dropdown/select-dropdown.ts} +10 -14
- package/src/forms/select-dropdown/select.stories.ts +89 -0
- package/src/index.ts +1 -1
- package/src/forms/select/index.ts +0 -1
- package/src/forms/select/select.stories.ts +0 -89
- /package/src/forms/{select → select-dropdown}/filter.ts +0 -0
- /package/src/forms/{select/select.html → select-dropdown/select-dropdown.html} +0 -0
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.3.
|
|
4
|
+
"version": "5.3.20",
|
|
5
5
|
"homepage": "https://github.com/ekzo-dev/aurelia-components/tree/main/packages/bootstrap-addons",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@ekzo-dev/bootstrap": "~5.3.
|
|
12
|
+
"@ekzo-dev/bootstrap": "~5.3.6",
|
|
13
13
|
"@ekzo-dev/vanilla-jsoneditor": "~3.11.0",
|
|
14
|
-
"@ekzo-dev/toolkit": "^1.
|
|
14
|
+
"@ekzo-dev/toolkit": "^1.3.0",
|
|
15
15
|
"@fortawesome/free-solid-svg-icons": "^7.0.1",
|
|
16
16
|
"@types/json-schema": "^7.0.14",
|
|
17
17
|
"@js-temporal/polyfill": "^0.5.1",
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
<template class="${floatingLabel ? 'form-floating' : ''}">
|
|
2
2
|
<label for.one-time="id" if.bind="label && !floatingLabel" class="form-label">${label}</label>
|
|
3
3
|
<fieldset class="${classes}" disabled.bind="disabled">
|
|
4
|
-
<input
|
|
5
|
-
|
|
6
|
-
id.one-time="id"
|
|
7
|
-
required.bind="required"
|
|
8
|
-
value.bind="value"
|
|
9
|
-
form.bind="form & attr"
|
|
10
|
-
focus.trigger="focus()"
|
|
11
|
-
/>
|
|
4
|
+
<input type="text" id.one-time="id" value.bind="value" focus.trigger="focus()" ref="control" />
|
|
5
|
+
|
|
12
6
|
<input type="number" min="0" value.bind="duration.years" placeholder="--" />
|
|
13
7
|
<span>${labels.years}</span>
|
|
14
8
|
<input type="number" min="0" value.bind="duration.months" placeholder="--" />
|
|
@@ -45,7 +45,7 @@ export class BsDurationInput extends BaseField implements EventListenerObject {
|
|
|
45
45
|
bsSize?: Size;
|
|
46
46
|
|
|
47
47
|
@bindable(coerceBoolean)
|
|
48
|
-
floatingLabel: boolean =
|
|
48
|
+
floatingLabel: boolean = this.config.floatingLabels;
|
|
49
49
|
|
|
50
50
|
duration: Duration = {};
|
|
51
51
|
|
|
@@ -101,15 +101,12 @@ export class BsDurationInput extends BaseField implements EventListenerObject {
|
|
|
101
101
|
private _parseDuration(value: string) {
|
|
102
102
|
try {
|
|
103
103
|
const duration = Temporal.Duration.from(value);
|
|
104
|
+
const result = {};
|
|
104
105
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
hours: duration.hours,
|
|
110
|
-
minutes: duration.minutes,
|
|
111
|
-
seconds: duration.seconds,
|
|
112
|
-
};
|
|
106
|
+
durationKeys.forEach((key) => {
|
|
107
|
+
result[key] = duration[key] ? duration[key].toString() : '';
|
|
108
|
+
});
|
|
109
|
+
this.duration = result;
|
|
113
110
|
} catch (error) {
|
|
114
111
|
if (error instanceof RangeError) {
|
|
115
112
|
console.warn(`[bs-duration-input] ${error.message}`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './select-dropdown';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
@import '@ekzo-dev/bootstrap/src/utils';
|
|
2
2
|
@import 'bootstrap/scss/forms/form-check';
|
|
3
3
|
|
|
4
|
-
bs-select
|
|
4
|
+
bs-select-dropdown {
|
|
5
|
+
display: block;
|
|
6
|
+
width: 100%;
|
|
7
|
+
|
|
5
8
|
.form-select {
|
|
6
9
|
cursor: default;
|
|
7
10
|
}
|
|
@@ -56,10 +59,10 @@ bs-select.addon {
|
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
/* stylelint-disable */
|
|
59
|
-
.was-validated bs-select
|
|
60
|
-
.was-validated bs-select
|
|
61
|
-
bs-select
|
|
62
|
-
bs-select
|
|
62
|
+
.was-validated bs-select-dropdown:has(.btn-close) .form-select:invalid,
|
|
63
|
+
.was-validated bs-select-dropdown:has(.btn-close) .form-select:valid,
|
|
64
|
+
bs-select-dropdown:has(.btn-close) .form-select.is-invalid,
|
|
65
|
+
bs-select-dropdown:has(.btn-close) .form-select.is-valid {
|
|
63
66
|
padding-right: 5.5rem !important;
|
|
64
67
|
|
|
65
68
|
+ .btn-close {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import template from './select.html';
|
|
1
|
+
import template from './select-dropdown.html';
|
|
2
2
|
|
|
3
|
-
import './select.scss';
|
|
3
|
+
import './select-dropdown.scss';
|
|
4
4
|
|
|
5
5
|
import type { Options } from '@popperjs/core';
|
|
6
6
|
import type { Tooltip } from 'bootstrap';
|
|
@@ -11,24 +11,22 @@ import {
|
|
|
11
11
|
BsDropdownItem,
|
|
12
12
|
BsDropdownMenu,
|
|
13
13
|
BsDropdownToggle,
|
|
14
|
-
BsSelect
|
|
14
|
+
BsSelect,
|
|
15
15
|
ISelectOption,
|
|
16
16
|
} from '@ekzo-dev/bootstrap';
|
|
17
|
-
import { bindable, customElement, ICustomElementViewModel,
|
|
17
|
+
import { bindable, customElement, ICustomElementViewModel, queueTask } from 'aurelia';
|
|
18
18
|
|
|
19
19
|
import { Filter } from './filter';
|
|
20
20
|
|
|
21
21
|
@customElement({
|
|
22
|
-
name: 'bs-select',
|
|
22
|
+
name: 'bs-select-dropdown',
|
|
23
23
|
template,
|
|
24
24
|
dependencies: [BsDropdown, BsDropdownMenu, BsDropdownToggle, BsDropdownItem, Filter, BsCloseButton],
|
|
25
25
|
})
|
|
26
|
-
export class
|
|
26
|
+
export class BsSelectDropdown extends BsSelect implements ICustomElementViewModel {
|
|
27
27
|
@bindable()
|
|
28
28
|
emptyValue?: unknown = null;
|
|
29
29
|
|
|
30
|
-
host = resolve(HTMLElement);
|
|
31
|
-
|
|
32
30
|
filter: string = '';
|
|
33
31
|
|
|
34
32
|
emptyOption?: ISelectOption;
|
|
@@ -36,8 +34,6 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
|
|
|
36
34
|
popperConfig: Partial<Options> | Tooltip.PopperConfigFunction | null = null;
|
|
37
35
|
|
|
38
36
|
binding() {
|
|
39
|
-
super.binding();
|
|
40
|
-
|
|
41
37
|
if (this.multiple && !Array.isArray(this.value)) {
|
|
42
38
|
this.value = [];
|
|
43
39
|
}
|
|
@@ -47,7 +43,7 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
|
|
|
47
43
|
this.setPopperConfig();
|
|
48
44
|
}
|
|
49
45
|
|
|
50
|
-
valueChanged(value: unknown)
|
|
46
|
+
valueChanged(value: unknown) {
|
|
51
47
|
if (this.multiple && !Array.isArray(value)) {
|
|
52
48
|
this.value = [];
|
|
53
49
|
}
|
|
@@ -159,12 +155,12 @@ export class BsSelect extends BaseBsSelect implements ICustomElementViewModel {
|
|
|
159
155
|
const foundValue = option?.value;
|
|
160
156
|
|
|
161
157
|
if (foundValue !== value) {
|
|
162
|
-
|
|
163
|
-
void Promise.resolve().then(() => (this.value = foundValue));
|
|
158
|
+
queueTask(() => (this.value = foundValue));
|
|
164
159
|
}
|
|
165
160
|
|
|
166
161
|
// update empty option next tick
|
|
167
|
-
|
|
162
|
+
// TODO: investigate if next tick is still needed
|
|
163
|
+
queueTask(() => (this.emptyOption = emptyOption));
|
|
168
164
|
|
|
169
165
|
return option;
|
|
170
166
|
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// import { BsButton, BsOffcanvas } from '@ekzo-dev/bootstrap';
|
|
2
|
+
// import { extractArgTypes, Meta, Story } from '@storybook/aurelia';
|
|
3
|
+
//
|
|
4
|
+
// import { selectControl } from '../../../../../.storybook/helpers';
|
|
5
|
+
//
|
|
6
|
+
// import { BsSelectDropdown } from '.';
|
|
7
|
+
//
|
|
8
|
+
// export default {
|
|
9
|
+
// title: 'Ekzo / Bootstrap Addons / Forms / Select',
|
|
10
|
+
// component: BsSelectDropdown,
|
|
11
|
+
// parameters: {
|
|
12
|
+
// actions: {
|
|
13
|
+
// handles: ['change', 'input'],
|
|
14
|
+
// },
|
|
15
|
+
// },
|
|
16
|
+
// args: {
|
|
17
|
+
// label: 'Label',
|
|
18
|
+
// floatingLabel: false,
|
|
19
|
+
// valid: null,
|
|
20
|
+
// },
|
|
21
|
+
// argTypes: {
|
|
22
|
+
// bsSize: {
|
|
23
|
+
// ...extractArgTypes(BsSelectDropdown).bsSize,
|
|
24
|
+
// ...selectControl(['', 'sm', 'lg']),
|
|
25
|
+
// },
|
|
26
|
+
// },
|
|
27
|
+
// } as Meta;
|
|
28
|
+
//
|
|
29
|
+
// const Overview: Story = (args) => ({
|
|
30
|
+
// props: args,
|
|
31
|
+
// });
|
|
32
|
+
//
|
|
33
|
+
// Overview.args = {
|
|
34
|
+
// options: [
|
|
35
|
+
// { value: undefined, text: 'Select option' },
|
|
36
|
+
// { value: '1', text: 'One', disabled: true },
|
|
37
|
+
// { value: '2', text: 'Two' },
|
|
38
|
+
// { value: '3', text: 'Three', group: 'Group' },
|
|
39
|
+
// ],
|
|
40
|
+
// value: '2',
|
|
41
|
+
// };
|
|
42
|
+
//
|
|
43
|
+
// const Multiple: Story = (args) => ({
|
|
44
|
+
// props: args,
|
|
45
|
+
// });
|
|
46
|
+
//
|
|
47
|
+
// Multiple.args = {
|
|
48
|
+
// multiple: true,
|
|
49
|
+
// value: ['2', '3'],
|
|
50
|
+
// options: [
|
|
51
|
+
// { value: '1', text: 'One', disabled: true },
|
|
52
|
+
// { value: '2', text: 'Two' },
|
|
53
|
+
// { value: '3', text: 'Three', group: 'Group' },
|
|
54
|
+
// ],
|
|
55
|
+
// };
|
|
56
|
+
//
|
|
57
|
+
// const LargeOptions: Story = (args) => ({
|
|
58
|
+
// props: args,
|
|
59
|
+
// template:
|
|
60
|
+
// '<bs-select value.bind="value" options.bind="options" label.bind="label" style="width: 400px; max-width: 100%"></bs-select>',
|
|
61
|
+
// });
|
|
62
|
+
//
|
|
63
|
+
// LargeOptions.args = {
|
|
64
|
+
// options: Array.from({ length: 1000 }).map((v, i) => ({
|
|
65
|
+
// value: i.toString(),
|
|
66
|
+
// text: `Option ${i} has long content which forces dropdown menu to scale larger that select box`,
|
|
67
|
+
// })),
|
|
68
|
+
// };
|
|
69
|
+
//
|
|
70
|
+
// const InModal: Story = (args) => ({
|
|
71
|
+
// props: args,
|
|
72
|
+
// template: `
|
|
73
|
+
// <button bs-button click.trigger="offcanvas.toggle()">Open modal</button>
|
|
74
|
+
// <bs-offcanvas component.ref="offcanvas">
|
|
75
|
+
// <bs-select value.bind="value" options.bind="options" label.bind="label" style="width: 100%"></bs-select>
|
|
76
|
+
// <div style="height: 2000px"></div>
|
|
77
|
+
// </bs-offcanvas>`,
|
|
78
|
+
// components: [BsOffcanvas, BsButton],
|
|
79
|
+
// });
|
|
80
|
+
//
|
|
81
|
+
// InModal.args = {
|
|
82
|
+
// options: Array.from({ length: 1000 }).map((v, i) => ({
|
|
83
|
+
// value: i.toString(),
|
|
84
|
+
// text: `Option ${i} has long content which forces dropdown menu to scale larger that select box`,
|
|
85
|
+
// })),
|
|
86
|
+
// };
|
|
87
|
+
//
|
|
88
|
+
// // eslint-disable-next-line
|
|
89
|
+
// export { Overview, Multiple, LargeOptions, InModal };
|
package/src/index.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './select';
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { BsButton, BsOffcanvas } from '@ekzo-dev/bootstrap';
|
|
2
|
-
import { extractArgTypes, Meta, Story } from '@storybook/aurelia';
|
|
3
|
-
|
|
4
|
-
import { selectControl } from '../../../../../.storybook/helpers';
|
|
5
|
-
|
|
6
|
-
import { BsSelect } from '.';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'Ekzo / Bootstrap Addons / Forms / Select',
|
|
10
|
-
component: BsSelect,
|
|
11
|
-
parameters: {
|
|
12
|
-
actions: {
|
|
13
|
-
handles: ['change', 'input'],
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
args: {
|
|
17
|
-
label: 'Label',
|
|
18
|
-
floatingLabel: false,
|
|
19
|
-
valid: null,
|
|
20
|
-
},
|
|
21
|
-
argTypes: {
|
|
22
|
-
bsSize: {
|
|
23
|
-
...extractArgTypes(BsSelect).bsSize,
|
|
24
|
-
...selectControl(['', 'sm', 'lg']),
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
} as Meta;
|
|
28
|
-
|
|
29
|
-
const Overview: Story = (args) => ({
|
|
30
|
-
props: args,
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
Overview.args = {
|
|
34
|
-
options: [
|
|
35
|
-
{ value: undefined, text: 'Select option' },
|
|
36
|
-
{ value: '1', text: 'One', disabled: true },
|
|
37
|
-
{ value: '2', text: 'Two' },
|
|
38
|
-
{ value: '3', text: 'Three', group: 'Group' },
|
|
39
|
-
],
|
|
40
|
-
value: '2',
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const Multiple: Story = (args) => ({
|
|
44
|
-
props: args,
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
Multiple.args = {
|
|
48
|
-
multiple: true,
|
|
49
|
-
value: ['2', '3'],
|
|
50
|
-
options: [
|
|
51
|
-
{ value: '1', text: 'One', disabled: true },
|
|
52
|
-
{ value: '2', text: 'Two' },
|
|
53
|
-
{ value: '3', text: 'Three', group: 'Group' },
|
|
54
|
-
],
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const LargeOptions: Story = (args) => ({
|
|
58
|
-
props: args,
|
|
59
|
-
template:
|
|
60
|
-
'<bs-select value.bind="value" options.bind="options" label.bind="label" style="width: 400px; max-width: 100%"></bs-select>',
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
LargeOptions.args = {
|
|
64
|
-
options: Array.from({ length: 1000 }).map((v, i) => ({
|
|
65
|
-
value: i.toString(),
|
|
66
|
-
text: `Option ${i} has long content which forces dropdown menu to scale larger that select box`,
|
|
67
|
-
})),
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const InModal: Story = (args) => ({
|
|
71
|
-
props: args,
|
|
72
|
-
template: `
|
|
73
|
-
<button bs-button click.trigger="offcanvas.toggle()">Open modal</button>
|
|
74
|
-
<bs-offcanvas component.ref="offcanvas">
|
|
75
|
-
<bs-select value.bind="value" options.bind="options" label.bind="label" style="width: 100%"></bs-select>
|
|
76
|
-
<div style="height: 2000px"></div>
|
|
77
|
-
</bs-offcanvas>`,
|
|
78
|
-
components: [BsOffcanvas, BsButton],
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
InModal.args = {
|
|
82
|
-
options: Array.from({ length: 1000 }).map((v, i) => ({
|
|
83
|
-
value: i.toString(),
|
|
84
|
-
text: `Option ${i} has long content which forces dropdown menu to scale larger that select box`,
|
|
85
|
-
})),
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
// eslint-disable-next-line
|
|
89
|
-
export { Overview, Multiple, LargeOptions, InModal };
|
|
File without changes
|
|
File without changes
|