@contember/bindx-repeater 0.1.19 → 0.1.21
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockRepeater.d.ts","sourceRoot":"","sources":["../../src/components/BlockRepeater.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAW,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAA;AACzE,OAAO,KAAK,EAGX,QAAQ,EAIR,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAyC,eAAe,EAAa,KAAK,iBAAiB,EAAwB,MAAM,wBAAwB,CAAA;AACxJ,OAAO,KAAK,EACX,kBAAkB,EAMlB,MAAM,aAAa,CAAA;AAMpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,aAAa,CAC5B,OAAO,SAAS,MAAM,GAAG,MAAM,EAC/B,SAAS,GAAG,OAAO,EACnB,MAAM,SAAS,QAAQ,GAAG,QAAQ,EAClC,WAAW,SAAS,MAAM,GAAG,MAAM,EACnC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/D,WAAW,SAAS,MAAM,GAAG,MAAM,EAClC,EACD,KAAK,EACL,mBAAmB,EACnB,UAAU,EACV,MAAM,EACN,QAAQ,GACR,EAAE,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,GAAG,YAAY,CAgIlG;AAGD,QAAA,MAAM,0BAA0B,EAAoB,OAAO,aAAa,GAAG,iBAAiB,GAAG;IAAE,CAAC,eAAe,CAAC,EAAE,IAAI,CAAA;CAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"BlockRepeater.d.ts","sourceRoot":"","sources":["../../src/components/BlockRepeater.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAW,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAA;AACzE,OAAO,KAAK,EAGX,QAAQ,EAIR,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAyC,eAAe,EAAa,KAAK,iBAAiB,EAAwB,MAAM,wBAAwB,CAAA;AACxJ,OAAO,KAAK,EACX,kBAAkB,EAMlB,MAAM,aAAa,CAAA;AAMpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,aAAa,CAC5B,OAAO,SAAS,MAAM,GAAG,MAAM,EAC/B,SAAS,GAAG,OAAO,EACnB,MAAM,SAAS,QAAQ,GAAG,QAAQ,EAClC,WAAW,SAAS,MAAM,GAAG,MAAM,EACnC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/D,WAAW,SAAS,MAAM,GAAG,MAAM,EAClC,EACD,KAAK,EACL,mBAAmB,EACnB,UAAU,EACV,MAAM,EACN,QAAQ,GACR,EAAE,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,GAAG,YAAY,CAgIlG;AAGD,QAAA,MAAM,0BAA0B,EAAoB,OAAO,aAAa,GAAG,iBAAiB,GAAG;IAAE,CAAC,eAAe,CAAC,EAAE,IAAI,CAAA;CAAE,CAAA;AA+F1H,OAAO,EAAE,0BAA0B,IAAI,qBAAqB,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/bindx-repeater",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "Repeater components for has-many list management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"react": ">=18.0.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@contember/bindx": "0.1.
|
|
19
|
-
"@contember/bindx-react": "0.1.
|
|
18
|
+
"@contember/bindx": "0.1.21",
|
|
19
|
+
"@contember/bindx-react": "0.1.21"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
@@ -218,6 +218,8 @@ blockRepeaterWithSelection.getSelection = (
|
|
|
218
218
|
const scope = new SelectionScope()
|
|
219
219
|
const collectorEntity = createCollectorProxy<unknown>(scope)
|
|
220
220
|
|
|
221
|
+
const blockJsx: ReactNode[] = []
|
|
222
|
+
|
|
221
223
|
const mockItems: BlockRepeaterItems<unknown> = {
|
|
222
224
|
map: (fn) => {
|
|
223
225
|
fn(collectorEntity, {
|
|
@@ -230,6 +232,13 @@ blockRepeaterWithSelection.getSelection = (
|
|
|
230
232
|
blockType: null,
|
|
231
233
|
block: undefined,
|
|
232
234
|
})
|
|
235
|
+
// Call block render/form functions inside the map callback so the
|
|
236
|
+
// collector proxy records field accesses. This code must execute inside
|
|
237
|
+
// a callback passed through props.children() to survive Rolldown DCE.
|
|
238
|
+
for (const blockDef of Object.values(props.blocks) as BlockDefinition[]) {
|
|
239
|
+
if (blockDef.render) blockJsx.push(blockDef.render(collectorEntity as EntityAccessor<object>))
|
|
240
|
+
if (blockDef.form) blockJsx.push(blockDef.form(collectorEntity as EntityAccessor<object>))
|
|
241
|
+
}
|
|
233
242
|
return []
|
|
234
243
|
},
|
|
235
244
|
length: 0,
|
|
@@ -242,20 +251,10 @@ blockRepeaterWithSelection.getSelection = (
|
|
|
242
251
|
}
|
|
243
252
|
|
|
244
253
|
const syntheticChildren = props.children(mockItems, mockMethods)
|
|
245
|
-
const jsxSelection = collectNested(syntheticChildren)
|
|
246
|
-
|
|
247
|
-
// Call block render/form functions so the collector proxy records field accesses.
|
|
248
|
-
// Collect JSX from block definitions and pass to collectNested alongside children.
|
|
249
|
-
const blockJsx: ReactNode[] = []
|
|
250
|
-
for (const blockDef of Object.values(props.blocks) as BlockDefinition[]) {
|
|
251
|
-
if (blockDef.render) blockJsx.push(blockDef.render(collectorEntity as EntityAccessor<object>))
|
|
252
|
-
if (blockDef.form) blockJsx.push(blockDef.form(collectorEntity as EntityAccessor<object>))
|
|
253
|
-
}
|
|
254
|
-
const blockSelection = collectNested(blockJsx)
|
|
254
|
+
const jsxSelection = collectNested([syntheticChildren, ...blockJsx])
|
|
255
255
|
|
|
256
256
|
const nestedSelection = scope.toSelectionMeta()
|
|
257
257
|
mergeSelections(nestedSelection, jsxSelection)
|
|
258
|
-
mergeSelections(nestedSelection, blockSelection)
|
|
259
258
|
|
|
260
259
|
// Add discrimination field to selection
|
|
261
260
|
nestedSelection.fields.set(props.discriminationField, {
|