@projectcaluma/ember-form 14.8.2 → 14.8.3
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-field/info.hbs +1 -5
- package/addon/components/cf-field/input/static.hbs +0 -1
- package/addon/components/cf-field/input/table.hbs +1 -0
- package/addon/components/document-validity.js +34 -28
- package/package.json +5 -6
- package/addon/initializers/register-showdown-extensions.js +0 -20
- package/app/initializers/register-showdown-extensions.js +0 -4
|
@@ -16,11 +16,7 @@
|
|
|
16
16
|
as |modal|
|
|
17
17
|
>
|
|
18
18
|
<modal.body>
|
|
19
|
-
<MarkdownToHtml
|
|
20
|
-
@markdown={{@text}}
|
|
21
|
-
@openLinksInNewWindow={{true}}
|
|
22
|
-
@extensions="DOMPurify"
|
|
23
|
-
/>
|
|
19
|
+
<MarkdownToHtml @markdown={{@text}} @openLinksInNewWindow={{true}} />
|
|
24
20
|
</modal.body>
|
|
25
21
|
</UkModal>
|
|
26
22
|
</div>
|
|
@@ -70,34 +70,7 @@ export default class DocumentValidity extends Component {
|
|
|
70
70
|
),
|
|
71
71
|
);
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
{
|
|
75
|
-
query: documentValidityQuery,
|
|
76
|
-
fetchPolicy: "network-only",
|
|
77
|
-
variables: { id: this.args.document.uuid },
|
|
78
|
-
},
|
|
79
|
-
"documentValidity.edges.0.node",
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
if (!isValid) {
|
|
83
|
-
errors
|
|
84
|
-
.filter(({ errorCode }) => errorCode === "format_validation_failed")
|
|
85
|
-
.forEach(({ slug, errorMsg, documentId }) => {
|
|
86
|
-
const pk = `Document:${documentId}:Question:${slug}`;
|
|
87
|
-
const field = this.calumaStore.findByPk(pk);
|
|
88
|
-
const parentField = field.document.parentField;
|
|
89
|
-
|
|
90
|
-
// Add the error manually as the frontend does not validate format
|
|
91
|
-
// validators - only the backend.
|
|
92
|
-
field.addManualError("format", { errorMsg }, field.value);
|
|
93
|
-
|
|
94
|
-
if (parentField) {
|
|
95
|
-
// If the affected field is in a table row, we need to mark the
|
|
96
|
-
// table answer as invalid as well.
|
|
97
|
-
parentField.addManualError("table", {}, null);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
73
|
+
await this.#runBackendValidation();
|
|
101
74
|
|
|
102
75
|
if (this.isValid) {
|
|
103
76
|
this.args.onValid?.();
|
|
@@ -111,6 +84,39 @@ export default class DocumentValidity extends Component {
|
|
|
111
84
|
}
|
|
112
85
|
});
|
|
113
86
|
|
|
87
|
+
async #runBackendValidation() {
|
|
88
|
+
if (this.args.skipBackendValidation) return;
|
|
89
|
+
|
|
90
|
+
const { isValid, errors } = await this.apollo.query(
|
|
91
|
+
{
|
|
92
|
+
query: documentValidityQuery,
|
|
93
|
+
fetchPolicy: "network-only",
|
|
94
|
+
variables: { id: this.args.document.uuid },
|
|
95
|
+
},
|
|
96
|
+
"documentValidity.edges.0.node",
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
if (!isValid) {
|
|
100
|
+
errors
|
|
101
|
+
.filter(({ errorCode }) => errorCode === "format_validation_failed")
|
|
102
|
+
.forEach(({ slug, errorMsg, documentId }) => {
|
|
103
|
+
const pk = `Document:${documentId}:Question:${slug}`;
|
|
104
|
+
const field = this.calumaStore.findByPk(pk);
|
|
105
|
+
const parentField = field.document.parentField;
|
|
106
|
+
|
|
107
|
+
// Add the error manually as the frontend does not validate format
|
|
108
|
+
// validators - only the backend.
|
|
109
|
+
field.addManualError("format", { errorMsg }, field.value);
|
|
110
|
+
|
|
111
|
+
if (parentField) {
|
|
112
|
+
// If the affected field is in a table row, we need to mark the
|
|
113
|
+
// table answer as invalid as well.
|
|
114
|
+
parentField.addManualError("table", {}, null);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
114
120
|
@action
|
|
115
121
|
validate() {
|
|
116
122
|
return this._validate.perform();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@projectcaluma/ember-form",
|
|
3
|
-
"version": "14.8.
|
|
3
|
+
"version": "14.8.3",
|
|
4
4
|
"description": "Ember addon for rendering Caluma forms.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"@ember/test-waiters": "^4.1.1",
|
|
15
15
|
"@embroider/macros": "^1.16.10",
|
|
16
16
|
"@embroider/util": "^1.13.2",
|
|
17
|
-
"dompurify": "^3.3.1",
|
|
18
17
|
"ember-apollo-client": "^5.0.0",
|
|
19
18
|
"ember-auto-import": "^2.10.0",
|
|
20
19
|
"ember-autoresize-modifier": "^0.7.0 || ^0.8.0",
|
|
@@ -40,7 +39,7 @@
|
|
|
40
39
|
"luxon": "^3.5.0",
|
|
41
40
|
"reactiveweb": "^1.3.0",
|
|
42
41
|
"tracked-toolbox": "^2.0.0",
|
|
43
|
-
"@projectcaluma/ember-core": "^14.8.
|
|
42
|
+
"@projectcaluma/ember-core": "^14.8.3"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
45
|
"@ember/optional-features": "2.3.0",
|
|
@@ -75,12 +74,12 @@
|
|
|
75
74
|
"uikit": "3.25.6",
|
|
76
75
|
"uuid": "13.0.0",
|
|
77
76
|
"webpack": "5.104.1",
|
|
78
|
-
"@projectcaluma/ember-testing": "14.8.
|
|
79
|
-
"@projectcaluma/ember-workflow": "14.8.
|
|
77
|
+
"@projectcaluma/ember-testing": "14.8.3",
|
|
78
|
+
"@projectcaluma/ember-workflow": "14.8.3"
|
|
80
79
|
},
|
|
81
80
|
"peerDependencies": {
|
|
82
81
|
"ember-source": ">= 4.0.0",
|
|
83
|
-
"@projectcaluma/ember-workflow": "^14.8.
|
|
82
|
+
"@projectcaluma/ember-workflow": "^14.8.3"
|
|
84
83
|
},
|
|
85
84
|
"dependenciesMeta": {
|
|
86
85
|
"@projectcaluma/ember-core": {
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import DOMPurify from "dompurify";
|
|
2
|
-
import showdown from "showdown";
|
|
3
|
-
|
|
4
|
-
export function initialize() {
|
|
5
|
-
showdown.extension("DOMPurify", function () {
|
|
6
|
-
return [
|
|
7
|
-
{
|
|
8
|
-
type: "output",
|
|
9
|
-
filter(dirty) {
|
|
10
|
-
return DOMPurify.sanitize(dirty, { USE_PROFILES: { html: true } });
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
];
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default {
|
|
18
|
-
name: "register-showdown-extensions",
|
|
19
|
-
initialize,
|
|
20
|
-
};
|