dlg-ui 1.0.37 → 1.0.38
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/button-primary.js +4 -4
- package/addon/components/checkbox-group.hbs +13 -13
- package/addon/components/checkbox-group.js +24 -24
- package/addon/components/checkbox.hbs +11 -6
- package/addon/components/checkbox.js +16 -16
- package/addon/components/date-picker.hbs +8 -8
- package/addon/components/date-picker.js +13 -13
- package/addon/components/dropdown.hbs +1 -1
- package/addon/components/dropdown.js +1 -1
- package/addon/components/fly-in.js +55 -52
- package/addon/components/footer.hbs +10 -0
- package/addon/components/form/field.js +18 -18
- package/addon/components/form.js +24 -24
- package/addon/components/header-dropdown.js +2 -2
- package/addon/components/modal.js +21 -21
- package/addon/components/navbar.hbs +29 -36
- package/addon/components/radio.hbs +21 -21
- package/addon/components/radio.js +2 -2
- package/addon/components/scaffold.hbs +15 -0
- package/addon/components/text-input.hbs +11 -11
- package/addon/components/text-input.js +15 -16
- package/addon/styles/dropdown.css +3 -3
- package/addon/styles/footer.css +14 -0
- package/addon/styles/navbar.css +4 -4
- package/addon/validations/base-validator.js +7 -7
- package/addon/validations/presence.js +21 -18
- package/addon/validations/validation-builder.js +20 -20
- package/app/components/button-primary.js +1 -1
- package/app/components/checkbox-group.js +1 -1
- package/app/components/checkbox.js +1 -1
- package/app/components/date-picker.js +1 -1
- package/app/components/fly-in.js +1 -1
- package/app/components/footer.js +1 -0
- package/app/components/form/field.js +1 -1
- package/app/components/form.js +1 -1
- package/app/components/modal.js +1 -1
- package/app/components/scaffold.js +1 -0
- package/app/components/text-input.js +1 -1
- package/index.js +1 -1
- package/package.json +3 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
|
|
3
3
|
export default class ButtonPrimaryComponent extends Component {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
4
|
+
onClick = () => {
|
|
5
|
+
if (this.args.onClick) {
|
|
6
|
+
this.args.onClick();
|
|
8
7
|
}
|
|
8
|
+
};
|
|
9
9
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<div class={{@class}} {{did-insert this.initCheckboxGroup}}>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
<div class='label'>
|
|
3
|
+
{{@label}}
|
|
4
|
+
</div>
|
|
5
|
+
<div>
|
|
6
|
+
{{#each @options as |option|}}
|
|
7
|
+
<Checkbox
|
|
8
|
+
@model={{this.value}}
|
|
9
|
+
@valuePath={{option.label}}
|
|
10
|
+
@option={{option}}
|
|
11
|
+
@onChange={{this.onChange}}
|
|
12
|
+
/>
|
|
13
|
+
{{/each}}
|
|
14
|
+
</div>
|
|
15
15
|
</div>
|
|
@@ -2,30 +2,30 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import { get, set } from '@ember/object';
|
|
3
3
|
|
|
4
4
|
export default class CheckboxGroupComponent extends Component {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
set value(newValue) {
|
|
11
|
-
set(this.args.model, this.args.valuePath, newValue);
|
|
12
|
-
return newValue;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
initCheckboxGroup = () => {
|
|
16
|
-
if (typeof this.value !== 'object') {
|
|
17
|
-
this.value = {};
|
|
18
|
-
}
|
|
19
|
-
this.args.options.forEach(option => {
|
|
20
|
-
if (this.value[option.label] === undefined) {
|
|
21
|
-
set(this.value, option.label, false);
|
|
22
|
-
} else {
|
|
23
|
-
set(this.value, option.label, this.value[option.label]);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
5
|
+
get value() {
|
|
6
|
+
const value = get(this.args.model, this.args.valuePath);
|
|
7
|
+
return value !== undefined ? value : this.placeholder;
|
|
8
|
+
}
|
|
27
9
|
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
set value(newValue) {
|
|
11
|
+
set(this.args.model, this.args.valuePath, newValue);
|
|
12
|
+
return newValue;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
initCheckboxGroup = () => {
|
|
16
|
+
if (typeof this.value !== 'object') {
|
|
17
|
+
this.value = {};
|
|
30
18
|
}
|
|
19
|
+
this.args.options.forEach((option) => {
|
|
20
|
+
if (this.value[option.label] === undefined) {
|
|
21
|
+
set(this.value, option.label, false);
|
|
22
|
+
} else {
|
|
23
|
+
set(this.value, option.label, this.value[option.label]);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
onChange = (value) => {
|
|
29
|
+
this.args.onChange?.(value);
|
|
30
|
+
};
|
|
31
31
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
<div class={{@class}}>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<div class=
|
|
2
|
+
<div class='label'>
|
|
3
|
+
{{@label}}
|
|
4
|
+
</div>
|
|
5
|
+
<div class='checkbox-container'>
|
|
6
6
|
<div>
|
|
7
|
-
<input
|
|
8
|
-
|
|
7
|
+
<input
|
|
8
|
+
type='checkbox'
|
|
9
|
+
id='checkboxId'
|
|
10
|
+
checked={{this.value}}
|
|
11
|
+
{{on 'change' this.onChange}}
|
|
12
|
+
/>
|
|
13
|
+
<label for='checkboxId'>{{@option.label}}</label>
|
|
9
14
|
</div>
|
|
10
15
|
</div>
|
|
11
16
|
</div>
|
|
@@ -2,22 +2,22 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import { get, set } from '@ember/object';
|
|
3
3
|
|
|
4
4
|
export default class CheckboxComponent extends Component {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
get value() {
|
|
6
|
+
const value = get(this.args.model, this.args.valuePath);
|
|
7
|
+
return value !== undefined ? value : this.placeholder;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
set value(newValue) {
|
|
11
|
+
set(this.args.model, this.args.valuePath, newValue);
|
|
12
|
+
return newValue;
|
|
13
|
+
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
this.args.onChange?.(this.value);
|
|
15
|
+
onChange = () => {
|
|
16
|
+
if (this.value === undefined) {
|
|
17
|
+
this.value = true;
|
|
18
|
+
} else {
|
|
19
|
+
this.value = !this.value;
|
|
22
20
|
}
|
|
21
|
+
this.args.onChange?.(this.value);
|
|
22
|
+
};
|
|
23
23
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<div class=
|
|
2
|
-
<div class=
|
|
3
|
-
{{
|
|
1
|
+
<div class='date-picker-wrapper {{@class}}'>
|
|
2
|
+
<div class='label'>
|
|
3
|
+
{{@label}}
|
|
4
4
|
</div>
|
|
5
5
|
<input
|
|
6
|
-
class=
|
|
7
|
-
type=
|
|
8
|
-
id=
|
|
9
|
-
name=
|
|
6
|
+
class='date-picker'
|
|
7
|
+
type='date'
|
|
8
|
+
id='start'
|
|
9
|
+
name='trip-start'
|
|
10
10
|
value={{this.value}}
|
|
11
|
-
{{on
|
|
11
|
+
{{on 'input' this.onChange}}
|
|
12
12
|
/>
|
|
13
13
|
</div>
|
|
@@ -2,18 +2,18 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import { get, set } from '@ember/object';
|
|
3
3
|
|
|
4
4
|
export default class DatePickerComponent extends Component {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
set value(newValue) {
|
|
11
|
-
set(this.args.model, this.args.valuePath, newValue);
|
|
12
|
-
return newValue;
|
|
13
|
-
}
|
|
5
|
+
get value() {
|
|
6
|
+
const value = get(this.args.model, this.args.valuePath);
|
|
7
|
+
return value !== undefined ? value : this.placeholder;
|
|
8
|
+
}
|
|
14
9
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
set value(newValue) {
|
|
11
|
+
set(this.args.model, this.args.valuePath, newValue);
|
|
12
|
+
return newValue;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
onChange = (event) => {
|
|
16
|
+
this.value = event.target.value;
|
|
17
|
+
this.args.onChange?.(this.value);
|
|
18
|
+
};
|
|
19
19
|
}
|
|
@@ -35,7 +35,7 @@ export default class DropdownComponent extends Component {
|
|
|
35
35
|
const value = get(this.args.model, this.args.valuePath);
|
|
36
36
|
return value !== undefined ? value : this.placeholder;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
set value(newValue) {
|
|
40
40
|
set(this.args.model, this.args.valuePath, newValue);
|
|
41
41
|
return newValue;
|
|
@@ -2,56 +2,59 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import { action } from '@ember/object';
|
|
3
3
|
|
|
4
4
|
export default class FlyInComponent extends Component {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
5
|
+
get activeWidth() {
|
|
6
|
+
return this.args.activeWidth || '300px';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
get icon() {
|
|
10
|
+
return this.args.icon || null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get imageSrc() {
|
|
14
|
+
return (
|
|
15
|
+
this.args.imageSrc ||
|
|
16
|
+
'https://cdn.nba.com/headshots/nba/latest/1040x760/2544.png'
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get title() {
|
|
21
|
+
return this.args.title || 'Title';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get titleOffset() {
|
|
25
|
+
return this.args.titleOffset || '15%';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get yPercentage() {
|
|
29
|
+
return this.args.yPercentage || '10%';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@action
|
|
33
|
+
configContent(element) {
|
|
34
|
+
element.style.right = this.titleOffset;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@action
|
|
38
|
+
configWrapper(element) {
|
|
39
|
+
element.style.top = this.yPercentage;
|
|
40
|
+
|
|
41
|
+
element.addEventListener('mouseenter', async () => {
|
|
42
|
+
element.style.minWidth = this.activeWidth;
|
|
43
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
44
|
+
let dropdown = element.querySelector('.fly-in-dropdown');
|
|
45
|
+
if (dropdown) {
|
|
46
|
+
dropdown.style.display = 'block';
|
|
47
|
+
dropdown.classList.add('fly-in-dropdown-hover');
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
element.addEventListener('mouseleave', async () => {
|
|
51
|
+
element.style.minWidth = '';
|
|
52
|
+
element.querySelector('.fly-in-dropdown').style.display = 'none';
|
|
53
|
+
let dropdown = element.querySelector('.fly-in-dropdown');
|
|
54
|
+
if (dropdown) {
|
|
55
|
+
dropdown.style.display = 'none';
|
|
56
|
+
dropdown.classList.remove('fly-in-dropdown-hover');
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
57
60
|
}
|
|
@@ -2,28 +2,28 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import PresenceValidator from '../../validations/presence';
|
|
3
3
|
|
|
4
4
|
export default class FormFieldComponent extends Component {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
get error() {
|
|
6
|
+
return this.args.errors?.[this.args.valuePath] || null;
|
|
7
|
+
}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
get fieldType() {
|
|
10
|
+
return this.args.field?.constructor?.name || null;
|
|
11
|
+
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
get didValidate() {
|
|
14
|
+
return this.args.didValidate;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
if (this.args.required) {
|
|
20
|
+
this.args.addValidator(new PresenceValidator(this.args.valuePath));
|
|
22
21
|
}
|
|
22
|
+
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
24
|
+
onChange = () => {
|
|
25
|
+
if (this.didValidate) {
|
|
26
|
+
this.args.validate();
|
|
28
27
|
}
|
|
28
|
+
};
|
|
29
29
|
}
|
package/addon/components/form.js
CHANGED
|
@@ -3,34 +3,34 @@ import ValidationBuilder from '../validations/validation-builder';
|
|
|
3
3
|
import { tracked } from '@glimmer/tracking';
|
|
4
4
|
|
|
5
5
|
export default class FormComponent extends Component {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
@tracked validations = new ValidationBuilder();
|
|
7
|
+
@tracked errors = null;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
get submitButtonText() {
|
|
14
|
-
return this.args.submitButtonText || 'Submit';
|
|
15
|
-
}
|
|
9
|
+
get didValidate() {
|
|
10
|
+
return this.validations.didValidate;
|
|
11
|
+
}
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
get submitButtonText() {
|
|
14
|
+
return this.args.submitButtonText || 'Submit';
|
|
15
|
+
}
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (errors) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
17
|
+
addValidator = (validator) => {
|
|
18
|
+
this.validations.addValidation(validator);
|
|
19
|
+
};
|
|
27
20
|
|
|
28
|
-
|
|
21
|
+
submitForm = async () => {
|
|
22
|
+
let errors = await this.validate();
|
|
23
|
+
console.log(errors);
|
|
24
|
+
if (errors) {
|
|
25
|
+
return;
|
|
29
26
|
}
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
this.args.onSubmit?.();
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
validate = async () => {
|
|
32
|
+
let errors = await this.validations.validate(this.args.model);
|
|
33
|
+
this.errors = errors;
|
|
34
|
+
return errors;
|
|
35
|
+
};
|
|
36
36
|
}
|
|
@@ -29,7 +29,7 @@ export default class DropdownComponent extends Component {
|
|
|
29
29
|
const value = get(this.args.model, this.args.valuePath);
|
|
30
30
|
return value !== undefined ? value : this.placeholder;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
set value(newValue) {
|
|
34
34
|
set(this.args.model, this.args.valuePath, newValue);
|
|
35
35
|
return newValue;
|
|
@@ -74,7 +74,7 @@ export default class DropdownComponent extends Component {
|
|
|
74
74
|
|
|
75
75
|
@action
|
|
76
76
|
makeSelection(option) {
|
|
77
|
-
if (option.value === this.value) {
|
|
77
|
+
if (option.value != undefined && option.value === this.value) {
|
|
78
78
|
this.saveSelection(null);
|
|
79
79
|
} else {
|
|
80
80
|
this.saveSelection(option);
|
|
@@ -2,28 +2,28 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import { faCircleXmark } from '@fortawesome/free-solid-svg-icons';
|
|
3
3
|
|
|
4
4
|
export default class ModalComponent extends Component {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
get isOpen() {
|
|
6
|
+
return this.args.isOpen ?? false;
|
|
7
|
+
}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
get icon() {
|
|
10
|
+
return faCircleXmark;
|
|
11
|
+
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
get secondaryButtonText() {
|
|
18
|
-
return this.args.secondaryButtonText || 'Cancel';
|
|
19
|
-
}
|
|
13
|
+
get primaryButtonText() {
|
|
14
|
+
return this.args.primaryButtonText || 'Done';
|
|
15
|
+
}
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
get secondaryButtonText() {
|
|
18
|
+
return this.args.secondaryButtonText || 'Cancel';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
acceptAndClose = () => {
|
|
22
|
+
this.args.onAccept?.();
|
|
23
|
+
this.toggleModal();
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
toggleModal = () => {
|
|
27
|
+
this.args.toggleModal?.();
|
|
28
|
+
};
|
|
29
29
|
}
|
|
@@ -1,39 +1,32 @@
|
|
|
1
|
-
<div class='navbar-
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
{{this.title}}
|
|
8
|
-
</div>
|
|
9
|
-
<div class='navbar-elements'>
|
|
10
|
-
{{#each this.navbarOptions as |option|}}
|
|
11
|
-
{{#if (eq option.type 'link')}}
|
|
12
|
-
<div
|
|
13
|
-
class='navbar-selection cursor-pointer'
|
|
14
|
-
{{on 'click' (fn this.onSelect option)}}
|
|
15
|
-
>
|
|
16
|
-
{{option.label}}
|
|
17
|
-
</div>
|
|
18
|
-
{{/if}}
|
|
19
|
-
{{#if (eq option.type 'dropdown')}}
|
|
20
|
-
<div class='navbar-selection cursor-pointer'>
|
|
21
|
-
<HeaderDropdown
|
|
22
|
-
@class='navbar-dropdown'
|
|
23
|
-
@options={{option.dropdownOptions}}
|
|
24
|
-
@placeholder={{option.placeholder}}
|
|
25
|
-
@onSelect={{this.onSelect}}
|
|
26
|
-
@selectedOption={{this.selectedOption}}
|
|
27
|
-
@preventDefault={{option.preventDefault}}
|
|
28
|
-
/>
|
|
29
|
-
</div>
|
|
30
|
-
{{/if}}
|
|
31
|
-
{{/each}}
|
|
32
|
-
</div>
|
|
1
|
+
<div class='navbar-container'>
|
|
2
|
+
<div
|
|
3
|
+
class='navbar-title cursor-pointer'
|
|
4
|
+
{{on 'click' (fn this.onSelect this.homeRoute)}}
|
|
5
|
+
>
|
|
6
|
+
{{this.title}}
|
|
33
7
|
</div>
|
|
34
|
-
<div class='navbar-
|
|
35
|
-
|
|
36
|
-
{{
|
|
37
|
-
|
|
8
|
+
<div class='navbar-elements'>
|
|
9
|
+
{{#each this.navbarOptions as |option|}}
|
|
10
|
+
{{#if (eq option.type 'link')}}
|
|
11
|
+
<div
|
|
12
|
+
class='navbar-selection cursor-pointer'
|
|
13
|
+
{{on 'click' (fn this.onSelect option)}}
|
|
14
|
+
>
|
|
15
|
+
{{option.label}}
|
|
16
|
+
</div>
|
|
17
|
+
{{/if}}
|
|
18
|
+
{{#if (eq option.type 'dropdown')}}
|
|
19
|
+
<div class='navbar-selection cursor-pointer'>
|
|
20
|
+
<HeaderDropdown
|
|
21
|
+
@class='navbar-dropdown'
|
|
22
|
+
@options={{option.dropdownOptions}}
|
|
23
|
+
@placeholder={{option.placeholder}}
|
|
24
|
+
@onSelect={{this.onSelect}}
|
|
25
|
+
@selectedOption={{this.selectedOption}}
|
|
26
|
+
@preventDefault={{option.preventDefault}}
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
{{/if}}
|
|
30
|
+
{{/each}}
|
|
38
31
|
</div>
|
|
39
32
|
</div>
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
<div class=
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
</div>
|
|
6
|
-
{{/if}}
|
|
7
|
-
<div class="radio-options">
|
|
8
|
-
{{#each this.options as |option|}}
|
|
9
|
-
<div class="radio-option">
|
|
10
|
-
<input
|
|
11
|
-
type="radio"
|
|
12
|
-
id={{option.label}}
|
|
13
|
-
checked={{eq option.label this.value.label}}
|
|
14
|
-
name={{this.args.name}}
|
|
15
|
-
{{on "change" (fn this.onChange option)}}
|
|
16
|
-
/>
|
|
17
|
-
<label for={{option.label}}>
|
|
18
|
-
{{option.label}}
|
|
19
|
-
</label>
|
|
20
|
-
</div>
|
|
21
|
-
{{/each}}
|
|
1
|
+
<div class='radio-container {{@class}}'>
|
|
2
|
+
{{#if @label}}
|
|
3
|
+
<div class='label'>
|
|
4
|
+
{{@label}}
|
|
22
5
|
</div>
|
|
6
|
+
{{/if}}
|
|
7
|
+
<div class='radio-options'>
|
|
8
|
+
{{#each this.options as |option|}}
|
|
9
|
+
<div class='radio-option'>
|
|
10
|
+
<input
|
|
11
|
+
type='radio'
|
|
12
|
+
id={{option.label}}
|
|
13
|
+
checked={{eq option.label this.value.label}}
|
|
14
|
+
name={{@name}}
|
|
15
|
+
{{on 'change' (fn this.onChange option)}}
|
|
16
|
+
/>
|
|
17
|
+
<label for={{option.label}}>
|
|
18
|
+
{{option.label}}
|
|
19
|
+
</label>
|
|
20
|
+
</div>
|
|
21
|
+
{{/each}}
|
|
22
|
+
</div>
|
|
23
23
|
</div>
|
|
@@ -13,7 +13,7 @@ export default class RadioComponent extends Component {
|
|
|
13
13
|
const value = get(this.args.model, this.args.valuePath);
|
|
14
14
|
return value !== undefined ? value : this.placeholder;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
set value(newValue) {
|
|
18
18
|
set(this.args.model, this.args.valuePath, newValue);
|
|
19
19
|
return newValue;
|
|
@@ -22,5 +22,5 @@ export default class RadioComponent extends Component {
|
|
|
22
22
|
onChange = (option) => {
|
|
23
23
|
this.value = option.value;
|
|
24
24
|
this.args.onChange?.(option);
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
26
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div class='scaffold-wrapper'>
|
|
2
|
+
<Navbar @options={{@options}} @title={{@title}} />
|
|
3
|
+
<div class='scaffold-yield'>
|
|
4
|
+
<div class='scaffold-body'>
|
|
5
|
+
{{yield to='body'}}
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
{{#if (has-block 'footer')}}
|
|
9
|
+
<Footer @footerTag={{@footerTag}}>
|
|
10
|
+
{{yield to='footer'}}
|
|
11
|
+
</Footer>
|
|
12
|
+
{{else}}
|
|
13
|
+
<Footer @footerTag={{@footerTag}} />
|
|
14
|
+
{{/if}}
|
|
15
|
+
</div>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<div class=
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
<div class='text-input-wrapper'>
|
|
2
|
+
<div class='label'>
|
|
3
|
+
{{@label}}
|
|
4
|
+
</div>
|
|
5
|
+
<input
|
|
6
|
+
type='text'
|
|
7
|
+
class='text-input'
|
|
8
|
+
placeholder={{@placeholder}}
|
|
9
|
+
value={{this.value}}
|
|
10
|
+
{{on 'input' this.updateValue}}
|
|
11
|
+
/>
|
|
12
12
|
</div>
|
|
@@ -2,23 +2,22 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import { get, set } from '@ember/object';
|
|
3
3
|
|
|
4
4
|
export default class TextInputComponent extends Component {
|
|
5
|
+
get placeholder() {
|
|
6
|
+
return this.args.placeholder || 'Enter text...';
|
|
7
|
+
}
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
get value() {
|
|
10
|
+
const value = get(this.args.model, this.args.valuePath);
|
|
11
|
+
return value !== undefined ? value : null;
|
|
12
|
+
}
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
set value(newValue) {
|
|
15
|
+
set(this.args.model, this.args.valuePath, newValue);
|
|
16
|
+
return newValue;
|
|
17
|
+
}
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
updateValue = (event) => {
|
|
21
|
-
this.value = event.target.value;
|
|
22
|
-
this.args.onChange?.(this.value);
|
|
23
|
-
}
|
|
19
|
+
updateValue = (event) => {
|
|
20
|
+
this.value = event.target.value;
|
|
21
|
+
this.args.onChange?.(this.value);
|
|
22
|
+
};
|
|
24
23
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
.dropdown-options {
|
|
24
24
|
white-space: normal;
|
|
25
25
|
max-height: 0;
|
|
26
|
-
overflow-wrap:
|
|
26
|
+
overflow-wrap: anywhere;
|
|
27
27
|
border-style: solid;
|
|
28
28
|
border-top-style: none;
|
|
29
29
|
border-bottom-style: none;
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
|
|
98
98
|
.header-dropdown-options {
|
|
99
99
|
white-space: normal;
|
|
100
|
-
overflow-wrap:
|
|
100
|
+
overflow-wrap: anywhere;
|
|
101
101
|
border-style: solid;
|
|
102
102
|
border-top-style: none;
|
|
103
103
|
border-bottom-style: none;
|
|
@@ -167,4 +167,4 @@
|
|
|
167
167
|
.header-dropdown-wrapper {
|
|
168
168
|
width: 100%;
|
|
169
169
|
position: relative;
|
|
170
|
-
}
|
|
170
|
+
}
|
package/addon/styles/navbar.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.
|
|
1
|
+
.scaffold-body {
|
|
2
2
|
flex: 1 1 auto;
|
|
3
3
|
padding: 0 1em;
|
|
4
4
|
}
|
|
@@ -76,15 +76,15 @@
|
|
|
76
76
|
align-items: center;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
.
|
|
79
|
+
.scaffold-wrapper {
|
|
80
80
|
display: flex;
|
|
81
81
|
flex-direction: column;
|
|
82
82
|
min-height: 100vh;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
.
|
|
85
|
+
.scaffold-yield {
|
|
86
86
|
display: flex;
|
|
87
87
|
justify-content: center;
|
|
88
88
|
flex: 1 1 auto;
|
|
89
89
|
padding-top: 8px;
|
|
90
|
-
}
|
|
90
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { tracked } from '@glimmer/tracking';
|
|
2
2
|
|
|
3
3
|
export default class BaseValidator {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
@tracked errorMessage = '';
|
|
5
|
+
@tracked isValid = false;
|
|
6
|
+
@tracked valuePath = '';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
8
|
+
validate(value) {
|
|
9
|
+
throw new Error('The validate method must be implemented by subclasses');
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import BaseValidator from './base-validator';
|
|
2
2
|
|
|
3
3
|
export default class PresenceValidator extends BaseValidator {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
validate(value) {
|
|
10
|
-
if (value === ''
|
|
11
|
-
|| value === null
|
|
12
|
-
|| value === undefined
|
|
13
|
-
|| (typeof value === 'boolean' && value === false)
|
|
14
|
-
|| (typeof value === 'object' && !Object.values(value).some(v => v ? true : false))) {
|
|
15
|
-
this.errorMessage = 'This field is required';
|
|
16
|
-
this.isValid = false;
|
|
17
|
-
return this.errorMessage;
|
|
18
|
-
}
|
|
4
|
+
constructor(valuePath) {
|
|
5
|
+
super();
|
|
6
|
+
this.valuePath = valuePath;
|
|
7
|
+
}
|
|
19
8
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
validate(value) {
|
|
10
|
+
if (
|
|
11
|
+
value === '' ||
|
|
12
|
+
value === null ||
|
|
13
|
+
value === undefined ||
|
|
14
|
+
(typeof value === 'boolean' && value === false) ||
|
|
15
|
+
(typeof value === 'object' &&
|
|
16
|
+
!Object.values(value).some((v) => (v ? true : false)))
|
|
17
|
+
) {
|
|
18
|
+
this.errorMessage = 'This field is required';
|
|
19
|
+
this.isValid = false;
|
|
20
|
+
return this.errorMessage;
|
|
23
21
|
}
|
|
22
|
+
|
|
23
|
+
this.isValid = true;
|
|
24
|
+
this.errorMessage = null;
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
24
27
|
}
|
|
@@ -2,27 +2,27 @@ import { tracked } from '@glimmer/tracking';
|
|
|
2
2
|
import { get } from '@ember/object';
|
|
3
3
|
|
|
4
4
|
export default class ValidationBuilder {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
@tracked validations;
|
|
6
|
+
@tracked didValidate = false;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
constructor() {
|
|
9
|
+
this.validations = [];
|
|
10
|
+
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
addValidation(validator) {
|
|
13
|
+
this.validations.push(validator);
|
|
14
|
+
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
this.didValidate = true;
|
|
26
|
-
return Object.keys(errors).length ? errors : null;
|
|
16
|
+
async validate(model) {
|
|
17
|
+
let errors = {};
|
|
18
|
+
for (let validator of this.validations) {
|
|
19
|
+
const value = get(model, validator.valuePath);
|
|
20
|
+
await validator.validate(value);
|
|
21
|
+
if (!validator.isValid) {
|
|
22
|
+
errors[validator.valuePath] = validator.errorMessage;
|
|
23
|
+
}
|
|
27
24
|
}
|
|
28
|
-
|
|
25
|
+
this.didValidate = true;
|
|
26
|
+
return Object.keys(errors).length ? errors : null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from 'dlg-ui/components/button-primary';
|
|
1
|
+
export { default } from 'dlg-ui/components/button-primary';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from 'dlg-ui/components/checkbox-group';
|
|
1
|
+
export { default } from 'dlg-ui/components/checkbox-group';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from 'dlg-ui/components/checkbox';
|
|
1
|
+
export { default } from 'dlg-ui/components/checkbox';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from 'dlg-ui/components/date-picker';
|
|
1
|
+
export { default } from 'dlg-ui/components/date-picker';
|
package/app/components/fly-in.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from 'dlg-ui/components/fly-in';
|
|
1
|
+
export { default } from 'dlg-ui/components/fly-in';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from 'dlg-ui/components/footer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from 'dlg-ui/components/form/field';
|
|
1
|
+
export { default } from 'dlg-ui/components/form/field';
|
package/app/components/form.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from 'dlg-ui/components/form';
|
|
1
|
+
export { default } from 'dlg-ui/components/form';
|
package/app/components/modal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from 'dlg-ui/components/modal';
|
|
1
|
+
export { default } from 'dlg-ui/components/modal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from 'dlg-ui/components/scaffold';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from 'dlg-ui/components/text-input';
|
|
1
|
+
export { default } from 'dlg-ui/components/text-input';
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dlg-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.38",
|
|
4
4
|
"description": "The default blueprint for ember-cli addons.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"lint:js:fix": "eslint . --fix",
|
|
23
23
|
"start": "ember serve",
|
|
24
24
|
"test": "npm-run-all --print-name \"lint\" \"test:*\"",
|
|
25
|
-
"test:ember": "ember test"
|
|
26
|
-
"test:ember-compatibility": "ember try:each"
|
|
25
|
+
"test:ember": "ember test"
|
|
27
26
|
},
|
|
28
27
|
"dependencies": {
|
|
29
28
|
"@ember/string": "^3.1.1",
|
|
30
29
|
"@fortawesome/ember-fontawesome": "^3.1.0",
|
|
31
30
|
"@fortawesome/fontawesome-svg-core": "^7.1.0",
|
|
32
31
|
"@fortawesome/free-solid-svg-icons": "^7.1.0",
|
|
32
|
+
"broccoli-funnel": "^3.0.8",
|
|
33
33
|
"ember-auto-import": "^2.4.3",
|
|
34
34
|
"ember-cli-babel": "^8.2.0",
|
|
35
35
|
"ember-cli-htmlbars": "^6.3.0"
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"@glimmer/component": "^1.1.2",
|
|
46
46
|
"babel-eslint": "^10.1.0",
|
|
47
47
|
"broccoli-asset-rev": "^3.0.0",
|
|
48
|
-
"broccoli-funnel": "^3.0.8",
|
|
49
48
|
"broccoli-merge-trees": "^4.2.0",
|
|
50
49
|
"ember-cli": "~4.12.0",
|
|
51
50
|
"ember-cli-dependency-checker": "^3.3.1",
|
|
@@ -58,7 +57,6 @@
|
|
|
58
57
|
"ember-qunit": "^6.0.0",
|
|
59
58
|
"ember-resolver": "^10.0.0",
|
|
60
59
|
"ember-source": "~5.4.0",
|
|
61
|
-
"ember-source-channel-url": "^3.0.0",
|
|
62
60
|
"ember-template-lint": "^4.16.1",
|
|
63
61
|
"ember-truth-helpers": "^4.0.3",
|
|
64
62
|
"eslint": "^7.32.0",
|