@operato/dataset 8.0.0 → 9.0.0-beta.1

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 (28) hide show
  1. package/CHANGELOG.md +188 -32
  2. package/dist/src/ox-data-entry-form.d.ts +3 -2
  3. package/dist/src/ox-data-entry-form.js +66 -141
  4. package/dist/src/ox-data-entry-form.js.map +1 -1
  5. package/dist/src/ox-data-entry-subgroup-form.d.ts +23 -1
  6. package/dist/src/ox-data-entry-subgroup-form.js +20 -44
  7. package/dist/src/ox-data-entry-subgroup-form.js.map +1 -1
  8. package/dist/src/ox-data-input-factory.d.ts +53 -0
  9. package/dist/src/ox-data-input-factory.js +162 -0
  10. package/dist/src/ox-data-input-factory.js.map +1 -0
  11. package/dist/src/ox-data-ooc-correction-part.js +10 -2
  12. package/dist/src/ox-data-ooc-correction-part.js.map +1 -1
  13. package/dist/src/ox-data-sample-view.d.ts +3 -2
  14. package/dist/src/ox-data-sample-view.js +66 -44
  15. package/dist/src/ox-data-sample-view.js.map +1 -1
  16. package/dist/stories/ox-data-entry-form-subgroups.stories.d.ts +19 -0
  17. package/dist/stories/ox-data-entry-form-subgroups.stories.js +248 -0
  18. package/dist/stories/ox-data-entry-form-subgroups.stories.js.map +1 -0
  19. package/dist/stories/ox-data-entry-form.stories.js +54 -42
  20. package/dist/stories/ox-data-entry-form.stories.js.map +1 -1
  21. package/dist/stories/ox-data-ooc-brief-view.stories.js +19 -18
  22. package/dist/stories/ox-data-ooc-brief-view.stories.js.map +1 -1
  23. package/dist/stories/ox-data-ooc-view.stories.js +19 -18
  24. package/dist/stories/ox-data-ooc-view.stories.js.map +1 -1
  25. package/dist/stories/ox-data-sample-view.stories.js +19 -18
  26. package/dist/stories/ox-data-sample-view.stories.js.map +1 -1
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +20 -20
package/CHANGELOG.md CHANGED
@@ -3,7 +3,32 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [8.0.0](https://github.com/hatiolab/operato/compare/v7.1.33...v8.0.0) (2025-01-14)
6
+ ## [9.0.0-beta.1](https://github.com/hatiolab/operato/compare/v9.0.0-beta.0...v9.0.0-beta.1) (2025-01-19)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * dataset styling for ox-data-ooc-correction-part ([7369e1d](https://github.com/hatiolab/operato/commit/7369e1d039742944c6d41ce7c07001f6e8df7d9d))
12
+
13
+
14
+
15
+ ## [9.0.0-beta.0](https://github.com/hatiolab/operato/compare/v8.0.0-beta.11...v9.0.0-beta.0) (2025-01-13)
16
+
17
+ **Note:** Version bump only for package @operato/dataset
18
+
19
+
20
+
21
+
22
+
23
+ ## [8.0.0-beta.6](https://github.com/hatiolab/operato/compare/v8.0.0-beta.5...v8.0.0-beta.6) (2025-01-11)
24
+
25
+ **Note:** Version bump only for package @operato/dataset
26
+
27
+
28
+
29
+
30
+
31
+ ## [8.0.0-beta.5](https://github.com/hatiolab/operato/compare/v8.0.0-beta.4...v8.0.0-beta.5) (2025-01-10)
7
32
 
8
33
  **Note:** Version bump only for package @operato/dataset
9
34
 
@@ -11,7 +36,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
36
 
12
37
 
13
38
 
14
- ### [7.1.33](https://github.com/hatiolab/operato/compare/v7.1.32...v7.1.33) (2025-01-13)
39
+ ## [8.0.0-beta.4](https://github.com/hatiolab/operato/compare/v8.0.0-beta.3...v8.0.0-beta.4) (2025-01-09)
15
40
 
16
41
  **Note:** Version bump only for package @operato/dataset
17
42
 
@@ -19,17 +44,34 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
19
44
 
20
45
 
21
46
 
22
- ### [7.1.32](https://github.com/hatiolab/operato/compare/v7.1.31...v7.1.32) (2025-01-11)
47
+ ## [8.0.0-beta.3](https://github.com/hatiolab/operato/compare/v8.0.0-beta.2...v8.0.0-beta.3) (2025-01-08)
23
48
 
24
49
 
25
50
  ### :bug: Bug Fix
26
51
 
27
- * missing .npmignore ([03db207](https://github.com/hatiolab/operato/commit/03db207498088b294ccfb9645f6839c2f11645d5))
28
- * typo .npmignore ([df91cae](https://github.com/hatiolab/operato/commit/df91caea0f5938a3febd9307184e5b036a65e2bd))
52
+ * dataset escaping exception from unsetting quota ([7cb081d](https://github.com/hatiolab/operato/commit/7cb081df54cfcab093341a17cdbfa5665360a005))
53
+
54
+
55
+
56
+ ## [8.0.0-beta.2](https://github.com/hatiolab/operato/compare/v8.0.0-beta.1...v8.0.0-beta.2) (2025-01-08)
57
+
58
+
59
+ ### :bug: Bug Fix
60
+
61
+ * typo .npmignore ([d9c0c8c](https://github.com/hatiolab/operato/commit/d9c0c8c79abc688c3c2cfb6c37fcb689483a5977))
62
+
63
+
64
+
65
+ ## [8.0.0-beta.1](https://github.com/hatiolab/operato/compare/v8.0.0-beta.0...v8.0.0-beta.1) (2025-01-08)
66
+
67
+
68
+ ### :bug: Bug Fix
29
69
 
70
+ * missing .npmignore ([be05985](https://github.com/hatiolab/operato/commit/be05985abfae4af53501f718dd52932099f7fbcb))
30
71
 
31
72
 
32
- ### [7.1.31](https://github.com/hatiolab/operato/compare/v7.1.30...v7.1.31) (2025-01-10)
73
+
74
+ ## [8.0.0-beta.0](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.56...v8.0.0-beta.0) (2025-01-07)
33
75
 
34
76
  **Note:** Version bump only for package @operato/dataset
35
77
 
@@ -37,7 +79,16 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
37
79
 
38
80
 
39
81
 
40
- ### [7.1.30](https://github.com/hatiolab/operato/compare/v7.1.29...v7.1.30) (2025-01-10)
82
+ ## [8.0.0-alpha.56](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.55...v8.0.0-alpha.56) (2025-01-05)
83
+
84
+
85
+ ### :bug: Bug Fix
86
+
87
+ * [dataset] muultiple tables, subgroups at first occurrence, structured and modular ([89179fc](https://github.com/hatiolab/operato/commit/89179fc43024d34fa6bff4b364ce56541cefe16b))
88
+
89
+
90
+
91
+ ## [8.0.0-alpha.54](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.53...v8.0.0-alpha.54) (2024-12-09)
41
92
 
42
93
  **Note:** Version bump only for package @operato/dataset
43
94
 
@@ -45,7 +96,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
45
96
 
46
97
 
47
98
 
48
- ### [7.1.28](https://github.com/hatiolab/operato/compare/v7.1.27...v7.1.28) (2024-12-09)
99
+ ## [8.0.0-alpha.52](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.51...v8.0.0-alpha.52) (2024-12-03)
49
100
 
50
101
  **Note:** Version bump only for package @operato/dataset
51
102
 
@@ -53,17 +104,16 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
53
104
 
54
105
 
55
106
 
56
- ### [7.1.27](https://github.com/hatiolab/operato/compare/v7.1.26...v7.1.27) (2024-12-09)
107
+ ## [8.0.0-alpha.51](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.50...v8.0.0-alpha.51) (2024-11-29)
57
108
 
58
109
 
59
110
  ### :bug: Bug Fix
60
111
 
61
- * calendar css variables ([75a7eb0](https://github.com/hatiolab/operato/commit/75a7eb0c68a9d863f2b0db44152fdb9b9536ceca))
62
- * support radio type for dataset item spec ([8ccd1b9](https://github.com/hatiolab/operato/commit/8ccd1b92fb78e42f5998a578244ba804d9f5cedb))
112
+ * support radio type for dataset item spec ([8f6ba8f](https://github.com/hatiolab/operato/commit/8f6ba8f9929d6cfb94f2c8993a7d3dba37297954))
63
113
 
64
114
 
65
115
 
66
- ### [7.1.26](https://github.com/hatiolab/operato/compare/v7.1.25...v7.1.26) (2024-11-28)
116
+ ## [8.0.0-alpha.50](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.49...v8.0.0-alpha.50) (2024-11-16)
67
117
 
68
118
  **Note:** Version bump only for package @operato/dataset
69
119
 
@@ -71,7 +121,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
71
121
 
72
122
 
73
123
 
74
- ### [7.1.25](https://github.com/hatiolab/operato/compare/v7.1.24...v7.1.25) (2024-11-23)
124
+ ## [8.0.0-alpha.49](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.48...v8.0.0-alpha.49) (2024-11-13)
75
125
 
76
126
  **Note:** Version bump only for package @operato/dataset
77
127
 
@@ -79,7 +129,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
79
129
 
80
130
 
81
131
 
82
- ### [7.1.21](https://github.com/hatiolab/operato/compare/v7.1.20...v7.1.21) (2024-11-13)
132
+ ## [8.0.0-alpha.48](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.47...v8.0.0-alpha.48) (2024-11-13)
83
133
 
84
134
  **Note:** Version bump only for package @operato/dataset
85
135
 
@@ -87,7 +137,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
87
137
 
88
138
 
89
139
 
90
- ### [7.1.18](https://github.com/hatiolab/operato/compare/v7.1.17...v7.1.18) (2024-10-31)
140
+ ## [8.0.0-alpha.46](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.45...v8.0.0-alpha.46) (2024-10-23)
91
141
 
92
142
  **Note:** Version bump only for package @operato/dataset
93
143
 
@@ -95,7 +145,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
95
145
 
96
146
 
97
147
 
98
- ### [7.1.13](https://github.com/hatiolab/operato/compare/v7.1.12...v7.1.13) (2024-09-23)
148
+ ## [8.0.0-alpha.45](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.44...v8.0.0-alpha.45) (2024-10-23)
99
149
 
100
150
  **Note:** Version bump only for package @operato/dataset
101
151
 
@@ -103,7 +153,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
103
153
 
104
154
 
105
155
 
106
- ### [7.1.10](https://github.com/hatiolab/operato/compare/v7.1.9...v7.1.10) (2024-09-15)
156
+ ## [8.0.0-alpha.44](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.43...v8.0.0-alpha.44) (2024-10-23)
107
157
 
108
158
  **Note:** Version bump only for package @operato/dataset
109
159
 
@@ -111,7 +161,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
111
161
 
112
162
 
113
163
 
114
- ### [7.1.9](https://github.com/hatiolab/operato/compare/v7.1.8...v7.1.9) (2024-09-12)
164
+ ## [8.0.0-alpha.41](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.40...v8.0.0-alpha.41) (2024-10-21)
115
165
 
116
166
  **Note:** Version bump only for package @operato/dataset
117
167
 
@@ -119,7 +169,16 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
119
169
 
120
170
 
121
171
 
122
- ### [7.1.8](https://github.com/hatiolab/operato/compare/v7.1.7...v7.1.8) (2024-09-12)
172
+ ## [8.0.0-alpha.37](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.36...v8.0.0-alpha.37) (2024-10-20)
173
+
174
+
175
+ ### :bug: Bug Fix
176
+
177
+ * update dev-dependencies version ([d6fe342](https://github.com/hatiolab/operato/commit/d6fe342de738c6bad3528550a862b5a1d2573161))
178
+
179
+
180
+
181
+ ## [8.0.0-alpha.34](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.33...v8.0.0-alpha.34) (2024-10-15)
123
182
 
124
183
  **Note:** Version bump only for package @operato/dataset
125
184
 
@@ -127,7 +186,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
127
186
 
128
187
 
129
188
 
130
- ### [7.1.7](https://github.com/hatiolab/operato/compare/v7.1.6...v7.1.7) (2024-09-12)
189
+ ## [8.0.0-alpha.33](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.32...v8.0.0-alpha.33) (2024-10-14)
131
190
 
132
191
  **Note:** Version bump only for package @operato/dataset
133
192
 
@@ -135,37 +194,126 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
135
194
 
136
195
 
137
196
 
138
- ### [7.1.6](https://github.com/hatiolab/operato/compare/v7.1.5...v7.1.6) (2024-09-07)
197
+ ## [8.0.0-alpha.30](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.29...v8.0.0-alpha.30) (2024-10-11)
198
+
199
+ **Note:** Version bump only for package @operato/dataset
200
+
201
+
202
+
203
+
204
+
205
+ ## [8.0.0-alpha.29](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.28...v8.0.0-alpha.29) (2024-10-10)
206
+
207
+ **Note:** Version bump only for package @operato/dataset
208
+
209
+
210
+
211
+
212
+
213
+ ## [8.0.0-alpha.27](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.26...v8.0.0-alpha.27) (2024-10-06)
139
214
 
140
215
 
141
216
  ### :bug: Bug Fix
142
217
 
143
- * dataset components & styles ([d6836bd](https://github.com/hatiolab/operato/commit/d6836bd1c400962453dec31ab6e6055e4110900b))
218
+ * calendar css variables ([9ea1918](https://github.com/hatiolab/operato/commit/9ea191844c72de5f920a8da85ad50209ba77cc07))
144
219
 
145
220
 
146
221
 
147
- ### [7.1.5](https://github.com/hatiolab/operato/compare/v7.1.4...v7.1.5) (2024-09-06)
222
+ ## [8.0.0-alpha.26](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.25...v8.0.0-alpha.26) (2024-10-06)
223
+
224
+ **Note:** Version bump only for package @operato/dataset
225
+
226
+
227
+
228
+
229
+
230
+ ## [8.0.0-alpha.21](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.20...v8.0.0-alpha.21) (2024-10-05)
231
+
232
+ **Note:** Version bump only for package @operato/dataset
233
+
234
+
235
+
236
+
237
+
238
+ ## [8.0.0-alpha.20](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.19...v8.0.0-alpha.20) (2024-10-04)
239
+
240
+ **Note:** Version bump only for package @operato/dataset
241
+
242
+
243
+
244
+
245
+
246
+ ## [8.0.0-alpha.19](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.18...v8.0.0-alpha.19) (2024-10-04)
247
+
248
+ **Note:** Version bump only for package @operato/dataset
249
+
250
+
251
+
252
+
253
+
254
+ ## [8.0.0-alpha.10](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.9...v8.0.0-alpha.10) (2024-09-18)
255
+
256
+ **Note:** Version bump only for package @operato/dataset
257
+
258
+
259
+
260
+
261
+
262
+ ## [8.0.0-alpha.9](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.8...v8.0.0-alpha.9) (2024-09-15)
263
+
264
+ **Note:** Version bump only for package @operato/dataset
265
+
266
+
267
+
268
+
269
+
270
+ ## [8.0.0-alpha.8](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.7...v8.0.0-alpha.8) (2024-09-15)
271
+
272
+ **Note:** Version bump only for package @operato/dataset
273
+
274
+
275
+
276
+
277
+
278
+ ## [8.0.0-alpha.6](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.5...v8.0.0-alpha.6) (2024-09-14)
279
+
280
+ **Note:** Version bump only for package @operato/dataset
281
+
282
+
283
+
284
+
285
+
286
+ ## [8.0.0-alpha.5](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.4...v8.0.0-alpha.5) (2024-09-12)
287
+
288
+ **Note:** Version bump only for package @operato/dataset
289
+
290
+
291
+
292
+
293
+
294
+ ## [8.0.0-alpha.4](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.3...v8.0.0-alpha.4) (2024-09-07)
148
295
 
149
296
 
150
297
  ### :bug: Bug Fix
151
298
 
152
- * enable multiple file upload for ox-data-entry-form ([33ce296](https://github.com/hatiolab/operato/commit/33ce296eefaad4f9d2b6a329b8274a8d650d618d))
299
+ * dataset components & styles ([be44acd](https://github.com/hatiolab/operato/commit/be44acde8f25980e5b27afc481a2c149f8c23dbd))
300
+ * enable multiple file upload for ox-data-entry-form ([2753ffc](https://github.com/hatiolab/operato/commit/2753ffca2f67a4abff73109047e78dee9a7dff9d))
301
+ * style for ox-data-sample-view ([8facbab](https://github.com/hatiolab/operato/commit/8facbaba683accc6e4cf2375902a0b25cde31c49))
153
302
 
154
303
 
155
304
 
156
- ### [7.1.4](https://github.com/hatiolab/operato/compare/v7.1.3...v7.1.4) (2024-09-06)
305
+ ## [8.0.0-alpha.3](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.2...v8.0.0-alpha.3) (2024-09-06)
157
306
 
158
307
 
159
308
  ### :bug: Bug Fix
160
309
 
161
- * add ox-grist-editor/renderer-signature for dataset signature item ([6e31dc6](https://github.com/hatiolab/operato/commit/6e31dc68c04812182e192f82f810a33fab5ae6a4))
162
- * dataset viewer 날짜 표기 ([5a9f38e](https://github.com/hatiolab/operato/commit/5a9f38eebdc6df9d455565a81851d38a4087beca))
163
- * style for ox-data-sample-view ([17bd6b5](https://github.com/hatiolab/operato/commit/17bd6b58c728d2f4c3864f852d2a25ff1d360393))
164
- * style for ox-data-sample-view ([c533743](https://github.com/hatiolab/operato/commit/c533743913ef8d0eb58c5bc6109f05c34c6e5e1f))
310
+ * add ox-grist-editor/renderer-signature for dataset signature item ([b5dda5e](https://github.com/hatiolab/operato/commit/b5dda5ebe0afc8c9a3af73d9475bba160893155a))
311
+ * dataset viewer 날짜 표기 ([f5bdead](https://github.com/hatiolab/operato/commit/f5bdead134ee9a989e84a2f758135b9e9333dc9f))
312
+ * style for ox-data-sample-view ([f2a1266](https://github.com/hatiolab/operato/commit/f2a1266d9355b78a389e998129e16b8fba5ab480))
165
313
 
166
314
 
167
315
 
168
- ### [7.1.3](https://github.com/hatiolab/operato/compare/v7.1.2...v7.1.3) (2024-09-04)
316
+ ## [8.0.0-alpha.2](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.1...v8.0.0-alpha.2) (2024-09-05)
169
317
 
170
318
  **Note:** Version bump only for package @operato/dataset
171
319
 
@@ -173,12 +321,20 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
173
321
 
174
322
 
175
323
 
176
- ### [7.1.2](https://github.com/hatiolab/operato/compare/v7.1.1...v7.1.2) (2024-09-02)
324
+ ## [8.0.0-alpha.1](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.0...v8.0.0-alpha.1) (2024-09-04)
177
325
 
178
326
 
179
327
  ### :bug: Bug Fix
180
328
 
181
- * support signature-input type for dataset ([f9e758e](https://github.com/hatiolab/operato/commit/f9e758eeb5efd6926af9d3526f0d7374e0c1b081))
329
+ * support signature-input type for dataset ([613de5d](https://github.com/hatiolab/operato/commit/613de5dc5c14cc8288d2d19431dda5475c4b3303))
330
+
331
+
332
+
333
+ ## [8.0.0-alpha.0](https://github.com/hatiolab/operato/compare/v7.1.1...v8.0.0-alpha.0) (2024-09-01)
334
+
335
+ **Note:** Version bump only for package @operato/dataset
336
+
337
+
182
338
 
183
339
 
184
340
 
@@ -14,8 +14,9 @@ export declare class OxDataEntryForm extends LitElement {
14
14
  render(): TemplateResult<1>;
15
15
  private onChange;
16
16
  private buildInputs;
17
- private buildInputs4Subgroup;
18
- private buildInputs4NonGrouped;
17
+ private buildInputsForSubgroup;
18
+ private buildInputsForNonGrouped;
19
19
  private buildValue;
20
+ private extractValuesFromInputs;
20
21
  private groupDataItemsByGroup;
21
22
  }
@@ -4,39 +4,50 @@ import '@operato/input/ox-input-signature.js';
4
4
  import './ox-data-entry-subgroup-form.js';
5
5
  import { css, html, LitElement } from 'lit';
6
6
  import { customElement, property, queryAll } from 'lit/decorators.js';
7
+ import { OxDataInputFactory } from './ox-data-input-factory';
7
8
  let OxDataEntryForm = class OxDataEntryForm extends LitElement {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.onChange = (e) => {
12
+ this.value = this.buildValue();
13
+ this.dispatchEvent(new CustomEvent('change', {
14
+ bubbles: true,
15
+ composed: true,
16
+ detail: this.value
17
+ }));
18
+ };
19
+ }
8
20
  render() {
9
21
  var _a, _b;
10
- return html ` <form @change=${(e) => this.onChange(e)}>
11
- <h2>${((_a = this.dataSet) === null || _a === void 0 ? void 0 : _a.name) || ''}</h2>
12
- <h3>${((_b = this.dataSet) === null || _b === void 0 ? void 0 : _b.description) || ''}</h3>
13
- ${this.buildInputs()}
14
- </form>`;
15
- }
16
- onChange(e) {
17
- this.value = this.buildValue();
18
- this.dispatchEvent(new CustomEvent('change', {
19
- bubbles: true,
20
- composed: true,
21
- detail: this.value
22
- }));
22
+ return html `
23
+ <form @change=${this.onChange}>
24
+ <h2>${((_a = this.dataSet) === null || _a === void 0 ? void 0 : _a.name) || ''}</h2>
25
+ <h3>${((_b = this.dataSet) === null || _b === void 0 ? void 0 : _b.description) || ''}</h3>
26
+ ${this.buildInputs()}
27
+ </form>
28
+ `;
23
29
  }
24
30
  buildInputs() {
25
31
  var _a;
26
32
  const dataItems = ((_a = this.dataSet) === null || _a === void 0 ? void 0 : _a.dataItems.filter(item => item.active)) || [];
27
- const nonGroupDataItems = dataItems.filter(dataItem => !dataItem.group);
28
- const dataItemSubgroups = Object.entries(this.groupDataItemsByGroup(dataItems)).map(([subgroup, dataItems]) => {
29
- const tags = dataItems.map(dataItem => dataItem.tag);
30
- const value = tags.reduce((partial, key) => {
31
- var _a;
32
- partial[key] = (_a = this.value) === null || _a === void 0 ? void 0 : _a[key];
33
- return partial;
34
- }, {});
35
- return this.buildInputs4Subgroup(subgroup, dataItems, value);
33
+ const groupedItems = this.groupDataItemsByGroup(dataItems);
34
+ const renderedGroups = new Set();
35
+ return dataItems.flatMap(dataItem => {
36
+ if (dataItem.group) {
37
+ if (renderedGroups.has(dataItem.group))
38
+ return [];
39
+ renderedGroups.add(dataItem.group);
40
+ return this.buildInputsForSubgroup(dataItem.group, groupedItems[dataItem.group]);
41
+ }
42
+ return this.buildInputsForNonGrouped([dataItem]);
36
43
  });
37
- return [...this.buildInputs4NonGrouped(nonGroupDataItems), ...dataItemSubgroups];
38
44
  }
39
- buildInputs4Subgroup(subgroup, dataItems, value) {
45
+ buildInputsForSubgroup(subgroup, dataItems) {
46
+ const subgroupValues = dataItems.reduce((values, item) => {
47
+ var _a;
48
+ values[item.tag] = (_a = this.value) === null || _a === void 0 ? void 0 : _a[item.tag];
49
+ return values;
50
+ }, {});
40
51
  return html `
41
52
  <div label>
42
53
  <div name>${subgroup}</div>
@@ -44,100 +55,52 @@ let OxDataEntryForm = class OxDataEntryForm extends LitElement {
44
55
  <ox-data-entry-subgroup-form
45
56
  .subgroup=${subgroup}
46
57
  .dataItems=${dataItems}
47
- .value=${value}
48
- @change=${(e) => this.onChange(e)}
58
+ .value=${subgroupValues}
59
+ @change=${this.onChange}
49
60
  ></ox-data-entry-subgroup-form>
50
61
  </div>
51
62
  </div>
52
63
  `;
53
64
  }
54
- buildInputs4NonGrouped(dataItems) {
55
- return (dataItems || []).map(dataItem => {
65
+ buildInputsForNonGrouped(dataItems) {
66
+ return dataItems.map(dataItem => {
67
+ var _a, _b;
56
68
  const { name, description, tag, type, quota = 1, options = {}, unit } = dataItem;
57
- const samples = new Array(quota).fill(0);
58
- const value = this.value && this.value[tag];
59
- const elements = samples.map((_, idx) => {
60
- const v = value instanceof Array ? value[idx] : idx === 0 ? value : undefined;
61
- switch (type) {
62
- case 'select':
63
- return html ` <select .name=${tag}>
64
- <option value=""></option>
65
- ${(options.options || []).map(option => html `<option value=${option.value} ?selected=${option.value === v}>${option.text}</option>`)}
66
- </select>`;
67
- case 'radio':
68
- return html `<div
69
- @change=${(e) => {
70
- const div = e.currentTarget;
71
- const inputHidden = div.querySelector(`input[name="${tag}"]`);
72
- inputHidden.value = e.target.value;
73
- }}
74
- >
75
- <input type="hidden" name=${tag} />
76
-
77
- ${(options.options || []).map(option => html `<label>
78
- <input
79
- type="radio"
80
- name=${'$' + tag + '-' + idx}
81
- .value=${option.value}
82
- ?checked=${option.value === v}
83
- />
84
- ${option.text}
85
- </label>`)}
86
- </div>`;
87
- case 'boolean':
88
- return html ` <input type="checkbox" name=${tag} .checked=${v} />`;
89
- case 'number':
90
- return html ` <input type="number" name=${tag} value=${v} />`;
91
- case 'date':
92
- return html ` <input type="date" name=${tag} value=${v} />`;
93
- case 'datetime':
94
- return html ` <input type="datetime-local" name=${tag} value=${v} />`;
95
- case 'file':
96
- return html `<ox-input-file name=${tag} multiple .value=${v}></ox-input-file>`;
97
- case 'signature':
98
- return html `<ox-input-signature name=${tag} value=${v}></ox-input-signature>`;
99
- case 'string':
100
- default:
101
- return html ` <input type="text" name=${tag} value=${v} />`;
102
- }
103
- });
104
- return html ` <div label>
105
- <div name>${name}${unit ? `(${unit})` : ''}</div>
106
- <div description><md-icon>info</md-icon> ${description}</div>
107
- <div elements>${elements}</div>
108
- </div>`;
69
+ const value = ((_a = this.value) === null || _a === void 0 ? void 0 : _a[tag]) === undefined ? [] : (_b = this.value) === null || _b === void 0 ? void 0 : _b[tag];
70
+ return html `
71
+ <div label>
72
+ <div name>${name}${unit ? ` (${unit})` : ''}</div>
73
+ <div description><md-icon>info</md-icon> ${description}</div>
74
+ <div elements>
75
+ ${Array.from({ length: quota || 1 }, (_, idx) => OxDataInputFactory.createInputElement(type, tag, Array.isArray(value) ? value[idx] : idx === 0 ? value : undefined, options, idx))}
76
+ </div>
77
+ </div>
78
+ `;
109
79
  });
110
80
  }
111
81
  buildValue() {
112
- const dataItems = this.dataSet.dataItems;
113
- const nonGroupDataItems = dataItems.filter(dataItem => !dataItem.group);
114
- const nonGroupValue = (nonGroupDataItems || []).reduce((sum, dataItem) => {
82
+ const nonGroupValues = this.extractValuesFromInputs();
83
+ return Array.from(this.subgroups).reduce((values, subgroup) => ({ ...values, ...subgroup.buildValue() }), nonGroupValues);
84
+ }
85
+ extractValuesFromInputs() {
86
+ var _a;
87
+ return (((_a = this.dataSet) === null || _a === void 0 ? void 0 : _a.dataItems.filter(item => !item.group)) || []).reduce((values, dataItem) => {
115
88
  const { tag, type } = dataItem;
116
- const editors = Array.prototype.slice.call(this.renderRoot.querySelectorAll(`[name=${tag}]`));
89
+ const editors = Array.from(this.renderRoot.querySelectorAll(`[name=${tag}]`));
117
90
  if (editors.length > 0) {
118
- sum[tag] = editors.map(editor => (type === 'boolean' ? editor.checked : editor.value));
91
+ values[tag] = editors.map(editor => (type === 'boolean' ? editor.checked : editor.value));
119
92
  }
120
- return sum;
93
+ return values;
121
94
  }, {});
122
- return Array.from(this.subgroups).reduce((value, subgroup) => {
123
- return {
124
- ...value,
125
- ...subgroup.buildValue()
126
- };
127
- }, nonGroupValue || {});
128
95
  }
129
96
  groupDataItemsByGroup(dataItems) {
130
- const groupedDataItems = {};
131
- for (const dataItem of dataItems) {
132
- const { group } = dataItem;
133
- if (group) {
134
- if (!groupedDataItems[group]) {
135
- groupedDataItems[group] = [];
136
- }
137
- groupedDataItems[group].push(dataItem);
97
+ return dataItems.reduce((groups, item) => {
98
+ if (item.group) {
99
+ ;
100
+ (groups[item.group] = groups[item.group] || []).push(item);
138
101
  }
139
- }
140
- return groupedDataItems;
102
+ return groups;
103
+ }, {});
141
104
  }
142
105
  };
143
106
  OxDataEntryForm.styles = css `
@@ -170,19 +133,12 @@ OxDataEntryForm.styles = css `
170
133
 
171
134
  form > div[label] {
172
135
  display: grid;
173
-
174
136
  grid-template-rows: auto 1fr;
175
137
  grid-template-columns: 1fr 5fr;
176
138
  grid-template-areas: 'name description' 'empty inputs';
177
-
178
139
  grid-gap: 9px;
179
140
  align-items: center;
180
141
  margin-bottom: var(--spacing-medium);
181
-
182
- &:nth-child(odd) {
183
- background-color: var(--md-sys-color-background);
184
- padding: var(--padding-default) 0;
185
- }
186
142
  }
187
143
 
188
144
  div[name] {
@@ -191,17 +147,13 @@ OxDataEntryForm.styles = css `
191
147
  color: var(--label-color, var(--md-sys-color-on-surface));
192
148
  text-align: right;
193
149
  }
150
+
194
151
  div[description] {
195
152
  grid-area: description;
196
153
  opacity: 0.7;
197
154
  font: var(--item-description-font);
198
155
  color: var(--item-description-color);
199
156
  text-align: left;
200
-
201
- * {
202
- vertical-align: middle;
203
- }
204
-
205
157
  md-icon {
206
158
  font-size: 0.9rem;
207
159
  }
@@ -214,42 +166,15 @@ OxDataEntryForm.styles = css `
214
166
  flex-wrap: wrap;
215
167
  gap: 10px;
216
168
  padding-right: var(--padding-default);
217
-
218
169
  * {
219
170
  flex: 1;
220
171
  }
221
-
222
- input,
223
- select {
224
- border: var(--input-field-border);
225
- border-radius: var(--input-field-border-radius);
226
- padding: var(--input-field-padding);
227
- font: var(--input-field-font);
228
- }
229
172
  }
230
173
 
231
174
  div[subgroup] {
232
175
  grid-column: 1 / 3;
233
176
  grid-row: 2;
234
177
  }
235
-
236
- @media only screen and (max-width: 460px) {
237
- form > div[label] {
238
- display: grid;
239
-
240
- grid-template-rows: auto auto 1fr;
241
- grid-template-columns: 1fr;
242
- grid-template-areas: 'name' 'description' 'inputs';
243
-
244
- grid-gap: 9px;
245
- align-items: center;
246
- margin-bottom: var(--spacing-medium);
247
- }
248
-
249
- div[name] {
250
- text-align: left;
251
- }
252
- }
253
178
  `;
254
179
  __decorate([
255
180
  property({ type: Object })