@json-render/vue 0.17.0 → 0.19.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/dist/index.d.mts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +226 -135
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +235 -137
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { PropType, ShallowRef, ComputedRef, VNode, Ref, Component } from 'vue';
|
|
3
|
-
import { StateStore, StateModel, VisibilityCondition, VisibilityContext, ActionHandler, ResolvedAction, ActionBinding, ActionConfirm, ValidationFunction, ValidationResult, ValidationConfig, Catalog, InferCatalogComponents, InferComponentProps, InferCatalogActions, InferActionParams, Spec, FlatElement, SchemaDefinition, ComputedFunction, UIElement } from '@json-render/core';
|
|
3
|
+
import { StateStore, StateModel, VisibilityCondition, VisibilityContext, ActionHandler, ResolvedAction, ActionBinding, ActionConfirm, ValidationFunction, ValidationResult, ValidationConfig, Catalog, InferCatalogComponents, InferComponentProps, InferCatalogActions, InferActionParams, Spec, FlatElement, SchemaDefinition, ComputedFunction, DirectiveDefinition, UIElement } from '@json-render/core';
|
|
4
4
|
export { ComputedFunction, Spec, StateModel, StateStore, createStateStore } from '@json-render/core';
|
|
5
5
|
export { VueSchema, VueSpec, schema } from './schema.mjs';
|
|
6
|
+
import * as zod from 'zod';
|
|
7
|
+
import * as zod_v4_core from 'zod/v4/core';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* State context value
|
|
@@ -708,6 +710,8 @@ interface JSONUIProviderProps {
|
|
|
708
710
|
validationFunctions?: Record<string, (value: unknown, args?: Record<string, unknown>) => boolean>;
|
|
709
711
|
/** Named functions for `$computed` expressions in props */
|
|
710
712
|
functions?: Record<string, ComputedFunction>;
|
|
713
|
+
/** Custom directives for user-defined `$`-prefixed dynamic values */
|
|
714
|
+
directives?: DirectiveDefinition[];
|
|
711
715
|
onStateChange?: (changes: Array<{
|
|
712
716
|
path: string;
|
|
713
717
|
value: unknown;
|
|
@@ -745,6 +749,10 @@ declare const JSONUIProvider: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
745
749
|
type: PropType<Record<string, ComputedFunction>>;
|
|
746
750
|
default: undefined;
|
|
747
751
|
};
|
|
752
|
+
directives: {
|
|
753
|
+
type: PropType<DirectiveDefinition[]>;
|
|
754
|
+
default: undefined;
|
|
755
|
+
};
|
|
748
756
|
onStateChange: {
|
|
749
757
|
type: PropType<(changes: Array<{
|
|
750
758
|
path: string;
|
|
@@ -783,6 +791,10 @@ declare const JSONUIProvider: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
783
791
|
type: PropType<Record<string, ComputedFunction>>;
|
|
784
792
|
default: undefined;
|
|
785
793
|
};
|
|
794
|
+
directives: {
|
|
795
|
+
type: PropType<DirectiveDefinition[]>;
|
|
796
|
+
default: undefined;
|
|
797
|
+
};
|
|
786
798
|
onStateChange: {
|
|
787
799
|
type: PropType<(changes: Array<{
|
|
788
800
|
path: string;
|
|
@@ -800,6 +812,7 @@ declare const JSONUIProvider: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
800
812
|
handlers: Record<string, (params: Record<string, unknown>) => Promise<unknown> | unknown>;
|
|
801
813
|
navigate: (path: string) => void;
|
|
802
814
|
functions: Record<string, ComputedFunction>;
|
|
815
|
+
directives: DirectiveDefinition<zod.ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>[];
|
|
803
816
|
validationFunctions: Record<string, (value: unknown, args?: Record<string, unknown>) => boolean>;
|
|
804
817
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
805
818
|
/**
|
|
@@ -851,6 +864,8 @@ interface CreateRendererProps {
|
|
|
851
864
|
}>) => void;
|
|
852
865
|
/** Named functions for `$computed` expressions in props */
|
|
853
866
|
functions?: Record<string, ComputedFunction>;
|
|
867
|
+
/** Custom directives for user-defined `$`-prefixed dynamic values */
|
|
868
|
+
directives?: DirectiveDefinition[];
|
|
854
869
|
loading?: boolean;
|
|
855
870
|
fallback?: Component;
|
|
856
871
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { PropType, ShallowRef, ComputedRef, VNode, Ref, Component } from 'vue';
|
|
3
|
-
import { StateStore, StateModel, VisibilityCondition, VisibilityContext, ActionHandler, ResolvedAction, ActionBinding, ActionConfirm, ValidationFunction, ValidationResult, ValidationConfig, Catalog, InferCatalogComponents, InferComponentProps, InferCatalogActions, InferActionParams, Spec, FlatElement, SchemaDefinition, ComputedFunction, UIElement } from '@json-render/core';
|
|
3
|
+
import { StateStore, StateModel, VisibilityCondition, VisibilityContext, ActionHandler, ResolvedAction, ActionBinding, ActionConfirm, ValidationFunction, ValidationResult, ValidationConfig, Catalog, InferCatalogComponents, InferComponentProps, InferCatalogActions, InferActionParams, Spec, FlatElement, SchemaDefinition, ComputedFunction, DirectiveDefinition, UIElement } from '@json-render/core';
|
|
4
4
|
export { ComputedFunction, Spec, StateModel, StateStore, createStateStore } from '@json-render/core';
|
|
5
5
|
export { VueSchema, VueSpec, schema } from './schema.js';
|
|
6
|
+
import * as zod from 'zod';
|
|
7
|
+
import * as zod_v4_core from 'zod/v4/core';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* State context value
|
|
@@ -708,6 +710,8 @@ interface JSONUIProviderProps {
|
|
|
708
710
|
validationFunctions?: Record<string, (value: unknown, args?: Record<string, unknown>) => boolean>;
|
|
709
711
|
/** Named functions for `$computed` expressions in props */
|
|
710
712
|
functions?: Record<string, ComputedFunction>;
|
|
713
|
+
/** Custom directives for user-defined `$`-prefixed dynamic values */
|
|
714
|
+
directives?: DirectiveDefinition[];
|
|
711
715
|
onStateChange?: (changes: Array<{
|
|
712
716
|
path: string;
|
|
713
717
|
value: unknown;
|
|
@@ -745,6 +749,10 @@ declare const JSONUIProvider: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
745
749
|
type: PropType<Record<string, ComputedFunction>>;
|
|
746
750
|
default: undefined;
|
|
747
751
|
};
|
|
752
|
+
directives: {
|
|
753
|
+
type: PropType<DirectiveDefinition[]>;
|
|
754
|
+
default: undefined;
|
|
755
|
+
};
|
|
748
756
|
onStateChange: {
|
|
749
757
|
type: PropType<(changes: Array<{
|
|
750
758
|
path: string;
|
|
@@ -783,6 +791,10 @@ declare const JSONUIProvider: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
783
791
|
type: PropType<Record<string, ComputedFunction>>;
|
|
784
792
|
default: undefined;
|
|
785
793
|
};
|
|
794
|
+
directives: {
|
|
795
|
+
type: PropType<DirectiveDefinition[]>;
|
|
796
|
+
default: undefined;
|
|
797
|
+
};
|
|
786
798
|
onStateChange: {
|
|
787
799
|
type: PropType<(changes: Array<{
|
|
788
800
|
path: string;
|
|
@@ -800,6 +812,7 @@ declare const JSONUIProvider: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
800
812
|
handlers: Record<string, (params: Record<string, unknown>) => Promise<unknown> | unknown>;
|
|
801
813
|
navigate: (path: string) => void;
|
|
802
814
|
functions: Record<string, ComputedFunction>;
|
|
815
|
+
directives: DirectiveDefinition<zod.ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>[];
|
|
803
816
|
validationFunctions: Record<string, (value: unknown, args?: Record<string, unknown>) => boolean>;
|
|
804
817
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
805
818
|
/**
|
|
@@ -851,6 +864,8 @@ interface CreateRendererProps {
|
|
|
851
864
|
}>) => void;
|
|
852
865
|
/** Named functions for `$computed` expressions in props */
|
|
853
866
|
functions?: Record<string, ComputedFunction>;
|
|
867
|
+
/** Custom directives for user-defined `$`-prefixed dynamic values */
|
|
868
|
+
directives?: DirectiveDefinition[];
|
|
854
869
|
loading?: boolean;
|
|
855
870
|
fallback?: Component;
|
|
856
871
|
}
|
package/dist/index.js
CHANGED
|
@@ -422,109 +422,141 @@ var ActionProvider = (0, import_vue4.defineComponent)({
|
|
|
422
422
|
};
|
|
423
423
|
const execute = async (binding) => {
|
|
424
424
|
const resolved = (0, import_core4.resolveAction)(binding, getSnapshot());
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
425
|
+
const dispatchId = (0, import_core4.nextActionDispatchId)();
|
|
426
|
+
const dispatchedAt = Date.now();
|
|
427
|
+
(0, import_core4.notifyActionDispatch)({
|
|
428
|
+
id: dispatchId,
|
|
429
|
+
name: resolved.action,
|
|
430
|
+
params: resolved.params,
|
|
431
|
+
at: dispatchedAt
|
|
432
|
+
});
|
|
433
|
+
let __ok = true;
|
|
434
|
+
let __error = void 0;
|
|
435
|
+
try {
|
|
436
|
+
if (resolved.action === "setState" && resolved.params) {
|
|
437
|
+
const statePath = resolved.params.statePath;
|
|
438
|
+
const value = resolved.params.value;
|
|
439
|
+
if (statePath) {
|
|
440
|
+
set(statePath, value);
|
|
441
|
+
}
|
|
442
|
+
return;
|
|
430
443
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
set(clearStatePath, "");
|
|
444
|
+
if (resolved.action === "pushState" && resolved.params) {
|
|
445
|
+
const statePath = resolved.params.statePath;
|
|
446
|
+
const rawValue = resolved.params.value;
|
|
447
|
+
if (statePath) {
|
|
448
|
+
const resolvedValue = deepResolveValue(rawValue, get);
|
|
449
|
+
const arr = get(statePath) ?? [];
|
|
450
|
+
set(statePath, [...arr, resolvedValue]);
|
|
451
|
+
const clearStatePath = resolved.params.clearStatePath;
|
|
452
|
+
if (clearStatePath) {
|
|
453
|
+
set(clearStatePath, "");
|
|
454
|
+
}
|
|
443
455
|
}
|
|
456
|
+
return;
|
|
444
457
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
458
|
+
if (resolved.action === "removeState" && resolved.params) {
|
|
459
|
+
const statePath = resolved.params.statePath;
|
|
460
|
+
const index = resolved.params.index;
|
|
461
|
+
if (statePath !== void 0 && index !== void 0) {
|
|
462
|
+
const arr = get(statePath) ?? [];
|
|
463
|
+
set(
|
|
464
|
+
statePath,
|
|
465
|
+
arr.filter((_, i) => i !== index)
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
return;
|
|
456
469
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
470
|
+
if (resolved.action === "validateForm") {
|
|
471
|
+
const validateAll = validation?.validateAll;
|
|
472
|
+
if (!validateAll) {
|
|
473
|
+
console.warn(
|
|
474
|
+
"validateForm action was dispatched but no ValidationProvider is connected. Ensure ValidationProvider is rendered inside the provider tree."
|
|
475
|
+
);
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
const valid = validateAll();
|
|
479
|
+
const errors = {};
|
|
480
|
+
for (const [path, fs] of Object.entries(validation.fieldStates)) {
|
|
481
|
+
if (fs.result && !fs.result.valid) {
|
|
482
|
+
errors[path] = fs.result.errors;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
const statePath = resolved.params?.statePath || "/formValidation";
|
|
486
|
+
set(statePath, { valid, errors });
|
|
465
487
|
return;
|
|
466
488
|
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
489
|
+
if (resolved.action === "push" && resolved.params) {
|
|
490
|
+
const screen = resolved.params.screen;
|
|
491
|
+
if (screen) {
|
|
492
|
+
const currentScreen = get("/currentScreen");
|
|
493
|
+
const navStack = get("/navStack") ?? [];
|
|
494
|
+
if (currentScreen) {
|
|
495
|
+
set("/navStack", [...navStack, currentScreen]);
|
|
496
|
+
} else {
|
|
497
|
+
set("/navStack", [...navStack, ""]);
|
|
498
|
+
}
|
|
499
|
+
set("/currentScreen", screen);
|
|
472
500
|
}
|
|
501
|
+
return;
|
|
473
502
|
}
|
|
474
|
-
|
|
475
|
-
set(statePath, { valid, errors });
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
if (resolved.action === "push" && resolved.params) {
|
|
479
|
-
const screen = resolved.params.screen;
|
|
480
|
-
if (screen) {
|
|
481
|
-
const currentScreen = get("/currentScreen");
|
|
503
|
+
if (resolved.action === "pop") {
|
|
482
504
|
const navStack = get("/navStack") ?? [];
|
|
483
|
-
if (
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
505
|
+
if (navStack.length > 0) {
|
|
506
|
+
const previousScreen = navStack[navStack.length - 1];
|
|
507
|
+
set("/navStack", navStack.slice(0, -1));
|
|
508
|
+
if (previousScreen) {
|
|
509
|
+
set("/currentScreen", previousScreen);
|
|
510
|
+
} else {
|
|
511
|
+
set("/currentScreen", void 0);
|
|
512
|
+
}
|
|
487
513
|
}
|
|
488
|
-
|
|
514
|
+
return;
|
|
489
515
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
516
|
+
const handler = handlers.value[resolved.action];
|
|
517
|
+
if (!handler) {
|
|
518
|
+
console.warn(`No handler registered for action: ${resolved.action}`);
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
if (resolved.confirm) {
|
|
522
|
+
await new Promise((resolve, reject) => {
|
|
523
|
+
pendingConfirmation.value = {
|
|
524
|
+
action: resolved,
|
|
525
|
+
handler,
|
|
526
|
+
resolve: () => {
|
|
527
|
+
pendingConfirmation.value = null;
|
|
528
|
+
resolve();
|
|
529
|
+
},
|
|
530
|
+
reject: () => {
|
|
531
|
+
pendingConfirmation.value = null;
|
|
532
|
+
reject(new Error("Action cancelled"));
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
});
|
|
536
|
+
const addLoading2 = new Set(loadingActions.value);
|
|
537
|
+
addLoading2.add(resolved.action);
|
|
538
|
+
loadingActions.value = addLoading2;
|
|
539
|
+
try {
|
|
540
|
+
await (0, import_core4.executeAction)({
|
|
541
|
+
action: resolved,
|
|
542
|
+
handler,
|
|
543
|
+
setState: set,
|
|
544
|
+
navigate: props.navigate,
|
|
545
|
+
executeAction: async (name) => {
|
|
546
|
+
const subBinding = { action: name };
|
|
547
|
+
await execute(subBinding);
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
} finally {
|
|
551
|
+
const removeLoading = new Set(loadingActions.value);
|
|
552
|
+
removeLoading.delete(resolved.action);
|
|
553
|
+
loadingActions.value = removeLoading;
|
|
501
554
|
}
|
|
555
|
+
return;
|
|
502
556
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
if (!handler) {
|
|
507
|
-
console.warn(`No handler registered for action: ${resolved.action}`);
|
|
508
|
-
return;
|
|
509
|
-
}
|
|
510
|
-
if (resolved.confirm) {
|
|
511
|
-
await new Promise((resolve, reject) => {
|
|
512
|
-
pendingConfirmation.value = {
|
|
513
|
-
action: resolved,
|
|
514
|
-
handler,
|
|
515
|
-
resolve: () => {
|
|
516
|
-
pendingConfirmation.value = null;
|
|
517
|
-
resolve();
|
|
518
|
-
},
|
|
519
|
-
reject: () => {
|
|
520
|
-
pendingConfirmation.value = null;
|
|
521
|
-
reject(new Error("Action cancelled"));
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
});
|
|
525
|
-
const addLoading2 = new Set(loadingActions.value);
|
|
526
|
-
addLoading2.add(resolved.action);
|
|
527
|
-
loadingActions.value = addLoading2;
|
|
557
|
+
const addLoading = new Set(loadingActions.value);
|
|
558
|
+
addLoading.add(resolved.action);
|
|
559
|
+
loadingActions.value = addLoading;
|
|
528
560
|
try {
|
|
529
561
|
await (0, import_core4.executeAction)({
|
|
530
562
|
action: resolved,
|
|
@@ -541,26 +573,20 @@ var ActionProvider = (0, import_vue4.defineComponent)({
|
|
|
541
573
|
removeLoading.delete(resolved.action);
|
|
542
574
|
loadingActions.value = removeLoading;
|
|
543
575
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
loadingActions.value = addLoading;
|
|
549
|
-
try {
|
|
550
|
-
await (0, import_core4.executeAction)({
|
|
551
|
-
action: resolved,
|
|
552
|
-
handler,
|
|
553
|
-
setState: set,
|
|
554
|
-
navigate: props.navigate,
|
|
555
|
-
executeAction: async (name) => {
|
|
556
|
-
const subBinding = { action: name };
|
|
557
|
-
await execute(subBinding);
|
|
558
|
-
}
|
|
559
|
-
});
|
|
576
|
+
} catch (err) {
|
|
577
|
+
__ok = false;
|
|
578
|
+
__error = err;
|
|
579
|
+
throw err;
|
|
560
580
|
} finally {
|
|
561
|
-
const
|
|
562
|
-
|
|
563
|
-
|
|
581
|
+
const now = Date.now();
|
|
582
|
+
(0, import_core4.notifyActionSettle)({
|
|
583
|
+
id: dispatchId,
|
|
584
|
+
name: resolved.action,
|
|
585
|
+
ok: __ok,
|
|
586
|
+
at: now,
|
|
587
|
+
durationMs: now - dispatchedAt,
|
|
588
|
+
error: __error
|
|
589
|
+
});
|
|
564
590
|
}
|
|
565
591
|
};
|
|
566
592
|
const confirm = () => pendingConfirmation.value?.resolve();
|
|
@@ -1328,6 +1354,29 @@ function useFunctions() {
|
|
|
1328
1354
|
(0, import_vue7.computed)(() => EMPTY_FUNCTIONS)
|
|
1329
1355
|
);
|
|
1330
1356
|
}
|
|
1357
|
+
var DIRECTIVES_KEY = /* @__PURE__ */ Symbol("json-render:directives");
|
|
1358
|
+
var DirectivesProvider = (0, import_vue7.defineComponent)({
|
|
1359
|
+
name: "DirectivesProvider",
|
|
1360
|
+
props: {
|
|
1361
|
+
directives: {
|
|
1362
|
+
type: Array,
|
|
1363
|
+
default: void 0
|
|
1364
|
+
}
|
|
1365
|
+
},
|
|
1366
|
+
setup(props, { slots }) {
|
|
1367
|
+
const registry = (0, import_vue7.computed)(
|
|
1368
|
+
() => props.directives ? (0, import_core7.createDirectiveRegistry)(props.directives) : void 0
|
|
1369
|
+
);
|
|
1370
|
+
(0, import_vue7.provide)(DIRECTIVES_KEY, registry);
|
|
1371
|
+
return () => slots.default?.();
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
function useDirectives() {
|
|
1375
|
+
return (0, import_vue7.inject)(
|
|
1376
|
+
DIRECTIVES_KEY,
|
|
1377
|
+
(0, import_vue7.computed)(() => void 0)
|
|
1378
|
+
);
|
|
1379
|
+
}
|
|
1331
1380
|
var ElementErrorBoundary = (0, import_vue7.defineComponent)({
|
|
1332
1381
|
name: "ElementErrorBoundary",
|
|
1333
1382
|
props: {
|
|
@@ -1372,6 +1421,14 @@ async function resolveAndExecuteBindings(actionBindings, ctx, getSnapshot, execu
|
|
|
1372
1421
|
if (cancelled?.()) break;
|
|
1373
1422
|
}
|
|
1374
1423
|
}
|
|
1424
|
+
function useDevtoolsActive() {
|
|
1425
|
+
const active = (0, import_vue7.ref)((0, import_core7.isDevtoolsActive)());
|
|
1426
|
+
const unsub = (0, import_core7.subscribeDevtoolsActive)(() => {
|
|
1427
|
+
active.value = (0, import_core7.isDevtoolsActive)();
|
|
1428
|
+
});
|
|
1429
|
+
(0, import_vue7.onBeforeUnmount)(unsub);
|
|
1430
|
+
return active;
|
|
1431
|
+
}
|
|
1375
1432
|
var ElementRenderer = (0, import_vue7.defineComponent)({
|
|
1376
1433
|
name: "JsonRenderElement",
|
|
1377
1434
|
props: {
|
|
@@ -1379,6 +1436,10 @@ var ElementRenderer = (0, import_vue7.defineComponent)({
|
|
|
1379
1436
|
type: Object,
|
|
1380
1437
|
required: true
|
|
1381
1438
|
},
|
|
1439
|
+
elementKey: {
|
|
1440
|
+
type: String,
|
|
1441
|
+
default: void 0
|
|
1442
|
+
},
|
|
1382
1443
|
spec: {
|
|
1383
1444
|
type: Object,
|
|
1384
1445
|
required: true
|
|
@@ -1397,11 +1458,13 @@ var ElementRenderer = (0, import_vue7.defineComponent)({
|
|
|
1397
1458
|
}
|
|
1398
1459
|
},
|
|
1399
1460
|
setup(props) {
|
|
1461
|
+
const devtoolsActive = useDevtoolsActive();
|
|
1400
1462
|
const repeatScope = useRepeatScope();
|
|
1401
1463
|
const { ctx: visibilityCtx } = useVisibility();
|
|
1402
1464
|
const { execute } = useActions();
|
|
1403
1465
|
const { getSnapshot, state: watchState } = useStateStore();
|
|
1404
1466
|
const functions = useFunctions();
|
|
1467
|
+
const directives = useDirectives();
|
|
1405
1468
|
const fullCtx = (0, import_vue7.computed)(() => {
|
|
1406
1469
|
const base = repeatScope ? {
|
|
1407
1470
|
...visibilityCtx.value,
|
|
@@ -1410,6 +1473,7 @@ var ElementRenderer = (0, import_vue7.defineComponent)({
|
|
|
1410
1473
|
repeatBasePath: repeatScope.basePath
|
|
1411
1474
|
} : { ...visibilityCtx.value };
|
|
1412
1475
|
base.functions = functions.value;
|
|
1476
|
+
base.directives = directives.value;
|
|
1413
1477
|
return base;
|
|
1414
1478
|
});
|
|
1415
1479
|
const emitEvent = async (eventName) => {
|
|
@@ -1511,28 +1575,33 @@ var ElementRenderer = (0, import_vue7.defineComponent)({
|
|
|
1511
1575
|
return (0, import_vue7.h)(ElementRenderer, {
|
|
1512
1576
|
key: childKey,
|
|
1513
1577
|
element: childElement,
|
|
1578
|
+
elementKey: childKey,
|
|
1514
1579
|
spec: props.spec,
|
|
1515
1580
|
registry: props.registry,
|
|
1516
1581
|
loading: props.loading,
|
|
1517
1582
|
fallback: props.fallback
|
|
1518
1583
|
});
|
|
1519
1584
|
}).filter((n) => n !== null) ?? void 0;
|
|
1585
|
+
const componentVNode = (0, import_vue7.h)(
|
|
1586
|
+
Component,
|
|
1587
|
+
{
|
|
1588
|
+
element: resolvedElement,
|
|
1589
|
+
emit: emitEvent,
|
|
1590
|
+
on: onEvent,
|
|
1591
|
+
bindings: elementBindings,
|
|
1592
|
+
loading: props.loading
|
|
1593
|
+
},
|
|
1594
|
+
{ default: () => childrenVNodes }
|
|
1595
|
+
);
|
|
1596
|
+
const tagged = devtoolsActive.value && props.elementKey ? (0, import_vue7.h)(
|
|
1597
|
+
"span",
|
|
1598
|
+
{ "data-jr-key": props.elementKey, style: "display:contents" },
|
|
1599
|
+
[componentVNode]
|
|
1600
|
+
) : componentVNode;
|
|
1520
1601
|
return (0, import_vue7.h)(
|
|
1521
1602
|
ElementErrorBoundary,
|
|
1522
1603
|
{ elementType: resolvedElement.type },
|
|
1523
|
-
{
|
|
1524
|
-
default: () => (0, import_vue7.h)(
|
|
1525
|
-
Component,
|
|
1526
|
-
{
|
|
1527
|
-
element: resolvedElement,
|
|
1528
|
-
emit: emitEvent,
|
|
1529
|
-
on: onEvent,
|
|
1530
|
-
bindings: elementBindings,
|
|
1531
|
-
loading: props.loading
|
|
1532
|
-
},
|
|
1533
|
-
{ default: () => childrenVNodes }
|
|
1534
|
-
)
|
|
1535
|
-
}
|
|
1604
|
+
{ default: () => tagged }
|
|
1536
1605
|
);
|
|
1537
1606
|
};
|
|
1538
1607
|
}
|
|
@@ -1590,6 +1659,7 @@ var RepeatChildren = (0, import_vue7.defineComponent)({
|
|
|
1590
1659
|
return (0, import_vue7.h)(ElementRenderer, {
|
|
1591
1660
|
key: childKey,
|
|
1592
1661
|
element: childElement,
|
|
1662
|
+
elementKey: childKey,
|
|
1593
1663
|
spec: props.spec,
|
|
1594
1664
|
registry: props.registry,
|
|
1595
1665
|
loading: props.loading,
|
|
@@ -1629,6 +1699,7 @@ var Renderer = (0, import_vue7.defineComponent)({
|
|
|
1629
1699
|
if (!rootElement) return null;
|
|
1630
1700
|
return (0, import_vue7.h)(ElementRenderer, {
|
|
1631
1701
|
element: rootElement,
|
|
1702
|
+
elementKey: props.spec.root,
|
|
1632
1703
|
spec: props.spec,
|
|
1633
1704
|
registry: props.registry,
|
|
1634
1705
|
loading: props.loading,
|
|
@@ -1682,6 +1753,10 @@ var JSONUIProvider = (0, import_vue7.defineComponent)({
|
|
|
1682
1753
|
type: Object,
|
|
1683
1754
|
default: void 0
|
|
1684
1755
|
},
|
|
1756
|
+
directives: {
|
|
1757
|
+
type: Array,
|
|
1758
|
+
default: void 0
|
|
1759
|
+
},
|
|
1685
1760
|
onStateChange: {
|
|
1686
1761
|
type: Function,
|
|
1687
1762
|
default: void 0
|
|
@@ -1709,10 +1784,16 @@ var JSONUIProvider = (0, import_vue7.defineComponent)({
|
|
|
1709
1784
|
FunctionsProvider,
|
|
1710
1785
|
{ functions: props.functions },
|
|
1711
1786
|
{
|
|
1712
|
-
default: () =>
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1787
|
+
default: () => (0, import_vue7.h)(
|
|
1788
|
+
DirectivesProvider,
|
|
1789
|
+
{ directives: props.directives },
|
|
1790
|
+
{
|
|
1791
|
+
default: () => [
|
|
1792
|
+
slots.default?.(),
|
|
1793
|
+
(0, import_vue7.h)(ConfirmationDialogManager)
|
|
1794
|
+
]
|
|
1795
|
+
}
|
|
1796
|
+
)
|
|
1716
1797
|
}
|
|
1717
1798
|
)
|
|
1718
1799
|
}
|
|
@@ -1818,6 +1899,10 @@ function createRenderer(catalog, components) {
|
|
|
1818
1899
|
type: Object,
|
|
1819
1900
|
default: void 0
|
|
1820
1901
|
},
|
|
1902
|
+
directives: {
|
|
1903
|
+
type: Array,
|
|
1904
|
+
default: void 0
|
|
1905
|
+
},
|
|
1821
1906
|
loading: {
|
|
1822
1907
|
type: Boolean,
|
|
1823
1908
|
default: void 0
|
|
@@ -1856,15 +1941,21 @@ function createRenderer(catalog, components) {
|
|
|
1856
1941
|
FunctionsProvider,
|
|
1857
1942
|
{ functions: rendererProps.functions },
|
|
1858
1943
|
{
|
|
1859
|
-
default: () =>
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1944
|
+
default: () => (0, import_vue7.h)(
|
|
1945
|
+
DirectivesProvider,
|
|
1946
|
+
{ directives: rendererProps.directives },
|
|
1947
|
+
{
|
|
1948
|
+
default: () => [
|
|
1949
|
+
(0, import_vue7.h)(Renderer, {
|
|
1950
|
+
spec: rendererProps.spec,
|
|
1951
|
+
registry,
|
|
1952
|
+
loading: rendererProps.loading,
|
|
1953
|
+
fallback: rendererProps.fallback
|
|
1954
|
+
}),
|
|
1955
|
+
(0, import_vue7.h)(ConfirmationDialogManager)
|
|
1956
|
+
]
|
|
1957
|
+
}
|
|
1958
|
+
)
|
|
1868
1959
|
}
|
|
1869
1960
|
)
|
|
1870
1961
|
}
|