@sitecore-feaas/clientside 0.3.3 → 0.3.4

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 (43) hide show
  1. package/build/dom/rendering.js +1 -1
  2. package/build/dom/rendering.js.map +1 -1
  3. package/build/utils/data.js +4 -3
  4. package/build/utils/data.js.map +1 -1
  5. package/dist/browser/headless.cjs +4 -4
  6. package/dist/browser/headless.cjs.map +3 -3
  7. package/dist/browser/headless.esm.js +5 -5
  8. package/dist/browser/headless.esm.js.map +1 -1
  9. package/dist/browser/index.cjs +5 -5
  10. package/dist/browser/index.cjs.map +3 -3
  11. package/dist/browser/index.esm.js +5 -5
  12. package/dist/browser/index.esm.js.map +1 -1
  13. package/dist/browser/react.cjs +5 -5
  14. package/dist/browser/react.cjs.map +3 -3
  15. package/dist/browser/react.esm.js +5 -5
  16. package/dist/browser/react.esm.js.map +1 -1
  17. package/dist/node/headless.cjs +3 -3
  18. package/dist/node/headless.cjs.map +3 -3
  19. package/dist/node/headless.esm.js +4 -4
  20. package/dist/node/headless.esm.js.map +3 -3
  21. package/dist/node/index.cjs +4 -4
  22. package/dist/node/index.cjs.map +3 -3
  23. package/dist/node/index.esm.js +5 -5
  24. package/dist/node/index.esm.js.map +3 -3
  25. package/dist/node/react.cjs +4 -4
  26. package/dist/node/react.cjs.map +3 -3
  27. package/dist/node/react.esm.js +5 -5
  28. package/dist/node/react.esm.js.map +3 -3
  29. package/headless.cjs +3 -3
  30. package/headless.cjs.map +3 -3
  31. package/headless.js +3 -3
  32. package/headless.js.map +3 -3
  33. package/package.json +1 -1
  34. package/react.cjs +5 -5
  35. package/react.cjs.map +3 -3
  36. package/react.js +5 -5
  37. package/react.js.map +3 -3
  38. package/src/dom/rendering.ts +1 -1
  39. package/src/utils/data.ts +3 -3
  40. package/types/tsbuildinfo +1 -1
  41. package/types/ui/tsbuildinfo +1 -1
  42. package/types/utils/data.d.ts +1 -1
  43. package/types/utils/data.d.ts.map +1 -1
@@ -162,7 +162,7 @@ export function renderDOMElement(
162
162
  const datascope = element.getAttribute('data-path-scope')
163
163
  if (datascope) {
164
164
  const index = getDOMCollectionIndex(element)
165
- const collection = queryScopes(datascopes, datascope, false) || []
165
+ const collection = queryScopes(datascopes, datascope, false)
166
166
  if (index == 0) {
167
167
  updateDOMClones(element, config?.shouldRepeat?.(element, collection) === false ? 1 : collection.length, config)
168
168
  }
package/src/utils/data.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { JSONPath } from 'jsonpath-plus'
2
2
 
3
3
  export function queryObject(json: any, path: string) {
4
- return JSONPath({ path, json })
4
+ return JSONPath<any[]>({ path, json })?.flat(Infinity) || []
5
5
  }
6
6
 
7
7
  export function queryScopes(scopes: any, datapath: string, singleValue = false, json: any = scopes) {
@@ -23,7 +23,7 @@ export function queryScopes(scopes: any, datapath: string, singleValue = false,
23
23
  }
24
24
  }
25
25
 
26
- var collection = JSONPath({ path, json })
26
+ var collection = queryObject(json, path)
27
27
 
28
28
  // If regular path didn't match any data, try fallbacks
29
29
  // datasourceId.wrapper.$.path
@@ -49,7 +49,7 @@ export function queryScopes(scopes: any, datapath: string, singleValue = false,
49
49
  ]
50
50
  .filter((v, i, a) => a.indexOf(v) === i)
51
51
  .reduce((v, path) => {
52
- return v.length > 0 ? v : JSONPath({ path, json })
52
+ return v.length > 0 ? v : queryObject(json, path)
53
53
  }, [] as any[])
54
54
  }
55
55