@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/node.js
CHANGED
|
@@ -2959,7 +2959,8 @@ var collectMarkIdsInOrder = (editorState) => {
|
|
|
2959
2959
|
var MAX_DEPTH_ROLLUP_POSSIBILITIES = 10;
|
|
2960
2960
|
function getRollupPossibilities({
|
|
2961
2961
|
tagType,
|
|
2962
|
-
allTpls
|
|
2962
|
+
allTpls,
|
|
2963
|
+
includeSelfHead = false
|
|
2963
2964
|
}) {
|
|
2964
2965
|
const thisTagTpl = allTpls.find((d) => d.kp_content_type === tagType);
|
|
2965
2966
|
if (!thisTagTpl) return [];
|
|
@@ -2991,7 +2992,8 @@ function getRollupPossibilities({
|
|
|
2991
2992
|
chains.push({
|
|
2992
2993
|
rollupType: "tagType",
|
|
2993
2994
|
tagTypeCollectionToRollup: tagType,
|
|
2994
|
-
rollupPath: [...visited, startTagType, nextTagType]
|
|
2995
|
+
rollupPath: [...visited, startTagType, nextTagType],
|
|
2996
|
+
filterDisplay: block.props?.shortLabel || block.props?.label
|
|
2995
2997
|
});
|
|
2996
2998
|
if (visited.length < maxDepth - 1) {
|
|
2997
2999
|
const nextChains = findTagChains(
|
|
@@ -3037,7 +3039,8 @@ function getRollupPossibilities({
|
|
|
3037
3039
|
const directChain = {
|
|
3038
3040
|
rollupType: "tagType",
|
|
3039
3041
|
tagTypeCollectionToRollup: tagType,
|
|
3040
|
-
rollupPath: [tagType, block.props.tagType]
|
|
3042
|
+
rollupPath: [tagType, block.props.tagType],
|
|
3043
|
+
filterDisplay: block.props?.shortLabel || block.props?.label
|
|
3041
3044
|
};
|
|
3042
3045
|
const deeperChains = findTagChains(
|
|
3043
3046
|
block.props?.tagType,
|
|
@@ -3046,7 +3049,14 @@ function getRollupPossibilities({
|
|
|
3046
3049
|
);
|
|
3047
3050
|
return [directChain, ...deeperChains];
|
|
3048
3051
|
});
|
|
3049
|
-
|
|
3052
|
+
const selfHeadRollup = includeSelfHead && nestedTagRollups.length > 0 && singleLevelValuePathRollups.length === 0 ? [
|
|
3053
|
+
{
|
|
3054
|
+
rollupType: "tagType",
|
|
3055
|
+
tagTypeCollectionToRollup: tagType,
|
|
3056
|
+
rollupPath: [tagType]
|
|
3057
|
+
}
|
|
3058
|
+
] : [];
|
|
3059
|
+
return [...singleLevelValuePathRollups, ...selfHeadRollup, ...nestedTagRollups];
|
|
3050
3060
|
}
|
|
3051
3061
|
|
|
3052
3062
|
// src/universal.ts
|
|
@@ -3454,6 +3464,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
3454
3464
|
if (isTerminalValuePath) {
|
|
3455
3465
|
return element.filterDisplay || lastItemInPath;
|
|
3456
3466
|
}
|
|
3467
|
+
if (element.filterDisplay) return element.filterDisplay;
|
|
3457
3468
|
const lastTag = rollupPath[rollupPath.length - 1];
|
|
3458
3469
|
const lastTagTpl = allTpls.find(
|
|
3459
3470
|
(tpl) => tpl.kp_content_type === lastTag
|
|
@@ -3498,6 +3509,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
3498
3509
|
scope: section.filterScope
|
|
3499
3510
|
};
|
|
3500
3511
|
};
|
|
3512
|
+
const isSelfTerminalTag = element.rollupPath.length === 1 && !isLastTagProfile && !isTerminalValuePath;
|
|
3501
3513
|
return {
|
|
3502
3514
|
filterId: `ROLLUP_${section.filterScope}_${element.rollupPath.join(
|
|
3503
3515
|
"_"
|
|
@@ -3511,9 +3523,14 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
3511
3523
|
scope: section.filterScope
|
|
3512
3524
|
}),
|
|
3513
3525
|
contentType: element.rollupPath[0],
|
|
3514
|
-
path: `tags.${element.rollupPath[1]}`,
|
|
3526
|
+
path: `tags.${isSelfTerminalTag ? element.rollupPath[0] : element.rollupPath[1]}`,
|
|
3515
3527
|
source: getSourceConfig(),
|
|
3516
|
-
target: {
|
|
3528
|
+
target: isSelfTerminalTag ? {
|
|
3529
|
+
filterType: "tagType",
|
|
3530
|
+
tagType: element.rollupPath[0],
|
|
3531
|
+
rollupPath: element.rollupPath,
|
|
3532
|
+
...isAnno && { isAnno: true }
|
|
3533
|
+
} : {
|
|
3517
3534
|
filterType: "nestedRollupTagType",
|
|
3518
3535
|
rollupPath: element.rollupPath,
|
|
3519
3536
|
...isAnno && { isAnno: true }
|
|
@@ -3720,7 +3737,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls, { smTagTypesConfig } = {}
|
|
|
3720
3737
|
return {
|
|
3721
3738
|
contentType: tpl.kp_content_type,
|
|
3722
3739
|
blocks: allBlocks.filter((block) => block.valuePath.startsWith("tags.") && ["TagsInputSingle", "TagsInputMulti"].includes(block.comp)).flatMap((block) => {
|
|
3723
|
-
const possibilities = getRollupPossibilities({ tagType: block.props.tagType, allTpls });
|
|
3740
|
+
const possibilities = getRollupPossibilities({ tagType: block.props.tagType, allTpls, includeSelfHead: true });
|
|
3724
3741
|
return possibilities.map((p) => ({
|
|
3725
3742
|
...p,
|
|
3726
3743
|
filterType: p.rollupPath ? "nestedRollupTagType" : "rollupValuePathType"
|
|
@@ -4053,13 +4070,16 @@ var buildTagTypeParentMap = (tagTypesInGroup, allTpls) => {
|
|
|
4053
4070
|
const tagBlocks = blocks.filter(
|
|
4054
4071
|
(block) => block.valuePath?.startsWith("tags.") && block.props?.tagType
|
|
4055
4072
|
);
|
|
4073
|
+
const referencedTagTypes = /* @__PURE__ */ new Set();
|
|
4056
4074
|
for (const block of tagBlocks) {
|
|
4057
4075
|
const referencedTagType = block.props.tagType;
|
|
4058
4076
|
if (tagTypeSet.has(referencedTagType) && referencedTagType !== tagType) {
|
|
4059
|
-
|
|
4060
|
-
break;
|
|
4077
|
+
referencedTagTypes.add(referencedTagType);
|
|
4061
4078
|
}
|
|
4062
4079
|
}
|
|
4080
|
+
if (referencedTagTypes.size === 1) {
|
|
4081
|
+
parentMap.set(tagType, [...referencedTagTypes][0]);
|
|
4082
|
+
}
|
|
4063
4083
|
}
|
|
4064
4084
|
for (const child of parentMap.keys()) {
|
|
4065
4085
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -4133,6 +4153,34 @@ var sortFiltersHierarchically = (filters) => {
|
|
|
4133
4153
|
return sorted;
|
|
4134
4154
|
};
|
|
4135
4155
|
|
|
4156
|
+
// src/utils/autoGenFilterConfigsFromTpl/utils/deduplicateRollupTagFilters.ts
|
|
4157
|
+
var deduplicateRollupTagFilters = (rollups) => {
|
|
4158
|
+
const tagTerminals = [];
|
|
4159
|
+
const nonTag = [];
|
|
4160
|
+
for (const r of rollups) {
|
|
4161
|
+
const rp = r.target?.rollupPath;
|
|
4162
|
+
if (rp?.length && !rp[rp.length - 1].startsWith("main.")) {
|
|
4163
|
+
tagTerminals.push(r);
|
|
4164
|
+
} else {
|
|
4165
|
+
nonTag.push({ ...r, isTagRollup: false });
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4168
|
+
if (tagTerminals.length === 0) return nonTag;
|
|
4169
|
+
const byTerminal = /* @__PURE__ */ new Map();
|
|
4170
|
+
for (const r of tagTerminals) {
|
|
4171
|
+
const terminal = r.target.rollupPath[r.target.rollupPath.length - 1];
|
|
4172
|
+
const existing = byTerminal.get(terminal);
|
|
4173
|
+
if (!existing || r.target.rollupPath.length < existing.target.rollupPath.length) {
|
|
4174
|
+
byTerminal.set(terminal, r);
|
|
4175
|
+
}
|
|
4176
|
+
}
|
|
4177
|
+
const dedupedTags = [...byTerminal.values()].map((r) => ({
|
|
4178
|
+
...r,
|
|
4179
|
+
isTagRollup: true
|
|
4180
|
+
}));
|
|
4181
|
+
return [...nonTag, ...dedupedTags];
|
|
4182
|
+
};
|
|
4183
|
+
|
|
4136
4184
|
// src/utils/autoGenFilterConfigsFromTpl/utils/_self_managed_buildDocHierarchyConfig.ts
|
|
4137
4185
|
var injectFilterOptionsBy = (filters) => filters.map(
|
|
4138
4186
|
(f) => f.parentFilterId ? { ...f, source: { ...f.source, filterOptionsBy: { filterId: f.parentFilterId } } } : f
|
|
@@ -4239,24 +4287,34 @@ var _self_managed_buildDocHierarchyConfig = ({
|
|
|
4239
4287
|
const dedupedFilters = filtersWithCommonFlag.filter(
|
|
4240
4288
|
(f) => !rollupSourceKeys.has(JSON.stringify(f.source))
|
|
4241
4289
|
);
|
|
4242
|
-
const
|
|
4290
|
+
const dedupedRollupConfigs = deduplicateRollupTagFilters(rollupConfigs);
|
|
4291
|
+
const combined = [...dedupedFilters, ...dedupedRollupConfigs];
|
|
4243
4292
|
const combinedWithParents = injectFilterOptionsBy(
|
|
4244
4293
|
sortFiltersHierarchically(
|
|
4245
4294
|
attachParentFields(combined, allTpls)
|
|
4246
4295
|
)
|
|
4247
4296
|
);
|
|
4248
|
-
const rollupFilterIds = new Set(
|
|
4297
|
+
const rollupFilterIds = new Set(dedupedRollupConfigs.map((r) => r.filterId));
|
|
4249
4298
|
const filtersWithParents = combinedWithParents.filter(
|
|
4250
4299
|
(f) => !rollupFilterIds.has(f.filterId)
|
|
4251
4300
|
);
|
|
4252
4301
|
const rollupsWithParents = combinedWithParents.filter(
|
|
4253
4302
|
(f) => rollupFilterIds.has(f.filterId)
|
|
4254
4303
|
);
|
|
4304
|
+
const rollupContentTypes = new Set(
|
|
4305
|
+
rollupsWithParents.filter((r) => r.target?.rollupPath).flatMap((r) => r.target.rollupPath)
|
|
4306
|
+
);
|
|
4307
|
+
const rollupDisplayMap = {};
|
|
4308
|
+
for (const ct of rollupContentTypes) {
|
|
4309
|
+
const t = allTpls.find((tp) => tp.kp_content_type === ct);
|
|
4310
|
+
if (t?.general?.content?.title) rollupDisplayMap[ct] = t.general.content.title;
|
|
4311
|
+
}
|
|
4255
4312
|
return {
|
|
4256
4313
|
contentType: tpl.kp_content_type,
|
|
4257
4314
|
display: tplData?.general?.content?.title || tpl.kp_content_type,
|
|
4258
4315
|
filters: filtersWithParents,
|
|
4259
|
-
rollups: rollupsWithParents
|
|
4316
|
+
rollups: rollupsWithParents,
|
|
4317
|
+
rollupDisplayMap
|
|
4260
4318
|
};
|
|
4261
4319
|
});
|
|
4262
4320
|
const filteredPerDataset = perDataset.filter(
|
package/dist/node.mjs
CHANGED
|
@@ -2887,7 +2887,8 @@ var collectMarkIdsInOrder = (editorState) => {
|
|
|
2887
2887
|
var MAX_DEPTH_ROLLUP_POSSIBILITIES = 10;
|
|
2888
2888
|
function getRollupPossibilities({
|
|
2889
2889
|
tagType,
|
|
2890
|
-
allTpls
|
|
2890
|
+
allTpls,
|
|
2891
|
+
includeSelfHead = false
|
|
2891
2892
|
}) {
|
|
2892
2893
|
const thisTagTpl = allTpls.find((d) => d.kp_content_type === tagType);
|
|
2893
2894
|
if (!thisTagTpl) return [];
|
|
@@ -2919,7 +2920,8 @@ function getRollupPossibilities({
|
|
|
2919
2920
|
chains.push({
|
|
2920
2921
|
rollupType: "tagType",
|
|
2921
2922
|
tagTypeCollectionToRollup: tagType,
|
|
2922
|
-
rollupPath: [...visited, startTagType, nextTagType]
|
|
2923
|
+
rollupPath: [...visited, startTagType, nextTagType],
|
|
2924
|
+
filterDisplay: block.props?.shortLabel || block.props?.label
|
|
2923
2925
|
});
|
|
2924
2926
|
if (visited.length < maxDepth - 1) {
|
|
2925
2927
|
const nextChains = findTagChains(
|
|
@@ -2965,7 +2967,8 @@ function getRollupPossibilities({
|
|
|
2965
2967
|
const directChain = {
|
|
2966
2968
|
rollupType: "tagType",
|
|
2967
2969
|
tagTypeCollectionToRollup: tagType,
|
|
2968
|
-
rollupPath: [tagType, block.props.tagType]
|
|
2970
|
+
rollupPath: [tagType, block.props.tagType],
|
|
2971
|
+
filterDisplay: block.props?.shortLabel || block.props?.label
|
|
2969
2972
|
};
|
|
2970
2973
|
const deeperChains = findTagChains(
|
|
2971
2974
|
block.props?.tagType,
|
|
@@ -2974,7 +2977,14 @@ function getRollupPossibilities({
|
|
|
2974
2977
|
);
|
|
2975
2978
|
return [directChain, ...deeperChains];
|
|
2976
2979
|
});
|
|
2977
|
-
|
|
2980
|
+
const selfHeadRollup = includeSelfHead && nestedTagRollups.length > 0 && singleLevelValuePathRollups.length === 0 ? [
|
|
2981
|
+
{
|
|
2982
|
+
rollupType: "tagType",
|
|
2983
|
+
tagTypeCollectionToRollup: tagType,
|
|
2984
|
+
rollupPath: [tagType]
|
|
2985
|
+
}
|
|
2986
|
+
] : [];
|
|
2987
|
+
return [...singleLevelValuePathRollups, ...selfHeadRollup, ...nestedTagRollups];
|
|
2978
2988
|
}
|
|
2979
2989
|
|
|
2980
2990
|
// src/universal.ts
|
|
@@ -3382,6 +3392,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
3382
3392
|
if (isTerminalValuePath) {
|
|
3383
3393
|
return element.filterDisplay || lastItemInPath;
|
|
3384
3394
|
}
|
|
3395
|
+
if (element.filterDisplay) return element.filterDisplay;
|
|
3385
3396
|
const lastTag = rollupPath[rollupPath.length - 1];
|
|
3386
3397
|
const lastTagTpl = allTpls.find(
|
|
3387
3398
|
(tpl) => tpl.kp_content_type === lastTag
|
|
@@ -3426,6 +3437,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
3426
3437
|
scope: section.filterScope
|
|
3427
3438
|
};
|
|
3428
3439
|
};
|
|
3440
|
+
const isSelfTerminalTag = element.rollupPath.length === 1 && !isLastTagProfile && !isTerminalValuePath;
|
|
3429
3441
|
return {
|
|
3430
3442
|
filterId: `ROLLUP_${section.filterScope}_${element.rollupPath.join(
|
|
3431
3443
|
"_"
|
|
@@ -3439,9 +3451,14 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
3439
3451
|
scope: section.filterScope
|
|
3440
3452
|
}),
|
|
3441
3453
|
contentType: element.rollupPath[0],
|
|
3442
|
-
path: `tags.${element.rollupPath[1]}`,
|
|
3454
|
+
path: `tags.${isSelfTerminalTag ? element.rollupPath[0] : element.rollupPath[1]}`,
|
|
3443
3455
|
source: getSourceConfig(),
|
|
3444
|
-
target: {
|
|
3456
|
+
target: isSelfTerminalTag ? {
|
|
3457
|
+
filterType: "tagType",
|
|
3458
|
+
tagType: element.rollupPath[0],
|
|
3459
|
+
rollupPath: element.rollupPath,
|
|
3460
|
+
...isAnno && { isAnno: true }
|
|
3461
|
+
} : {
|
|
3445
3462
|
filterType: "nestedRollupTagType",
|
|
3446
3463
|
rollupPath: element.rollupPath,
|
|
3447
3464
|
...isAnno && { isAnno: true }
|
|
@@ -3648,7 +3665,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls, { smTagTypesConfig } = {}
|
|
|
3648
3665
|
return {
|
|
3649
3666
|
contentType: tpl.kp_content_type,
|
|
3650
3667
|
blocks: allBlocks.filter((block) => block.valuePath.startsWith("tags.") && ["TagsInputSingle", "TagsInputMulti"].includes(block.comp)).flatMap((block) => {
|
|
3651
|
-
const possibilities = getRollupPossibilities({ tagType: block.props.tagType, allTpls });
|
|
3668
|
+
const possibilities = getRollupPossibilities({ tagType: block.props.tagType, allTpls, includeSelfHead: true });
|
|
3652
3669
|
return possibilities.map((p) => ({
|
|
3653
3670
|
...p,
|
|
3654
3671
|
filterType: p.rollupPath ? "nestedRollupTagType" : "rollupValuePathType"
|
|
@@ -3981,13 +3998,16 @@ var buildTagTypeParentMap = (tagTypesInGroup, allTpls) => {
|
|
|
3981
3998
|
const tagBlocks = blocks.filter(
|
|
3982
3999
|
(block) => block.valuePath?.startsWith("tags.") && block.props?.tagType
|
|
3983
4000
|
);
|
|
4001
|
+
const referencedTagTypes = /* @__PURE__ */ new Set();
|
|
3984
4002
|
for (const block of tagBlocks) {
|
|
3985
4003
|
const referencedTagType = block.props.tagType;
|
|
3986
4004
|
if (tagTypeSet.has(referencedTagType) && referencedTagType !== tagType) {
|
|
3987
|
-
|
|
3988
|
-
break;
|
|
4005
|
+
referencedTagTypes.add(referencedTagType);
|
|
3989
4006
|
}
|
|
3990
4007
|
}
|
|
4008
|
+
if (referencedTagTypes.size === 1) {
|
|
4009
|
+
parentMap.set(tagType, [...referencedTagTypes][0]);
|
|
4010
|
+
}
|
|
3991
4011
|
}
|
|
3992
4012
|
for (const child of parentMap.keys()) {
|
|
3993
4013
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -4061,6 +4081,34 @@ var sortFiltersHierarchically = (filters) => {
|
|
|
4061
4081
|
return sorted;
|
|
4062
4082
|
};
|
|
4063
4083
|
|
|
4084
|
+
// src/utils/autoGenFilterConfigsFromTpl/utils/deduplicateRollupTagFilters.ts
|
|
4085
|
+
var deduplicateRollupTagFilters = (rollups) => {
|
|
4086
|
+
const tagTerminals = [];
|
|
4087
|
+
const nonTag = [];
|
|
4088
|
+
for (const r of rollups) {
|
|
4089
|
+
const rp = r.target?.rollupPath;
|
|
4090
|
+
if (rp?.length && !rp[rp.length - 1].startsWith("main.")) {
|
|
4091
|
+
tagTerminals.push(r);
|
|
4092
|
+
} else {
|
|
4093
|
+
nonTag.push({ ...r, isTagRollup: false });
|
|
4094
|
+
}
|
|
4095
|
+
}
|
|
4096
|
+
if (tagTerminals.length === 0) return nonTag;
|
|
4097
|
+
const byTerminal = /* @__PURE__ */ new Map();
|
|
4098
|
+
for (const r of tagTerminals) {
|
|
4099
|
+
const terminal = r.target.rollupPath[r.target.rollupPath.length - 1];
|
|
4100
|
+
const existing = byTerminal.get(terminal);
|
|
4101
|
+
if (!existing || r.target.rollupPath.length < existing.target.rollupPath.length) {
|
|
4102
|
+
byTerminal.set(terminal, r);
|
|
4103
|
+
}
|
|
4104
|
+
}
|
|
4105
|
+
const dedupedTags = [...byTerminal.values()].map((r) => ({
|
|
4106
|
+
...r,
|
|
4107
|
+
isTagRollup: true
|
|
4108
|
+
}));
|
|
4109
|
+
return [...nonTag, ...dedupedTags];
|
|
4110
|
+
};
|
|
4111
|
+
|
|
4064
4112
|
// src/utils/autoGenFilterConfigsFromTpl/utils/_self_managed_buildDocHierarchyConfig.ts
|
|
4065
4113
|
var injectFilterOptionsBy = (filters) => filters.map(
|
|
4066
4114
|
(f) => f.parentFilterId ? { ...f, source: { ...f.source, filterOptionsBy: { filterId: f.parentFilterId } } } : f
|
|
@@ -4167,24 +4215,34 @@ var _self_managed_buildDocHierarchyConfig = ({
|
|
|
4167
4215
|
const dedupedFilters = filtersWithCommonFlag.filter(
|
|
4168
4216
|
(f) => !rollupSourceKeys.has(JSON.stringify(f.source))
|
|
4169
4217
|
);
|
|
4170
|
-
const
|
|
4218
|
+
const dedupedRollupConfigs = deduplicateRollupTagFilters(rollupConfigs);
|
|
4219
|
+
const combined = [...dedupedFilters, ...dedupedRollupConfigs];
|
|
4171
4220
|
const combinedWithParents = injectFilterOptionsBy(
|
|
4172
4221
|
sortFiltersHierarchically(
|
|
4173
4222
|
attachParentFields(combined, allTpls)
|
|
4174
4223
|
)
|
|
4175
4224
|
);
|
|
4176
|
-
const rollupFilterIds = new Set(
|
|
4225
|
+
const rollupFilterIds = new Set(dedupedRollupConfigs.map((r) => r.filterId));
|
|
4177
4226
|
const filtersWithParents = combinedWithParents.filter(
|
|
4178
4227
|
(f) => !rollupFilterIds.has(f.filterId)
|
|
4179
4228
|
);
|
|
4180
4229
|
const rollupsWithParents = combinedWithParents.filter(
|
|
4181
4230
|
(f) => rollupFilterIds.has(f.filterId)
|
|
4182
4231
|
);
|
|
4232
|
+
const rollupContentTypes = new Set(
|
|
4233
|
+
rollupsWithParents.filter((r) => r.target?.rollupPath).flatMap((r) => r.target.rollupPath)
|
|
4234
|
+
);
|
|
4235
|
+
const rollupDisplayMap = {};
|
|
4236
|
+
for (const ct of rollupContentTypes) {
|
|
4237
|
+
const t = allTpls.find((tp) => tp.kp_content_type === ct);
|
|
4238
|
+
if (t?.general?.content?.title) rollupDisplayMap[ct] = t.general.content.title;
|
|
4239
|
+
}
|
|
4183
4240
|
return {
|
|
4184
4241
|
contentType: tpl.kp_content_type,
|
|
4185
4242
|
display: tplData?.general?.content?.title || tpl.kp_content_type,
|
|
4186
4243
|
filters: filtersWithParents,
|
|
4187
|
-
rollups: rollupsWithParents
|
|
4244
|
+
rollups: rollupsWithParents,
|
|
4245
|
+
rollupDisplayMap
|
|
4188
4246
|
};
|
|
4189
4247
|
});
|
|
4190
4248
|
const filteredPerDataset = perDataset.filter(
|
package/dist/universal.d.mts
CHANGED
|
@@ -285,9 +285,10 @@ declare const collectMarkIdsInOrder: (editorState: any) => string[];
|
|
|
285
285
|
* }
|
|
286
286
|
* ]
|
|
287
287
|
*/
|
|
288
|
-
declare function getRollupPossibilities({ tagType, allTpls }: {
|
|
288
|
+
declare function getRollupPossibilities({ tagType, allTpls, includeSelfHead, }: {
|
|
289
289
|
tagType: string;
|
|
290
290
|
allTpls: any[];
|
|
291
|
+
includeSelfHead?: boolean;
|
|
291
292
|
}): any[];
|
|
292
293
|
|
|
293
294
|
declare namespace BASE_BULLMQ_CONFIG {
|
|
@@ -1241,6 +1242,27 @@ declare const processAuthorAndCommonFilters: (allTpls: any[], filterScopes: stri
|
|
|
1241
1242
|
|
|
1242
1243
|
declare const _self_managed_getFixedAnnoTagBlock: (selectedTpls: any[], annotationTagsCount: any) => any[];
|
|
1243
1244
|
|
|
1245
|
+
/**
|
|
1246
|
+
* FOLLOWUP (consolidate the count->rollupPath rule into one source of truth):
|
|
1247
|
+
*
|
|
1248
|
+
* The rule "given annotationTagsCount, which self-managed anno rollupPaths exist"
|
|
1249
|
+
* (subThemes>0 -> ['tags','subThemes']; subThemes>0 && themes>0 -> ['tags','subThemes','themes'])
|
|
1250
|
+
* is currently duplicated in THREE places and will drift:
|
|
1251
|
+
* 1. here (_self_managed_getFixedAnnoRollupBlocks) -> filter blocks
|
|
1252
|
+
* 2. _self_managed_buildAnnoHierarchyConfig -> anno hierarchy filter UI
|
|
1253
|
+
* 3. okf-fe _extractAllAnnoBasedDimensionsAsOptions.js -> reports dimension dropdown
|
|
1254
|
+
*
|
|
1255
|
+
* (#3 was added to fix a crash: the reports widget previously discovered these rollups
|
|
1256
|
+
* from publishing-segment tpls via getRollupPossibilities, but self-managed taxonomy lives
|
|
1257
|
+
* on `collections`-segment tpls which isTplAnnotationEnabled excludes -> empty list ->
|
|
1258
|
+
* unguarded .find('subThemes') returned undefined -> crash. The FE now builds them from the
|
|
1259
|
+
* count, mirroring this function.)
|
|
1260
|
+
*
|
|
1261
|
+
* Extract a pure helper here in ootils:
|
|
1262
|
+
* export const getSelfManagedAnnoRollupPaths = (annotationTagsCount): string[][] => [...]
|
|
1263
|
+
* then have all three call sites consume it (each maps paths -> its own shape:
|
|
1264
|
+
* filter-blocks / hierarchy levels / dropdown options). One rule, three presentations.
|
|
1265
|
+
*/
|
|
1244
1266
|
declare const _self_managed_getFixedAnnoRollupBlocks: ({ selectedTpls, allTpls, annotationTagsCount }: {
|
|
1245
1267
|
selectedTpls: any[];
|
|
1246
1268
|
allTpls: any[];
|
|
@@ -1342,6 +1364,7 @@ declare const _self_managed_buildDocHierarchyConfig: ({ combinedDocumentBlocks,
|
|
|
1342
1364
|
display: any;
|
|
1343
1365
|
filters: any[];
|
|
1344
1366
|
rollups: any[];
|
|
1367
|
+
rollupDisplayMap: Record<string, string>;
|
|
1345
1368
|
}[];
|
|
1346
1369
|
};
|
|
1347
1370
|
target: {
|
|
@@ -1501,6 +1524,7 @@ declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScope
|
|
|
1501
1524
|
display: any;
|
|
1502
1525
|
filters: any[];
|
|
1503
1526
|
rollups: any[];
|
|
1527
|
+
rollupDisplayMap: Record<string, string>;
|
|
1504
1528
|
}[];
|
|
1505
1529
|
};
|
|
1506
1530
|
target: {
|
package/dist/universal.d.ts
CHANGED
|
@@ -285,9 +285,10 @@ declare const collectMarkIdsInOrder: (editorState: any) => string[];
|
|
|
285
285
|
* }
|
|
286
286
|
* ]
|
|
287
287
|
*/
|
|
288
|
-
declare function getRollupPossibilities({ tagType, allTpls }: {
|
|
288
|
+
declare function getRollupPossibilities({ tagType, allTpls, includeSelfHead, }: {
|
|
289
289
|
tagType: string;
|
|
290
290
|
allTpls: any[];
|
|
291
|
+
includeSelfHead?: boolean;
|
|
291
292
|
}): any[];
|
|
292
293
|
|
|
293
294
|
declare namespace BASE_BULLMQ_CONFIG {
|
|
@@ -1241,6 +1242,27 @@ declare const processAuthorAndCommonFilters: (allTpls: any[], filterScopes: stri
|
|
|
1241
1242
|
|
|
1242
1243
|
declare const _self_managed_getFixedAnnoTagBlock: (selectedTpls: any[], annotationTagsCount: any) => any[];
|
|
1243
1244
|
|
|
1245
|
+
/**
|
|
1246
|
+
* FOLLOWUP (consolidate the count->rollupPath rule into one source of truth):
|
|
1247
|
+
*
|
|
1248
|
+
* The rule "given annotationTagsCount, which self-managed anno rollupPaths exist"
|
|
1249
|
+
* (subThemes>0 -> ['tags','subThemes']; subThemes>0 && themes>0 -> ['tags','subThemes','themes'])
|
|
1250
|
+
* is currently duplicated in THREE places and will drift:
|
|
1251
|
+
* 1. here (_self_managed_getFixedAnnoRollupBlocks) -> filter blocks
|
|
1252
|
+
* 2. _self_managed_buildAnnoHierarchyConfig -> anno hierarchy filter UI
|
|
1253
|
+
* 3. okf-fe _extractAllAnnoBasedDimensionsAsOptions.js -> reports dimension dropdown
|
|
1254
|
+
*
|
|
1255
|
+
* (#3 was added to fix a crash: the reports widget previously discovered these rollups
|
|
1256
|
+
* from publishing-segment tpls via getRollupPossibilities, but self-managed taxonomy lives
|
|
1257
|
+
* on `collections`-segment tpls which isTplAnnotationEnabled excludes -> empty list ->
|
|
1258
|
+
* unguarded .find('subThemes') returned undefined -> crash. The FE now builds them from the
|
|
1259
|
+
* count, mirroring this function.)
|
|
1260
|
+
*
|
|
1261
|
+
* Extract a pure helper here in ootils:
|
|
1262
|
+
* export const getSelfManagedAnnoRollupPaths = (annotationTagsCount): string[][] => [...]
|
|
1263
|
+
* then have all three call sites consume it (each maps paths -> its own shape:
|
|
1264
|
+
* filter-blocks / hierarchy levels / dropdown options). One rule, three presentations.
|
|
1265
|
+
*/
|
|
1244
1266
|
declare const _self_managed_getFixedAnnoRollupBlocks: ({ selectedTpls, allTpls, annotationTagsCount }: {
|
|
1245
1267
|
selectedTpls: any[];
|
|
1246
1268
|
allTpls: any[];
|
|
@@ -1342,6 +1364,7 @@ declare const _self_managed_buildDocHierarchyConfig: ({ combinedDocumentBlocks,
|
|
|
1342
1364
|
display: any;
|
|
1343
1365
|
filters: any[];
|
|
1344
1366
|
rollups: any[];
|
|
1367
|
+
rollupDisplayMap: Record<string, string>;
|
|
1345
1368
|
}[];
|
|
1346
1369
|
};
|
|
1347
1370
|
target: {
|
|
@@ -1501,6 +1524,7 @@ declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScope
|
|
|
1501
1524
|
display: any;
|
|
1502
1525
|
filters: any[];
|
|
1503
1526
|
rollups: any[];
|
|
1527
|
+
rollupDisplayMap: Record<string, string>;
|
|
1504
1528
|
}[];
|
|
1505
1529
|
};
|
|
1506
1530
|
target: {
|
package/dist/universal.js
CHANGED
|
@@ -722,7 +722,8 @@ var collectMarkIdsInOrder = (editorState) => {
|
|
|
722
722
|
var MAX_DEPTH_ROLLUP_POSSIBILITIES = 10;
|
|
723
723
|
function getRollupPossibilities({
|
|
724
724
|
tagType,
|
|
725
|
-
allTpls
|
|
725
|
+
allTpls,
|
|
726
|
+
includeSelfHead = false
|
|
726
727
|
}) {
|
|
727
728
|
const thisTagTpl = allTpls.find((d) => d.kp_content_type === tagType);
|
|
728
729
|
if (!thisTagTpl) return [];
|
|
@@ -754,7 +755,8 @@ function getRollupPossibilities({
|
|
|
754
755
|
chains.push({
|
|
755
756
|
rollupType: "tagType",
|
|
756
757
|
tagTypeCollectionToRollup: tagType,
|
|
757
|
-
rollupPath: [...visited, startTagType, nextTagType]
|
|
758
|
+
rollupPath: [...visited, startTagType, nextTagType],
|
|
759
|
+
filterDisplay: block.props?.shortLabel || block.props?.label
|
|
758
760
|
});
|
|
759
761
|
if (visited.length < maxDepth - 1) {
|
|
760
762
|
const nextChains = findTagChains(
|
|
@@ -800,7 +802,8 @@ function getRollupPossibilities({
|
|
|
800
802
|
const directChain = {
|
|
801
803
|
rollupType: "tagType",
|
|
802
804
|
tagTypeCollectionToRollup: tagType,
|
|
803
|
-
rollupPath: [tagType, block.props.tagType]
|
|
805
|
+
rollupPath: [tagType, block.props.tagType],
|
|
806
|
+
filterDisplay: block.props?.shortLabel || block.props?.label
|
|
804
807
|
};
|
|
805
808
|
const deeperChains = findTagChains(
|
|
806
809
|
block.props?.tagType,
|
|
@@ -809,7 +812,14 @@ function getRollupPossibilities({
|
|
|
809
812
|
);
|
|
810
813
|
return [directChain, ...deeperChains];
|
|
811
814
|
});
|
|
812
|
-
|
|
815
|
+
const selfHeadRollup = includeSelfHead && nestedTagRollups.length > 0 && singleLevelValuePathRollups.length === 0 ? [
|
|
816
|
+
{
|
|
817
|
+
rollupType: "tagType",
|
|
818
|
+
tagTypeCollectionToRollup: tagType,
|
|
819
|
+
rollupPath: [tagType]
|
|
820
|
+
}
|
|
821
|
+
] : [];
|
|
822
|
+
return [...singleLevelValuePathRollups, ...selfHeadRollup, ...nestedTagRollups];
|
|
813
823
|
}
|
|
814
824
|
|
|
815
825
|
// src/bullmq/GLOBAL_BULLMQ_CONFIG.js
|
|
@@ -1714,6 +1724,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
1714
1724
|
if (isTerminalValuePath) {
|
|
1715
1725
|
return element.filterDisplay || lastItemInPath;
|
|
1716
1726
|
}
|
|
1727
|
+
if (element.filterDisplay) return element.filterDisplay;
|
|
1717
1728
|
const lastTag = rollupPath[rollupPath.length - 1];
|
|
1718
1729
|
const lastTagTpl = allTpls.find(
|
|
1719
1730
|
(tpl) => tpl.kp_content_type === lastTag
|
|
@@ -1758,6 +1769,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
1758
1769
|
scope: section.filterScope
|
|
1759
1770
|
};
|
|
1760
1771
|
};
|
|
1772
|
+
const isSelfTerminalTag = element.rollupPath.length === 1 && !isLastTagProfile && !isTerminalValuePath;
|
|
1761
1773
|
return {
|
|
1762
1774
|
filterId: `ROLLUP_${section.filterScope}_${element.rollupPath.join(
|
|
1763
1775
|
"_"
|
|
@@ -1771,9 +1783,14 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
1771
1783
|
scope: section.filterScope
|
|
1772
1784
|
}),
|
|
1773
1785
|
contentType: element.rollupPath[0],
|
|
1774
|
-
path: `tags.${element.rollupPath[1]}`,
|
|
1786
|
+
path: `tags.${isSelfTerminalTag ? element.rollupPath[0] : element.rollupPath[1]}`,
|
|
1775
1787
|
source: getSourceConfig(),
|
|
1776
|
-
target: {
|
|
1788
|
+
target: isSelfTerminalTag ? {
|
|
1789
|
+
filterType: "tagType",
|
|
1790
|
+
tagType: element.rollupPath[0],
|
|
1791
|
+
rollupPath: element.rollupPath,
|
|
1792
|
+
...isAnno && { isAnno: true }
|
|
1793
|
+
} : {
|
|
1777
1794
|
filterType: "nestedRollupTagType",
|
|
1778
1795
|
rollupPath: element.rollupPath,
|
|
1779
1796
|
...isAnno && { isAnno: true }
|
|
@@ -1980,7 +1997,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls, { smTagTypesConfig } = {}
|
|
|
1980
1997
|
return {
|
|
1981
1998
|
contentType: tpl.kp_content_type,
|
|
1982
1999
|
blocks: allBlocks.filter((block) => block.valuePath.startsWith("tags.") && ["TagsInputSingle", "TagsInputMulti"].includes(block.comp)).flatMap((block) => {
|
|
1983
|
-
const possibilities = getRollupPossibilities({ tagType: block.props.tagType, allTpls });
|
|
2000
|
+
const possibilities = getRollupPossibilities({ tagType: block.props.tagType, allTpls, includeSelfHead: true });
|
|
1984
2001
|
return possibilities.map((p) => ({
|
|
1985
2002
|
...p,
|
|
1986
2003
|
filterType: p.rollupPath ? "nestedRollupTagType" : "rollupValuePathType"
|
|
@@ -2313,13 +2330,16 @@ var buildTagTypeParentMap = (tagTypesInGroup, allTpls) => {
|
|
|
2313
2330
|
const tagBlocks = blocks.filter(
|
|
2314
2331
|
(block) => block.valuePath?.startsWith("tags.") && block.props?.tagType
|
|
2315
2332
|
);
|
|
2333
|
+
const referencedTagTypes = /* @__PURE__ */ new Set();
|
|
2316
2334
|
for (const block of tagBlocks) {
|
|
2317
2335
|
const referencedTagType = block.props.tagType;
|
|
2318
2336
|
if (tagTypeSet.has(referencedTagType) && referencedTagType !== tagType) {
|
|
2319
|
-
|
|
2320
|
-
break;
|
|
2337
|
+
referencedTagTypes.add(referencedTagType);
|
|
2321
2338
|
}
|
|
2322
2339
|
}
|
|
2340
|
+
if (referencedTagTypes.size === 1) {
|
|
2341
|
+
parentMap.set(tagType, [...referencedTagTypes][0]);
|
|
2342
|
+
}
|
|
2323
2343
|
}
|
|
2324
2344
|
for (const child of parentMap.keys()) {
|
|
2325
2345
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -2393,6 +2413,34 @@ var sortFiltersHierarchically = (filters) => {
|
|
|
2393
2413
|
return sorted;
|
|
2394
2414
|
};
|
|
2395
2415
|
|
|
2416
|
+
// src/utils/autoGenFilterConfigsFromTpl/utils/deduplicateRollupTagFilters.ts
|
|
2417
|
+
var deduplicateRollupTagFilters = (rollups) => {
|
|
2418
|
+
const tagTerminals = [];
|
|
2419
|
+
const nonTag = [];
|
|
2420
|
+
for (const r of rollups) {
|
|
2421
|
+
const rp = r.target?.rollupPath;
|
|
2422
|
+
if (rp?.length && !rp[rp.length - 1].startsWith("main.")) {
|
|
2423
|
+
tagTerminals.push(r);
|
|
2424
|
+
} else {
|
|
2425
|
+
nonTag.push({ ...r, isTagRollup: false });
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
if (tagTerminals.length === 0) return nonTag;
|
|
2429
|
+
const byTerminal = /* @__PURE__ */ new Map();
|
|
2430
|
+
for (const r of tagTerminals) {
|
|
2431
|
+
const terminal = r.target.rollupPath[r.target.rollupPath.length - 1];
|
|
2432
|
+
const existing = byTerminal.get(terminal);
|
|
2433
|
+
if (!existing || r.target.rollupPath.length < existing.target.rollupPath.length) {
|
|
2434
|
+
byTerminal.set(terminal, r);
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
const dedupedTags = [...byTerminal.values()].map((r) => ({
|
|
2438
|
+
...r,
|
|
2439
|
+
isTagRollup: true
|
|
2440
|
+
}));
|
|
2441
|
+
return [...nonTag, ...dedupedTags];
|
|
2442
|
+
};
|
|
2443
|
+
|
|
2396
2444
|
// src/utils/autoGenFilterConfigsFromTpl/utils/_self_managed_buildDocHierarchyConfig.ts
|
|
2397
2445
|
var injectFilterOptionsBy = (filters) => filters.map(
|
|
2398
2446
|
(f) => f.parentFilterId ? { ...f, source: { ...f.source, filterOptionsBy: { filterId: f.parentFilterId } } } : f
|
|
@@ -2499,24 +2547,34 @@ var _self_managed_buildDocHierarchyConfig = ({
|
|
|
2499
2547
|
const dedupedFilters = filtersWithCommonFlag.filter(
|
|
2500
2548
|
(f) => !rollupSourceKeys.has(JSON.stringify(f.source))
|
|
2501
2549
|
);
|
|
2502
|
-
const
|
|
2550
|
+
const dedupedRollupConfigs = deduplicateRollupTagFilters(rollupConfigs);
|
|
2551
|
+
const combined = [...dedupedFilters, ...dedupedRollupConfigs];
|
|
2503
2552
|
const combinedWithParents = injectFilterOptionsBy(
|
|
2504
2553
|
sortFiltersHierarchically(
|
|
2505
2554
|
attachParentFields(combined, allTpls)
|
|
2506
2555
|
)
|
|
2507
2556
|
);
|
|
2508
|
-
const rollupFilterIds = new Set(
|
|
2557
|
+
const rollupFilterIds = new Set(dedupedRollupConfigs.map((r) => r.filterId));
|
|
2509
2558
|
const filtersWithParents = combinedWithParents.filter(
|
|
2510
2559
|
(f) => !rollupFilterIds.has(f.filterId)
|
|
2511
2560
|
);
|
|
2512
2561
|
const rollupsWithParents = combinedWithParents.filter(
|
|
2513
2562
|
(f) => rollupFilterIds.has(f.filterId)
|
|
2514
2563
|
);
|
|
2564
|
+
const rollupContentTypes = new Set(
|
|
2565
|
+
rollupsWithParents.filter((r) => r.target?.rollupPath).flatMap((r) => r.target.rollupPath)
|
|
2566
|
+
);
|
|
2567
|
+
const rollupDisplayMap = {};
|
|
2568
|
+
for (const ct of rollupContentTypes) {
|
|
2569
|
+
const t = allTpls.find((tp) => tp.kp_content_type === ct);
|
|
2570
|
+
if (t?.general?.content?.title) rollupDisplayMap[ct] = t.general.content.title;
|
|
2571
|
+
}
|
|
2515
2572
|
return {
|
|
2516
2573
|
contentType: tpl.kp_content_type,
|
|
2517
2574
|
display: tplData?.general?.content?.title || tpl.kp_content_type,
|
|
2518
2575
|
filters: filtersWithParents,
|
|
2519
|
-
rollups: rollupsWithParents
|
|
2576
|
+
rollups: rollupsWithParents,
|
|
2577
|
+
rollupDisplayMap
|
|
2520
2578
|
};
|
|
2521
2579
|
});
|
|
2522
2580
|
const filteredPerDataset = perDataset.filter(
|