@almadar/std 13.0.4 → 13.0.6

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.
@@ -43,7 +43,13 @@
43
43
  },
44
44
  {
45
45
  "name": "status",
46
- "type": "string"
46
+ "type": "string",
47
+ "default": "active",
48
+ "values": [
49
+ "active",
50
+ "inactive",
51
+ "pending"
52
+ ]
47
53
  }
48
54
  ]
49
55
  },
@@ -53,8 +59,8 @@
53
59
  "name": "FilteredItemSearch",
54
60
  "linkedEntity": "FilteredListItem",
55
61
  "config": {
56
- "placeholder": "Search filtered items…",
57
- "event": "SEARCH"
62
+ "event": "SEARCH",
63
+ "placeholder": "Search filtered items…"
58
64
  }
59
65
  },
60
66
  {
@@ -65,13 +71,13 @@
65
71
  "filters": [
66
72
  {
67
73
  "filterType": "select",
68
- "field": "status",
69
- "label": "Status",
70
74
  "options": [
71
75
  "active",
72
76
  "inactive",
73
77
  "pending"
74
- ]
78
+ ],
79
+ "field": "status",
80
+ "label": "Status"
75
81
  }
76
82
  ],
77
83
  "event": "FILTER"
@@ -85,21 +91,47 @@
85
91
  "fields": [
86
92
  {
87
93
  "label": "Name",
88
- "variant": "h4",
89
- "name": "name"
94
+ "name": "name",
95
+ "variant": "h4"
90
96
  },
91
97
  {
92
- "label": "Description",
93
98
  "variant": "caption",
99
+ "label": "Description",
94
100
  "name": "description"
95
101
  },
96
102
  {
103
+ "name": "status",
97
104
  "label": "Status",
98
- "variant": "badge",
99
- "name": "status"
105
+ "variant": "badge"
100
106
  }
101
107
  ]
102
- }
108
+ },
109
+ "listens": [
110
+ {
111
+ "event": "SEARCH",
112
+ "triggers": "REFETCH",
113
+ "source": {
114
+ "kind": "trait",
115
+ "trait": "FilteredItemSearch"
116
+ }
117
+ },
118
+ {
119
+ "event": "FILTER",
120
+ "triggers": "REFETCH",
121
+ "source": {
122
+ "kind": "trait",
123
+ "trait": "FilteredItemFilter"
124
+ }
125
+ },
126
+ {
127
+ "event": "PAGE",
128
+ "triggers": "REFETCH",
129
+ "source": {
130
+ "kind": "trait",
131
+ "trait": "FilteredItemPagination"
132
+ }
133
+ }
134
+ ]
103
135
  },
104
136
  {
105
137
  "ref": "Pagination.traits.PagedItemPagination",
@@ -188,8 +220,8 @@
188
220
  "FilteredListItem",
189
221
  {
190
222
  "emit": {
191
- "success": "FilteredListItemLoaded",
192
- "failure": "FilteredListItemLoadFailed"
223
+ "failure": "FilteredListItemLoadFailed",
224
+ "success": "FilteredListItemLoaded"
193
225
  }
194
226
  }
195
227
  ],
@@ -198,13 +230,11 @@
198
230
  "main",
199
231
  {
200
232
  "gap": "md",
201
- "type": "stack",
202
- "direction": "vertical",
203
- "className": "max-w-5xl mx-auto w-full",
204
233
  "children": [
205
234
  {
206
- "gap": "sm",
235
+ "type": "stack",
207
236
  "align": "center",
237
+ "gap": "sm",
208
238
  "direction": "horizontal",
209
239
  "children": [
210
240
  {
@@ -213,27 +243,29 @@
213
243
  },
214
244
  {
215
245
  "type": "typography",
216
- "variant": "h2",
217
- "content": "Filtered List"
246
+ "content": "Filtered List",
247
+ "variant": "h2"
218
248
  }
219
- ],
220
- "type": "stack"
249
+ ]
221
250
  },
222
251
  {
223
252
  "type": "divider"
224
253
  },
225
254
  {
226
- "direction": "horizontal",
227
255
  "children": [
228
256
  "@trait.FilteredItemSearch",
229
257
  "@trait.FilteredItemFilter"
230
258
  ],
259
+ "direction": "horizontal",
231
260
  "gap": "sm",
232
261
  "type": "stack"
233
262
  },
234
263
  "@trait.FilteredItemBrowse",
235
264
  "@trait.FilteredItemPagination"
236
- ]
265
+ ],
266
+ "direction": "vertical",
267
+ "className": "max-w-5xl mx-auto w-full",
268
+ "type": "stack"
237
269
  }
