@almadar/std 1.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/LICENSE +72 -0
- package/dist/behaviors/action-affinity.d.ts +88 -0
- package/dist/behaviors/action-affinity.js +290 -0
- package/dist/behaviors/action-affinity.js.map +1 -0
- package/dist/behaviors/async.d.ts +20 -0
- package/dist/behaviors/async.js +542 -0
- package/dist/behaviors/async.js.map +1 -0
- package/dist/behaviors/data-management.d.ts +40 -0
- package/dist/behaviors/data-management.js +495 -0
- package/dist/behaviors/data-management.js.map +1 -0
- package/dist/behaviors/feedback.d.ts +18 -0
- package/dist/behaviors/feedback.js +307 -0
- package/dist/behaviors/feedback.js.map +1 -0
- package/dist/behaviors/game-core.d.ts +40 -0
- package/dist/behaviors/game-core.js +443 -0
- package/dist/behaviors/game-core.js.map +1 -0
- package/dist/behaviors/game-entity.d.ts +39 -0
- package/dist/behaviors/game-entity.js +643 -0
- package/dist/behaviors/game-entity.js.map +1 -0
- package/dist/behaviors/game-ui.d.ts +29 -0
- package/dist/behaviors/game-ui.js +493 -0
- package/dist/behaviors/game-ui.js.map +1 -0
- package/dist/behaviors/index.d.ts +11 -0
- package/dist/behaviors/index.js +4539 -0
- package/dist/behaviors/index.js.map +1 -0
- package/dist/behaviors/registry.d.ts +103 -0
- package/dist/behaviors/registry.js +4166 -0
- package/dist/behaviors/registry.js.map +1 -0
- package/dist/behaviors/types.d.ts +179 -0
- package/dist/behaviors/types.js +111 -0
- package/dist/behaviors/types.js.map +1 -0
- package/dist/behaviors/ui-interaction.d.ts +36 -0
- package/dist/behaviors/ui-interaction.js +1104 -0
- package/dist/behaviors/ui-interaction.js.map +1 -0
- package/dist/index.d.ts +195 -0
- package/dist/index.js +8209 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/array.d.ts +28 -0
- package/dist/modules/array.js +556 -0
- package/dist/modules/array.js.map +1 -0
- package/dist/modules/async.d.ts +22 -0
- package/dist/modules/async.js +112 -0
- package/dist/modules/async.js.map +1 -0
- package/dist/modules/format.d.ts +21 -0
- package/dist/modules/format.js +129 -0
- package/dist/modules/format.js.map +1 -0
- package/dist/modules/index.d.ts +12 -0
- package/dist/modules/index.js +3131 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/math.d.ts +22 -0
- package/dist/modules/math.js +215 -0
- package/dist/modules/math.js.map +1 -0
- package/dist/modules/nn.d.ts +23 -0
- package/dist/modules/nn.js +189 -0
- package/dist/modules/nn.js.map +1 -0
- package/dist/modules/object.d.ts +22 -0
- package/dist/modules/object.js +257 -0
- package/dist/modules/object.js.map +1 -0
- package/dist/modules/str.d.ts +21 -0
- package/dist/modules/str.js +344 -0
- package/dist/modules/str.js.map +1 -0
- package/dist/modules/tensor.d.ts +23 -0
- package/dist/modules/tensor.js +427 -0
- package/dist/modules/tensor.js.map +1 -0
- package/dist/modules/time.d.ts +24 -0
- package/dist/modules/time.js +323 -0
- package/dist/modules/time.js.map +1 -0
- package/dist/modules/train.d.ts +23 -0
- package/dist/modules/train.js +308 -0
- package/dist/modules/train.js.map +1 -0
- package/dist/modules/validate.d.ts +23 -0
- package/dist/modules/validate.js +301 -0
- package/dist/modules/validate.js.map +1 -0
- package/dist/registry.d.ts +140 -0
- package/dist/registry.js +3240 -0
- package/dist/registry.js.map +1 -0
- package/dist/types-I95R8_FN.d.ts +91 -0
- package/package.json +59 -0
|
@@ -0,0 +1,1104 @@
|
|
|
1
|
+
// behaviors/ui-interaction.ts
|
|
2
|
+
var LIST_BEHAVIOR = {
|
|
3
|
+
name: "std/List",
|
|
4
|
+
category: "ui-interaction",
|
|
5
|
+
description: "Entity list management with CRUD operations",
|
|
6
|
+
suggestedFor: [
|
|
7
|
+
"Entity listing pages",
|
|
8
|
+
"Admin panels",
|
|
9
|
+
"Data management screens",
|
|
10
|
+
"Table views with inline actions"
|
|
11
|
+
],
|
|
12
|
+
dataEntities: [
|
|
13
|
+
{
|
|
14
|
+
name: "ListState",
|
|
15
|
+
runtime: true,
|
|
16
|
+
singleton: true,
|
|
17
|
+
fields: [
|
|
18
|
+
{ name: "selectedId", type: "string", default: null }
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
stateMachine: {
|
|
23
|
+
initial: "Browsing",
|
|
24
|
+
states: [
|
|
25
|
+
{ name: "Browsing", isInitial: true },
|
|
26
|
+
{ name: "Creating" },
|
|
27
|
+
{ name: "Viewing" },
|
|
28
|
+
{ name: "Editing" },
|
|
29
|
+
{ name: "Deleting" }
|
|
30
|
+
],
|
|
31
|
+
events: [
|
|
32
|
+
{ key: "INIT" },
|
|
33
|
+
{ key: "CREATE" },
|
|
34
|
+
{ key: "VIEW" },
|
|
35
|
+
{ key: "EDIT" },
|
|
36
|
+
{ key: "DELETE" },
|
|
37
|
+
{ key: "CONFIRM_DELETE" },
|
|
38
|
+
{ key: "CANCEL" },
|
|
39
|
+
{ key: "SAVE" }
|
|
40
|
+
],
|
|
41
|
+
transitions: [
|
|
42
|
+
// INIT: Self-loop on Browsing that renders the list UI
|
|
43
|
+
{
|
|
44
|
+
from: "Browsing",
|
|
45
|
+
to: "Browsing",
|
|
46
|
+
event: "INIT",
|
|
47
|
+
effects: [
|
|
48
|
+
["render-ui", "main", {
|
|
49
|
+
type: "page-header",
|
|
50
|
+
title: "@config.title",
|
|
51
|
+
actions: [{ label: "Create", event: "CREATE", variant: "primary" }]
|
|
52
|
+
}],
|
|
53
|
+
["render-ui", "main", {
|
|
54
|
+
type: "entity-table",
|
|
55
|
+
entity: "@config.entity",
|
|
56
|
+
columns: "@config.columns",
|
|
57
|
+
itemActions: [
|
|
58
|
+
{ label: "View", event: "VIEW", placement: "row" },
|
|
59
|
+
{ label: "Edit", event: "EDIT", placement: "row" },
|
|
60
|
+
{ label: "Delete", event: "DELETE", variant: "danger", placement: "row" }
|
|
61
|
+
]
|
|
62
|
+
}]
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
from: "Browsing",
|
|
67
|
+
to: "Creating",
|
|
68
|
+
event: "CREATE",
|
|
69
|
+
effects: [
|
|
70
|
+
["render-ui", "modal", {
|
|
71
|
+
type: "form-section",
|
|
72
|
+
entity: "@config.entity",
|
|
73
|
+
mode: "create",
|
|
74
|
+
submitEvent: "SAVE",
|
|
75
|
+
cancelEvent: "CANCEL"
|
|
76
|
+
}]
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
from: "Browsing",
|
|
81
|
+
to: "Viewing",
|
|
82
|
+
event: "VIEW",
|
|
83
|
+
effects: [
|
|
84
|
+
["set", "@entity.selectedId", "@payload.id"],
|
|
85
|
+
["render-ui", "drawer", {
|
|
86
|
+
type: "entity-detail",
|
|
87
|
+
entity: "@config.entity",
|
|
88
|
+
id: "@payload.id",
|
|
89
|
+
actions: [
|
|
90
|
+
{ label: "Edit", event: "EDIT" },
|
|
91
|
+
{ label: "Close", event: "CANCEL" }
|
|
92
|
+
]
|
|
93
|
+
}]
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
from: "Browsing",
|
|
98
|
+
to: "Editing",
|
|
99
|
+
event: "EDIT",
|
|
100
|
+
effects: [
|
|
101
|
+
["set", "@entity.selectedId", "@payload.id"],
|
|
102
|
+
["render-ui", "drawer", {
|
|
103
|
+
type: "form-section",
|
|
104
|
+
entity: "@config.entity",
|
|
105
|
+
id: "@payload.id",
|
|
106
|
+
mode: "edit",
|
|
107
|
+
submitEvent: "SAVE",
|
|
108
|
+
cancelEvent: "CANCEL"
|
|
109
|
+
}]
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
from: "Viewing",
|
|
114
|
+
to: "Editing",
|
|
115
|
+
event: "EDIT",
|
|
116
|
+
effects: [
|
|
117
|
+
["render-ui", "drawer", {
|
|
118
|
+
type: "form-section",
|
|
119
|
+
entity: "@config.entity",
|
|
120
|
+
id: "@entity.selectedId",
|
|
121
|
+
mode: "edit",
|
|
122
|
+
submitEvent: "SAVE",
|
|
123
|
+
cancelEvent: "CANCEL"
|
|
124
|
+
}]
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
from: "Browsing",
|
|
129
|
+
to: "Deleting",
|
|
130
|
+
event: "DELETE",
|
|
131
|
+
effects: [
|
|
132
|
+
["set", "@entity.selectedId", "@payload.id"],
|
|
133
|
+
["render-ui", "modal", {
|
|
134
|
+
type: "confirmation",
|
|
135
|
+
title: "Delete Confirmation",
|
|
136
|
+
message: "Are you sure you want to delete this item?",
|
|
137
|
+
confirmLabel: "Delete",
|
|
138
|
+
confirmVariant: "danger"
|
|
139
|
+
}]
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
from: "Creating",
|
|
144
|
+
to: "Browsing",
|
|
145
|
+
event: "SAVE",
|
|
146
|
+
effects: [
|
|
147
|
+
["persist", "create", "@config.entity", "@payload.data"],
|
|
148
|
+
["render-ui", "modal", null],
|
|
149
|
+
["notify", { type: "success", message: "Created successfully" }],
|
|
150
|
+
["emit", "INIT"]
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
from: "Editing",
|
|
155
|
+
to: "Browsing",
|
|
156
|
+
event: "SAVE",
|
|
157
|
+
effects: [
|
|
158
|
+
["persist", "update", "@config.entity", "@payload.data"],
|
|
159
|
+
["render-ui", "drawer", null],
|
|
160
|
+
["notify", { type: "success", message: "Updated successfully" }],
|
|
161
|
+
["emit", "INIT"]
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
from: "Deleting",
|
|
166
|
+
to: "Browsing",
|
|
167
|
+
event: "CONFIRM_DELETE",
|
|
168
|
+
effects: [
|
|
169
|
+
["persist", "delete", "@config.entity", "@entity.selectedId"],
|
|
170
|
+
["render-ui", "modal", null],
|
|
171
|
+
["notify", { type: "success", message: "Deleted successfully" }],
|
|
172
|
+
["emit", "INIT"]
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
from: "Creating",
|
|
177
|
+
to: "Browsing",
|
|
178
|
+
event: "CANCEL",
|
|
179
|
+
effects: [
|
|
180
|
+
["render-ui", "modal", null]
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
from: "Viewing",
|
|
185
|
+
to: "Browsing",
|
|
186
|
+
event: "CANCEL",
|
|
187
|
+
effects: [
|
|
188
|
+
["render-ui", "drawer", null]
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
from: "Editing",
|
|
193
|
+
to: "Browsing",
|
|
194
|
+
event: "CANCEL",
|
|
195
|
+
effects: [
|
|
196
|
+
["render-ui", "drawer", null]
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
from: "Deleting",
|
|
201
|
+
to: "Browsing",
|
|
202
|
+
event: "CANCEL",
|
|
203
|
+
effects: [
|
|
204
|
+
["render-ui", "modal", null]
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
},
|
|
209
|
+
configSchema: {
|
|
210
|
+
required: [
|
|
211
|
+
{ name: "entity", type: "entity", description: "Entity type to list" },
|
|
212
|
+
{ name: "columns", type: "array", description: "Fields to display as columns" }
|
|
213
|
+
],
|
|
214
|
+
optional: [
|
|
215
|
+
{ name: "title", type: "string", description: "Page title", default: "" },
|
|
216
|
+
{ name: "display", type: "string", description: "Display mode", default: "table", enum: ["table", "cards", "list"] },
|
|
217
|
+
{ name: "actions", type: "action[]", description: "Available actions", default: ["view", "edit", "delete"] },
|
|
218
|
+
{ name: "createInModal", type: "boolean", description: "Show create form in modal", default: true },
|
|
219
|
+
{ name: "editInDrawer", type: "boolean", description: "Show edit form in drawer", default: true }
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
var DETAIL_BEHAVIOR = {
|
|
224
|
+
name: "std/Detail",
|
|
225
|
+
category: "ui-interaction",
|
|
226
|
+
description: "Single entity view with edit/delete capabilities",
|
|
227
|
+
suggestedFor: [
|
|
228
|
+
"Entity detail pages",
|
|
229
|
+
"Profile views",
|
|
230
|
+
"Settings pages",
|
|
231
|
+
"Single record screens"
|
|
232
|
+
],
|
|
233
|
+
dataEntities: [
|
|
234
|
+
{
|
|
235
|
+
name: "DetailState",
|
|
236
|
+
runtime: true,
|
|
237
|
+
fields: [
|
|
238
|
+
{ name: "entityId", type: "string", default: null },
|
|
239
|
+
{ name: "isLoading", type: "boolean", default: false },
|
|
240
|
+
{ name: "hasChanges", type: "boolean", default: false }
|
|
241
|
+
]
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
stateMachine: {
|
|
245
|
+
initial: "Viewing",
|
|
246
|
+
states: [
|
|
247
|
+
{ name: "Viewing", isInitial: true },
|
|
248
|
+
{ name: "Editing" },
|
|
249
|
+
{ name: "Deleting" }
|
|
250
|
+
],
|
|
251
|
+
events: [
|
|
252
|
+
{ key: "INIT" },
|
|
253
|
+
{ key: "EDIT" },
|
|
254
|
+
{ key: "SAVE" },
|
|
255
|
+
{ key: "CANCEL" },
|
|
256
|
+
{ key: "DELETE" },
|
|
257
|
+
{ key: "CONFIRM_DELETE" }
|
|
258
|
+
],
|
|
259
|
+
transitions: [
|
|
260
|
+
// INIT: Self-loop on Viewing
|
|
261
|
+
{
|
|
262
|
+
from: "Viewing",
|
|
263
|
+
to: "Viewing",
|
|
264
|
+
event: "INIT",
|
|
265
|
+
effects: [
|
|
266
|
+
["render-ui", "main", {
|
|
267
|
+
type: "page-header",
|
|
268
|
+
title: "@entity.name",
|
|
269
|
+
actions: [
|
|
270
|
+
{ label: "Edit", event: "EDIT" },
|
|
271
|
+
{ label: "Delete", event: "DELETE", variant: "danger" }
|
|
272
|
+
]
|
|
273
|
+
}],
|
|
274
|
+
["render-ui", "main", {
|
|
275
|
+
type: "entity-detail",
|
|
276
|
+
entity: "@config.entity",
|
|
277
|
+
fieldNames: "@config.fields"
|
|
278
|
+
}]
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
from: "Viewing",
|
|
283
|
+
to: "Editing",
|
|
284
|
+
event: "EDIT",
|
|
285
|
+
effects: [
|
|
286
|
+
["render-ui", "main", {
|
|
287
|
+
type: "form-section",
|
|
288
|
+
entity: "@config.entity",
|
|
289
|
+
mode: "edit",
|
|
290
|
+
fields: "@config.fields",
|
|
291
|
+
submitEvent: "SAVE",
|
|
292
|
+
cancelEvent: "CANCEL"
|
|
293
|
+
}]
|
|
294
|
+
]
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
from: "Editing",
|
|
298
|
+
to: "Viewing",
|
|
299
|
+
event: "SAVE",
|
|
300
|
+
effects: [
|
|
301
|
+
["persist", "update", "@config.entity", "@payload.data"],
|
|
302
|
+
["notify", { type: "success", message: "Updated successfully" }],
|
|
303
|
+
["emit", "INIT"]
|
|
304
|
+
]
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
from: "Editing",
|
|
308
|
+
to: "Viewing",
|
|
309
|
+
event: "CANCEL",
|
|
310
|
+
effects: [
|
|
311
|
+
["emit", "INIT"]
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
from: "Viewing",
|
|
316
|
+
to: "Deleting",
|
|
317
|
+
event: "DELETE",
|
|
318
|
+
effects: [
|
|
319
|
+
["render-ui", "modal", {
|
|
320
|
+
type: "confirmation",
|
|
321
|
+
title: "Delete Confirmation",
|
|
322
|
+
message: "Are you sure you want to delete this item?"
|
|
323
|
+
}]
|
|
324
|
+
]
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
from: "Deleting",
|
|
328
|
+
to: "Viewing",
|
|
329
|
+
event: "CONFIRM_DELETE",
|
|
330
|
+
effects: [
|
|
331
|
+
["persist", "delete", "@config.entity", "@entity.id"],
|
|
332
|
+
["navigate", "@config.returnUrl"]
|
|
333
|
+
]
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
from: "Deleting",
|
|
337
|
+
to: "Viewing",
|
|
338
|
+
event: "CANCEL",
|
|
339
|
+
effects: [
|
|
340
|
+
["render-ui", "modal", null]
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
},
|
|
345
|
+
configSchema: {
|
|
346
|
+
required: [
|
|
347
|
+
{ name: "entity", type: "entity", description: "Entity type" },
|
|
348
|
+
{ name: "fields", type: "array", description: "Fields to display" }
|
|
349
|
+
],
|
|
350
|
+
optional: [
|
|
351
|
+
{ name: "layout", type: "string", description: "Layout mode", default: "two-column", enum: ["single-column", "two-column", "grid"] },
|
|
352
|
+
{ name: "allowEdit", type: "boolean", description: "Allow editing", default: true },
|
|
353
|
+
{ name: "allowDelete", type: "boolean", description: "Allow deletion", default: true }
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
var FORM_BEHAVIOR = {
|
|
358
|
+
name: "std/Form",
|
|
359
|
+
category: "ui-interaction",
|
|
360
|
+
description: "Form state management with validation and submission",
|
|
361
|
+
suggestedFor: [
|
|
362
|
+
"Create/edit forms",
|
|
363
|
+
"Settings forms",
|
|
364
|
+
"Multi-field input",
|
|
365
|
+
"Validated data entry"
|
|
366
|
+
],
|
|
367
|
+
dataEntities: [
|
|
368
|
+
{
|
|
369
|
+
name: "FormState",
|
|
370
|
+
runtime: true,
|
|
371
|
+
fields: [
|
|
372
|
+
{ name: "values", type: "object", default: {} },
|
|
373
|
+
{ name: "errors", type: "object", default: {} },
|
|
374
|
+
{ name: "touched", type: "object", default: {} },
|
|
375
|
+
{ name: "isDirty", type: "boolean", default: false },
|
|
376
|
+
{ name: "isSubmitting", type: "boolean", default: false }
|
|
377
|
+
]
|
|
378
|
+
}
|
|
379
|
+
],
|
|
380
|
+
stateMachine: {
|
|
381
|
+
initial: "Idle",
|
|
382
|
+
states: [
|
|
383
|
+
{ name: "Idle", isInitial: true },
|
|
384
|
+
{ name: "Editing" },
|
|
385
|
+
{ name: "Validating" },
|
|
386
|
+
{ name: "Submitting" },
|
|
387
|
+
{ name: "Success" },
|
|
388
|
+
{ name: "Error" }
|
|
389
|
+
],
|
|
390
|
+
events: [
|
|
391
|
+
{ key: "INIT" },
|
|
392
|
+
{ key: "FIELD_CHANGE" },
|
|
393
|
+
{ key: "FIELD_BLUR" },
|
|
394
|
+
{ key: "SUBMIT" },
|
|
395
|
+
{ key: "VALIDATION_PASSED" },
|
|
396
|
+
{ key: "VALIDATION_FAILED" },
|
|
397
|
+
{ key: "SUBMIT_SUCCESS" },
|
|
398
|
+
{ key: "SUBMIT_ERROR" },
|
|
399
|
+
{ key: "RESET" }
|
|
400
|
+
],
|
|
401
|
+
transitions: [
|
|
402
|
+
// INIT: Self-loop on Idle → Editing
|
|
403
|
+
{
|
|
404
|
+
from: "Idle",
|
|
405
|
+
to: "Editing",
|
|
406
|
+
event: "INIT",
|
|
407
|
+
effects: [
|
|
408
|
+
["render-ui", "main", {
|
|
409
|
+
type: "form-section",
|
|
410
|
+
entity: "@config.entity",
|
|
411
|
+
fields: "@config.fields",
|
|
412
|
+
values: "@entity.values",
|
|
413
|
+
errors: "@entity.errors",
|
|
414
|
+
submitEvent: "SUBMIT",
|
|
415
|
+
cancelEvent: "@config.cancelEvent"
|
|
416
|
+
}]
|
|
417
|
+
]
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
from: "Editing",
|
|
421
|
+
to: "Editing",
|
|
422
|
+
event: "FIELD_CHANGE",
|
|
423
|
+
effects: [
|
|
424
|
+
["set", "@entity.values", ["object/set", "@entity.values", "@payload.field", "@payload.value"]],
|
|
425
|
+
["set", "@entity.isDirty", true]
|
|
426
|
+
]
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
from: "Editing",
|
|
430
|
+
to: "Editing",
|
|
431
|
+
event: "FIELD_BLUR",
|
|
432
|
+
effects: [
|
|
433
|
+
["set", "@entity.touched", ["object/set", "@entity.touched", "@payload.field", true]]
|
|
434
|
+
]
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
from: "Editing",
|
|
438
|
+
to: "Validating",
|
|
439
|
+
event: "SUBMIT",
|
|
440
|
+
effects: [
|
|
441
|
+
[
|
|
442
|
+
"let",
|
|
443
|
+
[["result", ["validate/check", "@entity.values", "@config.validation"]]],
|
|
444
|
+
[
|
|
445
|
+
"if",
|
|
446
|
+
"@result.valid",
|
|
447
|
+
["emit", "VALIDATION_PASSED"],
|
|
448
|
+
[
|
|
449
|
+
"do",
|
|
450
|
+
["set", "@entity.errors", "@result.errors"],
|
|
451
|
+
["emit", "VALIDATION_FAILED"]
|
|
452
|
+
]
|
|
453
|
+
]
|
|
454
|
+
]
|
|
455
|
+
]
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
from: "Validating",
|
|
459
|
+
to: "Submitting",
|
|
460
|
+
event: "VALIDATION_PASSED",
|
|
461
|
+
effects: [
|
|
462
|
+
["set", "@entity.isSubmitting", true],
|
|
463
|
+
[
|
|
464
|
+
"if",
|
|
465
|
+
["=", "@config.mode", "create"],
|
|
466
|
+
["persist", "create", "@config.entity", "@entity.values"],
|
|
467
|
+
["persist", "update", "@config.entity", "@entity.values"]
|
|
468
|
+
]
|
|
469
|
+
]
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
from: "Validating",
|
|
473
|
+
to: "Editing",
|
|
474
|
+
event: "VALIDATION_FAILED",
|
|
475
|
+
effects: [
|
|
476
|
+
["notify", { type: "error", message: "Please fix the validation errors" }]
|
|
477
|
+
]
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
from: "Submitting",
|
|
481
|
+
to: "Success",
|
|
482
|
+
event: "SUBMIT_SUCCESS",
|
|
483
|
+
effects: [
|
|
484
|
+
["set", "@entity.isSubmitting", false],
|
|
485
|
+
["notify", { type: "success", message: "Saved successfully" }],
|
|
486
|
+
["emit", "@config.submitEvent", { data: "@entity.values" }]
|
|
487
|
+
]
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
from: "Submitting",
|
|
491
|
+
to: "Error",
|
|
492
|
+
event: "SUBMIT_ERROR",
|
|
493
|
+
effects: [
|
|
494
|
+
["set", "@entity.isSubmitting", false],
|
|
495
|
+
["set", "@entity.errors", { _form: "@payload.error" }],
|
|
496
|
+
["notify", { type: "error", message: "@payload.error" }]
|
|
497
|
+
]
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
from: "Editing",
|
|
501
|
+
to: "Idle",
|
|
502
|
+
event: "RESET",
|
|
503
|
+
effects: [
|
|
504
|
+
["set", "@entity.values", {}],
|
|
505
|
+
["set", "@entity.errors", {}],
|
|
506
|
+
["set", "@entity.touched", {}],
|
|
507
|
+
["set", "@entity.isDirty", false]
|
|
508
|
+
]
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
from: "Error",
|
|
512
|
+
to: "Idle",
|
|
513
|
+
event: "RESET",
|
|
514
|
+
effects: [
|
|
515
|
+
["set", "@entity.values", {}],
|
|
516
|
+
["set", "@entity.errors", {}],
|
|
517
|
+
["set", "@entity.touched", {}],
|
|
518
|
+
["set", "@entity.isDirty", false]
|
|
519
|
+
]
|
|
520
|
+
}
|
|
521
|
+
]
|
|
522
|
+
},
|
|
523
|
+
configSchema: {
|
|
524
|
+
required: [
|
|
525
|
+
{ name: "entity", type: "entity", description: "Entity type" },
|
|
526
|
+
{ name: "fields", type: "array", description: "Form fields" }
|
|
527
|
+
],
|
|
528
|
+
optional: [
|
|
529
|
+
{ name: "mode", type: "string", description: "Form mode", default: "create", enum: ["create", "edit"] },
|
|
530
|
+
{ name: "validation", type: "object", description: "Validation rules", default: {} },
|
|
531
|
+
{ name: "submitEvent", type: "event", description: "Event to emit on successful submit", default: "SAVE" },
|
|
532
|
+
{ name: "cancelEvent", type: "event", description: "Event to emit on cancel", default: "CANCEL" }
|
|
533
|
+
]
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
var MODAL_BEHAVIOR = {
|
|
537
|
+
name: "std/Modal",
|
|
538
|
+
category: "ui-interaction",
|
|
539
|
+
description: "Modal dialog with open/close state management",
|
|
540
|
+
suggestedFor: [
|
|
541
|
+
"Confirmation dialogs",
|
|
542
|
+
"Create forms",
|
|
543
|
+
"Detail views",
|
|
544
|
+
"Any overlay content"
|
|
545
|
+
],
|
|
546
|
+
dataEntities: [
|
|
547
|
+
{
|
|
548
|
+
name: "ModalState",
|
|
549
|
+
runtime: true,
|
|
550
|
+
fields: [
|
|
551
|
+
{ name: "content", type: "object", default: null }
|
|
552
|
+
]
|
|
553
|
+
}
|
|
554
|
+
],
|
|
555
|
+
stateMachine: {
|
|
556
|
+
initial: "Closed",
|
|
557
|
+
states: [
|
|
558
|
+
{ name: "Closed", isInitial: true },
|
|
559
|
+
{ name: "Open" }
|
|
560
|
+
],
|
|
561
|
+
events: [
|
|
562
|
+
{ key: "OPEN" },
|
|
563
|
+
{ key: "CLOSE" },
|
|
564
|
+
{ key: "CONFIRM" }
|
|
565
|
+
],
|
|
566
|
+
transitions: [
|
|
567
|
+
{
|
|
568
|
+
from: "Closed",
|
|
569
|
+
to: "Open",
|
|
570
|
+
event: "OPEN",
|
|
571
|
+
effects: [
|
|
572
|
+
["set", "@entity.content", "@payload.content"],
|
|
573
|
+
["render-ui", "modal", {
|
|
574
|
+
type: "@payload.type",
|
|
575
|
+
onClose: "CLOSE"
|
|
576
|
+
}]
|
|
577
|
+
]
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
from: "Open",
|
|
581
|
+
to: "Closed",
|
|
582
|
+
event: "CLOSE",
|
|
583
|
+
effects: [
|
|
584
|
+
["render-ui", "modal", null]
|
|
585
|
+
]
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
from: "Open",
|
|
589
|
+
to: "Closed",
|
|
590
|
+
event: "CONFIRM",
|
|
591
|
+
effects: [
|
|
592
|
+
["render-ui", "modal", null]
|
|
593
|
+
]
|
|
594
|
+
}
|
|
595
|
+
]
|
|
596
|
+
},
|
|
597
|
+
configSchema: {
|
|
598
|
+
required: [],
|
|
599
|
+
optional: [
|
|
600
|
+
{ name: "size", type: "string", description: "Modal size", default: "md", enum: ["sm", "md", "lg", "xl", "full"] },
|
|
601
|
+
{ name: "closeOnOverlay", type: "boolean", description: "Close on overlay click", default: true },
|
|
602
|
+
{ name: "closeOnEscape", type: "boolean", description: "Close on escape key", default: true }
|
|
603
|
+
]
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
var DRAWER_BEHAVIOR = {
|
|
607
|
+
name: "std/Drawer",
|
|
608
|
+
category: "ui-interaction",
|
|
609
|
+
description: "Side drawer panel for detail views and forms",
|
|
610
|
+
suggestedFor: [
|
|
611
|
+
"Detail panels",
|
|
612
|
+
"Edit forms",
|
|
613
|
+
"Property panels",
|
|
614
|
+
"Side navigation"
|
|
615
|
+
],
|
|
616
|
+
dataEntities: [
|
|
617
|
+
{
|
|
618
|
+
name: "DrawerState",
|
|
619
|
+
runtime: true,
|
|
620
|
+
fields: [
|
|
621
|
+
{ name: "content", type: "object", default: null }
|
|
622
|
+
]
|
|
623
|
+
}
|
|
624
|
+
],
|
|
625
|
+
stateMachine: {
|
|
626
|
+
initial: "Closed",
|
|
627
|
+
states: [
|
|
628
|
+
{ name: "Closed", isInitial: true },
|
|
629
|
+
{ name: "Open" }
|
|
630
|
+
],
|
|
631
|
+
events: [
|
|
632
|
+
{ key: "OPEN" },
|
|
633
|
+
{ key: "CLOSE" }
|
|
634
|
+
],
|
|
635
|
+
transitions: [
|
|
636
|
+
{
|
|
637
|
+
from: "Closed",
|
|
638
|
+
to: "Open",
|
|
639
|
+
event: "OPEN",
|
|
640
|
+
effects: [
|
|
641
|
+
["set", "@entity.content", "@payload.content"],
|
|
642
|
+
["render-ui", "drawer", {
|
|
643
|
+
type: "@payload.type",
|
|
644
|
+
onClose: "CLOSE"
|
|
645
|
+
}]
|
|
646
|
+
]
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
from: "Open",
|
|
650
|
+
to: "Closed",
|
|
651
|
+
event: "CLOSE",
|
|
652
|
+
effects: [
|
|
653
|
+
["render-ui", "drawer", null]
|
|
654
|
+
]
|
|
655
|
+
}
|
|
656
|
+
]
|
|
657
|
+
},
|
|
658
|
+
configSchema: {
|
|
659
|
+
required: [],
|
|
660
|
+
optional: [
|
|
661
|
+
{ name: "position", type: "string", description: "Drawer position", default: "right", enum: ["left", "right"] },
|
|
662
|
+
{ name: "size", type: "string", description: "Drawer size", default: "md", enum: ["sm", "md", "lg"] },
|
|
663
|
+
{ name: "overlay", type: "boolean", description: "Show overlay", default: true }
|
|
664
|
+
]
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
var TABS_BEHAVIOR = {
|
|
668
|
+
name: "std/Tabs",
|
|
669
|
+
category: "ui-interaction",
|
|
670
|
+
description: "Tabbed navigation within a page",
|
|
671
|
+
suggestedFor: [
|
|
672
|
+
"Multi-view pages",
|
|
673
|
+
"Settings with sections",
|
|
674
|
+
"Dashboard tabs",
|
|
675
|
+
"Profile sections"
|
|
676
|
+
],
|
|
677
|
+
dataEntities: [
|
|
678
|
+
{
|
|
679
|
+
name: "TabsState",
|
|
680
|
+
runtime: true,
|
|
681
|
+
singleton: true,
|
|
682
|
+
fields: [
|
|
683
|
+
{ name: "activeTab", type: "string", default: null }
|
|
684
|
+
]
|
|
685
|
+
}
|
|
686
|
+
],
|
|
687
|
+
stateMachine: {
|
|
688
|
+
initial: "Active",
|
|
689
|
+
states: [
|
|
690
|
+
{ name: "Active", isInitial: true }
|
|
691
|
+
],
|
|
692
|
+
events: [
|
|
693
|
+
{ key: "INIT" },
|
|
694
|
+
{ key: "SELECT_TAB" }
|
|
695
|
+
],
|
|
696
|
+
transitions: [
|
|
697
|
+
// INIT: Self-loop on Active
|
|
698
|
+
{
|
|
699
|
+
from: "Active",
|
|
700
|
+
to: "Active",
|
|
701
|
+
event: "INIT",
|
|
702
|
+
effects: [
|
|
703
|
+
["set", "@entity.activeTab", "@config.defaultTab"],
|
|
704
|
+
["render-ui", "main", {
|
|
705
|
+
type: "filter-group",
|
|
706
|
+
filterType: "tabs",
|
|
707
|
+
tabs: "@config.tabs",
|
|
708
|
+
active: "@entity.activeTab",
|
|
709
|
+
onSelect: "SELECT_TAB"
|
|
710
|
+
}]
|
|
711
|
+
]
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
from: "Active",
|
|
715
|
+
to: "Active",
|
|
716
|
+
event: "SELECT_TAB",
|
|
717
|
+
effects: [
|
|
718
|
+
["set", "@entity.activeTab", "@payload.tabId"]
|
|
719
|
+
]
|
|
720
|
+
}
|
|
721
|
+
]
|
|
722
|
+
},
|
|
723
|
+
configSchema: {
|
|
724
|
+
required: [
|
|
725
|
+
{ name: "tabs", type: "array", description: "Tab definitions with id, label, content" }
|
|
726
|
+
],
|
|
727
|
+
optional: [
|
|
728
|
+
{ name: "defaultTab", type: "string", description: "Default active tab ID" }
|
|
729
|
+
]
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
var WIZARD_BEHAVIOR = {
|
|
733
|
+
name: "std/Wizard",
|
|
734
|
+
category: "ui-interaction",
|
|
735
|
+
description: "Multi-step wizard flow - each step is a state",
|
|
736
|
+
suggestedFor: [
|
|
737
|
+
"Onboarding flows",
|
|
738
|
+
"Multi-step forms",
|
|
739
|
+
"Setup wizards",
|
|
740
|
+
"Checkout flows"
|
|
741
|
+
],
|
|
742
|
+
dataEntities: [
|
|
743
|
+
{
|
|
744
|
+
name: "WizardState",
|
|
745
|
+
runtime: true,
|
|
746
|
+
singleton: true,
|
|
747
|
+
fields: [
|
|
748
|
+
{ name: "stepData", type: "object", default: {} }
|
|
749
|
+
]
|
|
750
|
+
}
|
|
751
|
+
],
|
|
752
|
+
// IMPORTANT: Each wizard step is a STATE, not a number index
|
|
753
|
+
// This is the correct pattern for wizards
|
|
754
|
+
stateMachine: {
|
|
755
|
+
initial: "Step1",
|
|
756
|
+
states: [
|
|
757
|
+
{ name: "Step1", isInitial: true },
|
|
758
|
+
{ name: "Step2" },
|
|
759
|
+
{ name: "Step3" },
|
|
760
|
+
{ name: "Complete" }
|
|
761
|
+
],
|
|
762
|
+
events: [
|
|
763
|
+
{ key: "INIT" },
|
|
764
|
+
{ key: "NEXT" },
|
|
765
|
+
{ key: "PREV" },
|
|
766
|
+
{ key: "COMPLETE" }
|
|
767
|
+
],
|
|
768
|
+
transitions: [
|
|
769
|
+
// INIT on Step1: Self-loop that renders step 1
|
|
770
|
+
{
|
|
771
|
+
from: "Step1",
|
|
772
|
+
to: "Step1",
|
|
773
|
+
event: "INIT",
|
|
774
|
+
effects: [
|
|
775
|
+
["render-ui", "main", {
|
|
776
|
+
type: "wizard-progress",
|
|
777
|
+
steps: ["Step 1", "Step 2", "Step 3"],
|
|
778
|
+
current: 0
|
|
779
|
+
}],
|
|
780
|
+
["render-ui", "main", {
|
|
781
|
+
type: "form-section",
|
|
782
|
+
entity: "@config.entity",
|
|
783
|
+
fields: "@config.step1Fields",
|
|
784
|
+
submitEvent: "NEXT"
|
|
785
|
+
}]
|
|
786
|
+
]
|
|
787
|
+
},
|
|
788
|
+
// Step1 → Step2
|
|
789
|
+
{
|
|
790
|
+
from: "Step1",
|
|
791
|
+
to: "Step2",
|
|
792
|
+
event: "NEXT",
|
|
793
|
+
effects: [
|
|
794
|
+
["set", "@entity.stepData.step1", "@payload"],
|
|
795
|
+
["render-ui", "main", {
|
|
796
|
+
type: "wizard-progress",
|
|
797
|
+
steps: ["Step 1", "Step 2", "Step 3"],
|
|
798
|
+
current: 1
|
|
799
|
+
}],
|
|
800
|
+
["render-ui", "main", {
|
|
801
|
+
type: "form-section",
|
|
802
|
+
entity: "@config.entity",
|
|
803
|
+
fields: "@config.step2Fields",
|
|
804
|
+
submitEvent: "NEXT",
|
|
805
|
+
cancelEvent: "PREV"
|
|
806
|
+
}]
|
|
807
|
+
]
|
|
808
|
+
},
|
|
809
|
+
// Step2 → Step1 (back)
|
|
810
|
+
{
|
|
811
|
+
from: "Step2",
|
|
812
|
+
to: "Step1",
|
|
813
|
+
event: "PREV",
|
|
814
|
+
effects: [
|
|
815
|
+
["emit", "INIT"]
|
|
816
|
+
]
|
|
817
|
+
},
|
|
818
|
+
// Step2 → Step3
|
|
819
|
+
{
|
|
820
|
+
from: "Step2",
|
|
821
|
+
to: "Step3",
|
|
822
|
+
event: "NEXT",
|
|
823
|
+
effects: [
|
|
824
|
+
["set", "@entity.stepData.step2", "@payload"],
|
|
825
|
+
["render-ui", "main", {
|
|
826
|
+
type: "wizard-progress",
|
|
827
|
+
steps: ["Step 1", "Step 2", "Step 3"],
|
|
828
|
+
current: 2
|
|
829
|
+
}],
|
|
830
|
+
["render-ui", "main", {
|
|
831
|
+
type: "entity-detail",
|
|
832
|
+
entity: "@config.entity",
|
|
833
|
+
fieldNames: ["step1", "step2"],
|
|
834
|
+
title: "Review"
|
|
835
|
+
}],
|
|
836
|
+
["render-ui", "main", {
|
|
837
|
+
type: "form-section",
|
|
838
|
+
submitLabel: "Complete",
|
|
839
|
+
cancelLabel: "Back",
|
|
840
|
+
submitEvent: "COMPLETE",
|
|
841
|
+
cancelEvent: "PREV"
|
|
842
|
+
}]
|
|
843
|
+
]
|
|
844
|
+
},
|
|
845
|
+
// Step3 → Step2 (back)
|
|
846
|
+
{
|
|
847
|
+
from: "Step3",
|
|
848
|
+
to: "Step2",
|
|
849
|
+
event: "PREV",
|
|
850
|
+
effects: [
|
|
851
|
+
["render-ui", "main", {
|
|
852
|
+
type: "wizard-progress",
|
|
853
|
+
steps: ["Step 1", "Step 2", "Step 3"],
|
|
854
|
+
current: 1
|
|
855
|
+
}],
|
|
856
|
+
["render-ui", "main", {
|
|
857
|
+
type: "form-section",
|
|
858
|
+
entity: "@config.entity",
|
|
859
|
+
fields: "@config.step2Fields",
|
|
860
|
+
submitEvent: "NEXT",
|
|
861
|
+
cancelEvent: "PREV"
|
|
862
|
+
}]
|
|
863
|
+
]
|
|
864
|
+
},
|
|
865
|
+
// Step3 → Complete
|
|
866
|
+
{
|
|
867
|
+
from: "Step3",
|
|
868
|
+
to: "Complete",
|
|
869
|
+
event: "COMPLETE",
|
|
870
|
+
effects: [
|
|
871
|
+
["persist", "create", "@config.entity", "@entity.stepData"],
|
|
872
|
+
["notify", { type: "success", message: "Wizard completed!" }],
|
|
873
|
+
["navigate", "@config.completionUrl"]
|
|
874
|
+
]
|
|
875
|
+
}
|
|
876
|
+
]
|
|
877
|
+
},
|
|
878
|
+
configSchema: {
|
|
879
|
+
required: [
|
|
880
|
+
{ name: "entity", type: "entity", description: "Entity to create" },
|
|
881
|
+
{ name: "step1Fields", type: "array", description: "Fields for step 1" },
|
|
882
|
+
{ name: "step2Fields", type: "array", description: "Fields for step 2" }
|
|
883
|
+
],
|
|
884
|
+
optional: [
|
|
885
|
+
{ name: "completionUrl", type: "string", description: "URL to navigate on completion", default: "/" }
|
|
886
|
+
]
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
var MASTER_DETAIL_BEHAVIOR = {
|
|
890
|
+
name: "std/MasterDetail",
|
|
891
|
+
category: "ui-interaction",
|
|
892
|
+
description: "Master-detail layout with synchronized list and detail views",
|
|
893
|
+
suggestedFor: [
|
|
894
|
+
"Email clients",
|
|
895
|
+
"File managers",
|
|
896
|
+
"Two-panel layouts",
|
|
897
|
+
"List-detail views"
|
|
898
|
+
],
|
|
899
|
+
dataEntities: [
|
|
900
|
+
{
|
|
901
|
+
name: "MasterDetailState",
|
|
902
|
+
runtime: true,
|
|
903
|
+
singleton: true,
|
|
904
|
+
fields: [
|
|
905
|
+
{ name: "selectedId", type: "string", default: null }
|
|
906
|
+
]
|
|
907
|
+
}
|
|
908
|
+
],
|
|
909
|
+
stateMachine: {
|
|
910
|
+
initial: "NoSelection",
|
|
911
|
+
states: [
|
|
912
|
+
{ name: "NoSelection", isInitial: true },
|
|
913
|
+
{ name: "Selected" }
|
|
914
|
+
],
|
|
915
|
+
events: [
|
|
916
|
+
{ key: "INIT" },
|
|
917
|
+
{ key: "SELECT" },
|
|
918
|
+
{ key: "DESELECT" }
|
|
919
|
+
],
|
|
920
|
+
transitions: [
|
|
921
|
+
// INIT: Self-loop on NoSelection
|
|
922
|
+
{
|
|
923
|
+
from: "NoSelection",
|
|
924
|
+
to: "NoSelection",
|
|
925
|
+
event: "INIT",
|
|
926
|
+
effects: [
|
|
927
|
+
["render-ui", "main", {
|
|
928
|
+
type: "master-detail",
|
|
929
|
+
entity: "@config.entity",
|
|
930
|
+
masterColumns: "@config.masterColumns",
|
|
931
|
+
onSelect: "SELECT",
|
|
932
|
+
selected: "@entity.selectedId"
|
|
933
|
+
}],
|
|
934
|
+
["render-ui", "main", {
|
|
935
|
+
type: "empty-state",
|
|
936
|
+
message: "Select an item to view details"
|
|
937
|
+
}]
|
|
938
|
+
]
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
from: "NoSelection",
|
|
942
|
+
to: "Selected",
|
|
943
|
+
event: "SELECT",
|
|
944
|
+
effects: [
|
|
945
|
+
["set", "@entity.selectedId", "@payload.id"],
|
|
946
|
+
["render-ui", "main", {
|
|
947
|
+
type: "entity-detail",
|
|
948
|
+
entity: "@config.entity",
|
|
949
|
+
id: "@payload.id",
|
|
950
|
+
fieldNames: "@config.detailFields"
|
|
951
|
+
}]
|
|
952
|
+
]
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
from: "Selected",
|
|
956
|
+
to: "Selected",
|
|
957
|
+
event: "SELECT",
|
|
958
|
+
effects: [
|
|
959
|
+
["set", "@entity.selectedId", "@payload.id"],
|
|
960
|
+
["render-ui", "main", {
|
|
961
|
+
type: "entity-detail",
|
|
962
|
+
entity: "@config.entity",
|
|
963
|
+
id: "@payload.id",
|
|
964
|
+
fieldNames: "@config.detailFields"
|
|
965
|
+
}]
|
|
966
|
+
]
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
from: "Selected",
|
|
970
|
+
to: "NoSelection",
|
|
971
|
+
event: "DESELECT",
|
|
972
|
+
effects: [
|
|
973
|
+
["set", "@entity.selectedId", null],
|
|
974
|
+
["render-ui", "main", {
|
|
975
|
+
type: "empty-state",
|
|
976
|
+
message: "Select an item to view details"
|
|
977
|
+
}]
|
|
978
|
+
]
|
|
979
|
+
}
|
|
980
|
+
]
|
|
981
|
+
},
|
|
982
|
+
configSchema: {
|
|
983
|
+
required: [
|
|
984
|
+
{ name: "entity", type: "entity", description: "Entity type" },
|
|
985
|
+
{ name: "masterColumns", type: "array", description: "Columns for master list" },
|
|
986
|
+
{ name: "detailFields", type: "array", description: "Fields for detail panel" }
|
|
987
|
+
],
|
|
988
|
+
optional: [
|
|
989
|
+
{ name: "masterWidth", type: "string", description: "Master panel width", default: "350px" }
|
|
990
|
+
]
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
var FILTER_BEHAVIOR = {
|
|
994
|
+
name: "std/Filter",
|
|
995
|
+
category: "ui-interaction",
|
|
996
|
+
description: "Filter and search management for lists",
|
|
997
|
+
suggestedFor: [
|
|
998
|
+
"Filtered lists",
|
|
999
|
+
"Search interfaces",
|
|
1000
|
+
"Faceted navigation",
|
|
1001
|
+
"Advanced filtering"
|
|
1002
|
+
],
|
|
1003
|
+
dataEntities: [
|
|
1004
|
+
{
|
|
1005
|
+
name: "FilterState",
|
|
1006
|
+
runtime: true,
|
|
1007
|
+
singleton: true,
|
|
1008
|
+
fields: [
|
|
1009
|
+
{ name: "filters", type: "object", default: {} },
|
|
1010
|
+
{ name: "searchTerm", type: "string", default: "" }
|
|
1011
|
+
]
|
|
1012
|
+
}
|
|
1013
|
+
],
|
|
1014
|
+
stateMachine: {
|
|
1015
|
+
initial: "Idle",
|
|
1016
|
+
states: [
|
|
1017
|
+
{ name: "Idle", isInitial: true },
|
|
1018
|
+
{ name: "Filtering" }
|
|
1019
|
+
],
|
|
1020
|
+
events: [
|
|
1021
|
+
{ key: "INIT" },
|
|
1022
|
+
{ key: "SET_FILTER" },
|
|
1023
|
+
{ key: "CLEAR_FILTERS" },
|
|
1024
|
+
{ key: "SEARCH" }
|
|
1025
|
+
],
|
|
1026
|
+
transitions: [
|
|
1027
|
+
// INIT: Self-loop
|
|
1028
|
+
{
|
|
1029
|
+
from: "Idle",
|
|
1030
|
+
to: "Idle",
|
|
1031
|
+
event: "INIT",
|
|
1032
|
+
effects: [
|
|
1033
|
+
["render-ui", "main", {
|
|
1034
|
+
type: "filter-group",
|
|
1035
|
+
filters: "@config.filters",
|
|
1036
|
+
values: "@entity.filters",
|
|
1037
|
+
onFilterChange: "SET_FILTER",
|
|
1038
|
+
onClear: "CLEAR_FILTERS"
|
|
1039
|
+
}]
|
|
1040
|
+
]
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
from: "Idle",
|
|
1044
|
+
to: "Filtering",
|
|
1045
|
+
event: "SET_FILTER",
|
|
1046
|
+
effects: [
|
|
1047
|
+
["set", "@entity.filters", ["object/set", "@entity.filters", "@payload.field", "@payload.value"]],
|
|
1048
|
+
["emit", "FILTER_CHANGED", "@entity.filters"]
|
|
1049
|
+
]
|
|
1050
|
+
},
|
|
1051
|
+
{
|
|
1052
|
+
from: "Filtering",
|
|
1053
|
+
to: "Idle",
|
|
1054
|
+
event: "SET_FILTER",
|
|
1055
|
+
effects: [
|
|
1056
|
+
["set", "@entity.filters", ["object/set", "@entity.filters", "@payload.field", "@payload.value"]],
|
|
1057
|
+
["emit", "FILTER_CHANGED", "@entity.filters"]
|
|
1058
|
+
]
|
|
1059
|
+
},
|
|
1060
|
+
{
|
|
1061
|
+
from: "Filtering",
|
|
1062
|
+
to: "Idle",
|
|
1063
|
+
event: "CLEAR_FILTERS",
|
|
1064
|
+
effects: [
|
|
1065
|
+
["set", "@entity.filters", {}],
|
|
1066
|
+
["set", "@entity.searchTerm", ""],
|
|
1067
|
+
["emit", "FILTER_CHANGED", {}]
|
|
1068
|
+
]
|
|
1069
|
+
},
|
|
1070
|
+
{
|
|
1071
|
+
from: "Idle",
|
|
1072
|
+
to: "Filtering",
|
|
1073
|
+
event: "SEARCH",
|
|
1074
|
+
effects: [
|
|
1075
|
+
["set", "@entity.searchTerm", "@payload.term"],
|
|
1076
|
+
["emit", "SEARCH_CHANGED", "@payload.term"]
|
|
1077
|
+
]
|
|
1078
|
+
}
|
|
1079
|
+
]
|
|
1080
|
+
},
|
|
1081
|
+
configSchema: {
|
|
1082
|
+
required: [
|
|
1083
|
+
{ name: "filters", type: "array", description: "Filter definitions" }
|
|
1084
|
+
],
|
|
1085
|
+
optional: [
|
|
1086
|
+
{ name: "searchable", type: "boolean", description: "Enable search", default: true }
|
|
1087
|
+
]
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
var UI_INTERACTION_BEHAVIORS = [
|
|
1091
|
+
LIST_BEHAVIOR,
|
|
1092
|
+
DETAIL_BEHAVIOR,
|
|
1093
|
+
FORM_BEHAVIOR,
|
|
1094
|
+
MODAL_BEHAVIOR,
|
|
1095
|
+
DRAWER_BEHAVIOR,
|
|
1096
|
+
TABS_BEHAVIOR,
|
|
1097
|
+
WIZARD_BEHAVIOR,
|
|
1098
|
+
MASTER_DETAIL_BEHAVIOR,
|
|
1099
|
+
FILTER_BEHAVIOR
|
|
1100
|
+
];
|
|
1101
|
+
|
|
1102
|
+
export { DETAIL_BEHAVIOR, DRAWER_BEHAVIOR, FILTER_BEHAVIOR, FORM_BEHAVIOR, LIST_BEHAVIOR, MASTER_DETAIL_BEHAVIOR, MODAL_BEHAVIOR, TABS_BEHAVIOR, UI_INTERACTION_BEHAVIORS, WIZARD_BEHAVIOR };
|
|
1103
|
+
//# sourceMappingURL=ui-interaction.js.map
|
|
1104
|
+
//# sourceMappingURL=ui-interaction.js.map
|