@okf/ootils 1.26.4 → 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 +100 -1
- package/dist/browser.d.ts +100 -1
- package/dist/browser.js +303 -1
- package/dist/browser.mjs +300 -1
- package/dist/node.d.mts +100 -1
- package/dist/node.d.ts +100 -1
- package/dist/node.js +303 -1
- package/dist/node.mjs +300 -1
- package/dist/universal.d.mts +100 -1
- package/dist/universal.d.ts +100 -1
- package/dist/universal.js +303 -1
- package/dist/universal.mjs +300 -1
- package/package.json +1 -1
package/dist/universal.js
CHANGED
|
@@ -25,6 +25,7 @@ __export(universal_exports, {
|
|
|
25
25
|
TEMP_removeDuplicateFilters: () => TEMP_removeDuplicateFilters,
|
|
26
26
|
UI_CONTENT: () => UI_CONTENT,
|
|
27
27
|
_self_managed_buildAnnoHierarchyConfig: () => _self_managed_buildAnnoHierarchyConfig,
|
|
28
|
+
_self_managed_buildDocHierarchyConfig: () => _self_managed_buildDocHierarchyConfig,
|
|
28
29
|
_self_managed_getFixedAnnoRollupBlocks: () => _self_managed_getFixedAnnoRollupBlocks,
|
|
29
30
|
_self_managed_getFixedAnnoTagBlock: () => _self_managed_getFixedAnnoTagBlock,
|
|
30
31
|
autoGenFilterConfigsFromTpl: () => autoGenFilterConfigsFromTpl,
|
|
@@ -33,6 +34,8 @@ __export(universal_exports, {
|
|
|
33
34
|
deleteVal: () => deleteVal,
|
|
34
35
|
extractAllBlocksFromTpl: () => extractAllBlocksFromTpl,
|
|
35
36
|
extractAndOrganizeBlocks: () => extractAndOrganizeBlocks,
|
|
37
|
+
genCleanCamelCaseId: () => genCleanCamelCaseId,
|
|
38
|
+
genCleanIdForContentTypeAndValuePaths: () => genCleanIdForContentTypeAndValuePaths,
|
|
36
39
|
genTagId: () => genTagId,
|
|
37
40
|
generateFilterKey: () => generateFilterKey,
|
|
38
41
|
getFilterKeyForBlock: () => getFilterKeyForBlock,
|
|
@@ -1068,6 +1071,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
1068
1071
|
filterKey,
|
|
1069
1072
|
contentType: element.contentType,
|
|
1070
1073
|
path: element.valuePath,
|
|
1074
|
+
...element.comp && { comp: element.comp },
|
|
1071
1075
|
source: {
|
|
1072
1076
|
filterType: "tplType",
|
|
1073
1077
|
contentType: element.contentType,
|
|
@@ -1093,6 +1097,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
1093
1097
|
filterKey: valuePathFilterKey,
|
|
1094
1098
|
contentType: element.contentType,
|
|
1095
1099
|
path: element.valuePath,
|
|
1100
|
+
...element.comp && { comp: element.comp },
|
|
1096
1101
|
source: {
|
|
1097
1102
|
filterType: "tplType",
|
|
1098
1103
|
contentType: element.contentType,
|
|
@@ -1118,6 +1123,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
1118
1123
|
filterKey: dateFilterKey,
|
|
1119
1124
|
contentType: element.contentType,
|
|
1120
1125
|
path: element.valuePath,
|
|
1126
|
+
...element.comp && { comp: element.comp },
|
|
1121
1127
|
source: { filterType: "dateRangeType" },
|
|
1122
1128
|
target: { filterType: "dateRangeType", valuePath: element.valuePath }
|
|
1123
1129
|
};
|
|
@@ -1135,6 +1141,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
1135
1141
|
filterKey: numberFilterKey,
|
|
1136
1142
|
contentType: element.contentType,
|
|
1137
1143
|
path: element.valuePath,
|
|
1144
|
+
...element.comp && { comp: element.comp },
|
|
1138
1145
|
source: { filterType: "numberRangeType", valuePath: element.valuePath },
|
|
1139
1146
|
target: { filterType: "numberRangeType", valuePath: element.valuePath }
|
|
1140
1147
|
};
|
|
@@ -1255,6 +1262,7 @@ var buildFilterConfigurations = ({ groups, type, selectedTpls, allTpls, isRollup
|
|
|
1255
1262
|
filterKey: tagFilterKey,
|
|
1256
1263
|
contentType: element.tagType,
|
|
1257
1264
|
path: `tags.${element.tagType}`,
|
|
1265
|
+
...element.comp && { comp: element.comp },
|
|
1258
1266
|
source: allProfileTpls.some(
|
|
1259
1267
|
(tpl) => tpl.kp_content_type === element.tagType
|
|
1260
1268
|
) ? {
|
|
@@ -1396,6 +1404,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
1396
1404
|
contentType: tpl.kp_content_type,
|
|
1397
1405
|
blocks: allBlocks.filter((block) => block.valuePath.startsWith("tags.")).map((block) => ({
|
|
1398
1406
|
tagType: block.props.tagType,
|
|
1407
|
+
comp: block.comp,
|
|
1399
1408
|
filterType: "tagType"
|
|
1400
1409
|
}))
|
|
1401
1410
|
};
|
|
@@ -1423,6 +1432,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
1423
1432
|
value: block.valuePath,
|
|
1424
1433
|
saveValueAsString: block.props?.saveValueAsString,
|
|
1425
1434
|
contentType: tpl.kp_content_type,
|
|
1435
|
+
comp: block.comp,
|
|
1426
1436
|
filterType: "valuePathType"
|
|
1427
1437
|
}))
|
|
1428
1438
|
};
|
|
@@ -1437,6 +1447,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
1437
1447
|
value: block.valuePath,
|
|
1438
1448
|
saveValueAsString: block.props?.saveValueAsString,
|
|
1439
1449
|
contentType: tpl.kp_content_type,
|
|
1450
|
+
comp: block.comp,
|
|
1440
1451
|
block,
|
|
1441
1452
|
filterType: "split_valuePathType"
|
|
1442
1453
|
}))
|
|
@@ -1451,6 +1462,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
1451
1462
|
display: block.props?.shortLabel || block.props?.label || block.valuePath,
|
|
1452
1463
|
value: block.valuePath,
|
|
1453
1464
|
contentType: tpl.kp_content_type,
|
|
1465
|
+
comp: block.comp,
|
|
1454
1466
|
filterType: "dateRangeType"
|
|
1455
1467
|
}))
|
|
1456
1468
|
};
|
|
@@ -1464,6 +1476,7 @@ var extractAndOrganizeBlocks = (selectedTpls, allTpls) => {
|
|
|
1464
1476
|
display: block.props?.shortLabel || block.props?.label || block.valuePath,
|
|
1465
1477
|
value: block.valuePath,
|
|
1466
1478
|
contentType: tpl.kp_content_type,
|
|
1479
|
+
comp: block.comp,
|
|
1467
1480
|
filterType: "numberRangeType"
|
|
1468
1481
|
}))
|
|
1469
1482
|
};
|
|
@@ -1710,6 +1723,240 @@ var _self_managed_buildAnnoHierarchyConfig = ({
|
|
|
1710
1723
|
};
|
|
1711
1724
|
};
|
|
1712
1725
|
|
|
1726
|
+
// src/utils/autoGenFilterConfigsFromTpl/utils/buildTagTypeParentMap.ts
|
|
1727
|
+
var buildTagTypeParentMap = (tagTypesInGroup, allTpls) => {
|
|
1728
|
+
const tagTypeSet = new Set(tagTypesInGroup);
|
|
1729
|
+
const parentMap = /* @__PURE__ */ new Map();
|
|
1730
|
+
for (const tagType of tagTypesInGroup) {
|
|
1731
|
+
const tpl = allTpls.find((t) => t.kp_content_type === tagType);
|
|
1732
|
+
if (!tpl) continue;
|
|
1733
|
+
const blocks = extractAllBlocksFromTpl({ tpl });
|
|
1734
|
+
const tagBlocks = blocks.filter(
|
|
1735
|
+
(block) => block.valuePath?.startsWith("tags.") && block.props?.tagType
|
|
1736
|
+
);
|
|
1737
|
+
for (const block of tagBlocks) {
|
|
1738
|
+
const referencedTagType = block.props.tagType;
|
|
1739
|
+
if (tagTypeSet.has(referencedTagType) && referencedTagType !== tagType) {
|
|
1740
|
+
parentMap.set(tagType, referencedTagType);
|
|
1741
|
+
break;
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
for (const child of parentMap.keys()) {
|
|
1746
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1747
|
+
let current = child;
|
|
1748
|
+
while (current && parentMap.has(current)) {
|
|
1749
|
+
if (visited.has(current)) {
|
|
1750
|
+
parentMap.delete(current);
|
|
1751
|
+
break;
|
|
1752
|
+
}
|
|
1753
|
+
visited.add(current);
|
|
1754
|
+
current = parentMap.get(current);
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
return parentMap;
|
|
1758
|
+
};
|
|
1759
|
+
var attachParentFields = (filters, allTpls) => {
|
|
1760
|
+
const tagTypeFilters = filters.filter(
|
|
1761
|
+
(f) => f.source?.filterType === "tagType" && f.source?.tagType
|
|
1762
|
+
);
|
|
1763
|
+
if (tagTypeFilters.length === 0) return filters;
|
|
1764
|
+
const tagTypesInGroup = tagTypeFilters.map((f) => f.source.tagType);
|
|
1765
|
+
const parentMap = buildTagTypeParentMap(tagTypesInGroup, allTpls);
|
|
1766
|
+
if (parentMap.size === 0) return filters;
|
|
1767
|
+
const tagTypeToFilterId = /* @__PURE__ */ new Map();
|
|
1768
|
+
for (const f of tagTypeFilters) {
|
|
1769
|
+
tagTypeToFilterId.set(f.source.tagType, f.filterId);
|
|
1770
|
+
}
|
|
1771
|
+
return filters.map((f) => {
|
|
1772
|
+
if (f.source?.filterType !== "tagType" || !f.source?.tagType) return f;
|
|
1773
|
+
const parentTagType = parentMap.get(f.source.tagType);
|
|
1774
|
+
if (!parentTagType) return f;
|
|
1775
|
+
const parentFilterId = tagTypeToFilterId.get(parentTagType);
|
|
1776
|
+
if (!parentFilterId) return f;
|
|
1777
|
+
return { ...f, parentFilterId };
|
|
1778
|
+
});
|
|
1779
|
+
};
|
|
1780
|
+
var sortFiltersHierarchically = (filters) => {
|
|
1781
|
+
if (filters.length <= 1) return filters;
|
|
1782
|
+
const hasHierarchy = filters.some((f) => f.parentFilterId);
|
|
1783
|
+
if (!hasHierarchy) return filters;
|
|
1784
|
+
const childrenOf = /* @__PURE__ */ new Map();
|
|
1785
|
+
const roots = [];
|
|
1786
|
+
for (const f of filters) {
|
|
1787
|
+
if (!f.parentFilterId) {
|
|
1788
|
+
roots.push(f);
|
|
1789
|
+
} else {
|
|
1790
|
+
const siblings = childrenOf.get(f.parentFilterId) || [];
|
|
1791
|
+
siblings.push(f);
|
|
1792
|
+
childrenOf.set(f.parentFilterId, siblings);
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
const sorted = [];
|
|
1796
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1797
|
+
const visit = (filter) => {
|
|
1798
|
+
if (visited.has(filter.filterId)) return;
|
|
1799
|
+
visited.add(filter.filterId);
|
|
1800
|
+
sorted.push(filter);
|
|
1801
|
+
const children = childrenOf.get(filter.filterId) || [];
|
|
1802
|
+
for (const child of children) {
|
|
1803
|
+
visit(child);
|
|
1804
|
+
}
|
|
1805
|
+
};
|
|
1806
|
+
for (const root of roots) {
|
|
1807
|
+
visit(root);
|
|
1808
|
+
}
|
|
1809
|
+
for (const f of filters) {
|
|
1810
|
+
if (!visited.has(f.filterId)) {
|
|
1811
|
+
sorted.push(f);
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
return sorted;
|
|
1815
|
+
};
|
|
1816
|
+
|
|
1817
|
+
// src/utils/autoGenFilterConfigsFromTpl/utils/_self_managed_buildDocHierarchyConfig.ts
|
|
1818
|
+
var _self_managed_buildDocHierarchyConfig = ({
|
|
1819
|
+
combinedDocumentBlocks,
|
|
1820
|
+
docRollupBlocks,
|
|
1821
|
+
selectedTpls,
|
|
1822
|
+
allTpls,
|
|
1823
|
+
commonDocumentFilters,
|
|
1824
|
+
flatDocFilters = false
|
|
1825
|
+
}) => {
|
|
1826
|
+
const allGroups = compareAndGroupBlocks(combinedDocumentBlocks);
|
|
1827
|
+
const commonGroup = allGroups.find(
|
|
1828
|
+
(g) => g.contentTypes.length === selectedTpls.length
|
|
1829
|
+
);
|
|
1830
|
+
const commonFilterConfigs = commonGroup ? sortFiltersHierarchically(
|
|
1831
|
+
attachParentFields(
|
|
1832
|
+
buildFilterConfigurations({
|
|
1833
|
+
groups: [commonGroup],
|
|
1834
|
+
type: "tags",
|
|
1835
|
+
selectedTpls,
|
|
1836
|
+
allTpls,
|
|
1837
|
+
isRollup: false,
|
|
1838
|
+
isAnno: false
|
|
1839
|
+
}).flatMap((s) => s.configs),
|
|
1840
|
+
allTpls
|
|
1841
|
+
)
|
|
1842
|
+
) : [];
|
|
1843
|
+
const multiDatasetGroups = selectedTpls.length >= 2 ? allGroups.filter(
|
|
1844
|
+
(g) => g.contentTypes.length > 1 && g.contentTypes.length < selectedTpls.length
|
|
1845
|
+
) : [];
|
|
1846
|
+
const sharedAcrossMultiple = multiDatasetGroups.map((group) => {
|
|
1847
|
+
const groupFilterConfigs = sortFiltersHierarchically(
|
|
1848
|
+
attachParentFields(
|
|
1849
|
+
buildFilterConfigurations({
|
|
1850
|
+
groups: [group],
|
|
1851
|
+
type: "tags",
|
|
1852
|
+
selectedTpls,
|
|
1853
|
+
allTpls,
|
|
1854
|
+
isRollup: false,
|
|
1855
|
+
isAnno: false
|
|
1856
|
+
}).flatMap((s) => s.configs),
|
|
1857
|
+
allTpls
|
|
1858
|
+
)
|
|
1859
|
+
);
|
|
1860
|
+
const display = group.contentTypes.map((ct) => {
|
|
1861
|
+
const tplData = allTpls.find(
|
|
1862
|
+
(t) => t.kp_content_type === ct
|
|
1863
|
+
);
|
|
1864
|
+
return tplData?.general?.content?.title || ct;
|
|
1865
|
+
}).join(" + ");
|
|
1866
|
+
return {
|
|
1867
|
+
contentTypes: group.contentTypes,
|
|
1868
|
+
display,
|
|
1869
|
+
filters: groupFilterConfigs
|
|
1870
|
+
};
|
|
1871
|
+
}).filter((g) => g.filters.length > 0);
|
|
1872
|
+
const commonFilterIds = new Set(commonFilterConfigs.map((f) => f.filterId));
|
|
1873
|
+
const perDataset = selectedTpls.map((tpl) => {
|
|
1874
|
+
const tplBlocks = combinedDocumentBlocks.find(
|
|
1875
|
+
(b) => b.contentType === tpl.kp_content_type
|
|
1876
|
+
);
|
|
1877
|
+
const singleTplGroup = [
|
|
1878
|
+
{
|
|
1879
|
+
contentTypes: [tpl.kp_content_type],
|
|
1880
|
+
elements: tplBlocks?.blocks || []
|
|
1881
|
+
}
|
|
1882
|
+
];
|
|
1883
|
+
const filters = buildFilterConfigurations({
|
|
1884
|
+
groups: singleTplGroup,
|
|
1885
|
+
type: "tags",
|
|
1886
|
+
selectedTpls: [tpl],
|
|
1887
|
+
allTpls,
|
|
1888
|
+
isRollup: false,
|
|
1889
|
+
isAnno: false
|
|
1890
|
+
}).flatMap((s) => s.configs);
|
|
1891
|
+
const filtersWithCommonFlag = filters.map((f) => ({
|
|
1892
|
+
...f,
|
|
1893
|
+
isSharedFilter: commonFilterIds.has(f.filterId)
|
|
1894
|
+
}));
|
|
1895
|
+
const rollupData = docRollupBlocks?.find(
|
|
1896
|
+
(b) => b.contentType === tpl.kp_content_type
|
|
1897
|
+
);
|
|
1898
|
+
const rollupGroups = rollupData?.blocks?.length ? compareAndGroupBlocks([rollupData]) : [];
|
|
1899
|
+
const rollupConfigs = rollupGroups.length ? buildFilterConfigurations({
|
|
1900
|
+
groups: rollupGroups,
|
|
1901
|
+
type: "tags",
|
|
1902
|
+
selectedTpls: [tpl],
|
|
1903
|
+
allTpls,
|
|
1904
|
+
isRollup: true,
|
|
1905
|
+
isAnno: false
|
|
1906
|
+
}).flatMap((s) => s.configs) : [];
|
|
1907
|
+
const tplData = allTpls.find(
|
|
1908
|
+
(t) => t.kp_content_type === tpl.kp_content_type
|
|
1909
|
+
);
|
|
1910
|
+
const rollupSourceKeys = new Set(
|
|
1911
|
+
rollupConfigs.map((r) => JSON.stringify(r.source))
|
|
1912
|
+
);
|
|
1913
|
+
const dedupedFilters = filtersWithCommonFlag.filter(
|
|
1914
|
+
(f) => !rollupSourceKeys.has(JSON.stringify(f.source))
|
|
1915
|
+
);
|
|
1916
|
+
const combined = [...dedupedFilters, ...rollupConfigs];
|
|
1917
|
+
const combinedWithParents = sortFiltersHierarchically(
|
|
1918
|
+
attachParentFields(combined, allTpls)
|
|
1919
|
+
);
|
|
1920
|
+
const rollupFilterIds = new Set(rollupConfigs.map((r) => r.filterId));
|
|
1921
|
+
const filtersWithParents = combinedWithParents.filter(
|
|
1922
|
+
(f) => !rollupFilterIds.has(f.filterId)
|
|
1923
|
+
);
|
|
1924
|
+
const rollupsWithParents = combinedWithParents.filter(
|
|
1925
|
+
(f) => rollupFilterIds.has(f.filterId)
|
|
1926
|
+
);
|
|
1927
|
+
return {
|
|
1928
|
+
contentType: tpl.kp_content_type,
|
|
1929
|
+
display: tplData?.general?.content?.title || tpl.kp_content_type,
|
|
1930
|
+
filters: filtersWithParents,
|
|
1931
|
+
rollups: rollupsWithParents
|
|
1932
|
+
};
|
|
1933
|
+
});
|
|
1934
|
+
const filteredPerDataset = perDataset.filter(
|
|
1935
|
+
(d) => d.filters.length > 0 || d.rollups.length > 0
|
|
1936
|
+
);
|
|
1937
|
+
if (commonFilterConfigs.length === 0 && sharedAcrossMultiple.length === 0 && filteredPerDataset.every((d) => d.filters.length === 0)) {
|
|
1938
|
+
return null;
|
|
1939
|
+
}
|
|
1940
|
+
const flatCommonDocFilters = commonDocumentFilters.flatMap(
|
|
1941
|
+
(s) => s.configs || [s]
|
|
1942
|
+
);
|
|
1943
|
+
const shouldFlatten = flatDocFilters && selectedTpls.length === 1;
|
|
1944
|
+
return {
|
|
1945
|
+
filterId: "docHierarchy_document_filters",
|
|
1946
|
+
display: "Combined Content Filters",
|
|
1947
|
+
filterKey: "docHierarchyType::doc",
|
|
1948
|
+
source: {
|
|
1949
|
+
filterType: "docHierarchyType",
|
|
1950
|
+
flatDocFilters: shouldFlatten,
|
|
1951
|
+
commonFilters: commonFilterConfigs,
|
|
1952
|
+
sharedAcrossMultiple,
|
|
1953
|
+
commonDocumentFilters: flatCommonDocFilters,
|
|
1954
|
+
perDataset: filteredPerDataset
|
|
1955
|
+
},
|
|
1956
|
+
target: { filterType: "docHierarchyType" }
|
|
1957
|
+
};
|
|
1958
|
+
};
|
|
1959
|
+
|
|
1713
1960
|
// src/utils/autoGenFilterConfigsFromTpl/utils/TEMP_removeDuplicateFilters.ts
|
|
1714
1961
|
var TEMP_removeDuplicateFilters = (filterGroups) => {
|
|
1715
1962
|
return filterGroups.map((group) => {
|
|
@@ -1846,7 +2093,25 @@ var autoGenFilterConfigsFromTpl = ({
|
|
|
1846
2093
|
...annotationRollupSections
|
|
1847
2094
|
].filter((section) => Array.isArray(section.configs) ? section.configs.length > 0 : true)
|
|
1848
2095
|
};
|
|
1849
|
-
const
|
|
2096
|
+
const isSMTDocFilterUI = isSelfManagedTenant && filterScopes.includes("doc");
|
|
2097
|
+
const final_documentTagsFilterConfigs = isSMTDocFilterUI ? (() => {
|
|
2098
|
+
const docHierarchyConfig = _self_managed_buildDocHierarchyConfig({
|
|
2099
|
+
combinedDocumentBlocks: extractedBlocks.combinedDocumentBlocks,
|
|
2100
|
+
docRollupBlocks: extractedBlocks.docRollupBlocks,
|
|
2101
|
+
selectedTpls,
|
|
2102
|
+
allTpls,
|
|
2103
|
+
commonDocumentFilters
|
|
2104
|
+
});
|
|
2105
|
+
if (!docHierarchyConfig) return { sectionId: "documentTagsSection", sectionTitle: "Document Filters", configs: [] };
|
|
2106
|
+
return {
|
|
2107
|
+
sectionId: "documentTagsSection",
|
|
2108
|
+
// sectionTitle: 'Document Filters',
|
|
2109
|
+
configs: [{
|
|
2110
|
+
sectionId: "self_managed_consolidated_doc_filters",
|
|
2111
|
+
configs: [docHierarchyConfig]
|
|
2112
|
+
}]
|
|
2113
|
+
};
|
|
2114
|
+
})() : {
|
|
1850
2115
|
sectionId: "documentTagsSection",
|
|
1851
2116
|
sectionTitle: "Document Filters",
|
|
1852
2117
|
configs: [
|
|
@@ -1860,6 +2125,40 @@ var autoGenFilterConfigsFromTpl = ({
|
|
|
1860
2125
|
].filter(Boolean);
|
|
1861
2126
|
return result;
|
|
1862
2127
|
};
|
|
2128
|
+
|
|
2129
|
+
// src/utils/genCleanCamelCaseId.ts
|
|
2130
|
+
var genCleanCamelCaseId = (id) => {
|
|
2131
|
+
if (!id || typeof id !== "string") return id;
|
|
2132
|
+
const isAlreadyClean = /^\p{Ll}[\p{L}\p{N}]*$/u.test(id) || /^a\d[\p{L}\p{N}]*$/u.test(id);
|
|
2133
|
+
if (isAlreadyClean) return id;
|
|
2134
|
+
const words = id.split(/[^\p{L}\p{N}]+/u).filter(Boolean);
|
|
2135
|
+
if (words.length === 0) return "a";
|
|
2136
|
+
const result = words.map((word, i) => {
|
|
2137
|
+
const lower = word.toLowerCase();
|
|
2138
|
+
return i === 0 ? lower : lower.charAt(0).toUpperCase() + lower.slice(1);
|
|
2139
|
+
}).join("");
|
|
2140
|
+
return /^\d/.test(result) ? "a" + result : result;
|
|
2141
|
+
};
|
|
2142
|
+
|
|
2143
|
+
// src/utils/genCleanIdForContentTypeAndValuePaths.ts
|
|
2144
|
+
var CHARS = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
2145
|
+
function genShortId(length = 4) {
|
|
2146
|
+
let result = "";
|
|
2147
|
+
for (let i = 0; i < length; i++) {
|
|
2148
|
+
result += CHARS[Math.floor(Math.random() * CHARS.length)];
|
|
2149
|
+
}
|
|
2150
|
+
return result;
|
|
2151
|
+
}
|
|
2152
|
+
var genCleanIdForContentTypeAndValuePaths = (text, maxLength = 10, shortIdLength = 4) => {
|
|
2153
|
+
if (!text || typeof text !== "string") return text;
|
|
2154
|
+
let cleaned = text.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
2155
|
+
if (!cleaned) {
|
|
2156
|
+
throw new Error(`[genCleanIdForContentTypeAndValuePaths] Input "${text}" contains no alphanumeric characters`);
|
|
2157
|
+
}
|
|
2158
|
+
if (/^\d/.test(cleaned)) cleaned = "a" + cleaned;
|
|
2159
|
+
const truncated = cleaned.slice(0, maxLength);
|
|
2160
|
+
return `${truncated}_${genShortId(shortIdLength)}`;
|
|
2161
|
+
};
|
|
1863
2162
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1864
2163
|
0 && (module.exports = {
|
|
1865
2164
|
BASE_BULLMQ_CONFIG,
|
|
@@ -1867,6 +2166,7 @@ var autoGenFilterConfigsFromTpl = ({
|
|
|
1867
2166
|
TEMP_removeDuplicateFilters,
|
|
1868
2167
|
UI_CONTENT,
|
|
1869
2168
|
_self_managed_buildAnnoHierarchyConfig,
|
|
2169
|
+
_self_managed_buildDocHierarchyConfig,
|
|
1870
2170
|
_self_managed_getFixedAnnoRollupBlocks,
|
|
1871
2171
|
_self_managed_getFixedAnnoTagBlock,
|
|
1872
2172
|
autoGenFilterConfigsFromTpl,
|
|
@@ -1875,6 +2175,8 @@ var autoGenFilterConfigsFromTpl = ({
|
|
|
1875
2175
|
deleteVal,
|
|
1876
2176
|
extractAllBlocksFromTpl,
|
|
1877
2177
|
extractAndOrganizeBlocks,
|
|
2178
|
+
genCleanCamelCaseId,
|
|
2179
|
+
genCleanIdForContentTypeAndValuePaths,
|
|
1878
2180
|
genTagId,
|
|
1879
2181
|
generateFilterKey,
|
|
1880
2182
|
getFilterKeyForBlock,
|