238
270
  ]
239
271
  ]
@@ -113,6 +113,32 @@
113
113
  "type": "string"
114
114
  }
115
115
  ]
116
+ },
117
+ {
118
+ "key": "REFETCH",
119
+ "name": "Refetch",
120
+ "payloadSchema": [
121
+ {
122
+ "name": "query",
123
+ "type": "string"
124
+ },
125
+ {
126
+ "name": "field",
127
+ "type": "string"
128
+ },
129
+ {
130
+ "name": "value",
131
+ "type": "string"
132
+ },
133
+ {
134
+ "name": "page",
135
+ "type": "number"
136
+ },
137
+ {
138
+ "name": "pageSize",
139
+ "type": "number"
140
+ }
141
+ ]
116
142
  }
117
143
  ],
118
144
  "transitions": [
@@ -152,10 +178,10 @@
152
178
  {
153
179
  "children": [
154
180
  {
181
+ "entity": "@payload.data",
155
182
  "fields": "@config.fields",
156
183
  "type": "data-grid",
157
- "pageSize": "@config.pageSize",
158
- "entity": "@payload.data"
184
+ "pageSize": "@config.pageSize"
159
185
  }
160
186
  ],
161
187
  "type": "stack",
@@ -174,9 +200,9 @@
174
200
  "main",
175
201
  {
176
202
  "variant": "caption",
177
- "color": "error",
178
203
  "content": "@payload.error",
179
- "type": "typography"
204
+ "type": "typography",
205
+ "color": "error"
180
206
  }
181
207
  ]
182
208
  ]
@@ -185,6 +211,31 @@
185
211
  "from": "browsing",
186
212
  "to": "loading",
187
213
  "event": "INIT",
214
+ "effects": [
215
+ [
216
+ "fetch",
217
+ "BrowseItem",
218
+ {
219
+ "emit": {
220
+ "failure": "BrowseItemLoadFailed",
221
+ "success": "BrowseItemLoaded"
222
+ }
223
+ }
224
+ ],
225
+ [
226
+ "render-ui",
227
+ "main",
228
+ {
229
+ "type": "spinner",
230
+ "size": "sm"
231
+ }
232
+ ]
233
+ ]
234
+ },
235
+ {
236
+ "from": "browsing",
237
+ "to": "loading",
238
+ "event": "REFETCH",
188
239
  "effects": [
189
240
  [
190
241
  "fetch",
@@ -216,8 +267,8 @@
216
267
  "BrowseItem",
217
268
  {
218
269
  "emit": {
219
- "failure": "BrowseItemLoadFailed",
220
- "success": "BrowseItemLoaded"
270
+ "success": "BrowseItemLoaded",
271
+ "failure": "BrowseItemLoadFailed"
221
272
  }
222
273
  }
223
274
  ],
@@ -45,6 +45,21 @@
45
45
  "category": "interaction",
46
46
  "linkedEntity": "FilterTarget",
47
47
  "emits": [
48
+ {
49
+ "event": "FILTER",
50
+ "payloadSchema": [
51
+ {
52
+ "name": "field",
53
+ "type": "string",
54
+ "required": true
55
+ },
56
+ {
57
+ "name": "value",
58
+ "type": "string",
59
+ "required": true
60
+ }
61
+ ]
62
+ },
48
63
  {
49
64
  "event": "FilterTargetLoaded",
50
65
  "description": "Fired when FilterTarget finishes loading; payload.data holds the filtered list",
@@ -155,8 +170,8 @@
155
170
  "render-ui",
156
171
  "main",
157
172
  {
158
- "type": "spinner",
159
- "size": "sm"
173
+ "size": "sm",
174
+ "type": "spinner"
160
175
  }
161
176
  ]
162
177
  ]
@@ -170,8 +185,8 @@
170
185
  "render-ui",
171
186
  "main",
172
187
  {
173
- "entity": "FilterTarget",
174
188
  "type": "filter-group",
189
+ "entity": "FilterTarget",
175
190
  "filters": "@config.filters"
176
191
  }
177
192
  ]
@@ -187,21 +202,21 @@
187
202
  "main",
188
203
  {
189
204
  "type": "stack",
205
+ "direction": "vertical",
190
206
  "children": [
191
207
  {
208
+ "filters": "@config.filters",
192
209
  "type": "filter-group",
193
- "entity": "FilterTarget",
194
- "filters": "@config.filters"
210
+ "entity": "FilterTarget"
195
211
  },
196
212
  {
197
213
  "content": "@payload.error",
198
- "color": "error",
199
214
  "type": "typography",
215
+ "color": "error",
200
216
  "variant": "caption"
201
217
  }
202
218
  ],
203
- "gap": "xs",
204
- "direction": "vertical"
219
+ "gap": "xs"
205
220
  }
206
221
  ]
