@okf/ootils 1.39.3 → 1.41.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 +25 -1
- package/dist/browser.d.ts +25 -1
- package/dist/browser.js +62 -10
- package/dist/browser.mjs +62 -10
- package/dist/node.d.mts +121 -2
- package/dist/node.d.ts +121 -2
- package/dist/node.js +198 -10
- package/dist/node.mjs +198 -10
- package/dist/universal.d.mts +25 -1
- package/dist/universal.d.ts +25 -1
- package/dist/universal.js +62 -10
- package/dist/universal.mjs +62 -10
- 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
|
|
@@ -1910,7 +1921,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls, { smTagTypesConfig } = {}
|
|
|
1910
1921
|
return {
|
|
1911
1922
|
contentType: tpl.kp_content_type,
|
|
1912
1923
|
blocks: allBlocks.filter((block) => block.valuePath.startsWith("tags.") && ["TagsInputSingle", "TagsInputMulti"].includes(block.comp)).flatMap((block) => {
|
|
1913
|
-
const possibilities = getRollupPossibilities({ tagType: block.props.tagType, allTpls });
|
|
1924
|
+
const possibilities = getRollupPossibilities({ tagType: block.props.tagType, allTpls, includeSelfHead: true });
|
|
1914
1925
|
return possibilities.map((p) => ({
|
|
1915
1926
|
...p,
|
|
1916
1927
|
filterType: p.rollupPath ? "nestedRollupTagType" : "rollupValuePathType"
|
|
@@ -2243,13 +2254,16 @@ var buildTagTypeParentMap = (tagTypesInGroup, allTpls) => {
|
|
|
2243
2254
|
const tagBlocks = blocks.filter(
|
|
2244
2255
|
(block) => block.valuePath?.startsWith("tags.") && block.props?.tagType
|
|
2245
2256
|
);
|
|
2257
|
+
const referencedTagTypes = /* @__PURE__ */ new Set();
|
|
2246
2258
|
for (const block of tagBlocks) {
|
|
2247
2259
|
const referencedTagType = block.props.tagType;
|
|
2248
2260
|
if (tagTypeSet.has(referencedTagType) && referencedTagType !== tagType) {
|
|
2249
|
-
|
|
2250
|
-
break;
|
|
2261
|
+
referencedTagTypes.add(referencedTagType);
|
|
2251
2262
|
}
|
|
2252
2263
|
}
|
|
2264
|
+
if (referencedTagTypes.size === 1) {
|
|
2265
|
+
parentMap.set(tagType, [...referencedTagTypes][0]);
|
|
2266
|
+
}
|
|
2253
2267
|
}
|
|
2254
2268
|
for (const child of parentMap.keys()) {
|
|
2255
2269
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -2323,6 +2337,34 @@ var sortFiltersHierarchically = (filters) => {
|
|
|
2323
2337
|
return sorted;
|
|
2324
2338
|
};
|
|
2325
2339
|
|
|
2340
|
+
// src/utils/autoGenFilterConfigsFromTpl/utils/deduplicateRollupTagFilters.ts
|
|
2341
|
+
var deduplicateRollupTagFilters = (rollups) => {
|
|
2342
|
+
const tagTerminals = [];
|
|
2343
|
+
const nonTag = [];
|
|
2344
|
+
for (const r of rollups) {
|
|
2345
|
+
const rp = r.target?.rollupPath;
|
|
2346
|
+
if (rp?.length && !rp[rp.length - 1].startsWith("main.")) {
|
|
2347
|
+
tagTerminals.push(r);
|
|
2348
|
+
} else {
|
|
2349
|
+
nonTag.push({ ...r, isTagRollup: false });
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
if (tagTerminals.length === 0) return nonTag;
|
|
2353
|
+
const byTerminal = /* @__PURE__ */ new Map();
|
|
2354
|
+
for (const r of tagTerminals) {
|
|
2355
|
+
const terminal = r.target.rollupPath[r.target.rollupPath.length - 1];
|
|
2356
|
+
const existing = byTerminal.get(terminal);
|
|
2357
|
+
if (!existing || r.target.rollupPath.length < existing.target.rollupPath.length) {
|
|
2358
|
+
byTerminal.set(terminal, r);
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
const dedupedTags = [...byTerminal.values()].map((r) => ({
|
|
2362
|
+
...r,
|
|
2363
|
+
isTagRollup: true
|
|
2364
|
+
}));
|
|
2365
|
+
return [...nonTag, ...dedupedTags];
|
|
2366
|
+
};
|
|
2367
|
+
|
|
2326
2368
|
// src/utils/autoGenFilterConfigsFromTpl/utils/_self_managed_buildDocHierarchyConfig.ts
|
|
2327
2369
|
var injectFilterOptionsBy = (filters) => filters.map(
|
|
2328
2370
|
(f) => f.parentFilterId ? { ...f, source: { ...f.source, filterOptionsBy: { filterId: f.parentFilterId } } } : f
|
|
@@ -2429,24 +2471,34 @@ var _self_managed_buildDocHierarchyConfig = ({
|
|
|
2429
2471
|
const dedupedFilters = filtersWithCommonFlag.filter(
|
|
2430
2472
|
(f) => !rollupSourceKeys.has(JSON.stringify(f.source))
|
|
2431
2473
|
);
|
|
2432
|
-
const
|
|
2474
|
+
const dedupedRollupConfigs = deduplicateRollupTagFilters(rollupConfigs);
|
|
2475
|
+
const combined = [...dedupedFilters, ...dedupedRollupConfigs];
|
|
2433
2476
|
const combinedWithParents = injectFilterOptionsBy(
|
|
2434
2477
|
sortFiltersHierarchically(
|
|
2435
2478
|
attachParentFields(combined, allTpls)
|
|
2436
2479
|
)
|
|
2437
2480
|
);
|
|
2438
|
-
const rollupFilterIds = new Set(
|
|
2481
|
+
const rollupFilterIds = new Set(dedupedRollupConfigs.map((r) => r.filterId));
|
|
2439
2482
|
const filtersWithParents = combinedWithParents.filter(
|
|
2440
2483
|
(f) => !rollupFilterIds.has(f.filterId)
|
|
2441
2484
|
);
|
|
2442
2485
|
const rollupsWithParents = combinedWithParents.filter(
|
|
2443
2486
|
(f) => rollupFilterIds.has(f.filterId)
|
|
2444
2487
|
);
|
|
2488
|
+
const rollupContentTypes = new Set(
|
|
2489
|
+
rollupsWithParents.filter((r) => r.target?.rollupPath).flatMap((r) => r.target.rollupPath)
|
|
2490
|
+
);
|
|
2491
|
+
const rollupDisplayMap = {};
|
|
2492
|
+
for (const ct of rollupContentTypes) {
|
|
2493
|
+
const t = allTpls.find((tp) => tp.kp_content_type === ct);
|
|
2494
|
+
if (t?.general?.content?.title) rollupDisplayMap[ct] = t.general.content.title;
|
|
2495
|
+
}
|
|
2445
2496
|
return {
|
|
2446
2497
|
contentType: tpl.kp_content_type,
|
|
2447
2498
|
display: tplData?.general?.content?.title || tpl.kp_content_type,
|
|
2448
2499
|
filters: filtersWithParents,
|
|
2449
|
-
rollups: rollupsWithParents
|
|
2500
|
+
rollups: rollupsWithParents,
|
|
2501
|
+
rollupDisplayMap
|
|
2450
2502
|
};
|
|
2451
2503
|
});
|
|
2452
2504
|
const filteredPerDataset = perDataset.filter(
|