@json-render/vue 0.19.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/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  schema
3
- } from "./chunk-WIPZLAF7.mjs";
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 (name) => {
538
- const subBinding = { action: name };
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 (name) => {
559
- const subBinding = { action: name };
560
- await execute(subBinding);
557
+ executeAction: async (binding2) => {
558
+ await execute(binding2);
561
559
  }
562
560
  });
563
561
  } finally {
@@ -1270,6 +1268,8 @@ 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
1275
  createDirectiveRegistry,
@@ -1576,10 +1576,20 @@ var RepeatChildren = defineComponent6({
1576
1576
  },
1577
1577
  setup(props) {
1578
1578
  const { state } = useStateStore();
1579
+ const parentScope = useRepeatScope();
1579
1580
  return () => {
1580
1581
  const repeat = props.element.repeat;
1581
1582
  if (!repeat?.statePath) return null;
1582
- const statePath = repeat.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
+ }
1583
1593
  const raw = getByPath3(state.value, statePath);
1584
1594
  const items = Array.isArray(raw) ? raw : [];
1585
1595
  return items.map((itemValue, index) => {
@@ -1588,7 +1598,12 @@ var RepeatChildren = defineComponent6({
1588
1598
  ) : String(index);
1589
1599
  return h2(
1590
1600
  RepeatScopeProvider,
1591
- { key, item: itemValue, index, basePath: `${statePath}/${index}` },
1601
+ {
1602
+ key,
1603
+ item: itemValue,
1604
+ index,
1605
+ basePath: resolveRepeatItemStatePath(statePath, index)
1606
+ },
1592
1607
  {
1593
1608
  default: () => props.element.children?.map((childKey) => {
1594
1609
  const childElement = props.spec.elements[childKey];