207
222
  ]
@@ -211,10 +226,22 @@
211
226
  "to": "loading",
212
227
  "event": "FILTER",
213
228
  "effects": [
229
+ [
230
+ "emit",
231
+ "FILTER",
232
+ {
233
+ "value": "@payload.value",
234
+ "field": "@payload.field"
235
+ }
236
+ ],
214
237
  [
215
238
  "fetch",
216
239
  "FilterTarget",
217
240
  {
241
+ "emit": {
242
+ "failure": "FilterTargetLoadFailed",
243
+ "success": "FilterTargetLoaded"
244
+ },
218
245
  "filter": [
219
246
  "=",
220
247
  [
@@ -223,30 +250,26 @@
223
250
  "@payload.field"
224
251
  ],
225
252
  "@payload.value"
226
- ],
227
- "emit": {
228
- "failure": "FilterTargetLoadFailed",
229
- "success": "FilterTargetLoaded"
230
- }
253
+ ]
231
254
  }
232
255
  ],
233
256
  [
234
257
  "render-ui",
235
258
  "main",
236
259
  {
237
- "direction": "horizontal",
238
260
  "type": "stack",
239
- "align": "center",
261
+ "direction": "horizontal",
240
262
  "gap": "sm",
263
+ "align": "center",
241
264
  "children": [
242
265
  {
266
+ "type": "filter-group",
243
267
  "filters": "@config.filters",
244
- "entity": "FilterTarget",
245
- "type": "filter-group"
268
+ "entity": "FilterTarget"
246
269
  },
247
270
  {
248
- "size": "sm",
249
- "type": "spinner"
271
+ "type": "spinner",
272
+ "size": "sm"
250
273
  }
251
274
  ]
252
275
  }
@@ -263,8 +286,8 @@
263
286
  "FilterTarget",
264
287
  {
265
288
  "emit": {
266
- "success": "FilterTargetLoaded",
267
- "failure": "FilterTargetLoadFailed"
289
+ "failure": "FilterTargetLoadFailed",
290
+ "success": "FilterTargetLoaded"
268
291
  }
269
292
  }
270
293
  ],
@@ -272,8 +295,6 @@
272
295
  "render-ui",
273
296
  "main",
274
297
  {
275
- "type": "stack",
276
- "gap": "sm",
277
298
  "children": [
278
299
  {
279
300
  "filters": "@config.filters",
@@ -285,8 +306,10 @@
285
306
  "type": "spinner"
286
307
  }
287
308
  ],
288
- "align": "center",
289
- "direction": "horizontal"
309
+ "gap": "sm",
310
+ "type": "stack",
311
+ "direction": "horizontal",
312
+ "align": "center"
290
313
  }
291
314
  ]
292
315
  ]
@@ -301,8 +324,8 @@
301
324
  "FilterTarget",
302
325
  {
303
326
  "emit": {
304
- "failure": "FilterTargetLoadFailed",
305
- "success": "FilterTargetLoaded"
327
+ "success": "FilterTargetLoaded",
328
+ "failure": "FilterTargetLoadFailed"
306
329
  }
307
330
  }
308
331
  ],
@@ -310,8 +333,8 @@
310
333
  "render-ui",
311
334
  "main",
312
335
  {
313
- "size": "sm",
314
- "type": "spinner"
336
+ "type": "spinner",
337
+ "size": "sm"
315
338
  }
316
339
  ]
317
340
  ]
@@ -45,6 +45,21 @@
45
45
  "category": "interaction",
46
46
  "linkedEntity": "PagedItem",
47
47
  "emits": [
48
+ {
49
+ "event": "PAGE",
50
+ "payloadSchema": [
51
+ {
52
+ "name": "page",
53
+ "type": "number",
54
+ "required": true
55
+ },
56
+ {
57
+ "name": "pageSize",
58
+ "type": "number",
59
+ "required": true
60
+ }
61
+ ]
62
+ },
48
63
  {
49
64
  "event": "PagedItemLoaded",
50
65
  "description": "Fired when PagedItem finishes loading; payload.data holds the page",
@@ -151,8 +166,8 @@
151
166
  "render-ui",
152
167
  "main",
153
168
  {
154
- "type": "spinner",
155
- "size": "sm"
169
+ "size": "sm",
170
+ "type": "spinner"
156
171
  }
157
172
  ]
158
173
  ]
