@medyll/idae-machine 0.87.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/README.md +230 -0
- package/dist/db/dataModel.d.ts +23 -0
- package/dist/db/dataModel.js +40 -0
- package/dist/db/dbFields.d.ts +130 -0
- package/dist/db/dbFields.js +606 -0
- package/dist/db/dbSchema.d.ts +456 -0
- package/dist/db/dbSchema.js +456 -0
- package/dist/form/CollectionButton.svelte +26 -0
- package/dist/form/CollectionButton.svelte.d.ts +22 -0
- package/dist/form/CollectionFieldGuess.svelte +29 -0
- package/dist/form/CollectionFieldGuess.svelte.d.ts +11 -0
- package/dist/form/CollectionFks.svelte +24 -0
- package/dist/form/CollectionFks.svelte.d.ts +9 -0
- package/dist/form/CollectionList.svelte +93 -0
- package/dist/form/CollectionList.svelte.d.ts +30 -0
- package/dist/form/CollectionListMenu.svelte +46 -0
- package/dist/form/CollectionListMenu.svelte.d.ts +27 -0
- package/dist/form/CollectionReverseFks.svelte +56 -0
- package/dist/form/CollectionReverseFks.svelte.d.ts +18 -0
- package/dist/form/CreateUpdate.svelte +191 -0
- package/dist/form/CreateUpdate.svelte.d.ts +20 -0
- package/dist/form/CrudZone.svelte +23 -0
- package/dist/form/CrudZone.svelte.d.ts +22 -0
- package/dist/form/DataProvider.svelte +20 -0
- package/dist/form/DataProvider.svelte.d.ts +9 -0
- package/dist/form/FieldInPlace.svelte +49 -0
- package/dist/form/FieldInPlace.svelte.d.ts +11 -0
- package/dist/form/FieldValue.svelte +213 -0
- package/dist/form/FieldValue.svelte.d.ts +28 -0
- package/dist/form/types.d.ts +17 -0
- package/dist/form/types.js +1 -0
- package/dist/fragments/Confirm.svelte +58 -0
- package/dist/fragments/Confirm.svelte.d.ts +11 -0
- package/dist/fragments/Frame.svelte +19 -0
- package/dist/fragments/Frame.svelte.d.ts +32 -0
- package/dist/fragments/InfoLine.svelte +21 -0
- package/dist/fragments/InfoLine.svelte.d.ts +35 -0
- package/dist/fragments/List.svelte +21 -0
- package/dist/fragments/List.svelte.d.ts +38 -0
- package/dist/fragments/Selector.svelte +26 -0
- package/dist/fragments/Selector.svelte.d.ts +38 -0
- package/dist/fragments/Skeleton.svelte +21 -0
- package/dist/fragments/Skeleton.svelte.d.ts +20 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +23 -0
- package/dist/types/appschemeTypes.d.ts +71 -0
- package/dist/types/appschemeTypes.js +83 -0
- package/package.json +63 -0
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import { createIdbqDb } from '@medyll/idae-idbql';
|
|
2
|
+
import { space } from 'postcss/lib/list';
|
|
3
|
+
/* here is an example of how to declare a dataModel*/
|
|
4
|
+
export const schemeModelDb = {
|
|
5
|
+
agent: {
|
|
6
|
+
keyPath: '++id, promptId, created_at',
|
|
7
|
+
model: {},
|
|
8
|
+
ts: {},
|
|
9
|
+
template: {
|
|
10
|
+
index: 'id',
|
|
11
|
+
presentation: 'name model',
|
|
12
|
+
fields: {
|
|
13
|
+
id: 'id (readonly)',
|
|
14
|
+
name: 'text (private)',
|
|
15
|
+
code: 'text',
|
|
16
|
+
model: 'text',
|
|
17
|
+
prompt: 'text-long',
|
|
18
|
+
created_at: 'date (private)',
|
|
19
|
+
ia_lock: 'boolean (private)',
|
|
20
|
+
agentPromptId: 'fk-agentPrompt.id (required)'
|
|
21
|
+
},
|
|
22
|
+
fks: {
|
|
23
|
+
agentPrompt: {
|
|
24
|
+
code: 'agentPrompt',
|
|
25
|
+
rules: 'readonly private',
|
|
26
|
+
multiple: true
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
agentPrompt: {
|
|
32
|
+
keyPath: '++id, created_at',
|
|
33
|
+
model: {},
|
|
34
|
+
ts: {},
|
|
35
|
+
template: {
|
|
36
|
+
index: 'id',
|
|
37
|
+
presentation: 'name',
|
|
38
|
+
fields: {
|
|
39
|
+
id: 'id (readonly)',
|
|
40
|
+
created_at: 'date (private)',
|
|
41
|
+
value: 'text-long (required)',
|
|
42
|
+
name: 'text (required)',
|
|
43
|
+
code: 'text (required)',
|
|
44
|
+
ia_lock: 'boolean (private)'
|
|
45
|
+
},
|
|
46
|
+
fks: {}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
agentOf: {
|
|
50
|
+
keyPath: '++id, created_at',
|
|
51
|
+
model: {},
|
|
52
|
+
ts: {},
|
|
53
|
+
template: {
|
|
54
|
+
index: 'id',
|
|
55
|
+
presentation: 'name',
|
|
56
|
+
fields: {
|
|
57
|
+
code: 'text',
|
|
58
|
+
name: 'text',
|
|
59
|
+
context: 'array-of-number'
|
|
60
|
+
},
|
|
61
|
+
fks: {}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
chat: {
|
|
65
|
+
keyPath: '++id, &chatId, &chatPassKey, created_at, category, categoryId, dateLastMessage',
|
|
66
|
+
model: {},
|
|
67
|
+
ts: {},
|
|
68
|
+
template: {
|
|
69
|
+
index: 'id',
|
|
70
|
+
presentation: 'name',
|
|
71
|
+
fields: {
|
|
72
|
+
id: 'id',
|
|
73
|
+
chatId: 'fk.chat.id ',
|
|
74
|
+
chatPassKey: 'text',
|
|
75
|
+
created_at: 'date',
|
|
76
|
+
category: 'text',
|
|
77
|
+
categoryId: 'id',
|
|
78
|
+
dateLastMessage: 'date',
|
|
79
|
+
name: 'text',
|
|
80
|
+
description: 'text',
|
|
81
|
+
ia_lock: 'boolean',
|
|
82
|
+
spaceId: 'fk-space.id (required)'
|
|
83
|
+
},
|
|
84
|
+
fks: {
|
|
85
|
+
space: {
|
|
86
|
+
code: 'text',
|
|
87
|
+
rules: 'private required',
|
|
88
|
+
multiple: false
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
category: {
|
|
94
|
+
keyPath: '++id, code',
|
|
95
|
+
model: {},
|
|
96
|
+
ts: {},
|
|
97
|
+
template: {
|
|
98
|
+
index: 'id',
|
|
99
|
+
presentation: 'name',
|
|
100
|
+
fields: {
|
|
101
|
+
id: 'id',
|
|
102
|
+
code: 'text',
|
|
103
|
+
name: 'text',
|
|
104
|
+
ia_lock: 'boolean (private)'
|
|
105
|
+
},
|
|
106
|
+
fks: {}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
space: {
|
|
110
|
+
keyPath: '++id, code',
|
|
111
|
+
model: {},
|
|
112
|
+
ts: {},
|
|
113
|
+
template: {
|
|
114
|
+
index: 'id',
|
|
115
|
+
presentation: 'name',
|
|
116
|
+
fields: {
|
|
117
|
+
id: 'id',
|
|
118
|
+
code: 'text',
|
|
119
|
+
name: 'text',
|
|
120
|
+
ia_lock: 'boolean (private)'
|
|
121
|
+
},
|
|
122
|
+
fks: {}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
tags: {
|
|
126
|
+
keyPath: '++id, code',
|
|
127
|
+
model: {},
|
|
128
|
+
ts: {},
|
|
129
|
+
template: {
|
|
130
|
+
index: 'id',
|
|
131
|
+
presentation: 'name',
|
|
132
|
+
fields: {
|
|
133
|
+
id: 'id',
|
|
134
|
+
code: 'text',
|
|
135
|
+
name: 'text',
|
|
136
|
+
ia_lock: 'boolean (private)'
|
|
137
|
+
},
|
|
138
|
+
fks: {}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
messages: {
|
|
142
|
+
keyPath: '++id, messageId, chatId, created_at',
|
|
143
|
+
model: {},
|
|
144
|
+
ts: {},
|
|
145
|
+
template: {
|
|
146
|
+
index: 'id',
|
|
147
|
+
presentation: 'resume',
|
|
148
|
+
fields: {
|
|
149
|
+
id: 'id',
|
|
150
|
+
chatId: 'id',
|
|
151
|
+
messageId: 'id',
|
|
152
|
+
created_at: 'date',
|
|
153
|
+
content: 'text-long',
|
|
154
|
+
status: 'text',
|
|
155
|
+
context: 'array-of-number',
|
|
156
|
+
resume: 'text',
|
|
157
|
+
model: 'text',
|
|
158
|
+
ia_lock: 'boolean'
|
|
159
|
+
},
|
|
160
|
+
fks: {}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
prompts: {
|
|
164
|
+
keyPath: '++id, created_at',
|
|
165
|
+
model: {},
|
|
166
|
+
ts: {},
|
|
167
|
+
template: {
|
|
168
|
+
index: 'id',
|
|
169
|
+
presentation: 'name',
|
|
170
|
+
fields: {
|
|
171
|
+
id: 'id',
|
|
172
|
+
name: 'text',
|
|
173
|
+
code: 'text',
|
|
174
|
+
value: 'text',
|
|
175
|
+
created_at: 'date',
|
|
176
|
+
ia_lock: 'boolean'
|
|
177
|
+
},
|
|
178
|
+
fks: {}
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
settings: {
|
|
182
|
+
keyPath: '++id, userId',
|
|
183
|
+
model: {},
|
|
184
|
+
ts: {},
|
|
185
|
+
template: {
|
|
186
|
+
index: 'id',
|
|
187
|
+
presentation: 'code',
|
|
188
|
+
fields: {
|
|
189
|
+
id: 'id',
|
|
190
|
+
userId: 'id',
|
|
191
|
+
created_at: 'date (readonly)',
|
|
192
|
+
updated_at: 'date (readonly)',
|
|
193
|
+
code: 'text',
|
|
194
|
+
value: 'text',
|
|
195
|
+
ia_lock: 'boolean (private)'
|
|
196
|
+
},
|
|
197
|
+
fks: {}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
user: {
|
|
201
|
+
keyPath: '++id, created_at, email',
|
|
202
|
+
model: {},
|
|
203
|
+
ts: {},
|
|
204
|
+
template: {
|
|
205
|
+
index: 'id',
|
|
206
|
+
presentation: 'email',
|
|
207
|
+
fields: {
|
|
208
|
+
id: 'id',
|
|
209
|
+
name: 'text',
|
|
210
|
+
color: 'text',
|
|
211
|
+
created_at: 'date (readonly)',
|
|
212
|
+
email: 'email',
|
|
213
|
+
password: 'password',
|
|
214
|
+
ia_lock: 'boolean (private)'
|
|
215
|
+
},
|
|
216
|
+
fks: {}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
// Nouvelles entités pour le Book Creator Helper
|
|
220
|
+
book: {
|
|
221
|
+
keyPath: '++id, userId, created_at',
|
|
222
|
+
model: {},
|
|
223
|
+
ts: {},
|
|
224
|
+
template: {
|
|
225
|
+
index: 'id',
|
|
226
|
+
presentation: 'title',
|
|
227
|
+
fields: {
|
|
228
|
+
id: 'id (readonly)',
|
|
229
|
+
userId: 'id',
|
|
230
|
+
title: 'text-long (required)',
|
|
231
|
+
description: 'text-area',
|
|
232
|
+
created_at: 'date (readonly)',
|
|
233
|
+
updated_at: 'date',
|
|
234
|
+
status: 'text',
|
|
235
|
+
ia_lock: 'boolean (private)'
|
|
236
|
+
},
|
|
237
|
+
fks: {
|
|
238
|
+
user: {
|
|
239
|
+
code: 'user',
|
|
240
|
+
multiple: false,
|
|
241
|
+
rules: 'readonly'
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
chapter: {
|
|
247
|
+
keyPath: '++id, bookId, order',
|
|
248
|
+
model: {},
|
|
249
|
+
ts: {},
|
|
250
|
+
template: {
|
|
251
|
+
index: 'id',
|
|
252
|
+
presentation: 'title',
|
|
253
|
+
fields: {
|
|
254
|
+
id: 'id (readonly)',
|
|
255
|
+
bookId: 'id',
|
|
256
|
+
title: 'text-long (required)',
|
|
257
|
+
content: 'text-area',
|
|
258
|
+
order: 'number',
|
|
259
|
+
created_at: 'date (readonly)',
|
|
260
|
+
updated_at: 'date',
|
|
261
|
+
ia_lock: 'boolean (private readonly)'
|
|
262
|
+
},
|
|
263
|
+
fks: {
|
|
264
|
+
book: {
|
|
265
|
+
code: 'book',
|
|
266
|
+
multiple: false,
|
|
267
|
+
rules: 'readonly'
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
writingGoal: {
|
|
273
|
+
keyPath: '++id, userId, bookId',
|
|
274
|
+
model: {},
|
|
275
|
+
ts: {},
|
|
276
|
+
template: {
|
|
277
|
+
index: 'id',
|
|
278
|
+
presentation: 'description',
|
|
279
|
+
fields: {
|
|
280
|
+
id: 'id (readonly)',
|
|
281
|
+
userId: 'id',
|
|
282
|
+
bookId: 'id',
|
|
283
|
+
description: 'text (required)',
|
|
284
|
+
targetWordCount: 'number',
|
|
285
|
+
deadline: 'date',
|
|
286
|
+
created_at: 'date (readonly)',
|
|
287
|
+
updated_at: 'date',
|
|
288
|
+
ia_lock: 'boolean (private)'
|
|
289
|
+
},
|
|
290
|
+
fks: {
|
|
291
|
+
user: {
|
|
292
|
+
code: 'user',
|
|
293
|
+
multiple: false,
|
|
294
|
+
rules: 'readonly'
|
|
295
|
+
},
|
|
296
|
+
book: {
|
|
297
|
+
code: 'book',
|
|
298
|
+
multiple: false,
|
|
299
|
+
rules: 'readonly'
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
character: {
|
|
305
|
+
keyPath: '++id, bookId',
|
|
306
|
+
model: {},
|
|
307
|
+
ts: {},
|
|
308
|
+
template: {
|
|
309
|
+
index: 'id',
|
|
310
|
+
presentation: 'firstName lastName',
|
|
311
|
+
fields: {
|
|
312
|
+
id: 'id (readonly)',
|
|
313
|
+
bookId: 'id',
|
|
314
|
+
characterLinkIds: 'array-of-fk-characterLink.id (private)',
|
|
315
|
+
characterAttributesIds: 'array-of-fk-characterAttributes.id (private)',
|
|
316
|
+
firstName: 'text (required)',
|
|
317
|
+
lastName: 'text',
|
|
318
|
+
nickname: 'text',
|
|
319
|
+
age: 'number',
|
|
320
|
+
gender: 'text',
|
|
321
|
+
occupation: 'text',
|
|
322
|
+
role: 'text',
|
|
323
|
+
description: 'text-area',
|
|
324
|
+
backstory: 'text-area',
|
|
325
|
+
physicalDescription: 'text-area',
|
|
326
|
+
personalityTraits: 'array-of-text',
|
|
327
|
+
goals: 'text-area',
|
|
328
|
+
conflicts: 'text-area',
|
|
329
|
+
created_at: 'date (readonly private)',
|
|
330
|
+
updated_at: 'date (readonly private)',
|
|
331
|
+
ia_lock: 'boolean (private)'
|
|
332
|
+
},
|
|
333
|
+
fks: {
|
|
334
|
+
characterAttributes: {
|
|
335
|
+
code: 'characterAttributes',
|
|
336
|
+
multiple: true,
|
|
337
|
+
rules: ''
|
|
338
|
+
},
|
|
339
|
+
book: {
|
|
340
|
+
code: 'book',
|
|
341
|
+
multiple: false,
|
|
342
|
+
rules: 'readonly'
|
|
343
|
+
},
|
|
344
|
+
characterLink: {
|
|
345
|
+
code: 'characterLink',
|
|
346
|
+
multiple: true,
|
|
347
|
+
rules: ''
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
characterAttributes: {
|
|
353
|
+
keyPath: '++id',
|
|
354
|
+
model: {},
|
|
355
|
+
ts: {},
|
|
356
|
+
template: {
|
|
357
|
+
index: 'id',
|
|
358
|
+
presentation: 'name',
|
|
359
|
+
fields: {
|
|
360
|
+
id: 'id (readonly)',
|
|
361
|
+
attribute: 'text',
|
|
362
|
+
name: 'text',
|
|
363
|
+
created_at: 'date (readonly)',
|
|
364
|
+
updated_at: 'date'
|
|
365
|
+
},
|
|
366
|
+
fks: {}
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
characterLink: {
|
|
370
|
+
keyPath: '++id',
|
|
371
|
+
model: {},
|
|
372
|
+
ts: {},
|
|
373
|
+
template: {
|
|
374
|
+
index: 'id',
|
|
375
|
+
presentation: 'type',
|
|
376
|
+
fields: {
|
|
377
|
+
id: 'id',
|
|
378
|
+
characterId: 'array-of-fk-character.id',
|
|
379
|
+
type: 'text-short',
|
|
380
|
+
description: 'text-medium',
|
|
381
|
+
active: 'boolean'
|
|
382
|
+
},
|
|
383
|
+
fks: {
|
|
384
|
+
character: {
|
|
385
|
+
code: 'character',
|
|
386
|
+
multiple: true,
|
|
387
|
+
rules: ''
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
characterChapterStatus: {
|
|
393
|
+
keyPath: '++id, characterId, chapterId',
|
|
394
|
+
model: {},
|
|
395
|
+
ts: {},
|
|
396
|
+
template: {
|
|
397
|
+
index: 'id',
|
|
398
|
+
presentation: 'characterId chapterId status',
|
|
399
|
+
fields: {
|
|
400
|
+
id: 'id (readonly)',
|
|
401
|
+
characterId: 'id',
|
|
402
|
+
chapterId: 'id',
|
|
403
|
+
status: 'text',
|
|
404
|
+
role: 'text',
|
|
405
|
+
actions: 'text-long',
|
|
406
|
+
development: 'text-area',
|
|
407
|
+
notes: 'text-long',
|
|
408
|
+
created_at: 'date (readonly)',
|
|
409
|
+
updated_at: 'date'
|
|
410
|
+
},
|
|
411
|
+
fks: {
|
|
412
|
+
character: {
|
|
413
|
+
code: 'character',
|
|
414
|
+
multiple: false,
|
|
415
|
+
rules: 'readonly'
|
|
416
|
+
},
|
|
417
|
+
chapter: {
|
|
418
|
+
code: 'chapter',
|
|
419
|
+
multiple: false,
|
|
420
|
+
rules: 'readonly'
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
bookPrompts: {
|
|
426
|
+
keyPath: '++id, bookId',
|
|
427
|
+
model: {},
|
|
428
|
+
ts: {},
|
|
429
|
+
template: {
|
|
430
|
+
index: 'id',
|
|
431
|
+
presentation: 'name',
|
|
432
|
+
fields: {
|
|
433
|
+
id: 'id (readonly)',
|
|
434
|
+
bookId: 'id',
|
|
435
|
+
name: 'text (required)',
|
|
436
|
+
category: 'text',
|
|
437
|
+
content: 'text-area',
|
|
438
|
+
created_at: 'date (readonly)',
|
|
439
|
+
updated_at: 'date',
|
|
440
|
+
ia_lock: 'boolean (private)'
|
|
441
|
+
},
|
|
442
|
+
fks: {
|
|
443
|
+
book: {
|
|
444
|
+
code: 'book',
|
|
445
|
+
multiple: false,
|
|
446
|
+
rules: 'readonly'
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
export const schemeModel = {
|
|
453
|
+
...schemeModelDb
|
|
454
|
+
};
|
|
455
|
+
const idbqStore = createIdbqDb(schemeModel, 13);
|
|
456
|
+
export const { idbql, idbqlState, idbDatabase, idbqModel } = idbqStore.create('woolama');
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Component button to open a CreateUpdateShow window for a specific collection.
|
|
3
|
+
D:\boulot\python\wollama\src\components\form\CollectionButton.svelte
|
|
4
|
+
-->
|
|
5
|
+
<script lang="ts" generics="COL">
|
|
6
|
+
import { Button, openWindow } from '@medyll/idae-slotui-svelte';
|
|
7
|
+
import CreateUpdate from '$components/form/CreateUpdate.svelte';
|
|
8
|
+
import { type CreateUpdateProps } from './types';
|
|
9
|
+
|
|
10
|
+
type CollectionButtonProps = {
|
|
11
|
+
collection: string;
|
|
12
|
+
withData?: Record<string, any>;
|
|
13
|
+
} & CreateUpdateProps;
|
|
14
|
+
|
|
15
|
+
let { collection = 'book', withData, ...rest }: CollectionButtonProps = $props();
|
|
16
|
+
|
|
17
|
+
function openCrud(collection: string) {
|
|
18
|
+
openWindow(`create-${collection}`, {
|
|
19
|
+
component: CreateUpdate,
|
|
20
|
+
componentProps: { collection: collection, withData, ...rest },
|
|
21
|
+
hideCloseButton: false
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<Button class="ellipsis" onclick={() => openCrud(collection)} width="auto" icon="mdi:add" value="ui.{rest.mode}-{collection}" />
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type CreateUpdateProps } from './types';
|
|
2
|
+
type CollectionButtonProps = {
|
|
3
|
+
collection: string;
|
|
4
|
+
withData?: Record<string, any>;
|
|
5
|
+
} & CreateUpdateProps;
|
|
6
|
+
declare class __sveltets_Render<COL> {
|
|
7
|
+
props(): CollectionButtonProps;
|
|
8
|
+
events(): {};
|
|
9
|
+
slots(): {};
|
|
10
|
+
bindings(): "";
|
|
11
|
+
exports(): {};
|
|
12
|
+
}
|
|
13
|
+
interface $$IsomorphicComponent {
|
|
14
|
+
new <COL>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<COL>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<COL>['props']>, ReturnType<__sveltets_Render<COL>['events']>, ReturnType<__sveltets_Render<COL>['slots']>> & {
|
|
15
|
+
$$bindings?: ReturnType<__sveltets_Render<COL>['bindings']>;
|
|
16
|
+
} & ReturnType<__sveltets_Render<COL>['exports']>;
|
|
17
|
+
<COL>(internal: unknown, props: ReturnType<__sveltets_Render<COL>['props']> & {}): ReturnType<__sveltets_Render<COL>['exports']>;
|
|
18
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
19
|
+
}
|
|
20
|
+
declare const CollectionButton: $$IsomorphicComponent;
|
|
21
|
+
type CollectionButton<COL> = InstanceType<typeof CollectionButton<COL>>;
|
|
22
|
+
export default CollectionButton;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!-- CollectionFieldGuess.svelte -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import { Guesser } from '../tools/Guesser ';
|
|
4
|
+
import type { TplCollectionName } from '@medyll/idae-idbql';
|
|
5
|
+
import { IconButton } from '@medyll/idae-slotui-svelte';
|
|
6
|
+
|
|
7
|
+
let { collection, collectionId, fieldName, data, onGuess } = $props<{
|
|
8
|
+
collection: TplCollectionName;
|
|
9
|
+
collectionId?: any;
|
|
10
|
+
fieldName: string;
|
|
11
|
+
data: Record<string, any>;
|
|
12
|
+
onGuess: (fieldName: string, value: string) => void;
|
|
13
|
+
}>();
|
|
14
|
+
|
|
15
|
+
const guesser = new Guesser();
|
|
16
|
+
|
|
17
|
+
async function guessValue() {
|
|
18
|
+
try {
|
|
19
|
+
const result = await guesser.guessValue({ collection, collectionId, fieldName, data });
|
|
20
|
+
console.log({ result });
|
|
21
|
+
onGuess?.(fieldName, result.guessedValue);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error('Erreur lors de la devinette :', error);
|
|
24
|
+
// Gérer l'erreur (par exemple, afficher un message à l'utilisateur)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<IconButton icon="mdi:brain" tall="tiny" class="guess-button" onclick={guessValue} />
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TplCollectionName } from '@medyll/idae-idbql';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
collection: TplCollectionName;
|
|
4
|
+
collectionId?: any;
|
|
5
|
+
fieldName: string;
|
|
6
|
+
data: Record<string, any>;
|
|
7
|
+
onGuess: (fieldName: string, value: string) => void;
|
|
8
|
+
};
|
|
9
|
+
declare const CollectionFieldGuess: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
10
|
+
type CollectionFieldGuess = ReturnType<typeof CollectionFieldGuess>;
|
|
11
|
+
export default CollectionFieldGuess;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { IDbCollections } from '../db/dbFields';
|
|
3
|
+
import { schemeModel, idbqlState } from '../db/dbSchema';
|
|
4
|
+
import type { TplCollectionName, Where } from '@medyll/idae-idbql';
|
|
5
|
+
import { Looper } from '@medyll/idae-slotui-svelte';
|
|
6
|
+
|
|
7
|
+
type CollectionFksProps = {
|
|
8
|
+
collection: TplCollectionName;
|
|
9
|
+
collectionId?: any;
|
|
10
|
+
where?: Where;
|
|
11
|
+
};
|
|
12
|
+
let { collection }: CollectionFksProps = $props();
|
|
13
|
+
|
|
14
|
+
// idbqlState[fkCollection].get(fkId);
|
|
15
|
+
|
|
16
|
+
const dbFields = new IDbCollections(schemeModel);
|
|
17
|
+
const fks = $derived(dbFields.fks(collection));
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<Looper data={Object.entries(fks)}>
|
|
21
|
+
{#snippet children({ item })}
|
|
22
|
+
<div>{item[0]}</div>
|
|
23
|
+
{/snippet}
|
|
24
|
+
</Looper>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TplCollectionName, Where } from '@medyll/idae-idbql';
|
|
2
|
+
type CollectionFksProps = {
|
|
3
|
+
collection: TplCollectionName;
|
|
4
|
+
collectionId?: any;
|
|
5
|
+
where?: Where;
|
|
6
|
+
};
|
|
7
|
+
declare const CollectionFks: import("svelte").Component<CollectionFksProps, {}, "">;
|
|
8
|
+
type CollectionFks = ReturnType<typeof CollectionFks>;
|
|
9
|
+
export default CollectionFks;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<script lang="ts" generics="COL = Record<string,any>">
|
|
2
|
+
import {
|
|
3
|
+
type MenuListProps,
|
|
4
|
+
Button,
|
|
5
|
+
MenuList,
|
|
6
|
+
MenuListItem,
|
|
7
|
+
openWindow,
|
|
8
|
+
type Props,
|
|
9
|
+
Looper
|
|
10
|
+
} from '@medyll/idae-slotui-svelte';
|
|
11
|
+
import CreateUpdate from '$components/form/CreateUpdate.svelte';
|
|
12
|
+
import { idbqlState } from '../db/dbSchema';
|
|
13
|
+
import { IDbCollections, IDbCollectionValues } from '../db/dbFields';
|
|
14
|
+
import { hydrate, type Snippet } from 'svelte';
|
|
15
|
+
import type { Where } from '@medyll/idae-idbql';
|
|
16
|
+
|
|
17
|
+
interface DataListProps {
|
|
18
|
+
collection: string;
|
|
19
|
+
target?: string; // html target
|
|
20
|
+
data?: COL;
|
|
21
|
+
menuListProps?: MenuListProps;
|
|
22
|
+
style?: string;
|
|
23
|
+
displayMode?: 'line' | 'grid';
|
|
24
|
+
where?: Where<COL>;
|
|
25
|
+
children?: Snippet;
|
|
26
|
+
onclick?: (data: COL, index: number | string) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let {
|
|
30
|
+
collection,
|
|
31
|
+
target,
|
|
32
|
+
data,
|
|
33
|
+
menuListProps,
|
|
34
|
+
onclick,
|
|
35
|
+
style,
|
|
36
|
+
where,
|
|
37
|
+
children: _children,
|
|
38
|
+
displayMode
|
|
39
|
+
}: DataListProps = $props();
|
|
40
|
+
|
|
41
|
+
let test = new IDbCollections();
|
|
42
|
+
let fieldValues = new IDbCollectionValues(collection);
|
|
43
|
+
let index = test.getIndexName(collection);
|
|
44
|
+
|
|
45
|
+
let qy = $derived(where ? idbqlState[collection].where(where) : idbqlState[collection].getAll());
|
|
46
|
+
|
|
47
|
+
function load(event: CustomEvent, indexV: number | string) {
|
|
48
|
+
openCrud(event[index]);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function openCrud(id: any) {
|
|
52
|
+
// mount on target, returns component
|
|
53
|
+
let mounted = hydrate(CreateUpdate, {
|
|
54
|
+
target: document.querySelector(`[data-target-zone="${target}"]`),
|
|
55
|
+
props: { collection: collection, dataId: id, mode: 'show' }
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
return mounted;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const _onclick = (data: COL, index: number | string) => {
|
|
62
|
+
console.log('onclick', data, index);
|
|
63
|
+
|
|
64
|
+
if (onclick) {
|
|
65
|
+
onclick(data, index);
|
|
66
|
+
} else {
|
|
67
|
+
load(data, index);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<div class="grid grid-cols-3 gap-3 p-3">
|
|
73
|
+
<Looper data={qy}>
|
|
74
|
+
{#snippet loopTitle()}
|
|
75
|
+
{@render _children?.()}
|
|
76
|
+
{/snippet}
|
|
77
|
+
{#snippet children({ item })}
|
|
78
|
+
<div class="flex aspect-square flex-col rounded-2xl border border-gray-300 p-2">
|
|
79
|
+
<div class="flex-1">edit</div>
|
|
80
|
+
<a
|
|
81
|
+
href="/collections/{fieldValues.indexValue(item)}"
|
|
82
|
+
onclick={(event) => {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
_onclick?.(item, index);
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
<div class="py-3">{fieldValues.presentation(item)}</div>
|
|
88
|
+
<div class="py-3">date {fieldValues.display('created_at', item)}</div>
|
|
89
|
+
</a>
|
|
90
|
+
</div>
|
|
91
|
+
{/snippet}
|
|
92
|
+
</Looper>
|
|
93
|
+
</div>
|