mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-03 11:43:57 +00:00
refactor - not working
This commit is contained in:
@@ -36,9 +36,19 @@
|
|||||||
$: matcher = module.createMatcher && module.createMatcher(filter, passProps?.searchSettings);
|
$: matcher = module.createMatcher && module.createMatcher(filter, passProps?.searchSettings);
|
||||||
$: childMatcher = module.createChildMatcher && module.createChildMatcher(filter, passProps?.searchSettings);
|
$: childMatcher = module.createChildMatcher && module.createChildMatcher(filter, passProps?.searchSettings);
|
||||||
|
|
||||||
$: filtered = !groupFunc ? list.filter(data => !matcher || matcher(data)) : null;
|
$: dataLabeled = _.compact(
|
||||||
|
(list || []).map(data => {
|
||||||
|
const isMatched = !matcher || matcher(data);
|
||||||
|
const isChildMatched =
|
||||||
|
module.disableShowChildrenWithParentMatch && isMatched ? false : !childMatcher || childMatcher(data);
|
||||||
|
const group = groupFunc ? groupFunc(data) : undefined;
|
||||||
|
return { group, data, isMatched, isChildMatched };
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
$: childrenMatched = !groupFunc ? list.filter(data => !childMatcher || childMatcher(data)) : null;
|
$: filtered = dataLabeled.filter(x => x.isMatched).map(x => x.data);
|
||||||
|
|
||||||
|
$: childrenMatched = dataLabeled.filter(x => x.isChildMatched).map(x => x.data);
|
||||||
|
|
||||||
// let filtered = [];
|
// let filtered = [];
|
||||||
|
|
||||||
@@ -54,17 +64,6 @@
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
$: listGrouped = groupFunc
|
|
||||||
? _.compact(
|
|
||||||
(list || []).map(data => {
|
|
||||||
const isMatched = !matcher || matcher(data);
|
|
||||||
const isChildMatched = !childMatcher || childMatcher(data);
|
|
||||||
const group = groupFunc(data);
|
|
||||||
return { group, data, isMatched, isChildMatched };
|
|
||||||
})
|
|
||||||
)
|
|
||||||
: null;
|
|
||||||
|
|
||||||
function extendGroups(base, emptyList) {
|
function extendGroups(base, emptyList) {
|
||||||
const res = {
|
const res = {
|
||||||
...base,
|
...base,
|
||||||
@@ -76,10 +75,9 @@
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
$: groups = groupFunc ? extendGroups(_.groupBy(listGrouped, 'group'), emptyGroupNames) : null;
|
$: groups = groupFunc ? extendGroups(_.groupBy(dataLabeled, 'group'), emptyGroupNames) : null;
|
||||||
|
|
||||||
$: listLimited =
|
$: listLimited = isExpandedBySearch && !expandLimited ? filtered.slice(0, Math.min(filter.trim().length, 3)) : list;
|
||||||
isExpandedBySearch && !expandLimited ? filtered.slice(0, Math.min(filter.trim().length, 3)) : list;
|
|
||||||
$: isListLimited = isExpandedBySearch && listLimited.length < filtered.length;
|
$: isListLimited = isExpandedBySearch && listLimited.length < filtered.length;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,8 @@
|
|||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const disableShowChildrenWithParentMatch = true;
|
||||||
|
|
||||||
export const createTitle = ({ schemaName, pureName }) => (schemaName ? `${schemaName}.${pureName}` : pureName);
|
export const createTitle = ({ schemaName, pureName }) => (schemaName ? `${schemaName}.${pureName}` : pureName);
|
||||||
|
|
||||||
export const databaseObjectIcons = {
|
export const databaseObjectIcons = {
|
||||||
|
|||||||
Reference in New Issue
Block a user