@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.
- package/build/dom/rendering.js +1 -1
- package/build/dom/rendering.js.map +1 -1
- package/build/utils/data.js +4 -3
- package/build/utils/data.js.map +1 -1
- package/dist/browser/headless.cjs +4 -4
- package/dist/browser/headless.cjs.map +3 -3
- package/dist/browser/headless.esm.js +5 -5
- package/dist/browser/headless.esm.js.map +1 -1
- package/dist/browser/index.cjs +5 -5
- package/dist/browser/index.cjs.map +3 -3
- package/dist/browser/index.esm.js +5 -5
- package/dist/browser/index.esm.js.map +1 -1
- package/dist/browser/react.cjs +5 -5
- package/dist/browser/react.cjs.map +3 -3
- package/dist/browser/react.esm.js +5 -5
- package/dist/browser/react.esm.js.map +1 -1
- package/dist/node/headless.cjs +3 -3
- package/dist/node/headless.cjs.map +3 -3
- package/dist/node/headless.esm.js +4 -4
- package/dist/node/headless.esm.js.map +3 -3
- package/dist/node/index.cjs +4 -4
- package/dist/node/index.cjs.map +3 -3
- package/dist/node/index.esm.js +5 -5
- package/dist/node/index.esm.js.map +3 -3
- package/dist/node/react.cjs +4 -4
- package/dist/node/react.cjs.map +3 -3
- package/dist/node/react.esm.js +5 -5
- package/dist/node/react.esm.js.map +3 -3
- package/headless.cjs +3 -3
- package/headless.cjs.map +3 -3
- package/headless.js +3 -3
- package/headless.js.map +3 -3
- package/package.json +1 -1
- package/react.cjs +5 -5
- package/react.cjs.map +3 -3
- package/react.js +5 -5
- package/react.js.map +3 -3
- package/src/dom/rendering.ts +1 -1
- package/src/utils/data.ts +3 -3
- package/types/tsbuildinfo +1 -1
- package/types/ui/tsbuildinfo +1 -1
- package/types/utils/data.d.ts +1 -1
- package/types/utils/data.d.ts.map +1 -1
package/src/dom/rendering.ts
CHANGED
|
@@ -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 =
|
|
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 :
|
|
52
|
+
return v.length > 0 ? v : queryObject(json, path)
|
|
53
53
|
}, [] as any[])
|
|
54
54
|
}
|
|
55
55
|
|