@nocobase/plugin-flow-engine 2.1.0-alpha.15 → 2.1.0-alpha.17

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.
Files changed (116) hide show
  1. package/dist/externalVersion.js +10 -10
  2. package/dist/node_modules/ses/package.json +1 -1
  3. package/dist/node_modules/zod/package.json +1 -1
  4. package/dist/server/flow-surfaces/{compiler.d.ts → apply/compiler.d.ts} +1 -10
  5. package/dist/server/flow-surfaces/{compiler.js → apply/compiler.js} +41 -280
  6. package/dist/server/flow-surfaces/apply/layout.d.ts +34 -0
  7. package/dist/server/flow-surfaces/apply/layout.js +175 -0
  8. package/dist/server/flow-surfaces/apply/matching.d.ts +16 -0
  9. package/dist/server/flow-surfaces/apply/matching.js +181 -0
  10. package/dist/server/flow-surfaces/association-title-field.d.ts +20 -0
  11. package/dist/server/flow-surfaces/association-title-field.js +158 -0
  12. package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +14 -0
  13. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +717 -0
  14. package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +13 -0
  15. package/dist/server/flow-surfaces/blueprint/compile-plan.js +308 -0
  16. package/dist/server/flow-surfaces/blueprint/compile-reaction.d.ts +11 -0
  17. package/dist/server/flow-surfaces/blueprint/compile-reaction.js +72 -0
  18. package/dist/server/flow-surfaces/blueprint/index.d.ts +12 -0
  19. package/dist/server/flow-surfaces/blueprint/index.js +44 -0
  20. package/dist/server/flow-surfaces/blueprint/normalize-document.d.ts +10 -0
  21. package/dist/server/flow-surfaces/blueprint/normalize-document.js +296 -0
  22. package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +26 -0
  23. package/dist/server/flow-surfaces/blueprint/private-utils.js +182 -0
  24. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +153 -0
  25. package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
  26. package/dist/server/flow-surfaces/catalog-smart.d.ts +18 -0
  27. package/dist/server/flow-surfaces/catalog-smart.js +239 -0
  28. package/dist/server/flow-surfaces/catalog-smart.projector.d.ts +15 -0
  29. package/dist/server/flow-surfaces/catalog-smart.projector.js +157 -0
  30. package/dist/server/flow-surfaces/catalog-smart.types.d.ts +99 -0
  31. package/dist/server/flow-surfaces/catalog-smart.types.js +24 -0
  32. package/dist/server/flow-surfaces/catalog.d.ts +3 -0
  33. package/dist/server/flow-surfaces/catalog.js +163 -34
  34. package/dist/server/flow-surfaces/compose-compiler.d.ts +104 -0
  35. package/dist/server/flow-surfaces/compose-compiler.js +162 -0
  36. package/dist/server/flow-surfaces/compose-runtime.d.ts +89 -0
  37. package/dist/server/flow-surfaces/compose-runtime.js +338 -0
  38. package/dist/server/flow-surfaces/configure-options.js +12 -3
  39. package/dist/server/flow-surfaces/constants.d.ts +3 -2
  40. package/dist/server/flow-surfaces/constants.js +36 -3
  41. package/dist/server/flow-surfaces/default-action-popup.d.ts +52 -0
  42. package/dist/server/flow-surfaces/default-action-popup.js +258 -0
  43. package/dist/server/flow-surfaces/executor.d.ts +10 -0
  44. package/dist/server/flow-surfaces/executor.js +59 -24
  45. package/dist/server/flow-surfaces/field-binding-registry.d.ts +23 -0
  46. package/dist/server/flow-surfaces/field-binding-registry.js +391 -0
  47. package/dist/server/flow-surfaces/field-semantics.d.ts +1 -1
  48. package/dist/server/flow-surfaces/index.js +75 -0
  49. package/dist/server/flow-surfaces/node-use-sets.d.ts +15 -0
  50. package/dist/server/flow-surfaces/node-use-sets.js +114 -0
  51. package/dist/server/flow-surfaces/payload-shape.d.ts +9 -0
  52. package/dist/server/flow-surfaces/payload-shape.js +61 -0
  53. package/dist/server/flow-surfaces/placement.js +2 -6
  54. package/dist/server/flow-surfaces/planning/action-specs.d.ts +179 -0
  55. package/dist/server/flow-surfaces/planning/action-specs.js +190 -0
  56. package/dist/server/flow-surfaces/planning/compiler.d.ts +37 -0
  57. package/dist/server/flow-surfaces/planning/compiler.js +376 -0
  58. package/dist/server/flow-surfaces/planning/context.d.ts +30 -0
  59. package/dist/server/flow-surfaces/planning/context.js +139 -0
  60. package/dist/server/flow-surfaces/planning/created-keys.d.ts +34 -0
  61. package/dist/server/flow-surfaces/planning/created-keys.js +375 -0
  62. package/dist/server/flow-surfaces/planning/key-kind.d.ts +11 -0
  63. package/dist/server/flow-surfaces/planning/key-kind.js +86 -0
  64. package/dist/server/flow-surfaces/planning/key-persistence.d.ts +34 -0
  65. package/dist/server/flow-surfaces/planning/key-persistence.js +148 -0
  66. package/dist/server/flow-surfaces/planning/key-registry.d.ts +40 -0
  67. package/dist/server/flow-surfaces/planning/key-registry.js +206 -0
  68. package/dist/server/flow-surfaces/planning/runtime.d.ts +37 -0
  69. package/dist/server/flow-surfaces/planning/runtime.js +259 -0
  70. package/dist/server/flow-surfaces/planning/step-link.d.ts +14 -0
  71. package/dist/server/flow-surfaces/planning/step-link.js +104 -0
  72. package/dist/server/flow-surfaces/planning/types.d.ts +55 -0
  73. package/dist/server/flow-surfaces/planning/types.js +24 -0
  74. package/dist/server/flow-surfaces/reaction/errors.d.ts +20 -0
  75. package/dist/server/flow-surfaces/reaction/errors.js +69 -0
  76. package/dist/server/flow-surfaces/reaction/field-value.d.ts +34 -0
  77. package/dist/server/flow-surfaces/reaction/field-value.js +181 -0
  78. package/dist/server/flow-surfaces/reaction/fingerprint.d.ts +16 -0
  79. package/dist/server/flow-surfaces/reaction/fingerprint.js +71 -0
  80. package/dist/server/flow-surfaces/reaction/linkage.d.ts +136 -0
  81. package/dist/server/flow-surfaces/reaction/linkage.js +882 -0
  82. package/dist/server/flow-surfaces/reaction/meta.d.ts +11 -0
  83. package/dist/server/flow-surfaces/reaction/meta.js +451 -0
  84. package/dist/server/flow-surfaces/reaction/registry.d.ts +136 -0
  85. package/dist/server/flow-surfaces/reaction/registry.js +186 -0
  86. package/dist/server/flow-surfaces/reaction/resolver.d.ts +22 -0
  87. package/dist/server/flow-surfaces/reaction/resolver.js +202 -0
  88. package/dist/server/flow-surfaces/reaction/types.d.ts +241 -0
  89. package/dist/server/flow-surfaces/reaction/types.js +24 -0
  90. package/dist/server/flow-surfaces/reaction/utils.d.ts +17 -0
  91. package/dist/server/flow-surfaces/reaction/utils.js +67 -0
  92. package/dist/server/flow-surfaces/reaction/value-expr.d.ts +15 -0
  93. package/dist/server/flow-surfaces/reaction/value-expr.js +209 -0
  94. package/dist/server/flow-surfaces/reference-guards.d.ts +19 -0
  95. package/dist/server/flow-surfaces/reference-guards.js +103 -0
  96. package/dist/server/flow-surfaces/service-helpers.d.ts +42 -0
  97. package/dist/server/flow-surfaces/service-helpers.js +377 -0
  98. package/dist/server/flow-surfaces/service-utils.d.ts +105 -0
  99. package/dist/server/flow-surfaces/service-utils.js +760 -0
  100. package/dist/server/flow-surfaces/service.d.ts +199 -104
  101. package/dist/server/flow-surfaces/service.js +4158 -1890
  102. package/dist/server/flow-surfaces/template-compatibility.d.ts +42 -0
  103. package/dist/server/flow-surfaces/template-compatibility.js +189 -0
  104. package/dist/server/flow-surfaces/template-service-utils.d.ts +62 -0
  105. package/dist/server/flow-surfaces/template-service-utils.js +281 -0
  106. package/dist/server/flow-surfaces/types.d.ts +129 -37
  107. package/dist/swagger/flow-surfaces.d.ts +3777 -1581
  108. package/dist/swagger/flow-surfaces.examples.d.ts +1246 -0
  109. package/dist/swagger/flow-surfaces.examples.js +1396 -0
  110. package/dist/swagger/flow-surfaces.js +2020 -1469
  111. package/dist/swagger/flow-surfaces.template-action-docs.d.ts +62 -0
  112. package/dist/swagger/flow-surfaces.template-action-docs.js +121 -0
  113. package/dist/swagger/flow-surfaces.template-schemas.d.ts +239 -0
  114. package/dist/swagger/flow-surfaces.template-schemas.js +255 -0
  115. package/dist/swagger/index.d.ts +3777 -1581
  116. package/package.json +2 -2
