@projectcaluma/ember-form 14.8.2 → 14.9.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.
Files changed (59) hide show
  1. package/addon/components/cf-content.hbs +44 -39
  2. package/addon/components/cf-content.js +50 -14
  3. package/addon/components/cf-field/info.hbs +1 -5
  4. package/addon/components/cf-field/input/checkbox.hbs +3 -1
  5. package/addon/components/cf-field/input/checkbox.js +15 -0
  6. package/addon/components/cf-field/input/date.hbs +38 -31
  7. package/addon/components/cf-field/input/float.hbs +22 -15
  8. package/addon/components/cf-field/input/integer.hbs +22 -15
  9. package/addon/components/cf-field/input/number-separator.hbs +19 -12
  10. package/addon/components/cf-field/input/number-separator.js +10 -2
  11. package/addon/components/cf-field/input/powerselect.hbs +2 -2
  12. package/addon/components/cf-field/input/powerselect.js +12 -0
  13. package/addon/components/cf-field/input/radio.hbs +3 -1
  14. package/addon/components/cf-field/input/radio.js +15 -0
  15. package/addon/components/cf-field/input/static.hbs +0 -1
  16. package/addon/components/cf-field/input/table.hbs +32 -1
  17. package/addon/components/cf-field/input/table.js +10 -0
  18. package/addon/components/cf-field/input/text.hbs +21 -14
  19. package/addon/components/cf-field/input/textarea.hbs +21 -14
  20. package/addon/components/cf-field/input-compare/changes-note.hbs +9 -0
  21. package/addon/components/cf-field/input-compare/text-diff.hbs +6 -0
  22. package/addon/components/cf-field/input-compare/textarea-diff.hbs +6 -0
  23. package/addon/components/cf-field/input-compare.hbs +50 -0
  24. package/addon/components/cf-field/input-compare.js +60 -0
  25. package/addon/components/cf-field/input.hbs +1 -0
  26. package/addon/components/cf-field.hbs +17 -8
  27. package/addon/components/cf-field.js +15 -3
  28. package/addon/components/cf-form-wrapper.hbs +1 -0
  29. package/addon/components/cf-form.hbs +1 -0
  30. package/addon/components/cf-navigation-item.hbs +14 -4
  31. package/addon/components/cf-navigation.hbs +1 -0
  32. package/addon/components/document-validity.js +34 -28
  33. package/addon/components/timeline-select.hbs +20 -0
  34. package/addon/gql/queries/document-answers-compare.graphql +157 -0
  35. package/addon/helpers/get-widget.js +17 -31
  36. package/addon/instance-initializers/form-widget-overrides.js +6 -0
  37. package/addon/lib/answer.js +38 -3
  38. package/addon/lib/compare.js +161 -0
  39. package/addon/lib/document.js +10 -2
  40. package/addon/lib/field.js +81 -1
  41. package/addon/lib/fieldset.js +11 -0
  42. package/addon/lib/navigation.js +51 -1
  43. package/addon/lib/parsers.js +57 -5
  44. package/addon/services/caluma-store.js +12 -0
  45. package/app/components/cf-field/input-compare/changes-note.js +1 -0
  46. package/app/components/cf-field/input-compare/text-diff.js +1 -0
  47. package/app/components/cf-field/input-compare/textarea-diff.js +1 -0
  48. package/app/components/cf-field/input-compare.js +1 -0
  49. package/app/components/timeline-select.js +1 -0
  50. package/app/styles/@projectcaluma/ember-form.scss +1 -0
  51. package/app/styles/_cf-content-compare.scss +214 -0
  52. package/app/styles/_cf-navigation.scss +1 -0
  53. package/package.json +5 -6
  54. package/translations/de.yaml +9 -0
  55. package/translations/en.yaml +9 -0
  56. package/translations/fr.yaml +9 -0
  57. package/translations/it.yaml +9 -0
  58. package/addon/initializers/register-showdown-extensions.js +0 -20
  59. package/app/initializers/register-showdown-extensions.js +0 -4
