@golemui/lit 0.0.2 → 0.12.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.
- package/CHANGELOG.md +2 -447
- package/README.md +17 -4
- package/index.js +193 -196
- package/index.umd.cjs +9 -4
- package/lib/adapters/action-widget.adapter.d.ts +3 -3
- package/lib/components/form/form.element.d.ts +12 -12
- package/lib/context/repeater-index-token.context.d.ts +2 -5
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,448 +1,3 @@
|
|
|
1
|
-
## 0.
|
|
1
|
+
## 0.12.0 (2026-05-16)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
- add the novalidate attr to forms ([60189661](https://github.com/golemui/formforge/commit/60189661))
|
|
6
|
-
- **lit:** integrate i18n.lang on the calendar component ([86cba865](https://github.com/golemui/formforge/commit/86cba865))
|
|
7
|
-
- **lit:** i18n integration ([0744c6db](https://github.com/golemui/formforge/commit/0744c6db))
|
|
8
|
-
- **lit:** add list component to lit-vanilla ([a00ba79e](https://github.com/golemui/formforge/commit/a00ba79e))
|
|
9
|
-
|
|
10
|
-
### 🩹 Fixes
|
|
11
|
-
|
|
12
|
-
- **core:** update kind taxonomy ([17d0aba1](https://github.com/golemui/formforge/commit/17d0aba1))
|
|
13
|
-
|
|
14
|
-
### ❤️ Thank You
|
|
15
|
-
|
|
16
|
-
- Joan Llenas
|
|
17
|
-
- Raul Jimenez @Elecash
|
|
18
|
-
|
|
19
|
-
## 0.18.0 (2026-01-13)
|
|
20
|
-
|
|
21
|
-
### 🩹 Fixes
|
|
22
|
-
|
|
23
|
-
- **lit:** lit uid fixes ([5973338](https://github.com/golemui/formforge/commit/5973338))
|
|
24
|
-
|
|
25
|
-
### ❤️ Thank You
|
|
26
|
-
|
|
27
|
-
- Joan Llenas
|
|
28
|
-
|
|
29
|
-
## 0.17.0 (2026-01-11)
|
|
30
|
-
|
|
31
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
32
|
-
|
|
33
|
-
## 0.16.0 (2026-01-05)
|
|
34
|
-
|
|
35
|
-
### 🚀 Features
|
|
36
|
-
|
|
37
|
-
- Add support for injectedIssues to the current validation pipeline ([d7de030](https://github.com/golemui/formforge/commit/d7de030))
|
|
38
|
-
|
|
39
|
-
### 🩹 Fixes
|
|
40
|
-
|
|
41
|
-
- **lit:** update validator handling ([4302b8f](https://github.com/golemui/formforge/commit/4302b8f))
|
|
42
|
-
|
|
43
|
-
### ❤️ Thank You
|
|
44
|
-
|
|
45
|
-
- Joan Llenas
|
|
46
|
-
|
|
47
|
-
## 0.15.2 (2026-01-03)
|
|
48
|
-
|
|
49
|
-
### 🩹 Fixes
|
|
50
|
-
|
|
51
|
-
- **lit:** rename formError to formHealth ([f57b6ec](https://github.com/golemui/formforge/commit/f57b6ec))
|
|
52
|
-
|
|
53
|
-
### ❤️ Thank You
|
|
54
|
-
|
|
55
|
-
- Joan Llenas
|
|
56
|
-
|
|
57
|
-
## 0.15.1 (2025-12-27)
|
|
58
|
-
|
|
59
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
60
|
-
|
|
61
|
-
## 0.15.0 (2025-12-27)
|
|
62
|
-
|
|
63
|
-
### 🩹 Fixes
|
|
64
|
-
|
|
65
|
-
- remove unnecessary field flags ([da74dc3](https://github.com/golemui/formforge/commit/da74dc3))
|
|
66
|
-
- **lit:** update adapters to use the new reactivity ([7e2dd8c](https://github.com/golemui/formforge/commit/7e2dd8c))
|
|
67
|
-
|
|
68
|
-
### ❤️ Thank You
|
|
69
|
-
|
|
70
|
-
- Joan Llenas
|
|
71
|
-
|
|
72
|
-
## 0.14.11 (2025-12-21)
|
|
73
|
-
|
|
74
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
75
|
-
|
|
76
|
-
## 0.14.10 (2025-12-20)
|
|
77
|
-
|
|
78
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
79
|
-
|
|
80
|
-
## 0.14.9 (2025-12-20)
|
|
81
|
-
|
|
82
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
83
|
-
|
|
84
|
-
## 0.14.8 (2025-12-20)
|
|
85
|
-
|
|
86
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
87
|
-
|
|
88
|
-
## 0.14.7 (2025-12-18)
|
|
89
|
-
|
|
90
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
91
|
-
|
|
92
|
-
## 0.14.6 (2025-12-18)
|
|
93
|
-
|
|
94
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
95
|
-
|
|
96
|
-
## 0.14.5 (2025-12-17)
|
|
97
|
-
|
|
98
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
99
|
-
|
|
100
|
-
## 0.14.4 (2025-12-17)
|
|
101
|
-
|
|
102
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
103
|
-
|
|
104
|
-
## 0.14.3 (2025-12-16)
|
|
105
|
-
|
|
106
|
-
### 🩹 Fixes
|
|
107
|
-
|
|
108
|
-
- **lit:** fix lit change detection ([124b9fe](https://github.com/golemui/formforge/commit/124b9fe))
|
|
109
|
-
|
|
110
|
-
### ❤️ Thank You
|
|
111
|
-
|
|
112
|
-
- Raul Jimenez @Elecash
|
|
113
|
-
|
|
114
|
-
## 0.14.2 (2025-12-16)
|
|
115
|
-
|
|
116
|
-
### 🩹 Fixes
|
|
117
|
-
|
|
118
|
-
- minor refactors and fixes ([b413896](https://github.com/golemui/formforge/commit/b413896))
|
|
119
|
-
|
|
120
|
-
### ❤️ Thank You
|
|
121
|
-
|
|
122
|
-
- Joan Llenas
|
|
123
|
-
|
|
124
|
-
## 0.14.1 (2025-12-15)
|
|
125
|
-
|
|
126
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
127
|
-
|
|
128
|
-
## 0.14.0 (2025-12-14)
|
|
129
|
-
|
|
130
|
-
### 🚀 Features
|
|
131
|
-
|
|
132
|
-
- **lit:** add form vanilla component ([3f4fde2](https://github.com/golemui/formforge/commit/3f4fde2))
|
|
133
|
-
|
|
134
|
-
### 🩹 Fixes
|
|
135
|
-
|
|
136
|
-
- unify vanilla apis ([efd0a00](https://github.com/golemui/formforge/commit/efd0a00))
|
|
137
|
-
|
|
138
|
-
### ❤️ Thank You
|
|
139
|
-
|
|
140
|
-
- Raul Jimenez @Elecash
|
|
141
|
-
|
|
142
|
-
## 0.13.0 (2025-12-11)
|
|
143
|
-
|
|
144
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
145
|
-
|
|
146
|
-
## 0.12.0 (2025-12-11)
|
|
147
|
-
|
|
148
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
149
|
-
|
|
150
|
-
## 0.11.0 (2025-12-08)
|
|
151
|
-
|
|
152
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
153
|
-
|
|
154
|
-
## 0.10.0 (2025-12-08)
|
|
155
|
-
|
|
156
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
157
|
-
|
|
158
|
-
## 0.9.0 (2025-12-08)
|
|
159
|
-
|
|
160
|
-
### 🚀 Features
|
|
161
|
-
|
|
162
|
-
- **core:** introduce SET_FIELD_INITIAL_DATA action and update related logic ([f6c2e89](https://github.com/golemui/formforge/commit/f6c2e89))
|
|
163
|
-
|
|
164
|
-
### ❤️ Thank You
|
|
165
|
-
|
|
166
|
-
- Joan Llenas
|
|
167
|
-
|
|
168
|
-
## 0.8.0 (2025-12-07)
|
|
169
|
-
|
|
170
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
171
|
-
|
|
172
|
-
## 0.7.1 (2025-12-07)
|
|
173
|
-
|
|
174
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
175
|
-
|
|
176
|
-
## 0.7.0 (2025-12-04)
|
|
177
|
-
|
|
178
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
179
|
-
|
|
180
|
-
## 0.6.0 (2025-12-03)
|
|
181
|
-
|
|
182
|
-
### 🚀 Features
|
|
183
|
-
|
|
184
|
-
- **lit:** Add select component ([b81344e](https://github.com/golemui/formforge/commit/b81344e))
|
|
185
|
-
|
|
186
|
-
### ❤️ Thank You
|
|
187
|
-
|
|
188
|
-
- Raul Jimenez @Elecash
|
|
189
|
-
|
|
190
|
-
## 0.5.0 (2025-11-30)
|
|
191
|
-
|
|
192
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
193
|
-
|
|
194
|
-
## 0.4.0 (2025-11-30)
|
|
195
|
-
|
|
196
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
197
|
-
|
|
198
|
-
## 0.3.26 (2025-11-29)
|
|
199
|
-
|
|
200
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
201
|
-
|
|
202
|
-
## 0.3.25 (2025-11-27)
|
|
203
|
-
|
|
204
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
205
|
-
|
|
206
|
-
## 0.3.24 (2025-11-27)
|
|
207
|
-
|
|
208
|
-
### 🩹 Fixes
|
|
209
|
-
|
|
210
|
-
- **lit:** remove all lit external dependencies from builds ([1ad4504](https://github.com/golemui/formforge/commit/1ad4504))
|
|
211
|
-
|
|
212
|
-
### ❤️ Thank You
|
|
213
|
-
|
|
214
|
-
- Raul Jimenez @Elecash
|
|
215
|
-
|
|
216
|
-
## 0.3.23 (2025-11-27)
|
|
217
|
-
|
|
218
|
-
### 🩹 Fixes
|
|
219
|
-
|
|
220
|
-
- **lit:** Use experimental decorators ([77856c0](https://github.com/golemui/formforge/commit/77856c0))
|
|
221
|
-
|
|
222
|
-
### ❤️ Thank You
|
|
223
|
-
|
|
224
|
-
- Raul Jimenez @Elecash
|
|
225
|
-
|
|
226
|
-
## 0.3.22 (2025-11-27)
|
|
227
|
-
|
|
228
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
229
|
-
|
|
230
|
-
## 0.3.21 (2025-11-27)
|
|
231
|
-
|
|
232
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
233
|
-
|
|
234
|
-
## 0.3.20 (2025-11-26)
|
|
235
|
-
|
|
236
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
237
|
-
|
|
238
|
-
## 0.3.19 (2025-11-26)
|
|
239
|
-
|
|
240
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
241
|
-
|
|
242
|
-
## 0.3.18 (2025-11-26)
|
|
243
|
-
|
|
244
|
-
### 🩹 Fixes
|
|
245
|
-
|
|
246
|
-
- build all libraries with vite ([2880d7f](https://github.com/golemui/formforge/commit/2880d7f))
|
|
247
|
-
|
|
248
|
-
### ❤️ Thank You
|
|
249
|
-
|
|
250
|
-
- Raul Jimenez @Elecash
|
|
251
|
-
|
|
252
|
-
## 0.3.17 (2025-11-25)
|
|
253
|
-
|
|
254
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
255
|
-
|
|
256
|
-
## 0.3.16 (2025-11-25)
|
|
257
|
-
|
|
258
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
259
|
-
|
|
260
|
-
## 0.3.15 (2025-11-25)
|
|
261
|
-
|
|
262
|
-
### 🩹 Fixes
|
|
263
|
-
|
|
264
|
-
- build with nx ([3f423b4](https://github.com/golemui/formforge/commit/3f423b4))
|
|
265
|
-
|
|
266
|
-
### ❤️ Thank You
|
|
267
|
-
|
|
268
|
-
- Raul Jimenez @Elecash
|
|
269
|
-
|
|
270
|
-
## 0.3.14 (2025-11-24)
|
|
271
|
-
|
|
272
|
-
### 🩹 Fixes
|
|
273
|
-
|
|
274
|
-
- package.json paths in core, lit and lit-vanilla ([677e530](https://github.com/golemui/formforge/commit/677e530))
|
|
275
|
-
|
|
276
|
-
### ❤️ Thank You
|
|
277
|
-
|
|
278
|
-
- Raul Jimenez @Elecash
|
|
279
|
-
|
|
280
|
-
## 0.3.13 (2025-11-24)
|
|
281
|
-
|
|
282
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
283
|
-
|
|
284
|
-
## 0.3.12 (2025-11-24)
|
|
285
|
-
|
|
286
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
287
|
-
|
|
288
|
-
## 0.3.11 (2025-11-24)
|
|
289
|
-
|
|
290
|
-
### 🩹 Fixes
|
|
291
|
-
|
|
292
|
-
- build files to output cjs and js ([20d24ec](https://github.com/golemui/formforge/commit/20d24ec))
|
|
293
|
-
|
|
294
|
-
### ❤️ Thank You
|
|
295
|
-
|
|
296
|
-
- Raul Jimenez @Elecash
|
|
297
|
-
|
|
298
|
-
## 0.3.10 (2025-11-24)
|
|
299
|
-
|
|
300
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
301
|
-
|
|
302
|
-
## 0.3.9 (2025-11-24)
|
|
303
|
-
|
|
304
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
305
|
-
|
|
306
|
-
## 0.3.8 (2025-11-24)
|
|
307
|
-
|
|
308
|
-
### 🩹 Fixes
|
|
309
|
-
|
|
310
|
-
- build libs for es2022 and commonjs ([7a7c037](https://github.com/golemui/formforge/commit/7a7c037))
|
|
311
|
-
|
|
312
|
-
### ❤️ Thank You
|
|
313
|
-
|
|
314
|
-
- Raul Jimenez @Elecash
|
|
315
|
-
|
|
316
|
-
## 0.3.7 (2025-11-23)
|
|
317
|
-
|
|
318
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
319
|
-
|
|
320
|
-
## 0.3.6 (2025-11-23)
|
|
321
|
-
|
|
322
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
323
|
-
|
|
324
|
-
## 0.3.5 (2025-11-23)
|
|
325
|
-
|
|
326
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
327
|
-
|
|
328
|
-
## 0.3.4 (2025-11-23)
|
|
329
|
-
|
|
330
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
331
|
-
|
|
332
|
-
## 0.3.3 (2025-11-23)
|
|
333
|
-
|
|
334
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
335
|
-
|
|
336
|
-
## 0.3.2 (2025-11-23)
|
|
337
|
-
|
|
338
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
339
|
-
|
|
340
|
-
## 0.3.1 (2025-11-23)
|
|
341
|
-
|
|
342
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
343
|
-
|
|
344
|
-
## 0.3.0 (2025-11-23)
|
|
345
|
-
|
|
346
|
-
### 🚀 Features
|
|
347
|
-
|
|
348
|
-
- **validators:** Make validators pluggable ([397e67c](https://github.com/golemui/formforge/commit/397e67c))
|
|
349
|
-
|
|
350
|
-
### ❤️ Thank You
|
|
351
|
-
|
|
352
|
-
- Joan Llenas
|
|
353
|
-
|
|
354
|
-
## 0.2.4 (2025-11-22)
|
|
355
|
-
|
|
356
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
357
|
-
|
|
358
|
-
## 0.2.3 (2025-11-22)
|
|
359
|
-
|
|
360
|
-
### 🩹 Fixes
|
|
361
|
-
|
|
362
|
-
- **react:** fix react package jsons build ([b98d9e2](https://github.com/golemui/formforge/commit/b98d9e2))
|
|
363
|
-
|
|
364
|
-
### ❤️ Thank You
|
|
365
|
-
|
|
366
|
-
- Raul Jimenez @Elecash
|
|
367
|
-
|
|
368
|
-
## 0.2.2 (2025-11-22)
|
|
369
|
-
|
|
370
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
371
|
-
|
|
372
|
-
## 0.2.1 (2025-11-16)
|
|
373
|
-
|
|
374
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
375
|
-
|
|
376
|
-
## 0.2.0 (2025-11-16)
|
|
377
|
-
|
|
378
|
-
### 🚀 Features
|
|
379
|
-
|
|
380
|
-
- **lit:** integrate touched flag ([8f9d918](https://github.com/golemui/formforge/commit/8f9d918))
|
|
381
|
-
- **lit:** Integrate the validateOn flag ([747e477](https://github.com/golemui/formforge/commit/747e477))
|
|
382
|
-
|
|
383
|
-
### 🩹 Fixes
|
|
384
|
-
|
|
385
|
-
- **lit:** Add types to ValidateOnConverter ([473b98c](https://github.com/golemui/formforge/commit/473b98c))
|
|
386
|
-
- **lit:** Integrate validateOn ([08927b1](https://github.com/golemui/formforge/commit/08927b1))
|
|
387
|
-
|
|
388
|
-
### ❤️ Thank You
|
|
389
|
-
|
|
390
|
-
- Joan Llenas
|
|
391
|
-
|
|
392
|
-
## 0.1.5 (2025-11-16)
|
|
393
|
-
|
|
394
|
-
### 🩹 Fixes
|
|
395
|
-
|
|
396
|
-
- lint errors and peer dependencies ([d0f139d](https://github.com/golemui/formforge/commit/d0f139d))
|
|
397
|
-
- set build paths for release artifacts ([9760118](https://github.com/golemui/formforge/commit/9760118))
|
|
398
|
-
|
|
399
|
-
### ❤️ Thank You
|
|
400
|
-
|
|
401
|
-
- Raul Jimenez @Elecash
|
|
402
|
-
|
|
403
|
-
## 0.1.4 (2025-11-16)
|
|
404
|
-
|
|
405
|
-
### 🩹 Fixes
|
|
406
|
-
|
|
407
|
-
- set correct paths for release artifacts ([8941d2f](https://github.com/golemui/formforge/commit/8941d2f))
|
|
408
|
-
- create release tool ([7cd7845](https://github.com/golemui/formforge/commit/7cd7845))
|
|
409
|
-
|
|
410
|
-
### ❤️ Thank You
|
|
411
|
-
|
|
412
|
-
- Raul Jimenez @Elecash
|
|
413
|
-
|
|
414
|
-
## 0.1.3 (2025-11-15)
|
|
415
|
-
|
|
416
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
417
|
-
|
|
418
|
-
## 0.1.2 (2025-11-15)
|
|
419
|
-
|
|
420
|
-
This was a version bump only for lit to align it with other projects, there were no code changes.
|
|
421
|
-
|
|
422
|
-
## 0.1.1 (2025-11-15)
|
|
423
|
-
|
|
424
|
-
### 🩹 Fixes
|
|
425
|
-
|
|
426
|
-
- update dependencies on libraries ([374b3c9](https://github.com/golemui/formforge/commit/374b3c9))
|
|
427
|
-
|
|
428
|
-
### ❤️ Thank You
|
|
429
|
-
|
|
430
|
-
- Raul Jimenez @Elecash
|
|
431
|
-
|
|
432
|
-
## 0.1.0 (2025-11-15)
|
|
433
|
-
|
|
434
|
-
### 🚀 Features
|
|
435
|
-
|
|
436
|
-
- **lit:** Add lit vanilla components, create shared lib for playgrounds ([3e34ad1](https://github.com/golemui/formforge/commit/3e34ad1))
|
|
437
|
-
- **lit:** Add lit element support ([a122d2d](https://github.com/golemui/formforge/commit/a122d2d))
|
|
438
|
-
|
|
439
|
-
### 🩹 Fixes
|
|
440
|
-
|
|
441
|
-
- Integrate custom validators on lit and react projects ([b109a1b](https://github.com/golemui/formforge/commit/b109a1b))
|
|
442
|
-
- **lit:** Fix lit form element event dispatching ([5669e26](https://github.com/golemui/formforge/commit/5669e26))
|
|
443
|
-
- **core:** Rename Button to Interactive ([25fcea3](https://github.com/golemui/formforge/commit/25fcea3))
|
|
444
|
-
|
|
445
|
-
### ❤️ Thank You
|
|
446
|
-
|
|
447
|
-
- Joan Llenas
|
|
448
|
-
- Raul Jimenez @Elecash
|
|
3
|
+
This was a version bump only for lit to align it with other projects, there were no code changes.
|
package/README.md
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
# lit
|
|
1
|
+
# @golemui/lit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[Golem UI](https://golemui.com): the declarative form engine.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install @golemui/lit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
- Website: https://golemui.com
|
|
14
|
+
- Repository: https://github.com/golemui/golemui
|
|
15
|
+
- Source: https://github.com/golemui/golemui/tree/main/libs/lit
|
|
16
|
+
- Issues: https://github.com/golemui/golemui/issues
|
|
17
|
+
|
|
18
|
+
## License
|
|
19
|
+
|
|
20
|
+
MIT
|
package/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Subject as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { LitElement as f, html as
|
|
5
|
-
import { property as
|
|
6
|
-
import { when as
|
|
7
|
-
class
|
|
1
|
+
import * as n from "@golemui/core";
|
|
2
|
+
import { Subject as C, takeUntil as h, combineLatest as T } from "rxjs";
|
|
3
|
+
import { createContext as c, consume as g, ContextProvider as _, provide as $ } from "@lit/context";
|
|
4
|
+
import { LitElement as f, nothing as I, html as x } from "lit";
|
|
5
|
+
import { property as d, customElement as w, state as W } from "lit/decorators.js";
|
|
6
|
+
import { when as A } from "lit/directives/when.js";
|
|
7
|
+
class b {
|
|
8
8
|
constructor() {
|
|
9
|
-
this.templateData = {}, this.destroy$ = new
|
|
9
|
+
this.templateData = {}, this.destroy$ = new C(), this.templateDataChanged$ = new C();
|
|
10
10
|
}
|
|
11
11
|
setTemplateData(t) {
|
|
12
12
|
this.templateData = { ...this.templateData, ...t }, this.templateDataChanged$.next();
|
|
@@ -19,11 +19,15 @@ class g {
|
|
|
19
19
|
}
|
|
20
20
|
// Listen to the calculated props stream and keep all widget props merged in a flattened object
|
|
21
21
|
templateDataUpdater() {
|
|
22
|
-
this.context.store.state$.pipe(h(this.destroy$),
|
|
23
|
-
|
|
22
|
+
this.context.store.state$.pipe(h(this.destroy$), n.calculatedWidgetsByUid$(this.widget.uid)).subscribe((t) => {
|
|
23
|
+
const o = {
|
|
24
24
|
...t,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
lang: this.context.store.getState().lang,
|
|
26
|
+
deps: this.context.dependencies
|
|
27
|
+
};
|
|
28
|
+
n.assertNoPropCollisions(t.uid, t.props, o), this.setTemplateData({
|
|
29
|
+
...o,
|
|
30
|
+
...t.props
|
|
27
31
|
});
|
|
28
32
|
});
|
|
29
33
|
}
|
|
@@ -34,8 +38,8 @@ class g {
|
|
|
34
38
|
}), this.destroy$.next();
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
|
-
const
|
|
38
|
-
class
|
|
41
|
+
const q = c("guiInputWidgetAdapter");
|
|
42
|
+
class J extends b {
|
|
39
43
|
constructor() {
|
|
40
44
|
super(...arguments), this.templateData = {};
|
|
41
45
|
}
|
|
@@ -43,21 +47,21 @@ class q extends g {
|
|
|
43
47
|
this.widget = t, this.addWidgetToTheStore(t), this.templateDataUpdater(), this.context.store.dispatch({
|
|
44
48
|
type: "SET_WIDGET_INITIAL_DATA",
|
|
45
49
|
payload: { data: t.defaultValue, path: t.path }
|
|
46
|
-
}), this.context.store.state$.pipe(h(this.destroy$),
|
|
47
|
-
const
|
|
50
|
+
}), this.context.store.state$.pipe(h(this.destroy$), n.dataByPath$(t.path)).subscribe((e) => this.setTemplateData({ value: e }));
|
|
51
|
+
const o = this.context.store.state$.pipe(
|
|
48
52
|
h(this.destroy$),
|
|
49
|
-
|
|
53
|
+
n.validationByPath$(t.path)
|
|
50
54
|
), r = this.context.store.state$.pipe(
|
|
51
55
|
h(this.destroy$),
|
|
52
|
-
|
|
56
|
+
n.injectedValidationByPath$(t.path)
|
|
53
57
|
);
|
|
54
|
-
|
|
58
|
+
T([o, r]).subscribe(
|
|
55
59
|
([e, s]) => {
|
|
56
60
|
this.setTemplateData({
|
|
57
61
|
errors: [...e ?? [], ...s ?? []]
|
|
58
62
|
});
|
|
59
63
|
}
|
|
60
|
-
), this.context.store.state$.pipe(h(this.destroy$),
|
|
64
|
+
), this.context.store.state$.pipe(h(this.destroy$), n.touchedControlsByPath$(t.path)).subscribe((e) => this.setTemplateData({ touched: e })), this.context.emitEvent("load", this.widget);
|
|
61
65
|
}
|
|
62
66
|
valueChanged(t) {
|
|
63
67
|
this.context.store.dispatch({
|
|
@@ -77,18 +81,18 @@ class q extends g {
|
|
|
77
81
|
/**
|
|
78
82
|
* This is a helper to get the item renderer from the context
|
|
79
83
|
*/
|
|
80
|
-
getItemRenderer(t,
|
|
81
|
-
return t ? this.context.itemRenderers[t] :
|
|
84
|
+
getItemRenderer(t, o) {
|
|
85
|
+
return t ? this.context.itemRenderers[t] : o;
|
|
82
86
|
}
|
|
83
87
|
onBlur() {
|
|
84
88
|
this.context.store.dispatch({
|
|
85
89
|
type: "ATTEMPT_VALIDATION",
|
|
86
90
|
payload: { reason: "blur", path: this.widget.path, uid: this.widget.uid }
|
|
87
|
-
});
|
|
91
|
+
}), this.context.emitEvent("blur", this.widget);
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
|
-
const
|
|
91
|
-
class
|
|
94
|
+
const Z = c("guiDisplayWidgetAdapter");
|
|
95
|
+
class Q extends b {
|
|
92
96
|
constructor() {
|
|
93
97
|
super(...arguments), this.templateData = {};
|
|
94
98
|
}
|
|
@@ -98,31 +102,33 @@ class X extends g {
|
|
|
98
102
|
}), this.addWidgetToTheStore(t), this.templateDataUpdater();
|
|
99
103
|
}
|
|
100
104
|
}
|
|
101
|
-
const
|
|
102
|
-
class
|
|
105
|
+
const X = c("guiActionWidgetAdapter");
|
|
106
|
+
class Y extends b {
|
|
103
107
|
constructor() {
|
|
104
108
|
super(...arguments), this.templateData = {};
|
|
105
109
|
}
|
|
106
110
|
init(t) {
|
|
107
111
|
this.widget = t, this.setTemplateData({
|
|
108
|
-
label: this.widget.label
|
|
112
|
+
label: this.widget.label,
|
|
113
|
+
icon: this.widget.props?.icon,
|
|
114
|
+
iconPosition: this.widget.props?.iconPosition
|
|
109
115
|
}), this.addWidgetToTheStore(t), this.templateDataUpdater(), this.context.emitEvent("load", this.widget);
|
|
110
116
|
}
|
|
111
117
|
click() {
|
|
112
118
|
this.context.emitEvent("click", this.widget);
|
|
113
119
|
}
|
|
114
120
|
}
|
|
115
|
-
const
|
|
116
|
-
class
|
|
121
|
+
const K = c("guiLayoutWidgetAdapter");
|
|
122
|
+
class tt extends b {
|
|
117
123
|
constructor() {
|
|
118
124
|
super(...arguments), this.templateData = {};
|
|
119
125
|
}
|
|
120
126
|
init(t) {
|
|
121
127
|
this.widget = t, this.setTemplateData({
|
|
122
128
|
...this.widget.props
|
|
123
|
-
}), this.context.store.state$.pipe(
|
|
129
|
+
}), this.context.store.state$.pipe(n.calculatedLayoutChildrenByUid$(this.widget.uid)).pipe(h(this.destroy$)).subscribe((o) => {
|
|
124
130
|
this.setTemplateData({
|
|
125
|
-
children:
|
|
131
|
+
children: o
|
|
126
132
|
});
|
|
127
133
|
}), this.addWidgetToTheStore(t), this.templateDataUpdater();
|
|
128
134
|
}
|
|
@@ -130,37 +136,42 @@ class et extends g {
|
|
|
130
136
|
this.context.emitEvent("change", this.widget, t);
|
|
131
137
|
}
|
|
132
138
|
}
|
|
133
|
-
const v =
|
|
134
|
-
class
|
|
139
|
+
const v = c("guiFormContext");
|
|
140
|
+
class S extends n.FormContext {
|
|
135
141
|
// Just a subclass to make Core.FormContext Injectable
|
|
136
142
|
}
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
var R = Object.defineProperty, u = (i, t, a, r) => {
|
|
144
|
-
for (var e = void 0, s = i.length - 1, d; s >= 0; s--)
|
|
145
|
-
(d = i[s]) && (e = d(t, a, e) || e);
|
|
146
|
-
return e && R(t, a, e), e;
|
|
143
|
+
const y = c("guiRepeaterIndexesContext");
|
|
144
|
+
var O = Object.defineProperty, u = (i, t, o, r) => {
|
|
145
|
+
for (var e = void 0, s = i.length - 1, a; s >= 0; s--)
|
|
146
|
+
(a = i[s]) && (e = a(t, o, e) || e);
|
|
147
|
+
return e && O(t, o, e), e;
|
|
147
148
|
};
|
|
148
|
-
const
|
|
149
|
+
const R = (i) => {
|
|
149
150
|
class t extends i {
|
|
151
|
+
constructor() {
|
|
152
|
+
super(...arguments), this.repeaterIndexes = [];
|
|
153
|
+
}
|
|
150
154
|
connectedCallback() {
|
|
151
155
|
super.connectedCallback?.(), this.loadWidgetComponent();
|
|
152
156
|
}
|
|
153
157
|
async loadWidgetComponent() {
|
|
154
158
|
if (this.widget)
|
|
155
159
|
try {
|
|
156
|
-
const r = await this.formContext.widgetRegistry.loadWidget(this.widget.type), e = new r(), s = this.
|
|
157
|
-
|
|
160
|
+
const r = await this.formContext.widgetRegistry.loadWidget(this.widget.type), e = new r(), s = this.repeaterIndexes ?? [];
|
|
161
|
+
let a;
|
|
162
|
+
this.repeaterIndex !== void 0 ? a = [...s, this.repeaterIndex] : a = s, e.widget = a.length > 0 ? n.makeRepeaterItemConfig(
|
|
163
|
+
n.cloneObject(this.widget),
|
|
164
|
+
a
|
|
165
|
+
) : this.widget, e.id = `host-${this.widget.uid}`, this.replaceWith(e);
|
|
158
166
|
} catch (r) {
|
|
159
|
-
console.error(`Widget "${this.widget.type}" could not be loaded`, r)
|
|
167
|
+
console.error(`Widget "${this.widget.type}" could not be loaded`, r);
|
|
168
|
+
const e = n.errorCodes.widgetCouldNotBeLoaded;
|
|
169
|
+
this.dispatchEvent(
|
|
160
170
|
new CustomEvent("formHealth", {
|
|
161
171
|
detail: {
|
|
162
172
|
status: "errored",
|
|
163
|
-
message: `Widget "${this.widget.type}" could not be loaded
|
|
173
|
+
message: `[${e}] Widget "${this.widget.type}" could not be loaded`,
|
|
174
|
+
code: e
|
|
164
175
|
},
|
|
165
176
|
bubbles: !0,
|
|
166
177
|
composed: !0
|
|
@@ -173,36 +184,36 @@ const N = (i) => {
|
|
|
173
184
|
}
|
|
174
185
|
}
|
|
175
186
|
return u([
|
|
176
|
-
|
|
177
|
-
|
|
187
|
+
g({ context: v }),
|
|
188
|
+
d({ attribute: !1 })
|
|
178
189
|
], t.prototype, "formContext"), u([
|
|
179
|
-
|
|
190
|
+
d({ type: Object })
|
|
180
191
|
], t.prototype, "widget"), u([
|
|
181
|
-
|
|
192
|
+
d({ type: Number })
|
|
182
193
|
], t.prototype, "repeaterIndex"), u([
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
], t.prototype, "
|
|
194
|
+
g({ context: y, subscribe: !0 }),
|
|
195
|
+
d({ attribute: !1 })
|
|
196
|
+
], t.prototype, "repeaterIndexes"), t;
|
|
186
197
|
};
|
|
187
|
-
var
|
|
188
|
-
for (var e = r > 1 ? void 0 : r ?
|
|
189
|
-
(
|
|
198
|
+
var N = Object.getOwnPropertyDescriptor, P = (i, t, o, r) => {
|
|
199
|
+
for (var e = r > 1 ? void 0 : r ? N(t, o) : t, s = i.length - 1, a; s >= 0; s--)
|
|
200
|
+
(a = i[s]) && (e = a(e) || e);
|
|
190
201
|
return e;
|
|
191
202
|
};
|
|
192
|
-
let
|
|
203
|
+
let E = class extends R(f) {
|
|
193
204
|
};
|
|
194
|
-
|
|
205
|
+
E = P([
|
|
195
206
|
w("gui-widget")
|
|
196
|
-
],
|
|
197
|
-
var
|
|
198
|
-
for (var e = void 0, s = i.length - 1,
|
|
199
|
-
(
|
|
200
|
-
return e &&
|
|
207
|
+
], E);
|
|
208
|
+
var L = Object.defineProperty, m = (i, t, o, r) => {
|
|
209
|
+
for (var e = void 0, s = i.length - 1, a; s >= 0; s--)
|
|
210
|
+
(a = i[s]) && (e = a(t, o, e) || e);
|
|
211
|
+
return e && L(t, o, e), e;
|
|
201
212
|
};
|
|
202
|
-
const
|
|
213
|
+
const j = (i) => {
|
|
203
214
|
class t extends i {
|
|
204
215
|
constructor() {
|
|
205
|
-
super(...arguments), this.repeaterIndex = -1, this.
|
|
216
|
+
super(...arguments), this.repeaterIndex = -1, this.parentRepeaterIndexes = [];
|
|
206
217
|
}
|
|
207
218
|
connectedCallback() {
|
|
208
219
|
super.connectedCallback(), this.loadWidgetComponent(this.repeaterIndex);
|
|
@@ -210,14 +221,23 @@ const S = (i) => {
|
|
|
210
221
|
async loadWidgetComponent(r) {
|
|
211
222
|
if (this.widget)
|
|
212
223
|
try {
|
|
213
|
-
const e = await this.formContext.widgetRegistry.loadWidget(this.widget.type), s = new e();
|
|
214
|
-
|
|
224
|
+
const e = await this.formContext.widgetRegistry.loadWidget(this.widget.type), s = new e(), a = [...this.parentRepeaterIndexes ?? [], r];
|
|
225
|
+
new _(s, {
|
|
226
|
+
context: y,
|
|
227
|
+
initialValue: a
|
|
228
|
+
}), s.widget = n.makeRepeaterItemConfig(
|
|
229
|
+
n.cloneObject(this.widget),
|
|
230
|
+
a
|
|
231
|
+
), s.id = `host-${this.widget.uid}`, this.replaceWith(s);
|
|
215
232
|
} catch (e) {
|
|
216
|
-
console.error(`Widget "${this.widget.type}" could not be loaded`, e)
|
|
233
|
+
console.error(`Widget "${this.widget.type}" could not be loaded`, e);
|
|
234
|
+
const s = n.errorCodes.widgetCouldNotBeLoaded;
|
|
235
|
+
this.dispatchEvent(
|
|
217
236
|
new CustomEvent("formHealth", {
|
|
218
237
|
detail: {
|
|
219
238
|
status: "errored",
|
|
220
|
-
message: `Widget "${this.widget.type}" could not be loaded
|
|
239
|
+
message: `[${s}] Widget "${this.widget.type}" could not be loaded`,
|
|
240
|
+
code: s
|
|
221
241
|
},
|
|
222
242
|
bubbles: !0,
|
|
223
243
|
composed: !0
|
|
@@ -230,159 +250,136 @@ const S = (i) => {
|
|
|
230
250
|
}
|
|
231
251
|
}
|
|
232
252
|
return m([
|
|
233
|
-
|
|
234
|
-
|
|
253
|
+
g({ context: v }),
|
|
254
|
+
d({ attribute: !1 })
|
|
235
255
|
], t.prototype, "formContext"), m([
|
|
236
|
-
|
|
256
|
+
d({ type: Object })
|
|
237
257
|
], t.prototype, "widget"), m([
|
|
238
|
-
|
|
258
|
+
d({ type: Number })
|
|
239
259
|
], t.prototype, "repeaterIndex"), m([
|
|
240
|
-
|
|
241
|
-
|
|
260
|
+
g({ context: y, subscribe: !0 }),
|
|
261
|
+
d({ attribute: !1 })
|
|
262
|
+
], t.prototype, "parentRepeaterIndexes"), t;
|
|
242
263
|
};
|
|
243
|
-
var
|
|
244
|
-
for (var e = r > 1 ? void 0 : r ?
|
|
245
|
-
(
|
|
264
|
+
var F = Object.getOwnPropertyDescriptor, U = (i, t, o, r) => {
|
|
265
|
+
for (var e = r > 1 ? void 0 : r ? F(t, o) : t, s = i.length - 1, a; s >= 0; s--)
|
|
266
|
+
(a = i[s]) && (e = a(e) || e);
|
|
246
267
|
return e;
|
|
247
268
|
};
|
|
248
|
-
let
|
|
269
|
+
let D = class extends j(f) {
|
|
249
270
|
};
|
|
250
|
-
|
|
271
|
+
D = U([
|
|
251
272
|
w("gui-repeater-widget")
|
|
252
|
-
],
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const t = JSON.parse(i);
|
|
258
|
-
if (Array.isArray(t))
|
|
259
|
-
return t;
|
|
260
|
-
} catch {
|
|
261
|
-
}
|
|
262
|
-
return i;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
var F = Object.defineProperty, M = Object.getOwnPropertyDescriptor, c = (i, t, a, r) => {
|
|
267
|
-
for (var e = r > 1 ? void 0 : r ? M(t, a) : t, s = i.length - 1, d; s >= 0; s--)
|
|
268
|
-
(d = i[s]) && (e = (r ? d(t, a, e) : d(e)) || e);
|
|
269
|
-
return r && e && F(t, a, e), e;
|
|
273
|
+
], D);
|
|
274
|
+
var M = Object.defineProperty, V = Object.getOwnPropertyDescriptor, l = (i, t, o, r) => {
|
|
275
|
+
for (var e = r > 1 ? void 0 : r ? V(t, o) : t, s = i.length - 1, a; s >= 0; s--)
|
|
276
|
+
(a = i[s]) && (e = (r ? a(t, o, e) : a(e)) || e);
|
|
277
|
+
return r && e && M(t, o, e), e;
|
|
270
278
|
};
|
|
271
|
-
let
|
|
279
|
+
let p = class extends f {
|
|
272
280
|
constructor() {
|
|
273
|
-
super(...arguments), this.context = new
|
|
274
|
-
};
|
|
281
|
+
super(...arguments), this.context = new S(), this.autocomplete = void 0, this.direction = "ltr", this.unsubscribeI18n = () => {
|
|
282
|
+
}, this._defaultFormName = n.shortUUID();
|
|
275
283
|
}
|
|
276
284
|
connectedCallback() {
|
|
277
|
-
super.connectedCallback(), this.classList.add("gui-form"), this.context.
|
|
278
|
-
this.
|
|
279
|
-
|
|
280
|
-
this.validators,
|
|
281
|
-
this.validateOn,
|
|
282
|
-
this.itemRenderers,
|
|
283
|
-
this.localization
|
|
284
|
-
), this.direction = p.getDirectionFromLanguage(this.context.localization.lang), this.subscriptions.push(
|
|
285
|
-
this.context.store.state$.subscribe((i) => this.state = i),
|
|
286
|
-
p.formHealth(this.context.store.state$).subscribe((i) => {
|
|
287
|
-
this.dispatchEvent(
|
|
288
|
-
new CustomEvent(o.FORM_HEALTH_EVENT, {
|
|
289
|
-
detail: i,
|
|
290
|
-
bubbles: !0
|
|
291
|
-
})
|
|
292
|
-
);
|
|
293
|
-
}),
|
|
294
|
-
this.context.events$.subscribe(
|
|
295
|
-
(i) => this.dispatchEvent(
|
|
296
|
-
new CustomEvent(o.FORM_EVENT, { detail: i, bubbles: !0 })
|
|
297
|
-
)
|
|
285
|
+
super.connectedCallback(), this.classList.add("gui-form"), this.eventSub = this.context.events$.subscribe(
|
|
286
|
+
(i) => this.dispatchEvent(
|
|
287
|
+
new CustomEvent(p.FORM_EVENT, { detail: i, bubbles: !0 })
|
|
298
288
|
)
|
|
299
|
-
)
|
|
300
|
-
|
|
301
|
-
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
updated(i) {
|
|
292
|
+
super.updated(i), i.has("config") && this.config && this._reinitialize(this.config);
|
|
293
|
+
}
|
|
294
|
+
_reinitialize(i) {
|
|
295
|
+
this.unsubscribeI18n(), this.stateSub?.unsubscribe(), this.healthSub?.unsubscribe(), this.context.initialize(
|
|
296
|
+
i.widgetLoaders,
|
|
297
|
+
i.middlewares ?? [],
|
|
298
|
+
this.validators,
|
|
299
|
+
i.validateOn ?? "eager",
|
|
300
|
+
i.itemRenderers ?? {},
|
|
301
|
+
i.localization,
|
|
302
|
+
i.dependencies ?? {}
|
|
303
|
+
), this.direction = n.getDirectionFromLanguage(this.context.localization.lang), this.stateSub = this.context.store.state$.subscribe((t) => {
|
|
304
|
+
this.formState = t, this.requestUpdate();
|
|
305
|
+
}), this.healthSub = n.formHealth(this.context.store.state$).subscribe((t) => {
|
|
306
|
+
this.dispatchEvent(
|
|
307
|
+
new CustomEvent(p.FORM_HEALTH_EVENT, {
|
|
308
|
+
detail: t,
|
|
309
|
+
bubbles: !0
|
|
310
|
+
})
|
|
311
|
+
);
|
|
302
312
|
}), this.context.store.dispatch({
|
|
303
|
-
type: "
|
|
304
|
-
payload: {
|
|
305
|
-
}), this.unsubscribeI18n = this.context.localization.subscribe((
|
|
306
|
-
this.direction =
|
|
307
|
-
type: "SET_LANGUAGE",
|
|
308
|
-
payload: {
|
|
309
|
-
lang: i
|
|
310
|
-
}
|
|
311
|
-
});
|
|
313
|
+
type: "INITIALIZE",
|
|
314
|
+
payload: { formName: i.formName ?? this._defaultFormName, formDef: i.formDef }
|
|
315
|
+
}), this.context.store.dispatch({ type: "SET_DATA", payload: { data: i.data ?? {} } }), this.context.store.dispatch({ type: "SET_META", payload: { meta: i.meta ?? {} } }), this.unsubscribeI18n = this.context.localization.subscribe((t) => {
|
|
316
|
+
this.direction = n.getDirectionFromLanguage(t), this.context.store.dispatch({ type: "SET_LANGUAGE", payload: { lang: t } });
|
|
312
317
|
});
|
|
313
318
|
}
|
|
314
319
|
createRenderRoot() {
|
|
315
320
|
return this;
|
|
316
321
|
}
|
|
317
322
|
render() {
|
|
318
|
-
const i = this.
|
|
319
|
-
return
|
|
320
|
-
<form
|
|
321
|
-
|
|
323
|
+
const i = this.formState?.formDef && this.context.widgetRegistry.ready, t = this.config?.formName ?? this._defaultFormName;
|
|
324
|
+
return x`
|
|
325
|
+
<form
|
|
326
|
+
id=${t}
|
|
327
|
+
novalidate
|
|
328
|
+
dir=${this.direction}
|
|
329
|
+
autocomplete=${this.autocomplete || I}
|
|
330
|
+
>
|
|
331
|
+
${A(
|
|
322
332
|
i,
|
|
323
|
-
() =>
|
|
324
|
-
() =>
|
|
333
|
+
() => x` <gui-widget .widget=${this.formState?.formDef.form}></gui-widget>`,
|
|
334
|
+
() => x` <div>Loading form...</div>`
|
|
325
335
|
)}
|
|
326
336
|
</form>
|
|
327
337
|
`;
|
|
328
338
|
}
|
|
339
|
+
setData(i) {
|
|
340
|
+
this.context.store.dispatch({ type: "SET_DATA", payload: { data: i } });
|
|
341
|
+
}
|
|
342
|
+
setMeta(i) {
|
|
343
|
+
this.context.store.dispatch({ type: "SET_META", payload: { meta: i } });
|
|
344
|
+
}
|
|
329
345
|
disconnectedCallback() {
|
|
330
|
-
super.disconnectedCallback(), this.
|
|
346
|
+
super.disconnectedCallback(), this.stateSub?.unsubscribe(), this.healthSub?.unsubscribe(), this.eventSub?.unsubscribe(), this.unsubscribeI18n();
|
|
331
347
|
}
|
|
332
348
|
};
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
],
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
],
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
],
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
],
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
],
|
|
350
|
-
|
|
351
|
-
n({ type: Object })
|
|
352
|
-
], o.prototype, "data", 2);
|
|
353
|
-
c([
|
|
354
|
-
n({ type: String })
|
|
355
|
-
], o.prototype, "formName", 2);
|
|
356
|
-
c([
|
|
357
|
-
n({ converter: V })
|
|
358
|
-
], o.prototype, "validateOn", 2);
|
|
359
|
-
c([
|
|
360
|
-
n({ type: Object })
|
|
361
|
-
], o.prototype, "itemRenderers", 2);
|
|
362
|
-
c([
|
|
363
|
-
n({ type: Object })
|
|
364
|
-
], o.prototype, "localization", 2);
|
|
365
|
-
c([
|
|
366
|
-
_()
|
|
367
|
-
], o.prototype, "direction", 2);
|
|
368
|
-
o = c([
|
|
349
|
+
p.FORM_HEALTH_EVENT = "formHealth";
|
|
350
|
+
p.FORM_EVENT = "formEvent";
|
|
351
|
+
l([
|
|
352
|
+
$({ context: v })
|
|
353
|
+
], p.prototype, "context", 2);
|
|
354
|
+
l([
|
|
355
|
+
d({ attribute: !1 })
|
|
356
|
+
], p.prototype, "config", 2);
|
|
357
|
+
l([
|
|
358
|
+
d({ attribute: !1 })
|
|
359
|
+
], p.prototype, "validators", 2);
|
|
360
|
+
l([
|
|
361
|
+
d({ type: String })
|
|
362
|
+
], p.prototype, "autocomplete", 2);
|
|
363
|
+
l([
|
|
364
|
+
W()
|
|
365
|
+
], p.prototype, "direction", 2);
|
|
366
|
+
p = l([
|
|
369
367
|
w("gui-core-form")
|
|
370
|
-
],
|
|
368
|
+
], p);
|
|
371
369
|
export {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
Q as displayWidgetContext,
|
|
370
|
+
Y as ActionWidgetAdapter,
|
|
371
|
+
b as BaseWidgetAdapter,
|
|
372
|
+
Q as DisplayWidgetAdapter,
|
|
373
|
+
p as FormElement,
|
|
374
|
+
J as InputWidgetAdapter,
|
|
375
|
+
tt as LayoutWidgetAdapter,
|
|
376
|
+
S as LitFormContext,
|
|
377
|
+
D as RepeaterWidgetElement,
|
|
378
|
+
E as WidgetElement,
|
|
379
|
+
X as actionContext,
|
|
380
|
+
Z as displayWidgetContext,
|
|
384
381
|
v as formContext,
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
382
|
+
q as inputContext,
|
|
383
|
+
K as layoutContext,
|
|
384
|
+
y as repeaterIndexesContext
|
|
388
385
|
};
|
package/index.umd.cjs
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
<form
|
|
3
|
-
|
|
1
|
+
(function(i,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("@golemui/core"),require("rxjs"),require("@lit/context"),require("lit"),require("lit/decorators.js"),require("lit/directives/when.js")):typeof define=="function"&&define.amd?define(["exports","@golemui/core","rxjs","@lit/context","lit","lit/decorators.js","lit/directives/when.js"],m):(i=typeof globalThis<"u"?globalThis:i||self,m(i.lit={},i.Core,i.rxjs,i.context,i.lit,i.decorators_js,i.when_js))})(this,(function(i,m,c,h,l,p,w){"use strict";function x(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const s in a)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(a,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:()=>a[s]})}}return t.default=a,Object.freeze(t)}const d=x(m);class g{constructor(){this.templateData={},this.destroy$=new c.Subject,this.templateDataChanged$=new c.Subject}setTemplateData(t){this.templateData={...this.templateData,...t},this.templateDataChanged$.next()}addWidgetToTheStore(t){this.context.store.dispatch({type:"ADD_WIDGET",payload:{widget:t}})}templateDataUpdater(){this.context.store.state$.pipe(c.takeUntil(this.destroy$),d.calculatedWidgetsByUid$(this.widget.uid)).subscribe(t=>{const s={...t,lang:this.context.store.getState().lang,deps:this.context.dependencies};d.assertNoPropCollisions(t.uid,t.props,s),this.setTemplateData({...s,...t.props})})}destroy(){this.context.store.dispatch({type:"REMOVE_WIDGET",payload:{uid:this.widget.uid}}),this.destroy$.next()}}const v=h.createContext("guiInputWidgetAdapter");class D extends g{constructor(){super(...arguments),this.templateData={}}init(t){this.widget=t,this.addWidgetToTheStore(t),this.templateDataUpdater(),this.context.store.dispatch({type:"SET_WIDGET_INITIAL_DATA",payload:{data:t.defaultValue,path:t.path}}),this.context.store.state$.pipe(c.takeUntil(this.destroy$),d.dataByPath$(t.path)).subscribe(e=>this.setTemplateData({value:e}));const s=this.context.store.state$.pipe(c.takeUntil(this.destroy$),d.validationByPath$(t.path)),r=this.context.store.state$.pipe(c.takeUntil(this.destroy$),d.injectedValidationByPath$(t.path));c.combineLatest([s,r]).subscribe(([e,n])=>{this.setTemplateData({errors:[...e??[],...n??[]]})}),this.context.store.state$.pipe(c.takeUntil(this.destroy$),d.touchedControlsByPath$(t.path)).subscribe(e=>this.setTemplateData({touched:e})),this.context.emitEvent("load",this.widget)}valueChanged(t){this.context.store.dispatch({type:"SET_WIDGET_DATA",payload:{path:this.widget.path,data:t}}),this.context.emitEvent("change",this.widget)}filterChanged(t){this.context.emitEvent("filter",this.widget,t)}injectValidationIssues(t){this.context.store.dispatch({type:"INJECT_VALIDATION_ISSUES",payload:{path:this.widget.path,issues:t}})}getItemRenderer(t,s){return t?this.context.itemRenderers[t]:s}onBlur(){this.context.store.dispatch({type:"ATTEMPT_VALIDATION",payload:{reason:"blur",path:this.widget.path,uid:this.widget.uid}}),this.context.emitEvent("blur",this.widget)}}const T=h.createContext("guiDisplayWidgetAdapter");class $ extends g{constructor(){super(...arguments),this.templateData={}}init(t){this.widget=t,this.setTemplateData({...this.widget.props}),this.addWidgetToTheStore(t),this.templateDataUpdater()}}const W=h.createContext("guiActionWidgetAdapter");class I extends g{constructor(){super(...arguments),this.templateData={}}init(t){this.widget=t,this.setTemplateData({label:this.widget.label,icon:this.widget.props?.icon,iconPosition:this.widget.props?.iconPosition}),this.addWidgetToTheStore(t),this.templateDataUpdater(),this.context.emitEvent("load",this.widget)}click(){this.context.emitEvent("click",this.widget)}}const A=h.createContext("guiLayoutWidgetAdapter");class _ extends g{constructor(){super(...arguments),this.templateData={}}init(t){this.widget=t,this.setTemplateData({...this.widget.props}),this.context.store.state$.pipe(d.calculatedLayoutChildrenByUid$(this.widget.uid)).pipe(c.takeUntil(this.destroy$)).subscribe(s=>{this.setTemplateData({children:s})}),this.addWidgetToTheStore(t),this.templateDataUpdater()}change(t){this.context.emitEvent("change",this.widget,t)}}const y=h.createContext("guiFormContext");class C extends d.FormContext{}const b=h.createContext("guiRepeaterIndexesContext");var S=Object.defineProperty,f=(a,t,s,r)=>{for(var e=void 0,n=a.length-1,o;n>=0;n--)(o=a[n])&&(e=o(t,s,e)||e);return e&&S(t,s,e),e};const O=a=>{class t extends a{constructor(){super(...arguments),this.repeaterIndexes=[]}connectedCallback(){super.connectedCallback?.(),this.loadWidgetComponent()}async loadWidgetComponent(){if(this.widget)try{const r=await this.formContext.widgetRegistry.loadWidget(this.widget.type),e=new r,n=this.repeaterIndexes??[];let o;this.repeaterIndex!==void 0?o=[...n,this.repeaterIndex]:o=n,e.widget=o.length>0?d.makeRepeaterItemConfig(d.cloneObject(this.widget),o):this.widget,e.id=`host-${this.widget.uid}`,this.replaceWith(e)}catch(r){console.error(`Widget "${this.widget.type}" could not be loaded`,r);const e=d.errorCodes.widgetCouldNotBeLoaded;this.dispatchEvent(new CustomEvent("formHealth",{detail:{status:"errored",message:`[${e}] Widget "${this.widget.type}" could not be loaded`,code:e},bubbles:!0,composed:!0}))}}render(){return null}}return f([h.consume({context:y}),p.property({attribute:!1})],t.prototype,"formContext"),f([p.property({type:Object})],t.prototype,"widget"),f([p.property({type:Number})],t.prototype,"repeaterIndex"),f([h.consume({context:b,subscribe:!0}),p.property({attribute:!1})],t.prototype,"repeaterIndexes"),t};var F=Object.getOwnPropertyDescriptor,R=(a,t,s,r)=>{for(var e=r>1?void 0:r?F(t,s):t,n=a.length-1,o;n>=0;n--)(o=a[n])&&(e=o(e)||e);return e};i.WidgetElement=class extends O(l.LitElement){},i.WidgetElement=R([p.customElement("gui-widget")],i.WidgetElement);var L=Object.defineProperty,E=(a,t,s,r)=>{for(var e=void 0,n=a.length-1,o;n>=0;n--)(o=a[n])&&(e=o(t,s,e)||e);return e&&L(t,s,e),e};const P=a=>{class t extends a{constructor(){super(...arguments),this.repeaterIndex=-1,this.parentRepeaterIndexes=[]}connectedCallback(){super.connectedCallback(),this.loadWidgetComponent(this.repeaterIndex)}async loadWidgetComponent(r){if(this.widget)try{const e=await this.formContext.widgetRegistry.loadWidget(this.widget.type),n=new e,o=[...this.parentRepeaterIndexes??[],r];new h.ContextProvider(n,{context:b,initialValue:o}),n.widget=d.makeRepeaterItemConfig(d.cloneObject(this.widget),o),n.id=`host-${this.widget.uid}`,this.replaceWith(n)}catch(e){console.error(`Widget "${this.widget.type}" could not be loaded`,e);const n=d.errorCodes.widgetCouldNotBeLoaded;this.dispatchEvent(new CustomEvent("formHealth",{detail:{status:"errored",message:`[${n}] Widget "${this.widget.type}" could not be loaded`,code:n},bubbles:!0,composed:!0}))}}render(){return null}}return E([h.consume({context:y}),p.property({attribute:!1})],t.prototype,"formContext"),E([p.property({type:Object})],t.prototype,"widget"),E([p.property({type:Number})],t.prototype,"repeaterIndex"),E([h.consume({context:b,subscribe:!0}),p.property({attribute:!1})],t.prototype,"parentRepeaterIndexes"),t};var N=Object.getOwnPropertyDescriptor,U=(a,t,s,r)=>{for(var e=r>1?void 0:r?N(t,s):t,n=a.length-1,o;n>=0;n--)(o=a[n])&&(e=o(e)||e);return e};i.RepeaterWidgetElement=class extends P(l.LitElement){},i.RepeaterWidgetElement=U([p.customElement("gui-repeater-widget")],i.RepeaterWidgetElement);var M=Object.defineProperty,k=Object.getOwnPropertyDescriptor,u=(a,t,s,r)=>{for(var e=r>1?void 0:r?k(t,s):t,n=a.length-1,o;n>=0;n--)(o=a[n])&&(e=(r?o(t,s,e):o(e))||e);return r&&e&&M(t,s,e),e};i.FormElement=class extends l.LitElement{constructor(){super(...arguments),this.context=new C,this.autocomplete=void 0,this.direction="ltr",this.unsubscribeI18n=()=>{},this._defaultFormName=d.shortUUID()}connectedCallback(){super.connectedCallback(),this.classList.add("gui-form"),this.eventSub=this.context.events$.subscribe(t=>this.dispatchEvent(new CustomEvent(i.FormElement.FORM_EVENT,{detail:t,bubbles:!0})))}updated(t){super.updated(t),t.has("config")&&this.config&&this._reinitialize(this.config)}_reinitialize(t){this.unsubscribeI18n(),this.stateSub?.unsubscribe(),this.healthSub?.unsubscribe(),this.context.initialize(t.widgetLoaders,t.middlewares??[],this.validators,t.validateOn??"eager",t.itemRenderers??{},t.localization,t.dependencies??{}),this.direction=d.getDirectionFromLanguage(this.context.localization.lang),this.stateSub=this.context.store.state$.subscribe(s=>{this.formState=s,this.requestUpdate()}),this.healthSub=d.formHealth(this.context.store.state$).subscribe(s=>{this.dispatchEvent(new CustomEvent(i.FormElement.FORM_HEALTH_EVENT,{detail:s,bubbles:!0}))}),this.context.store.dispatch({type:"INITIALIZE",payload:{formName:t.formName??this._defaultFormName,formDef:t.formDef}}),this.context.store.dispatch({type:"SET_DATA",payload:{data:t.data??{}}}),this.context.store.dispatch({type:"SET_META",payload:{meta:t.meta??{}}}),this.unsubscribeI18n=this.context.localization.subscribe(s=>{this.direction=d.getDirectionFromLanguage(s),this.context.store.dispatch({type:"SET_LANGUAGE",payload:{lang:s}})})}createRenderRoot(){return this}render(){const t=this.formState?.formDef&&this.context.widgetRegistry.ready,s=this.config?.formName??this._defaultFormName;return l.html`
|
|
2
|
+
<form
|
|
3
|
+
id=${s}
|
|
4
|
+
novalidate
|
|
5
|
+
dir=${this.direction}
|
|
6
|
+
autocomplete=${this.autocomplete||l.nothing}
|
|
7
|
+
>
|
|
8
|
+
${w.when(t,()=>l.html` <gui-widget .widget=${this.formState?.formDef.form}></gui-widget>`,()=>l.html` <div>Loading form...</div>`)}
|
|
4
9
|
</form>
|
|
5
|
-
`}
|
|
10
|
+
`}setData(t){this.context.store.dispatch({type:"SET_DATA",payload:{data:t}})}setMeta(t){this.context.store.dispatch({type:"SET_META",payload:{meta:t}})}disconnectedCallback(){super.disconnectedCallback(),this.stateSub?.unsubscribe(),this.healthSub?.unsubscribe(),this.eventSub?.unsubscribe(),this.unsubscribeI18n()}},i.FormElement.FORM_HEALTH_EVENT="formHealth",i.FormElement.FORM_EVENT="formEvent",u([h.provide({context:y})],i.FormElement.prototype,"context",2),u([p.property({attribute:!1})],i.FormElement.prototype,"config",2),u([p.property({attribute:!1})],i.FormElement.prototype,"validators",2),u([p.property({type:String})],i.FormElement.prototype,"autocomplete",2),u([p.state()],i.FormElement.prototype,"direction",2),i.FormElement=u([p.customElement("gui-core-form")],i.FormElement),i.ActionWidgetAdapter=I,i.BaseWidgetAdapter=g,i.DisplayWidgetAdapter=$,i.InputWidgetAdapter=D,i.LayoutWidgetAdapter=_,i.LitFormContext=C,i.actionContext=W,i.displayWidgetContext=T,i.formContext=y,i.inputContext=v,i.layoutContext=A,i.repeaterIndexesContext=b,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BaseWidgetAdapter } from './base-widget.adapter';
|
|
2
2
|
import * as Core from '@golemui/core';
|
|
3
3
|
export declare const actionContext: {
|
|
4
|
-
__context__: ActionWidgetAdapter
|
|
4
|
+
__context__: ActionWidgetAdapter<any>;
|
|
5
5
|
};
|
|
6
|
-
export declare class ActionWidgetAdapter extends BaseWidgetAdapter<Core.ActionWidget> {
|
|
7
|
-
templateData: Core.ActionWidgetTemplateData;
|
|
6
|
+
export declare class ActionWidgetAdapter<ExtraProps extends Record<string, any>> extends BaseWidgetAdapter<Core.ActionWidget> {
|
|
7
|
+
templateData: Core.ActionWidgetTemplateData & ExtraProps;
|
|
8
8
|
init(widget: Core.ActionWidget): void;
|
|
9
9
|
click(): void;
|
|
10
10
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormInitConfig, WithWidget } from '@golemui/core';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
|
-
import { Subscription } from 'rxjs';
|
|
4
3
|
import { LitFormContext } from '../../context/form.context';
|
|
5
4
|
import * as Core from '@golemui/core';
|
|
6
5
|
export declare class FormElement extends LitElement {
|
|
7
6
|
context: LitFormContext<Core.WithWidget>;
|
|
8
|
-
|
|
9
|
-
widgetLoaders: WidgetLoaders<WithWidget>;
|
|
7
|
+
config: FormInitConfig<WithWidget>;
|
|
10
8
|
validators: Core.ValidatorFn<any>;
|
|
11
|
-
|
|
12
|
-
data: any;
|
|
13
|
-
formName: string;
|
|
14
|
-
validateOn: Core.ValidateOn;
|
|
15
|
-
itemRenderers: Record<string, Core.ItemRenderer>;
|
|
16
|
-
localization?: Core.I18nTranslator;
|
|
9
|
+
autocomplete: string | undefined;
|
|
17
10
|
direction: 'ltr' | 'rtl';
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
private formState;
|
|
12
|
+
private stateSub;
|
|
13
|
+
private healthSub;
|
|
14
|
+
private eventSub;
|
|
20
15
|
private unsubscribeI18n;
|
|
16
|
+
private readonly _defaultFormName;
|
|
21
17
|
static FORM_HEALTH_EVENT: string;
|
|
22
18
|
static FORM_EVENT: string;
|
|
23
19
|
connectedCallback(): void;
|
|
20
|
+
updated(changed: Map<string, unknown>): void;
|
|
21
|
+
private _reinitialize;
|
|
24
22
|
createRenderRoot(): this;
|
|
25
23
|
render(): import('lit-html').TemplateResult<1>;
|
|
24
|
+
setData(data: Record<string, any>): void;
|
|
25
|
+
setMeta(meta: Record<string, any>): void;
|
|
26
26
|
disconnectedCallback(): void;
|
|
27
27
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemui/lit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.umd.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -20,9 +20,14 @@
|
|
|
20
20
|
"*.md"
|
|
21
21
|
],
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@golemui/core": "
|
|
23
|
+
"@golemui/core": "0.12.1",
|
|
24
24
|
"@lit/context": "^1.1.6",
|
|
25
25
|
"lit": "^3.3.1",
|
|
26
26
|
"rxjs": "^7.8.0"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/golemui/golemui.git",
|
|
31
|
+
"directory": "libs/lit"
|
|
27
32
|
}
|
|
28
33
|
}
|