@projectcaluma/ember-form 11.0.0-beta.3 → 11.0.0-beta.30
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +209 -0
- package/addon/components/cf-content.hbs +38 -37
- package/addon/components/cf-content.js +2 -2
- package/addon/components/cf-field/hint.hbs +5 -0
- package/addon/components/cf-field/info.hbs +2 -2
- package/addon/components/cf-field/info.js +0 -15
- package/addon/components/cf-field/input/action-button.hbs +8 -4
- package/addon/components/cf-field/input/action-button.js +60 -59
- package/addon/components/cf-field/input/checkbox.hbs +2 -3
- package/addon/components/cf-field/input/date.hbs +10 -5
- package/addon/components/cf-field/input/date.js +40 -10
- package/addon/components/cf-field/input/files.hbs +38 -0
- package/addon/components/cf-field/input/files.js +113 -0
- package/addon/components/cf-field/input/powerselect.hbs +27 -29
- package/addon/components/cf-field/input/powerselect.js +8 -2
- package/addon/components/cf-field/input/radio.hbs +2 -2
- package/addon/components/cf-field/input/static.hbs +1 -1
- package/addon/components/cf-field/input/table.hbs +20 -19
- package/addon/components/cf-field/input/table.js +1 -11
- package/addon/components/cf-field/input.hbs +8 -21
- package/addon/components/cf-field/input.js +32 -14
- package/addon/components/cf-field/label.hbs +4 -2
- package/addon/components/cf-field-value.hbs +22 -7
- package/addon/components/cf-field-value.js +12 -36
- package/addon/components/cf-field.hbs +42 -9
- package/addon/components/cf-field.js +41 -17
- package/addon/components/cf-form-wrapper.hbs +4 -1
- package/addon/components/cf-form.hbs +6 -1
- package/addon/components/document-validity.js +16 -1
- package/addon/gql/fragments/field.graphql +32 -2
- package/addon/gql/mutations/save-document-files-answer.graphql +9 -0
- package/addon/gql/queries/document-forms.graphql +1 -1
- package/addon/gql/queries/dynamic-options.graphql +1 -1
- package/addon/gql/queries/{fileanswer-info.graphql → filesanswer-info.graphql} +4 -4
- package/addon/helpers/format-graphql-error.js +21 -0
- package/addon/helpers/get-widget.js +16 -2
- package/addon/instance-initializers/form-widget-overrides.js +52 -0
- package/addon/lib/field.js +78 -51
- package/addon/lib/navigation.js +3 -1
- package/addon/lib/question.js +12 -4
- package/addon/modifiers/autoresize.js +14 -0
- package/addon/services/caluma-store.js +2 -0
- package/app/components/cf-field/{input/file.js → hint.js} +1 -1
- package/app/components/cf-field/input/files.js +1 -0
- package/app/helpers/format-graphql-error.js +1 -0
- package/app/helpers/get-widget.js +1 -4
- package/app/instance-initializers/form-widget-overrides.js +4 -0
- package/app/modifiers/autoresize.js +1 -0
- package/app/styles/@projectcaluma/ember-form.scss +3 -15
- package/package.json +44 -34
- package/translations/de.yaml +6 -2
- package/translations/en.yaml +6 -2
- package/translations/fr.yaml +6 -2
- package/addon/components/cf-field/input/file.hbs +0 -32
- package/addon/components/cf-field/input/file.js +0 -89
- package/addon/components/cf-field/label.js +0 -11
- package/addon/gql/mutations/remove-answer.graphql +0 -7
- package/addon/gql/mutations/save-document-file-answer.graphql +0 -9
- package/addon/instance-initializers/setup-pikaday-i18n.js +0 -35
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,212 @@
|
|
1
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.23](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.22...@projectcaluma/ember-form-v11.0.0-beta.23) (2022-08-15)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* **files:** disable delete button when field is disabled ([#2086](https://github.com/projectcaluma/ember-caluma/issues/2086)) ([2055c53](https://github.com/projectcaluma/ember-caluma/commit/2055c53cbcfe07fbdcfa46e6042a763b4b643d65))
|
7
|
+
* **form:** allow deselecting disabled multiple choice options ([0dd663e](https://github.com/projectcaluma/ember-caluma/commit/0dd663e467b66f0f8742d667630c28255e03e161))
|
8
|
+
|
9
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.22](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.21...@projectcaluma/ember-form-v11.0.0-beta.22) (2022-08-05)
|
10
|
+
|
11
|
+
|
12
|
+
* feat!: add multi file upload (#2040) ([c4fd004](https://github.com/projectcaluma/ember-caluma/commit/c4fd0049654b2d2e5ea62e5909a45d89cb888b40)), closes [#2040](https://github.com/projectcaluma/ember-caluma/issues/2040)
|
13
|
+
|
14
|
+
|
15
|
+
### BREAKING CHANGES
|
16
|
+
|
17
|
+
* This requires the caluma backend version v8.0.0-beta.12
|
18
|
+
or later.
|
19
|
+
|
20
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.21](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.20...@projectcaluma/ember-form-v11.0.0-beta.21) (2022-06-09)
|
21
|
+
|
22
|
+
|
23
|
+
### Features
|
24
|
+
|
25
|
+
* **caluma:** use new filter syntax of caluma ([7a00c03](https://github.com/projectcaluma/ember-caluma/commit/7a00c03a103933d9e48dd88adb7382441a298742))
|
26
|
+
|
27
|
+
|
28
|
+
### BREAKING CHANGES
|
29
|
+
|
30
|
+
* **caluma:** `ember-caluma` now requires Caluma version >=
|
31
|
+
8.0.0-beta.6
|
32
|
+
|
33
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.20](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.19...@projectcaluma/ember-form-v11.0.0-beta.20) (2022-06-09)
|
34
|
+
|
35
|
+
|
36
|
+
### Bug Fixes
|
37
|
+
|
38
|
+
* **form:** improve validation of choice and multiple choice fields ([e828fad](https://github.com/projectcaluma/ember-caluma/commit/e828fad9557fd521ca9eec63af74f8cee12e3910))
|
39
|
+
* **form:** pass context to table row form ([af1031a](https://github.com/projectcaluma/ember-caluma/commit/af1031ae9e8138a404cd043199709025092da882))
|
40
|
+
|
41
|
+
|
42
|
+
### Features
|
43
|
+
|
44
|
+
* **form:** add option to bypass the timeout when saving a field ([a2ba306](https://github.com/projectcaluma/ember-caluma/commit/a2ba306306f90a2d2279b34550507241f0987961))
|
45
|
+
|
46
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.19](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.18...@projectcaluma/ember-form-v11.0.0-beta.19) (2022-05-09)
|
47
|
+
|
48
|
+
|
49
|
+
### Bug Fixes
|
50
|
+
|
51
|
+
* **resources:** fix deprecations of ember-resources ([7a84c5c](https://github.com/projectcaluma/ember-caluma/commit/7a84c5c78d5b28f7b5393c64722907728dd5f42b))
|
52
|
+
|
53
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.18](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.17...@projectcaluma/ember-form-v11.0.0-beta.18) (2022-04-13)
|
54
|
+
|
55
|
+
|
56
|
+
### Bug Fixes
|
57
|
+
|
58
|
+
* **form:** fix error formatting for older browsers ([9e34876](https://github.com/projectcaluma/ember-caluma/commit/9e3487625ccb73918b32fdf787054bab9114162f))
|
59
|
+
|
60
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.17](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.16...@projectcaluma/ember-form-v11.0.0-beta.17) (2022-04-07)
|
61
|
+
|
62
|
+
|
63
|
+
### Bug Fixes
|
64
|
+
|
65
|
+
* **form:** fix error status indicator for backend errors ([03fc27e](https://github.com/projectcaluma/ember-caluma/commit/03fc27e0626edf3a6f774c41d25485158ee6a99d)), closes [#1877](https://github.com/projectcaluma/ember-caluma/issues/1877)
|
66
|
+
|
67
|
+
|
68
|
+
### Features
|
69
|
+
|
70
|
+
* **cf-field:** add optional hints for form fields ([d847fbf](https://github.com/projectcaluma/ember-caluma/commit/d847fbffa376ea60971fb9e91aff8bf54ce77d50))
|
71
|
+
* **form:** show technical details of backend errors in UI ([c34cda6](https://github.com/projectcaluma/ember-caluma/commit/c34cda691f78623f41da1f9d75a39efce7e0ff0f))
|
72
|
+
|
73
|
+
|
74
|
+
### BREAKING CHANGES
|
75
|
+
|
76
|
+
* **cf-field:** Question hints requires Caluma >= v7.15.0
|
77
|
+
|
78
|
+
Add option to create hints for certain question types. These
|
79
|
+
are displayed below the input field and can be used to provide
|
80
|
+
short, informative messages. Hints are available for all question
|
81
|
+
types except for form, static and action button questions.
|
82
|
+
|
83
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.16](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.15...@projectcaluma/ember-form-v11.0.0-beta.16) (2022-03-23)
|
84
|
+
|
85
|
+
|
86
|
+
### Bug Fixes
|
87
|
+
|
88
|
+
* **embroider:** add missing dependency on @ember/string ([3a6e6bb](https://github.com/projectcaluma/ember-caluma/commit/3a6e6bb39a8c1a40a2ae00b3d4ea00606a755e25))
|
89
|
+
* **embroider:** fix dynamic component usage ([1cf0f6e](https://github.com/projectcaluma/ember-caluma/commit/1cf0f6e2914651bbb0ec70d1f7485fd9db90c9b5))
|
90
|
+
* **embroider:** remove obsolete export for getWidget helper function ([94fb461](https://github.com/projectcaluma/ember-caluma/commit/94fb461aaa7cac6af9f5612b8f34ad047a2b67bb))
|
91
|
+
|
92
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.15](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.14...@projectcaluma/ember-form-v11.0.0-beta.15) (2022-03-16)
|
93
|
+
|
94
|
+
|
95
|
+
### Bug Fixes
|
96
|
+
|
97
|
+
* **form:** make sure dynamic options are loaded before validating ([2713b37](https://github.com/projectcaluma/ember-caluma/commit/2713b3718b64f9111ca3e7bec2a6c60fafcb183a))
|
98
|
+
|
99
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.14](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.13...@projectcaluma/ember-form-v11.0.0-beta.14) (2022-03-11)
|
100
|
+
|
101
|
+
|
102
|
+
### Bug Fixes
|
103
|
+
|
104
|
+
* **form:** make sure table controls are always visible ([8cd97d2](https://github.com/projectcaluma/ember-caluma/commit/8cd97d204539f2e84b9baf9841591460bddf145a))
|
105
|
+
|
106
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.13](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.12...@projectcaluma/ember-form-v11.0.0-beta.13) (2022-03-11)
|
107
|
+
|
108
|
+
|
109
|
+
### Bug Fixes
|
110
|
+
|
111
|
+
* **form:** don't refetch dynamic options on validation ([27061c6](https://github.com/projectcaluma/ember-caluma/commit/27061c67f0562508f558305247cb51d615fa36b0))
|
112
|
+
* **form:** fix input in date fields ([cf54bf5](https://github.com/projectcaluma/ember-caluma/commit/cf54bf5542e35fd7dbe293a9e22288afae6a517a))
|
113
|
+
* **navigation:** exclude static questions from visible fields ([6ebd085](https://github.com/projectcaluma/ember-caluma/commit/6ebd085098df71fab693dec5282ea4b81d5b9836))
|
114
|
+
* **workflow:** return case status on complete / skip work-item mutation ([524453c](https://github.com/projectcaluma/ember-caluma/commit/524453c1189b4375ca792fca7d35056b916696f8))
|
115
|
+
|
116
|
+
|
117
|
+
### Features
|
118
|
+
|
119
|
+
* **form:** support passing component override classes ([9409c7c](https://github.com/projectcaluma/ember-caluma/commit/9409c7cb5901dcdffec1c0294046da64b74b9922))
|
120
|
+
|
121
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.12](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.11...@projectcaluma/ember-form-v11.0.0-beta.12) (2022-02-23)
|
122
|
+
|
123
|
+
|
124
|
+
### Bug Fixes
|
125
|
+
|
126
|
+
* **form:** fix textarea size in tables ([efba737](https://github.com/projectcaluma/ember-caluma/commit/efba737f0a6314225a851ee0c57c2c506403bc06))
|
127
|
+
|
128
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.11](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.10...@projectcaluma/ember-form-v11.0.0-beta.11) (2022-02-16)
|
129
|
+
|
130
|
+
|
131
|
+
### Bug Fixes
|
132
|
+
|
133
|
+
* **form:** always use monday as first day of the week in datepicker ([7008a90](https://github.com/projectcaluma/ember-caluma/commit/7008a90d737d2dca714f4799f846f4c4086ecd4d))
|
134
|
+
* **form:** use action button type "button" ([3e9795f](https://github.com/projectcaluma/ember-caluma/commit/3e9795f28b73dcf376ec9ecabcd4c1b6a8085beb))
|
135
|
+
|
136
|
+
|
137
|
+
### Features
|
138
|
+
|
139
|
+
* **form:** add notfound named block in cf-content if no document found ([f1861c1](https://github.com/projectcaluma/ember-caluma/commit/f1861c1f3b2da9843771aa1b12956190c98799a6))
|
140
|
+
|
141
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.10](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.9...@projectcaluma/ember-form-v11.0.0-beta.10) (2022-02-09)
|
142
|
+
|
143
|
+
|
144
|
+
### Bug Fixes
|
145
|
+
|
146
|
+
* **form:** always trigger data fetching in cf-content ([3fab675](https://github.com/projectcaluma/ember-caluma/commit/3fab675fca0559cd4164d4d62b44b9d9b74e4a5c))
|
147
|
+
|
148
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.9](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.8...@projectcaluma/ember-form-v11.0.0-beta.9) (2022-02-07)
|
149
|
+
|
150
|
+
|
151
|
+
### Bug Fixes
|
152
|
+
|
153
|
+
* **action-button:** only hide action button visually if disabled ([e292f09](https://github.com/projectcaluma/ember-caluma/commit/e292f093c33efd0b99a73674f8f83de5f496bf40))
|
154
|
+
* **deps:** remove moment altogether and update ember-pikday ([b2f7fa2](https://github.com/projectcaluma/ember-caluma/commit/b2f7fa28fa076897addd36e5964c926c671508ff))
|
155
|
+
* **form:** change file download actions to query and network-only ([aa4458e](https://github.com/projectcaluma/ember-caluma/commit/aa4458e944263f0f00ba1684a4f7bbfa83d2efea))
|
156
|
+
|
157
|
+
|
158
|
+
### BREAKING CHANGES
|
159
|
+
|
160
|
+
* **deps:** The host app now needs to opt-in to use the default
|
161
|
+
pikaday styles: https://github.com/adopted-ember-addons/ember-pikaday#styles
|
162
|
+
|
163
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.8](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.7...@projectcaluma/ember-form-v11.0.0-beta.8) (2022-02-03)
|
164
|
+
|
165
|
+
|
166
|
+
### Bug Fixes
|
167
|
+
|
168
|
+
* dye file upload button in default color ([ad9e1b8](https://github.com/projectcaluma/ember-caluma/commit/ad9e1b8ed18c8228c495142af1bbe1f2c219c088))
|
169
|
+
* **form:** fix isNew state of answers without backend object ([c10129f](https://github.com/projectcaluma/ember-caluma/commit/c10129ffe76d7751cd0105c71fc4ba010323e2e4))
|
170
|
+
|
171
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.7](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.6...@projectcaluma/ember-form-v11.0.0-beta.7) (2022-02-03)
|
172
|
+
|
173
|
+
|
174
|
+
### Bug Fixes
|
175
|
+
|
176
|
+
* **validation:** sync format validator validation with backend ([ee66968](https://github.com/projectcaluma/ember-caluma/commit/ee66968230b9f0e4c5a4df8bdb3f8e58b44b5b82))
|
177
|
+
|
178
|
+
|
179
|
+
### BREAKING CHANGES
|
180
|
+
|
181
|
+
* **validation:** Use the `formatValidators` property of the backend to store and read
|
182
|
+
format validators instead of the `meta.formatValidators` so the backend
|
183
|
+
validates as well. For more information on how to migrate check the
|
184
|
+
migration guide to v11.
|
185
|
+
|
186
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.6](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.5...@projectcaluma/ember-form-v11.0.0-beta.6) (2022-02-02)
|
187
|
+
|
188
|
+
|
189
|
+
### Bug Fixes
|
190
|
+
|
191
|
+
* **action-button:** hide field wrapper if action button is not displayed ([1d4b701](https://github.com/projectcaluma/ember-caluma/commit/1d4b701af35d48d072001f3295b905b1065daffe))
|
192
|
+
* render static questions ([28fff94](https://github.com/projectcaluma/ember-caluma/commit/28fff9487e4ad3153fe267db4b66208ad858aaac))
|
193
|
+
* **table:** fix styling of table fields ([30c5903](https://github.com/projectcaluma/ember-caluma/commit/30c590389ed82c37ebf666f1484501c66ca8f0bb))
|
194
|
+
|
195
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.5](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.4...@projectcaluma/ember-form-v11.0.0-beta.5) (2022-02-01)
|
196
|
+
|
197
|
+
|
198
|
+
### Bug Fixes
|
199
|
+
|
200
|
+
* **document-validity:** wait to validate until the UI has finished saving values ([9ec5330](https://github.com/projectcaluma/ember-caluma/commit/9ec5330905046604f95ab42985a29a5e0dc369a4))
|
201
|
+
* **form:** use component save task instead of field for loading indicator ([6de510d](https://github.com/projectcaluma/ember-caluma/commit/6de510d19a3608b7cd40092908d562a152ef03bd))
|
202
|
+
|
203
|
+
# [@projectcaluma/ember-form-v11.0.0-beta.4](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.3...@projectcaluma/ember-form-v11.0.0-beta.4) (2022-02-01)
|
204
|
+
|
205
|
+
|
206
|
+
### Bug Fixes
|
207
|
+
|
208
|
+
* **form:** fix closing of info modal ([b46095a](https://github.com/projectcaluma/ember-caluma/commit/b46095aa3b31bc1b2035a0818778edaa8fd9c745))
|
209
|
+
|
1
210
|
# [@projectcaluma/ember-form-v11.0.0-beta.3](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-form-v11.0.0-beta.2...@projectcaluma/ember-form-v11.0.0-beta.3) (2022-01-24)
|
2
211
|
|
3
212
|
|
@@ -1,41 +1,42 @@
|
|
1
|
-
{{#if
|
2
|
-
{{
|
3
|
-
|
4
|
-
{{
|
5
|
-
|
6
|
-
|
1
|
+
{{#if this.loading}}
|
2
|
+
<div class="uk-text-center"><UkSpinner @ratio={{2}} /></div>
|
3
|
+
{{else if this.document}}
|
4
|
+
{{#let
|
5
|
+
(hash
|
6
|
+
document=this.document
|
7
|
+
navigation=(component
|
8
|
+
"cf-navigation"
|
9
|
+
navigation=this.navigation
|
10
|
+
useAsHeading=(or @useAsHeading false)
|
11
|
+
headingBaseLevel=(or @headingBaseLevel 1)
|
12
|
+
)
|
13
|
+
pagination=(component "cf-pagination" navigation=this.navigation)
|
14
|
+
form=(component
|
15
|
+
"cf-form-wrapper"
|
7
16
|
document=this.document
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
headingBaseLevel=(or @headingBaseLevel 1)
|
13
|
-
)
|
14
|
-
pagination=(component "cf-pagination" navigation=this.navigation)
|
15
|
-
form=(component
|
16
|
-
"cf-form-wrapper"
|
17
|
-
document=this.document
|
18
|
-
fieldset=this.fieldset
|
19
|
-
context=@context
|
20
|
-
disabled=@disabled
|
21
|
-
)
|
17
|
+
fieldset=this.fieldset
|
18
|
+
context=@context
|
19
|
+
disabled=@disabled
|
20
|
+
onSave=@onSave
|
22
21
|
)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
{{
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
22
|
+
)
|
23
|
+
as |content|
|
24
|
+
}}
|
25
|
+
{{#if (has-block)}}
|
26
|
+
{{yield content}}
|
27
|
+
{{else if (gt this.document.fieldsets.length 1)}}
|
28
|
+
<div uk-grid>
|
29
|
+
<div class="uk-width-1-1 uk-width-1-3@m"><content.navigation /></div>
|
30
|
+
<div class="uk-width-1-1 uk-width-2-3@m">
|
31
|
+
<content.form />
|
32
|
+
<hr />
|
33
|
+
<content.pagination />
|
35
34
|
</div>
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
{{/
|
40
|
-
{{/
|
35
|
+
</div>
|
36
|
+
{{else}}
|
37
|
+
<content.form />
|
38
|
+
{{/if}}
|
39
|
+
{{/let}}
|
40
|
+
{{else}}
|
41
|
+
{{yield to="notfound"}}
|
41
42
|
{{/if}}
|
@@ -4,7 +4,7 @@ import { inject as service } from "@ember/service";
|
|
4
4
|
import Component from "@glimmer/component";
|
5
5
|
import { queryManager } from "ember-apollo-client";
|
6
6
|
import { dropTask } from "ember-concurrency";
|
7
|
-
import {
|
7
|
+
import { trackedTask } from "ember-resources/util/ember-concurrency";
|
8
8
|
|
9
9
|
import getDocumentAnswersQuery from "@projectcaluma/ember-form/gql/queries/document-answers.graphql";
|
10
10
|
import getDocumentFormsQuery from "@projectcaluma/ember-form/gql/queries/document-forms.graphql";
|
@@ -125,7 +125,7 @@ export default class CfContentComponent extends Component {
|
|
125
125
|
);
|
126
126
|
}
|
127
127
|
|
128
|
-
data =
|
128
|
+
data = trackedTask(this, this.fetchData, () => [this.args.documentId]);
|
129
129
|
|
130
130
|
@dropTask
|
131
131
|
*fetchData() {
|
@@ -4,7 +4,7 @@
|
|
4
4
|
class="uk-icon-button"
|
5
5
|
uk-icon="info"
|
6
6
|
title={{t "caluma.form.info"}}
|
7
|
-
{{on "click" this.
|
7
|
+
{{on "click" (fn (mut this.modalVisible) true)}}
|
8
8
|
>
|
9
9
|
<span class="uk-hidden">{{t "caluma.form.info"}}</span>
|
10
10
|
</button>
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<UkModal
|
13
13
|
@visible={{this.modalVisible}}
|
14
14
|
@stack={{true}}
|
15
|
-
@onHide={{this.
|
15
|
+
@onHide={{fn (mut this.modalVisible) false}}
|
16
16
|
as |modal|
|
17
17
|
>
|
18
18
|
<modal.body>
|
@@ -1,21 +1,6 @@
|
|
1
|
-
import { action } from "@ember/object";
|
2
1
|
import Component from "@glimmer/component";
|
3
2
|
import { tracked } from "@glimmer/tracking";
|
4
3
|
|
5
4
|
export default class CfFieldInfoComponent extends Component {
|
6
5
|
@tracked modalVisible = false;
|
7
|
-
|
8
|
-
@action
|
9
|
-
showModal(e) {
|
10
|
-
e.preventDefault();
|
11
|
-
|
12
|
-
this.modalVisible = true;
|
13
|
-
}
|
14
|
-
|
15
|
-
@action
|
16
|
-
hideModal(e) {
|
17
|
-
e.preventDefault();
|
18
|
-
|
19
|
-
this.modalVisible = false;
|
20
|
-
}
|
21
6
|
}
|
@@ -1,4 +1,8 @@
|
|
1
|
-
{{#
|
1
|
+
{{#if
|
2
|
+
(macroCondition
|
3
|
+
(macroDependencySatisfies "@projectcaluma/ember-workflow" "*")
|
4
|
+
)
|
5
|
+
}}
|
2
6
|
<DocumentValidity
|
3
7
|
@document={{@field.document}}
|
4
8
|
@validateOnEnter={{this.validateOnEnter}}
|
@@ -8,12 +12,12 @@
|
|
8
12
|
@workItemId={{this.workItem}}
|
9
13
|
@mutation={{this.action}}
|
10
14
|
@label={{@field.question.raw.label}}
|
11
|
-
@disabled={{and (not-eq isValid null) (not isValid)}}
|
15
|
+
@disabled={{or (and (not-eq isValid null) (not isValid)) @disabled}}
|
12
16
|
@color={{this.color}}
|
13
17
|
@beforeMutate={{fn this.beforeMutate validate}}
|
14
18
|
@onSuccess={{this.onSuccess}}
|
15
19
|
@onError={{this.onError}}
|
16
|
-
|
20
|
+
class={{if @disabled "uk-hidden"}}
|
17
21
|
/>
|
18
22
|
</DocumentValidity>
|
19
|
-
{{/
|
23
|
+
{{/if}}
|
@@ -1,77 +1,78 @@
|
|
1
1
|
import { assert } from "@ember/debug";
|
2
2
|
import { action } from "@ember/object";
|
3
|
+
import { dependencySatisfies, macroCondition } from "@embroider/macros";
|
3
4
|
import Component from "@glimmer/component";
|
4
|
-
import
|
5
|
+
import { confirm } from "ember-uikit";
|
5
6
|
|
6
|
-
|
7
|
-
try {
|
8
|
-
await UIkit.modal.confirm(text);
|
7
|
+
let CfFieldInputActionButtonComponent;
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
}
|
9
|
+
if (macroCondition(dependencySatisfies("@projectcaluma/ember-workflow", ""))) {
|
10
|
+
CfFieldInputActionButtonComponent = class extends Component {
|
11
|
+
constructor(...args) {
|
12
|
+
super(...args);
|
15
13
|
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
assert(
|
15
|
+
"The document must have a `workItemUuid` for `<CfField::Input::ActionButton />` to work.",
|
16
|
+
this.args.field.document.workItemUuid
|
17
|
+
);
|
18
|
+
}
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
get workItem() {
|
21
|
+
return (
|
22
|
+
this.args.context?.actionButtonWorkItemId ||
|
23
|
+
this.args.field.document.workItemUuid
|
24
|
+
);
|
25
|
+
}
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
this.args.field.document.workItemUuid
|
30
|
-
);
|
31
|
-
}
|
27
|
+
get action() {
|
28
|
+
return this.args.field.question.raw.action.toLowerCase();
|
29
|
+
}
|
32
30
|
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
get color() {
|
32
|
+
return this.args.field.question.raw.color.toLowerCase();
|
33
|
+
}
|
36
34
|
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
get validateOnEnter() {
|
36
|
+
return (
|
37
|
+
this.args.field.question.raw.action === "COMPLETE" &&
|
38
|
+
this.args.field.question.raw.validateOnEnter
|
39
|
+
);
|
40
|
+
}
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
@action
|
43
|
+
async beforeMutate(validateFn) {
|
44
|
+
if (
|
45
|
+
this.args.field.question.raw.action === "COMPLETE" &&
|
46
|
+
!(await validateFn())
|
47
|
+
) {
|
48
|
+
return false;
|
49
|
+
}
|
46
50
|
|
47
|
-
|
48
|
-
return (
|
49
|
-
this.args.field.question.raw.action === "COMPLETE" &&
|
50
|
-
this.args.field.question.raw.validateOnEnter
|
51
|
-
);
|
52
|
-
}
|
51
|
+
const confirmText = this.args.field.question.raw.infoText;
|
53
52
|
|
54
|
-
|
55
|
-
async beforeMutate(validateFn) {
|
56
|
-
if (
|
57
|
-
this.args.field.question.raw.action === "COMPLETE" &&
|
58
|
-
!(await validateFn())
|
59
|
-
) {
|
60
|
-
return false;
|
53
|
+
return !confirmText || confirm(confirmText);
|
61
54
|
}
|
62
55
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
56
|
+
@action
|
57
|
+
onSuccess() {
|
58
|
+
return this.args.context?.actionButtonOnSuccess?.();
|
59
|
+
}
|
67
60
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
61
|
+
@action
|
62
|
+
onError(error) {
|
63
|
+
return this.args.context?.actionButtonOnError?.(error);
|
64
|
+
}
|
65
|
+
};
|
66
|
+
} else {
|
67
|
+
CfFieldInputActionButtonComponent = class extends Component {
|
68
|
+
constructor(...args) {
|
69
|
+
super(...args);
|
72
70
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
71
|
+
assert(
|
72
|
+
"@projectcaluma/ember-workflow must be installed to enable the usage of the action button questions"
|
73
|
+
);
|
74
|
+
}
|
75
|
+
};
|
77
76
|
}
|
77
|
+
|
78
|
+
export default CfFieldInputActionButtonComponent;
|
@@ -1,8 +1,7 @@
|
|
1
1
|
{{#each @field.options as |option i|}}
|
2
|
-
{{#if (gt i 0)}}<br />{{/if}}
|
2
|
+
{{#if (and (gt i 0) (not @field.raw.question.meta.vertical))}}<br />{{/if}}
|
3
3
|
<label
|
4
|
-
class="
|
5
|
-
{{if @field.isInvalid 'uk-form-danger'}}
|
4
|
+
class="{{if @field.isInvalid 'uk-form-danger'}}
|
6
5
|
{{if @field.raw.question.meta.vertical 'uk-margin-large-right'}}"
|
7
6
|
>
|
8
7
|
<input
|
@@ -13,13 +13,18 @@
|
|
13
13
|
readonly
|
14
14
|
/>
|
15
15
|
{{else}}
|
16
|
-
<
|
16
|
+
<input
|
17
17
|
class="uk-input"
|
18
|
+
type="text"
|
18
19
|
name={{@field.pk}}
|
19
20
|
id={{@field.pk}}
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
{{pikaday
|
22
|
+
firstDay=1
|
23
|
+
toString=this.formatDate
|
24
|
+
i18n=this.pikadayTranslations
|
25
|
+
value=@field.answer.value
|
26
|
+
onSelect=this.onChange
|
27
|
+
parse=this.parseDate
|
28
|
+
}}
|
24
29
|
/>
|
25
30
|
{{/if}}
|
@@ -1,19 +1,49 @@
|
|
1
1
|
import { action } from "@ember/object";
|
2
|
+
import { inject as service } from "@ember/service";
|
2
3
|
import Component from "@glimmer/component";
|
3
|
-
import
|
4
|
+
import { DateTime, Info } from "luxon";
|
5
|
+
import { cached } from "tracked-toolbox";
|
6
|
+
|
7
|
+
// put the last element to the front of the array
|
8
|
+
const shift = (array) => [...array.slice(-1), ...array.slice(0, -1)];
|
4
9
|
|
5
10
|
export default class CfFieldInputDateComponent extends Component {
|
11
|
+
@service intl;
|
12
|
+
|
6
13
|
@action
|
7
14
|
onChange(date) {
|
8
15
|
// Change Javascript date to ISO string if not null.
|
9
|
-
this.args.onSave(
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
this.args.onSave(date ? DateTime.fromJSDate(date).toISODate() : null);
|
17
|
+
}
|
18
|
+
|
19
|
+
@action
|
20
|
+
parseDate(value) {
|
21
|
+
const date = DateTime.fromFormat(value, "D", {
|
22
|
+
locale: this.intl.primaryLocale,
|
23
|
+
});
|
24
|
+
|
25
|
+
return date.isValid ? date.toJSDate() : null;
|
26
|
+
}
|
27
|
+
|
28
|
+
@action
|
29
|
+
formatDate(date) {
|
30
|
+
return this.intl.formatDate(date, {
|
31
|
+
day: "2-digit",
|
32
|
+
month: "2-digit",
|
33
|
+
year: "numeric",
|
34
|
+
});
|
35
|
+
}
|
36
|
+
|
37
|
+
@cached
|
38
|
+
get pikadayTranslations() {
|
39
|
+
const locale = this.intl.primaryLocale;
|
40
|
+
|
41
|
+
return {
|
42
|
+
previousMonth: this.intl.t("caluma.form.pikaday.month-previous"),
|
43
|
+
nextMonth: this.intl.t("caluma.form.pikaday.month-next"),
|
44
|
+
months: Info.months("long", { locale }),
|
45
|
+
weekdays: shift(Info.weekdays("long", { locale })),
|
46
|
+
weekdaysShort: shift(Info.weekdays("short", { locale })),
|
47
|
+
};
|
18
48
|
}
|
19
49
|
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<div class="uk-flex-middle uk-grid-divider uk-grid-column-small" uk-grid>
|
2
|
+
<div uk-form-custom="target: true">
|
3
|
+
|
4
|
+
<input
|
5
|
+
type="file"
|
6
|
+
name={{@field.pk}}
|
7
|
+
id={{@field.pk}}
|
8
|
+
disabled={{@disabled}}
|
9
|
+
multiple
|
10
|
+
{{on "change" this.save}}
|
11
|
+
/>
|
12
|
+
<UkButton disabled={{@disabled}}>
|
13
|
+
{{t "caluma.form.selectFile"}}
|
14
|
+
</UkButton>
|
15
|
+
</div>
|
16
|
+
<ul class="uk-list uk-list-collapse" data-test-file-list={{@field.pk}}>
|
17
|
+
{{#each this.files as |file|}}
|
18
|
+
<li class="uk-text-justify uk-text-middle">
|
19
|
+
<UkButton
|
20
|
+
data-test-download-link={{file.id}}
|
21
|
+
@color="link"
|
22
|
+
@onClick={{fn this.download file.id}}
|
23
|
+
>
|
24
|
+
{{file.name}}
|
25
|
+
</UkButton>
|
26
|
+
{{#unless @disabled}}
|
27
|
+
<UkIcon
|
28
|
+
data-test-delete={{file.id}}
|
29
|
+
class="uk-icon-button uk-margin-small-left"
|
30
|
+
role="button"
|
31
|
+
@icon="trash"
|
32
|
+
{{on "click" (fn this.delete file.id)}}
|
33
|
+
/>
|
34
|
+
{{/unless}}
|
35
|
+
</li>
|
36
|
+
{{/each}}
|
37
|
+
</ul>
|
38
|
+
</div>
|