@okf/ootils 1.40.0 → 1.41.1
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 +25 -1
- package/dist/browser.d.ts +25 -1
- package/dist/browser.js +70 -12
- package/dist/browser.mjs +70 -12
- package/dist/node.d.mts +25 -1
- package/dist/node.d.ts +25 -1
- package/dist/node.js +70 -12
- package/dist/node.mjs +70 -12
- package/dist/universal.d.mts +25 -1
- package/dist/universal.d.ts +25 -1
- package/dist/universal.js +70 -12
- package/dist/universal.mjs +70 -12
- package/package.json +1 -1
package/dist/universal.mjs
CHANGED
|
@@ -652,7 +652,8 @@ var collectMarkIdsInOrder = (editorState) => {
|
|
|
652
652
|
var MAX_DEPTH_ROLLUP_POSSIBILITIES = 10;
|
|
653
653
|
function getRollupPossibilities({
|
|
654
654
|
tagType,
|
|
655
|
-
allTpls
|
|
655
|
+
allTpls,
|
|
656
|
+
includeSelfHead = false
|
|
656
657
|
}) {
|
|
657
658
|
const thisTagTpl = allTpls.find((d) => d.kp_content_type === tagType);
|
|
658
659
|
if (!thisTagTpl) return [];
|
|
@@ -684,7 +685,8 @@ function getRollupPossibilities({
|
|
|
684
685
|
chains.push({
|
|
685
686
|
rollupType: "tagType",
|
|
686
687
|
tagTypeCollectionToRollup: tagType,
|
|
687
|
-
rollupPath: [...visited, startTagType, nextTagType]
|
|
688
|
+
rollupPath: [...visited, startTagType, nextTagType],
|
|
689
|
+
filterDisplay: block.props?.shortLabel || block.props?.label
|
|
688
690
|
});
|
|
689
691
|
if (visited.length < maxDepth - 1) {
|
|
690
692
|
const nextChains = findTagChains(
|
|
@@ -730,7 +732,8 @@ function getRollupPossibilities({
|
|
|
730
732
|
const directChain = {
|
|
731
733
|
rollupType: "tagType",
|
|
732
734
|
tagTypeCollectionToRollup: tagType,
|
|
733
|
-
rollupPath: [tagType, block.props.tagType]
|
|
735
|
+
rollupPath: [tagType, block.props.tagType],
|
|
736
|
+
filterDisplay: block.props?.shortLabel || block.props?.label
|
|
734
737
|
};
|
|
735
738
|
const deeperChains = findTagChains(
|
|
736
739
|
block.props?.tagType,
|
|
@@ -739,7 +742,14 @@ function getRollupPossibilities({
|
|
|
739
742
|
);
|
|
740
743
|
return [directChain, ...deeperChains];
|
|
741
744
|
});
|
|
742
|
-
|
|
745
|
+
const selfHeadRollup = includeSelfHead && nestedTagRollups.length > 0 && singleLevelValuePathRollups.length === 0 ? [
|
|
746
|
+
{
|
|
747
|
+
rollupType: "tagType",
|
|
748
|
+
tagTypeCollectionToRollup: tagType,
|
|
749
|
+
rollupPath: [tagType]
|
|
750
|
+
}
|
|
751
|
+
] : [];
|
|
752
|
+
return [...singleLevelValuePathRollups, ...selfHeadRollup, ...nestedTagRollups];
|
|
743
753
|
}
|
|
744
754
|
|
|
745
755
|
// src/bullmq/GLOBAL_BULLMQ_CONFIG.js
|
|
@@ -1644,6 +1654,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
1644
1654
|
if (isTerminalValuePath) {
|
|
1645
1655
|
return element.filterDisplay || lastItemInPath;
|
|
1646
1656
|
}
|
|
1657
|
+
if (element.filterDisplay) return element.filterDisplay;
|
|
1647
1658
|
const lastTag = rollupPath[rollupPath.length - 1];
|
|
1648
1659
|
const lastTagTpl = allTpls.find(
|
|
1649
1660
|
(tpl) => tpl.kp_content_type === lastTag
|
|
@@ -1688,6 +1699,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
1688
1699
|
scope: section.filterScope
|
|
1689
1700
|
};
|
|
1690
1701
|
};
|
|
1702
|
+
const isSelfTerminalTag = element.rollupPath.length === 1 && !isLastTagProfile && !isTerminalValuePath;
|
|
1691
1703
|
return {
|
|
1692
1704
|
filterId: `ROLLUP_${section.filterScope}_${element.rollupPath.join(
|
|
1693
1705
|
"_"
|
|
@@ -1701,9 +1713,14 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
1701
1713
|
scope: section.filterScope
|
|
1702
1714
|
}),
|
|
1703
1715
|
contentType: element.rollupPath[0],
|
|
1704
|
-
path: `tags.${element.rollupPath[1]}`,
|
|
1716
|
+
path: `tags.${isSelfTerminalTag ? element.rollupPath[0] : element.rollupPath[1]}`,
|
|
1705
1717
|
source: getSourceConfig(),
|
|
1706
|
-
target: {
|
|
1718
|
+
target: isSelfTerminalTag ? {
|
|
1719
|
+
filterType: "tagType",
|
|
1720
|
+
tagType: element.rollupPath[0],
|
|
1721
|
+
rollupPath: element.rollupPath,
|
|
1722
|
+
...isAnno && { isAnno: true }
|
|
1723
|
+
} : {
|
|
1707
1724
|
filterType: "nestedRollupTagType",
|
|
1708
1725
|
rollupPath: element.rollupPath,
|
|
1709
1726
|
...isAnno && { isAnno: true }
|
|
@@ -1910,7 +1927,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls, { smTagTypesConfig } = {}
|
|
|
1910
1927
|
return {
|
|
1911
1928
|
contentType: tpl.kp_content_type,
|
|
1912
1929
|
blocks: allBlocks.filter((block) => block.valuePath.startsWith("tags.") && ["TagsInputSingle", "TagsInputMulti"].includes(block.comp)).flatMap((block) => {
|
|
1913
|
-
const possibilities = getRollupPossibilities({ tagType: block.props.tagType, allTpls });
|
|
1930
|
+
const possibilities = getRollupPossibilities({ tagType: block.props.tagType, allTpls, includeSelfHead: true });
|
|
1914
1931
|
return possibilities.map((p) => ({
|
|
1915
1932
|
...p,
|
|
1916
1933
|
filterType: p.rollupPath ? "nestedRollupTagType" : "rollupValuePathType"
|
|
@@ -2243,13 +2260,16 @@ var buildTagTypeParentMap = (tagTypesInGroup, allTpls) => {
|
|
|
2243
2260
|
const tagBlocks = blocks.filter(
|
|
2244
2261
|
(block) => block.valuePath?.startsWith("tags.") && block.props?.tagType
|
|
2245
2262
|
);
|
|
2263
|
+
const referencedTagTypes = /* @__PURE__ */ new Set();
|
|
2246
2264
|
for (const block of tagBlocks) {
|
|
2247
2265
|
const referencedTagType = block.props.tagType;
|
|
2248
2266
|
if (tagTypeSet.has(referencedTagType) && referencedTagType !== tagType) {
|
|
2249
|
-
|
|
2250
|
-
break;
|
|
2267
|
+
referencedTagTypes.add(referencedTagType);
|
|
2251
2268
|
}
|
|
2252
2269
|
}
|
|
2270
|
+
if (referencedTagTypes.size === 1) {
|
|
2271
|
+
parentMap.set(tagType, [...referencedTagTypes][0]);
|
|
2272
|
+
}
|
|
2253
2273
|
}
|
|
2254
2274
|
for (const child of parentMap.keys()) {
|
|
2255
2275
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -2323,6 +2343,34 @@ var sortFiltersHierarchically = (filters) => {
|
|
|
2323
2343
|
return sorted;
|
|
2324
2344
|
};
|
|
2325
2345
|
|
|
2346
|
+
// src/utils/autoGenFilterConfigsFromTpl/utils/deduplicateRollupTagFilters.ts
|
|
2347
|
+
var deduplicateRollupTagFilters = (rollups) => {
|
|
2348
|
+
const tagTerminals = [];
|
|
2349
|
+
const nonTag = [];
|
|
2350
|
+
for (const r of rollups) {
|
|
2351
|
+
const rp = r.target?.rollupPath;
|
|
2352
|
+
if (rp?.length && !rp[rp.length - 1].startsWith("main.")) {
|
|
2353
|
+
tagTerminals.push(r);
|
|
2354
|
+
} else {
|
|
2355
|
+
nonTag.push({ ...r, isTagRollup: false });
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
if (tagTerminals.length === 0) return nonTag;
|
|
2359
|
+
const byTerminal = /* @__PURE__ */ new Map();
|
|
2360
|
+
for (const r of tagTerminals) {
|
|
2361
|
+
const terminal = r.target.rollupPath[r.target.rollupPath.length - 1];
|
|
2362
|
+
const existing = byTerminal.get(terminal);
|
|
2363
|
+
if (!existing || r.target.rollupPath.length < existing.target.rollupPath.length) {
|
|
2364
|
+
byTerminal.set(terminal, r);
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
const dedupedTags = [...byTerminal.values()].map((r) => ({
|
|
2368
|
+
...r,
|
|
2369
|
+
isTagRollup: true
|
|
2370
|
+
}));
|
|
2371
|
+
return [...nonTag, ...dedupedTags];
|
|
2372
|
+
};
|
|
2373
|
+
|
|
2326
2374
|
// src/utils/autoGenFilterConfigsFromTpl/utils/_self_managed_buildDocHierarchyConfig.ts
|
|
2327
2375
|
var injectFilterOptionsBy = (filters) => filters.map(
|
|
2328
2376
|
(f) => f.parentFilterId ? { ...f, source: { ...f.source, filterOptionsBy: { filterId: f.parentFilterId } } } : f
|
|
@@ -2429,24 +2477,34 @@ var _self_managed_buildDocHierarchyConfig = ({
|
|
|
2429
2477
|
const dedupedFilters = filtersWithCommonFlag.filter(
|
|
2430
2478
|
(f) => !rollupSourceKeys.has(JSON.stringify(f.source))
|
|
2431
2479
|
);
|
|
2432
|
-
const
|
|
2480
|
+
const dedupedRollupConfigs = deduplicateRollupTagFilters(rollupConfigs);
|
|
2481
|
+
const combined = [...dedupedFilters, ...dedupedRollupConfigs];
|
|
2433
2482
|
const combinedWithParents = injectFilterOptionsBy(
|
|
2434
2483
|
sortFiltersHierarchically(
|
|
2435
2484
|
attachParentFields(combined, allTpls)
|
|
2436
2485
|
)
|
|
2437
2486
|
);
|
|
2438
|
-
const rollupFilterIds = new Set(
|
|
2487
|
+
const rollupFilterIds = new Set(dedupedRollupConfigs.map((r) => r.filterId));
|
|
2439
2488
|
const filtersWithParents = combinedWithParents.filter(
|
|
2440
2489
|
(f) => !rollupFilterIds.has(f.filterId)
|
|
2441
2490
|
);
|
|
2442
2491
|
const rollupsWithParents = combinedWithParents.filter(
|
|
2443
2492
|
(f) => rollupFilterIds.has(f.filterId)
|
|
2444
2493
|
);
|
|
2494
|
+
const rollupContentTypes = new Set(
|
|
2495
|
+
rollupsWithParents.filter((r) => r.target?.rollupPath).flatMap((r) => r.target.rollupPath)
|
|
2496
|
+
);
|
|
2497
|
+
const rollupDisplayMap = {};
|
|
2498
|
+
for (const ct of rollupContentTypes) {
|
|
2499
|
+
const t = allTpls.find((tp) => tp.kp_content_type === ct);
|
|
2500
|
+
if (t?.general?.content?.title) rollupDisplayMap[ct] = t.general.content.title;
|
|
2501
|
+
}
|
|
2445
2502
|
return {
|
|
2446
2503
|
contentType: tpl.kp_content_type,
|
|
2447
2504
|
display: tplData?.general?.content?.title || tpl.kp_content_type,
|
|
2448
2505
|
filters: filtersWithParents,
|
|
2449
|
-
rollups: rollupsWithParents
|
|
2506
|
+
rollups: rollupsWithParents,
|
|
2507
|
+
rollupDisplayMap
|
|
2450
2508
|
};
|
|
2451
2509
|
});
|
|
2452
2510
|
const filteredPerDataset = perDataset.filter(
|