@@ -0,0 +1,214 @@
1
+ @use "sass:color";
2
+
3
+ $diff-danger-background: color.adjust(
4
+ $global-danger-background,
5
+ $lightness: 25%
6
+ );
7
+ $diff-success-background: color.adjust(
8
+ $global-success-background,
9
+ $lightness: 30%
10
+ );
11
+ $diff-warning-background: color.adjust(
12
+ $global-warning-background,
13
+ $lightness: 25%
14
+ );
15
+
16
+ .cf-compare {
17
+ position: relative;
18
+
19
+ &:not(.cf-compare-manual) > ::before {
20
+ content: "";
21
+ position: absolute;
22
+ inset: 0 auto calc($global-small-margin * -1)
23
+ calc($global-small-margin * -1);
24
+ pointer-events: none;
25
+ z-index: 1;
26
+ border-right: 2px dotted $global-primary-background;
27
+ }
28
+
29
+ // Default from/to version styling.
30
+ :not(.cf-compare-removed),
31
+ :not(.cf-compare-added) {
32
+ .uk-input {
33
+ overflow: visible;
34
+ text-wrap: wrap;
35
+ height: auto;
36
+ }
37
+
38
+ .diff-from-version {
39
+ background: $diff-danger-background;
40
+ }
41
+
42
+ .diff-to-version {
43
+ background: $diff-success-background;
44
+ }
45
+
46
+ .diff-is-added {
47
+ background: $diff-success-background;
48
+ }
49
+
50
+ .diff-is-modified {
51
+ background: $diff-warning-background;
52
+ }
53
+
54
+ .diff-is-removed {
55
+ background: $diff-danger-background;
56
+ }
57
+ }
58
+
59
+ // Specific styling for ember basic dropdowns.
60
+ &.cf-compare-ChoiceQuestion,
61
+ &.cf-compare-MultipleChoiceQuestion,
62
+ &.cf-compare-DynamicChoiceQuestion {
63
+ .from-version .ember-basic-dropdown-trigger {
64
+ background: $diff-danger-background;
65
+ }
66
+
67
+ .to-version .ember-basic-dropdown-trigger {
68
+ background: $diff-success-background;
69
+ }
70
+ }
71
+
72
+ // Specific styling for table questions.
73
+ &.cf-compare-TableQuestion {
74
+ .diff-removed {
75
+ background: $diff-danger-background;
76
+ }
77
+
78
+ .diff-modified {
79
+ background: $diff-warning-background;
80
+ }
81
+
82
+ .diff-added {
83
+ background: $diff-success-background;
84
+ }
85
+ }
86
+
87
+ // Overrides for added documents.
88
+ &.cf-compare-added {
89
+ .diff-from-version {
90
+ display: none;
91
+ }
92
+
93
+ .diff-to-version {
94
+ background: $diff-success-background;
95
+ }
96
+
97
+ &.cf-compare-TextQuestion,
98
+ &.cf-compare-DateQuestion,
99
+ &.cf-compare-IntegerQuestion,
100
+ &.cf-compare-FloatQuestion,
101
+ &.cf-compare-CalculatedFloatQuestion {
102
+ .from-version input {
103
+ display: none;
104
+ }
105
+
106
+ .to-version input {
107
+ background: $diff-success-background;
108
+ }
109
+ }
110
+
111
+ &.cf-compare-TextareaQuestion {
112
+ .from-version {
113
+ display: none;
114
+ }
115
+
116
+ .to-version {
117
+ background: $diff-success-background;
118
+ }
119
+ }
120
+
121
+ &.cf-compare-ChoiceQuestion,
122
+ &.cf-compare-MultipleChoiceQuestion,
123
+ &.cf-compare-DynamicChoiceQuestion {
124
+ .from-version .ember-basic-dropdown-trigger {
125
+ display: none;
126
+ }
127
+
128
+ .to-version .ember-basic-dropdown-trigger {
129
+ background: $diff-success-background;
130
+ }
131
+ }
132
+ }
133
+
134
+ // Overrides for removed documents.
135
+ &.cf-compare-removed {
136
+ .diff-from-version {
137
+ display: none;
138
+ }
139
+
140
+ .diff-to-version {
141
+ background: $diff-danger-background;
142
+ }
143
+
144
+ &.cf-compare-TextQuestion,
145
+ &.cf-compare-DateQuestion,
146
+ &.cf-compare-IntegerQuestion,
147
+ &.cf-compare-FloatQuestion,
148
+ &.cf-compare-CalculatedFloatQuestion {
149
+ .from-version input {
150
+ background: $diff-danger-background;
151
+ }
152
+
153
+ .to-version input {
154
+ display: none;
155
+ }
156
+ }
157
+
158
+ &.cf-compare-TextareaQuestion {
159
+ .from-version {
160
+ background: $diff-danger-background;
161
+ }
162
+
163
+ .to-version {
164
+ display: none;
165
+ }
166
+ }
167
+
168
+ &.cf-compare-ChoiceQuestion,
169
+ &.cf-compare-MultipleChoiceQuestion,
170
+ &.cf-compare-DynamicChoiceQuestion {
171
+ .from-version .ember-basic-dropdown-trigger {
172
+ display: none;
173
+ }
174
+
175
+ .to-version .ember-basic-dropdown-trigger {
176
+ background: $diff-danger-background;
177
+ }
178
+ }
179
+ }
180
+
181
+ // Extra specific styling for textarea questions.
182
+ &.cf-compare-TextareaQuestion .uk-form-controls {
183
+ .uk-textarea {
184
+ padding: 0;
185
+ height: auto;
186
+ }
187
+
188
+ .diff-from-version,
189
+ .diff-to-version {
190
+ white-space: pre-line;
191
+ padding: 2px 4px;
192
+ min-height: $global-medium-font-size;
193
+ }
194
+ }
195
+
196
+ // Extra specific styling for choice questions.
197
+ &.cf-compare-ChoiceQuestion .uk-form-controls,
198
+ &.cf-compare-MultipleChoiceQuestion .uk-form-controls {
199
+ label {
200
+ display: block;
201
+ padding: 4px;
202
+ line-height: 1rem;
203
+
204
+ input {
205
+ margin: 0;
206
+ padding: 0;
207
+ }
208
+ }
209
+
210
+ br {
211
+ display: none;
212
+ }
213
+ }
214
+ }
@@ -51,6 +51,7 @@ $icon-size: 0.8rem !default;
51
51
  }
