-
Notifications
You must be signed in to change notification settings - Fork 32
/
index.js
71 lines (63 loc) · 2.77 KB
/
index.js
1
2
3
4
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"use strict";
module.exports = {
name: require("./package").name,
included(...args) {
this._super.included.apply(this, ...args);
const app = this._findHost(this);
const {
theme = null,
scrollErrorIntoView = false,
defaults = {},
} = app.options["ember-validated-form"] ?? {};
// Theming options
this.options["@embroider/macros"].setOwnConfig.isDefault = ![
"uikit",
"bootstrap",
].includes(theme);
this.options["@embroider/macros"].setOwnConfig.isUikit = theme === "uikit";
this.options["@embroider/macros"].setOwnConfig.isBootstrap =
theme === "bootstrap";
// Features
this.options["@embroider/macros"].setOwnConfig.scrollErrorIntoView =
scrollErrorIntoView;
// Component defaults
this.options["@embroider/macros"].setOwnConfig.error =
defaults.error ?? "ember-validated-form/components/validated-input/error";
this.options["@embroider/macros"].setOwnConfig.hint =
defaults.hint ?? "ember-validated-form/components/validated-input/hint";
this.options["@embroider/macros"].setOwnConfig.label =
defaults.label ?? "ember-validated-form/components/validated-input/label";
this.options["@embroider/macros"].setOwnConfig.render =
defaults.render ??
"ember-validated-form/components/validated-input/render";
this.options["@embroider/macros"].setOwnConfig.button =
defaults.button ??
"ember-validated-form/components/validated-button/button";
this.options["@embroider/macros"].setOwnConfig["types/checkbox-group"] =
defaults["types/checkbox-group"] ??
"ember-validated-form/components/validated-input/types/checkbox-group";
this.options["@embroider/macros"].setOwnConfig["types/checkbox"] =
defaults["types/checkbox"] ??
"ember-validated-form/components/validated-input/types/checkbox";
this.options["@embroider/macros"].setOwnConfig["types/input"] =
defaults["types/input"] ??
"ember-validated-form/components/validated-input/types/input";
this.options["@embroider/macros"].setOwnConfig["types/radio-group"] =
defaults["types/radio-group"] ??
"ember-validated-form/components/validated-input/types/radio-group";
this.options["@embroider/macros"].setOwnConfig["types/select"] =
defaults["types/select"] ??
"ember-validated-form/components/validated-input/types/select";
this.options["@embroider/macros"].setOwnConfig["types/textarea"] =
defaults["types/textarea"] ??
"ember-validated-form/components/validated-input/types/textarea";
this.options["@embroider/macros"].setOwnConfig["types/date"] =
defaults["types/date"] ??
"ember-validated-form/components/validated-input/types/input";
},
options: {
"@embroider/macros": {
setOwnConfig: {},
},
},
};