@@ -166,22 +181,11 @@
166
181
  "render-ui",
167
182
  "main",
168
183
  {
169
- "type": "stack",
170
- "gap": "sm",
171
- "children": [
172
- {
173
- "totalPages": "@config.totalPages",
174
- "currentPage": 1.0,
175
- "type": "pagination",
176
- "onPageChange": "@config.event",
177
- "showPageSize": false
178
- },
179
- {
180
- "type": "infinite-scroll-sentinel",
181
- "loadMoreEvent": "@config.event"
182
- }
183
- ],
184
- "direction": "vertical"
184
+ "onPageChange": "@config.event",
185
+ "currentPage": 1.0,
186
+ "type": "pagination",
187
+ "totalPages": "@config.totalPages",
188
+ "showPageSize": false
185
189
  }
186
190
  ]
187
191
  ]
@@ -195,33 +199,22 @@
195
199
  "render-ui",
196
200
  "main",
197
201
  {
198
- "type": "stack",
199
202
  "children": [
200
203
  {
201
- "gap": "sm",
202
- "children": [
203
- {
204
- "type": "pagination",
205
- "onPageChange": "@config.event",
206
- "totalPages": "@config.totalPages",
207
- "currentPage": 1.0,
208
- "showPageSize": false
209
- },
210
- {
211
- "type": "infinite-scroll-sentinel",
212
- "loadMoreEvent": "@config.event"
213
- }
214
- ],
215
- "direction": "vertical",
216
- "type": "stack"
204
+ "type": "pagination",
205
+ "currentPage": 1.0,
206
+ "onPageChange": "@config.event",
207
+ "totalPages": "@config.totalPages",
208
+ "showPageSize": false
217
209
  },
218
210
  {
219
- "variant": "caption",
220
- "color": "error",
221
211
  "content": "@payload.error",
222
- "type": "typography"
212
+ "type": "typography",
213
+ "color": "error",
214
+ "variant": "caption"
223
215
  }
224
216
  ],
217
+ "type": "stack",
225
218
  "gap": "xs",
226
219
  "direction": "vertical"
227
220
  }
@@ -233,13 +226,21 @@
233
226
  "to": "loading",
234
227
  "event": "PAGE",
235
228
  "effects": [
229
+ [
230
+ "emit",
231
+ "PAGE",
232
+ {
233
+ "pageSize": "@payload.pageSize",
234
+ "page": "@payload.page"
235
+ }
236
+ ],
236
237
  [
237
238
  "fetch",
238
239
  "PagedItem",
239
240
  {
240
241
  "emit": {
241
- "success": "PagedItemLoaded",
242
- "failure": "PagedItemLoadFailed"
242
+ "failure": "PagedItemLoadFailed",
243
+ "success": "PagedItemLoaded"
243
244
  }
244
245
  }
245
246
  ],
@@ -247,32 +248,21 @@
247
248
  "render-ui",
248
249
  "main",
249
250
  {
250
- "direction": "horizontal",
251
- "gap": "sm",
252
251
  "align": "center",
253
252
  "type": "stack",
253
+ "direction": "horizontal",
254
+ "gap": "sm",
254
255
  "children": [
255
256
  {
256
- "gap": "sm",
257
- "type": "stack",
258
- "children": [
259
- {
260
- "showPageSize": false,
261
- "type": "pagination",
262
- "totalPages": "@config.totalPages",
263
- "currentPage": 1.0,
264
- "onPageChange": "@config.event"
265
- },
266
- {
267
- "type": "infinite-scroll-sentinel",
268
- "loadMoreEvent": "@config.event"
269
- }
270
- ],
271
- "direction": "vertical"
257
+ "type": "pagination",
258
+ "onPageChange": "@config.event",
259
+ "showPageSize": false,
260
+ "currentPage": 1.0,
261
+ "totalPages": "@config.totalPages"
272
262
  },
273
263
  {
274
- "type": "spinner",
275
- "size": "sm"
264
+ "size": "sm",
265
+ "type": "spinner"
276
266
  }
277
267
  ]
278
268
  }
@@ -298,8 +288,8 @@
298
288
  "render-ui",
299
289
  "main",
300
290
  {
301
- "type": "spinner",
302
- "size": "sm"
291
+ "size": "sm",
292
+ "type": "spinner"
303
293
  }
304
294
  ]
305
295
  ]