52
52
  }
53
53
 
54
+ .cf-navigation__item__icon--compare-modified,
54
55
  .cf-navigation__item__icon--in-progress.cf-navigation__item__icon--dirty {
55
56
  color: color.adjust($global-warning-background, $lightness: -20%);
56
57
  border-color: color.adjust($global-warning-background, $lightness: 10%);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-form",
3
- "version": "14.8.2",
3
+ "version": "14.9.0",
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.2"
42
+ "@projectcaluma/ember-core": "^14.9.0"
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.2",
79
- "@projectcaluma/ember-workflow": "14.8.2"
77
+ "@projectcaluma/ember-testing": "14.9.0",
78
+ "@projectcaluma/ember-workflow": "14.9.0"
80
79
  },
81
80
  "peerDependencies": {
82
81
  "ember-source": ">= 4.0.0",
83
- "@projectcaluma/ember-workflow": "^14.8.2"
82
+ "@projectcaluma/ember-workflow": "^14.9.0"
84
83
  },
85
84
  "dependenciesMeta": {
86
85
  "@projectcaluma/ember-core": {
@@ -57,3 +57,12 @@ caluma:
57
57
  format: "{errorMsg}"
58
58
  table: "Mindestens eine Zeile der Tabelle wurde nicht korrekt ausgefüllt"
59
59
  error: "Folgende Fragen sind noch nicht korrekt ausgefüllt:"
60
+
61
+ compare:
62
+ note: "Geändert von {username} am {date}"
63
+ diff:
64
+ added: "Hinzugefügt"
65
+ removed: "Entfernt"
66
+ modified: "Geändert"
67
+ timeline:
68
+ current: "Aktueller Formularstand"
@@ -57,3 +57,12 @@ caluma:
57
57
  format: "{errorMsg}"
58
58
  table: "At least one row of the table was not filled in correctly"
59
59
  error: "The following questions have not yet been filled in correctly:"
60
+
61
+ compare:
62
+ note: "Changed by {username} on {date}"
63
+ diff:
64
+ added: "Added"
65
+ removed: "Removed"
66
+ modified: "Modified"
67
+ timeline:
68
+ current: "Current form version"
@@ -57,3 +57,12 @@ caluma:
57
57
  format: "{errorMsg}"
58
58
  table: "Au moins une ligne du tableau n'a pas été remplie correctement"
59
59
  error: "Les questions suivantes n'ont pas encore été correctement remplies :"
60
+
61
+ compare:
62
+ note: "Modifié par {username} le {date}"
63
+ diff:
64
+ added: "Ajouté"
65
+ removed: "Supprimé"
66
+ modified: "Modifié"
67
+ timeline:
68
+ current: "Version actuelle du formulaire"
@@ -57,3 +57,12 @@ caluma:
57
57
  format: "{errorMsg}"
58
58
  table: "Almeno una riga della tabella non è stata compilata correttamente."
59
59
  error: "Le domande seguenti non sono state compilate in modo corretto:"
60
+
61
+ compare:
62
+ note: "Modificato da {username} il {date}"
63
+ diff:
64
+ added: "Aggiunto"
65
+ removed: "Rimosso"
66
+ modified: "Modificato"
67
+ timeline:
68
+ current: "Versione attuale del modulo"
@@ -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
- };
@@ -1,4 +0,0 @@
1
- export {
2
- default,
3
- initialize,
4
- } from "@projectcaluma/ember-form/initializers/register-showdown-extensions";