@metadev/daga 4.0.1 → 4.1.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/Changelog.md +25 -0
- package/index.cjs.js +478 -194
- package/index.esm.js +478 -194
- package/package.json +1 -1
- package/src/index.d.ts +8 -5
- package/src/lib/diagram/canvas/diagram-canvas-util.d.ts +10 -0
- package/src/lib/diagram/canvas/diagram-canvas.d.ts +4 -1
- package/src/lib/diagram/canvas/diagram-user-selection.d.ts +1 -1
- package/src/lib/diagram/collab/collab-action.d.ts +32 -2
- package/src/lib/diagram/config/diagram-canvas-config.d.ts +6 -0
- package/src/lib/diagram/config/diagram-components-config.d.ts +249 -0
- package/src/lib/diagram/config/diagram-config.d.ts +33 -248
- package/src/lib/diagram/diagram-action.d.ts +23 -0
- package/src/lib/diagram/layout/adjacency-layout.d.ts +2 -0
- package/src/lib/diagram/layout/breadth-adjacency-layout.d.ts +2 -0
- package/src/lib/diagram/layout/breadth-layout.d.ts +2 -0
- package/src/lib/diagram/layout/force-layout.d.ts +2 -0
- package/src/lib/diagram/layout/horizontal-layout.d.ts +2 -0
- package/src/lib/diagram/layout/priority-layout.d.ts +2 -0
- package/src/lib/diagram/layout/tree-layout.d.ts +2 -0
- package/src/lib/diagram/layout/vertical-layout.d.ts +2 -0
- package/src/lib/diagram/model/diagram-connection.d.ts +2 -1
- package/src/lib/diagram/model/diagram-model.d.ts +2 -1
- package/src/lib/diagram/model/diagram-node.d.ts +25 -2
- package/src/lib/diagram/property/property-util.d.ts +61 -0
- package/src/lib/diagram/property/property.d.ts +146 -0
- package/src/lib/diagram/property/value.d.ts +163 -0
- package/src/lib/interfaces/canvas.d.ts +14 -1
- package/src/lib/interfaces/property-editor.d.ts +1 -1
- package/src/lib/diagram/model/diagram-property.d.ts +0 -368
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Point } from '../../util/canvas-util';
|
|
2
|
-
import {
|
|
2
|
+
import { HorizontalAlign, Side, VerticalAlign } from '../../util/svg-util';
|
|
3
3
|
import { DiagramActions } from '../diagram-action';
|
|
4
|
-
import { Property } from '../
|
|
4
|
+
import { Property } from '../property/property';
|
|
5
5
|
import { CanvasConfig } from './diagram-canvas-config';
|
|
6
|
+
import { ComponentsConfig } from './diagram-components-config';
|
|
6
7
|
import { ConnectionLookConfig, ImageLookConfig, MarkerImageLookConfig, ShapedLookConfig, StretchableImageLookConfig } from './diagram-look-config';
|
|
7
8
|
/**
|
|
8
9
|
* The configuration for a diagram.
|
|
@@ -94,252 +95,6 @@ export interface DiagramConfig {
|
|
|
94
95
|
export type UserActionConfig = {
|
|
95
96
|
[key in DiagramActions]?: boolean;
|
|
96
97
|
};
|
|
97
|
-
/**
|
|
98
|
-
* Configuration for the components of the diagram.
|
|
99
|
-
* @public
|
|
100
|
-
*/
|
|
101
|
-
export type ComponentsConfig = {
|
|
102
|
-
/**
|
|
103
|
-
* Configuration for the buttons component in the diagram.
|
|
104
|
-
* If left undefined, it is interpreted as disabling the buttons component,
|
|
105
|
-
* same as if the attribute `enabled` in its configuration was set to `false`.
|
|
106
|
-
*/
|
|
107
|
-
buttons?: ButtonsComponentConfig;
|
|
108
|
-
/**
|
|
109
|
-
* Configuration for the errors component in the diagram.
|
|
110
|
-
* If left undefined, it is interpreted as disabling the errors component,
|
|
111
|
-
* same as if the attribute `enabled` in its configuration was set to `false`.
|
|
112
|
-
*/
|
|
113
|
-
errors?: ErrorsComponentConfig;
|
|
114
|
-
/**
|
|
115
|
-
* Configuration for the palette component in the diagram.
|
|
116
|
-
* If left undefined, it is interpreted as disabling the palette component,
|
|
117
|
-
* same as if the attribute `enabled` in its configuration was set to `false`.
|
|
118
|
-
*/
|
|
119
|
-
palette?: PaletteComponentConfig;
|
|
120
|
-
/**
|
|
121
|
-
* Configuration for the property editor component in the diagram.
|
|
122
|
-
* If left undefined, it is interpreted as disabling the property editor component,
|
|
123
|
-
* same as if the attribute `enabled` in its configuration was set to `false`.
|
|
124
|
-
*/
|
|
125
|
-
propertyEditor?: PropertyEditorComponentConfig;
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* Configuration for the buttons component in a diagram.
|
|
129
|
-
* @public
|
|
130
|
-
* @see DiagramButtonsComponent
|
|
131
|
-
*/
|
|
132
|
-
export interface ButtonsComponentConfig {
|
|
133
|
-
/**
|
|
134
|
-
* Whether this component is present in the diagram.
|
|
135
|
-
* @default true
|
|
136
|
-
*/
|
|
137
|
-
enabled?: boolean;
|
|
138
|
-
/**
|
|
139
|
-
* Location of this component in the screen.
|
|
140
|
-
* @default 'bottom-right'
|
|
141
|
-
*/
|
|
142
|
-
location?: Corner;
|
|
143
|
-
/**
|
|
144
|
-
* Direction that this component extends towards.
|
|
145
|
-
* @default 'top'
|
|
146
|
-
*/
|
|
147
|
-
direction?: Side;
|
|
148
|
-
/**
|
|
149
|
-
* Whether to enable the user action (undo, redo) buttons in this component.
|
|
150
|
-
* @default true
|
|
151
|
-
*/
|
|
152
|
-
enableAction?: boolean;
|
|
153
|
-
/**
|
|
154
|
-
* Whether to enable the filter button in this component.
|
|
155
|
-
* @default false
|
|
156
|
-
*/
|
|
157
|
-
enableFilter?: boolean;
|
|
158
|
-
/**
|
|
159
|
-
* Whether to enable the layout button in this component.
|
|
160
|
-
* @default false
|
|
161
|
-
*/
|
|
162
|
-
enableLayout?: boolean;
|
|
163
|
-
/**
|
|
164
|
-
* Whether to enable the user selection (copy, paste, cut, delete) buttons in this component.
|
|
165
|
-
* @default true
|
|
166
|
-
*/
|
|
167
|
-
enableSelection?: boolean;
|
|
168
|
-
/**
|
|
169
|
-
* Whether to enable the zoom buttons in this component.
|
|
170
|
-
* @default true
|
|
171
|
-
*/
|
|
172
|
-
enableZoom?: boolean;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Configuration for the errors component in a diagram.
|
|
176
|
-
* @public
|
|
177
|
-
* @see ErrorsComponent
|
|
178
|
-
*/
|
|
179
|
-
export interface ErrorsComponentConfig {
|
|
180
|
-
/**
|
|
181
|
-
* Whether this component is present in the diagram.
|
|
182
|
-
* @default true
|
|
183
|
-
*/
|
|
184
|
-
enabled?: boolean;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Configuration for the palette component in a diagram.
|
|
188
|
-
* @public
|
|
189
|
-
* @see PaletteComponent
|
|
190
|
-
*/
|
|
191
|
-
export interface PaletteComponentConfig {
|
|
192
|
-
/**
|
|
193
|
-
* Whether this component is present in the diagram.
|
|
194
|
-
* @default true
|
|
195
|
-
*/
|
|
196
|
-
enabled?: boolean;
|
|
197
|
-
/**
|
|
198
|
-
* Location of this component in the screen.
|
|
199
|
-
* @default 'top-left'
|
|
200
|
-
*/
|
|
201
|
-
location?: Corner;
|
|
202
|
-
/**
|
|
203
|
-
* Direction that this component extends towards.
|
|
204
|
-
* @default 'bottom'
|
|
205
|
-
*/
|
|
206
|
-
direction?: Side;
|
|
207
|
-
/**
|
|
208
|
-
* Dimension of this component in the direction perpendicular to the direction that it extends towards.
|
|
209
|
-
* @default '12rem'
|
|
210
|
-
*/
|
|
211
|
-
width?: string;
|
|
212
|
-
/**
|
|
213
|
-
* Gap between the templates in this palette.
|
|
214
|
-
* @default '1rem'
|
|
215
|
-
*/
|
|
216
|
-
gap?: string;
|
|
217
|
-
/**
|
|
218
|
-
* Configuration for the sections of this palette. By default, no sections are created.
|
|
219
|
-
* @default undefined
|
|
220
|
-
*/
|
|
221
|
-
sections?: PaletteSectionConfig[];
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Configuration for the property editor component in a diagram.
|
|
225
|
-
* @public
|
|
226
|
-
* @see PropertyEditorComponent
|
|
227
|
-
*/
|
|
228
|
-
export interface PropertyEditorComponentConfig {
|
|
229
|
-
/**
|
|
230
|
-
* Whether this component is present in the diagram.
|
|
231
|
-
* @default true
|
|
232
|
-
*/
|
|
233
|
-
enabled?: boolean;
|
|
234
|
-
/**
|
|
235
|
-
* Location of this component in the screen.
|
|
236
|
-
* @default 'top-right'
|
|
237
|
-
*/
|
|
238
|
-
location?: Corner;
|
|
239
|
-
/**
|
|
240
|
-
* Direction that this component extends towards.
|
|
241
|
-
* @default 'bottom'
|
|
242
|
-
*/
|
|
243
|
-
direction?: Side;
|
|
244
|
-
/**
|
|
245
|
-
* Dimension of this component in the direction perpendicular to the direction that it extends towards.
|
|
246
|
-
* @default '24rem'
|
|
247
|
-
*/
|
|
248
|
-
width?: string;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Configuration for a palette.
|
|
252
|
-
* @public
|
|
253
|
-
* @see PaletteComponent
|
|
254
|
-
*/
|
|
255
|
-
export interface PaletteSectionConfig {
|
|
256
|
-
/**
|
|
257
|
-
* Name of this palette. Displayed in the tab of this palette in the palette component. Can be left undefined if this is the only palette.
|
|
258
|
-
*/
|
|
259
|
-
name?: string;
|
|
260
|
-
/**
|
|
261
|
-
* Categories of this palette. Used to enable displaying one of different categories of templates as defined here. Can be left undefined if there are no categories.
|
|
262
|
-
*/
|
|
263
|
-
categories?: {
|
|
264
|
-
[key: string]: (NodeTemplateConfig | ConnectionTemplateConfig)[];
|
|
265
|
-
};
|
|
266
|
-
/**
|
|
267
|
-
* List of templates that are always displayed in this palette. Can be left undefined.
|
|
268
|
-
*/
|
|
269
|
-
templates?: (NodeTemplateConfig | ConnectionTemplateConfig)[];
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Configuration for a template of a node in a palette.
|
|
273
|
-
* @public
|
|
274
|
-
* @see PaletteComponent
|
|
275
|
-
*/
|
|
276
|
-
export interface NodeTemplateConfig {
|
|
277
|
-
/**
|
|
278
|
-
* String used to indicate that this is a template of a node.
|
|
279
|
-
*/
|
|
280
|
-
templateType: 'node';
|
|
281
|
-
/**
|
|
282
|
-
* Id of the type of node of this template. Must correspond to the id of a type of node defined in the nodeTypes list.
|
|
283
|
-
*/
|
|
284
|
-
type: string;
|
|
285
|
-
/**
|
|
286
|
-
* Look of this template as it appears on the palette which can be used to override the default look of the nodes of this type.
|
|
287
|
-
*/
|
|
288
|
-
look?: ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig;
|
|
289
|
-
/**
|
|
290
|
-
* Label of this template as it appears on the palette and label that will be given to nodes created from this template.
|
|
291
|
-
*/
|
|
292
|
-
label?: string;
|
|
293
|
-
/**
|
|
294
|
-
* Look of the label of this template as it appears on the palette. By default, the label of the type of node is used.
|
|
295
|
-
*/
|
|
296
|
-
labelLook?: FieldConfig | null;
|
|
297
|
-
/**
|
|
298
|
-
* Default values of the properties of nodes created from this template.
|
|
299
|
-
*/
|
|
300
|
-
values?: {
|
|
301
|
-
[key: string]: unknown;
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Configuration for a template of a connection in a palette.
|
|
306
|
-
* @public
|
|
307
|
-
* @see PaletteComponent
|
|
308
|
-
*/
|
|
309
|
-
export interface ConnectionTemplateConfig {
|
|
310
|
-
/**
|
|
311
|
-
* String used to indicate that this is a template of a connection.
|
|
312
|
-
*/
|
|
313
|
-
templateType: 'connection';
|
|
314
|
-
/**
|
|
315
|
-
* Id of the type of connection of this template. Must correspond to the id of a type of connection defined in the connectionTypes list.
|
|
316
|
-
*/
|
|
317
|
-
type: string;
|
|
318
|
-
/**
|
|
319
|
-
* Label of this template as it appears on the palette.
|
|
320
|
-
*/
|
|
321
|
-
label: string;
|
|
322
|
-
/**
|
|
323
|
-
* Background color of this template as it appears on the palette.
|
|
324
|
-
*/
|
|
325
|
-
backgroundColor: string;
|
|
326
|
-
/**
|
|
327
|
-
* File path of the background image of this template as it appears on the palette.
|
|
328
|
-
*/
|
|
329
|
-
icon: string;
|
|
330
|
-
/**
|
|
331
|
-
* File path of the background image of this template as it appears on the palette when this connection type is selected.
|
|
332
|
-
*/
|
|
333
|
-
selectedIcon: string;
|
|
334
|
-
/**
|
|
335
|
-
* Width of this template in diagram units as it appears on the palette.
|
|
336
|
-
*/
|
|
337
|
-
width: number;
|
|
338
|
-
/**
|
|
339
|
-
* Height of this template in diagram units as it appears on the palette.
|
|
340
|
-
*/
|
|
341
|
-
height: number;
|
|
342
|
-
}
|
|
343
98
|
/**
|
|
344
99
|
* Configuration for a type of node.
|
|
345
100
|
* @public
|
|
@@ -404,6 +159,11 @@ export interface NodeTypeConfig {
|
|
|
404
159
|
* @default []
|
|
405
160
|
*/
|
|
406
161
|
ports?: PortConfig[];
|
|
162
|
+
/**
|
|
163
|
+
* Configuration of the decorators of nodes of this type.
|
|
164
|
+
* @default []
|
|
165
|
+
*/
|
|
166
|
+
decorators?: DecoratorConfig[];
|
|
407
167
|
/**
|
|
408
168
|
* Configuration of the look of nodes of this type as they should appear to the user.
|
|
409
169
|
*/
|
|
@@ -558,6 +318,31 @@ export interface FieldConfig {
|
|
|
558
318
|
*/
|
|
559
319
|
fit?: boolean;
|
|
560
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* Configuration for a decorator that is part of another element.
|
|
323
|
+
* @public
|
|
324
|
+
* @see DiagramDecorator
|
|
325
|
+
*/
|
|
326
|
+
export interface DecoratorConfig {
|
|
327
|
+
/**
|
|
328
|
+
* Coordinates of this decorator relative to its root element's coordinates.
|
|
329
|
+
*/
|
|
330
|
+
coords: Point;
|
|
331
|
+
/**
|
|
332
|
+
* Dimension of this decorator along the x axis.
|
|
333
|
+
* @public
|
|
334
|
+
*/
|
|
335
|
+
width: number;
|
|
336
|
+
/**
|
|
337
|
+
* Dimension of this decorator along the y axis.
|
|
338
|
+
* @public
|
|
339
|
+
*/
|
|
340
|
+
height: number;
|
|
341
|
+
/**
|
|
342
|
+
* Inner HTML of this decorator.
|
|
343
|
+
*/
|
|
344
|
+
html: string;
|
|
345
|
+
}
|
|
561
346
|
/**
|
|
562
347
|
* Configuration for the grid of sections of a node.
|
|
563
348
|
* @public
|
|
@@ -102,6 +102,12 @@ export declare enum DiagramActions {
|
|
|
102
102
|
* @see AddNodeAction
|
|
103
103
|
*/
|
|
104
104
|
AddNode = "add-node",
|
|
105
|
+
/**
|
|
106
|
+
* Action that corresponds to the addition or removal of sections in a node.
|
|
107
|
+
* @public
|
|
108
|
+
* @see AddSectionAction
|
|
109
|
+
*/
|
|
110
|
+
AddSectionAction = "add-section",
|
|
105
111
|
/**
|
|
106
112
|
* Action that corresponds to applying a layout which changes the location of several nodes.
|
|
107
113
|
* @public
|
|
@@ -192,6 +198,23 @@ export declare class AddNodeAction implements DiagramAction {
|
|
|
192
198
|
undo(): boolean;
|
|
193
199
|
redo(): boolean;
|
|
194
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Action which consists of adding or removing sections in a node.
|
|
203
|
+
* @private
|
|
204
|
+
* @see DiagramSection
|
|
205
|
+
*/
|
|
206
|
+
export declare class AddSectionAction implements DiagramAction {
|
|
207
|
+
readonly canvas: Canvas;
|
|
208
|
+
nodeId: string;
|
|
209
|
+
copyColumnIndex: number | undefined;
|
|
210
|
+
copyRowIndex: number | undefined;
|
|
211
|
+
removeColumnIndex: number | undefined;
|
|
212
|
+
removeRowIndex: number | undefined;
|
|
213
|
+
constructor(canvas: Canvas, nodeId: string, copyColumnIndex: number | undefined, copyRowIndex: number | undefined, removeColumnIndex: number | undefined, removeRowIndex: number | undefined);
|
|
214
|
+
do(): boolean;
|
|
215
|
+
undo(): boolean;
|
|
216
|
+
redo(): boolean;
|
|
217
|
+
}
|
|
195
218
|
/**
|
|
196
219
|
* Action which consists of applying a layout to the diagram which can change the location of several nodes.
|
|
197
220
|
* @private
|
|
@@ -7,7 +7,8 @@ import { DiagramElement, DiagramElementSet } from './diagram-element';
|
|
|
7
7
|
import { DiagramEntity, DiagramEntitySet } from './diagram-entity';
|
|
8
8
|
import { DiagramModel } from './diagram-model';
|
|
9
9
|
import { DiagramPort } from './diagram-port';
|
|
10
|
-
import { PropertySet
|
|
10
|
+
import { PropertySet } from '../property/property';
|
|
11
|
+
import { ValueSet } from '../property/value';
|
|
11
12
|
/**
|
|
12
13
|
* Default values of the parameters of a diagram connection.
|
|
13
14
|
* @private
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Canvas } from '../../interfaces/canvas';
|
|
2
|
+
import { Property } from '../property/property';
|
|
3
|
+
import { ValueSet } from '../property/value';
|
|
2
4
|
import { DiagramConnectionSet } from './diagram-connection';
|
|
3
5
|
import { DiagramDecoratorSet } from './diagram-decorator';
|
|
4
6
|
import { DiagramFieldSet } from './diagram-field';
|
|
5
7
|
import { DiagramNodeSet } from './diagram-node';
|
|
6
8
|
import { DiagramObjectSet } from './diagram-object';
|
|
7
9
|
import { DiagramPortSet } from './diagram-port';
|
|
8
|
-
import { Property, ValueSet } from './diagram-property';
|
|
9
10
|
import { DiagramSectionSet } from './diagram-section';
|
|
10
11
|
/**
|
|
11
12
|
* Stores the data of a diagram.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Point } from '../../util/canvas-util';
|
|
2
2
|
import { Side } from '../../util/svg-util';
|
|
3
3
|
import { CollabTimestamp } from '../collab/primitives';
|
|
4
|
-
import { FieldConfig, NodeTypeConfig, PortConfig } from '../config/diagram-config';
|
|
4
|
+
import { DecoratorConfig, FieldConfig, NodeTypeConfig, PortConfig } from '../config/diagram-config';
|
|
5
5
|
import { ImageLook, ImageLookConfig, ShapedLook, ShapedLookConfig, StretchableImageLook, StretchableImageLookConfig } from '../config/diagram-look-config';
|
|
6
|
+
import { PropertySet } from '../property/property';
|
|
7
|
+
import { ValueSet } from '../property/value';
|
|
6
8
|
import { DiagramConnection } from './diagram-connection';
|
|
7
9
|
import { DiagramDecorator } from './diagram-decorator';
|
|
8
10
|
import { DiagramElement, DiagramElementSet } from './diagram-element';
|
|
@@ -10,7 +12,6 @@ import { DiagramEntity, DiagramEntitySet } from './diagram-entity';
|
|
|
10
12
|
import { DiagramField, LabeledElement } from './diagram-field';
|
|
11
13
|
import { DiagramModel } from './diagram-model';
|
|
12
14
|
import { DiagramPort } from './diagram-port';
|
|
13
|
-
import { PropertySet, ValueSet } from './diagram-property';
|
|
14
15
|
import { DiagramSection, DiagramSectionGeometry, DiagramSectionGrid } from './diagram-section';
|
|
15
16
|
/**
|
|
16
17
|
* Default values of the look of a diagram node.
|
|
@@ -34,6 +35,7 @@ export declare const DIAGRAM_NODE_TYPE_DEFAULTS: {
|
|
|
34
35
|
padding: number;
|
|
35
36
|
label: null;
|
|
36
37
|
ports: never[];
|
|
38
|
+
decorators: never[];
|
|
37
39
|
sectionGrid: null;
|
|
38
40
|
look: ShapedLookConfig;
|
|
39
41
|
isUnique: boolean;
|
|
@@ -80,6 +82,7 @@ export declare class DiagramNodeType implements DiagramEntity {
|
|
|
80
82
|
topPadding: number;
|
|
81
83
|
label: FieldConfig | null;
|
|
82
84
|
ports: PortConfig[];
|
|
85
|
+
decorators: DecoratorConfig[];
|
|
83
86
|
sectionGrid: DiagramSectionGrid | null;
|
|
84
87
|
defaultLook: NodeLook;
|
|
85
88
|
selectedLook: NodeLook;
|
|
@@ -273,6 +276,26 @@ export declare class DiagramNode extends DiagramElement implements LabeledElemen
|
|
|
273
276
|
* @public
|
|
274
277
|
*/
|
|
275
278
|
setGeometry(geometry: DiagramNodeGeometry): void;
|
|
279
|
+
/**
|
|
280
|
+
* Removes all sections with the given index along the x axis.
|
|
281
|
+
* @public
|
|
282
|
+
*/
|
|
283
|
+
removeSectionColumn(columnIndex: number): void;
|
|
284
|
+
/**
|
|
285
|
+
* Removes all sections with the given index along the y axis.
|
|
286
|
+
* @public
|
|
287
|
+
*/
|
|
288
|
+
removeSectionRow(rowIndex: number): void;
|
|
289
|
+
/**
|
|
290
|
+
* Creates a copy of all sections with the given index along the x axis.
|
|
291
|
+
* @public
|
|
292
|
+
*/
|
|
293
|
+
copySectionColumn(columnIndex: number): void;
|
|
294
|
+
/**
|
|
295
|
+
* Creates a copy of all sections with the given index along the y axis.
|
|
296
|
+
* @public
|
|
297
|
+
*/
|
|
298
|
+
copySectionRow(rowIndex: number): void;
|
|
276
299
|
}
|
|
277
300
|
export declare class DiagramNodeSet extends DiagramElementSet<DiagramNode> {
|
|
278
301
|
private model;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ValueSet } from './value';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the given value is not empty.
|
|
4
|
+
* @private
|
|
5
|
+
* @param a A value.
|
|
6
|
+
* @returns `true` if the given value is not `undefined`, `null`, `''`, `[]` or `{}`; `false` otherwise.
|
|
7
|
+
*/
|
|
8
|
+
export declare const empty: (a: unknown) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Checks whether the given values are equal.
|
|
11
|
+
* @public
|
|
12
|
+
* @param a A value.
|
|
13
|
+
* @param b A value.
|
|
14
|
+
* @returns `true` if the given values are equal, `false` otherwise.
|
|
15
|
+
*/
|
|
16
|
+
export declare const equals: (a: unknown, b: unknown) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Calculates the differences between the two given objects and returns two objects containing the differences in each relative to the other.
|
|
19
|
+
*
|
|
20
|
+
* For each key that holds a different value in the two objects, the resulting objects will contain the differences in the values under that key.
|
|
21
|
+
*
|
|
22
|
+
* This function is recursive, that is, if the value under the key is an object, the function will be applied to that value recursively.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
* @param a An object.
|
|
26
|
+
* @param b An object.
|
|
27
|
+
* @returns A tuple of two objects with each containing the keys that have a different value in the corresponding argument compared to the other argument.
|
|
28
|
+
*/
|
|
29
|
+
export declare const diff: (a: {
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}, b: {
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}) => [{
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}, {
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}];
|
|
38
|
+
/**
|
|
39
|
+
* Calculates the differences between the two given values of a valueset and returns two objects containing the differences in each relative to the other.
|
|
40
|
+
*
|
|
41
|
+
* @param a An object.
|
|
42
|
+
* @param b An object.
|
|
43
|
+
* @param valueSet A ValueSet to use as reference for the keys and types of each property.
|
|
44
|
+
* @returns A tuple of two objects with each containing the keys that have a different value in the corresponding argument compared to the other argument.
|
|
45
|
+
*/
|
|
46
|
+
export declare const diffProperties: (a: {
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
}, b: {
|
|
49
|
+
[key: string]: unknown;
|
|
50
|
+
}, valueSet: ValueSet) => [{
|
|
51
|
+
[key: string]: unknown;
|
|
52
|
+
}, {
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}];
|
|
55
|
+
/**
|
|
56
|
+
* Checks if the given value is an object.
|
|
57
|
+
* @public
|
|
58
|
+
* @param x A value.
|
|
59
|
+
* @returns `true` if the given value is an object, `false` otherwise.
|
|
60
|
+
*/
|
|
61
|
+
export declare const isObject: (x: unknown) => boolean;
|