@projectcaluma/ember-core 11.0.0-beta.4 → 11.0.0-beta.5

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [@projectcaluma/ember-core-v11.0.0-beta.5](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-core-v11.0.0-beta.4...@projectcaluma/ember-core-v11.0.0-beta.5) (2022-03-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **core:** ensure only language code of the locale is passed to slugify ([02e4506](https://github.com/projectcaluma/ember-caluma/commit/02e45064b9171de85af5b9e1a890d5207a6ec252))
7
+ * **core:** handle null values in raw dates ([9c73d0b](https://github.com/projectcaluma/ember-caluma/commit/9c73d0b3853b154b5edc84bcf2c1227ffb825116)), closes [#1826](https://github.com/projectcaluma/ember-caluma/issues/1826)
8
+ * **distribution:** fix sorting after group names in navigation ([2299d3b](https://github.com/projectcaluma/ember-caluma/commit/2299d3b0e265204ab6747dbdc6a8b64fc22f247f))
9
+
10
+
11
+ ### Features
12
+
13
+ * **form:** support passing component override classes ([9409c7c](https://github.com/projectcaluma/ember-caluma/commit/9409c7cb5901dcdffec1c0294046da64b74b9922))
14
+
1
15
  # [@projectcaluma/ember-core-v11.0.0-beta.4](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-core-v11.0.0-beta.3...@projectcaluma/ember-core-v11.0.0-beta.4) (2022-02-07)
2
16
 
3
17
 
@@ -13,9 +13,10 @@ export function uuidAttr(target, name) {
13
13
  export function dateAttr(target, name) {
14
14
  return {
15
15
  get() {
16
- const date = new Date(this.raw[name]);
16
+ const raw = this.raw[name];
17
+ const date = raw ? new Date(raw) : null;
17
18
 
18
- return !isNaN(date) ? date : null;
19
+ return raw && !isNaN(date) ? date : null;
19
20
  },
20
21
  set(value) {
21
22
  if (!isNaN(value)) {
@@ -2,6 +2,7 @@ import { assert } from "@ember/debug";
2
2
  import { once } from "@ember/runloop";
3
3
  import Service, { inject as service } from "@ember/service";
4
4
  import { camelize } from "@ember/string";
5
+ import { tracked } from "@glimmer/tracking";
5
6
  import { task } from "ember-concurrency";
6
7
  import { pluralize } from "ember-inflector";
7
8
 
@@ -14,25 +15,46 @@ import { pluralize } from "ember-inflector";
14
15
  */
15
16
  function typeResolver(type) {
16
17
  return task(function* () {
17
- const identifiers = [...this[type].identifiers];
18
- const callbacks = [...this[type].callbacks];
18
+ const identifiers = [...(this[type]?.identifiers ?? [])];
19
+ const callbacks = [...(this[type]?.callbacks ?? [])];
19
20
 
20
21
  this[type] = undefined;
21
22
 
22
23
  if (!identifiers.length) return;
23
24
 
25
+ const cached = this[`${type}Cache`];
26
+ const uncachedIdentifiers = identifiers.filter(
27
+ (identifier) =>
28
+ !cached
29
+ .map((resolved) =>
30
+ String(resolved[this.calumaOptions[`${type}IdentifierProperty`]])
31
+ )
32
+ .includes(String(identifier))
33
+ );
34
+
24
35
  const methodName = camelize(`resolve-${pluralize(type)}`);
25
- const result = yield this.calumaOptions[methodName]?.(identifiers);
36
+ const result = uncachedIdentifiers.length
37
+ ? yield this.calumaOptions[methodName]?.(uncachedIdentifiers)
38
+ : [];
39
+
40
+ const allResults = [...cached, ...(result?.toArray?.() ?? result ?? [])];
26
41
 
27
- yield Promise.all(callbacks.map((callback) => callback(result)));
42
+ if (result?.length) {
43
+ this[`${type}Cache`] = allResults;
44
+ }
45
+
46
+ yield Promise.all(callbacks.map((callback) => callback(allResults)));
28
47
 
29
- return result;
48
+ return allResults;
30
49
  }).enqueue();
31
50
  }
32
51
 
33
52
  export default class PrivateSchedulerService extends Service {
34
53
  @service calumaOptions;
35
54
 
55
+ @tracked groupCache = [];
56
+ @tracked userCache = [];
57
+
36
58
  @typeResolver("group") resolveGroup;
37
59
  @typeResolver("user") resolveUser;
38
60
 
@@ -18,33 +18,6 @@ export default class CalumaOptionsService extends Service {
18
18
 
19
19
  @tracked currentGroupId;
20
20
 
21
- constructor(...args) {
22
- super(...args);
23
-
24
- this.registerComponentOverride({
25
- label: this.intl.t(
26
- "caluma.form-builder.question.widgetOverrides.powerselect"
27
- ),
28
- component: "cf-field/input/powerselect",
29
- types: [
30
- "ChoiceQuestion",
31
- "MultipleChoiceQuestion",
32
- "DynamicChoiceQuestion",
33
- "DynamicMultipleChoiceQuestion",
34
- ],
35
- });
36
-
37
- this.registerComponentOverride({
38
- label: this.intl.t("caluma.form-builder.question.widgetOverrides.hidden"),
39
- component: "cf-field/input/hidden",
40
- });
41
-
42
- this.registerComponentOverride({
43
- component: "cfb-form-editor/question/default/table",
44
- types: [],
45
- });
46
- }
47
-
48
21
  _namespace = null;
49
22
  _overrides = {};
50
23
 
@@ -7,6 +7,6 @@ export default function (value, { locale = null } = {}) {
7
7
  return slugify(value, {
8
8
  lower: true,
9
9
  strict: true,
10
- locale,
10
+ locale: locale?.split("-")[0].toLowerCase(),
11
11
  }).substr(0, 127);
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-core",
3
- "version": "11.0.0-beta.4",
3
+ "version": "11.0.0-beta.5",
4
4
  "description": "Ember core addon for working with Caluma.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -14,17 +14,17 @@
14
14
  "test:ember-compatibility": "ember try:each"
15
15
  },
16
16
  "dependencies": {
17
- "@apollo/client": "^3.5.8",
17
+ "@apollo/client": "^3.5.10",
18
18
  "@glimmer/tracking": "^1.0.4",
19
19
  "ember-apollo-client": "^3.2.0",
20
20
  "ember-auto-import": "^2.4.0",
21
21
  "ember-cli-babel": "^7.26.11",
22
22
  "ember-cli-htmlbars": "^6.0.1",
23
- "ember-concurrency": "^2.2.0",
23
+ "ember-concurrency": "^2.2.1",
24
24
  "ember-fetch": "^8.1.1",
25
25
  "ember-inflector": "^4.0.2",
26
26
  "ember-intl": "^5.7.2",
27
- "ember-resources": "^4.3.1",
27
+ "ember-resources": "^4.4.0",
28
28
  "graphql": "^15.8.0",
29
29
  "graphql-tag": "^2.12.6",
30
30
  "jexl": "^2.3.0",
@@ -35,16 +35,17 @@
35
35
  "@ember/optional-features": "2.0.0",
36
36
  "@ember/render-modifiers": "2.0.4",
37
37
  "@ember/test-helpers": "2.6.0",
38
- "@embroider/test-setup": "1.0.0",
39
- "@faker-js/faker": "6.0.0-alpha.5",
38
+ "@embroider/test-setup": "1.5.0",
39
+ "@embroider/util": "^1.5.0",
40
+ "@faker-js/faker": "6.0.0-beta.0",
40
41
  "@glimmer/component": "1.0.4",
41
- "@projectcaluma/ember-testing": "11.0.0-beta.2",
42
+ "@projectcaluma/ember-testing": "11.0.0-beta.4",
42
43
  "broccoli-asset-rev": "3.0.0",
43
44
  "ember-cli": "3.28.5",
44
45
  "ember-cli-code-coverage": "1.0.3",
45
46
  "ember-cli-dependency-checker": "3.2.0",
46
47
  "ember-cli-inject-live-reload": "2.1.0",
47
- "ember-cli-mirage": "2.4.0",
48
+ "ember-cli-mirage": "3.0.0-alpha.2",
48
49
  "ember-cli-sri": "2.1.1",
49
50
  "ember-cli-terser": "4.0.2",
50
51
  "ember-disable-prototype-extensions": "1.1.3",
@@ -58,9 +59,9 @@
58
59
  "ember-try": "2.0.0",
59
60
  "loader.js": "4.7.0",
60
61
  "npm-run-all": "4.1.5",
61
- "qunit": "2.17.2",
62
+ "qunit": "2.18.0",
62
63
  "qunit-dom": "2.0.0",
63
- "webpack": "5.68.0"
64
+ "webpack": "5.70.0"
64
65
  },
65
66
  "engines": {
66
67
  "node": "12.* || 14.* || >= 16"