import type refactor

This commit is contained in:
Jan Prochazka 2022-11-05 09:23:16 +01:00
parent 435d06ffb9
commit d41b254058
25 changed files with 53 additions and 86 deletions

View File

@ -1,5 +1,5 @@
import { getCommands, visibleCommandPalette } from '../stores';
import { GlobalCommand } from './registerCommand';
import type { GlobalCommand } from './registerCommand';
export default function runCommand(id) {
const commandsValue = getCommands();

View File

@ -1,5 +1,6 @@
import type { ChangeSet, MacroDefinition, MacroSelectedCell } from 'dbgate-datalib';
import {
ChangeSet,
changeSetContainsChanges,
changeSetInsertNewRow,
createChangeSet,
@ -7,8 +8,6 @@ import {
findExistingChangeSetItem,
getChangeSetInsertedRows,
GridDisplay,
MacroDefinition,
MacroSelectedCell,
revertChangeSetRowChanges,
setChangeSetValue,
setChangeSetRowData,
@ -16,7 +15,8 @@ import {
runMacroOnValue,
changeSetInsertDocuments,
} from 'dbgate-datalib';
import Grider, { GriderRowStatus } from './Grider';
import Grider from './Grider';
import type { GriderRowStatus } from './Grider';
function getRowFromItem(row, matchedChangeSetItem) {
return matchedChangeSetItem.document

View File

@ -1,4 +1,4 @@
import Grider, { GriderRowStatus } from './Grider';
import Grider from './Grider';
export default class RowsArrayGrider extends Grider {
constructor(private rows: any[]) {

View File

@ -1,8 +1,8 @@
import _ from 'lodash';
import { SeriesSizes } from './SeriesSizes';
import { CellAddress } from './selection';
import { GridDisplay } from 'dbgate-datalib';
import Grider from './Grider';
import type { CellAddress } from './selection';
import type { GridDisplay } from 'dbgate-datalib';
import type Grider from './Grider';
import { isJsonLikeLongString, safeJsonParse } from 'dbgate-tools';
export function countColumnSizes(grider: Grider, columns, containerWidth, display: GridDisplay) {

View File

@ -1,17 +1,9 @@
import _ from 'lodash';
import {
dumpSqlSelect,
Select,
JoinType,
Condition,
Relation,
mergeConditions,
Source,
ResultField,
Expression,
} from 'dbgate-sqltree';
import { DesignerInfo, DesignerTableInfo, DesignerReferenceInfo, DesignerJoinType } from './types';
import { DesignerComponent } from './DesignerComponentCreator';
import type { Select, JoinType, Condition, ResultField, Expression } from 'dbgate-sqltree';
import { mergeConditions } from 'dbgate-sqltree';
import type { DesignerInfo, DesignerTableInfo } from './types';
import type { DesignerComponent } from './DesignerComponentCreator';
import {
getReferenceConditions,
referenceIsCrossJoin,

View File

@ -1,4 +1,4 @@
import { DesignerTableInfo } from './types';
import type { DesignerTableInfo } from './types';
export default class DomTableRef {
domTable: Element;

View File

@ -1,12 +1,6 @@
import _ from 'lodash';
import {
IBoxBounds,
IPoint,
rectangleDistance,
rectangleIntersectArea,
solveOverlapsInIntervalArray,
Vector2D,
} from './designerMath';
import type { IBoxBounds, IPoint } from './designerMath';
import { rectangleDistance, rectangleIntersectArea, solveOverlapsInIntervalArray, Vector2D } from './designerMath';
import { union, intersection } from 'interval-operations';
const MIN_NODE_DISTANCE = 50;

View File

@ -1,5 +1,5 @@
import type { ChangeSet, ChangeSetRowDefinition } from 'dbgate-datalib';
import {
ChangeSet,
changeSetContainsChanges,
changeSetInsertNewRow,
createChangeSet,
@ -9,7 +9,6 @@ import {
TableFormViewDisplay,
revertChangeSetRowChanges,
setChangeSetValue,
ChangeSetRowDefinition,
} from 'dbgate-datalib';
import Former from './Former';

View File

@ -1,5 +1,5 @@
import { FreeTableModel } from 'dbgate-datalib';
import Grider, { GriderRowStatus } from '../datagrid/Grider';
import type { FreeTableModel } from 'dbgate-datalib';
import Grider from '../datagrid/Grider';
export default class FreeTableGrider extends Grider {
public model: FreeTableModel;

View File

@ -1,5 +1,7 @@
import { FreeTableModel, MacroDefinition, MacroSelectedCell, runMacro } from 'dbgate-datalib';
import Grider, { GriderRowStatus } from '../datagrid/Grider';
import type { FreeTableModel, MacroDefinition, MacroSelectedCell } from 'dbgate-datalib';
import { runMacro } from 'dbgate-datalib';
import Grider from '../datagrid/Grider';
import type { GriderRowStatus } from '../datagrid/Grider';
import _ from 'lodash';
function convertToSet(row, field) {

View File

@ -16,13 +16,8 @@
useViewInfo,
} from '../utility/metadataLoaders';
import { onMount, tick } from 'svelte';
import {
ChangePerspectiveConfigFunc,
createPerspectiveNodeConfig,
PerspectiveConfig,
PerspectiveCustomJoinConfig,
PerspectiveTreeNode,
} from 'dbgate-datalib';
import { createPerspectiveNodeConfig, PerspectiveTreeNode } from 'dbgate-datalib';
import type { ChangePerspectiveConfigFunc, PerspectiveConfig, PerspectiveCustomJoinConfig } from 'dbgate-datalib';
import getConnectionLabel from '../utility/getConnectionLabel';
import uuidv1 from 'uuid/v1';
import TextField from '../forms/TextField.svelte';

View File

@ -1,13 +1,11 @@
<script lang="ts">
import {
createPerspectiveNodeConfig,
MultipleDatabaseInfo,
PerspectiveConfig,
PerspectiveDataPatternDict,
perspectiveNodesHaveStructure,
PerspectiveTreeNode,
switchPerspectiveReferenceDirection,
} from 'dbgate-datalib';
import type { MultipleDatabaseInfo, PerspectiveConfig, PerspectiveDataPatternDict } from 'dbgate-datalib';
import type { CollectionInfo } from 'dbgate-types';
import _ from 'lodash';
import { tick } from 'svelte';

View File

@ -1,5 +1,6 @@
<script lang="ts">
import { ChangePerspectiveConfigFunc, PerspectiveConfig, PerspectiveTreeNode } from 'dbgate-datalib';
import { PerspectiveTreeNode } from 'dbgate-datalib';
import type { ChangePerspectiveConfigFunc, PerspectiveConfig } from 'dbgate-datalib';
import { keys } from 'localforage';
import _, { map } from 'lodash';

View File

@ -1,19 +1,10 @@
<script lang="ts">
import DataFilterControl from '../datagrid/DataFilterControl.svelte';
import ColumnLabel from '../elements/ColumnLabel.svelte';
import InlineButton from '../buttons/InlineButton.svelte';
import FontIcon from '../icons/FontIcon.svelte';
import { getFilterType, getFilterValueExpression } from 'dbgate-filterparser';
import {
ChangePerspectiveConfigFunc,
PerspectiveConfig,
PerspectiveFilterColumnInfo,
PerspectiveTreeNode,
} from 'dbgate-datalib';
import { showModal } from '../modals/modalTools';
import DictionaryLookupModal from '../modals/DictionaryLookupModal.svelte';
import ValueLookupModal from '../modals/ValueLookupModal.svelte';
import { PerspectiveTreeNode } from 'dbgate-datalib';
import type { ChangePerspectiveConfigFunc, PerspectiveConfig, PerspectiveFilterColumnInfo } from 'dbgate-datalib';
export let filterInfo: PerspectiveFilterColumnInfo;

View File

@ -1,5 +1,6 @@
<script lang="ts">
import { ChangePerspectiveConfigFunc, PerspectiveConfig, PerspectiveDisplayColumn } from 'dbgate-datalib';
import { PerspectiveDisplayColumn } from 'dbgate-datalib';
import type { ChangePerspectiveConfigFunc, PerspectiveConfig } from 'dbgate-datalib';
import _, { mapKeys } from 'lodash';
import DropDownButton from '../buttons/DropDownButton.svelte';

View File

@ -1,5 +1,6 @@
<script lang="ts">
import { ChangePerspectiveConfigFunc, PerspectiveConfig, PerspectiveTreeNode } from 'dbgate-datalib';
import type { ChangePerspectiveConfigFunc, PerspectiveConfig } from 'dbgate-datalib';
import { PerspectiveTreeNode } from 'dbgate-datalib';
import ColumnLabel from '../elements/ColumnLabel.svelte';
import { plusExpandIcon } from '../icons/expandIcons';

View File

@ -13,15 +13,14 @@
<script lang="ts">
import {
ChangePerspectiveConfigFunc,
PerspectiveConfig,
PerspectiveDisplay,
PerspectivePatternColumnNode,
PerspectiveTableColumnNode,
PerspectiveTreeNode,
PERSPECTIVE_PAGE_SIZE,
} from 'dbgate-datalib';
import _, { values } from 'lodash';
import type { ChangePerspectiveConfigFunc, PerspectiveConfig } from 'dbgate-datalib';
import _ from 'lodash';
import { onMount, tick } from 'svelte';
import resizeObserver from '../utility/resizeObserver';
import debug from 'debug';

View File

@ -1,11 +1,6 @@
<script lang="ts">
import {
ChangeConfigFunc,
ChangePerspectiveConfigFunc,
GridConfig,
PerspectiveConfig,
PerspectiveTreeNode,
} from 'dbgate-datalib';
import { PerspectiveTreeNode } from 'dbgate-datalib';
import type { ChangeConfigFunc, ChangePerspectiveConfigFunc, GridConfig, PerspectiveConfig } from 'dbgate-datalib';
import { filterName } from 'dbgate-tools';
import PerspectiveNodeRow from './PerspectiveNodeRow.svelte';

View File

@ -26,15 +26,14 @@
<script lang="ts">
import {
ChangePerspectiveConfigFunc,
extractPerspectiveDatabases,
PerspectiveConfig,
PerspectiveDataProvider,
PerspectiveTableNode,
PerspectiveTreeNode,
processPerspectiveDefaultColunns,
shouldProcessPerspectiveDefaultColunns,
} from 'dbgate-datalib';
import type { ChangePerspectiveConfigFunc, PerspectiveConfig } from 'dbgate-datalib';
import _ from 'lodash';
@ -48,7 +47,7 @@
import PerspectiveTable from './PerspectiveTable.svelte';
import { apiCall } from '../utility/api';
import ManagerInnerContainer from '../elements/ManagerInnerContainer.svelte';
import { PerspectiveDataLoader } from 'dbgate-datalib/lib/PerspectiveDataLoader';
import { PerspectiveDataLoader } from 'dbgate-datalib';
import stableStringify from 'json-stable-stringify';
import createActivator, { getActiveComponent } from '../utility/createActivator';
import registerCommand from '../commands/registerCommand';

View File

@ -1,4 +1,4 @@
import { ChangePerspectiveConfigFunc, PerspectiveConfig, PerspectiveTreeNode } from 'dbgate-datalib';
import type { ChangePerspectiveConfigFunc, PerspectiveConfig, PerspectiveTreeNode } from 'dbgate-datalib';
import _ from 'lodash';
import { showModal } from '../modals/modalTools';
import CustomJoinModal from './CustomJoinModal.svelte';

View File

@ -59,7 +59,7 @@
import { useInstalledPlugins } from '../utility/metadataLoaders';
import { buildFileFormats, buildQuickExports } from './fileformats';
import { buildThemes } from './themes';
import dbgateTools from 'dbgate-tools';
import * as dbgateTools from 'dbgate-tools';
import { apiCall } from '../utility/api';
let pluginsDict = {};

View File

@ -1,4 +1,4 @@
import { DictionaryDescription } from 'dbgate-datalib';
import type { DictionaryDescription } from 'dbgate-datalib';
import type { ApplicationDefinition, TableInfo } from 'dbgate-types';
import _ from 'lodash';
import { apiCall } from './api';

View File

@ -1,7 +1,7 @@
import _ from 'lodash';
import uuidv1 from 'uuid/v1';
import { get } from 'svelte/store';
import { getOpenedTabs, openedTabs, TabDefinition } from '../stores';
import { getOpenedTabs, openedTabs } from '../stores';
import tabs from '../tabs';
import { setSelectedTabFunc } from './common';
import localforage from 'localforage';

View File

@ -1,6 +1,7 @@
import { derived, Readable } from 'svelte/store';
import { derived } from 'svelte/store';
import type { Readable } from 'svelte/store';
import { useDatabaseInfo } from './metadataLoaders';
import { MultipleDatabaseInfo } from 'dbgate-datalib';
import type { MultipleDatabaseInfo } from 'dbgate-datalib';
export function useMultipleDatabaseInfo(dbs: { conid: string; database: string }[]): Readable<MultipleDatabaseInfo> {
return derived(

View File

@ -1,15 +1,14 @@
import {
analyseDataPattern,
import { analyseDataPattern, PerspectiveCache } from 'dbgate-datalib';
import type {
MultipleDatabaseInfo,
PerspectiveCache,
PerspectiveConfig,
PerspectiveDatabaseConfig,
PerspectiveDataLoadProps,
PerspectiveDataPattern,
PerspectiveDataPatternDict,
} from 'dbgate-datalib';
import { PerspectiveDataLoader } from 'dbgate-datalib/lib/PerspectiveDataLoader';
import { writable, Readable } from 'svelte/store';
import type { PerspectiveDataLoader } from 'dbgate-datalib/lib/PerspectiveDataLoader';
import { writable } from 'svelte/store';
import type { Readable } from 'svelte/store';
export function getPerspectiveDataPatternsFromCache(
databaseConfig: PerspectiveDatabaseConfig,