@okf/ootils 1.45.0 → 1.47.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/browser.d.mts +74 -3
- package/dist/browser.d.ts +74 -3
- package/dist/browser.js +74 -7
- package/dist/browser.mjs +74 -7
- package/dist/node.d.mts +74 -3
- package/dist/node.d.ts +74 -3
- package/dist/node.js +74 -7
- package/dist/node.mjs +74 -7
- package/dist/universal.d.mts +74 -3
- package/dist/universal.d.ts +74 -3
- package/dist/universal.js +74 -7
- package/dist/universal.mjs +74 -7
- package/package.json +1 -1
package/dist/browser.d.mts
CHANGED
|
@@ -1334,6 +1334,21 @@ declare const processAuthorAndCommonFilters: (allTpls: any[], filterScopes: stri
|
|
|
1334
1334
|
filterType: string;
|
|
1335
1335
|
valuePath: string;
|
|
1336
1336
|
};
|
|
1337
|
+
} | {
|
|
1338
|
+
filterId: string;
|
|
1339
|
+
blockId: string;
|
|
1340
|
+
display: string;
|
|
1341
|
+
value: string;
|
|
1342
|
+
filterKey: string | undefined;
|
|
1343
|
+
source: {
|
|
1344
|
+
filterType: string;
|
|
1345
|
+
scope: string;
|
|
1346
|
+
profileTypes?: undefined;
|
|
1347
|
+
};
|
|
1348
|
+
target: {
|
|
1349
|
+
filterType: string;
|
|
1350
|
+
valuePath: string;
|
|
1351
|
+
};
|
|
1337
1352
|
})[];
|
|
1338
1353
|
}[];
|
|
1339
1354
|
};
|
|
@@ -1463,6 +1478,7 @@ declare const _self_managed_buildDocHierarchyConfig: ({ combinedDocumentBlocks,
|
|
|
1463
1478
|
filters: any[];
|
|
1464
1479
|
rollups: any[];
|
|
1465
1480
|
rollupDisplayMap: Record<string, string>;
|
|
1481
|
+
childByParentId: Record<string, any>;
|
|
1466
1482
|
}[];
|
|
1467
1483
|
};
|
|
1468
1484
|
target: {
|
|
@@ -1623,6 +1639,7 @@ declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScope
|
|
|
1623
1639
|
filters: any[];
|
|
1624
1640
|
rollups: any[];
|
|
1625
1641
|
rollupDisplayMap: Record<string, string>;
|
|
1642
|
+
childByParentId: Record<string, any>;
|
|
1626
1643
|
}[];
|
|
1627
1644
|
};
|
|
1628
1645
|
target: {
|
|
@@ -1689,6 +1706,21 @@ declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScope
|
|
|
1689
1706
|
filterType: string;
|
|
1690
1707
|
valuePath: string;
|
|
1691
1708
|
};
|
|
1709
|
+
} | {
|
|
1710
|
+
filterId: string;
|
|
1711
|
+
blockId: string;
|
|
1712
|
+
display: string;
|
|
1713
|
+
value: string;
|
|
1714
|
+
filterKey: string | undefined;
|
|
1715
|
+
source: {
|
|
1716
|
+
filterType: string;
|
|
1717
|
+
scope: string;
|
|
1718
|
+
profileTypes?: undefined;
|
|
1719
|
+
};
|
|
1720
|
+
target: {
|
|
1721
|
+
filterType: string;
|
|
1722
|
+
valuePath: string;
|
|
1723
|
+
};
|
|
1692
1724
|
})[];
|
|
1693
1725
|
})[];
|
|
1694
1726
|
} | null)[];
|
|
@@ -1973,8 +2005,39 @@ declare class BlockRegistry {
|
|
|
1973
2005
|
comp: string;
|
|
1974
2006
|
props?: any;
|
|
1975
2007
|
}): boolean;
|
|
1976
|
-
/**
|
|
1977
|
-
|
|
2008
|
+
/**
|
|
2009
|
+
* Check if a specific block has a specific capability.
|
|
2010
|
+
*
|
|
2011
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
2012
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
2013
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
2014
|
+
* for the `annotation` capability when the instance sets
|
|
2015
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
2016
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
2017
|
+
* existing 2-arg callers are unaffected.
|
|
2018
|
+
*/
|
|
2019
|
+
hasCapability(compType: string, capability: keyof BlockCapabilities, block?: {
|
|
2020
|
+
props?: any;
|
|
2021
|
+
}): boolean;
|
|
2022
|
+
/**
|
|
2023
|
+
* Per-instance annotation kill-switch.
|
|
2024
|
+
*
|
|
2025
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
2026
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
2027
|
+
* block instance can be opted out of annotation entirely by setting
|
|
2028
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
2029
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
2030
|
+
*
|
|
2031
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
2032
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
2033
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
2034
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
2035
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
2036
|
+
* type-level `false` isn't enough on its own.
|
|
2037
|
+
*/
|
|
2038
|
+
isAnnotationDisabledForBlock(block: {
|
|
2039
|
+
props?: any;
|
|
2040
|
+
}): boolean;
|
|
1978
2041
|
/**
|
|
1979
2042
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
1980
2043
|
* Useful for callers that need to know whether to query `valuePath.0` for existence
|
|
@@ -1996,7 +2059,15 @@ declare class BlockRegistry {
|
|
|
1996
2059
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
1997
2060
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
1998
2061
|
*
|
|
1999
|
-
*
|
|
2062
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
2063
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
2064
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
2065
|
+
* and because this method is the central gate used across every repo, the
|
|
2066
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
2067
|
+
* chunking/anno sync, filters).
|
|
2068
|
+
*
|
|
2069
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
2070
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
2000
2071
|
*/
|
|
2001
2072
|
getAnnotationEnabledBlocks(allBlocks: Array<{
|
|
2002
2073
|
comp: string;
|
package/dist/browser.d.ts
CHANGED
|
@@ -1334,6 +1334,21 @@ declare const processAuthorAndCommonFilters: (allTpls: any[], filterScopes: stri
|
|
|
1334
1334
|
filterType: string;
|
|
1335
1335
|
valuePath: string;
|
|
1336
1336
|
};
|
|
1337
|
+
} | {
|
|
1338
|
+
filterId: string;
|
|
1339
|
+
blockId: string;
|
|
1340
|
+
display: string;
|
|
1341
|
+
value: string;
|
|
1342
|
+
filterKey: string | undefined;
|
|
1343
|
+
source: {
|
|
1344
|
+
filterType: string;
|
|
1345
|
+
scope: string;
|
|
1346
|
+
profileTypes?: undefined;
|
|
1347
|
+
};
|
|
1348
|
+
target: {
|
|
1349
|
+
filterType: string;
|
|
1350
|
+
valuePath: string;
|
|
1351
|
+
};
|
|
1337
1352
|
})[];
|
|
1338
1353
|
}[];
|
|
1339
1354
|
};
|
|
@@ -1463,6 +1478,7 @@ declare const _self_managed_buildDocHierarchyConfig: ({ combinedDocumentBlocks,
|
|
|
1463
1478
|
filters: any[];
|
|
1464
1479
|
rollups: any[];
|
|
1465
1480
|
rollupDisplayMap: Record<string, string>;
|
|
1481
|
+
childByParentId: Record<string, any>;
|
|
1466
1482
|
}[];
|
|
1467
1483
|
};
|
|
1468
1484
|
target: {
|
|
@@ -1623,6 +1639,7 @@ declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScope
|
|
|
1623
1639
|
filters: any[];
|
|
1624
1640
|
rollups: any[];
|
|
1625
1641
|
rollupDisplayMap: Record<string, string>;
|
|
1642
|
+
childByParentId: Record<string, any>;
|
|
1626
1643
|
}[];
|
|
1627
1644
|
};
|
|
1628
1645
|
target: {
|
|
@@ -1689,6 +1706,21 @@ declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScope
|
|
|
1689
1706
|
filterType: string;
|
|
1690
1707
|
valuePath: string;
|
|
1691
1708
|
};
|
|
1709
|
+
} | {
|
|
1710
|
+
filterId: string;
|
|
1711
|
+
blockId: string;
|
|
1712
|
+
display: string;
|
|
1713
|
+
value: string;
|
|
1714
|
+
filterKey: string | undefined;
|
|
1715
|
+
source: {
|
|
1716
|
+
filterType: string;
|
|
1717
|
+
scope: string;
|
|
1718
|
+
profileTypes?: undefined;
|
|
1719
|
+
};
|
|
1720
|
+
target: {
|
|
1721
|
+
filterType: string;
|
|
1722
|
+
valuePath: string;
|
|
1723
|
+
};
|
|
1692
1724
|
})[];
|
|
1693
1725
|
})[];
|
|
1694
1726
|
} | null)[];
|
|
@@ -1973,8 +2005,39 @@ declare class BlockRegistry {
|
|
|
1973
2005
|
comp: string;
|
|
1974
2006
|
props?: any;
|
|
1975
2007
|
}): boolean;
|
|
1976
|
-
/**
|
|
1977
|
-
|
|
2008
|
+
/**
|
|
2009
|
+
* Check if a specific block has a specific capability.
|
|
2010
|
+
*
|
|
2011
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
2012
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
2013
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
2014
|
+
* for the `annotation` capability when the instance sets
|
|
2015
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
2016
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
2017
|
+
* existing 2-arg callers are unaffected.
|
|
2018
|
+
*/
|
|
2019
|
+
hasCapability(compType: string, capability: keyof BlockCapabilities, block?: {
|
|
2020
|
+
props?: any;
|
|
2021
|
+
}): boolean;
|
|
2022
|
+
/**
|
|
2023
|
+
* Per-instance annotation kill-switch.
|
|
2024
|
+
*
|
|
2025
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
2026
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
2027
|
+
* block instance can be opted out of annotation entirely by setting
|
|
2028
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
2029
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
2030
|
+
*
|
|
2031
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
2032
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
2033
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
2034
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
2035
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
2036
|
+
* type-level `false` isn't enough on its own.
|
|
2037
|
+
*/
|
|
2038
|
+
isAnnotationDisabledForBlock(block: {
|
|
2039
|
+
props?: any;
|
|
2040
|
+
}): boolean;
|
|
1978
2041
|
/**
|
|
1979
2042
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
1980
2043
|
* Useful for callers that need to know whether to query `valuePath.0` for existence
|
|
@@ -1996,7 +2059,15 @@ declare class BlockRegistry {
|
|
|
1996
2059
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
1997
2060
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
1998
2061
|
*
|
|
1999
|
-
*
|
|
2062
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
2063
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
2064
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
2065
|
+
* and because this method is the central gate used across every repo, the
|
|
2066
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
2067
|
+
* chunking/anno sync, filters).
|
|
2068
|
+
*
|
|
2069
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
2070
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
2000
2071
|
*/
|
|
2001
2072
|
getAnnotationEnabledBlocks(allBlocks: Array<{
|
|
2002
2073
|
comp: string;
|
package/dist/browser.js
CHANGED
|
@@ -625,11 +625,44 @@ var BlockRegistry = class {
|
|
|
625
625
|
return value === cond.equals;
|
|
626
626
|
});
|
|
627
627
|
}
|
|
628
|
-
/**
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
628
|
+
/**
|
|
629
|
+
* Check if a specific block has a specific capability.
|
|
630
|
+
*
|
|
631
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
632
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
633
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
634
|
+
* for the `annotation` capability when the instance sets
|
|
635
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
636
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
637
|
+
* existing 2-arg callers are unaffected.
|
|
638
|
+
*/
|
|
639
|
+
hasCapability(compType, capability, block) {
|
|
640
|
+
const def = this.blocks.get(compType);
|
|
641
|
+
if (!def) return false;
|
|
642
|
+
if (!def.capabilities[capability]) return false;
|
|
643
|
+
if (capability === "annotation" && block && this.isAnnotationDisabledForBlock(block)) {
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
return true;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Per-instance annotation kill-switch.
|
|
650
|
+
*
|
|
651
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
652
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
653
|
+
* block instance can be opted out of annotation entirely by setting
|
|
654
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
655
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
656
|
+
*
|
|
657
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
658
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
659
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
660
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
661
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
662
|
+
* type-level `false` isn't enough on its own.
|
|
663
|
+
*/
|
|
664
|
+
isAnnotationDisabledForBlock(block) {
|
|
665
|
+
return block?.props?.annotations?.disable === true;
|
|
633
666
|
}
|
|
634
667
|
/**
|
|
635
668
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
@@ -659,10 +692,19 @@ var BlockRegistry = class {
|
|
|
659
692
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
660
693
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
661
694
|
*
|
|
662
|
-
*
|
|
695
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
696
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
697
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
698
|
+
* and because this method is the central gate used across every repo, the
|
|
699
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
700
|
+
* chunking/anno sync, filters).
|
|
701
|
+
*
|
|
702
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
703
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
663
704
|
*/
|
|
664
705
|
getAnnotationEnabledBlocks(allBlocks) {
|
|
665
706
|
return allBlocks.filter((block) => {
|
|
707
|
+
if (this.isAnnotationDisabledForBlock(block)) return false;
|
|
666
708
|
const blockDef = this.blocks.get(block.comp);
|
|
667
709
|
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
668
710
|
return block.props?.annotation?.enable === true;
|
|
@@ -2324,6 +2366,24 @@ var processAuthorAndCommonFilters = (allTpls, filterScopes, annoEnabledBlocks =
|
|
|
2324
2366
|
filterType: "dateRangeType",
|
|
2325
2367
|
valuePath: "kp_date_published"
|
|
2326
2368
|
}
|
|
2369
|
+
},
|
|
2370
|
+
// "Documents" filter — narrows results to specific chosen documents of the
|
|
2371
|
+
// datasets in view, matched on their own _id. Options list those datasets'
|
|
2372
|
+
// documents by title (documentsType fetch, which uses the ambient contentTypes);
|
|
2373
|
+
// the backend matches { _id: { $in: [ids] } } via target valuePath "_id"
|
|
2374
|
+
// (getValuePathQuery ObjectId-casts any `_id`-ending path).
|
|
2375
|
+
{
|
|
2376
|
+
filterId: "documentsFilter",
|
|
2377
|
+
blockId: "documentsFilter",
|
|
2378
|
+
display: "Documents",
|
|
2379
|
+
value: "documents",
|
|
2380
|
+
filterKey: generateFilterKey({
|
|
2381
|
+
filterType: "valuePathType",
|
|
2382
|
+
valuePath: "_id",
|
|
2383
|
+
scope: "doc"
|
|
2384
|
+
}),
|
|
2385
|
+
source: { filterType: "documentsType", scope: "tags" },
|
|
2386
|
+
target: { filterType: "valuePathType", valuePath: "_id" }
|
|
2327
2387
|
}
|
|
2328
2388
|
]
|
|
2329
2389
|
}] : [];
|
|
@@ -2684,12 +2744,19 @@ var _self_managed_buildDocHierarchyConfig = ({
|
|
|
2684
2744
|
const t = allTpls.find((tp) => tp.kp_content_type === ct);
|
|
2685
2745
|
if (t?.general?.content?.title) rollupDisplayMap[ct] = t.general.content.title;
|
|
2686
2746
|
}
|
|
2747
|
+
const childByParentId = {};
|
|
2748
|
+
for (const r of rollupsWithParents) {
|
|
2749
|
+
if (r.parentFilterId && r.isTagRollup && r.source?.filterType === "tagType") {
|
|
2750
|
+
childByParentId[r.parentFilterId] = r;
|
|
2751
|
+
}
|
|
2752
|
+
}
|
|
2687
2753
|
return {
|
|
2688
2754
|
contentType: tpl.kp_content_type,
|
|
2689
2755
|
display: tplData?.general?.content?.title || tpl.kp_content_type,
|
|
2690
2756
|
filters: filtersWithParents,
|
|
2691
2757
|
rollups: rollupsWithParents,
|
|
2692
|
-
rollupDisplayMap
|
|
2758
|
+
rollupDisplayMap,
|
|
2759
|
+
childByParentId
|
|
2693
2760
|
};
|
|
2694
2761
|
});
|
|
2695
2762
|
const filteredPerDataset = perDataset.filter(
|
package/dist/browser.mjs
CHANGED
|
@@ -553,11 +553,44 @@ var BlockRegistry = class {
|
|
|
553
553
|
return value === cond.equals;
|
|
554
554
|
});
|
|
555
555
|
}
|
|
556
|
-
/**
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
556
|
+
/**
|
|
557
|
+
* Check if a specific block has a specific capability.
|
|
558
|
+
*
|
|
559
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
560
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
561
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
562
|
+
* for the `annotation` capability when the instance sets
|
|
563
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
564
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
565
|
+
* existing 2-arg callers are unaffected.
|
|
566
|
+
*/
|
|
567
|
+
hasCapability(compType, capability, block) {
|
|
568
|
+
const def = this.blocks.get(compType);
|
|
569
|
+
if (!def) return false;
|
|
570
|
+
if (!def.capabilities[capability]) return false;
|
|
571
|
+
if (capability === "annotation" && block && this.isAnnotationDisabledForBlock(block)) {
|
|
572
|
+
return false;
|
|
573
|
+
}
|
|
574
|
+
return true;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Per-instance annotation kill-switch.
|
|
578
|
+
*
|
|
579
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
580
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
581
|
+
* block instance can be opted out of annotation entirely by setting
|
|
582
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
583
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
584
|
+
*
|
|
585
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
586
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
587
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
588
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
589
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
590
|
+
* type-level `false` isn't enough on its own.
|
|
591
|
+
*/
|
|
592
|
+
isAnnotationDisabledForBlock(block) {
|
|
593
|
+
return block?.props?.annotations?.disable === true;
|
|
561
594
|
}
|
|
562
595
|
/**
|
|
563
596
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
@@ -587,10 +620,19 @@ var BlockRegistry = class {
|
|
|
587
620
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
588
621
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
589
622
|
*
|
|
590
|
-
*
|
|
623
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
624
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
625
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
626
|
+
* and because this method is the central gate used across every repo, the
|
|
627
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
628
|
+
* chunking/anno sync, filters).
|
|
629
|
+
*
|
|
630
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
631
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
591
632
|
*/
|
|
592
633
|
getAnnotationEnabledBlocks(allBlocks) {
|
|
593
634
|
return allBlocks.filter((block) => {
|
|
635
|
+
if (this.isAnnotationDisabledForBlock(block)) return false;
|
|
594
636
|
const blockDef = this.blocks.get(block.comp);
|
|
595
637
|
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
596
638
|
return block.props?.annotation?.enable === true;
|
|
@@ -2252,6 +2294,24 @@ var processAuthorAndCommonFilters = (allTpls, filterScopes, annoEnabledBlocks =
|
|
|
2252
2294
|
filterType: "dateRangeType",
|
|
2253
2295
|
valuePath: "kp_date_published"
|
|
2254
2296
|
}
|
|
2297
|
+
},
|
|
2298
|
+
// "Documents" filter — narrows results to specific chosen documents of the
|
|
2299
|
+
// datasets in view, matched on their own _id. Options list those datasets'
|
|
2300
|
+
// documents by title (documentsType fetch, which uses the ambient contentTypes);
|
|
2301
|
+
// the backend matches { _id: { $in: [ids] } } via target valuePath "_id"
|
|
2302
|
+
// (getValuePathQuery ObjectId-casts any `_id`-ending path).
|
|
2303
|
+
{
|
|
2304
|
+
filterId: "documentsFilter",
|
|
2305
|
+
blockId: "documentsFilter",
|
|
2306
|
+
display: "Documents",
|
|
2307
|
+
value: "documents",
|
|
2308
|
+
filterKey: generateFilterKey({
|
|
2309
|
+
filterType: "valuePathType",
|
|
2310
|
+
valuePath: "_id",
|
|
2311
|
+
scope: "doc"
|
|
2312
|
+
}),
|
|
2313
|
+
source: { filterType: "documentsType", scope: "tags" },
|
|
2314
|
+
target: { filterType: "valuePathType", valuePath: "_id" }
|
|
2255
2315
|
}
|
|
2256
2316
|
]
|
|
2257
2317
|
}] : [];
|
|
@@ -2612,12 +2672,19 @@ var _self_managed_buildDocHierarchyConfig = ({
|
|
|
2612
2672
|
const t = allTpls.find((tp) => tp.kp_content_type === ct);
|
|
2613
2673
|
if (t?.general?.content?.title) rollupDisplayMap[ct] = t.general.content.title;
|
|
2614
2674
|
}
|
|
2675
|
+
const childByParentId = {};
|
|
2676
|
+
for (const r of rollupsWithParents) {
|
|
2677
|
+
if (r.parentFilterId && r.isTagRollup && r.source?.filterType === "tagType") {
|
|
2678
|
+
childByParentId[r.parentFilterId] = r;
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2615
2681
|
return {
|
|
2616
2682
|
contentType: tpl.kp_content_type,
|
|
2617
2683
|
display: tplData?.general?.content?.title || tpl.kp_content_type,
|
|
2618
2684
|
filters: filtersWithParents,
|
|
2619
2685
|
rollups: rollupsWithParents,
|
|
2620
|
-
rollupDisplayMap
|
|
2686
|
+
rollupDisplayMap,
|
|
2687
|
+
childByParentId
|
|
2621
2688
|
};
|
|
2622
2689
|
});
|
|
2623
2690
|
const filteredPerDataset = perDataset.filter(
|
package/dist/node.d.mts
CHANGED
|
@@ -1342,6 +1342,21 @@ declare const processAuthorAndCommonFilters: (allTpls: any[], filterScopes: stri
|
|
|
1342
1342
|
filterType: string;
|
|
1343
1343
|
valuePath: string;
|
|
1344
1344
|
};
|
|
1345
|
+
} | {
|
|
1346
|
+
filterId: string;
|
|
1347
|
+
blockId: string;
|
|
1348
|
+
display: string;
|
|
1349
|
+
value: string;
|
|
1350
|
+
filterKey: string | undefined;
|
|
1351
|
+
source: {
|
|
1352
|
+
filterType: string;
|
|
1353
|
+
scope: string;
|
|
1354
|
+
profileTypes?: undefined;
|
|
1355
|
+
};
|
|
1356
|
+
target: {
|
|
1357
|
+
filterType: string;
|
|
1358
|
+
valuePath: string;
|
|
1359
|
+
};
|
|
1345
1360
|
})[];
|
|
1346
1361
|
}[];
|
|
1347
1362
|
};
|
|
@@ -1471,6 +1486,7 @@ declare const _self_managed_buildDocHierarchyConfig: ({ combinedDocumentBlocks,
|
|
|
1471
1486
|
filters: any[];
|
|
1472
1487
|
rollups: any[];
|
|
1473
1488
|
rollupDisplayMap: Record<string, string>;
|
|
1489
|
+
childByParentId: Record<string, any>;
|
|
1474
1490
|
}[];
|
|
1475
1491
|
};
|
|
1476
1492
|
target: {
|
|
@@ -1631,6 +1647,7 @@ declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScope
|
|
|
1631
1647
|
filters: any[];
|
|
1632
1648
|
rollups: any[];
|
|
1633
1649
|
rollupDisplayMap: Record<string, string>;
|
|
1650
|
+
childByParentId: Record<string, any>;
|
|
1634
1651
|
}[];
|
|
1635
1652
|
};
|
|
1636
1653
|
target: {
|
|
@@ -1697,6 +1714,21 @@ declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScope
|
|
|
1697
1714
|
filterType: string;
|
|
1698
1715
|
valuePath: string;
|
|
1699
1716
|
};
|
|
1717
|
+
} | {
|
|
1718
|
+
filterId: string;
|
|
1719
|
+
blockId: string;
|
|
1720
|
+
display: string;
|
|
1721
|
+
value: string;
|
|
1722
|
+
filterKey: string | undefined;
|
|
1723
|
+
source: {
|
|
1724
|
+
filterType: string;
|
|
1725
|
+
scope: string;
|
|
1726
|
+
profileTypes?: undefined;
|
|
1727
|
+
};
|
|
1728
|
+
target: {
|
|
1729
|
+
filterType: string;
|
|
1730
|
+
valuePath: string;
|
|
1731
|
+
};
|
|
1700
1732
|
})[];
|
|
1701
1733
|
})[];
|
|
1702
1734
|
} | null)[];
|
|
@@ -1981,8 +2013,39 @@ declare class BlockRegistry {
|
|
|
1981
2013
|
comp: string;
|
|
1982
2014
|
props?: any;
|
|
1983
2015
|
}): boolean;
|
|
1984
|
-
/**
|
|
1985
|
-
|
|
2016
|
+
/**
|
|
2017
|
+
* Check if a specific block has a specific capability.
|
|
2018
|
+
*
|
|
2019
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
2020
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
2021
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
2022
|
+
* for the `annotation` capability when the instance sets
|
|
2023
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
2024
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
2025
|
+
* existing 2-arg callers are unaffected.
|
|
2026
|
+
*/
|
|
2027
|
+
hasCapability(compType: string, capability: keyof BlockCapabilities, block?: {
|
|
2028
|
+
props?: any;
|
|
2029
|
+
}): boolean;
|
|
2030
|
+
/**
|
|
2031
|
+
* Per-instance annotation kill-switch.
|
|
2032
|
+
*
|
|
2033
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
2034
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
2035
|
+
* block instance can be opted out of annotation entirely by setting
|
|
2036
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
2037
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
2038
|
+
*
|
|
2039
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
2040
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
2041
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
2042
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
2043
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
2044
|
+
* type-level `false` isn't enough on its own.
|
|
2045
|
+
*/
|
|
2046
|
+
isAnnotationDisabledForBlock(block: {
|
|
2047
|
+
props?: any;
|
|
2048
|
+
}): boolean;
|
|
1986
2049
|
/**
|
|
1987
2050
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
1988
2051
|
* Useful for callers that need to know whether to query `valuePath.0` for existence
|
|
@@ -2004,7 +2067,15 @@ declare class BlockRegistry {
|
|
|
2004
2067
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
2005
2068
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
2006
2069
|
*
|
|
2007
|
-
*
|
|
2070
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
2071
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
2072
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
2073
|
+
* and because this method is the central gate used across every repo, the
|
|
2074
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
2075
|
+
* chunking/anno sync, filters).
|
|
2076
|
+
*
|
|
2077
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
2078
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
2008
2079
|
*/
|
|
2009
2080
|
getAnnotationEnabledBlocks(allBlocks: Array<{
|
|
2010
2081
|
comp: string;
|