@projectcaluma/ember-form 14.11.0 → 14.11.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.
@@ -1,10 +1,11 @@
1
- import { getOwner } from "@ember/application";
2
1
  import { action } from "@ember/object";
3
2
  import { inject as service } from "@ember/service";
4
3
  import Component from "@glimmer/component";
5
4
  import { tracked } from "@glimmer/tracking";
6
5
  import { DateTime } from "luxon";
7
6
 
7
+ import getConfig from "@projectcaluma/ember-core/utils/get-config";
8
+
8
9
  export default class CfFieldInputDateComponent extends Component {
9
10
  @service intl;
10
11
 
@@ -14,21 +15,13 @@ export default class CfFieldInputDateComponent extends Component {
14
15
  return this.intl.primaryLocale.split("-")[0];
15
16
  }
16
17
 
17
- get config() {
18
- return getOwner(this).resolveRegistration("config:environment");
19
- }
20
-
21
18
  get dateFormat() {
22
- const {
23
- FLATPICKR_DATE_FORMAT = {
24
- de: "d.m.Y",
25
- fr: "d.m.Y",
26
- en: "m/d/Y",
27
- },
28
- FLATPICKR_DATE_FORMAT_DEFAULT = "m/d/Y",
29
- } = this.config["ember-caluma"] || {};
19
+ const config = getConfig(this);
30
20
 
31
- return FLATPICKR_DATE_FORMAT[this.locale] ?? FLATPICKR_DATE_FORMAT_DEFAULT;
21
+ return (
22
+ config.FLATPICKR_DATE_FORMAT[this.locale] ??
23
+ config.FLATPICKR_DATE_FORMAT_DEFAULT
24
+ );
32
25
  }
33
26
 
34
27
  @action
@@ -1,7 +1,8 @@
1
- import { getOwner } from "@ember/application";
2
1
  import { action } from "@ember/object";
3
2
  import Component from "@glimmer/component";
4
3
 
4
+ import getConfig from "@projectcaluma/ember-core/utils/get-config";
5
+
5
6
  export default class CfFieldInputFloatComponent extends Component {
6
7
  get disabled() {
7
8
  return this.args.disabled || this.args.field?.question.isCalculated;
@@ -12,9 +13,7 @@ export default class CfFieldInputFloatComponent extends Component {
12
13
  return this.args.field.question.raw.floatStep;
13
14
  }
14
15
 
15
- const config = getOwner(this).resolveRegistration("config:environment");
16
- const { floatStep = 0.001 } = config["ember-caluma"] || {};
17
- return floatStep;
16
+ return getConfig(this).floatStep;
18
17
  }
19
18
 
20
19
  /**
@@ -1,4 +1,3 @@
1
- import { getOwner } from "@ember/application";
2
1
  import { action } from "@ember/object";
3
2
  import { inject as service } from "@ember/service";
4
3
  import { ensureSafeComponent } from "@embroider/util";
@@ -6,6 +5,8 @@ import Component from "@glimmer/component";
6
5
  import PowerSelectComponent from "ember-power-select/components/power-select";
7
6
  import PowerSelectMultipleComponent from "ember-power-select/components/power-select-multiple";
8
7
 
8
+ import getConfig from "@projectcaluma/ember-core/utils/get-config";
9
+
9
10
  /**
10
11
  * Dropdown component for the single and multiple choice question type
11
12
  *
@@ -39,10 +40,10 @@ export default class CfFieldInputPowerselectComponent extends Component {
39
40
  }
40
41
 
41
42
  get searchEnabled() {
42
- const config = getOwner(this).resolveRegistration("config:environment");
43
- const { powerSelectEnableSearchLimit = 10 } = config["ember-caluma"] || {};
44
-
45
- return this.args.field?.options?.length > powerSelectEnableSearchLimit;
43
+ return (
44
+ this.args.field?.options?.length >
45
+ getConfig(this).powerSelectEnableSearchLimit
46
+ );
46
47
  }
47
48
 
48
49
  get placeholder() {
@@ -1,7 +1,7 @@
1
1
  import { action } from "@ember/object";
2
2
  import Component from "@glimmer/component";
3
3
 
4
- export default class CfFieldInpuRadio extends Component {
4
+ export default class CfFieldInputRadio extends Component {
5
5
  isAnswerRemoved = (option) => {
6
6
  return (
7
7
  this.args.compare &&
@@ -1,20 +1,16 @@
1
- import { getOwner } from "@ember/application";
2
1
  import Component from "@glimmer/component";
3
2
 
3
+ import getConfig from "@projectcaluma/ember-core/utils/get-config";
4
+
4
5
  /**
5
6
  * Label component of the CfField
6
7
  *
7
8
  * @class CfFieldLabelComponent
8
9
  */
9
10
  export default class CfFieldLabelComponent extends Component {
10
- get config() {
11
- return getOwner(this).resolveRegistration("config:environment");
12
- }
13
-
14
11
  get useMandatoryAsterisk() {
15
- const { USE_MANDATORY_ASTERISK = false } =
16
- this.config["ember-caluma"] || {};
17
-
18
- return this.args.useMandatoryAsterisk ?? USE_MANDATORY_ASTERISK;
12
+ return (
13
+ this.args.useMandatoryAsterisk ?? getConfig(this).USE_MANDATORY_ASTERISK
14
+ );
19
15
  }
20
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-form",
3
- "version": "14.11.0",
3
+ "version": "14.11.1",
4
4
  "description": "Ember addon for rendering Caluma forms.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -39,7 +39,7 @@
39
39
  "luxon": "^3.5.0",
40
40
  "reactiveweb": "^1.3.0",
41
41
  "tracked-toolbox": "^2.0.0",
42
- "@projectcaluma/ember-core": "^14.11.0"
42
+ "@projectcaluma/ember-core": "^14.11.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@ember/optional-features": "2.3.0",
@@ -74,12 +74,12 @@
74
74
  "uikit": "3.25.6",
75
75
  "uuid": "13.0.0",
76
76
  "webpack": "5.104.1",
77
- "@projectcaluma/ember-workflow": "14.11.0",
78
- "@projectcaluma/ember-testing": "14.11.0"
77
+ "@projectcaluma/ember-testing": "14.11.1",
78
+ "@projectcaluma/ember-workflow": "14.11.1"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "ember-source": ">= 4.0.0",
82
- "@projectcaluma/ember-workflow": "^14.11.0"
82
+ "@projectcaluma/ember-workflow": "^14.11.1"
83
83
  },
84
84
  "dependenciesMeta": {
85
85
  "@projectcaluma/ember-core": {