@ekzo-dev/bootstrap-addons 5.3.20 → 5.3.21
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 +1 -1
- package/src/forms/duration-input/duration-input.stories.ts +39 -39
- package/src/forms/duration-input/duration-input.ts +11 -5
- package/src/forms/json-input/json-input.stories.ts +59 -59
- package/src/forms/json-input/json-input.ts +9 -9
- package/src/forms/select-dropdown/select-dropdown.ts +9 -5
- package/src/forms/select-dropdown/select.stories.ts +89 -89
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.21",
|
|
5
5
|
"homepage": "https://github.com/ekzo-dev/aurelia-components/tree/main/packages/bootstrap-addons",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { BsButton } from '@ekzo-dev/bootstrap';
|
|
2
|
-
import { createComponentTemplate, Meta, Story, StoryFnAureliaReturnType } from '@storybook/aurelia';
|
|
3
|
-
|
|
4
|
-
import { selectControl } from '../../../../../.storybook/helpers';
|
|
5
|
-
|
|
6
|
-
import { BsDurationInput } from '.';
|
|
7
|
-
|
|
8
|
-
const meta: Meta = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default meta;
|
|
21
|
-
|
|
22
|
-
const Overview: Story = (args): StoryFnAureliaReturnType => ({
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const Validation: Story = (args): StoryFnAureliaReturnType => ({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
Validation.args = {
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// eslint-disable-next-line
|
|
39
|
-
export { Overview, Validation };
|
|
1
|
+
// import { BsButton } from '@ekzo-dev/bootstrap';
|
|
2
|
+
// import { createComponentTemplate, Meta, Story, StoryFnAureliaReturnType } from '@storybook/aurelia';
|
|
3
|
+
//
|
|
4
|
+
// import { selectControl } from '../../../../../.storybook/helpers';
|
|
5
|
+
//
|
|
6
|
+
// import { BsDurationInput } from '.';
|
|
7
|
+
//
|
|
8
|
+
// const meta: Meta = {
|
|
9
|
+
// title: 'Ekzo / Bootstrap Addons / Forms / Duration input',
|
|
10
|
+
// component: BsDurationInput,
|
|
11
|
+
// args: {
|
|
12
|
+
// value: 'P5DT1Hasds',
|
|
13
|
+
// label: 'Duration',
|
|
14
|
+
// },
|
|
15
|
+
// argTypes: {
|
|
16
|
+
// bsSize: selectControl(['', 'sm', 'lg']),
|
|
17
|
+
// },
|
|
18
|
+
// };
|
|
19
|
+
//
|
|
20
|
+
// export default meta;
|
|
21
|
+
//
|
|
22
|
+
// const Overview: Story = (args): StoryFnAureliaReturnType => ({
|
|
23
|
+
// props: args,
|
|
24
|
+
// });
|
|
25
|
+
//
|
|
26
|
+
// const Validation: Story = (args): StoryFnAureliaReturnType => ({
|
|
27
|
+
// props: args,
|
|
28
|
+
// template: `<form class='was-validated'>${createComponentTemplate(
|
|
29
|
+
// BsDurationInput
|
|
30
|
+
// )}<br>\${value} <button bs-button>Validate</button></form>`,
|
|
31
|
+
// components: [BsButton],
|
|
32
|
+
// });
|
|
33
|
+
//
|
|
34
|
+
// Validation.args = {
|
|
35
|
+
// required: true,
|
|
36
|
+
// };
|
|
37
|
+
//
|
|
38
|
+
// // eslint-disable-next-line
|
|
39
|
+
// export { Overview, Validation };
|
|
@@ -7,12 +7,17 @@ import { coerceBoolean } from '@ekzo-dev/toolkit';
|
|
|
7
7
|
import { Temporal } from '@js-temporal/polyfill';
|
|
8
8
|
import { bindable, BindingMode, customElement } from 'aurelia';
|
|
9
9
|
|
|
10
|
-
type
|
|
10
|
+
type Writable<T> = {
|
|
11
|
+
-readonly [P in keyof T]: T[P];
|
|
12
|
+
};
|
|
13
|
+
type Duration = Writable<
|
|
14
|
+
Partial<Pick<Temporal.Duration, 'years' | 'months' | 'days' | 'hours' | 'minutes' | 'seconds'>>
|
|
15
|
+
>;
|
|
11
16
|
type DurationLabels = {
|
|
12
17
|
[K in keyof Duration]: string;
|
|
13
18
|
};
|
|
14
19
|
|
|
15
|
-
const durationKeys = ['years', 'months', 'days', 'hours', 'minutes', 'seconds'] as const;
|
|
20
|
+
const durationKeys: (keyof Duration)[] = ['years', 'months', 'days', 'hours', 'minutes', 'seconds'] as const;
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* https://github.com/whatwg/html/issues/5488
|
|
@@ -81,7 +86,7 @@ export class BsDurationInput extends BaseField implements EventListenerObject {
|
|
|
81
86
|
}
|
|
82
87
|
|
|
83
88
|
handleEvent(event: KeyboardEvent | ClipboardEvent): void {
|
|
84
|
-
const data = event instanceof KeyboardEvent ? event.key : event.clipboardData
|
|
89
|
+
const data = event instanceof KeyboardEvent ? event.key : event.clipboardData!.getData('text');
|
|
85
90
|
|
|
86
91
|
// don't allow non-numeric values
|
|
87
92
|
if (!/^\d+$/.test(data)) {
|
|
@@ -101,10 +106,10 @@ export class BsDurationInput extends BaseField implements EventListenerObject {
|
|
|
101
106
|
private _parseDuration(value: string) {
|
|
102
107
|
try {
|
|
103
108
|
const duration = Temporal.Duration.from(value);
|
|
104
|
-
const result = {};
|
|
109
|
+
const result: Duration = {};
|
|
105
110
|
|
|
106
111
|
durationKeys.forEach((key) => {
|
|
107
|
-
result[key] = duration[key] ? duration[key]
|
|
112
|
+
result[key] = duration[key] ? duration[key] : undefined;
|
|
108
113
|
});
|
|
109
114
|
this.duration = result;
|
|
110
115
|
} catch (error) {
|
|
@@ -118,6 +123,7 @@ export class BsDurationInput extends BaseField implements EventListenerObject {
|
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
#getLabels(): DurationLabels {
|
|
126
|
+
// @ts-ignore
|
|
121
127
|
const str: string = new Intl['DurationFormat'](navigator.language, { style: 'narrow' }).format({
|
|
122
128
|
years: 1,
|
|
123
129
|
months: 1,
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { Meta, Story, StoryFnAureliaReturnType } from '@storybook/aurelia';
|
|
2
|
-
|
|
3
|
-
import { BsJsonInput } from '.';
|
|
4
|
-
|
|
5
|
-
const meta: Meta = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default meta;
|
|
11
|
-
|
|
12
|
-
const Overview: Story = (args): StoryFnAureliaReturnType => ({
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
Overview.args = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const JsonSchemaEditor: Story = (args): StoryFnAureliaReturnType => ({
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
JsonSchemaEditor.args = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
// eslint-disable-next-line
|
|
59
|
-
export { Overview, JsonSchemaEditor };
|
|
1
|
+
// import { Meta, Story, StoryFnAureliaReturnType } from '@storybook/aurelia';
|
|
2
|
+
//
|
|
3
|
+
// import { BsJsonInput } from '.';
|
|
4
|
+
//
|
|
5
|
+
// const meta: Meta = {
|
|
6
|
+
// title: 'Ekzo / Bootstrap Addons / Forms / Json input',
|
|
7
|
+
// component: BsJsonInput,
|
|
8
|
+
// };
|
|
9
|
+
//
|
|
10
|
+
// export default meta;
|
|
11
|
+
//
|
|
12
|
+
// const Overview: Story = (args): StoryFnAureliaReturnType => ({
|
|
13
|
+
// props: args,
|
|
14
|
+
// });
|
|
15
|
+
//
|
|
16
|
+
// Overview.args = {
|
|
17
|
+
// jsonSchema: {
|
|
18
|
+
// $schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
19
|
+
// type: 'object',
|
|
20
|
+
// properties: {
|
|
21
|
+
// enum: {
|
|
22
|
+
// type: 'string',
|
|
23
|
+
// enum: ['1', '2', '3'],
|
|
24
|
+
// },
|
|
25
|
+
// boolean: {
|
|
26
|
+
// type: 'boolean',
|
|
27
|
+
// },
|
|
28
|
+
// email: {
|
|
29
|
+
// type: 'string',
|
|
30
|
+
// format: 'email',
|
|
31
|
+
// },
|
|
32
|
+
// number: {
|
|
33
|
+
// type: 'number',
|
|
34
|
+
// multipleOf: 0.0001,
|
|
35
|
+
// },
|
|
36
|
+
// },
|
|
37
|
+
// required: ['enum'],
|
|
38
|
+
// },
|
|
39
|
+
// value: {
|
|
40
|
+
// number: 1.11,
|
|
41
|
+
// enum: '1',
|
|
42
|
+
// },
|
|
43
|
+
// };
|
|
44
|
+
//
|
|
45
|
+
// const JsonSchemaEditor: Story = (args): StoryFnAureliaReturnType => ({
|
|
46
|
+
// props: args,
|
|
47
|
+
// });
|
|
48
|
+
//
|
|
49
|
+
// JsonSchemaEditor.args = {
|
|
50
|
+
// jsonSchema: true,
|
|
51
|
+
// value: {
|
|
52
|
+
// $schema: 'http://json-schema.org/draft-07/schema#',
|
|
53
|
+
// type: 'object',
|
|
54
|
+
// properties: {},
|
|
55
|
+
// },
|
|
56
|
+
// };
|
|
57
|
+
//
|
|
58
|
+
// // eslint-disable-next-line
|
|
59
|
+
// export { Overview, JsonSchemaEditor };
|
|
@@ -21,7 +21,7 @@ import { ProxyObservable } from '@aurelia/runtime';
|
|
|
21
21
|
import { coerceBoolean } from '@ekzo-dev/toolkit';
|
|
22
22
|
import { JsonEditor } from '@ekzo-dev/vanilla-jsoneditor';
|
|
23
23
|
import { faUpRightAndDownLeftFromCenter } from '@fortawesome/free-solid-svg-icons/faUpRightAndDownLeftFromCenter';
|
|
24
|
-
import Ajv, { ErrorObject, Options } from 'ajv';
|
|
24
|
+
import Ajv, { type AnySchema, type ErrorObject, type Options } from 'ajv';
|
|
25
25
|
import Ajv2019 from 'ajv/dist/2019';
|
|
26
26
|
import Ajv2020 from 'ajv/dist/2020';
|
|
27
27
|
import addFormats from 'ajv-formats';
|
|
@@ -49,7 +49,7 @@ export class BsJsonInput {
|
|
|
49
49
|
@bindable(coerceBoolean)
|
|
50
50
|
disabled: boolean = false;
|
|
51
51
|
|
|
52
|
-
@bindable({ set: (v:
|
|
52
|
+
@bindable({ set: (v: unknown) => (v === '' || v === true || v === 'true' ? true : v) })
|
|
53
53
|
jsonSchema?: JSONSchema | SchemaNode | boolean;
|
|
54
54
|
|
|
55
55
|
@bindable()
|
|
@@ -77,7 +77,7 @@ export class BsJsonInput {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
onRenderValue = (props: RenderValueProps): RenderValueComponentDescription[] => {
|
|
80
|
-
let result: RenderValueComponentDescription[] | null;
|
|
80
|
+
// let result: RenderValueComponentDescription[] | null;
|
|
81
81
|
// const { jsonSchema } = this;
|
|
82
82
|
const { editorModule } = this.editorComponent;
|
|
83
83
|
|
|
@@ -86,7 +86,7 @@ export class BsJsonInput {
|
|
|
86
86
|
// result = editorModule.renderJSONSchemaEnum(props, jsonSchema, this.#getSchemaDefinitions(jsonSchema));
|
|
87
87
|
// }
|
|
88
88
|
|
|
89
|
-
return
|
|
89
|
+
return editorModule!.renderValue(props);
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
onRenderMenu = (items: MenuItem[]): MenuItem[] | undefined => {
|
|
@@ -140,12 +140,12 @@ export class BsJsonInput {
|
|
|
140
140
|
return this.required && (this.value == null || this.value === '');
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
get schemaVersion(): string {
|
|
143
|
+
get schemaVersion(): string | undefined {
|
|
144
144
|
if (this.jsonSchema !== true) return undefined;
|
|
145
145
|
|
|
146
|
-
const
|
|
146
|
+
const value = this.value as JSONSchema;
|
|
147
147
|
|
|
148
|
-
return value == null || value
|
|
148
|
+
return value == null || value.$schema == null ? '' : (value.$schema as string);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
get validator(): Validator | undefined {
|
|
@@ -172,7 +172,7 @@ export class BsJsonInput {
|
|
|
172
172
|
// do not validate empty documents
|
|
173
173
|
if (json === undefined) return [];
|
|
174
174
|
|
|
175
|
-
void ajv.validateSchema(json);
|
|
175
|
+
void ajv.validateSchema(json as AnySchema);
|
|
176
176
|
|
|
177
177
|
return rawThis.#processErrorsAjv(ajv.errors, json);
|
|
178
178
|
};
|
|
@@ -244,7 +244,7 @@ export class BsJsonInput {
|
|
|
244
244
|
return (schema.$defs ?? schema.definitions) as JSONSchemaDefinitions;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
#processErrorsAjv(errors: ErrorObject[] | null, json: unknown): ValidationError[] {
|
|
247
|
+
#processErrorsAjv(errors: ErrorObject[] | null | undefined, json: unknown): ValidationError[] {
|
|
248
248
|
const message = this.jsonSchema === true ? 'JSON is not a valid JSONSchema' : 'JSON does not match schema';
|
|
249
249
|
|
|
250
250
|
this.input.setCustomValidity(errors?.length ? message : '');
|
|
@@ -58,7 +58,7 @@ export class BsSelectDropdown extends BsSelect implements ICustomElementViewMode
|
|
|
58
58
|
setPopperConfig() {
|
|
59
59
|
const { host } = this;
|
|
60
60
|
const parentModal = host.closest('.modal-body,.popover-body,.offcanvas-body');
|
|
61
|
-
const dropdownMenu: HTMLElement = host.querySelector('.dropdown-menu')
|
|
61
|
+
const dropdownMenu: HTMLElement = host.querySelector('.dropdown-menu')!;
|
|
62
62
|
|
|
63
63
|
if (parentModal != null) {
|
|
64
64
|
this.popperConfig = {
|
|
@@ -67,7 +67,7 @@ export class BsSelectDropdown extends BsSelect implements ICustomElementViewMode
|
|
|
67
67
|
dropdownMenu.style.minWidth = `${host.offsetWidth}px`;
|
|
68
68
|
} else {
|
|
69
69
|
this.popperConfig = null;
|
|
70
|
-
dropdownMenu.style.minWidth =
|
|
70
|
+
dropdownMenu.style.minWidth = '';
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -75,8 +75,8 @@ export class BsSelectDropdown extends BsSelect implements ICustomElementViewMode
|
|
|
75
75
|
return `${this.id}${parentIndex != null ? '-g' + parentIndex.toString() : ''}-${index}`;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
selectOption(option
|
|
79
|
-
this.value = option
|
|
78
|
+
selectOption(option?: ISelectOption) {
|
|
79
|
+
this.value = option?.value;
|
|
80
80
|
this.#dispatchEvents();
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -85,7 +85,7 @@ export class BsSelectDropdown extends BsSelect implements ICustomElementViewMode
|
|
|
85
85
|
const { options, value } = this;
|
|
86
86
|
|
|
87
87
|
return Array.isArray(value)
|
|
88
|
-
? value.map((val) => (options as ISelectOption[]).find((option) => option.value === val)
|
|
88
|
+
? value.map((val) => (options as ISelectOption[]).find((option) => option.value === val)!.text).join(', ')
|
|
89
89
|
: '';
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -134,13 +134,16 @@ export class BsSelectDropdown extends BsSelect implements ICustomElementViewMode
|
|
|
134
134
|
options = Object.entries(options);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
// @ts-ignore
|
|
137
138
|
const isEntries = Array.isArray(options[0]);
|
|
138
139
|
let option = (options as Array<ISelectOption | readonly [unknown, string]>).find((option) => {
|
|
140
|
+
// @ts-ignore
|
|
139
141
|
const optionValue: unknown = isEntries ? option[0] : (option as ISelectOption).value;
|
|
140
142
|
|
|
141
143
|
if (optionValue == emptyValue) {
|
|
142
144
|
emptyOption = {
|
|
143
145
|
value: optionValue,
|
|
146
|
+
// @ts-ignore
|
|
144
147
|
text: isEntries ? (option[1] as string) : (option as ISelectOption).text,
|
|
145
148
|
} as ISelectOption;
|
|
146
149
|
}
|
|
@@ -149,6 +152,7 @@ export class BsSelectDropdown extends BsSelect implements ICustomElementViewMode
|
|
|
149
152
|
});
|
|
150
153
|
|
|
151
154
|
option =
|
|
155
|
+
// @ts-ignore
|
|
152
156
|
isEntries && option !== undefined ? { value: option[0], text: option[1] as string } : (option as ISelectOption);
|
|
153
157
|
|
|
154
158
|
// update value next tick
|
|
@@ -1,89 +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 };
|
|
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 };
|