dlg-ui 0.0.0 → 1.0.1
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.
|
@@ -4,7 +4,15 @@ import { tracked } from '@glimmer/tracking';
|
|
|
4
4
|
|
|
5
5
|
export default class DropdownComponent extends Component {
|
|
6
6
|
@tracked isOpen = false;
|
|
7
|
-
@tracked
|
|
7
|
+
@tracked _selectedOption = this.args.selectedOption;
|
|
8
|
+
|
|
9
|
+
get selectedOption() {
|
|
10
|
+
if (this.args.selectedOption) {
|
|
11
|
+
return this.args.selectedOption;
|
|
12
|
+
} else {
|
|
13
|
+
null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
8
16
|
|
|
9
17
|
get placeholder() {
|
|
10
18
|
if (this.args.placeholder) {
|
|
@@ -30,7 +38,9 @@ export default class DropdownComponent extends Component {
|
|
|
30
38
|
}
|
|
31
39
|
|
|
32
40
|
saveSelection(value) {
|
|
33
|
-
this.
|
|
41
|
+
if (!this.args.preventDefault) {
|
|
42
|
+
this._selectedOption = value;
|
|
43
|
+
}
|
|
34
44
|
this.args.onSelect(value);
|
|
35
45
|
}
|
|
36
46
|
|
|
@@ -4,7 +4,15 @@ import { tracked } from '@glimmer/tracking';
|
|
|
4
4
|
|
|
5
5
|
export default class DropdownComponent extends Component {
|
|
6
6
|
@tracked isOpen = false;
|
|
7
|
-
@tracked
|
|
7
|
+
@tracked _selectedOption = this.args.selectedOption;
|
|
8
|
+
|
|
9
|
+
get selectedOption() {
|
|
10
|
+
if (this.args.selectedOption) {
|
|
11
|
+
return this.args.selectedOption;
|
|
12
|
+
} else {
|
|
13
|
+
null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
8
16
|
|
|
9
17
|
get placeholder() {
|
|
10
18
|
if (this.args.placeholder) {
|
|
@@ -29,7 +37,7 @@ export default class DropdownComponent extends Component {
|
|
|
29
37
|
|
|
30
38
|
saveSelection(value) {
|
|
31
39
|
if (!this.args.preventDefault) {
|
|
32
|
-
this.
|
|
40
|
+
this._selectedOption = value;
|
|
33
41
|
}
|
|
34
42
|
this.args.onSelect(value);
|
|
35
43
|
}
|
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
<div class=
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
</div>
|
|
6
|
-
<div class="navbar-elements">
|
|
7
|
-
{{#each this.navbarOptions as |option|}}
|
|
8
|
-
{{#if (eq option.type "link")}}
|
|
9
|
-
<div class="navbar-selection" {{on "click" (fn this.onSelect option)}}>
|
|
10
|
-
{{option.label}}
|
|
11
|
-
</div>
|
|
12
|
-
{{/if}}
|
|
13
|
-
{{#if (eq option.type "dropdown")}}
|
|
14
|
-
<div class="navbar-selection">
|
|
15
|
-
<HeaderDropdown
|
|
16
|
-
@class="navbar-dropdown"
|
|
17
|
-
@options={{option.dropdownOptions}}
|
|
18
|
-
@placeholder={{option.placeholder}}
|
|
19
|
-
@onSelect={{this.onSelect}}
|
|
20
|
-
@selectedOption={{option}}
|
|
21
|
-
@preventDefault={{true}}
|
|
22
|
-
/>
|
|
23
|
-
</div>
|
|
24
|
-
{{/if}}
|
|
25
|
-
{{/each}}
|
|
26
|
-
</div>
|
|
1
|
+
<div class='navbar-wrapper'>
|
|
2
|
+
<div class='navbar-container'>
|
|
3
|
+
<div class='navbar-title'>
|
|
4
|
+
dlg-ui
|
|
27
5
|
</div>
|
|
28
|
-
<div class=
|
|
29
|
-
|
|
6
|
+
<div class='navbar-elements'>
|
|
7
|
+
{{#each this.navbarOptions as |option|}}
|
|
8
|
+
{{#if (eq option.type 'link')}}
|
|
9
|
+
<div
|
|
10
|
+
class='navbar-selection'
|
|
11
|
+
{{on 'click' (fn this.onSelect option)}}
|
|
12
|
+
>
|
|
13
|
+
{{option.label}}
|
|
14
|
+
</div>
|
|
15
|
+
{{/if}}
|
|
16
|
+
{{#if (eq option.type 'dropdown')}}
|
|
17
|
+
<div class='navbar-selection'>
|
|
18
|
+
<HeaderDropdown
|
|
19
|
+
@class='navbar-dropdown'
|
|
20
|
+
@options={{option.dropdownOptions}}
|
|
21
|
+
@placeholder={{option.placeholder}}
|
|
22
|
+
@onSelect={{this.onSelect}}
|
|
23
|
+
@selectedOption={{option}}
|
|
24
|
+
@preventDefault={{true}}
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
{{/if}}
|
|
28
|
+
{{/each}}
|
|
30
29
|
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<div class='navbar-yield'>
|
|
32
|
+
{{yield}}
|
|
33
|
+
</div>
|
|
31
34
|
</div>
|