@projectcaluma/ember-core 14.10.3 → 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.
@@ -0,0 +1,40 @@
1
+ import { getOwner } from "@ember/application";
2
+ import { getEngineParent } from "@ember/engine";
3
+
4
+ const DEFAULTS = {
5
+ floatStep: 0.001,
6
+ powerSelectEnableSearchLimit: 10,
7
+ USE_MANDATORY_ASTERISK: false,
8
+ FLATPICKR_DATE_FORMAT: {
9
+ de: "d.m.Y",
10
+ fr: "d.m.Y",
11
+ en: "m/d/Y",
12
+ },
13
+ FLATPICKR_DATE_FORMAT_DEFAULT: "m/d/Y",
14
+ };
15
+
16
+ /**
17
+ * Resolve the host application's `ember-caluma` configuration, merged with the
18
+ * addon defaults.
19
+ *
20
+ * Ember engines have their own, isolated `config:environment`. Resolving config
21
+ * off an engine's own owner (e.g. via `getOwner(this)`) therefore yields the
22
+ * engine's config instead of the host application's, which means addon
23
+ * components rendered inside an engine silently fall back to defaults.
24
+ *
25
+ * When rendered inside an engine we resolve the config from the engine's parent
26
+ * (the host application), otherwise we use the owner directly.
27
+ *
28
+ * @function getConfig
29
+ * @param {Object} context Any object with an owner (e.g. a component).
30
+ * @return {Object} The resolved `ember-caluma` config, with defaults applied.
31
+ */
32
+ export default function getConfig(context) {
33
+ const owner = getOwner(context);
34
+ const host = getEngineParent(owner) ?? owner;
35
+
36
+ return {
37
+ ...DEFAULTS,
38
+ ...(host.resolveRegistration("config:environment")["ember-caluma"] ?? {}),
39
+ };
40
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-core",
3
- "version": "14.10.3",
3
+ "version": "14.11.1",
4
4
  "description": "Ember core addon for working with Caluma.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -61,7 +61,7 @@
61
61
  "sinon": "21.0.1",
62
62
  "uikit": "3.25.6",
63
63
  "webpack": "5.104.1",
64
- "@projectcaluma/ember-testing": "14.10.3"
64
+ "@projectcaluma/ember-testing": "14.11.1"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "ember-data": "*",