@conduction/nextcloud-vue 2.146.0 → 2.147.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/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +68 -9
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js +37 -13
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue.js +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js +2 -2
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue3.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +83 -71
- package/dist/esm/utils/objectParties.js +30 -1
- package/dist/esm/utils/objectParties.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +193 -81
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +83 -71
- package/package.json +1 -1
- package/src/components/CnFactsWidget/CnFactsWidget.vue +96 -9
- package/src/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue +2 -1
- package/src/utils/objectParties.js +29 -0
|
@@ -248,6 +248,7 @@ import {
|
|
|
248
248
|
indicatorVerdict,
|
|
249
249
|
kindCode,
|
|
250
250
|
newPartyRecord,
|
|
251
|
+
partyKindAccepted,
|
|
251
252
|
representedByMap,
|
|
252
253
|
roleLabel,
|
|
253
254
|
rolesInOrder,
|
|
@@ -892,7 +893,7 @@ export default {
|
|
|
892
893
|
if (!party?.partyKind || !this.kinds || (enforce && this.kinds.source !== enforce)) {
|
|
893
894
|
return false
|
|
894
895
|
}
|
|
895
|
-
return !this.kinds.kinds
|
|
896
|
+
return !partyKindAccepted(party.partyKind, this.kinds.kinds, this.listing?.kinds)
|
|
896
897
|
},
|
|
897
898
|
|
|
898
899
|
/**
|
|
@@ -176,6 +176,35 @@ export function kindCode(kind) {
|
|
|
176
176
|
return String(kind?.code || kind?.key || '')
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
+
/**
|
|
180
|
+
* Whether a party's kind is among the kinds a record accepts. Two
|
|
181
|
+
* vocabularies meet here: the party's kind is its schema's (`person`,
|
|
182
|
+
* `organisation`, `colleague`), while the accepted kinds may be role kinds
|
|
183
|
+
* that name the identity shapes they take (pipelinq's `aanvrager` with
|
|
184
|
+
* `identityShapes: ["naturalPerson", "organization"]`). When the accepted
|
|
185
|
+
* kinds name shapes, the party's own kind is matched by the shapes the
|
|
186
|
+
* listing gives it; a kind that names none cannot be judged and passes.
|
|
187
|
+
* Otherwise the codes are compared.
|
|
188
|
+
*
|
|
189
|
+
* @param {string} partyKind The party's kind key.
|
|
190
|
+
* @param {Array<object>} accepted The accepted kinds.
|
|
191
|
+
* @param {Array<object>} own The listing's own kinds (`{ key, identityShapes? }`).
|
|
192
|
+
* @return {boolean} False only when the party is known not to fit.
|
|
193
|
+
* @spec openspec/changes/parties-accepted-kinds-by-shape/specs/object-parties/spec.md#requirement-a-party-is-checked-against-the-accepted-kinds-in-one-vocabulary
|
|
194
|
+
*/
|
|
195
|
+
export function partyKindAccepted(partyKind, accepted, own) {
|
|
196
|
+
const kinds = Array.isArray(accepted) ? accepted : []
|
|
197
|
+
const shapes = new Set(kinds.flatMap((kind) => (Array.isArray(kind?.identityShapes) ? kind.identityShapes : [])))
|
|
198
|
+
if (shapes.size === 0) {
|
|
199
|
+
return kinds.some((kind) => kindCode(kind) === partyKind)
|
|
200
|
+
}
|
|
201
|
+
const mine = (Array.isArray(own) ? own : []).find((kind) => kindCode(kind) === partyKind)?.identityShapes
|
|
202
|
+
if (!Array.isArray(mine) || mine.length === 0) {
|
|
203
|
+
return true
|
|
204
|
+
}
|
|
205
|
+
return mine.some((shape) => shapes.has(shape))
|
|
206
|
+
}
|
|
207
|
+
|
|
179
208
|
/**
|
|
180
209
|
* Write a value at a dotted path, creating the objects on the way.
|
|
181
210
|
*
|