mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 19:56:02 +00:00
search settings
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
export let showPinnedInsteadOfUnpin = false;
|
||||
export let indentLevel = 0;
|
||||
export let disableBoldScroll = false;
|
||||
export let filter = null;
|
||||
|
||||
$: isChecked =
|
||||
checkedObjectsStore && $checkedObjectsStore.find(x => module?.extractKey(data) == module?.extractKey(x));
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
$: filtered = !groupFunc
|
||||
? list.filter(data => {
|
||||
const matcher = module.createMatcher && module.createMatcher(data);
|
||||
const matcher = module.createMatcher && module.createMatcher(data, passProps?.searchSettings);
|
||||
if (matcher && !matcher(filter)) return false;
|
||||
return true;
|
||||
})
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
$: childrenMatched = !groupFunc
|
||||
? list.filter(data => {
|
||||
const matcher = module.createChildMatcher && module.createChildMatcher(data);
|
||||
const matcher = module.createChildMatcher && module.createChildMatcher(data, passProps?.searchSettings);
|
||||
if (matcher && !matcher(filter)) return false;
|
||||
return true;
|
||||
})
|
||||
@@ -62,7 +62,7 @@
|
||||
$: listGrouped = groupFunc
|
||||
? _.compact(
|
||||
(list || []).map(data => {
|
||||
const matcher = module.createMatcher && module.createMatcher(data);
|
||||
const matcher = module.createMatcher && module.createMatcher(data, passProps?.searchSettings);
|
||||
const isMatched = matcher && !matcher(filter) ? false : true;
|
||||
const group = groupFunc(data);
|
||||
return { group, data, isMatched };
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
{module}
|
||||
{disableContextMenu}
|
||||
{passProps}
|
||||
{filter}
|
||||
/>
|
||||
|
||||
{#if (isExpanded || isExpandedBySearch) && subItemsComponent}
|
||||
|
||||
@@ -3,14 +3,30 @@
|
||||
|
||||
export const extractKey = ({ schemaName, pureName }) => (schemaName ? `${schemaName}.${pureName}` : pureName);
|
||||
export const createMatcher =
|
||||
({ schemaName, pureName, columns }) =>
|
||||
filter =>
|
||||
filterName(
|
||||
filter,
|
||||
pureName,
|
||||
schemaName,
|
||||
...(columns?.map(({ columnName }) => ({ childName: columnName })) || [])
|
||||
);
|
||||
(
|
||||
{ schemaName, pureName, objectComment, tableEngine, columns, objectTypeField, createSql },
|
||||
cfg = DEFAULT_SEARCH_SETTINGS
|
||||
) =>
|
||||
filter => {
|
||||
const filterArgs = [];
|
||||
if (cfg.schemaName) filterArgs.push(schemaName);
|
||||
if (objectTypeField == 'tables') {
|
||||
if (cfg.tableName) filterArgs.push(pureName);
|
||||
if (cfg.tableComment) filterArgs.push(objectComment);
|
||||
if (cfg.tableEngine) filterArgs.push(tableEngine);
|
||||
|
||||
for (const column of columns || []) {
|
||||
if (cfg.columnName) filterArgs.push(column.columnName);
|
||||
if (cfg.columnComment) filterArgs.push(column.columnComment);
|
||||
if (cfg.columnDataType) filterArgs.push(column.dataType);
|
||||
}
|
||||
} else {
|
||||
if (cfg.sqlObjectName) filterArgs.push(pureName);
|
||||
if (cfg.sqlObjectText) filterArgs.push(createSql);
|
||||
}
|
||||
|
||||
return filterName(filter, ...filterArgs);
|
||||
};
|
||||
export const createTitle = ({ schemaName, pureName }) => (schemaName ? `${schemaName}.${pureName}` : pureName);
|
||||
|
||||
export const databaseObjectIcons = {
|
||||
@@ -877,9 +893,11 @@
|
||||
import AppObjectCore from './AppObjectCore.svelte';
|
||||
import {
|
||||
currentDatabase,
|
||||
DEFAULT_SEARCH_SETTINGS,
|
||||
extensions,
|
||||
getActiveTab,
|
||||
getCurrentSettings,
|
||||
getDatabaseObjectAppObjectSearchSettings,
|
||||
getExtensions,
|
||||
getLastUsedDefaultActions,
|
||||
lastUsedDefaultActions,
|
||||
|
||||
Reference in New Issue
Block a user