@@ -0,0 +1,1396 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var flow_surfaces_examples_exports = {};
28
+ __export(flow_surfaces_examples_exports, {
29
+ flowSurfaceExamples: () => flowSurfaceExamples
30
+ });
31
+ module.exports = __toCommonJS(flow_surfaces_examples_exports);
32
+ const flowSurfaceExamples = {
33
+ catalog: {
34
+ target: {
35
+ uid: "table-block-uid"
36
+ }
37
+ },
38
+ context: {
39
+ target: {
40
+ uid: "details-block-uid"
41
+ },
42
+ path: "record",
43
+ maxDepth: 3
44
+ },
45
+ getReactionMeta: {
46
+ target: {
47
+ uid: "employees-form-uid"
48
+ }
49
+ },
50
+ describeSurface: {
51
+ locator: {
52
+ pageSchemaUid: "employees-page-schema"
53
+ },
54
+ bindKeys: [
55
+ {
56
+ key: "employeesTable",
57
+ locator: {
58
+ uid: "employees-table-uid"
59
+ },
60
+ expectedKind: "block"
61
+ }
62
+ ]
63
+ },
64
+ applyBlueprint: {
65
+ version: "1",
66
+ mode: "create",
67
+ navigation: {
68
+ group: {
69
+ title: "Workspace"
70
+ },
71
+ item: {
72
+ title: "Employees"
73
+ }
74
+ },
75
+ page: {
76
+ title: "Employees",
77
+ documentTitle: "Employees workspace",
78
+ enableHeader: true,
79
+ displayTitle: true
80
+ },
81
+ tabs: [
82
+ {
83
+ key: "main",
84
+ title: "Overview",
85
+ blocks: [
86
+ {
87
+ key: "employeeForm",
88
+ type: "createForm",
89
+ collection: "employees",
90
+ fields: ["nickname", "status", "amount", "taxRate", "subtotal", "total"],
91
+ actions: ["submit"]
92
+ },
93
+ {
94
+ key: "employeesTable",
95
+ type: "table",
96
+ collection: "employees",
97
+ fields: ["nickname", "status", "total"],
98
+ actions: [
99
+ {
100
+ key: "refreshAction",
101
+ type: "refresh"
102
+ }
103
+ ]
104
+ }
105
+ ],
106
+ layout: {
107
+ rows: [["main.employeeForm"], ["main.employeesTable"]]
108
+ }
109
+ }
110
+ ],
111
+ reaction: {
112
+ items: [
113
+ {
114
+ type: "setFieldValueRules",
115
+ target: "main.employeeForm",
116
+ rules: [
117
+ {
118
+ key: "defaultStatus",
119
+ targetPath: "status",
120
+ mode: "default",
121
+ value: {
122
+ source: "literal",
123
+ value: "draft"
124
+ }
125
+ }
126
+ ]
127
+ },
128
+ {
129
+ type: "setBlockLinkageRules",
130
+ target: "main.employeesTable",
131
+ rules: [
132
+ {
133
+ key: "hideTable",
134
+ when: {
135
+ logic: "$and",
136
+ items: [
137
+ {
138
+ path: "params.query.hideTable",
139
+ operator: "$isTruly"
140
+ }
141
+ ]
142
+ },
143
+ then: [{ type: "setBlockState", state: "hidden" }]
144
+ }
145
+ ]
146
+ },
147
+ {
148
+ type: "setFieldLinkageRules",
149
+ target: "main.employeeForm",
150
+ rules: [
151
+ {
152
+ key: "recomputeTotals",
153
+ when: {
154
+ logic: "$and",
155
+ items: [
156
+ {
157
+ path: "formValues.amount",
158
+ operator: "$notEmpty"
159
+ }
160
+ ]
161
+ },
162
+ then: [
163
+ {
164
+ type: "assignField",
165
+ items: [
166
+ {
167
+ targetPath: "subtotal",
168
+ value: {
169
+ source: "runjs",
170
+ version: "v2",
171
+ code: "const amount = Number(ctx.formValues?.amount || 0); return amount;"
172
+ }
173
+ },
174
+ {
175
+ targetPath: "total",
176
+ value: {
177
+ source: "runjs",
178
+ version: "v2",
179
+ code: "const amount = Number(ctx.formValues?.amount || 0); const taxRate = Number(ctx.formValues?.taxRate || 0); return amount + amount * taxRate;"
180
+ }
181
+ }
182
+ ]
183
+ }
184
+ ]
185
+ }
186
+ ]
187
+ },
188
+ {
189
+ type: "setActionLinkageRules",
190
+ target: "main.employeesTable.refreshAction",
191
+ rules: [
192
+ {
193
+ key: "disableRefresh",
194
+ when: {
195
+ logic: "$and",
196
+ items: [
197
+ {
198
+ path: "params.query.readonly",
199
+ operator: "$isTruly"
200
+ }
201
+ ]
202
+ },
203
+ then: [{ type: "setActionState", state: "disabled" }]
204
+ }
205
+ ]
206
+ }
207
+ ]
208
+ }
209
+ },
210
+ applyBlueprintReplace: {
211
+ version: "1",
212
+ mode: "replace",
213
+ target: {
214
+ pageSchemaUid: "employees-page-schema"
215
+ },
216
+ page: {
217
+ title: "Employees workspace",
218
+ documentTitle: "Employees replace flow",
219
+ displayTitle: false,
220
+ enableTabs: true
221
+ },
222
+ tabs: [
223
+ {
224
+ title: "Overview",
225
+ blocks: [
226
+ {
227
+ key: "employeesTable",
228
+ type: "table",
229
+ collection: "employees",
230
+ fields: ["nickname", "status", "total"]
231
+ }
232
+ ]
233
+ }
234
+ ]
235
+ },
236
+ setFieldValueRules: {
237
+ target: {
238
+ uid: "employees-form-uid"
239
+ },
240
+ rules: [
241
+ {
242
+ key: "defaultStatus",
243
+ targetPath: "status",
244
+ mode: "default",
245
+ value: {
246
+ source: "literal",
247
+ value: "draft"
248
+ }
249
+ }
250
+ ],
251
+ expectedFingerprint: "field-value-fp-1"
252
+ },
253
+ setBlockLinkageRules: {
254
+ target: {
255
+ uid: "employees-table-uid"
256
+ },
257
+ rules: [
258
+ {
259
+ key: "hideTable",
260
+ when: {
261
+ logic: "$and",
262
+ items: [
263
+ {
264
+ path: "params.query.hideTable",
265
+ operator: "$isTruly"
266
+ }
267
+ ]
268
+ },
269
+ then: [{ type: "setBlockState", state: "hidden" }]
270
+ }
271
+ ],
272
+ expectedFingerprint: "block-linkage-fp-1"
273
+ },
274
+ setFieldLinkageRules: {
275
+ target: {
276
+ uid: "employees-form-uid"
277
+ },
278
+ rules: [
279
+ {
280
+ key: "recomputeTotals",
281
+ when: {
282
+ logic: "$and",
283
+ items: [
284
+ {
285
+ path: "formValues.amount",
286
+ operator: "$notEmpty"
287
+ }
288
+ ]
289
+ },
290
+ then: [
291
+ {
292
+ type: "assignField",
293
+ items: [
294
+ {
295
+ targetPath: "subtotal",
296
+ value: {
297
+ source: "runjs",
298
+ version: "v2",
299
+ code: "const amount = Number(ctx.formValues?.amount || 0); return amount;"
300
+ }
301
+ },
302
+ {
303
+ targetPath: "total",
304
+ value: {
305
+ source: "runjs",
306
+ version: "v2",
307
+ code: "const amount = Number(ctx.formValues?.amount || 0); const taxRate = Number(ctx.formValues?.taxRate || 0); return amount + amount * taxRate;"
308
+ }
309
+ }
310
+ ]
311
+ }
312
+ ]
313
+ }
314
+ ],
315
+ expectedFingerprint: "field-linkage-fp-1"
316
+ },
317
+ setActionLinkageRules: {
318
+ target: {
319
+ uid: "refresh-action-uid"
320
+ },
321
+ expectedFingerprint: "action-linkage-fp-1",
322
+ rules: [
323
+ {
324
+ key: "disableRefresh",
325
+ when: {
326
+ logic: "$and",
327
+ items: [
328
+ {
329
+ path: "params.query.readonly",
330
+ operator: "$isTruly"
331
+ }
332
+ ]
333
+ },
334
+ then: [{ type: "setActionState", state: "disabled" }]
335
+ }
336
+ ]
337
+ },
338
+ compose: {
339
+ target: {
340
+ uid: "page-grid-uid"
341
+ },
342
+ mode: "append",
343
+ blocks: [
344
+ {
345
+ key: "filter",
346
+ type: "filterForm",
347
+ resource: {
348
+ dataSourceKey: "main",
349
+ collectionName: "users"
350
+ },
351
+ fields: [
352
+ {
353
+ fieldPath: "username",
354
+ target: "table"
355
+ },
356
+ {
357
+ fieldPath: "nickname",
358
+ target: "table"
359
+ }
360
+ ],
361
+ actions: ["submit", "reset", "collapse"]
362
+ },
363
+ {
364
+ key: "table",
365
+ type: "table",
366
+ resource: {
367
+ dataSourceKey: "main",
368
+ collectionName: "users"
369
+ },
370
+ fields: ["username", "nickname", { fieldPath: "roles.title" }],
371
+ actions: ["filter", "addNew", "refresh", "bulkDelete", "link"],
372
+ recordActions: [
373
+ "view",
374
+ "edit",
375
+ {
376
+ type: "popup",
377
+ popup: {
378
+ mode: "replace",
379
+ blocks: [
380
+ {
381
+ key: "details",
382
+ type: "details",
383
+ resource: {
384
+ dataSourceKey: "main",
385
+ collectionName: "users"
386
+ },
387
+ fields: ["username", "nickname"]
388
+ }
389
+ ]
390
+ }
391
+ },
392
+ "updateRecord",
393
+ "delete"
394
+ ]
395
+ }
396
+ ],
397
+ layout: {
398
+ rows: [
399
+ [
400
+ {
401
+ key: "filter",
402
+ span: 3
403
+ },
404
+ {
405
+ key: "table",
406
+ span: 7
407
+ }
408
+ ]
409
+ ]
410
+ }
411
+ },
412
+ composeStatic: {
413
+ target: {
414
+ uid: "page-grid-uid"
415
+ },
416
+ blocks: [
417
+ {
418
+ key: "markdown",
419
+ type: "markdown",
420
+ settings: {
421
+ content: "# Team handbook"
422
+ }
423
+ },
424
+ {
425
+ key: "iframe",
426
+ type: "iframe",
427
+ settings: {
428
+ mode: "url",
429
+ url: "https://example.com/embed",
430
+ height: 360
431
+ }
432
+ },
433
+ {
434
+ key: "panel",
435
+ type: "actionPanel",
436
+ settings: {
437
+ layout: "list",
438
+ ellipsis: false
439
+ }
440
+ }
441
+ ],
442
+ layout: {
443
+ rows: [["markdown", "iframe"], ["panel"]]
444
+ }
445
+ },
446
+ composeListRich: {
447
+ target: {
448
+ uid: "page-grid-uid"
449
+ },
450
+ blocks: [
451
+ {
452
+ key: "employeesList",
453
+ type: "list",
454
+ resource: {
455
+ dataSourceKey: "main",
456
+ collectionName: "employees"
457
+ },
458
+ fields: [
459
+ "nickname",
460
+ {
461
+ fieldPath: "department.name"
462
+ }
463
+ ],
464
+ actions: ["addNew", "refresh"],
465
+ recordActions: [
466
+ "view",
467
+ "edit",
468
+ {
469
+ type: "popup",
470
+ popup: {
471
+ mode: "replace",
472
+ blocks: [
473
+ {
474
+ key: "details",
475
+ type: "details",
476
+ resource: {
477
+ dataSourceKey: "main",
478
+ collectionName: "employees"
479
+ },
480
+ fields: ["nickname"]
481
+ }
482
+ ]
483
+ }
484
+ },
485
+ "delete"
486
+ ],
487
+ settings: {
488
+ pageSize: 20,
489
+ layout: "vertical"
490
+ }
491
+ }
492
+ ]
493
+ },
494
+ composeGridCardRich: {
495
+ target: {
496
+ uid: "page-grid-uid"
497
+ },
498
+ blocks: [
499
+ {
500
+ key: "employeeCards",
501
+ type: "gridCard",
502
+ resource: {
503
+ dataSourceKey: "main",
504
+ collectionName: "employees"
505
+ },
506
+ fields: [
507
+ "nickname",
508
+ {
509
+ fieldPath: "department.name"
510
+ }
511
+ ],
512
+ actions: ["addNew", "refresh"],
513
+ recordActions: ["view", "edit", "updateRecord", "delete"],
514
+ settings: {
515
+ columns: 3,
516
+ rowCount: 2,
517
+ layout: "vertical"
518
+ }
519
+ }
520
+ ]
521
+ },
522
+ composeJsBlock: {
523
+ target: {
524
+ uid: "page-grid-uid"
525
+ },
526
+ blocks: [
527
+ {
528
+ key: "customHero",
529
+ type: "jsBlock",
530
+ settings: {
531
+ title: "Custom hero",
532
+ description: "Rendered by JS block runtime",
533
+ className: "hero-shell",
534
+ version: "1.0.0",
535
+ code: "ctx.render('<div>Hello from JS block</div>');"
536
+ }
537
+ }
538
+ ]
539
+ },
540
+ configure: {
541
+ target: {
542
+ uid: "details-field-uid"
543
+ },
544
+ changes: {
545
+ clickToOpen: true,
546
+ openView: {
547
+ dataSourceKey: "main",
548
+ collectionName: "departments",
549
+ associationName: "users.department",
550
+ mode: "drawer"
551
+ }
552
+ }
553
+ },
554
+ configureAssociationPopup: {
555
+ target: {
556
+ uid: "roles-field-wrapper-uid"
557
+ },
558
+ changes: {
559
+ clickToOpen: true,
560
+ openView: {
561
+ dataSourceKey: "main",
562
+ collectionName: "roles",
563
+ associationName: "users.roles",
564
+ mode: "drawer"
565
+ }
566
+ }
567
+ },
568
+ configureBlock: {
569
+ target: {
570
+ uid: "list-block-uid"
571
+ },
572
+ changes: {
573
+ pageSize: 50,
574
+ dataScope: {
575
+ logic: "$and",
576
+ items: [
577
+ {
578
+ path: "nickname",
579
+ operator: "$eq",
580
+ value: "beta"
581
+ }
582
+ ]
583
+ },
584
+ sorting: [
585
+ {
586
+ field: "username",
587
+ direction: "asc"
588
+ }
589
+ ],
590
+ layout: "vertical"
591
+ }
592
+ },
593
+ createMenu: {
594
+ title: "Employees",
595
+ type: "item",
596
+ parentMenuRouteId: 1001
597
+ },
598
+ updateMenu: {
599
+ menuRouteId: 1002,
600
+ title: "Employees Center",
601
+ parentMenuRouteId: null
602
+ },
603
+ configureAction: {
604
+ target: {
605
+ uid: "update-record-action-uid"
606
+ },
607
+ changes: {
608
+ title: "Quick update",
609
+ type: "primary",
610
+ color: "gold",
611
+ htmlType: "button",
612
+ position: "end",
613
+ confirm: {
614
+ enable: true,
615
+ title: "Confirm update",
616
+ content: "Apply assigned values?"
617
+ },
618
+ assignValues: {
619
+ status: "active"
620
+ }
621
+ }
622
+ },
623
+ configureJsBlock: {
624
+ target: {
625
+ uid: "js-block-uid"
626
+ },
627
+ changes: {
628
+ title: "Users hero",
629
+ description: "Rendered from FlowSurfaces configure",
630
+ className: "users-hero",
631
+ version: "1.0.1",
632
+ code: "ctx.render('<div>Users hero</div>');"
633
+ }
634
+ },
635
+ configureJsAction: {
636
+ target: {
637
+ uid: "js-action-uid"
638
+ },
639
+ changes: {
640
+ title: "Run diagnostics",
641
+ type: "primary",
642
+ version: "1.0.1",
643
+ code: `await ctx.runjs('console.log("diagnostics")');`
644
+ }
645
+ },
646
+ configureJsItemAction: {
647
+ target: {
648
+ uid: "js-item-action-uid"
649
+ },
650
+ changes: {
651
+ title: "Run item diagnostics",
652
+ type: "default",
653
+ version: "1.0.1",
654
+ code: `await ctx.runjs('console.log("item diagnostics")');`
655
+ }
656
+ },
657
+ configureJsField: {
658
+ target: {
659
+ uid: "js-field-wrapper-uid"
660
+ },
661
+ changes: {
662
+ label: "Custom renderer",
663
+ version: "1.0.1",
664
+ code: "ctx.render(String(ctx.record?.nickname?.toUpperCase?.() || ''));"
665
+ }
666
+ },
667
+ configureJsColumn: {
668
+ target: {
669
+ uid: "js-column-uid"
670
+ },
671
+ changes: {
672
+ title: "JS column",
673
+ width: 240,
674
+ fixed: "left",
675
+ version: "1.0.1",
676
+ code: "ctx.render(String(ctx.record?.username || ''));"
677
+ }
678
+ },
679
+ configureJsItem: {
680
+ target: {
681
+ uid: "js-item-uid"
682
+ },
683
+ changes: {
684
+ label: "JS item",
685
+ showLabel: true,
686
+ labelWidth: 120,
687
+ version: "1.0.1",
688
+ code: "ctx.render(String(ctx.record?.nickname || ''));"
689
+ }
690
+ },
691
+ configurePage: {
692
+ target: {
693
+ uid: "employees-page-uid"
694
+ },
695
+ changes: {
696
+ icon: "UserOutlined",
697
+ enableHeader: false
698
+ }
699
+ },
700
+ configureTableAdvanced: {
701
+ target: {
702
+ uid: "tree-table-block-uid"
703
+ },
704
+ changes: {
705
+ quickEdit: true,
706
+ treeTable: true,
707
+ defaultExpandAllRows: true,
708
+ dragSort: true,
709
+ dragSortBy: "sort"
710
+ }
711
+ },
712
+ configureEditForm: {
713
+ target: {
714
+ uid: "edit-form-block-uid"
715
+ },
716
+ changes: {
717
+ colon: false,
718
+ dataScope: {
719
+ logic: "$and",
720
+ items: [
721
+ {
722
+ path: "status",
723
+ operator: "$eq",
724
+ value: "draft"
725
+ }
726
+ ]
727
+ }
728
+ }
729
+ },
730
+ configureDetailsCompatibility: {
731
+ target: {
732
+ uid: "details-block-uid"
733
+ },
734
+ changes: {
735
+ colon: true,
736
+ linkageRules: [
737
+ {
738
+ when: {
739
+ path: "status",
740
+ operator: "$eq",
741
+ value: "archived"
742
+ },
743
+ set: {
744
+ hidden: true
745
+ }
746
+ }
747
+ ]
748
+ }
749
+ },
750
+ composePopupCurrentRecord: {
751
+ target: {
752
+ uid: "view-action-uid"
753
+ },
754
+ mode: "replace",
755
+ blocks: [
756
+ {
757
+ key: "details",
758
+ type: "details",
759
+ resource: {
760
+ binding: "currentRecord"
761
+ },
762
+ fields: ["nickname", "department.title"]
763
+ }
764
+ ]
765
+ },
766
+ composePopupAssociatedRecords: {
767
+ target: {
768
+ uid: "association-popup-action-uid"
769
+ },
770
+ mode: "replace",
771
+ blocks: [
772
+ {
773
+ key: "employees",
774
+ type: "table",
775
+ resource: {
776
+ binding: "associatedRecords",
777
+ associationField: "employee"
778
+ },
779
+ fields: ["nickname", "status"],
780
+ actions: ["refresh"],
781
+ recordActions: ["view", "edit"]
782
+ }
783
+ ]
784
+ },
785
+ configureActionModesCompatibility: {
786
+ target: {
787
+ uid: "compose-email-action-uid"
788
+ },
789
+ changes: {
790
+ linkageRules: [
791
+ {
792
+ when: {
793
+ path: "status",
794
+ operator: "$eq",
795
+ value: "draft"
796
+ },
797
+ set: {
798
+ disabled: true
799
+ }
800
+ }
801
+ ],
802
+ editMode: "drawer",
803
+ updateMode: "overwrite",
804
+ duplicateMode: "popup",
805
+ collapsedRows: 2,
806
+ defaultCollapsed: true,
807
+ emailFieldNames: ["email", "backupEmail"],
808
+ defaultSelectAllRecords: true
809
+ }
810
+ },
811
+ createPage: {
812
+ menuRouteId: 1002,
813
+ title: "Employees",
814
+ tabTitle: "Overview",
815
+ enableTabs: true,
816
+ displayTitle: true,
817
+ documentTitle: "Employees workspace",
818
+ tabDocumentTitle: "Employees overview"
819
+ },
820
+ addTab: {
821
+ target: {
822
+ uid: "employees-page-uid"
823
+ },
824
+ title: "Details",
825
+ icon: "TableOutlined",
826
+ documentTitle: "Employee details tab"
827
+ },
828
+ updateTab: {
829
+ target: {
830
+ uid: "details-tab-schema"
831
+ },
832
+ title: "Details",
833
+ icon: "TableOutlined",
834
+ documentTitle: "Employee details tab",
835
+ flowRegistry: {
836
+ beforeRenderApply: {
837
+ key: "beforeRenderApply",
838
+ on: "beforeRender",
839
+ steps: {}
840
+ }
841
+ }
842
+ },
843
+ addPopupTab: {
844
+ target: {
845
+ uid: "view-action-popup-page-uid"
846
+ },
847
+ title: "Popup details",
848
+ icon: "TableOutlined",
849
+ documentTitle: "Popup details tab"
850
+ },
851
+ updatePopupTab: {
852
+ target: {
853
+ uid: "popup-secondary-tab-uid"
854
+ },
855
+ title: "Popup details updated",
856
+ icon: "AppstoreOutlined",
857
+ documentTitle: "Popup details updated tab",
858
+ flowRegistry: {
859
+ beforeRenderApply: {
860
+ key: "beforeRenderApply",
861
+ on: "beforeRender",
862
+ steps: {}
863
+ }
864
+ }
865
+ },
866
+ movePopupTab: {
867
+ sourceUid: "popup-secondary-tab-uid",
868
+ targetUid: "popup-primary-tab-uid",
869
+ position: "before"
870
+ },
871
+ removePopupTab: {
872
+ target: {
873
+ uid: "popup-secondary-tab-uid"
874
+ }
875
+ },
876
+ addBlock: {
877
+ target: {
878
+ uid: "view-action-uid"
879
+ },
880
+ type: "details",
881
+ resource: {
882
+ binding: "currentRecord"
883
+ }
884
+ },
885
+ addPopupAssociatedBlock: {
886
+ target: {
887
+ uid: "association-popup-action-uid"
888
+ },
889
+ type: "table",
890
+ resource: {
891
+ binding: "associatedRecords",
892
+ associationField: "employee"
893
+ }
894
+ },
895
+ addPopupOtherRecordsBlock: {
896
+ target: {
897
+ uid: "popup-action-uid"
898
+ },
899
+ type: "table",
900
+ resource: {
901
+ binding: "otherRecords",
902
+ dataSourceKey: "main",
903
+ collectionName: "departments"
904
+ }
905
+ },
906
+ addJsBlock: {
907
+ target: {
908
+ uid: "page-grid-uid"
909
+ },
910
+ type: "jsBlock",
911
+ settings: {
912
+ title: "Users banner",
913
+ description: "Custom JS rendered banner",
914
+ version: "1.0.0",
915
+ code: "ctx.render('<div>Users banner</div>');"
916
+ }
917
+ },
918
+ addField: {
919
+ target: {
920
+ uid: "create-form-block-uid"
921
+ },
922
+ fieldPath: "nickname",
923
+ renderer: "js",
924
+ settings: {
925
+ label: "Nickname (JS)",
926
+ code: "ctx.render(String(ctx.value?.toUpperCase?.() || ctx.value || ''));",
927
+ version: "1.0.0"
928
+ }
929
+ },
930
+ addAssociationField: {
931
+ target: {
932
+ uid: "table-block-uid"
933
+ },
934
+ fieldPath: "title",
935
+ associationPathName: "department",
936
+ settings: {
937
+ title: "Department title",
938
+ width: 240
939
+ },
940
+ popup: {
941
+ mode: "replace",
942
+ blocks: [
943
+ {
944
+ key: "departmentDetails",
945
+ type: "details",
946
+ resource: {
947
+ binding: "currentRecord"
948
+ },
949
+ fields: ["title", "manager.nickname"]
950
+ }
951
+ ]
952
+ }
953
+ },
954
+ addJsColumn: {
955
+ target: {
956
+ uid: "table-block-uid"
957
+ },
958
+ type: "jsColumn",
959
+ settings: {
960
+ title: "Runtime column",
961
+ width: 240,
962
+ version: "1.0.0",
963
+ code: "ctx.render(String(ctx.record?.nickname || ''));"
964
+ }
965
+ },
966
+ addJsItem: {
967
+ target: {
968
+ uid: "create-form-grid-uid"
969
+ },
970
+ type: "jsItem",
971
+ settings: {
972
+ label: "Runtime item",
973
+ showLabel: true,
974
+ version: "1.0.0",
975
+ code: "ctx.render(String(ctx.record?.nickname || ''));"
976
+ }
977
+ },
978
+ addFieldPopupTemplate: {
979
+ target: {
980
+ uid: "details-block-uid"
981
+ },
982
+ fieldPath: "nickname",
983
+ popup: {
984
+ template: {
985
+ uid: "employee-popup-template",
986
+ mode: "reference"
987
+ }
988
+ }
989
+ },
990
+ addAction: {
991
+ target: {
992
+ uid: "filter-form-block-uid"
993
+ },
994
+ type: "submit",
995
+ settings: {
996
+ title: "Apply filters",
997
+ confirm: false
998
+ }
999
+ },
1000
+ addLinkAction: {
1001
+ target: {
1002
+ uid: "table-block-uid"
1003
+ },
1004
+ type: "link",
1005
+ settings: {
1006
+ title: "Open docs"
1007
+ }
1008
+ },
1009
+ addJsAction: {
1010
+ target: {
1011
+ uid: "action-panel-uid"
1012
+ },
1013
+ type: "js",
1014
+ settings: {
1015
+ title: "Run JS",
1016
+ type: "primary",
1017
+ version: "1.0.0",
1018
+ code: `await ctx.runjs('console.log("hello")');`
1019
+ }
1020
+ },
1021
+ addJsItemAction: {
1022
+ target: {
1023
+ uid: "create-form-uid"
1024
+ },
1025
+ type: "jsItem",
1026
+ settings: {
1027
+ title: "Run item JS",
1028
+ type: "default",
1029
+ version: "1.0.0",
1030
+ code: `await ctx.runjs('console.log("item")');`
1031
+ }
1032
+ },
1033
+ addRecordAction: {
1034
+ target: {
1035
+ uid: "table-block-uid"
1036
+ },
1037
+ type: "view",
1038
+ settings: {
1039
+ title: "View user",
1040
+ openView: {
1041
+ dataSourceKey: "main",
1042
+ collectionName: "users",
1043
+ mode: "drawer"
1044
+ }
1045
+ },
1046
+ popup: {
1047
+ mode: "replace",
1048
+ blocks: [
1049
+ {
1050
+ key: "details",
1051
+ type: "details",
1052
+ resource: {
1053
+ dataSourceKey: "main",
1054
+ collectionName: "users"
1055
+ },
1056
+ fields: ["username", "nickname"]
1057
+ }
1058
+ ]
1059
+ }
1060
+ },
1061
+ addRecordAddChildAction: {
1062
+ target: {
1063
+ uid: "tree-table-block-uid"
1064
+ },
1065
+ type: "addChild",
1066
+ settings: {
1067
+ title: "Add child category",
1068
+ openView: {
1069
+ dataSourceKey: "main",
1070
+ collectionName: "categories",
1071
+ mode: "drawer"
1072
+ }
1073
+ }
1074
+ },
1075
+ addRecordJsAction: {
1076
+ target: {
1077
+ uid: "details-block-uid"
1078
+ },
1079
+ type: "js",
1080
+ settings: {
1081
+ title: "Inspect record",
1082
+ type: "default",
1083
+ version: "1.0.0",
1084
+ code: "return currentRecord?.id;"
1085
+ }
1086
+ },
1087
+ addBlocks: {
1088
+ target: {
1089
+ uid: "page-grid-uid"
1090
+ },
1091
+ blocks: [
1092
+ {
1093
+ key: "usersTable",
1094
+ type: "table",
1095
+ resourceInit: {
1096
+ dataSourceKey: "main",
1097
+ collectionName: "users"
1098
+ },
1099
+ settings: {
1100
+ title: "Users table",
1101
+ pageSize: 50
1102
+ }
1103
+ },
1104
+ {
1105
+ key: "teamNotes",
1106
+ type: "markdown",
1107
+ settings: {
1108
+ content: "# Team notes"
1109
+ }
1110
+ }
1111
+ ]
1112
+ },
1113
+ addFields: {
1114
+ target: {
1115
+ uid: "table-block-uid"
1116
+ },
1117
+ fields: [
1118
+ {
1119
+ key: "username",
1120
+ fieldPath: "username",
1121
+ settings: {
1122
+ title: "User name",
1123
+ width: 220
1124
+ },
1125
+ popup: {
1126
+ mode: "replace",
1127
+ blocks: [
1128
+ {
1129
+ key: "details",
1130
+ type: "details",
1131
+ resource: {
1132
+ binding: "currentRecord"
1133
+ },
1134
+ fields: ["username", "nickname"]
1135
+ }
1136
+ ]
1137
+ }
1138
+ },
1139
+ {
1140
+ key: "nickname",
1141
+ fieldPath: "nickname",
1142
+ renderer: "js",
1143
+ settings: {
1144
+ label: "Nickname (JS)",
1145
+ code: "return value;",
1146
+ version: "1.0.0"
1147
+ }
1148
+ }
1149
+ ]
1150
+ },
1151
+ addActions: {
1152
+ target: {
1153
+ uid: "filter-form-block-uid"
1154
+ },
1155
+ actions: [
1156
+ {
1157
+ key: "submit",
1158
+ type: "submit",
1159
+ settings: {
1160
+ title: "Search",
1161
+ confirm: false
1162
+ }
1163
+ },
1164
+ {
1165
+ key: "reset",
1166
+ type: "reset",
1167
+ settings: {
1168
+ title: "Reset filters"
1169
+ }
1170
+ }
1171
+ ]
1172
+ },
1173
+ addRecordActions: {
1174
+ target: {
1175
+ uid: "table-block-uid"
1176
+ },
1177
+ recordActions: [
1178
+ {
1179
+ key: "view",
1180
+ type: "view",
1181
+ settings: {
1182
+ title: "View user",
1183
+ openView: {
1184
+ dataSourceKey: "main",
1185
+ collectionName: "users",
1186
+ mode: "drawer"
1187
+ }
1188
+ },
1189
+ popup: {
1190
+ mode: "replace",
1191
+ blocks: [
1192
+ {
1193
+ key: "details",
1194
+ type: "details",
1195
+ resource: {
1196
+ dataSourceKey: "main",
1197
+ collectionName: "users"
1198
+ },
1199
+ fields: ["username"]
1200
+ }
1201
+ ]
1202
+ }
1203
+ },
1204
+ {
1205
+ key: "edit",
1206
+ type: "edit",
1207
+ settings: {
1208
+ title: "Edit user"
1209
+ }
1210
+ },
1211
+ {
1212
+ key: "delete",
1213
+ type: "delete",
1214
+ settings: {
1215
+ title: "Delete user"
1216
+ }
1217
+ }
1218
+ ]
1219
+ },
1220
+ addRecordAddChildActions: {
1221
+ target: {
1222
+ uid: "tree-table-block-uid"
1223
+ },
1224
+ recordActions: [
1225
+ {
1226
+ key: "addChild",
1227
+ type: "addChild",
1228
+ settings: {
1229
+ title: "Add child category",
1230
+ openView: {
1231
+ dataSourceKey: "main",
1232
+ collectionName: "categories",
1233
+ mode: "drawer"
1234
+ }
1235
+ }
1236
+ }
1237
+ ]
1238
+ },
1239
+ updateSettings: {
1240
+ target: {
1241
+ uid: "table-block-uid"
1242
+ },
1243
+ stepParams: {
1244
+ tableSettings: {
1245
+ pageSize: {
1246
+ pageSize: 50
1247
+ },
1248
+ tableDensity: {
1249
+ size: "middle"
1250
+ }
1251
+ }
1252
+ },
1253
+ flowRegistry: {
1254
+ beforeRenderApply: {
1255
+ key: "beforeRenderApply",
1256
+ on: "beforeRender",
1257
+ steps: {}
1258
+ }
1259
+ }
1260
+ },
1261
+ setEventFlows: {
1262
+ target: {
1263
+ uid: "view-action-uid"
1264
+ },
1265
+ flowRegistry: {
1266
+ popupSettings: {
1267
+ key: "popupSettings",
1268
+ on: "click",
1269
+ steps: {
1270
+ openView: {
1271
+ params: {
1272
+ title: "Employee details",
1273
+ size: "large"
1274
+ }
1275
+ }
1276
+ }
1277
+ }
1278
+ }
1279
+ },
1280
+ setLayout: {
1281
+ target: {
1282
+ uid: "page-grid-uid"
1283
+ },
1284
+ rows: {
1285
+ row1: [["block-a"], ["block-b"]]
1286
+ },
1287
+ sizes: {
1288
+ row1: [12, 12]
1289
+ },
1290
+ rowOrder: ["row1"]
1291
+ },
1292
+ moveNode: {
1293
+ sourceUid: "block-b",
1294
+ targetUid: "block-a",
1295
+ position: "before"
1296
+ },
1297
+ removeNode: {
1298
+ target: {
1299
+ uid: "obsolete-block-uid"
1300
+ }
1301
+ },
1302
+ mutate: {
1303
+ atomic: true,
1304
+ ops: [
1305
+ {
1306
+ opId: "menu",
1307
+ type: "createMenu",
1308
+ values: {
1309
+ title: "Employees",
1310
+ type: "item"
1311
+ }
1312
+ },
1313
+ {
1314
+ opId: "page",
1315
+ type: "createPage",
1316
+ values: {
1317
+ menuRouteId: {
1318
+ step: "menu",
1319
+ path: "routeId"
1320
+ },
1321
+ tabTitle: "Overview"
1322
+ }
1323
+ },
1324
+ {
1325
+ opId: "table",
1326
+ type: "addBlock",
1327
+ values: {
1328
+ target: {
1329
+ uid: {
1330
+ step: "page",
1331
+ path: "tabSchemaUid"
1332
+ }
1333
+ },
1334
+ type: "table",
1335
+ resourceInit: {
1336
+ dataSourceKey: "main",
1337
+ collectionName: "employees"
1338
+ }
1339
+ }
1340
+ },
1341
+ {
1342
+ type: "addField",
1343
+ values: {
1344
+ target: {
1345
+ uid: {
1346
+ step: "table",
1347
+ path: "uid"
1348
+ }
1349
+ },
1350
+ fieldPath: "nickname"
1351
+ }
1352
+ }
1353
+ ]
1354
+ },
1355
+ apply: {
1356
+ target: {
1357
+ uid: "page-grid-uid"
1358
+ },
1359
+ mode: "replace",
1360
+ spec: {
1361
+ subModels: {
1362
+ items: [
1363
+ {
1364
+ clientKey: "table-a",
1365
+ use: "TableBlockModel",
1366
+ stepParams: {
1367
+ resourceSettings: {
1368
+ init: {
1369
+ dataSourceKey: "main",
1370
+ collectionName: "employees"
1371
+ }
1372
+ }
1373
+ }
1374
+ },
1375
+ {
1376
+ clientKey: "markdown-a",
1377
+ use: "MarkdownBlockModel",
1378
+ props: {
1379
+ content: "Employee handbook"
1380
+ }
1381
+ }
1382
+ ]
1383
+ }
1384
+ }
1385
+ },
1386
+ getPopupQuery: {
1387
+ uid: "view-action-uid"
1388
+ },
1389
+ getPageQuery: {
1390
+ pageSchemaUid: "employees-page-schema"
1391
+ }
1392
+ };
1393
+ // Annotate the CommonJS export names for ESM import in node:
1394
+ 0 && (module.exports = {
1395
+ flowSurfaceExamples
1396
+ });