@json-render/vue 0.18.0 → 0.20.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/README.md +2 -0
- package/dist/{chunk-WIPZLAF7.mjs → chunk-F4CKBTOP.mjs} +6 -3
- package/dist/chunk-F4CKBTOP.mjs.map +1 -0
- package/dist/index.d.mts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +84 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -22
- package/dist/index.mjs.map +1 -1
- package/dist/schema.d.mts +11 -1
- package/dist/schema.d.ts +11 -1
- package/dist/schema.js +5 -2
- package/dist/schema.js.map +1 -1
- package/dist/schema.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-WIPZLAF7.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
schema
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-F4CKBTOP.mjs";
|
|
4
4
|
|
|
5
5
|
// src/composables/state.ts
|
|
6
6
|
import {
|
|
@@ -534,9 +534,8 @@ var ActionProvider = defineComponent4({
|
|
|
534
534
|
handler,
|
|
535
535
|
setState: set,
|
|
536
536
|
navigate: props.navigate,
|
|
537
|
-
executeAction: async (
|
|
538
|
-
|
|
539
|
-
await execute(subBinding);
|
|
537
|
+
executeAction: async (binding2) => {
|
|
538
|
+
await execute(binding2);
|
|
540
539
|
}
|
|
541
540
|
});
|
|
542
541
|
} finally {
|
|
@@ -555,9 +554,8 @@ var ActionProvider = defineComponent4({
|
|
|
555
554
|
handler,
|
|
556
555
|
setState: set,
|
|
557
556
|
navigate: props.navigate,
|
|
558
|
-
executeAction: async (
|
|
559
|
-
|
|
560
|
-
await execute(subBinding);
|
|
557
|
+
executeAction: async (binding2) => {
|
|
558
|
+
await execute(binding2);
|
|
561
559
|
}
|
|
562
560
|
});
|
|
563
561
|
} finally {
|
|
@@ -1270,8 +1268,11 @@ import {
|
|
|
1270
1268
|
resolveElementProps,
|
|
1271
1269
|
resolveBindings,
|
|
1272
1270
|
resolveActionParam,
|
|
1271
|
+
resolveRepeatItemStatePath,
|
|
1272
|
+
resolveRepeatStatePath,
|
|
1273
1273
|
evaluateVisibility as evaluateVisibility2,
|
|
1274
1274
|
getByPath as getByPath3,
|
|
1275
|
+
createDirectiveRegistry,
|
|
1275
1276
|
isDevtoolsActive,
|
|
1276
1277
|
subscribeDevtoolsActive
|
|
1277
1278
|
} from "@json-render/core";
|
|
@@ -1297,6 +1298,29 @@ function useFunctions() {
|
|
|
1297
1298
|
computed6(() => EMPTY_FUNCTIONS)
|
|
1298
1299
|
);
|
|
1299
1300
|
}
|
|
1301
|
+
var DIRECTIVES_KEY = /* @__PURE__ */ Symbol("json-render:directives");
|
|
1302
|
+
var DirectivesProvider = defineComponent6({
|
|
1303
|
+
name: "DirectivesProvider",
|
|
1304
|
+
props: {
|
|
1305
|
+
directives: {
|
|
1306
|
+
type: Array,
|
|
1307
|
+
default: void 0
|
|
1308
|
+
}
|
|
1309
|
+
},
|
|
1310
|
+
setup(props, { slots }) {
|
|
1311
|
+
const registry = computed6(
|
|
1312
|
+
() => props.directives ? createDirectiveRegistry(props.directives) : void 0
|
|
1313
|
+
);
|
|
1314
|
+
provide6(DIRECTIVES_KEY, registry);
|
|
1315
|
+
return () => slots.default?.();
|
|
1316
|
+
}
|
|
1317
|
+
});
|
|
1318
|
+
function useDirectives() {
|
|
1319
|
+
return inject6(
|
|
1320
|
+
DIRECTIVES_KEY,
|
|
1321
|
+
computed6(() => void 0)
|
|
1322
|
+
);
|
|
1323
|
+
}
|
|
1300
1324
|
var ElementErrorBoundary = defineComponent6({
|
|
1301
1325
|
name: "ElementErrorBoundary",
|
|
1302
1326
|
props: {
|
|
@@ -1384,6 +1408,7 @@ var ElementRenderer = defineComponent6({
|
|
|
1384
1408
|
const { execute } = useActions();
|
|
1385
1409
|
const { getSnapshot, state: watchState } = useStateStore();
|
|
1386
1410
|
const functions = useFunctions();
|
|
1411
|
+
const directives = useDirectives();
|
|
1387
1412
|
const fullCtx = computed6(() => {
|
|
1388
1413
|
const base = repeatScope ? {
|
|
1389
1414
|
...visibilityCtx.value,
|
|
@@ -1392,6 +1417,7 @@ var ElementRenderer = defineComponent6({
|
|
|
1392
1417
|
repeatBasePath: repeatScope.basePath
|
|
1393
1418
|
} : { ...visibilityCtx.value };
|
|
1394
1419
|
base.functions = functions.value;
|
|
1420
|
+
base.directives = directives.value;
|
|
1395
1421
|
return base;
|
|
1396
1422
|
});
|
|
1397
1423
|
const emitEvent = async (eventName) => {
|
|
@@ -1550,10 +1576,20 @@ var RepeatChildren = defineComponent6({
|
|
|
1550
1576
|
},
|
|
1551
1577
|
setup(props) {
|
|
1552
1578
|
const { state } = useStateStore();
|
|
1579
|
+
const parentScope = useRepeatScope();
|
|
1553
1580
|
return () => {
|
|
1554
1581
|
const repeat = props.element.repeat;
|
|
1555
1582
|
if (!repeat?.statePath) return null;
|
|
1556
|
-
const statePath =
|
|
1583
|
+
const statePath = resolveRepeatStatePath(
|
|
1584
|
+
repeat.statePath,
|
|
1585
|
+
parentScope?.basePath
|
|
1586
|
+
);
|
|
1587
|
+
if (statePath === void 0) {
|
|
1588
|
+
console.warn(
|
|
1589
|
+
"[json-render/vue] $item in repeat.statePath used outside of a repeat scope"
|
|
1590
|
+
);
|
|
1591
|
+
return null;
|
|
1592
|
+
}
|
|
1557
1593
|
const raw = getByPath3(state.value, statePath);
|
|
1558
1594
|
const items = Array.isArray(raw) ? raw : [];
|
|
1559
1595
|
return items.map((itemValue, index) => {
|
|
@@ -1562,7 +1598,12 @@ var RepeatChildren = defineComponent6({
|
|
|
1562
1598
|
) : String(index);
|
|
1563
1599
|
return h2(
|
|
1564
1600
|
RepeatScopeProvider,
|
|
1565
|
-
{
|
|
1601
|
+
{
|
|
1602
|
+
key,
|
|
1603
|
+
item: itemValue,
|
|
1604
|
+
index,
|
|
1605
|
+
basePath: resolveRepeatItemStatePath(statePath, index)
|
|
1606
|
+
},
|
|
1566
1607
|
{
|
|
1567
1608
|
default: () => props.element.children?.map((childKey) => {
|
|
1568
1609
|
const childElement = props.spec.elements[childKey];
|
|
@@ -1671,6 +1712,10 @@ var JSONUIProvider = defineComponent6({
|
|
|
1671
1712
|
type: Object,
|
|
1672
1713
|
default: void 0
|
|
1673
1714
|
},
|
|
1715
|
+
directives: {
|
|
1716
|
+
type: Array,
|
|
1717
|
+
default: void 0
|
|
1718
|
+
},
|
|
1674
1719
|
onStateChange: {
|
|
1675
1720
|
type: Function,
|
|
1676
1721
|
default: void 0
|
|
@@ -1698,10 +1743,16 @@ var JSONUIProvider = defineComponent6({
|
|
|
1698
1743
|
FunctionsProvider,
|
|
1699
1744
|
{ functions: props.functions },
|
|
1700
1745
|
{
|
|
1701
|
-
default: () =>
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1746
|
+
default: () => h2(
|
|
1747
|
+
DirectivesProvider,
|
|
1748
|
+
{ directives: props.directives },
|
|
1749
|
+
{
|
|
1750
|
+
default: () => [
|
|
1751
|
+
slots.default?.(),
|
|
1752
|
+
h2(ConfirmationDialogManager)
|
|
1753
|
+
]
|
|
1754
|
+
}
|
|
1755
|
+
)
|
|
1705
1756
|
}
|
|
1706
1757
|
)
|
|
1707
1758
|
}
|
|
@@ -1807,6 +1858,10 @@ function createRenderer(catalog, components) {
|
|
|
1807
1858
|
type: Object,
|
|
1808
1859
|
default: void 0
|
|
1809
1860
|
},
|
|
1861
|
+
directives: {
|
|
1862
|
+
type: Array,
|
|
1863
|
+
default: void 0
|
|
1864
|
+
},
|
|
1810
1865
|
loading: {
|
|
1811
1866
|
type: Boolean,
|
|
1812
1867
|
default: void 0
|
|
@@ -1845,15 +1900,21 @@ function createRenderer(catalog, components) {
|
|
|
1845
1900
|
FunctionsProvider,
|
|
1846
1901
|
{ functions: rendererProps.functions },
|
|
1847
1902
|
{
|
|
1848
|
-
default: () =>
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1903
|
+
default: () => h2(
|
|
1904
|
+
DirectivesProvider,
|
|
1905
|
+
{ directives: rendererProps.directives },
|
|
1906
|
+
{
|
|
1907
|
+
default: () => [
|
|
1908
|
+
h2(Renderer, {
|
|
1909
|
+
spec: rendererProps.spec,
|
|
1910
|
+
registry,
|
|
1911
|
+
loading: rendererProps.loading,
|
|
1912
|
+
fallback: rendererProps.fallback
|
|
1913
|
+
}),
|
|
1914
|
+
h2(ConfirmationDialogManager)
|
|
1915
|
+
]
|
|
1916
|
+
}
|
|
1917
|
+
)
|
|
1857
1918
|
}
|
|
1858
1919
|
)
|
|
1859
1920
|
}
|