@projectcaluma/ember-form 12.1.0 → 12.2.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.
- package/addon/components/cf-content.js +3 -3
- package/addon/components/cf-field/input/action-button.js +2 -2
- package/addon/components/cf-field/input/files.js +4 -4
- package/addon/components/cf-field/input/powerselect.js +1 -1
- package/addon/components/cf-field/input/table.js +6 -6
- package/addon/components/cf-field-value.js +1 -1
- package/addon/components/cf-field.js +1 -1
- package/addon/helpers/get-widget.js +2 -2
- package/addon/instance-initializers/form-widget-overrides.js +1 -1
- package/addon/lib/answer.js +3 -3
- package/addon/lib/dependencies.js +4 -4
- package/addon/lib/document.js +13 -10
- package/addon/lib/field.js +14 -14
- package/addon/lib/fieldset.js +5 -5
- package/addon/lib/navigation.js +4 -4
- package/addon/lib/parsers.js +4 -4
- package/addon/lib/question.js +4 -4
- package/addon/services/caluma-store.js +2 -2
- package/app/styles/_cf-navigation.scss +3 -1
- package/package.json +14 -14
@@ -121,7 +121,7 @@ export default class CfContentComponent extends Component {
|
|
121
121
|
this.document?.raw.form.slug;
|
122
122
|
|
123
123
|
return this.document.fieldsets.find(
|
124
|
-
(fieldset) => fieldset.form.slug === slug
|
124
|
+
(fieldset) => fieldset.form.slug === slug,
|
125
125
|
);
|
126
126
|
}
|
127
127
|
|
@@ -140,7 +140,7 @@ export default class CfContentComponent extends Component {
|
|
140
140
|
fetchPolicy: "network-only",
|
141
141
|
variables: { id: this.args.documentId },
|
142
142
|
},
|
143
|
-
"allDocuments.edges"
|
143
|
+
"allDocuments.edges",
|
144
144
|
)).map(({ node }) => node);
|
145
145
|
|
146
146
|
const [form] = (yield this.apollo.query(
|
@@ -149,7 +149,7 @@ export default class CfContentComponent extends Component {
|
|
149
149
|
fetchPolicy: "cache-first",
|
150
150
|
variables: { slug: answerDocument.form.slug },
|
151
151
|
},
|
152
|
-
"allForms.edges"
|
152
|
+
"allForms.edges",
|
153
153
|
)).map(({ node }) => node);
|
154
154
|
|
155
155
|
const owner = getOwner(this);
|
@@ -13,7 +13,7 @@ if (macroCondition(dependencySatisfies("@projectcaluma/ember-workflow", ""))) {
|
|
13
13
|
|
14
14
|
assert(
|
15
15
|
"The document must have a `workItemUuid` for `<CfField::Input::ActionButton />` to work.",
|
16
|
-
this.args.field.document.workItemUuid
|
16
|
+
this.args.field.document.workItemUuid,
|
17
17
|
);
|
18
18
|
}
|
19
19
|
|
@@ -69,7 +69,7 @@ if (macroCondition(dependencySatisfies("@projectcaluma/ember-workflow", ""))) {
|
|
69
69
|
super(...args);
|
70
70
|
|
71
71
|
assert(
|
72
|
-
"@projectcaluma/ember-workflow must be installed to enable the usage of the action button questions"
|
72
|
+
"@projectcaluma/ember-workflow must be installed to enable the usage of the action button questions",
|
73
73
|
);
|
74
74
|
}
|
75
75
|
};
|
@@ -27,7 +27,7 @@ export default class CfFieldInputFilesComponent extends Component {
|
|
27
27
|
variables: { id: this.args.field.answer.raw.id },
|
28
28
|
fetchPolicy: "network-only",
|
29
29
|
},
|
30
|
-
"node.value"
|
30
|
+
"node.value",
|
31
31
|
);
|
32
32
|
const { downloadUrl } =
|
33
33
|
answers.find((file) =>
|
@@ -35,7 +35,7 @@ export default class CfFieldInputFilesComponent extends Component {
|
|
35
35
|
macroCondition(isTesting())
|
36
36
|
? file.id === fileId ||
|
37
37
|
atob(file.id).substring(file.__typename.length + 1) === fileId
|
38
|
-
: file.id === fileId
|
38
|
+
: file.id === fileId,
|
39
39
|
) ?? {};
|
40
40
|
if (downloadUrl) {
|
41
41
|
window.open(downloadUrl, "_blank");
|
@@ -60,7 +60,7 @@ export default class CfFieldInputFilesComponent extends Component {
|
|
60
60
|
// trigger save action for file list of old and new files with
|
61
61
|
// reduces properties to match gql format
|
62
62
|
const { filesValue: savedAnswerValue } = await this.args.onSave(
|
63
|
-
fileList.map(({ name, id }) => ({ name, id }))
|
63
|
+
fileList.map(({ name, id }) => ({ name, id })),
|
64
64
|
);
|
65
65
|
|
66
66
|
try {
|
@@ -69,7 +69,7 @@ export default class CfFieldInputFilesComponent extends Component {
|
|
69
69
|
...savedAnswerValue.find(
|
70
70
|
(value) =>
|
71
71
|
file.name === value.name &&
|
72
|
-
!fileList.find((file) => file.id === value.id)
|
72
|
+
!fileList.find((file) => file.id === value.id),
|
73
73
|
),
|
74
74
|
value: file.value,
|
75
75
|
}));
|
@@ -28,7 +28,7 @@ export default class CfFieldInputTableComponent extends Component {
|
|
28
28
|
|
29
29
|
get questions() {
|
30
30
|
return this.args.field.question.raw.rowForm.questions.edges.map(
|
31
|
-
(edge) => edge.node
|
31
|
+
(edge) => edge.node,
|
32
32
|
);
|
33
33
|
}
|
34
34
|
|
@@ -37,7 +37,7 @@ export default class CfFieldInputTableComponent extends Component {
|
|
37
37
|
|
38
38
|
if (config?.length) {
|
39
39
|
return this.questions.filter((question) =>
|
40
|
-
config.includes(question.slug)
|
40
|
+
config.includes(question.slug),
|
41
41
|
);
|
42
42
|
}
|
43
43
|
|
@@ -53,7 +53,7 @@ export default class CfFieldInputTableComponent extends Component {
|
|
53
53
|
input: { form: this.args.field.question.raw.rowForm.slug },
|
54
54
|
},
|
55
55
|
},
|
56
|
-
"saveDocument.document"
|
56
|
+
"saveDocument.document",
|
57
57
|
);
|
58
58
|
|
59
59
|
const owner = getOwner(this);
|
@@ -75,7 +75,7 @@ export default class CfFieldInputTableComponent extends Component {
|
|
75
75
|
}
|
76
76
|
|
77
77
|
const remainingDocuments = this.args.field.answer.value.filter(
|
78
|
-
(doc) => doc.pk !== document.pk
|
78
|
+
(doc) => doc.pk !== document.pk,
|
79
79
|
);
|
80
80
|
|
81
81
|
yield this.args.onSave(remainingDocuments);
|
@@ -104,7 +104,7 @@ export default class CfFieldInputTableComponent extends Component {
|
|
104
104
|
yield this.args.onSave([...rows, newDocument]);
|
105
105
|
|
106
106
|
this.notification.success(
|
107
|
-
this.intl.t("caluma.form.notification.table.add.success")
|
107
|
+
this.intl.t("caluma.form.notification.table.add.success"),
|
108
108
|
);
|
109
109
|
}
|
110
110
|
|
@@ -113,7 +113,7 @@ export default class CfFieldInputTableComponent extends Component {
|
|
113
113
|
yield this.close.perform();
|
114
114
|
} catch (e) {
|
115
115
|
this.notification.danger(
|
116
|
-
this.intl.t("caluma.form.notification.table.add.error")
|
116
|
+
this.intl.t("caluma.form.notification.table.add.error"),
|
117
117
|
);
|
118
118
|
}
|
119
119
|
}
|
@@ -15,7 +15,7 @@ export default class CfFieldValueComponent extends Component {
|
|
15
15
|
variables: { id: this.args.field.answer.raw.id },
|
16
16
|
fetchPolicy: "network-only",
|
17
17
|
},
|
18
|
-
"node.value"
|
18
|
+
"node.value",
|
19
19
|
);
|
20
20
|
|
21
21
|
const { downloadUrl } = files?.find((file) => file.id === id) ?? {};
|
@@ -48,13 +48,13 @@ export default class GetWidgetHelper extends Helper {
|
|
48
48
|
warn(
|
49
49
|
`Widget override "${widget}" is not registered. Please register it by calling \`calumaOptions.registerComponentOverride\``,
|
50
50
|
override,
|
51
|
-
{ id: "ember-caluma.unregistered-override" }
|
51
|
+
{ id: "ember-caluma.unregistered-override" },
|
52
52
|
);
|
53
53
|
|
54
54
|
if (override) {
|
55
55
|
return ensureSafeComponent(
|
56
56
|
override.componentClass ?? override.component,
|
57
|
-
this
|
57
|
+
this,
|
58
58
|
);
|
59
59
|
}
|
60
60
|
}
|
package/addon/lib/answer.js
CHANGED
@@ -21,7 +21,7 @@ class DedupedTrackedObject {
|
|
21
21
|
Object.defineProperty(
|
22
22
|
this,
|
23
23
|
key,
|
24
|
-
dedupeTracked(this, key, { initializer: () => value })
|
24
|
+
dedupeTracked(this, key, { initializer: () => value }),
|
25
25
|
);
|
26
26
|
});
|
27
27
|
}
|
@@ -38,7 +38,7 @@ export default class Answer extends Base {
|
|
38
38
|
|
39
39
|
assert(
|
40
40
|
"A graphql answer `raw` must be passed",
|
41
|
-
/Answer$/.test(raw?.__typename)
|
41
|
+
/Answer$/.test(raw?.__typename),
|
42
42
|
);
|
43
43
|
|
44
44
|
super({ raw, ...args });
|
@@ -128,7 +128,7 @@ export default class Answer extends Base {
|
|
128
128
|
if (document instanceof Document) return document;
|
129
129
|
|
130
130
|
const existing = this.calumaStore.find(
|
131
|
-
`Document:${decodeId(document.id)}
|
131
|
+
`Document:${decodeId(document.id)}`,
|
132
132
|
);
|
133
133
|
|
134
134
|
return (
|
@@ -16,19 +16,19 @@ import { getAST, getTransforms } from "@projectcaluma/ember-core/utils/jexl";
|
|
16
16
|
export function getDependenciesFromJexl(jexl, expression) {
|
17
17
|
const allTransforms = getTransforms(getAST(jexl, expression));
|
18
18
|
const answerTransforms = allTransforms.filter(
|
19
|
-
(transform) => transform.name === "answer"
|
19
|
+
(transform) => transform.name === "answer",
|
20
20
|
);
|
21
21
|
const mapbyTransforms = allTransforms.filter(
|
22
22
|
(transform) =>
|
23
23
|
transform.name === "mapby" &&
|
24
24
|
transform.args[0].type === "FunctionCall" &&
|
25
|
-
transform.args[0].name === "answer"
|
25
|
+
transform.args[0].name === "answer",
|
26
26
|
);
|
27
27
|
const stringifyTransforms = allTransforms.filter(
|
28
28
|
(transform) =>
|
29
29
|
transform.name === "stringify" &&
|
30
30
|
transform.args[0].type === "FunctionCall" &&
|
31
|
-
transform.args[0].name === "answer"
|
31
|
+
transform.args[0].name === "answer",
|
32
32
|
);
|
33
33
|
|
34
34
|
return [
|
@@ -41,7 +41,7 @@ export function getDependenciesFromJexl(jexl, expression) {
|
|
41
41
|
return childKeys.map((key) => `${parentKey}.${key}`);
|
42
42
|
}),
|
43
43
|
...stringifyTransforms.map(
|
44
|
-
(transform) => `${transform.args[0].args[0].value}.__all__
|
44
|
+
(transform) => `${transform.args[0].args[0].value}.__all__`,
|
45
45
|
),
|
46
46
|
]),
|
47
47
|
];
|
package/addon/lib/document.js
CHANGED
@@ -25,7 +25,7 @@ export default class Document extends Base {
|
|
25
25
|
constructor({ raw, parentDocument, dataSourceContext, ...args }) {
|
26
26
|
assert(
|
27
27
|
"A graphql document `raw` must be passed",
|
28
|
-
raw?.__typename === "Document"
|
28
|
+
raw?.__typename === "Document",
|
29
29
|
);
|
30
30
|
|
31
31
|
super({ raw, ...args });
|
@@ -62,7 +62,7 @@ export default class Document extends Base {
|
|
62
62
|
raw: { form, answers: this.raw.answers },
|
63
63
|
document: this,
|
64
64
|
owner,
|
65
|
-
})
|
65
|
+
}),
|
66
66
|
);
|
67
67
|
});
|
68
68
|
}
|
@@ -124,7 +124,7 @@ export default class Document extends Base {
|
|
124
124
|
const rawId =
|
125
125
|
this.raw.workItem?.id ||
|
126
126
|
this.raw.case?.workItems.edges.find(
|
127
|
-
(edge) => edge.node.task.__typename === "CompleteWorkflowFormTask"
|
127
|
+
(edge) => edge.node.task.__typename === "CompleteWorkflowFormTask",
|
128
128
|
)?.node.id;
|
129
129
|
|
130
130
|
return rawId ? decodeId(rawId) : null;
|
@@ -149,8 +149,11 @@ export default class Document extends Base {
|
|
149
149
|
get jexl() {
|
150
150
|
const documentJexl = new jexl.Jexl();
|
151
151
|
|
152
|
+
// WARNING: When adding a new transform or operator, make sure to add it in
|
153
|
+
// `packages/form-builder/addon/validators/jexl.js` as well for the
|
154
|
+
// validation in the form builder.
|
152
155
|
documentJexl.addTransform("answer", (slug, defaultValue) =>
|
153
|
-
this.findAnswer(slug, defaultValue)
|
156
|
+
this.findAnswer(slug, defaultValue),
|
154
157
|
);
|
155
158
|
documentJexl.addTransform("mapby", mapby);
|
156
159
|
documentJexl.addBinaryOp("intersects", 20, intersects);
|
@@ -170,13 +173,13 @@ export default class Document extends Base {
|
|
170
173
|
documentJexl.addTransform("round", (num, places = 0) =>
|
171
174
|
!onlyNumbers([num]).length
|
172
175
|
? null
|
173
|
-
: Math.round(num * Math.pow(10, places)) / Math.pow(10, places)
|
176
|
+
: Math.round(num * Math.pow(10, places)) / Math.pow(10, places),
|
174
177
|
);
|
175
178
|
documentJexl.addTransform("ceil", (num) =>
|
176
|
-
!onlyNumbers([num]).length ? null : Math.ceil(num)
|
179
|
+
!onlyNumbers([num]).length ? null : Math.ceil(num),
|
177
180
|
);
|
178
181
|
documentJexl.addTransform("floor", (num) =>
|
179
|
-
!onlyNumbers([num]).length ? null : Math.floor(num)
|
182
|
+
!onlyNumbers([num]).length ? null : Math.floor(num),
|
180
183
|
);
|
181
184
|
documentJexl.addTransform("sum", (arr) => sum(onlyNumbers(arr)));
|
182
185
|
documentJexl.addTransform("avg", (arr) => {
|
@@ -234,7 +237,7 @@ export default class Document extends Base {
|
|
234
237
|
...answerMap,
|
235
238
|
[field.question.slug]: field.value,
|
236
239
|
}),
|
237
|
-
{}
|
240
|
+
{},
|
238
241
|
);
|
239
242
|
}
|
240
243
|
|
@@ -269,7 +272,7 @@ export default class Document extends Base {
|
|
269
272
|
...obj,
|
270
273
|
[tableField.question.slug]: tableField.value,
|
271
274
|
};
|
272
|
-
}, {})
|
275
|
+
}, {}),
|
273
276
|
);
|
274
277
|
}
|
275
278
|
|
@@ -284,7 +287,7 @@ export default class Document extends Base {
|
|
284
287
|
*/
|
285
288
|
findField(slug) {
|
286
289
|
return [...this.fields, ...(this.parentDocument?.fields ?? [])].find(
|
287
|
-
(field) => field.question.slug === slug
|
290
|
+
(field) => field.question.slug === slug,
|
288
291
|
);
|
289
292
|
}
|
290
293
|
}
|
package/addon/lib/field.js
CHANGED
@@ -283,7 +283,7 @@ export default class Field extends Base {
|
|
283
283
|
try {
|
284
284
|
return this.document.jexl.evalSync(
|
285
285
|
this.question.raw.calcExpression,
|
286
|
-
this.jexlContext
|
286
|
+
this.jexlContext,
|
287
287
|
);
|
288
288
|
} catch (error) {
|
289
289
|
return null;
|
@@ -311,7 +311,7 @@ export default class Field extends Base {
|
|
311
311
|
question: this.question.slug,
|
312
312
|
},
|
313
313
|
},
|
314
|
-
"allUsedDynamicOptions.edges"
|
314
|
+
"allUsedDynamicOptions.edges",
|
315
315
|
);
|
316
316
|
|
317
317
|
return edges.map(({ node: { slug, label } }) => ({
|
@@ -352,11 +352,11 @@ export default class Field extends Base {
|
|
352
352
|
(this.question.isMultipleChoice ? this.value : [this.value]) || [];
|
353
353
|
|
354
354
|
const options = this.question.options.filter(
|
355
|
-
(option) => !option.disabled || selected.includes(option.slug)
|
355
|
+
(option) => !option.disabled || selected.includes(option.slug),
|
356
356
|
);
|
357
357
|
|
358
358
|
const hasUnknownValue = !selected.every((slug) =>
|
359
|
-
options.find((option) => option.slug === slug)
|
359
|
+
options.find((option) => option.slug === slug),
|
360
360
|
);
|
361
361
|
|
362
362
|
if (this.question.isDynamic && hasUnknownValue) {
|
@@ -399,7 +399,7 @@ export default class Field extends Base {
|
|
399
399
|
const selected = this.options.filter(({ slug }) =>
|
400
400
|
this.question.isMultipleChoice
|
401
401
|
? (this.value || []).includes(slug)
|
402
|
-
: this.value === slug
|
402
|
+
: this.value === slug,
|
403
403
|
);
|
404
404
|
|
405
405
|
return this.question.isMultipleChoice ? selected : selected[0];
|
@@ -491,11 +491,11 @@ export default class Field extends Base {
|
|
491
491
|
try {
|
492
492
|
return this.document.jexl.evalSync(
|
493
493
|
this.question.raw.isHidden,
|
494
|
-
this.jexlContext
|
494
|
+
this.jexlContext,
|
495
495
|
);
|
496
496
|
} catch (error) {
|
497
497
|
throw new Error(
|
498
|
-
`Error while evaluating \`isHidden\` expression on field \`${this.pk}\`: ${error.message}
|
498
|
+
`Error while evaluating \`isHidden\` expression on field \`${this.pk}\`: ${error.message}`,
|
499
499
|
);
|
500
500
|
}
|
501
501
|
}
|
@@ -526,11 +526,11 @@ export default class Field extends Base {
|
|
526
526
|
try {
|
527
527
|
return !this.document.jexl.evalSync(
|
528
528
|
this.question.raw.isRequired,
|
529
|
-
this.jexlContext
|
529
|
+
this.jexlContext,
|
530
530
|
);
|
531
531
|
} catch (error) {
|
532
532
|
throw new Error(
|
533
|
-
`Error while evaluating \`isRequired\` expression on field \`${this.pk}\`: ${error.message}
|
533
|
+
`Error while evaluating \`isRequired\` expression on field \`${this.pk}\`: ${error.message}`,
|
534
534
|
);
|
535
535
|
}
|
536
536
|
}
|
@@ -569,7 +569,7 @@ export default class Field extends Base {
|
|
569
569
|
mutation: MUTATION_MAP[type],
|
570
570
|
variables: { input },
|
571
571
|
},
|
572
|
-
`saveDocument${type}.answer
|
572
|
+
`saveDocument${type}.answer`,
|
573
573
|
);
|
574
574
|
|
575
575
|
const wasNew = this.isNew;
|
@@ -613,7 +613,7 @@ export default class Field extends Base {
|
|
613
613
|
|
614
614
|
assert(
|
615
615
|
`Missing validation function for ${this.questionType}`,
|
616
|
-
specificValidation
|
616
|
+
specificValidation,
|
617
617
|
);
|
618
618
|
|
619
619
|
const validationFns = [
|
@@ -626,7 +626,7 @@ export default class Field extends Base {
|
|
626
626
|
const res = await fn.call(this);
|
627
627
|
|
628
628
|
return Array.isArray(res) ? res : [res];
|
629
|
-
})
|
629
|
+
}),
|
630
630
|
))
|
631
631
|
.reduce((arr, e) => [...arr, ...e], []) // flatten the array
|
632
632
|
.filter((e) => typeof e === "object");
|
@@ -861,11 +861,11 @@ export default class Field extends Base {
|
|
861
861
|
await field.validate.perform();
|
862
862
|
|
863
863
|
return field.isValid;
|
864
|
-
})
|
864
|
+
}),
|
865
865
|
);
|
866
866
|
|
867
867
|
return validFields.every(Boolean);
|
868
|
-
})
|
868
|
+
}),
|
869
869
|
);
|
870
870
|
|
871
871
|
return (
|
package/addon/lib/fieldset.js
CHANGED
@@ -16,11 +16,11 @@ export default class Fieldset extends Base {
|
|
16
16
|
|
17
17
|
assert(
|
18
18
|
"A graphql form `raw.form` must be passed",
|
19
|
-
raw?.form?.__typename === "Form"
|
19
|
+
raw?.form?.__typename === "Form",
|
20
20
|
);
|
21
21
|
assert(
|
22
22
|
"A collection of graphql answers `raw.answers` must be passed",
|
23
|
-
raw?.answers?.every((answer) => /Answer$/.test(answer.__typename))
|
23
|
+
raw?.answers?.every((answer) => /Answer$/.test(answer.__typename)),
|
24
24
|
);
|
25
25
|
|
26
26
|
super({ raw, ...args });
|
@@ -53,18 +53,18 @@ export default class Fieldset extends Base {
|
|
53
53
|
return associateDestroyableChild(
|
54
54
|
this,
|
55
55
|
this.calumaStore.find(
|
56
|
-
`${this.document.pk}:Question:${question.slug}
|
56
|
+
`${this.document.pk}:Question:${question.slug}`,
|
57
57
|
) ||
|
58
58
|
new (owner.factoryFor("caluma-model:field").class)({
|
59
59
|
raw: {
|
60
60
|
question,
|
61
61
|
answer: this.raw.answers.find(
|
62
|
-
(answer) => answer?.question?.slug === question.slug
|
62
|
+
(answer) => answer?.question?.slug === question.slug,
|
63
63
|
),
|
64
64
|
},
|
65
65
|
fieldset: this,
|
66
66
|
owner,
|
67
|
-
})
|
67
|
+
}),
|
68
68
|
);
|
69
69
|
});
|
70
70
|
|
package/addon/lib/navigation.js
CHANGED
@@ -81,7 +81,7 @@ export class NavigationItem extends Base {
|
|
81
81
|
@cached
|
82
82
|
get children() {
|
83
83
|
return this.navigation.items.filter(
|
84
|
-
(item) => item._parentSlug === this.slug
|
84
|
+
(item) => item._parentSlug === this.slug,
|
85
85
|
);
|
86
86
|
}
|
87
87
|
|
@@ -162,7 +162,7 @@ export class NavigationItem extends Base {
|
|
162
162
|
return (
|
163
163
|
(this.fieldset.field === undefined || !this.fieldset.field.hidden) &&
|
164
164
|
this.fieldset.fields.some(
|
165
|
-
(field) => field.questionType !== "FormQuestion" && !field.hidden
|
165
|
+
(field) => field.questionType !== "FormQuestion" && !field.hidden,
|
166
166
|
)
|
167
167
|
);
|
168
168
|
}
|
@@ -234,7 +234,7 @@ export class NavigationItem extends Base {
|
|
234
234
|
return this.fieldset.fields.filter(
|
235
235
|
(f) =>
|
236
236
|
!["FormQuestion", "StaticQuestion"].includes(f.questionType) &&
|
237
|
-
!f.hidden
|
237
|
+
!f.hidden,
|
238
238
|
);
|
239
239
|
}
|
240
240
|
|
@@ -343,7 +343,7 @@ export class Navigation extends Base {
|
|
343
343
|
fieldset,
|
344
344
|
navigation: this,
|
345
345
|
owner,
|
346
|
-
})
|
346
|
+
}),
|
347
347
|
);
|
348
348
|
});
|
349
349
|
|
package/addon/lib/parsers.js
CHANGED
@@ -3,7 +3,7 @@ import { assert } from "@ember/debug";
|
|
3
3
|
export const parseDocument = (response) => {
|
4
4
|
assert(
|
5
5
|
"The passed document must be a GraphQL document",
|
6
|
-
response.__typename === "Document"
|
6
|
+
response.__typename === "Document",
|
7
7
|
);
|
8
8
|
assert("The passed document must include a form", response.form);
|
9
9
|
assert("The passed document must include answers", response.answers);
|
@@ -19,7 +19,7 @@ export const parseDocument = (response) => {
|
|
19
19
|
export const parseForm = (response) => {
|
20
20
|
assert(
|
21
21
|
"The passed form must be a GraphQL form",
|
22
|
-
response.__typename === "Form"
|
22
|
+
response.__typename === "Form",
|
23
23
|
);
|
24
24
|
|
25
25
|
return {
|
@@ -45,7 +45,7 @@ export const parseFormTree = (response) => {
|
|
45
45
|
export const parseAnswer = (response) => {
|
46
46
|
assert(
|
47
47
|
"The passed answer must be a GraphQL answer",
|
48
|
-
/Answer$/.test(response.__typename)
|
48
|
+
/Answer$/.test(response.__typename),
|
49
49
|
);
|
50
50
|
|
51
51
|
return { ...response };
|
@@ -54,7 +54,7 @@ export const parseAnswer = (response) => {
|
|
54
54
|
export const parseQuestion = (response) => {
|
55
55
|
assert(
|
56
56
|
"The passed question must be a GraphQL question",
|
57
|
-
/Question$/.test(response.__typename)
|
57
|
+
/Question$/.test(response.__typename),
|
58
58
|
);
|
59
59
|
|
60
60
|
return { ...response };
|
package/addon/lib/question.js
CHANGED
@@ -22,7 +22,7 @@ export default class Question extends Base {
|
|
22
22
|
constructor({ raw, ...args }) {
|
23
23
|
assert(
|
24
24
|
"A graphql question `raw` must be passed",
|
25
|
-
/Question$/.test(raw?.__typename)
|
25
|
+
/Question$/.test(raw?.__typename),
|
26
26
|
);
|
27
27
|
|
28
28
|
super({ raw, ...args });
|
@@ -64,7 +64,7 @@ export default class Question extends Base {
|
|
64
64
|
: null,
|
65
65
|
},
|
66
66
|
},
|
67
|
-
"allQuestions.edges"
|
67
|
+
"allQuestions.edges",
|
68
68
|
);
|
69
69
|
|
70
70
|
return (
|
@@ -153,7 +153,7 @@ export default class Question extends Base {
|
|
153
153
|
@cached
|
154
154
|
get defaultValue() {
|
155
155
|
const key = camelize(
|
156
|
-
this.raw.__typename.replace(/Question$/, "DefaultAnswer")
|
156
|
+
this.raw.__typename.replace(/Question$/, "DefaultAnswer"),
|
157
157
|
);
|
158
158
|
|
159
159
|
const value = this.raw[key]?.value;
|
@@ -167,7 +167,7 @@ export default class Question extends Base {
|
|
167
167
|
[answer.question.slug]: getValue(answer),
|
168
168
|
};
|
169
169
|
},
|
170
|
-
{}
|
170
|
+
{},
|
171
171
|
);
|
172
172
|
});
|
173
173
|
}
|
@@ -12,14 +12,14 @@ export default class CalumaStoreService extends Service {
|
|
12
12
|
push(obj) {
|
13
13
|
assert(
|
14
14
|
`Object must have an \`pk\` in order to be pushed into the store`,
|
15
|
-
obj.pk
|
15
|
+
obj.pk,
|
16
16
|
);
|
17
17
|
|
18
18
|
const existing = this._store.get(obj.pk);
|
19
19
|
|
20
20
|
if (existing) {
|
21
21
|
debug(
|
22
|
-
`Object with the pk \`${obj.pk}\` already exists in the store. It will be updated
|
22
|
+
`Object with the pk \`${obj.pk}\` already exists in the store. It will be updated.`,
|
23
23
|
);
|
24
24
|
|
25
25
|
set(existing, "raw", obj.raw);
|
@@ -17,7 +17,9 @@ $icon-size: 0.8rem !default;
|
|
17
17
|
width: $icon-size;
|
18
18
|
color: color.adjust($global-border, $lightness: -40%);
|
19
19
|
border: 1px solid color.adjust($global-border, $lightness: -10%);
|
20
|
-
transition:
|
20
|
+
transition:
|
21
|
+
color 500ms ease,
|
22
|
+
border 500ms ease;
|
21
23
|
|
22
24
|
&::before {
|
23
25
|
position: absolute;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@projectcaluma/ember-form",
|
3
|
-
"version": "12.
|
3
|
+
"version": "12.2.0",
|
4
4
|
"description": "Ember addon for rendering Caluma forms.",
|
5
5
|
"keywords": [
|
6
6
|
"ember-addon"
|
@@ -10,8 +10,8 @@
|
|
10
10
|
"repository": "github:projectcaluma/ember-caluma",
|
11
11
|
"dependencies": {
|
12
12
|
"@ember/string": "^3.1.1",
|
13
|
-
"@embroider/macros": "^1.
|
14
|
-
"@embroider/util": "^1.11.
|
13
|
+
"@embroider/macros": "^1.12.3",
|
14
|
+
"@embroider/util": "^1.11.2",
|
15
15
|
"@glimmer/component": "^1.1.2",
|
16
16
|
"@glimmer/tracking": "^1.1.2",
|
17
17
|
"ember-apollo-client": "~4.0.2",
|
@@ -19,16 +19,16 @@
|
|
19
19
|
"ember-autoresize-modifier": "^0.7.0",
|
20
20
|
"ember-cli-babel": "^7.26.11",
|
21
21
|
"ember-cli-htmlbars": "^6.2.0",
|
22
|
-
"ember-cli-showdown": "^
|
22
|
+
"ember-cli-showdown": "^7.0.0",
|
23
23
|
"ember-composable-helpers": "^5.0.0",
|
24
|
-
"ember-concurrency": "^
|
24
|
+
"ember-concurrency": "^3.0.0",
|
25
25
|
"ember-fetch": "^8.1.2",
|
26
26
|
"ember-flatpickr": "^4.0.0",
|
27
27
|
"ember-in-viewport": "^4.1.0",
|
28
28
|
"ember-intl": "^5.7.2",
|
29
29
|
"ember-math-helpers": "^3.0.0",
|
30
|
-
"ember-power-select": "^7.
|
31
|
-
"ember-resources": "^
|
30
|
+
"ember-power-select": "^7.1.0",
|
31
|
+
"ember-resources": "^6.2.2",
|
32
32
|
"ember-uikit": "^8.0.0",
|
33
33
|
"ember-validators": "^4.1.2",
|
34
34
|
"graphql": "^15.8.0",
|
@@ -36,11 +36,11 @@
|
|
36
36
|
"lodash.isequal": "^4.5.0",
|
37
37
|
"luxon": "^3.3.0",
|
38
38
|
"tracked-toolbox": "^2.0.0",
|
39
|
-
"@projectcaluma/ember-core": "^12.
|
39
|
+
"@projectcaluma/ember-core": "^12.2.0"
|
40
40
|
},
|
41
41
|
"devDependencies": {
|
42
42
|
"@ember/optional-features": "2.0.0",
|
43
|
-
"@ember/test-helpers": "3.
|
43
|
+
"@ember/test-helpers": "3.2.0",
|
44
44
|
"@embroider/test-setup": "3.0.1",
|
45
45
|
"@faker-js/faker": "8.0.2",
|
46
46
|
"broccoli-asset-rev": "3.0.0",
|
@@ -54,7 +54,7 @@
|
|
54
54
|
"ember-load-initializers": "2.1.2",
|
55
55
|
"ember-qunit": "7.0.0",
|
56
56
|
"ember-resolver": "10.1.1",
|
57
|
-
"ember-source": "4.12.
|
57
|
+
"ember-source": "4.12.3",
|
58
58
|
"ember-source-channel-url": "3.0.0",
|
59
59
|
"ember-try": "2.0.0",
|
60
60
|
"loader.js": "4.7.0",
|
@@ -63,13 +63,13 @@
|
|
63
63
|
"qunit-dom": "2.0.0",
|
64
64
|
"uikit": "3.16.22",
|
65
65
|
"uuid": "9.0.0",
|
66
|
-
"webpack": "5.
|
67
|
-
"@projectcaluma/ember-testing": "12.
|
68
|
-
"@projectcaluma/ember-workflow": "12.
|
66
|
+
"webpack": "5.88.2",
|
67
|
+
"@projectcaluma/ember-testing": "12.2.0",
|
68
|
+
"@projectcaluma/ember-workflow": "12.2.0"
|
69
69
|
},
|
70
70
|
"peerDependencies": {
|
71
71
|
"ember-source": "^4.0.0",
|
72
|
-
"@projectcaluma/ember-workflow": "^12.
|
72
|
+
"@projectcaluma/ember-workflow": "^12.2.0"
|
73
73
|
},
|
74
74
|
"peerDependenciesMeta": {
|
75
75
|
"@projectcaluma/ember-workflow": {
|