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 { getCommands, visibleCommandPalette } from '../stores';
import { GlobalCommand } from './registerCommand'; import type { GlobalCommand } from './registerCommand';
export default function runCommand(id) { export default function runCommand(id) {
const commandsValue = getCommands(); const commandsValue = getCommands();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,6 @@
<script lang="ts"> <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 { keys } from 'localforage';
import _, { map } from 'lodash'; import _, { map } from 'lodash';

View File

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

View File

@ -1,5 +1,6 @@
<script lang="ts"> <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 _, { mapKeys } from 'lodash';
import DropDownButton from '../buttons/DropDownButton.svelte'; import DropDownButton from '../buttons/DropDownButton.svelte';

View File

@ -1,5 +1,6 @@
<script lang="ts"> <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 ColumnLabel from '../elements/ColumnLabel.svelte';
import { plusExpandIcon } from '../icons/expandIcons'; import { plusExpandIcon } from '../icons/expandIcons';

View File

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

View File

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

View File

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

View File

@ -59,7 +59,7 @@
import { useInstalledPlugins } from '../utility/metadataLoaders'; import { useInstalledPlugins } from '../utility/metadataLoaders';
import { buildFileFormats, buildQuickExports } from './fileformats'; import { buildFileFormats, buildQuickExports } from './fileformats';
import { buildThemes } from './themes'; import { buildThemes } from './themes';
import dbgateTools from 'dbgate-tools'; import * as dbgateTools from 'dbgate-tools';
import { apiCall } from '../utility/api'; import { apiCall } from '../utility/api';
let pluginsDict = {}; 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 type { ApplicationDefinition, TableInfo } from 'dbgate-types';
import _ from 'lodash'; import _ from 'lodash';
import { apiCall } from './api'; import { apiCall } from './api';

View File

@ -1,7 +1,7 @@
import _ from 'lodash'; import _ from 'lodash';
import uuidv1 from 'uuid/v1'; import uuidv1 from 'uuid/v1';
import { get } from 'svelte/store'; import { get } from 'svelte/store';
import { getOpenedTabs, openedTabs, TabDefinition } from '../stores'; import { getOpenedTabs, openedTabs } from '../stores';
import tabs from '../tabs'; import tabs from '../tabs';
import { setSelectedTabFunc } from './common'; import { setSelectedTabFunc } from './common';
import localforage from 'localforage'; 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 { useDatabaseInfo } from './metadataLoaders';
import { MultipleDatabaseInfo } from 'dbgate-datalib'; import type { MultipleDatabaseInfo } from 'dbgate-datalib';
export function useMultipleDatabaseInfo(dbs: { conid: string; database: string }[]): Readable<MultipleDatabaseInfo> { export function useMultipleDatabaseInfo(dbs: { conid: string; database: string }[]): Readable<MultipleDatabaseInfo> {
return derived( return derived(

View File

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