@okf/ootils 1.27.0 → 1.28.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 +77 -1
- package/dist/browser.d.ts +77 -1
- package/dist/browser.js +265 -1
- package/dist/browser.mjs +264 -1
- package/dist/node.d.mts +77 -1
- package/dist/node.d.ts +77 -1
- package/dist/node.js +265 -1
- package/dist/node.mjs +264 -1
- package/dist/universal.d.mts +77 -1
- package/dist/universal.d.ts +77 -1
- package/dist/universal.js +265 -1
- package/dist/universal.mjs +264 -1
- package/package.json +1 -1
package/dist/node.js
CHANGED
|
@@ -1939,6 +1939,7 @@ __export(node_exports, {
|
|
|
1939
1939
|
UI_CONTENT: () => UI_CONTENT,
|
|
1940
1940
|
WorkerManager: () => import_WorkerManager.WorkerManager,
|
|
1941
1941
|
_self_managed_buildAnnoHierarchyConfig: () => _self_managed_buildAnnoHierarchyConfig,
|
|
1942
|
+
_self_managed_buildDocHierarchyConfig: () => _self_managed_buildDocHierarchyConfig,
|
|
1942
1943
|
_self_managed_getFixedAnnoRollupBlocks: () => _self_managed_getFixedAnnoRollupBlocks,
|
|
1943
1944
|
_self_managed_getFixedAnnoTagBlock: () => _self_managed_getFixedAnnoTagBlock,
|
|
1944
1945
|
autoGenFilterConfigsFromTpl: () => autoGenFilterConfigsFromTpl,
|
|
@@ -2664,6 +2665,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
2664
2665
|
filterKey,
|
|
2665
2666
|
contentType: element.contentType,
|
|
2666
2667
|
path: element.valuePath,
|
|
2668
|
+
...element.comp && { comp: element.comp },
|
|
2667
2669
|
source: {
|
|
2668
2670
|
filterType: "tplType",
|
|
2669
2671
|
contentType: element.contentType,
|
|
@@ -2689,6 +2691,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
2689
2691
|
filterKey: valuePathFilterKey,
|
|
2690
2692
|
contentType: element.contentType,
|
|
2691
2693
|
path: element.valuePath,
|
|
2694
|
+
...element.comp && { comp: element.comp },
|
|
2692
2695
|
source: {
|
|
2693
2696
|
filterType: "tplType",
|
|
2694
2697
|
contentType: element.contentType,
|
|
@@ -2714,6 +2717,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
2714
2717
|
filterKey: dateFilterKey,
|
|
2715
2718
|
contentType: element.contentType,
|
|
2716
2719
|
path: element.valuePath,
|
|
2720
|
+
...element.comp && { comp: element.comp },
|
|
2717
2721
|
source: { filterType: "dateRangeType" },
|
|
2718
2722
|
target: { filterType: "dateRangeType", valuePath: element.valuePath }
|
|
2719
2723
|
};
|
|
@@ -2731,6 +2735,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
2731
2735
|
filterKey: numberFilterKey,
|
|
2732
2736
|
contentType: element.contentType,
|
|
2733
2737
|
path: element.valuePath,
|
|
2738
|
+
...element.comp && { comp: element.comp },
|
|
2734
2739
|
source: { filterType: "numberRangeType", valuePath: element.valuePath },
|
|
2735
2740
|
target: { filterType: "numberRangeType", valuePath: element.valuePath }
|
|
2736
2741
|
};
|
|
@@ -2851,6 +2856,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
2851
2856
|
filterKey: tagFilterKey,
|
|
2852
2857
|
contentType: element.tagType,
|
|
2853
2858
|
path: `tags.${element.tagType}`,
|
|
2859
|
+
...element.comp && { comp: element.comp },
|
|
2854
2860
|
source: allProfileTpls.some(
|
|
2855
2861
|
(tpl) => tpl.kp_content_type === element.tagType
|
|
2856
2862
|
) ? {
|
|
@@ -2992,6 +2998,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
2992
2998
|
contentType: tpl.kp_content_type,
|
|
2993
2999
|
blocks: allBlocks.filter((block) => block.valuePath.startsWith("tags.")).map((block) => ({
|
|
2994
3000
|
tagType: block.props.tagType,
|
|
3001
|
+
comp: block.comp,
|
|
2995
3002
|
filterType: "tagType"
|
|
2996
3003
|
}))
|
|
2997
3004
|
};
|
|
@@ -3019,6 +3026,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
3019
3026
|
value: block.valuePath,
|
|
3020
3027
|
saveValueAsString: block.props?.saveValueAsString,
|
|
3021
3028
|
contentType: tpl.kp_content_type,
|
|
3029
|
+
comp: block.comp,
|
|
3022
3030
|
filterType: "valuePathType"
|
|
3023
3031
|
}))
|
|
3024
3032
|
};
|
|
@@ -3033,6 +3041,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
3033
3041
|
value: block.valuePath,
|
|
3034
3042
|
saveValueAsString: block.props?.saveValueAsString,
|
|
3035
3043
|
contentType: tpl.kp_content_type,
|
|
3044
|
+
comp: block.comp,
|
|
3036
3045
|
block,
|
|
3037
3046
|
filterType: "split_valuePathType"
|
|
3038
3047
|
}))
|
|
@@ -3047,6 +3056,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
3047
3056
|
display: block.props?.shortLabel || block.props?.label || block.valuePath,
|
|
3048
3057
|
value: block.valuePath,
|
|
3049
3058
|
contentType: tpl.kp_content_type,
|
|
3059
|
+
comp: block.comp,
|
|
3050
3060
|
filterType: "dateRangeType"
|
|
3051
3061
|
}))
|
|
3052
3062
|
};
|
|
@@ -3060,6 +3070,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
3060
3070
|
display: block.props?.shortLabel || block.props?.label || block.valuePath,
|
|
3061
3071
|
value: block.valuePath,
|
|
3062
3072
|
contentType: tpl.kp_content_type,
|
|
3073
|
+
comp: block.comp,
|
|
3063
3074
|
filterType: "numberRangeType"
|
|
3064
3075
|
}))
|
|
3065
3076
|
};
|
|
@@ -3306,6 +3317,240 @@ var _self_managed_buildAnnoHierarchyConfig = ({
|
|
|
3306
3317
|
};
|
|
3307
3318
|
};
|
|
3308
3319
|
|
|
3320
|
+
// src/utils/autoGenFilterConfigsFromTpl/utils/buildTagTypeParentMap.ts
|
|
3321
|
+
var buildTagTypeParentMap = (tagTypesInGroup, allTpls) => {
|
|
3322
|
+
const tagTypeSet = new Set(tagTypesInGroup);
|
|
3323
|
+
const parentMap = /* @__PURE__ */ new Map();
|
|
3324
|
+
for (const tagType of tagTypesInGroup) {
|
|
3325
|
+
const tpl = allTpls.find((t) => t.kp_content_type === tagType);
|
|
3326
|
+
if (!tpl) continue;
|
|
3327
|
+
const blocks = extractAllBlocksFromTpl({ tpl });
|
|
3328
|
+
const tagBlocks = blocks.filter(
|
|
3329
|
+
(block) => block.valuePath?.startsWith("tags.") && block.props?.tagType
|
|
3330
|
+
);
|
|
3331
|
+
for (const block of tagBlocks) {
|
|
3332
|
+
const referencedTagType = block.props.tagType;
|
|
3333
|
+
if (tagTypeSet.has(referencedTagType) && referencedTagType !== tagType) {
|
|
3334
|
+
parentMap.set(tagType, referencedTagType);
|
|
3335
|
+
break;
|
|
3336
|
+
}
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
for (const child of parentMap.keys()) {
|
|
3340
|
+
const visited = /* @__PURE__ */ new Set();
|
|
3341
|
+
let current = child;
|
|
3342
|
+
while (current && parentMap.has(current)) {
|
|
3343
|
+
if (visited.has(current)) {
|
|
3344
|
+
parentMap.delete(current);
|
|
3345
|
+
break;
|
|
3346
|
+
}
|
|
3347
|
+
visited.add(current);
|
|
3348
|
+
current = parentMap.get(current);
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
return parentMap;
|
|
3352
|
+
};
|
|
3353
|
+
var attachParentFields = (filters, allTpls) => {
|
|
3354
|
+
const tagTypeFilters = filters.filter(
|
|
3355
|
+
(f) => f.source?.filterType === "tagType" && f.source?.tagType
|
|
3356
|
+
);
|
|
3357
|
+
if (tagTypeFilters.length === 0) return filters;
|
|
3358
|
+
const tagTypesInGroup = tagTypeFilters.map((f) => f.source.tagType);
|
|
3359
|
+
const parentMap = buildTagTypeParentMap(tagTypesInGroup, allTpls);
|
|
3360
|
+
if (parentMap.size === 0) return filters;
|
|
3361
|
+
const tagTypeToFilterId = /* @__PURE__ */ new Map();
|
|
3362
|
+
for (const f of tagTypeFilters) {
|
|
3363
|
+
tagTypeToFilterId.set(f.source.tagType, f.filterId);
|
|
3364
|
+
}
|
|
3365
|
+
return filters.map((f) => {
|
|
3366
|
+
if (f.source?.filterType !== "tagType" || !f.source?.tagType) return f;
|
|
3367
|
+
const parentTagType = parentMap.get(f.source.tagType);
|
|
3368
|
+
if (!parentTagType) return f;
|
|
3369
|
+
const parentFilterId = tagTypeToFilterId.get(parentTagType);
|
|
3370
|
+
if (!parentFilterId) return f;
|
|
3371
|
+
return { ...f, parentFilterId };
|
|
3372
|
+
});
|
|
3373
|
+
};
|
|
3374
|
+
var sortFiltersHierarchically = (filters) => {
|
|
3375
|
+
if (filters.length <= 1) return filters;
|
|
3376
|
+
const hasHierarchy = filters.some((f) => f.parentFilterId);
|
|
3377
|
+
if (!hasHierarchy) return filters;
|
|
3378
|
+
const childrenOf = /* @__PURE__ */ new Map();
|
|
3379
|
+
const roots = [];
|
|
3380
|
+
for (const f of filters) {
|
|
3381
|
+
if (!f.parentFilterId) {
|
|
3382
|
+
roots.push(f);
|
|
3383
|
+
} else {
|
|
3384
|
+
const siblings = childrenOf.get(f.parentFilterId) || [];
|
|
3385
|
+
siblings.push(f);
|
|
3386
|
+
childrenOf.set(f.parentFilterId, siblings);
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
const sorted = [];
|
|
3390
|
+
const visited = /* @__PURE__ */ new Set();
|
|
3391
|
+
const visit = (filter) => {
|
|
3392
|
+
if (visited.has(filter.filterId)) return;
|
|
3393
|
+
visited.add(filter.filterId);
|
|
3394
|
+
sorted.push(filter);
|
|
3395
|
+
const children = childrenOf.get(filter.filterId) || [];
|
|
3396
|
+
for (const child of children) {
|
|
3397
|
+
visit(child);
|
|
3398
|
+
}
|
|
3399
|
+
};
|
|
3400
|
+
for (const root of roots) {
|
|
3401
|
+
visit(root);
|
|
3402
|
+
}
|
|
3403
|
+
for (const f of filters) {
|
|
3404
|
+
if (!visited.has(f.filterId)) {
|
|
3405
|
+
sorted.push(f);
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
return sorted;
|
|
3409
|
+
};
|
|
3410
|
+
|
|
3411
|
+
// src/utils/autoGenFilterConfigsFromTpl/utils/_self_managed_buildDocHierarchyConfig.ts
|
|
3412
|
+
var _self_managed_buildDocHierarchyConfig = ({
|
|
3413
|
+
combinedDocumentBlocks,
|
|
3414
|
+
docRollupBlocks,
|
|
3415
|
+
selectedTpls,
|
|
3416
|
+
allTpls,
|
|
3417
|
+
commonDocumentFilters,
|
|
3418
|
+
flatDocFilters = false
|
|
3419
|
+
}) => {
|
|
3420
|
+
const allGroups = compareAndGroupBlocks(combinedDocumentBlocks);
|
|
3421
|
+
const commonGroup = allGroups.find(
|
|
3422
|
+
(g) => g.contentTypes.length === selectedTpls.length
|
|
3423
|
+
);
|
|
3424
|
+
const commonFilterConfigs = commonGroup ? sortFiltersHierarchically(
|
|
3425
|
+
attachParentFields(
|
|
3426
|
+
buildFilterConfigurations({
|
|
3427
|
+
groups: [commonGroup],
|
|
3428
|
+
type: "tags",
|
|
3429
|
+
selectedTpls,
|
|
3430
|
+
allTpls,
|
|
3431
|
+
isRollup: false,
|
|
3432
|
+
isAnno: false
|
|
3433
|
+
}).flatMap((s) => s.configs),
|
|
3434
|
+
allTpls
|
|
3435
|
+
)
|
|
3436
|
+
) : [];
|
|
3437
|
+
const multiDatasetGroups = selectedTpls.length >= 2 ? allGroups.filter(
|
|
3438
|
+
(g) => g.contentTypes.length > 1 && g.contentTypes.length < selectedTpls.length
|
|
3439
|
+
) : [];
|
|
3440
|
+
const sharedAcrossMultiple = multiDatasetGroups.map((group) => {
|
|
3441
|
+
const groupFilterConfigs = sortFiltersHierarchically(
|
|
3442
|
+
attachParentFields(
|
|
3443
|
+
buildFilterConfigurations({
|
|
3444
|
+
groups: [group],
|
|
3445
|
+
type: "tags",
|
|
3446
|
+
selectedTpls,
|
|
3447
|
+
allTpls,
|
|
3448
|
+
isRollup: false,
|
|
3449
|
+
isAnno: false
|
|
3450
|
+
}).flatMap((s) => s.configs),
|
|
3451
|
+
allTpls
|
|
3452
|
+
)
|
|
3453
|
+
);
|
|
3454
|
+
const display = group.contentTypes.map((ct) => {
|
|
3455
|
+
const tplData = allTpls.find(
|
|
3456
|
+
(t) => t.kp_content_type === ct
|
|
3457
|
+
);
|
|
3458
|
+
return tplData?.general?.content?.title || ct;
|
|
3459
|
+
}).join(" + ");
|
|
3460
|
+
return {
|
|
3461
|
+
contentTypes: group.contentTypes,
|
|
3462
|
+
display,
|
|
3463
|
+
filters: groupFilterConfigs
|
|
3464
|
+
};
|
|
3465
|
+
}).filter((g) => g.filters.length > 0);
|
|
3466
|
+
const commonFilterIds = new Set(commonFilterConfigs.map((f) => f.filterId));
|
|
3467
|
+
const perDataset = selectedTpls.map((tpl) => {
|
|
3468
|
+
const tplBlocks = combinedDocumentBlocks.find(
|
|
3469
|
+
(b) => b.contentType === tpl.kp_content_type
|
|
3470
|
+
);
|
|
3471
|
+
const singleTplGroup = [
|
|
3472
|
+
{
|
|
3473
|
+
contentTypes: [tpl.kp_content_type],
|
|
3474
|
+
elements: tplBlocks?.blocks || []
|
|
3475
|
+
}
|
|
3476
|
+
];
|
|
3477
|
+
const filters = buildFilterConfigurations({
|
|
3478
|
+
groups: singleTplGroup,
|
|
3479
|
+
type: "tags",
|
|
3480
|
+
selectedTpls: [tpl],
|
|
3481
|
+
allTpls,
|
|
3482
|
+
isRollup: false,
|
|
3483
|
+
isAnno: false
|
|
3484
|
+
}).flatMap((s) => s.configs);
|
|
3485
|
+
const filtersWithCommonFlag = filters.map((f) => ({
|
|
3486
|
+
...f,
|
|
3487
|
+
isSharedFilter: commonFilterIds.has(f.filterId)
|
|
3488
|
+
}));
|
|
3489
|
+
const rollupData = docRollupBlocks?.find(
|
|
3490
|
+
(b) => b.contentType === tpl.kp_content_type
|
|
3491
|
+
);
|
|
3492
|
+
const rollupGroups = rollupData?.blocks?.length ? compareAndGroupBlocks([rollupData]) : [];
|
|
3493
|
+
const rollupConfigs = rollupGroups.length ? buildFilterConfigurations({
|
|
3494
|
+
groups: rollupGroups,
|
|
3495
|
+
type: "tags",
|
|
3496
|
+
selectedTpls: [tpl],
|
|
3497
|
+
allTpls,
|
|
3498
|
+
isRollup: true,
|
|
3499
|
+
isAnno: false
|
|
3500
|
+
}).flatMap((s) => s.configs) : [];
|
|
3501
|
+
const tplData = allTpls.find(
|
|
3502
|
+
(t) => t.kp_content_type === tpl.kp_content_type
|
|
3503
|
+
);
|
|
3504
|
+
const rollupSourceKeys = new Set(
|
|
3505
|
+
rollupConfigs.map((r) => JSON.stringify(r.source))
|
|
3506
|
+
);
|
|
3507
|
+
const dedupedFilters = filtersWithCommonFlag.filter(
|
|
3508
|
+
(f) => !rollupSourceKeys.has(JSON.stringify(f.source))
|
|
3509
|
+
);
|
|
3510
|
+
const combined = [...dedupedFilters, ...rollupConfigs];
|
|
3511
|
+
const combinedWithParents = sortFiltersHierarchically(
|
|
3512
|
+
attachParentFields(combined, allTpls)
|
|
3513
|
+
);
|
|
3514
|
+
const rollupFilterIds = new Set(rollupConfigs.map((r) => r.filterId));
|
|
3515
|
+
const filtersWithParents = combinedWithParents.filter(
|
|
3516
|
+
(f) => !rollupFilterIds.has(f.filterId)
|
|
3517
|
+
);
|
|
3518
|
+
const rollupsWithParents = combinedWithParents.filter(
|
|
3519
|
+
(f) => rollupFilterIds.has(f.filterId)
|
|
3520
|
+
);
|
|
3521
|
+
return {
|
|
3522
|
+
contentType: tpl.kp_content_type,
|
|
3523
|
+
display: tplData?.general?.content?.title || tpl.kp_content_type,
|
|
3524
|
+
filters: filtersWithParents,
|
|
3525
|
+
rollups: rollupsWithParents
|
|
3526
|
+
};
|
|
3527
|
+
});
|
|
3528
|
+
const filteredPerDataset = perDataset.filter(
|
|
3529
|
+
(d) => d.filters.length > 0 || d.rollups.length > 0
|
|
3530
|
+
);
|
|
3531
|
+
if (commonFilterConfigs.length === 0 && sharedAcrossMultiple.length === 0 && filteredPerDataset.every((d) => d.filters.length === 0)) {
|
|
3532
|
+
return null;
|
|
3533
|
+
}
|
|
3534
|
+
const flatCommonDocFilters = commonDocumentFilters.flatMap(
|
|
3535
|
+
(s) => s.configs || [s]
|
|
3536
|
+
);
|
|
3537
|
+
const shouldFlatten = flatDocFilters && selectedTpls.length === 1;
|
|
3538
|
+
return {
|
|
3539
|
+
filterId: "docHierarchy_document_filters",
|
|
3540
|
+
display: "Combined Content Filters",
|
|
3541
|
+
filterKey: "docHierarchyType::doc",
|
|
3542
|
+
source: {
|
|
3543
|
+
filterType: "docHierarchyType",
|
|
3544
|
+
flatDocFilters: shouldFlatten,
|
|
3545
|
+
commonFilters: commonFilterConfigs,
|
|
3546
|
+
sharedAcrossMultiple,
|
|
3547
|
+
commonDocumentFilters: flatCommonDocFilters,
|
|
3548
|
+
perDataset: filteredPerDataset
|
|
3549
|
+
},
|
|
3550
|
+
target: { filterType: "docHierarchyType" }
|
|
3551
|
+
};
|
|
3552
|
+
};
|
|
3553
|
+
|
|
3309
3554
|
// src/utils/autoGenFilterConfigsFromTpl/utils/TEMP_removeDuplicateFilters.ts
|
|
3310
3555
|
var TEMP_removeDuplicateFilters = (filterGroups) => {
|
|
3311
3556
|
return filterGroups.map((group) => {
|
|
@@ -3442,7 +3687,25 @@ var autoGenFilterConfigsFromTpl = ({
|
|
|
3442
3687
|
...annotationRollupSections
|
|
3443
3688
|
].filter((section) => Array.isArray(section.configs) ? section.configs.length > 0 : true)
|
|
3444
3689
|
};
|
|
3445
|
-
const
|
|
3690
|
+
const isSMTDocFilterUI = isSelfManagedTenant && filterScopes.includes("doc");
|
|
3691
|
+
const final_documentTagsFilterConfigs = isSMTDocFilterUI ? (() => {
|
|
3692
|
+
const docHierarchyConfig = _self_managed_buildDocHierarchyConfig({
|
|
3693
|
+
combinedDocumentBlocks: extractedBlocks.combinedDocumentBlocks,
|
|
3694
|
+
docRollupBlocks: extractedBlocks.docRollupBlocks,
|
|
3695
|
+
selectedTpls,
|
|
3696
|
+
allTpls,
|
|
3697
|
+
commonDocumentFilters
|
|
3698
|
+
});
|
|
3699
|
+
if (!docHierarchyConfig) return { sectionId: "documentTagsSection", sectionTitle: "Document Filters", configs: [] };
|
|
3700
|
+
return {
|
|
3701
|
+
sectionId: "documentTagsSection",
|
|
3702
|
+
// sectionTitle: 'Document Filters',
|
|
3703
|
+
configs: [{
|
|
3704
|
+
sectionId: "self_managed_consolidated_doc_filters",
|
|
3705
|
+
configs: [docHierarchyConfig]
|
|
3706
|
+
}]
|
|
3707
|
+
};
|
|
3708
|
+
})() : {
|
|
3446
3709
|
sectionId: "documentTagsSection",
|
|
3447
3710
|
sectionTitle: "Document Filters",
|
|
3448
3711
|
configs: [
|
|
@@ -3898,6 +4161,7 @@ var import_GET_GLOBAL_BULLMQ_CONFIG = __toESM(require_GET_GLOBAL_BULLMQ_CONFIG()
|
|
|
3898
4161
|
UI_CONTENT,
|
|
3899
4162
|
WorkerManager,
|
|
3900
4163
|
_self_managed_buildAnnoHierarchyConfig,
|
|
4164
|
+
_self_managed_buildDocHierarchyConfig,
|
|
3901
4165
|
_self_managed_getFixedAnnoRollupBlocks,
|
|
3902
4166
|
_self_managed_getFixedAnnoTagBlock,
|
|
3903
4167
|
autoGenFilterConfigsFromTpl,
|