@projectcaluma/ember-core 14.1.1 → 14.3.0

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.
@@ -87,6 +87,13 @@ export default class BaseQuery {
87
87
  return this._fetchMore.perform(...args);
88
88
  }
89
89
 
90
+ refresh() {
91
+ // This peforms the fetch task with the current arguments which will result
92
+ // in a refresh of the base query. `queryOptions` is explicitly not being
93
+ // passed as this is merged with `this.queryOptions` in the task anyways.
94
+ return this._fetch.perform({ filter: this.filter, order: this.order });
95
+ }
96
+
90
97
  @restartableTask
91
98
  *_fetch({ filter = [], order = [], queryOptions = {} } = {}) {
92
99
  yield this._fetchPage.cancelAll({ resetState: true });
@@ -54,6 +54,15 @@ export default class CalumaQueryResource extends Resource {
54
54
  this.query.fetchMore();
55
55
  }
56
56
 
57
+ @action
58
+ refresh(event) {
59
+ if (event instanceof Event) {
60
+ event.preventDefault();
61
+ }
62
+
63
+ this.query.refresh();
64
+ }
65
+
57
66
  get value() {
58
67
  return this.query.value;
59
68
  }
@@ -4,7 +4,7 @@ import { warn } from "@ember/debug";
4
4
  export function decodeId(str) {
5
5
  try {
6
6
  return window.atob(str).split(":")[1];
7
- } catch (e) {
7
+ } catch {
8
8
  warn(`Attempted to decode ${str} as base64 but failed`, {
9
9
  id: "ember-caluma.decode-id",
10
10
  });
@@ -1,6 +1,7 @@
1
1
  import { assert } from "@ember/debug";
2
2
  import Service, { inject as service } from "@ember/service";
3
3
  import { tracked } from "@glimmer/tracking";
4
+ import { DateTime } from "luxon";
4
5
 
5
6
  import slugify from "@projectcaluma/ember-core/utils/slugify";
6
7
 
@@ -90,6 +91,27 @@ export default class CalumaOptionsService extends Service {
90
91
  */
91
92
  async sendReminderDistributionInquiry() {}
92
93
 
94
+ /**
95
+ * Calculate the default deadline for new inquiries in the distribution
96
+ * module. Per default, this will add the configured default lead time in days
97
+ * to the current date.
98
+ *
99
+ * This may be overwritten by the host app to define more complex logic to
100
+ * calculate said date. E.g. defining a different default deadline depending
101
+ * on which groups were selected.
102
+ *
103
+ * This function may return a promise.
104
+ *
105
+ * @method calculateDistributionDefaultDeadline
106
+ * @param {Number} defaultLeadTime
107
+ * @param {Array<String>} selectedGroups
108
+ * @returns {String} Deadline date formatted as ISO 8601 string
109
+ */
110
+ // eslint-disable-next-line no-unused-vars
111
+ calculateDistributionDefaultDeadline(defaultLeadTime, selectedGroups) {
112
+ return DateTime.now().plus({ days: defaultLeadTime }).toISODate();
113
+ }
114
+
93
115
  groupIdentifierProperty = "id";
94
116
  groupNameProperty = "name";
95
117
  resolveGroups(identifiers) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-core",
3
- "version": "14.1.1",
3
+ "version": "14.3.0",
4
4
  "description": "Ember core addon for working with Caluma.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -37,7 +37,7 @@
37
37
  "@ember/test-helpers": "4.0.4",
38
38
  "@embroider/test-setup": "4.0.0",
39
39
  "@embroider/util": "1.13.2",
40
- "@faker-js/faker": "9.4.0",
40
+ "@faker-js/faker": "9.7.0",
41
41
  "@glimmer/component": "1.1.2",
42
42
  "broccoli-asset-rev": "3.0.0",
43
43
  "ember-cli": "6.1.0",
@@ -49,17 +49,19 @@
49
49
  "ember-cli-sri": "2.1.1",
50
50
  "ember-cli-terser": "4.0.2",
51
51
  "ember-load-initializers": "3.0.1",
52
- "ember-qunit": "9.0.1",
52
+ "ember-qunit": "9.0.2",
53
53
  "ember-resolver": "13.1.0",
54
+ "ember-sinon-qunit": "7.5.0",
54
55
  "ember-source": "6.1.0",
55
56
  "ember-source-channel-url": "3.0.0",
56
- "ember-try": "3.0.0",
57
+ "ember-try": "4.0.0",
57
58
  "loader.js": "4.7.0",
58
- "qunit": "2.23.1",
59
+ "qunit": "2.24.1",
59
60
  "qunit-dom": "3.4.0",
60
- "uikit": "3.22.0",
61
- "webpack": "5.97.1",
62
- "@projectcaluma/ember-testing": "14.1.1"
61
+ "sinon": "20.0.0",
62
+ "uikit": "3.23.7",
63
+ "webpack": "5.99.8",
64
+ "@projectcaluma/ember-testing": "14.3.0"
63
65
  },
64
66
  "peerDependencies": {
65
67
  "ember-data": "*",