@nordcraft/runtime 1.0.46 → 1.0.47
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/dist/custom-element.main.esm.js +21 -21
- package/dist/custom-element.main.esm.js.map +3 -3
- package/dist/events/handleAction.d.ts +1 -1
- package/dist/events/handleAction.js +36 -6
- package/dist/events/handleAction.js.map +1 -1
- package/dist/page.main.esm.js +3 -3
- package/dist/page.main.esm.js.map +3 -3
- package/package.json +3 -3
- package/src/events/handleAction.ts +58 -2
package/package.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"type": "module",
|
|
5
5
|
"homepage": "https://github.com/nordcraftengine/nordcraft",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@nordcraft/core": "1.0.
|
|
8
|
-
"@nordcraft/std-lib": "1.0.
|
|
7
|
+
"@nordcraft/core": "1.0.47",
|
|
8
|
+
"@nordcraft/std-lib": "1.0.47",
|
|
9
9
|
"fast-deep-equal": "3.1.3",
|
|
10
10
|
"path-to-regexp": "6.3.0"
|
|
11
11
|
},
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"files": ["dist", "src"],
|
|
22
22
|
"main": "dist/page.main.js",
|
|
23
23
|
"types": "dist/page.main.d.ts",
|
|
24
|
-
"version": "1.0.
|
|
24
|
+
"version": "1.0.47"
|
|
25
25
|
}
|
|
@@ -19,6 +19,7 @@ export function handleAction(
|
|
|
19
19
|
data: ComponentData,
|
|
20
20
|
ctx: ComponentContext,
|
|
21
21
|
event?: Event,
|
|
22
|
+
workflowCallback?: (event: string, data: unknown) => void,
|
|
22
23
|
) {
|
|
23
24
|
try {
|
|
24
25
|
if (!action) {
|
|
@@ -48,7 +49,13 @@ export function handleAction(
|
|
|
48
49
|
// handle all actions for the case
|
|
49
50
|
for (const action of actionList.actions) {
|
|
50
51
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
51
|
-
handleAction(
|
|
52
|
+
handleAction(
|
|
53
|
+
action,
|
|
54
|
+
{ ...data, ...ctx.dataSignal.get() },
|
|
55
|
+
ctx,
|
|
56
|
+
event,
|
|
57
|
+
workflowCallback,
|
|
58
|
+
)
|
|
52
59
|
}
|
|
53
60
|
break
|
|
54
61
|
}
|
|
@@ -86,6 +93,19 @@ export function handleAction(
|
|
|
86
93
|
ctx.triggerEvent(action.event, payload)
|
|
87
94
|
break
|
|
88
95
|
}
|
|
96
|
+
case 'TriggerWorkflowCallback': {
|
|
97
|
+
const payload = applyFormula(action.data, {
|
|
98
|
+
data,
|
|
99
|
+
component: ctx.component,
|
|
100
|
+
formulaCache: ctx.formulaCache,
|
|
101
|
+
root: ctx.root,
|
|
102
|
+
package: ctx.package,
|
|
103
|
+
toddle: ctx.toddle,
|
|
104
|
+
env: ctx.env,
|
|
105
|
+
})
|
|
106
|
+
workflowCallback?.(action.event, payload)
|
|
107
|
+
break
|
|
108
|
+
}
|
|
89
109
|
case 'SetURLParameter': {
|
|
90
110
|
ctx.toddle.locationSignal.update((current) => {
|
|
91
111
|
const value = applyFormula(action.data, {
|
|
@@ -271,6 +291,7 @@ export function handleAction(
|
|
|
271
291
|
{ ...data, ...ctx.dataSignal.get() },
|
|
272
292
|
ctx,
|
|
273
293
|
event,
|
|
294
|
+
workflowCallback,
|
|
274
295
|
)
|
|
275
296
|
}
|
|
276
297
|
}
|
|
@@ -298,7 +319,7 @@ export function handleAction(
|
|
|
298
319
|
env: ctx.env,
|
|
299
320
|
}),
|
|
300
321
|
)
|
|
301
|
-
|
|
322
|
+
const callbacks = action.callbacks
|
|
302
323
|
if (action.contextProvider) {
|
|
303
324
|
const provider =
|
|
304
325
|
ctx.providers[
|
|
@@ -324,6 +345,23 @@ export function handleAction(
|
|
|
324
345
|
},
|
|
325
346
|
provider.ctx,
|
|
326
347
|
event,
|
|
348
|
+
(callbackName, callbackData) => {
|
|
349
|
+
const callback = callbacks?.[callbackName]
|
|
350
|
+
callback?.actions.forEach((action) =>
|
|
351
|
+
handleAction(
|
|
352
|
+
action,
|
|
353
|
+
{
|
|
354
|
+
...data,
|
|
355
|
+
...ctx.dataSignal.get(),
|
|
356
|
+
Parameters: parameters,
|
|
357
|
+
Event: callbackData,
|
|
358
|
+
},
|
|
359
|
+
ctx,
|
|
360
|
+
event,
|
|
361
|
+
workflowCallback,
|
|
362
|
+
),
|
|
363
|
+
)
|
|
364
|
+
},
|
|
327
365
|
),
|
|
328
366
|
)
|
|
329
367
|
return
|
|
@@ -347,6 +385,23 @@ export function handleAction(
|
|
|
347
385
|
},
|
|
348
386
|
ctx,
|
|
349
387
|
event,
|
|
388
|
+
(callbackName, callbackData) => {
|
|
389
|
+
const callback = callbacks?.[callbackName]
|
|
390
|
+
callback?.actions.forEach((action) =>
|
|
391
|
+
handleAction(
|
|
392
|
+
action,
|
|
393
|
+
{
|
|
394
|
+
...data,
|
|
395
|
+
...ctx.dataSignal.get(),
|
|
396
|
+
Parameters: parameters,
|
|
397
|
+
Event: callbackData,
|
|
398
|
+
},
|
|
399
|
+
ctx,
|
|
400
|
+
event,
|
|
401
|
+
workflowCallback,
|
|
402
|
+
),
|
|
403
|
+
)
|
|
404
|
+
},
|
|
350
405
|
),
|
|
351
406
|
)
|
|
352
407
|
break
|
|
@@ -365,6 +420,7 @@ export function handleAction(
|
|
|
365
420
|
: { ...data, ...ctx.dataSignal.get() },
|
|
366
421
|
ctx,
|
|
367
422
|
eventData ?? event,
|
|
423
|
+
workflowCallback,
|
|
368
424
|
),
|
|
369
425
|
)
|
|
370
426
|
}
|