@dineug/erd-editor 3.9.2 → 3.10.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/README.md +28 -9
- package/dist/components/erd/Erd.d.ts +1 -0
- package/dist/components/erd/canvas/relationship-group/relationship/Relationship.d.ts +2 -0
- package/dist/components/erd/canvas/relationship-group/relationship/RelationshipActionLabel.d.ts +32 -0
- package/dist/components/erd/canvas/table/cellLayout.d.ts +11 -0
- package/dist/components/erd/canvas/table/column/Column.d.ts +7 -0
- package/dist/components/erd/canvas/table/goToErd.d.ts +3 -10
- package/dist/components/erd/erd-context-menu/menus/relationshipMenus.d.ts +11 -0
- package/dist/components/erd/goToErdTarget.d.ts +85 -0
- package/dist/components/erd/table-properties/TableProperties.d.ts +2 -0
- package/dist/components/erd/table-properties/TableProperties.styles.d.ts +24 -2
- package/dist/components/erd/table-properties/table-properties-indexes/TablePropertiesIndexes.d.ts +2 -0
- package/dist/components/erd/table-properties/table-properties-indexes/TablePropertiesIndexes.styles.d.ts +32 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-checkbox-column/IndexesCheckboxColumn.d.ts +7 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-checkbox-column/IndexesCheckboxColumn.styles.d.ts +5 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-column/IndexesColumn.d.ts +7 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-column/IndexesColumn.styles.d.ts +3 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-index/IndexesIndex.d.ts +7 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-index/IndexesIndex.styles.d.ts +6 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-key/IndexesKey.d.ts +15 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-key/IndexesKey.styles.d.ts +13 -0
- package/dist/components/erd-editor/ErdEditor.d.ts +1 -1
- package/dist/components/find-replace/FindReplace.d.ts +13 -0
- package/dist/components/find-replace/FindReplace.styles.d.ts +27 -0
- package/dist/components/find-replace/fieldIcon.d.ts +5 -0
- package/dist/components/find-replace/matchTarget.d.ts +26 -0
- package/dist/components/find-replace/panelLayout.d.ts +17 -0
- package/dist/components/primitives/icon/icons.d.ts +10 -1
- package/dist/components/quick-search/QuickSearch.styles.d.ts +6 -0
- package/dist/components/quick-search/actions.d.ts +23 -0
- package/dist/components/quick-search/hangul.d.ts +73 -0
- package/dist/components/quick-search/paletteQuery.d.ts +37 -0
- package/dist/components/quick-search/scopedActions.d.ts +41 -0
- package/dist/components/visualization/table/column/Column.d.ts +4 -0
- package/dist/constants/layout.d.ts +13 -0
- package/dist/constants/open.d.ts +1 -0
- package/dist/constants/schema.d.ts +13 -0
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.js +20 -14
- package/dist/engine/modules/relationship/actions.d.ts +13 -0
- package/dist/engine/modules/relationship/atom.actions.d.ts +54 -0
- package/dist/engine/modules/relationship/fkColumns.d.ts +20 -3
- package/dist/engine/modules/relationship/generator.actions.d.ts +5 -2
- package/dist/engine/modules/relationship/history.d.ts +2 -0
- package/dist/engine/modules/relationship/hooks.d.ts +11 -0
- package/dist/engine/modules/table-column/hooks.d.ts +6 -0
- package/dist/engine/replication-store.d.ts +15 -1
- package/dist/engine/store-hooks.d.ts +8 -0
- package/dist/erd-editor.umd.js +1038 -481
- package/dist/index.js +7088 -5245
- package/dist/konva/scene/metrics.d.ts +5 -0
- package/dist/{store-hooks-DuzDVhPy.js → loadValue-Mdc5K4qO.js} +4001 -3425
- package/dist/peer/index.d.ts +1 -1
- package/dist/peer/index.js +64 -67
- package/dist/schemaGCService-CZtGFh2z.js +42 -0
- package/dist/services/schema-gc/schemaGCService.d.ts +5 -0
- package/dist/shared-store-D82WVL5a.js +1129 -0
- package/dist/utils/calcTable.d.ts +9 -1
- package/dist/utils/emitter.d.ts +13 -0
- package/dist/utils/find-replace/findMatches.d.ts +90 -0
- package/dist/utils/find-replace/index.d.ts +5 -0
- package/dist/utils/find-replace/matcher.d.ts +53 -0
- package/dist/utils/find-replace/present.d.ts +22 -0
- package/dist/utils/find-replace/replaceActions.d.ts +20 -0
- package/dist/utils/generator-code/utils.d.ts +12 -1
- package/dist/utils/keyboard-shortcut/index.d.ts +8 -1
- package/dist/utils/loadValue.d.ts +7 -0
- package/dist/utils/referentialAction.d.ts +21 -0
- package/dist/utils/schema-aml-parser/types.d.ts +6 -0
- package/dist/utils/schema-dbml-parser/types.d.ts +3 -0
- package/dist/utils/schema-sql/Databricks.d.ts +5 -0
- package/dist/utils/schema-sql/MSSQL.d.ts +5 -0
- package/dist/utils/schema-sql/MariaDB.d.ts +5 -0
- package/dist/utils/schema-sql/MySQL.d.ts +5 -0
- package/dist/utils/schema-sql/Oracle.d.ts +5 -0
- package/dist/utils/schema-sql/index.d.ts +5 -0
- package/dist/utils/schema-sql/utils.d.ts +19 -0
- package/dist/utils/schema-sql-parser/index.d.ts +5 -1
- package/dist/utils/table-clipboard/payload.d.ts +3 -0
- package/dist/utils/tableKeys.d.ts +46 -0
- package/dist/workers/elkLayout.shared-worker.js +1 -1
- package/dist/workers/exportPng.shared-worker.js +29 -27
- package/dist/workers/schemaGC.shared-worker.js +1 -1
- package/package.json +7 -6
- package/dist/schemaGCService-BagQ1wfF.js +0 -38
- package/dist/shared-store-BqPSXAEf.js +0 -1072
|
@@ -9,9 +9,17 @@ export declare function getWidthGeneration(): number;
|
|
|
9
9
|
* relationship-sort hook for any action that is not a pure move.
|
|
10
10
|
*/
|
|
11
11
|
export declare function invalidateTableWidths(): void;
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The room a row keeps for the table's alternate key marks after its last
|
|
14
|
+
* cell: the longest mark, or none while the marks are hidden or the table has
|
|
15
|
+
* none, so only a table that shows one widens.
|
|
16
|
+
*/
|
|
17
|
+
export declare function calcAlternateKeyWidth(table: Table, state: RootState): number;
|
|
18
|
+
export declare function calcTableWidths(table: Table, state: RootState): ColumnWidth;
|
|
13
19
|
export type ColumnWidth = {
|
|
14
20
|
width: number;
|
|
21
|
+
/** The alternate key marks' room after a row's last cell, 0 while none is drawn. */
|
|
22
|
+
alternateKey: number;
|
|
15
23
|
name: number;
|
|
16
24
|
comment: number;
|
|
17
25
|
dataType: number;
|
package/dist/utils/emitter.d.ts
CHANGED
|
@@ -3,6 +3,12 @@ import { TablePlacement } from '../constants/tablePlacement';
|
|
|
3
3
|
import { ValuesType } from '../internal-types';
|
|
4
4
|
import { ThemeOptions } from '../themes/radix-ui-theme';
|
|
5
5
|
import { GeometrySource } from './draw-relationship/geometrySource';
|
|
6
|
+
import { FindField } from './find-replace/findMatches';
|
|
7
|
+
/** A search the palette hands Find and Replace: the query, and the kinds of text it searches in. */
|
|
8
|
+
export type FindReplaceQuery = {
|
|
9
|
+
query: string;
|
|
10
|
+
fields: FindField[];
|
|
11
|
+
};
|
|
6
12
|
declare const InternalActionType: {
|
|
7
13
|
readonly openColorPicker: "openColorPicker";
|
|
8
14
|
readonly closeColorPicker: "closeColorPicker";
|
|
@@ -13,6 +19,7 @@ declare const InternalActionType: {
|
|
|
13
19
|
readonly paste: "paste";
|
|
14
20
|
readonly schemaGC: "schemaGC";
|
|
15
21
|
readonly toggleSearch: "toggleSearch";
|
|
22
|
+
readonly openFindReplace: "openFindReplace";
|
|
16
23
|
readonly openThemeBuilder: "openThemeBuilder";
|
|
17
24
|
readonly setThemeOptions: "setThemeOptions";
|
|
18
25
|
readonly mouseTrackerStart: "mouseTrackerStart";
|
|
@@ -46,6 +53,7 @@ type InternalActionMap = {
|
|
|
46
53
|
};
|
|
47
54
|
[InternalActionType.schemaGC]: void;
|
|
48
55
|
[InternalActionType.toggleSearch]: void;
|
|
56
|
+
[InternalActionType.openFindReplace]: FindReplaceQuery | void;
|
|
49
57
|
[InternalActionType.openThemeBuilder]: void;
|
|
50
58
|
[InternalActionType.setThemeOptions]: Partial<ThemeOptions>;
|
|
51
59
|
[InternalActionType.mouseTrackerStart]: void;
|
|
@@ -146,6 +154,11 @@ export declare const toggleSearchAction: {
|
|
|
146
154
|
toString(): string;
|
|
147
155
|
type: string;
|
|
148
156
|
};
|
|
157
|
+
export declare const openFindReplaceAction: {
|
|
158
|
+
(payload: void | FindReplaceQuery): AnyAction<void | FindReplaceQuery>;
|
|
159
|
+
toString(): string;
|
|
160
|
+
type: string;
|
|
161
|
+
};
|
|
149
162
|
export declare const openThemeBuilderAction: {
|
|
150
163
|
(payload: void): AnyAction<void>;
|
|
151
164
|
toString(): string;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { ActionType } from '../../engine/actions';
|
|
2
|
+
import { RootState } from '../../engine/state';
|
|
3
|
+
import { ValuesType } from '../../internal-types';
|
|
4
|
+
import { Matcher } from './matcher';
|
|
5
|
+
export declare const FindField: {
|
|
6
|
+
readonly tableName: "tableName";
|
|
7
|
+
readonly tableComment: "tableComment";
|
|
8
|
+
readonly columnName: "columnName";
|
|
9
|
+
readonly columnComment: "columnComment";
|
|
10
|
+
readonly memo: "memo";
|
|
11
|
+
};
|
|
12
|
+
export type FindField = ValuesType<typeof FindField>;
|
|
13
|
+
export declare const FindFieldList: ReadonlyArray<FindField>;
|
|
14
|
+
/**
|
|
15
|
+
* The kinds of text Find and Replace first opens on, the names of tables and
|
|
16
|
+
* columns alone (an owner decision): a comment or memo is prose a rename
|
|
17
|
+
* should not reach unasked. A search given no fields still reads every kind.
|
|
18
|
+
*/
|
|
19
|
+
export declare const DEFAULT_FIND_FIELDS: ReadonlyArray<FindField>;
|
|
20
|
+
export type FindMatch = {
|
|
21
|
+
field: FindField;
|
|
22
|
+
/** The entity holding the text: a table, a column or a memo. */
|
|
23
|
+
id: string;
|
|
24
|
+
/** The table of a table or column field; empty for a memo. */
|
|
25
|
+
tableId: string;
|
|
26
|
+
/** Where the field stands in the walk, so a match keeps its place when its text changes. */
|
|
27
|
+
slot: number;
|
|
28
|
+
text: string;
|
|
29
|
+
start: number;
|
|
30
|
+
end: number;
|
|
31
|
+
};
|
|
32
|
+
type Field = Omit<FindMatch, 'start' | 'end'>;
|
|
33
|
+
/**
|
|
34
|
+
* What changes a text the search reads, or which fields it walks: the actions
|
|
35
|
+
* a search on screen runs again on. A hover, a selection or a scroll changes
|
|
36
|
+
* none, and a slow pattern would stall the tab on every one of them.
|
|
37
|
+
*/
|
|
38
|
+
export declare const FindTextActionTypes: ReadonlyArray<ActionType>;
|
|
39
|
+
/**
|
|
40
|
+
* Every text field the fields given cover, in document order: each table's
|
|
41
|
+
* name and comment, then its columns' names and comments, then the memos.
|
|
42
|
+
* The walk reads the live id lists, since a removed entity keeps its record.
|
|
43
|
+
*/
|
|
44
|
+
export declare function walkFields({ doc, collections }: RootState, fields: ReadonlyArray<FindField>): Field[];
|
|
45
|
+
/**
|
|
46
|
+
* Every occurrence the matcher finds in the fields given, one entry each, in
|
|
47
|
+
* document order.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* findMatches(store.state, matcher, [FindField.columnName]);
|
|
51
|
+
*/
|
|
52
|
+
export declare function findMatches(state: RootState, matcher: Matcher, fields?: ReadonlyArray<FindField>): FindMatch[];
|
|
53
|
+
/**
|
|
54
|
+
* The matches as they will stand once the field a match was found in holds a
|
|
55
|
+
* new value, before the store has it: that field searched again in the value,
|
|
56
|
+
* every other one as it was, since no other text moves.
|
|
57
|
+
*/
|
|
58
|
+
export declare function rematchField(matches: ReadonlyArray<FindMatch>, matcher: Matcher, changed: FindMatch, value: string): FindMatch[];
|
|
59
|
+
/**
|
|
60
|
+
* The match a search goes on to once the text before a point has been dealt
|
|
61
|
+
* with: the first one past the offset in the slot given, or in a later slot,
|
|
62
|
+
* wrapping to the first. Minus one when there is none.
|
|
63
|
+
*/
|
|
64
|
+
export declare function indexAfter(matches: ReadonlyArray<FindMatch>, slot: number, offset: number): number;
|
|
65
|
+
/**
|
|
66
|
+
* Where a run of Replace presses began, and whether it has since gone past the
|
|
67
|
+
* last match to the first. Its field is known by entity, with the text the run
|
|
68
|
+
* left there, since a slot shifts and an undo or a peer may write over that text.
|
|
69
|
+
*/
|
|
70
|
+
export type ReplaceRun = Pick<FindMatch, 'field' | 'id' | 'slot' | 'start'> & {
|
|
71
|
+
text: string;
|
|
72
|
+
wrapped: boolean;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* A run as the document stands now, its field's slot found again, since a
|
|
76
|
+
* table added or removed before it moves that, or null once the field is gone
|
|
77
|
+
* or holds a text the run did not leave, after an undo or a peer's edit say.
|
|
78
|
+
*/
|
|
79
|
+
export declare function resumeRun(state: RootState, fields: ReadonlyArray<FindField>, run: ReplaceRun | null): ReplaceRun | null;
|
|
80
|
+
/**
|
|
81
|
+
* Where a Replace goes on to once it has written value in place of a match:
|
|
82
|
+
* the first match past what it wrote, wrapping to the first, or minus one once
|
|
83
|
+
* the run has wrapped and come back to where it began, which it would replace again.
|
|
84
|
+
*/
|
|
85
|
+
export declare function nextReplace(after: ReadonlyArray<FindMatch>, match: FindMatch, value: string, run: ReplaceRun | null): {
|
|
86
|
+
index: number;
|
|
87
|
+
run: ReplaceRun;
|
|
88
|
+
};
|
|
89
|
+
export {};
|
|
90
|
+
//# sourceMappingURL=findMatches.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type FindOptions = {
|
|
2
|
+
matchCase: boolean;
|
|
3
|
+
wholeWord: boolean;
|
|
4
|
+
regex: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type TextRange = {
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
};
|
|
10
|
+
export type Replaced = {
|
|
11
|
+
value: string;
|
|
12
|
+
/** The occurrences whose replacement differs from the text they matched. */
|
|
13
|
+
changed: number;
|
|
14
|
+
};
|
|
15
|
+
export type Matcher = {
|
|
16
|
+
/** Every occurrence in the text, in order. An empty match is never one. */
|
|
17
|
+
find: (text: string) => TextRange[];
|
|
18
|
+
/**
|
|
19
|
+
* The text with its occurrences replaced, or only the one starting at the
|
|
20
|
+
* offset given. A regular expression expands $1, $<name>, $& and $$ in the
|
|
21
|
+
* replacement; plain text is inserted as it is.
|
|
22
|
+
*/
|
|
23
|
+
replace: (text: string, replacement: string, onlyAt?: number) => Replaced;
|
|
24
|
+
};
|
|
25
|
+
export type MatcherResult = {
|
|
26
|
+
matcher: Matcher;
|
|
27
|
+
error: null;
|
|
28
|
+
} | {
|
|
29
|
+
matcher: null;
|
|
30
|
+
error: 'empty' | 'invalid';
|
|
31
|
+
};
|
|
32
|
+
export declare const DEFAULT_FIND_OPTIONS: FindOptions;
|
|
33
|
+
/**
|
|
34
|
+
* What a replacement template becomes for one match, by the rules of
|
|
35
|
+
* String.prototype.replace, which offers no way to expand a template for a
|
|
36
|
+
* match it is handed one at a time.
|
|
37
|
+
*/
|
|
38
|
+
export declare function expandReplacement(template: string, match: string, captures: Array<string | undefined>, position: number, subject: string, groups?: Record<string, string | undefined>): string;
|
|
39
|
+
/**
|
|
40
|
+
* A typed pattern spelled for unicode mode, read the way people type it: an
|
|
41
|
+
* escaped character other than a letter, a digit or a syntax character by its
|
|
42
|
+
* code point, and a stray ] or a brace no quantifier owns as itself.
|
|
43
|
+
*/
|
|
44
|
+
export declare function toUnicodeSource(source: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Builds the search a find and replace runs over every field, or says why
|
|
47
|
+
* there is none: nothing to look for, or a regular expression that does not parse.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* const { matcher } = createMatcher('user', { ...DEFAULT_FIND_OPTIONS, wholeWord: true });
|
|
51
|
+
*/
|
|
52
|
+
export declare function createMatcher(query: string, options: FindOptions): MatcherResult;
|
|
53
|
+
//# sourceMappingURL=matcher.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RootState } from '../../engine/state';
|
|
2
|
+
import { FindField, FindMatch } from './findMatches';
|
|
3
|
+
export declare const FindFieldLabel: Record<FindField, string>;
|
|
4
|
+
/**
|
|
5
|
+
* Where a match sits, as a reader finds it on the canvas: the table, or the
|
|
6
|
+
* table and column, and nothing for a memo, which has no name.
|
|
7
|
+
*/
|
|
8
|
+
export declare function locationOf({ collections }: RootState, { field, id, tableId }: FindMatch): string;
|
|
9
|
+
/** A result row's second line: where the match sits, then the kind of text it was found in. */
|
|
10
|
+
export declare function describeMatch(state: RootState, match: FindMatch): string;
|
|
11
|
+
export type Snippet = {
|
|
12
|
+
text: string;
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The part of a long text a result row has room for, on one line, with the
|
|
18
|
+
* match inside it: from the start of a word some way before it, then as much
|
|
19
|
+
* after as fits. The range given back is the match's place within the excerpt.
|
|
20
|
+
*/
|
|
21
|
+
export declare function snippetOf({ text, start, end }: Pick<FindMatch, 'text' | 'start' | 'end'>, before?: number, length?: number): Snippet;
|
|
22
|
+
//# sourceMappingURL=present.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AnyAction } from '@dineug/r-html';
|
|
2
|
+
import { FindMatch } from './findMatches';
|
|
3
|
+
import { Matcher } from './matcher';
|
|
4
|
+
/** The atom action that writes a new value into the field a match was found in. */
|
|
5
|
+
export declare function toFieldAction({ field, id, tableId }: Pick<FindMatch, 'field' | 'id' | 'tableId'>, value: string): AnyAction;
|
|
6
|
+
export type ReplaceActions = {
|
|
7
|
+
actions: AnyAction[];
|
|
8
|
+
/** The matches the replacement changed, leaving out one it wrote back as it was. */
|
|
9
|
+
replaced: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* One atom action per field whose text the replacement changes, for a single
|
|
13
|
+
* dispatch: one undo entry, and the same LWW writes a peer receives from an
|
|
14
|
+
* edit by hand. Given one match, only that occurrence is replaced.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* store.dispatchSync(toReplaceActions(matches, matcher, 'account_id').actions);
|
|
18
|
+
*/
|
|
19
|
+
export declare function toReplaceActions(matches: ReadonlyArray<FindMatch>, matcher: Matcher, replacement: string, only?: FindMatch): ReplaceActions;
|
|
20
|
+
//# sourceMappingURL=replaceActions.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DataTypeHint, PrimitiveType } from '../../constants/sql/dataType';
|
|
2
|
-
import { Column, Table } from '../../internal-types';
|
|
2
|
+
import { Column, Relationship, Table } from '../../internal-types';
|
|
3
|
+
import { ReferentialActionSupport } from '../schema-sql/utils';
|
|
3
4
|
export interface FormatTableOptions {
|
|
4
5
|
buffer: string[];
|
|
5
6
|
table: Table;
|
|
@@ -17,4 +18,14 @@ export declare const hasNRelationship: (value: number) => boolean;
|
|
|
17
18
|
export declare function getPrimitiveType(dataType: string, database: number): PrimitiveType;
|
|
18
19
|
export declare function getDataTypeHints(database: number): DataTypeHint[];
|
|
19
20
|
export declare function getNameCase(name: string, nameCase: number): string;
|
|
21
|
+
export type ReferentialActionEntry = {
|
|
22
|
+
key: 'onDelete' | 'onUpdate';
|
|
23
|
+
action: number;
|
|
24
|
+
sql: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The actions a relationship sets, ON DELETE first, each with its SQL spelling;
|
|
28
|
+
* with a support, only those the database's DDL would write too.
|
|
29
|
+
*/
|
|
30
|
+
export declare function referentialActionEntries({ onDelete, onUpdate }: Pick<Relationship, 'onDelete' | 'onUpdate'>, support?: ReferentialActionSupport): ReferentialActionEntry[];
|
|
20
31
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -9,6 +9,7 @@ export declare const KeyBindingName: {
|
|
|
9
9
|
readonly edit: "edit";
|
|
10
10
|
readonly stop: "stop";
|
|
11
11
|
readonly search: "search";
|
|
12
|
+
readonly findReplace: "findReplace";
|
|
12
13
|
readonly undo: "undo";
|
|
13
14
|
readonly redo: "redo";
|
|
14
15
|
readonly addTable: "addTable";
|
|
@@ -32,9 +33,15 @@ export declare const KeyBindingName: {
|
|
|
32
33
|
readonly zenMode: "zenMode";
|
|
33
34
|
};
|
|
34
35
|
export type KeyBindingName = ValuesType<typeof KeyBindingName>;
|
|
35
|
-
export declare const KeyBindingNameList: ("undo" | "redo" | "selectAllColumn" | "search" | "stop" | "edit" | "addMemo" | "addTable" | "removeTable" | "addColumn" | "removeColumn" | "
|
|
36
|
+
export declare const KeyBindingNameList: ("undo" | "redo" | "selectAllColumn" | "search" | "stop" | "primaryKey" | "edit" | "addMemo" | "addTable" | "removeTable" | "addColumn" | "removeColumn" | "findReplace" | "selectAllTable" | "relationshipZeroOne" | "relationshipZeroN" | "relationshipOneOnly" | "relationshipOneN" | "tableProperties" | "focusView" | "zoomIn" | "zoomOut" | "zoomReset" | "handTool" | "zenMode")[];
|
|
36
37
|
export type KeyBindingMap = Record<KeyBindingName, ShortcutOption[]>;
|
|
37
38
|
export declare const createKeyBindingMap: () => KeyBindingMap;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the press is one of the chords given, read the way tinykeys reads a
|
|
41
|
+
* binding: the key by its code or its value, every modifier named held down and
|
|
42
|
+
* no other. A sequence of presses never matches a single one.
|
|
43
|
+
*/
|
|
44
|
+
export declare function matchesShortcut(event: KeyboardEvent, options: ReadonlyArray<ShortcutOption>): boolean;
|
|
38
45
|
export declare function shortcutToTuple(shortcut?: string): KeyBindingPress[];
|
|
39
46
|
export declare function isMod(event: MouseEvent | TouchEvent | KeyboardEvent): boolean;
|
|
40
47
|
/**
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text a load parses, trimmed. An empty one, a new file's, is a document
|
|
3
|
+
* created from nothing, written out in full so every peer replaying the load
|
|
4
|
+
* reads that document, a released one included, which cannot parse nothing.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toLoadValue(value: unknown): string;
|
|
7
|
+
//# sourceMappingURL=loadValue.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The action a source spells as SQL does, in any case, with a space or an
|
|
3
|
+
* underscore between words: CASCADE, set null, no_action. Anything else is none.
|
|
4
|
+
*/
|
|
5
|
+
export declare function toReferentialAction(spelling: string): number;
|
|
6
|
+
type ReferentialActions = {
|
|
7
|
+
onDelete: number;
|
|
8
|
+
onUpdate: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* What a connector shows at its child end: D: for ON DELETE, then U: for ON
|
|
12
|
+
* UPDATE, each only when set, so a relationship that sets neither shows none.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* referentialActionLabel({ onDelete: cascade, onUpdate: restrict }); // 'D:C U:R'
|
|
16
|
+
*/
|
|
17
|
+
export declare function referentialActionLabel({ onDelete, onUpdate, }: ReferentialActions): string;
|
|
18
|
+
/** The clauses the label stands for, one to a line, as a hover spells them out. */
|
|
19
|
+
export declare function referentialActionTitle({ onDelete, onUpdate, }: ReferentialActions): string;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=referentialAction.d.ts.map
|
|
@@ -23,6 +23,12 @@ export type AMLRelation = {
|
|
|
23
23
|
refCardinality: AMLCardinality;
|
|
24
24
|
/** -item_kind=User>; the discriminator has no editor slot and is dropped. */
|
|
25
25
|
polymorphic: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* A standalone rel's onDelete and onUpdate properties as written, set null
|
|
28
|
+
* say; '' otherwise, since an inline relation's properties are its attribute's.
|
|
29
|
+
*/
|
|
30
|
+
onDelete: string;
|
|
31
|
+
onUpdate: string;
|
|
26
32
|
};
|
|
27
33
|
/**
|
|
28
34
|
* One unique / unique=name / index / index=name constraint. A bare
|
|
@@ -45,6 +45,9 @@ export type DBMLRef = {
|
|
|
45
45
|
operator: string;
|
|
46
46
|
left: DBMLEndpoint;
|
|
47
47
|
right: DBMLEndpoint;
|
|
48
|
+
/** The delete and update settings as written, set null say; '' if absent. */
|
|
49
|
+
onDelete: string;
|
|
50
|
+
onUpdate: string;
|
|
48
51
|
};
|
|
49
52
|
export type DBMLModel = {
|
|
50
53
|
tables: DBMLTable[];
|
|
@@ -2,5 +2,10 @@ import { RootState } from '../../engine/state';
|
|
|
2
2
|
import { FormatIndexOptions, FormatTableOptions } from './utils';
|
|
3
3
|
export declare function createSchema(state: RootState): string;
|
|
4
4
|
export declare function formatTable(state: RootState, { buffer, table }: FormatTableOptions): void;
|
|
5
|
+
/**
|
|
6
|
+
* A comment per column the diagram marks unique, after the table: UNIQUE is not
|
|
7
|
+
* one of the constraints Databricks accepts, so it is reported, never dropped.
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatUnique({ collections }: RootState, { buffer, table }: FormatTableOptions): void;
|
|
5
10
|
export declare function formatIndex({ collections }: RootState, { buffer, index, indexNames }: FormatIndexOptions): void;
|
|
6
11
|
//# sourceMappingURL=Databricks.d.ts.map
|
|
@@ -2,5 +2,10 @@ import { RootState } from '../../engine/state';
|
|
|
2
2
|
import { FormatIndexOptions, FormatTableOptions } from './utils';
|
|
3
3
|
export declare function createSchema(state: RootState): string;
|
|
4
4
|
export declare function formatTable(state: RootState, { buffer, table }: FormatTableOptions): void;
|
|
5
|
+
/**
|
|
6
|
+
* One named constraint per column the diagram marks unique, after the table.
|
|
7
|
+
* The whole export and the per-table Schema SQL tab both write it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatUnique({ settings: { bracketType }, collections }: RootState, { buffer, table }: FormatTableOptions): void;
|
|
5
10
|
export declare function formatIndex({ settings: { bracketType }, collections }: RootState, { buffer, index, indexNames }: FormatIndexOptions): void;
|
|
6
11
|
//# sourceMappingURL=MSSQL.d.ts.map
|
|
@@ -2,5 +2,10 @@ import { RootState } from '../../engine/state';
|
|
|
2
2
|
import { FormatIndexOptions, FormatTableOptions } from './utils';
|
|
3
3
|
export declare function createSchema(state: RootState): string;
|
|
4
4
|
export declare function formatTable(state: RootState, { buffer, table }: FormatTableOptions): void;
|
|
5
|
+
/**
|
|
6
|
+
* One named constraint per column the diagram marks unique, after the table.
|
|
7
|
+
* The whole export and the per-table Schema SQL tab both write it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatUnique({ settings: { bracketType }, collections }: RootState, { buffer, table }: FormatTableOptions): void;
|
|
5
10
|
export declare function formatIndex({ settings: { bracketType }, collections }: RootState, { buffer, index, indexNames }: FormatIndexOptions): void;
|
|
6
11
|
//# sourceMappingURL=MariaDB.d.ts.map
|
|
@@ -2,5 +2,10 @@ import { RootState } from '../../engine/state';
|
|
|
2
2
|
import { FormatIndexOptions, FormatTableOptions } from './utils';
|
|
3
3
|
export declare function createSchema(state: RootState): string;
|
|
4
4
|
export declare function formatTable(state: RootState, { buffer, table }: FormatTableOptions): void;
|
|
5
|
+
/**
|
|
6
|
+
* One named constraint per column the diagram marks unique, after the table.
|
|
7
|
+
* The whole export and the per-table Schema SQL tab both write it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatUnique({ settings: { bracketType }, collections }: RootState, { buffer, table }: FormatTableOptions): void;
|
|
5
10
|
export declare function formatIndex({ settings: { bracketType }, collections }: RootState, { buffer, index, indexNames }: FormatIndexOptions): void;
|
|
6
11
|
//# sourceMappingURL=MySQL.d.ts.map
|
|
@@ -2,5 +2,10 @@ import { RootState } from '../../engine/state';
|
|
|
2
2
|
import { FormatIndexOptions, FormatTableOptions } from './utils';
|
|
3
3
|
export declare function createSchema(state: RootState): string;
|
|
4
4
|
export declare function formatTable(state: RootState, { buffer, table }: FormatTableOptions): void;
|
|
5
|
+
/**
|
|
6
|
+
* One named constraint per column the diagram marks unique, after the table.
|
|
7
|
+
* The whole export and the per-table Schema SQL tab both write it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatUnique({ settings: { bracketType }, collections }: RootState, { buffer, table }: FormatTableOptions): void;
|
|
5
10
|
export declare function formatIndex({ settings: { bracketType }, collections }: RootState, { buffer, index, indexNames }: FormatIndexOptions): void;
|
|
6
11
|
//# sourceMappingURL=Oracle.d.ts.map
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { RootState } from '../../engine/state';
|
|
2
2
|
import { Table } from '../../internal-types';
|
|
3
3
|
export declare function createSchemaSQL(state: RootState, database?: number): string;
|
|
4
|
+
/**
|
|
5
|
+
* One table's DDL for the table properties Schema SQL tab: the table, the
|
|
6
|
+
* uniqueness its columns carry where the whole export writes it as its own
|
|
7
|
+
* statement, and the table's indexes.
|
|
8
|
+
*/
|
|
4
9
|
export declare function createSchemaSQLTable(state: RootState, table: Table): string;
|
|
5
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -53,4 +53,23 @@ export declare function autoName<T extends {
|
|
|
53
53
|
name: string;
|
|
54
54
|
}>(list: T[], id: string, name: string, num?: number): string;
|
|
55
55
|
export declare function toOrderName(orderType: number): "" | "ASC" | "DESC";
|
|
56
|
+
/** The actions a vendor accepts after ON DELETE and after ON UPDATE. */
|
|
57
|
+
export type ReferentialActionSupport = {
|
|
58
|
+
onDelete: ReadonlyArray<number>;
|
|
59
|
+
onUpdate: ReadonlyArray<number>;
|
|
60
|
+
};
|
|
61
|
+
export declare const ALL_REFERENTIAL_ACTIONS: ReferentialActionSupport;
|
|
62
|
+
/** Every action but the ones a vendor refuses, on both events. */
|
|
63
|
+
export declare function withoutReferentialAction(...refused: number[]): ReferentialActionSupport;
|
|
64
|
+
/**
|
|
65
|
+
* The actions the DDL of a database writes, which the code generators and the
|
|
66
|
+
* relationship menu follow too; an unknown database takes every one.
|
|
67
|
+
*/
|
|
68
|
+
export declare function referentialActionSupport(database: number): ReferentialActionSupport;
|
|
69
|
+
/**
|
|
70
|
+
* ON DELETE, then ON UPDATE, each where the relationship sets one the vendor
|
|
71
|
+
* accepts; an action it would refuse is left out, so the default applies.
|
|
72
|
+
*/
|
|
73
|
+
export declare function formatReferentialActions({ onDelete, onUpdate }: Pick<Relationship, 'onDelete' | 'onUpdate'>, support: ReferentialActionSupport): string[];
|
|
74
|
+
export declare function toStringLiteral(value: string): string;
|
|
56
75
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ERDEditorSchemaV3 } from '@dineug/erd-editor-schema';
|
|
2
2
|
import { EngineContext } from '../../engine/context';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The SQL as a document. The document's database, when given, names the vendor
|
|
5
|
+
* to the parser: a Databricks one reads string literals by Spark's escapes.
|
|
6
|
+
*/
|
|
7
|
+
export declare function schemaSQLParserToSchemaJson(sql: string, ctx: EngineContext, prepare?: (schema: ERDEditorSchemaV3) => ERDEditorSchemaV3, database?: number): string;
|
|
4
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -58,6 +58,9 @@ export type ClipboardRelationshipPoint = {
|
|
|
58
58
|
};
|
|
59
59
|
export type ClipboardRelationship = {
|
|
60
60
|
relationshipType: number;
|
|
61
|
+
/** Absent from a copy an editor made before the referential actions. */
|
|
62
|
+
onDelete?: number;
|
|
63
|
+
onUpdate?: number;
|
|
61
64
|
start: ClipboardRelationshipPoint;
|
|
62
65
|
end: ClipboardRelationshipPoint;
|
|
63
66
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { RootState } from '../engine/state';
|
|
2
|
+
import { Table } from '../internal-types';
|
|
3
|
+
type KeyState = Pick<RootState, 'doc' | 'collections'>;
|
|
4
|
+
export declare function invalidateTableIndexes(): void;
|
|
5
|
+
/**
|
|
6
|
+
* The ids of the table's indexes in list order, from a grouping of the whole
|
|
7
|
+
* list built once per add or drop, so measuring every table reads the list once
|
|
8
|
+
* rather than once a table. An observer still re-runs on each add and drop.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getTableIndexIds({ doc, collections }: KeyState, tableId: string): string[];
|
|
11
|
+
/**
|
|
12
|
+
* A key the table's columns declare rather than an index entity: the primary
|
|
13
|
+
* key over the columns marked PK, or one column marked UQ. The name is the one
|
|
14
|
+
* the DDL gives it where a vendor writes a name.
|
|
15
|
+
*/
|
|
16
|
+
export type ColumnKey = {
|
|
17
|
+
id: string;
|
|
18
|
+
kind: 'primaryKey' | 'unique';
|
|
19
|
+
name: string;
|
|
20
|
+
columnIds: string[];
|
|
21
|
+
};
|
|
22
|
+
/** One alternate key: a unique index of the table and the columns it keys, in key order. */
|
|
23
|
+
export type AlternateKey = {
|
|
24
|
+
indexId: string;
|
|
25
|
+
columnIds: string[];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The keys a table's columns declare, primary key first and then each unique
|
|
29
|
+
* column in column order. Only the columns edit them, so a list showing them
|
|
30
|
+
* beside the index entities shows them read only.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getColumnKeys({ collections }: KeyState, table: Table): ColumnKey[];
|
|
33
|
+
/**
|
|
34
|
+
* The table's alternate keys, AK1 first: its unique indexes over two or more
|
|
35
|
+
* of its columns, ordered by where those columns stand in the table. Neither
|
|
36
|
+
* an undo nor a peer's concurrent add reorders them, as the index list would.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getAlternateKeys(state: KeyState, table: Table): AlternateKey[];
|
|
39
|
+
/**
|
|
40
|
+
* What each column in those keys is marked with, AK1.2 for the second column
|
|
41
|
+
* of the first key; a column in several keys carries each mark, comma joined.
|
|
42
|
+
* A column in none has no entry.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getAlternateKeyMarks(state: KeyState, table: Table): Record<string, string>;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=tableKeys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"comlink";typeof document>`u`&&Reflect.set(globalThis,`document`,{});const t={force:`force`,layeredHorizontal:`layeredHorizontal`,layeredVertical:`layeredVertical`,flow:`flow`,viewLayered:`viewLayered`};t.force;function n(e){return e!==t.force}function r(e){return e===t.flow}const i={"elk.algorithm":`layered`,"elk.layered.spacing.baseValue":`40`,"elk.spacing.componentComponent":`80`,"elk.layered.spacing.edgeNodeBetweenLayers":`120`,"elk.layered.considerModelOrder.strategy":`PREFER_EDGES`,"elk.layered.crossingMinimization.forceNodeModelOrder":`true`,"elk.layered.mergeEdges":`true`,"elk.layered.nodePlacement.strategy":`INTERACTIVE`,"elk.layered.layering.strategy":`INTERACTIVE`},a={"elk.alignment":`LEFT`},o={"elk.aspectRatio":`0.5625`},s={"elk.spacing.nodeNode":`80`,"elk.separateConnectedComponents":`true`,"elk.spacing.componentComponent":`160`},c=e=>({...s,"elk.algorithm":`layered`,"elk.direction":e,"elk.layered.spacing.nodeNodeBetweenLayers":`160`,"elk.layered.cycleBreaking.strategy":`DEPTH_FIRST`});function l(e){switch(e){case t.layeredHorizontal:return c(`RIGHT`);case t.layeredVertical:return c(`DOWN`);case t.flow:return{...c(`RIGHT`),"elk.layered.nodePlacement.strategy":`SIMPLE`,"elk.layered.spacing.edgeNodeBetweenLayers":`80`};case t.viewLayered:return{...i}}}function u(e){return e===t.viewLayered?{...a}:null}const d=[...new Set(Object.values(t).filter(n).map(e=>l(e)[`elk.algorithm`]))],f=`EAST`,p=e=>`edge-${e}-source`,m=e=>`edge-${e}-target`;function h(e,t){return e.side===t.side?e.side===f?e.row-t.row:t.row-e.row:e.side===f?-1:1}function g(e){let t
|
|
1
|
+
import*as e from"comlink";typeof document>`u`&&Reflect.set(globalThis,`document`,{});const t={force:`force`,layeredHorizontal:`layeredHorizontal`,layeredVertical:`layeredVertical`,flow:`flow`,viewLayered:`viewLayered`};t.force;function n(e){return e!==t.force}function r(e){return e===t.flow}const i={"elk.algorithm":`layered`,"elk.layered.spacing.baseValue":`40`,"elk.spacing.componentComponent":`80`,"elk.layered.spacing.edgeNodeBetweenLayers":`120`,"elk.layered.considerModelOrder.strategy":`PREFER_EDGES`,"elk.layered.crossingMinimization.forceNodeModelOrder":`true`,"elk.layered.mergeEdges":`true`,"elk.layered.nodePlacement.strategy":`INTERACTIVE`,"elk.layered.layering.strategy":`INTERACTIVE`},a={"elk.alignment":`LEFT`},o={"elk.aspectRatio":`0.5625`},s={"elk.spacing.nodeNode":`80`,"elk.separateConnectedComponents":`true`,"elk.spacing.componentComponent":`160`},c=e=>({...s,"elk.algorithm":`layered`,"elk.direction":e,"elk.layered.spacing.nodeNodeBetweenLayers":`160`,"elk.layered.cycleBreaking.strategy":`DEPTH_FIRST`});function l(e){switch(e){case t.layeredHorizontal:return c(`RIGHT`);case t.layeredVertical:return c(`DOWN`);case t.flow:return{...c(`RIGHT`),"elk.layered.nodePlacement.strategy":`SIMPLE`,"elk.layered.spacing.edgeNodeBetweenLayers":`80`};case t.viewLayered:return{...i}}}function u(e){return e===t.viewLayered?{...a}:null}const d=[...new Set(Object.values(t).filter(n).map(e=>l(e)[`elk.algorithm`]))],f=`EAST`,p=e=>`edge-${e}-source`,m=e=>`edge-${e}-target`;function h(e,t){return e.side===t.side?e.side===f?e.row-t.row:t.row-e.row:e.side===f?-1:1}function g(e){let t=/* @__PURE__ */ new Map,n=(e,n)=>{let r=t.get(e);r?r.push(n):t.set(e,[n])};return e.forEach((e,t)=>{n(e.source,{id:p(t),row:e.sourceRow,side:f}),n(e.target,{id:m(t),row:e.targetRow,side:`WEST`})}),new Map([...t].map(([e,t])=>[e,t.sort(h).map(({id:e,side:t})=>({id:e,width:8,height:8,layoutOptions:{"elk.port.side":t}}))]))}function _({placement:e,nodes:t,edges:n}){let i=r(e)?g(n):null;return{id:`root`,layoutOptions:l(e),children:t.map(t=>v(t,e,i)),edges:n.map(({source:e,target:t},n)=>({id:`edge-${n}`,sources:[i?p(n):e],targets:[i?m(n):t]}))}}function v({id:e,width:t,height:n,x:r,y:i,children:a},s,c){if(a?.length)return{id:e,width:t,height:n,layoutOptions:{...o},children:a.map(e=>v(e,s,c))};let l={...u(s),...c?{"elk.portConstraints":`FIXED_ORDER`}:{}};return{id:e,width:t,height:n,...r===void 0?{}:{x:r},...i===void 0?{}:{y:i},...Object.keys(l).length?{layoutOptions:l}:{},...c?{ports:c.get(e)??[]}:{}}}function y(e,t,n){return e.flatMap(({id:e,x:r,y:i,children:a})=>{let o=t+(r??0),s=n+(i??0);return a?.length?y(a,o,s):[{id:e,x:o,y:s}]})}let b=null;function x(){return b??=import(`elkjs/lib/elk.bundled.js`).then(({default:e})=>new e({algorithms:d})),b}const S=new class{async ready(){return await x(),!0}async layout(e){return y((await(await x()).layout(_(e))).children??[],0,0)}};self.onconnect=t=>{let n=t.ports[0];e.expose(S,n)};
|