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