dlg-ui 1.0.8 → 1.0.10
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/addon/components/content.hbs +8 -0
- package/addon/components/header-dropdown.hbs +1 -1
- package/addon/components/header-dropdown.js +9 -4
- package/addon/components/navbar.hbs +2 -2
- package/addon/components/navbar.js +3 -0
- package/addon/styles/addon.css +19 -0
- package/app/components/content.js +1 -0
- package/package.json +1 -1
|
@@ -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 _selectedOption = this.
|
|
7
|
+
@tracked _selectedOption = this.selectedOption;
|
|
8
|
+
|
|
9
|
+
get displaySelectedOption() {
|
|
10
|
+
if (this._selectedOption) {
|
|
11
|
+
return this._selectedOption.label;
|
|
12
|
+
} else {
|
|
13
|
+
return this.placeholder;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
8
16
|
|
|
9
17
|
get selectedOption() {
|
|
10
18
|
if (this.args.selectedOption) {
|
|
@@ -30,9 +38,6 @@ export default class DropdownComponent extends Component {
|
|
|
30
38
|
if (!this.args.options) {
|
|
31
39
|
throw new Error('Dropdown requires an options array');
|
|
32
40
|
}
|
|
33
|
-
if (!this.args.selectedOption) {
|
|
34
|
-
throw new Error('Header dropdown requires a selected option');
|
|
35
|
-
}
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
saveSelection(value) {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
@options={{option.dropdownOptions}}
|
|
24
24
|
@placeholder={{option.placeholder}}
|
|
25
25
|
@onSelect={{this.onSelect}}
|
|
26
|
-
@selectedOption={{
|
|
27
|
-
@preventDefault={{
|
|
26
|
+
@selectedOption={{this.selectedOption}}
|
|
27
|
+
@preventDefault={{option.preventDefault}}
|
|
28
28
|
/>
|
|
29
29
|
</div>
|
|
30
30
|
{{/if}}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { action } from '@ember/object';
|
|
3
3
|
import { service } from '@ember/service';
|
|
4
|
+
import { tracked } from '@glimmer/tracking';
|
|
4
5
|
|
|
5
6
|
export default class NavbarComponent extends Component {
|
|
6
7
|
@service router;
|
|
8
|
+
@tracked selectedOption = null;
|
|
7
9
|
|
|
8
10
|
get title() {
|
|
9
11
|
return this.args.title || 'dlg-ui';
|
|
@@ -31,6 +33,7 @@ export default class NavbarComponent extends Component {
|
|
|
31
33
|
|
|
32
34
|
@action
|
|
33
35
|
onSelect(value) {
|
|
36
|
+
this.selectedOption = value;
|
|
34
37
|
if (this.args.onSelect) {
|
|
35
38
|
this.args.onSelect(value);
|
|
36
39
|
}
|
package/addon/styles/addon.css
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
cursor: pointer;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
.content-wrapper {
|
|
6
|
+
display: flex;
|
|
7
|
+
height: 100%;
|
|
8
|
+
width: 100%;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
padding: 1em;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.content-header {
|
|
14
|
+
min-height: 20%;
|
|
15
|
+
height: fit-content;
|
|
16
|
+
margin-bottom: 1em;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.content-body {
|
|
20
|
+
min-height: 80%;
|
|
21
|
+
height: fit-content;
|
|
22
|
+
}
|
|
23
|
+
|
|
5
24
|
.dropdown-option {
|
|
6
25
|
border-bottom-style: solid;
|
|
7
26
|
border-width: 2px;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from 'dlg-ui/components/content';
|