@operato/dataset 8.0.0-beta.5 → 8.0.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.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
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.5](https://github.com/hatiolab/operato/compare/v8.0.0-beta.4...v8.0.0-beta.5) (2025-01-10)
6
+ ## [8.0.0](https://github.com/hatiolab/operato/compare/v7.1.33...v8.0.0) (2025-01-14)
7
7
 
8
8
  **Note:** Version bump only for package @operato/dataset
9
9
 
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
- ## [8.0.0-beta.4](https://github.com/hatiolab/operato/compare/v8.0.0-beta.3...v8.0.0-beta.4) (2025-01-09)
14
+ ### [7.1.33](https://github.com/hatiolab/operato/compare/v7.1.32...v7.1.33) (2025-01-13)
15
15
 
16
16
  **Note:** Version bump only for package @operato/dataset
17
17
 
@@ -19,34 +19,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
19
19
 
20
20
 
21
21
 
22
- ## [8.0.0-beta.3](https://github.com/hatiolab/operato/compare/v8.0.0-beta.2...v8.0.0-beta.3) (2025-01-08)
22
+ ### [7.1.32](https://github.com/hatiolab/operato/compare/v7.1.31...v7.1.32) (2025-01-11)
23
23
 
24
24
 
25
25
  ### :bug: Bug Fix
26
26
 
27
- * dataset escaping exception from unsetting quota ([7cb081d](https://github.com/hatiolab/operato/commit/7cb081df54cfcab093341a17cdbfa5665360a005))
27
+ * missing .npmignore ([03db207](https://github.com/hatiolab/operato/commit/03db207498088b294ccfb9645f6839c2f11645d5))
28
+ * typo .npmignore ([df91cae](https://github.com/hatiolab/operato/commit/df91caea0f5938a3febd9307184e5b036a65e2bd))
28
29
 
29
30
 
30
31
 
31
- ## [8.0.0-beta.2](https://github.com/hatiolab/operato/compare/v8.0.0-beta.1...v8.0.0-beta.2) (2025-01-08)
32
-
33
-
34
- ### :bug: Bug Fix
35
-
36
- * typo .npmignore ([d9c0c8c](https://github.com/hatiolab/operato/commit/d9c0c8c79abc688c3c2cfb6c37fcb689483a5977))
37
-
38
-
39
-
40
- ## [8.0.0-beta.1](https://github.com/hatiolab/operato/compare/v8.0.0-beta.0...v8.0.0-beta.1) (2025-01-08)
41
-
42
-
43
- ### :bug: Bug Fix
44
-
45
- * missing .npmignore ([be05985](https://github.com/hatiolab/operato/commit/be05985abfae4af53501f718dd52932099f7fbcb))
46
-
47
-
48
-
49
- ## [8.0.0-beta.0](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.56...v8.0.0-beta.0) (2025-01-07)
32
+ ### [7.1.31](https://github.com/hatiolab/operato/compare/v7.1.30...v7.1.31) (2025-01-10)
50
33
 
51
34
  **Note:** Version bump only for package @operato/dataset
52
35
 
@@ -54,16 +37,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
54
37
 
55
38
 
56
39
 
57
- ## [8.0.0-alpha.56](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.55...v8.0.0-alpha.56) (2025-01-05)
58
-
59
-
60
- ### :bug: Bug Fix
61
-
62
- * [dataset] muultiple tables, subgroups at first occurrence, structured and modular ([89179fc](https://github.com/hatiolab/operato/commit/89179fc43024d34fa6bff4b364ce56541cefe16b))
63
-
64
-
65
-
66
- ## [8.0.0-alpha.54](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.53...v8.0.0-alpha.54) (2024-12-09)
40
+ ### [7.1.30](https://github.com/hatiolab/operato/compare/v7.1.29...v7.1.30) (2025-01-10)
67
41
 
68
42
  **Note:** Version bump only for package @operato/dataset
69
43
 
@@ -71,7 +45,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
71
45
 
72
46
 
73
47
 
74
- ## [8.0.0-alpha.52](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.51...v8.0.0-alpha.52) (2024-12-03)
48
+ ### [7.1.28](https://github.com/hatiolab/operato/compare/v7.1.27...v7.1.28) (2024-12-09)
75
49
 
76
50
  **Note:** Version bump only for package @operato/dataset
77
51
 
@@ -79,24 +53,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
79
53
 
80
54
 
81
55
 
82
- ## [8.0.0-alpha.51](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.50...v8.0.0-alpha.51) (2024-11-29)
56
+ ### [7.1.27](https://github.com/hatiolab/operato/compare/v7.1.26...v7.1.27) (2024-12-09)
83
57
 
84
58
 
85
59
  ### :bug: Bug Fix
86
60
 
87
- * support radio type for dataset item spec ([8f6ba8f](https://github.com/hatiolab/operato/commit/8f6ba8f9929d6cfb94f2c8993a7d3dba37297954))
88
-
89
-
90
-
91
- ## [8.0.0-alpha.50](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.49...v8.0.0-alpha.50) (2024-11-16)
92
-
93
- **Note:** Version bump only for package @operato/dataset
94
-
95
-
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))
96
63
 
97
64
 
98
65
 
99
- ## [8.0.0-alpha.49](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.48...v8.0.0-alpha.49) (2024-11-13)
66
+ ### [7.1.26](https://github.com/hatiolab/operato/compare/v7.1.25...v7.1.26) (2024-11-28)
100
67
 
101
68
  **Note:** Version bump only for package @operato/dataset
102
69
 
@@ -104,7 +71,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
104
71
 
105
72
 
106
73
 
107
- ## [8.0.0-alpha.48](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.47...v8.0.0-alpha.48) (2024-11-13)
74
+ ### [7.1.25](https://github.com/hatiolab/operato/compare/v7.1.24...v7.1.25) (2024-11-23)
108
75
 
109
76
  **Note:** Version bump only for package @operato/dataset
110
77
 
@@ -112,7 +79,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
112
79
 
113
80
 
114
81
 
115
- ## [8.0.0-alpha.46](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.45...v8.0.0-alpha.46) (2024-10-23)
82
+ ### [7.1.21](https://github.com/hatiolab/operato/compare/v7.1.20...v7.1.21) (2024-11-13)
116
83
 
117
84
  **Note:** Version bump only for package @operato/dataset
118
85
 
@@ -120,7 +87,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
120
87
 
121
88
 
122
89
 
123
- ## [8.0.0-alpha.45](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.44...v8.0.0-alpha.45) (2024-10-23)
90
+ ### [7.1.18](https://github.com/hatiolab/operato/compare/v7.1.17...v7.1.18) (2024-10-31)
124
91
 
125
92
  **Note:** Version bump only for package @operato/dataset
126
93
 
@@ -128,7 +95,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
128
95
 
129
96
 
130
97
 
131
- ## [8.0.0-alpha.44](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.43...v8.0.0-alpha.44) (2024-10-23)
98
+ ### [7.1.13](https://github.com/hatiolab/operato/compare/v7.1.12...v7.1.13) (2024-09-23)
132
99
 
133
100
  **Note:** Version bump only for package @operato/dataset
134
101
 
@@ -136,7 +103,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
136
103
 
137
104
 
138
105
 
139
- ## [8.0.0-alpha.41](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.40...v8.0.0-alpha.41) (2024-10-21)
106
+ ### [7.1.10](https://github.com/hatiolab/operato/compare/v7.1.9...v7.1.10) (2024-09-15)
140
107
 
141
108
  **Note:** Version bump only for package @operato/dataset
142
109
 
@@ -144,24 +111,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
144
111
 
145
112
 
146
113
 
147
- ## [8.0.0-alpha.37](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.36...v8.0.0-alpha.37) (2024-10-20)
148
-
149
-
150
- ### :bug: Bug Fix
151
-
152
- * update dev-dependencies version ([d6fe342](https://github.com/hatiolab/operato/commit/d6fe342de738c6bad3528550a862b5a1d2573161))
153
-
154
-
155
-
156
- ## [8.0.0-alpha.34](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.33...v8.0.0-alpha.34) (2024-10-15)
157
-
158
- **Note:** Version bump only for package @operato/dataset
159
-
160
-
161
-
162
-
163
-
164
- ## [8.0.0-alpha.33](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.32...v8.0.0-alpha.33) (2024-10-14)
114
+ ### [7.1.9](https://github.com/hatiolab/operato/compare/v7.1.8...v7.1.9) (2024-09-12)
165
115
 
166
116
  **Note:** Version bump only for package @operato/dataset
167
117
 
@@ -169,7 +119,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
169
119
 
170
120
 
171
121
 
172
- ## [8.0.0-alpha.30](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.29...v8.0.0-alpha.30) (2024-10-11)
122
+ ### [7.1.8](https://github.com/hatiolab/operato/compare/v7.1.7...v7.1.8) (2024-09-12)
173
123
 
174
124
  **Note:** Version bump only for package @operato/dataset
175
125
 
@@ -177,7 +127,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
177
127
 
178
128
 
179
129
 
180
- ## [8.0.0-alpha.29](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.28...v8.0.0-alpha.29) (2024-10-10)
130
+ ### [7.1.7](https://github.com/hatiolab/operato/compare/v7.1.6...v7.1.7) (2024-09-12)
181
131
 
182
132
  **Note:** Version bump only for package @operato/dataset
183
133
 
@@ -185,110 +135,37 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
185
135
 
186
136
 
187
137
 
188
- ## [8.0.0-alpha.27](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.26...v8.0.0-alpha.27) (2024-10-06)
138
+ ### [7.1.6](https://github.com/hatiolab/operato/compare/v7.1.5...v7.1.6) (2024-09-07)
189
139
 
190
140
 
191
141
  ### :bug: Bug Fix
192
142
 
193
- * calendar css variables ([9ea1918](https://github.com/hatiolab/operato/commit/9ea191844c72de5f920a8da85ad50209ba77cc07))
194
-
195
-
196
-
197
- ## [8.0.0-alpha.26](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.25...v8.0.0-alpha.26) (2024-10-06)
198
-
199
- **Note:** Version bump only for package @operato/dataset
200
-
201
-
202
-
203
-
204
-
205
- ## [8.0.0-alpha.21](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.20...v8.0.0-alpha.21) (2024-10-05)
206
-
207
- **Note:** Version bump only for package @operato/dataset
208
-
209
-
143
+ * dataset components & styles ([d6836bd](https://github.com/hatiolab/operato/commit/d6836bd1c400962453dec31ab6e6055e4110900b))
210
144
 
211
145
 
212
146
 
213
- ## [8.0.0-alpha.20](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.19...v8.0.0-alpha.20) (2024-10-04)
214
-
215
- **Note:** Version bump only for package @operato/dataset
216
-
217
-
218
-
219
-
220
-
221
- ## [8.0.0-alpha.19](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.18...v8.0.0-alpha.19) (2024-10-04)
222
-
223
- **Note:** Version bump only for package @operato/dataset
224
-
225
-
226
-
227
-
228
-
229
- ## [8.0.0-alpha.10](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.9...v8.0.0-alpha.10) (2024-09-18)
230
-
231
- **Note:** Version bump only for package @operato/dataset
232
-
233
-
234
-
235
-
236
-
237
- ## [8.0.0-alpha.9](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.8...v8.0.0-alpha.9) (2024-09-15)
238
-
239
- **Note:** Version bump only for package @operato/dataset
240
-
241
-
242
-
243
-
244
-
245
- ## [8.0.0-alpha.8](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.7...v8.0.0-alpha.8) (2024-09-15)
246
-
247
- **Note:** Version bump only for package @operato/dataset
248
-
249
-
250
-
251
-
252
-
253
- ## [8.0.0-alpha.6](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.5...v8.0.0-alpha.6) (2024-09-14)
254
-
255
- **Note:** Version bump only for package @operato/dataset
256
-
257
-
258
-
259
-
260
-
261
- ## [8.0.0-alpha.5](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.4...v8.0.0-alpha.5) (2024-09-12)
262
-
263
- **Note:** Version bump only for package @operato/dataset
264
-
265
-
266
-
267
-
268
-
269
- ## [8.0.0-alpha.4](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.3...v8.0.0-alpha.4) (2024-09-07)
147
+ ### [7.1.5](https://github.com/hatiolab/operato/compare/v7.1.4...v7.1.5) (2024-09-06)
270
148
 
271
149
 
272
150
  ### :bug: Bug Fix
273
151
 
274
- * dataset components & styles ([be44acd](https://github.com/hatiolab/operato/commit/be44acde8f25980e5b27afc481a2c149f8c23dbd))
275
- * enable multiple file upload for ox-data-entry-form ([2753ffc](https://github.com/hatiolab/operato/commit/2753ffca2f67a4abff73109047e78dee9a7dff9d))
276
- * style for ox-data-sample-view ([8facbab](https://github.com/hatiolab/operato/commit/8facbaba683accc6e4cf2375902a0b25cde31c49))
152
+ * enable multiple file upload for ox-data-entry-form ([33ce296](https://github.com/hatiolab/operato/commit/33ce296eefaad4f9d2b6a329b8274a8d650d618d))
277
153
 
278
154
 
279
155
 
280
- ## [8.0.0-alpha.3](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.2...v8.0.0-alpha.3) (2024-09-06)
156
+ ### [7.1.4](https://github.com/hatiolab/operato/compare/v7.1.3...v7.1.4) (2024-09-06)
281
157
 
282
158
 
283
159
  ### :bug: Bug Fix
284
160
 
285
- * add ox-grist-editor/renderer-signature for dataset signature item ([b5dda5e](https://github.com/hatiolab/operato/commit/b5dda5ebe0afc8c9a3af73d9475bba160893155a))
286
- * dataset viewer 날짜 표기 ([f5bdead](https://github.com/hatiolab/operato/commit/f5bdead134ee9a989e84a2f758135b9e9333dc9f))
287
- * style for ox-data-sample-view ([f2a1266](https://github.com/hatiolab/operato/commit/f2a1266d9355b78a389e998129e16b8fba5ab480))
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))
288
165
 
289
166
 
290
167
 
291
- ## [8.0.0-alpha.2](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.1...v8.0.0-alpha.2) (2024-09-05)
168
+ ### [7.1.3](https://github.com/hatiolab/operato/compare/v7.1.2...v7.1.3) (2024-09-04)
292
169
 
293
170
  **Note:** Version bump only for package @operato/dataset
294
171
 
@@ -296,20 +173,12 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
296
173
 
297
174
 
298
175
 
299
- ## [8.0.0-alpha.1](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.0...v8.0.0-alpha.1) (2024-09-04)
176
+ ### [7.1.2](https://github.com/hatiolab/operato/compare/v7.1.1...v7.1.2) (2024-09-02)
300
177
 
301
178
 
302
179
  ### :bug: Bug Fix
303
180
 
304
- * support signature-input type for dataset ([613de5d](https://github.com/hatiolab/operato/commit/613de5dc5c14cc8288d2d19431dda5475c4b3303))
305
-
306
-
307
-
308
- ## [8.0.0-alpha.0](https://github.com/hatiolab/operato/compare/v7.1.1...v8.0.0-alpha.0) (2024-09-01)
309
-
310
- **Note:** Version bump only for package @operato/dataset
311
-
312
-
181
+ * support signature-input type for dataset ([f9e758e](https://github.com/hatiolab/operato/commit/f9e758eeb5efd6926af9d3526f0d7374e0c1b081))
313
182
 
314
183
 
315
184
 
@@ -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 })