lucid-extension-sdk 0.0.164 → 0.0.166
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/commandtypes.d.ts +32 -0
- package/commandtypes.js +3 -0
- package/core/properties/strokestyle.d.ts +22 -0
- package/core/properties/strokestyle.js +41 -0
- package/core/rules/badgeboxfit.d.ts +4 -0
- package/core/rules/badgeboxfit.js +8 -0
- package/core/rules/conditions.d.ts +43 -0
- package/core/rules/conditions.js +50 -0
- package/core/rules/conditiontype.d.ts +7 -0
- package/core/rules/conditiontype.js +11 -0
- package/core/rules/serializedcondition.d.ts +16 -0
- package/core/rules/serializedcondition.js +2 -0
- package/core/rules/serializeddatagraphic.d.ts +14 -0
- package/core/rules/serializeddatagraphic.js +2 -0
- package/core/rules/serializedeffect.d.ts +25 -0
- package/core/rules/serializedeffect.js +9 -0
- package/core/rules/serializedstencilgraphic.d.ts +16 -0
- package/core/rules/serializedstencilgraphic.js +14 -0
- package/document/documentelement/ruleproxy.d.ts +81 -0
- package/document/documentelement/ruleproxy.js +118 -0
- package/document/documentproxy.d.ts +4 -0
- package/document/documentproxy.js +38 -0
- package/document/pageproxy.d.ts +13 -0
- package/document/pageproxy.js +27 -0
- package/document/ruledefinition.d.ts +109 -0
- package/document/ruledefinition.js +73 -0
- package/editorclient.d.ts +12 -0
- package/editorclient.js +14 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/package.json +1 -1
package/commandtypes.d.ts
CHANGED
|
@@ -36,11 +36,13 @@ export declare const enum CommandName {
|
|
|
36
36
|
CreateBlock = "cb",
|
|
37
37
|
CreateCollection = "cc",
|
|
38
38
|
CreateDataSource = "cds",
|
|
39
|
+
CreateDocumentElement = "cde",
|
|
39
40
|
CreateLine = "cl",
|
|
40
41
|
CreatePage = "cp",
|
|
41
42
|
CreateUserImage = "cui",
|
|
42
43
|
DataAction = "da",
|
|
43
44
|
DataItemExists = "die",
|
|
45
|
+
DeleteDocumentElement = "dde",
|
|
44
46
|
DeleteItem = "di",
|
|
45
47
|
DeletePage = "dp",
|
|
46
48
|
DeleteShapeData = "dsd",
|
|
@@ -75,6 +77,7 @@ export declare const enum CommandName {
|
|
|
75
77
|
HookSelection = "hs",
|
|
76
78
|
HookTextEdit = "hte",
|
|
77
79
|
ImportCards = "ic",
|
|
80
|
+
ImportPage = "imp",
|
|
78
81
|
KillExtension = "k",
|
|
79
82
|
ListBlocks = "lb",
|
|
80
83
|
ListCollectionFields = "lcf",
|
|
@@ -197,6 +200,10 @@ export declare type CommandArgs = {
|
|
|
197
200
|
query: CreateDataSourceQuery;
|
|
198
201
|
result: CreateDataSourceResult;
|
|
199
202
|
};
|
|
203
|
+
[CommandName.CreateDocumentElement]: {
|
|
204
|
+
query: CreateDocumentElementQuery;
|
|
205
|
+
result: CreateDocumentElementResult;
|
|
206
|
+
};
|
|
200
207
|
[CommandName.CreateLine]: {
|
|
201
208
|
query: CreateLineQuery;
|
|
202
209
|
result: CreateLineResult;
|
|
@@ -217,6 +224,10 @@ export declare type CommandArgs = {
|
|
|
217
224
|
query: DataItemExistsQuery;
|
|
218
225
|
result: DataItemExistsResult;
|
|
219
226
|
};
|
|
227
|
+
[CommandName.DeleteDocumentElement]: {
|
|
228
|
+
query: DeleteDocumentElementQuery;
|
|
229
|
+
result: DeleteDocumentElementResult;
|
|
230
|
+
};
|
|
220
231
|
[CommandName.DeleteItem]: {
|
|
221
232
|
query: DeleteItemQuery;
|
|
222
233
|
result: DeleteItemResult;
|
|
@@ -357,6 +368,10 @@ export declare type CommandArgs = {
|
|
|
357
368
|
query: ImportCardsQuery;
|
|
358
369
|
result: ImportCardsResult;
|
|
359
370
|
};
|
|
371
|
+
[CommandName.ImportPage]: {
|
|
372
|
+
query: ImportPageQuery;
|
|
373
|
+
result: ImportPageResult;
|
|
374
|
+
};
|
|
360
375
|
[CommandName.ListBlocks]: {
|
|
361
376
|
query: ListChildrenQuery;
|
|
362
377
|
result: ListChildrenResult;
|
|
@@ -763,6 +778,13 @@ export declare type CreateDataSourceQuery = {
|
|
|
763
778
|
};
|
|
764
779
|
};
|
|
765
780
|
export declare type CreateDataSourceResult = string;
|
|
781
|
+
export declare type CreateDocumentElementQuery = {
|
|
782
|
+
/** Type of element to create */
|
|
783
|
+
't': DocumentElementType;
|
|
784
|
+
/** Properties to set on that element */
|
|
785
|
+
'p': Record<string, any>;
|
|
786
|
+
};
|
|
787
|
+
export declare type CreateDocumentElementResult = string | undefined;
|
|
766
788
|
export declare type CreateLineQuery = {
|
|
767
789
|
/**
|
|
768
790
|
* By default, we add the line to the current page & currently active group. If specified, the
|
|
@@ -814,6 +836,8 @@ export declare type DataItemExistsQuery = {
|
|
|
814
836
|
'pk': string;
|
|
815
837
|
};
|
|
816
838
|
export declare type DataItemExistsResult = boolean;
|
|
839
|
+
export declare type DeleteDocumentElementQuery = string;
|
|
840
|
+
export declare type DeleteDocumentElementResult = boolean;
|
|
817
841
|
export declare type DeleteItemQuery = string;
|
|
818
842
|
export declare type DeleteItemResult = boolean;
|
|
819
843
|
export declare type DeletePageQuery = string;
|
|
@@ -1001,6 +1025,14 @@ export declare type HookTextEditResult = undefined;
|
|
|
1001
1025
|
export declare type ImportCardsQuery = string;
|
|
1002
1026
|
/** Resolves when the import dialog is closed */
|
|
1003
1027
|
export declare type ImportCardsResult = Promise<void>;
|
|
1028
|
+
export declare type ImportPageQuery = {
|
|
1029
|
+
/** The ID of the document or template to import */
|
|
1030
|
+
'id': string;
|
|
1031
|
+
/** Page numbers of specified document or template to import (zero-indexed) */
|
|
1032
|
+
'n': number[];
|
|
1033
|
+
};
|
|
1034
|
+
/** Resolves when the import succeeds or fails */
|
|
1035
|
+
export declare type ImportPageResult = Promise<void>;
|
|
1004
1036
|
export declare type KillExtensionQuery = void;
|
|
1005
1037
|
export declare type KillExtensionResult = undefined;
|
|
1006
1038
|
export declare type ListChildrenQuery = {
|
package/commandtypes.js
CHANGED
|
@@ -20,9 +20,11 @@ exports.commandTitles = new Map([
|
|
|
20
20
|
["cb" /* CommandName.CreateBlock */, 'CreateBlock'],
|
|
21
21
|
["cc" /* CommandName.CreateCollection */, 'CreateCollection'],
|
|
22
22
|
["cds" /* CommandName.CreateDataSource */, 'CreateDataSource'],
|
|
23
|
+
["cde" /* CommandName.CreateDocumentElement */, 'CreateDocumentElement'],
|
|
23
24
|
["cl" /* CommandName.CreateLine */, 'CreateLine'],
|
|
24
25
|
["cp" /* CommandName.CreatePage */, 'CreatePage'],
|
|
25
26
|
["die" /* CommandName.DataItemExists */, 'DataItemExists'],
|
|
27
|
+
["dde" /* CommandName.DeleteDocumentElement */, 'DeleteDocumentElement'],
|
|
26
28
|
["di" /* CommandName.DeleteItem */, 'DeleteItem'],
|
|
27
29
|
["dp" /* CommandName.DeletePage */, 'DeletePage'],
|
|
28
30
|
["dsd" /* CommandName.DeleteShapeData */, 'DeleteShapeData'],
|
|
@@ -57,6 +59,7 @@ exports.commandTitles = new Map([
|
|
|
57
59
|
["hs" /* CommandName.HookSelection */, 'HookSelection'],
|
|
58
60
|
["hte" /* CommandName.HookTextEdit */, 'HookTextEdit'],
|
|
59
61
|
["ic" /* CommandName.ImportCards */, 'ImportCards'],
|
|
62
|
+
["imp" /* CommandName.ImportPage */, 'ImportPage'],
|
|
60
63
|
["k" /* CommandName.KillExtension */, 'KillExtension'],
|
|
61
64
|
["lb" /* CommandName.ListBlocks */, 'ListBlocks'],
|
|
62
65
|
["lcf" /* CommandName.ListCollectionFields */, 'ListCollectionFields'],
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare enum StrokeStyle {
|
|
2
|
+
Solid = "solid",
|
|
3
|
+
Dashed = "dashed",
|
|
4
|
+
LongDash = "longdash",
|
|
5
|
+
DashDot = "dashdot",
|
|
6
|
+
DashDotDot = "dashdotdot",
|
|
7
|
+
DashLongDash = "dashlongdash",
|
|
8
|
+
Dashed32 = "dashed32",
|
|
9
|
+
Dashed44 = "dashed44",
|
|
10
|
+
Dashed24 = "dashed24",
|
|
11
|
+
Dotted = "dotted",
|
|
12
|
+
DotDotDot = "dotdotdot",
|
|
13
|
+
StripeThinThin = "stripethinthin",
|
|
14
|
+
StripeThickThick = "stripethickthick",
|
|
15
|
+
StripeThickThin = "stripethickthin",
|
|
16
|
+
StripeThinThick = "stripethinthick",
|
|
17
|
+
StripeThickThinThick = "stripethickthinthick",
|
|
18
|
+
StripeThinThickThin = "stripethinthickthin",
|
|
19
|
+
StripeTriple = "stripetriple"
|
|
20
|
+
}
|
|
21
|
+
export declare function isStrokeStyle(value: any): value is StrokeStyle;
|
|
22
|
+
export declare function convertStrokeStyleToBorder(strokeStyle: StrokeStyle): string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertStrokeStyleToBorder = exports.isStrokeStyle = exports.StrokeStyle = void 0;
|
|
4
|
+
var StrokeStyle;
|
|
5
|
+
(function (StrokeStyle) {
|
|
6
|
+
StrokeStyle["Solid"] = "solid";
|
|
7
|
+
StrokeStyle["Dashed"] = "dashed";
|
|
8
|
+
StrokeStyle["LongDash"] = "longdash";
|
|
9
|
+
StrokeStyle["DashDot"] = "dashdot";
|
|
10
|
+
StrokeStyle["DashDotDot"] = "dashdotdot";
|
|
11
|
+
StrokeStyle["DashLongDash"] = "dashlongdash";
|
|
12
|
+
StrokeStyle["Dashed32"] = "dashed32";
|
|
13
|
+
StrokeStyle["Dashed44"] = "dashed44";
|
|
14
|
+
StrokeStyle["Dashed24"] = "dashed24";
|
|
15
|
+
StrokeStyle["Dotted"] = "dotted";
|
|
16
|
+
StrokeStyle["DotDotDot"] = "dotdotdot";
|
|
17
|
+
StrokeStyle["StripeThinThin"] = "stripethinthin";
|
|
18
|
+
StrokeStyle["StripeThickThick"] = "stripethickthick";
|
|
19
|
+
StrokeStyle["StripeThickThin"] = "stripethickthin";
|
|
20
|
+
StrokeStyle["StripeThinThick"] = "stripethinthick";
|
|
21
|
+
StrokeStyle["StripeThickThinThick"] = "stripethickthinthick";
|
|
22
|
+
StrokeStyle["StripeThinThickThin"] = "stripethinthickthin";
|
|
23
|
+
StrokeStyle["StripeTriple"] = "stripetriple";
|
|
24
|
+
})(StrokeStyle = exports.StrokeStyle || (exports.StrokeStyle = {}));
|
|
25
|
+
const strokeStyleSet = new Set(Object.values(StrokeStyle));
|
|
26
|
+
function isStrokeStyle(value) {
|
|
27
|
+
return strokeStyleSet.has(value);
|
|
28
|
+
}
|
|
29
|
+
exports.isStrokeStyle = isStrokeStyle;
|
|
30
|
+
function convertStrokeStyleToBorder(strokeStyle) {
|
|
31
|
+
if (strokeStyle.startsWith('dash') || strokeStyle == StrokeStyle.LongDash) {
|
|
32
|
+
return 'dashed';
|
|
33
|
+
}
|
|
34
|
+
else if (strokeStyle.startsWith('dot')) {
|
|
35
|
+
return 'dotted';
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return 'solid';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.convertStrokeStyleToBorder = convertStrokeStyleToBorder;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BadgeBoxFit = void 0;
|
|
4
|
+
var BadgeBoxFit;
|
|
5
|
+
(function (BadgeBoxFit) {
|
|
6
|
+
BadgeBoxFit["fitHeight"] = "fit-height";
|
|
7
|
+
BadgeBoxFit["none"] = "none";
|
|
8
|
+
})(BadgeBoxFit = exports.BadgeBoxFit || (exports.BadgeBoxFit = {}));
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare enum ConditionCombination {
|
|
2
|
+
AND = "AND",
|
|
3
|
+
OR = "OR"
|
|
4
|
+
}
|
|
5
|
+
export declare enum TextConditions {
|
|
6
|
+
TextEmpty = 0,
|
|
7
|
+
TextNotEmpty = 1,
|
|
8
|
+
TextContains = 2,
|
|
9
|
+
TextDoesNotContain = 3
|
|
10
|
+
}
|
|
11
|
+
export declare enum ShapeDataConditions {
|
|
12
|
+
TextEmpty = 0,
|
|
13
|
+
TextNotEmpty = 1,
|
|
14
|
+
TextContains = 2,
|
|
15
|
+
TextDoesNotContain = 3,
|
|
16
|
+
/** @deprecated */ TextEquals = 4,
|
|
17
|
+
/** @deprecated */ TextNotEqual = 5,
|
|
18
|
+
TextStartsWith = 6,
|
|
19
|
+
TextEndsWith = 7,
|
|
20
|
+
GreaterThan = 8,
|
|
21
|
+
GreaterThanOrEqual = 9,
|
|
22
|
+
LessThan = 10,
|
|
23
|
+
LessThanOrEqual = 11,
|
|
24
|
+
Equal = 12,
|
|
25
|
+
NotEqual = 13,
|
|
26
|
+
Between = 14,
|
|
27
|
+
NotBetween = 15
|
|
28
|
+
}
|
|
29
|
+
export declare enum ShapeTypeConditions {
|
|
30
|
+
TextContains = 2,
|
|
31
|
+
TextDoesNotContain = 3
|
|
32
|
+
}
|
|
33
|
+
export declare enum ConnectedShapesCondition {
|
|
34
|
+
GreaterThan = 8,
|
|
35
|
+
GreaterThanOrEqual = 9,
|
|
36
|
+
LessThan = 10,
|
|
37
|
+
LessThanOrEqual = 11,
|
|
38
|
+
Equal = 12,
|
|
39
|
+
NotEqual = 13,
|
|
40
|
+
Between = 14,
|
|
41
|
+
NotBetween = 15
|
|
42
|
+
}
|
|
43
|
+
export declare type Conditions = TextConditions | ShapeDataConditions | ShapeTypeConditions | ConnectedShapesCondition;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConnectedShapesCondition = exports.ShapeTypeConditions = exports.ShapeDataConditions = exports.TextConditions = exports.ConditionCombination = void 0;
|
|
4
|
+
var ConditionCombination;
|
|
5
|
+
(function (ConditionCombination) {
|
|
6
|
+
ConditionCombination["AND"] = "AND";
|
|
7
|
+
ConditionCombination["OR"] = "OR";
|
|
8
|
+
})(ConditionCombination = exports.ConditionCombination || (exports.ConditionCombination = {}));
|
|
9
|
+
var TextConditions;
|
|
10
|
+
(function (TextConditions) {
|
|
11
|
+
TextConditions[TextConditions["TextEmpty"] = 0] = "TextEmpty";
|
|
12
|
+
TextConditions[TextConditions["TextNotEmpty"] = 1] = "TextNotEmpty";
|
|
13
|
+
TextConditions[TextConditions["TextContains"] = 2] = "TextContains";
|
|
14
|
+
TextConditions[TextConditions["TextDoesNotContain"] = 3] = "TextDoesNotContain";
|
|
15
|
+
})(TextConditions = exports.TextConditions || (exports.TextConditions = {}));
|
|
16
|
+
var ShapeDataConditions;
|
|
17
|
+
(function (ShapeDataConditions) {
|
|
18
|
+
ShapeDataConditions[ShapeDataConditions["TextEmpty"] = 0] = "TextEmpty";
|
|
19
|
+
ShapeDataConditions[ShapeDataConditions["TextNotEmpty"] = 1] = "TextNotEmpty";
|
|
20
|
+
ShapeDataConditions[ShapeDataConditions["TextContains"] = 2] = "TextContains";
|
|
21
|
+
ShapeDataConditions[ShapeDataConditions["TextDoesNotContain"] = 3] = "TextDoesNotContain";
|
|
22
|
+
/** @deprecated */ ShapeDataConditions[ShapeDataConditions["TextEquals"] = 4] = "TextEquals";
|
|
23
|
+
/** @deprecated */ ShapeDataConditions[ShapeDataConditions["TextNotEqual"] = 5] = "TextNotEqual";
|
|
24
|
+
ShapeDataConditions[ShapeDataConditions["TextStartsWith"] = 6] = "TextStartsWith";
|
|
25
|
+
ShapeDataConditions[ShapeDataConditions["TextEndsWith"] = 7] = "TextEndsWith";
|
|
26
|
+
ShapeDataConditions[ShapeDataConditions["GreaterThan"] = 8] = "GreaterThan";
|
|
27
|
+
ShapeDataConditions[ShapeDataConditions["GreaterThanOrEqual"] = 9] = "GreaterThanOrEqual";
|
|
28
|
+
ShapeDataConditions[ShapeDataConditions["LessThan"] = 10] = "LessThan";
|
|
29
|
+
ShapeDataConditions[ShapeDataConditions["LessThanOrEqual"] = 11] = "LessThanOrEqual";
|
|
30
|
+
ShapeDataConditions[ShapeDataConditions["Equal"] = 12] = "Equal";
|
|
31
|
+
ShapeDataConditions[ShapeDataConditions["NotEqual"] = 13] = "NotEqual";
|
|
32
|
+
ShapeDataConditions[ShapeDataConditions["Between"] = 14] = "Between";
|
|
33
|
+
ShapeDataConditions[ShapeDataConditions["NotBetween"] = 15] = "NotBetween";
|
|
34
|
+
})(ShapeDataConditions = exports.ShapeDataConditions || (exports.ShapeDataConditions = {}));
|
|
35
|
+
var ShapeTypeConditions;
|
|
36
|
+
(function (ShapeTypeConditions) {
|
|
37
|
+
ShapeTypeConditions[ShapeTypeConditions["TextContains"] = 2] = "TextContains";
|
|
38
|
+
ShapeTypeConditions[ShapeTypeConditions["TextDoesNotContain"] = 3] = "TextDoesNotContain";
|
|
39
|
+
})(ShapeTypeConditions = exports.ShapeTypeConditions || (exports.ShapeTypeConditions = {}));
|
|
40
|
+
var ConnectedShapesCondition;
|
|
41
|
+
(function (ConnectedShapesCondition) {
|
|
42
|
+
ConnectedShapesCondition[ConnectedShapesCondition["GreaterThan"] = 8] = "GreaterThan";
|
|
43
|
+
ConnectedShapesCondition[ConnectedShapesCondition["GreaterThanOrEqual"] = 9] = "GreaterThanOrEqual";
|
|
44
|
+
ConnectedShapesCondition[ConnectedShapesCondition["LessThan"] = 10] = "LessThan";
|
|
45
|
+
ConnectedShapesCondition[ConnectedShapesCondition["LessThanOrEqual"] = 11] = "LessThanOrEqual";
|
|
46
|
+
ConnectedShapesCondition[ConnectedShapesCondition["Equal"] = 12] = "Equal";
|
|
47
|
+
ConnectedShapesCondition[ConnectedShapesCondition["NotEqual"] = 13] = "NotEqual";
|
|
48
|
+
ConnectedShapesCondition[ConnectedShapesCondition["Between"] = 14] = "Between";
|
|
49
|
+
ConnectedShapesCondition[ConnectedShapesCondition["NotBetween"] = 15] = "NotBetween";
|
|
50
|
+
})(ConnectedShapesCondition = exports.ConnectedShapesCondition || (exports.ConnectedShapesCondition = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConditionType = void 0;
|
|
4
|
+
var ConditionType;
|
|
5
|
+
(function (ConditionType) {
|
|
6
|
+
ConditionType[ConditionType["Text"] = 0] = "Text";
|
|
7
|
+
ConditionType[ConditionType["ShapeData"] = 1] = "ShapeData";
|
|
8
|
+
ConditionType[ConditionType["Formula"] = 2] = "Formula";
|
|
9
|
+
ConditionType[ConditionType["ShapeType"] = 3] = "ShapeType";
|
|
10
|
+
ConditionType[ConditionType["ConnectedShapes"] = 4] = "ConnectedShapes";
|
|
11
|
+
})(ConditionType = exports.ConditionType || (exports.ConditionType = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Conditions } from './conditions';
|
|
2
|
+
import { ConditionType } from './conditiontype';
|
|
3
|
+
export declare type Between = {
|
|
4
|
+
'After': number | undefined;
|
|
5
|
+
'Before': number | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare type ConditionValueType = string | number | boolean | Between | undefined | Array<string>;
|
|
8
|
+
/** See lucid-extension-sdk/document/documentelement/ruleproxy.ts for a description of each of these fields */
|
|
9
|
+
export declare type SerializedCondition = {
|
|
10
|
+
'Type': ConditionType;
|
|
11
|
+
'Source': string;
|
|
12
|
+
'Condition': Conditions;
|
|
13
|
+
'Value'?: ConditionValueType;
|
|
14
|
+
'Label'?: string | undefined;
|
|
15
|
+
'DisplayLabel'?: string | undefined;
|
|
16
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SerializedBadgeEnumPosition } from '../properties/datagraphic/badgeposition';
|
|
2
|
+
import { DataGraphicIconSets } from '../properties/datagraphic/datagraphicindexes';
|
|
3
|
+
export declare type SerializedDataGraphic = {
|
|
4
|
+
'Set': DataGraphicIconSets;
|
|
5
|
+
'Index': number;
|
|
6
|
+
'Position': SerializedBadgeEnumPosition;
|
|
7
|
+
'Color'?: string;
|
|
8
|
+
'Image'?: SerializedDataGraphicImage;
|
|
9
|
+
};
|
|
10
|
+
export declare type SerializedDataGraphicImage = {
|
|
11
|
+
'url': string;
|
|
12
|
+
'w': number;
|
|
13
|
+
'h': number;
|
|
14
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ConditionCombination } from './conditions';
|
|
2
|
+
import { SerializedDataGraphic } from './serializeddatagraphic';
|
|
3
|
+
import { SerializedStencilGraphic } from './serializedstencilgraphic';
|
|
4
|
+
export declare type FormattingInterface = {
|
|
5
|
+
[index: string]: string;
|
|
6
|
+
};
|
|
7
|
+
export declare type SerializedFormatting = {
|
|
8
|
+
'Block'?: FormattingInterface;
|
|
9
|
+
'Line'?: FormattingInterface;
|
|
10
|
+
'Page'?: FormattingInterface;
|
|
11
|
+
};
|
|
12
|
+
export declare enum RuleFormattingType {
|
|
13
|
+
FORMATTING = 0,
|
|
14
|
+
DATA_GRAPHICS = 1,
|
|
15
|
+
STENCIL = 2
|
|
16
|
+
}
|
|
17
|
+
export declare type SerializedEffect = {
|
|
18
|
+
'ConditionOrder': number[];
|
|
19
|
+
'Combination': ConditionCombination;
|
|
20
|
+
'FormatType': RuleFormattingType;
|
|
21
|
+
'Formatting': SerializedFormatting;
|
|
22
|
+
'DataGraphic'?: SerializedDataGraphic | undefined;
|
|
23
|
+
'StencilGraphic'?: SerializedStencilGraphic | undefined;
|
|
24
|
+
'Tooltip'?: string | undefined;
|
|
25
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuleFormattingType = void 0;
|
|
4
|
+
var RuleFormattingType;
|
|
5
|
+
(function (RuleFormattingType) {
|
|
6
|
+
RuleFormattingType[RuleFormattingType["FORMATTING"] = 0] = "FORMATTING";
|
|
7
|
+
RuleFormattingType[RuleFormattingType["DATA_GRAPHICS"] = 1] = "DATA_GRAPHICS";
|
|
8
|
+
RuleFormattingType[RuleFormattingType["STENCIL"] = 2] = "STENCIL";
|
|
9
|
+
})(RuleFormattingType = exports.RuleFormattingType || (exports.RuleFormattingType = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SerializedBadgeEnumPosition } from '../properties/datagraphic/badgeposition';
|
|
2
|
+
import { BadgeBoxFit } from './badgeboxfit';
|
|
3
|
+
export declare type SerializedStencilGraphic = {
|
|
4
|
+
'Stencil': string;
|
|
5
|
+
'Properties': {
|
|
6
|
+
[index: string]: number | string | boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* AutoHide used to be an undefined property that should default to true.
|
|
10
|
+
* Either continue handling undefined case when deserializing, or write a BCU that changes undefined to true.
|
|
11
|
+
*/
|
|
12
|
+
'AutoHide'?: boolean;
|
|
13
|
+
'Badge'?: SerializedBadgeEnumPosition;
|
|
14
|
+
'BoxFit'?: BadgeBoxFit;
|
|
15
|
+
};
|
|
16
|
+
export declare const isSerializedStencilGraphic: (v: unknown) => v is SerializedStencilGraphic;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSerializedStencilGraphic = void 0;
|
|
4
|
+
const checks_1 = require("../checks");
|
|
5
|
+
const badgeposition_1 = require("../properties/datagraphic/badgeposition");
|
|
6
|
+
const validators_1 = require("../validators/validators");
|
|
7
|
+
const badgeboxfit_1 = require("./badgeboxfit");
|
|
8
|
+
exports.isSerializedStencilGraphic = (0, validators_1.objectValidator)({
|
|
9
|
+
'Stencil': checks_1.isString,
|
|
10
|
+
'Properties': (0, validators_1.objectOfValidator)((0, validators_1.either)(checks_1.isBoolean, (0, validators_1.either)(checks_1.isString, checks_1.isNumber))),
|
|
11
|
+
'AutoHide': (0, validators_1.option)(checks_1.isBoolean),
|
|
12
|
+
'Badge': (0, validators_1.option)(badgeposition_1.isValidSerializedBadgeEnumPosition),
|
|
13
|
+
'BoxFit': (0, validators_1.option)((0, validators_1.enumValidator)(badgeboxfit_1.BadgeBoxFit)),
|
|
14
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { EditorClient } from '../../editorclient';
|
|
2
|
+
import { MapProxy } from '../mapproxy';
|
|
3
|
+
import { ConditionDefinition, EffectDefinition } from '../ruledefinition';
|
|
4
|
+
import { DocumentElementProxy } from './documentelementproxy';
|
|
5
|
+
export declare class RuleCondition {
|
|
6
|
+
readonly rule: RuleProxy;
|
|
7
|
+
private readonly client;
|
|
8
|
+
readonly key: string;
|
|
9
|
+
private definition;
|
|
10
|
+
constructor(rule: RuleProxy, client: EditorClient, key: string);
|
|
11
|
+
/** What kind of condition is this? e.g. a formula evaluation, checking for non-empty text, etc. */
|
|
12
|
+
readonly type: import("../..").ConditionType;
|
|
13
|
+
/**
|
|
14
|
+
* If this.type == ConditionType.Text, this is a TextConditions.
|
|
15
|
+
* If this.type == ConditionType.ShapeData, this is a ShapeDataConditions.
|
|
16
|
+
* If this.type == ConditionType.ShapeType, this is a ShapeTypeConditions.
|
|
17
|
+
* If this.type == ConditionType.ConnectedShapes, this is a ConnectedShapesConditions.
|
|
18
|
+
*/
|
|
19
|
+
readonly condition: import("../..").Conditions;
|
|
20
|
+
/**
|
|
21
|
+
* For formula conditions, the formula string.
|
|
22
|
+
*
|
|
23
|
+
* For other conditions,the value against which the condition is tested. For example, a condition with
|
|
24
|
+
* type = ConditionType.ShapeData
|
|
25
|
+
* condition = ShapeDataConditions.GreaterThan
|
|
26
|
+
* field = 'TheField'
|
|
27
|
+
* value = 14
|
|
28
|
+
*
|
|
29
|
+
* will trigger when the shape data field "TheField" has a value that is greater than 14.
|
|
30
|
+
*/
|
|
31
|
+
readonly value: import("../../core/rules/serializedcondition").ConditionValueType;
|
|
32
|
+
/** For shape data conditions, the name of the shape data field to test */
|
|
33
|
+
readonly field: string | undefined;
|
|
34
|
+
/** For shape data conditions, the name to display to the end user to identify the field name */
|
|
35
|
+
readonly fieldLabel: string | undefined;
|
|
36
|
+
/** Update this condition to reflect a new definition */
|
|
37
|
+
update(definition: ConditionDefinition): void;
|
|
38
|
+
}
|
|
39
|
+
export declare class RuleEffect {
|
|
40
|
+
readonly rule: RuleProxy;
|
|
41
|
+
private readonly client;
|
|
42
|
+
readonly key: string;
|
|
43
|
+
private definition;
|
|
44
|
+
constructor(rule: RuleProxy, client: EditorClient, key: string);
|
|
45
|
+
readonly conditions: MapProxy<string, RuleCondition>;
|
|
46
|
+
/** How multiple conditions are combined (AND vs OR) */
|
|
47
|
+
readonly combination: import("../..").ConditionCombination;
|
|
48
|
+
/** What kind of effect is displayed? Formatting vs. icons vs. dynamic stencil, etc. */
|
|
49
|
+
readonly formatType: import("../../core/rules/serializedeffect").RuleFormattingType;
|
|
50
|
+
/** For formatType = RuleFormattingType.FORMATTING, what styles are applied to blocks, lines, and pages? */
|
|
51
|
+
readonly formatting: import("../../core/rules/serializedeffect").SerializedFormatting;
|
|
52
|
+
/** For formatType = RuleFormattingType.DATA_GRAPHICS, a description of which icon appears and where */
|
|
53
|
+
readonly dataGraphic: {
|
|
54
|
+
set: import("../..").DataGraphicIconSets;
|
|
55
|
+
index: number;
|
|
56
|
+
position: import("../../core/properties/datagraphic/badgeposition").BadgeEnumPosition;
|
|
57
|
+
color: string | undefined;
|
|
58
|
+
image: {
|
|
59
|
+
url: string;
|
|
60
|
+
w: number;
|
|
61
|
+
h: number;
|
|
62
|
+
} | undefined;
|
|
63
|
+
} | undefined;
|
|
64
|
+
/** Update this effect to reflect a new definition */
|
|
65
|
+
update(definition: EffectDefinition): void;
|
|
66
|
+
}
|
|
67
|
+
export declare class RuleProxy extends DocumentElementProxy {
|
|
68
|
+
readonly id: string;
|
|
69
|
+
/**
|
|
70
|
+
* @param id The ID of this conditional formatting rule
|
|
71
|
+
* @param client
|
|
72
|
+
*/
|
|
73
|
+
constructor(id: string, client: EditorClient);
|
|
74
|
+
getName(): string;
|
|
75
|
+
getOrder(): number;
|
|
76
|
+
readonly effects: MapProxy<string, RuleEffect>;
|
|
77
|
+
/**
|
|
78
|
+
* Delete this conditional formatting rule from the document
|
|
79
|
+
*/
|
|
80
|
+
delete(): void;
|
|
81
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuleProxy = exports.RuleEffect = exports.RuleCondition = void 0;
|
|
4
|
+
const badgeposition_1 = require("../../core/properties/datagraphic/badgeposition");
|
|
5
|
+
const mapproxy_1 = require("../mapproxy");
|
|
6
|
+
const ruledefinition_1 = require("../ruledefinition");
|
|
7
|
+
const documentelementproxy_1 = require("./documentelementproxy");
|
|
8
|
+
class RuleCondition {
|
|
9
|
+
constructor(rule, client, key) {
|
|
10
|
+
this.rule = rule;
|
|
11
|
+
this.client = client;
|
|
12
|
+
this.key = key;
|
|
13
|
+
this.definition = this.rule.properties.get(this.key);
|
|
14
|
+
/** What kind of condition is this? e.g. a formula evaluation, checking for non-empty text, etc. */
|
|
15
|
+
this.type = this.definition['Type'];
|
|
16
|
+
/**
|
|
17
|
+
* If this.type == ConditionType.Text, this is a TextConditions.
|
|
18
|
+
* If this.type == ConditionType.ShapeData, this is a ShapeDataConditions.
|
|
19
|
+
* If this.type == ConditionType.ShapeType, this is a ShapeTypeConditions.
|
|
20
|
+
* If this.type == ConditionType.ConnectedShapes, this is a ConnectedShapesConditions.
|
|
21
|
+
*/
|
|
22
|
+
this.condition = this.definition['Condition'];
|
|
23
|
+
/**
|
|
24
|
+
* For formula conditions, the formula string.
|
|
25
|
+
*
|
|
26
|
+
* For other conditions,the value against which the condition is tested. For example, a condition with
|
|
27
|
+
* type = ConditionType.ShapeData
|
|
28
|
+
* condition = ShapeDataConditions.GreaterThan
|
|
29
|
+
* field = 'TheField'
|
|
30
|
+
* value = 14
|
|
31
|
+
*
|
|
32
|
+
* will trigger when the shape data field "TheField" has a value that is greater than 14.
|
|
33
|
+
*/
|
|
34
|
+
this.value = this.definition['Value'];
|
|
35
|
+
/** For shape data conditions, the name of the shape data field to test */
|
|
36
|
+
this.field = this.definition['Label'];
|
|
37
|
+
/** For shape data conditions, the name to display to the end user to identify the field name */
|
|
38
|
+
this.fieldLabel = this.definition['DisplayLabel'];
|
|
39
|
+
}
|
|
40
|
+
/** Update this condition to reflect a new definition */
|
|
41
|
+
update(definition) {
|
|
42
|
+
this.rule.properties.set(this.key, (0, ruledefinition_1.serializeConditionDefinition)(definition));
|
|
43
|
+
this.definition = this.rule.properties.get(this.key);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.RuleCondition = RuleCondition;
|
|
47
|
+
class RuleEffect {
|
|
48
|
+
constructor(rule, client, key) {
|
|
49
|
+
this.rule = rule;
|
|
50
|
+
this.client = client;
|
|
51
|
+
this.key = key;
|
|
52
|
+
this.definition = this.rule.properties.get(this.key);
|
|
53
|
+
this.conditions = new mapproxy_1.MapProxy(() => this.definition['ConditionOrder'].map((order) => 'Condition_' + order), (key) => new RuleCondition(this.rule, this.client, key));
|
|
54
|
+
/** How multiple conditions are combined (AND vs OR) */
|
|
55
|
+
this.combination = this.definition['Combination'];
|
|
56
|
+
/** What kind of effect is displayed? Formatting vs. icons vs. dynamic stencil, etc. */
|
|
57
|
+
this.formatType = this.definition['FormatType'];
|
|
58
|
+
/** For formatType = RuleFormattingType.FORMATTING, what styles are applied to blocks, lines, and pages? */
|
|
59
|
+
this.formatting = this.definition['Formatting'];
|
|
60
|
+
/** For formatType = RuleFormattingType.DATA_GRAPHICS, a description of which icon appears and where */
|
|
61
|
+
this.dataGraphic = this.definition['DataGraphic'] && {
|
|
62
|
+
set: this.definition['DataGraphic']['Set'],
|
|
63
|
+
index: this.definition['DataGraphic']['Index'],
|
|
64
|
+
position: (0, badgeposition_1.deserializeBadgeEnumPosition)(this.definition['DataGraphic']['Position']),
|
|
65
|
+
color: this.definition['DataGraphic']['Color'],
|
|
66
|
+
image: this.definition['DataGraphic']['Image'] && {
|
|
67
|
+
url: this.definition['DataGraphic']['Image']['url'],
|
|
68
|
+
w: this.definition['DataGraphic']['Image']['w'],
|
|
69
|
+
h: this.definition['DataGraphic']['Image']['h'],
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Update this effect to reflect a new definition */
|
|
74
|
+
update(definition) {
|
|
75
|
+
//Find the maximum used condition index in the entire rule, in case we need to add more.
|
|
76
|
+
let nextConditionIndex = 1;
|
|
77
|
+
for (const effect of this.rule.effects.values()) {
|
|
78
|
+
nextConditionIndex = Math.max(nextConditionIndex, ...effect.definition.ConditionOrder.map((index) => index + 1));
|
|
79
|
+
}
|
|
80
|
+
const conditionIndexes = this.definition.ConditionOrder;
|
|
81
|
+
definition.conditions.forEach((condition, index) => {
|
|
82
|
+
let conditionIndex = conditionIndexes[index];
|
|
83
|
+
if (conditionIndex === undefined) {
|
|
84
|
+
//Added a new condition
|
|
85
|
+
conditionIndex = nextConditionIndex;
|
|
86
|
+
conditionIndexes.push(nextConditionIndex++);
|
|
87
|
+
}
|
|
88
|
+
const conditionKey = 'Condition_' + conditionIndex;
|
|
89
|
+
this.rule.properties.set(conditionKey, (0, ruledefinition_1.serializeConditionDefinition)(condition));
|
|
90
|
+
});
|
|
91
|
+
this.rule.properties.set(this.key, (0, ruledefinition_1.serializeEffectDefinition)(definition, conditionIndexes.slice(0, definition.conditions.length)));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.RuleEffect = RuleEffect;
|
|
95
|
+
class RuleProxy extends documentelementproxy_1.DocumentElementProxy {
|
|
96
|
+
/**
|
|
97
|
+
* @param id The ID of this conditional formatting rule
|
|
98
|
+
* @param client
|
|
99
|
+
*/
|
|
100
|
+
constructor(id, client) {
|
|
101
|
+
super(id, client);
|
|
102
|
+
this.id = id;
|
|
103
|
+
this.effects = new mapproxy_1.MapProxy(() => this.properties.get('EffectOrder').map((order) => 'Effect_' + order), (key) => new RuleEffect(this, this.client, key));
|
|
104
|
+
}
|
|
105
|
+
getName() {
|
|
106
|
+
return this.properties.get('Name');
|
|
107
|
+
}
|
|
108
|
+
getOrder() {
|
|
109
|
+
return this.properties.get('Order');
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Delete this conditional formatting rule from the document
|
|
113
|
+
*/
|
|
114
|
+
delete() {
|
|
115
|
+
this.client.sendCommand("dde" /* CommandName.DeleteDocumentElement */, this.id);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.RuleProxy = RuleProxy;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { EditorClient } from '../editorclient';
|
|
2
2
|
import { CardConfigProxy } from './documentelement/cardconfigproxy';
|
|
3
|
+
import { RuleProxy } from './documentelement/ruleproxy';
|
|
3
4
|
import { ElementProxy } from './elementproxy';
|
|
4
5
|
import { ItemProxy } from './itemproxy';
|
|
5
6
|
import { MapProxy } from './mapproxy';
|
|
6
7
|
import { PageDefinition } from './pagedefinition';
|
|
7
8
|
import { PageProxy } from './pageproxy';
|
|
9
|
+
import { RuleDefinition } from './ruledefinition';
|
|
8
10
|
/**
|
|
9
11
|
* The currently-open Lucid document
|
|
10
12
|
*/
|
|
@@ -68,6 +70,8 @@ export declare class DocumentProxy extends ElementProxy {
|
|
|
68
70
|
*/
|
|
69
71
|
unhookCreateItems(handle: string): void;
|
|
70
72
|
readonly cardIntegrationConfigs: MapProxy<string, CardConfigProxy>;
|
|
73
|
+
readonly rules: MapProxy<string, RuleProxy>;
|
|
74
|
+
addRule(definition: RuleDefinition): RuleProxy | undefined;
|
|
71
75
|
/**
|
|
72
76
|
* Watch for new blocks, lines, or groups deleted from this document. The callback will
|
|
73
77
|
* be called with items deleted by the current user, but will not be called with items
|
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DocumentProxy = void 0;
|
|
4
4
|
const cardconfigproxy_1 = require("./documentelement/cardconfigproxy");
|
|
5
5
|
const documentelementtype_1 = require("./documentelement/documentelementtype");
|
|
6
|
+
const ruleproxy_1 = require("./documentelement/ruleproxy");
|
|
6
7
|
const elementproxy_1 = require("./elementproxy");
|
|
7
8
|
const mapproxy_1 = require("./mapproxy");
|
|
8
9
|
const pageproxy_1 = require("./pageproxy");
|
|
10
|
+
const ruledefinition_1 = require("./ruledefinition");
|
|
9
11
|
/**
|
|
10
12
|
* The currently-open Lucid document
|
|
11
13
|
*/
|
|
@@ -17,6 +19,10 @@ class DocumentProxy extends elementproxy_1.ElementProxy {
|
|
|
17
19
|
*/
|
|
18
20
|
this.pages = new mapproxy_1.MapProxy(() => this.client.sendCommand("lp" /* CommandName.ListPages */, undefined), (pageId) => new pageproxy_1.PageProxy(pageId, this.client));
|
|
19
21
|
this.cardIntegrationConfigs = new mapproxy_1.MapProxy(() => this.client.sendCommand("lde" /* CommandName.ListDocumentElements */, { 't': documentelementtype_1.DocumentElementType.TaskCardFieldsConfig }), (id) => new cardconfigproxy_1.CardConfigProxy(id, this.client));
|
|
22
|
+
this.rules = new mapproxy_1.MapProxy(() => this.client
|
|
23
|
+
.sendCommand("lde" /* CommandName.ListDocumentElements */, { 't': documentelementtype_1.DocumentElementType.Rule })
|
|
24
|
+
//Filter down to only the rules with source User (i.e. ones visible in the UI, not ones created internally by the app)
|
|
25
|
+
.filter((id) => this.client.sendCommand("gp" /* CommandName.GetProperty */, { 'id': id, 'p': 'SourceType' }) === 0), (id) => new ruleproxy_1.RuleProxy(id, this.client));
|
|
20
26
|
}
|
|
21
27
|
static getNextHookName() {
|
|
22
28
|
return '__documentproxy__hook' + DocumentProxy.nextHookId++;
|
|
@@ -107,6 +113,38 @@ class DocumentProxy extends elementproxy_1.ElementProxy {
|
|
|
107
113
|
this.client.deleteAction(handle);
|
|
108
114
|
this.client.sendCommand("uci" /* CommandName.UnhookCreateItems */, { 'n': handle });
|
|
109
115
|
}
|
|
116
|
+
addRule(definition) {
|
|
117
|
+
let maxOrder = 0;
|
|
118
|
+
for (const rule of this.rules.values()) {
|
|
119
|
+
maxOrder = Math.max(maxOrder, rule.getOrder());
|
|
120
|
+
}
|
|
121
|
+
const properties = {
|
|
122
|
+
'EffectOrder': definition.effects.map((effect, index) => index + 1),
|
|
123
|
+
'SourceType': 0,
|
|
124
|
+
'Name': definition.name,
|
|
125
|
+
'Order': maxOrder + 1,
|
|
126
|
+
};
|
|
127
|
+
let nextConditionIndex = 1;
|
|
128
|
+
let nextEffectIndex = 1;
|
|
129
|
+
for (const effect of definition.effects) {
|
|
130
|
+
const effectKey = 'Effect_' + nextEffectIndex++;
|
|
131
|
+
const conditionOrder = [];
|
|
132
|
+
for (const condition of effect.conditions) {
|
|
133
|
+
conditionOrder.push(nextConditionIndex);
|
|
134
|
+
const conditionKey = 'Condition_' + nextConditionIndex++;
|
|
135
|
+
properties[conditionKey] = (0, ruledefinition_1.serializeConditionDefinition)(condition);
|
|
136
|
+
}
|
|
137
|
+
properties[effectKey] = (0, ruledefinition_1.serializeEffectDefinition)(effect, conditionOrder);
|
|
138
|
+
}
|
|
139
|
+
const id = this.client.sendCommand("cde" /* CommandName.CreateDocumentElement */, {
|
|
140
|
+
't': documentelementtype_1.DocumentElementType.Rule,
|
|
141
|
+
'p': properties,
|
|
142
|
+
});
|
|
143
|
+
if (id === undefined) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
return new ruleproxy_1.RuleProxy(id, this.client);
|
|
147
|
+
}
|
|
110
148
|
/**
|
|
111
149
|
* Watch for new blocks, lines, or groups deleted from this document. The callback will
|
|
112
150
|
* be called with items deleted by the current user, but will not be called with items
|
package/document/pageproxy.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { EditorClient } from '../editorclient';
|
|
|
3
3
|
import { Box } from '../math';
|
|
4
4
|
import { BlockDefinition } from './blockdefinition';
|
|
5
5
|
import { BlockProxy } from './blockproxy';
|
|
6
|
+
import { RuleProxy } from './documentelement/ruleproxy';
|
|
6
7
|
import { ElementProxy } from './elementproxy';
|
|
7
8
|
import { GroupProxy } from './groupproxy';
|
|
8
9
|
import { LineDefinition } from './linedefinition';
|
|
@@ -18,6 +19,18 @@ export declare class PageProxy extends ElementProxy {
|
|
|
18
19
|
* @param client
|
|
19
20
|
*/
|
|
20
21
|
constructor(id: string, client: EditorClient);
|
|
22
|
+
/**
|
|
23
|
+
* @returns All conditional formatting rules that are applied to every item on this page
|
|
24
|
+
*/
|
|
25
|
+
getRulesAppliedToAllItems(): RuleProxy[];
|
|
26
|
+
/**
|
|
27
|
+
* @param rule Rule to apply to all items on this page
|
|
28
|
+
*/
|
|
29
|
+
applyRuleToAllItems(rule: RuleProxy): void;
|
|
30
|
+
/**
|
|
31
|
+
* @param rule Rule to remove from the list applied to all items on this page
|
|
32
|
+
*/
|
|
33
|
+
unapplyRuleToAllItems(rule: RuleProxy): void;
|
|
21
34
|
/**
|
|
22
35
|
* The blocks contained directly on this page, not including ones inside groups
|
|
23
36
|
*/
|
package/document/pageproxy.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PageProxy = void 0;
|
|
4
|
+
const ruleproxy_1 = require("./documentelement/ruleproxy");
|
|
4
5
|
const elementproxy_1 = require("./elementproxy");
|
|
5
6
|
const groupproxy_1 = require("./groupproxy");
|
|
6
7
|
const lineproxy_1 = require("./lineproxy");
|
|
@@ -41,6 +42,32 @@ class PageProxy extends elementproxy_1.ElementProxy {
|
|
|
41
42
|
*/
|
|
42
43
|
this.allGroups = new mapproxy_1.MapProxy(() => this.client.sendCommand("lg" /* CommandName.ListGroups */, { id: this.id, d: true }), (id) => new groupproxy_1.GroupProxy(id, this.client));
|
|
43
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* @returns All conditional formatting rules that are applied to every item on this page
|
|
47
|
+
*/
|
|
48
|
+
getRulesAppliedToAllItems() {
|
|
49
|
+
const ids = this.properties.get('ChildRuleList');
|
|
50
|
+
return ids.map((id) => new ruleproxy_1.RuleProxy(id, this.client));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @param rule Rule to apply to all items on this page
|
|
54
|
+
*/
|
|
55
|
+
applyRuleToAllItems(rule) {
|
|
56
|
+
const ids = this.properties.get('ChildRuleList');
|
|
57
|
+
if (!ids.includes(rule.id)) {
|
|
58
|
+
ids.push(rule.id);
|
|
59
|
+
this.properties.set('ChildRuleList', ids);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @param rule Rule to remove from the list applied to all items on this page
|
|
64
|
+
*/
|
|
65
|
+
unapplyRuleToAllItems(rule) {
|
|
66
|
+
const ids = this.properties.get('ChildRuleList');
|
|
67
|
+
if (ids.includes(rule.id)) {
|
|
68
|
+
this.properties.set('ChildRuleList', ids.filter((id) => id !== rule.id));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
44
71
|
/**
|
|
45
72
|
* Add a new block to this page.
|
|
46
73
|
*
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { BadgeEnumPosition } from '../core/properties/datagraphic/badgeposition';
|
|
2
|
+
import { DataGraphicIconSets } from '../core/properties/datagraphic/datagraphicindexes';
|
|
3
|
+
import { StrokeStyle } from '../core/properties/strokestyle';
|
|
4
|
+
import { ConditionCombination, ShapeDataConditions, TextConditions } from '../core/rules/conditions';
|
|
5
|
+
import { ConditionType } from '../core/rules/conditiontype';
|
|
6
|
+
import { ConditionValueType, SerializedCondition } from '../core/rules/serializedcondition';
|
|
7
|
+
import { RuleFormattingType, SerializedEffect } from '../core/rules/serializedeffect';
|
|
8
|
+
export interface BaseConditionDefinition {
|
|
9
|
+
/** What kind of condition is this? e.g. a formula evaluation, checking for non-empty text, etc. */
|
|
10
|
+
type: ConditionType;
|
|
11
|
+
}
|
|
12
|
+
export interface FormulaConditionDefinition extends BaseConditionDefinition {
|
|
13
|
+
type: ConditionType.Formula;
|
|
14
|
+
/** The formula string */
|
|
15
|
+
formula: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ShapeDataConditionDefinition extends BaseConditionDefinition {
|
|
18
|
+
type: ConditionType.ShapeData;
|
|
19
|
+
condition: ShapeDataConditions;
|
|
20
|
+
/**
|
|
21
|
+
* The value against which the condition is tested. For example, a condition with
|
|
22
|
+
* type = ConditionType.ShapeData
|
|
23
|
+
* condition = ShapeDataConditions.GreaterThan
|
|
24
|
+
* field = 'TheField'
|
|
25
|
+
* value = 14
|
|
26
|
+
*
|
|
27
|
+
* will trigger when the shape data field "TheField" has a value that is greater than 14.
|
|
28
|
+
*/
|
|
29
|
+
value?: ConditionValueType;
|
|
30
|
+
/** The name of the shape data field to test */
|
|
31
|
+
field: string | undefined;
|
|
32
|
+
/** The name to display to the end user to identify the field name */
|
|
33
|
+
fieldLabel?: string | undefined;
|
|
34
|
+
}
|
|
35
|
+
export interface TextConditionDefinition extends BaseConditionDefinition {
|
|
36
|
+
type: ConditionType.Text;
|
|
37
|
+
condition: TextConditions;
|
|
38
|
+
/**
|
|
39
|
+
* The value against which the condition is tested. For example, a condition with
|
|
40
|
+
* type = ConditionType.ShapeData
|
|
41
|
+
* condition = ShapeDataConditions.GreaterThan
|
|
42
|
+
* field = 'TheField'
|
|
43
|
+
* value = 14
|
|
44
|
+
*
|
|
45
|
+
* will trigger when the shape data field "TheField" has a value that is greater than 14.
|
|
46
|
+
*/
|
|
47
|
+
value?: ConditionValueType;
|
|
48
|
+
}
|
|
49
|
+
export declare type ConditionDefinition = FormulaConditionDefinition | ShapeDataConditionDefinition | TextConditionDefinition;
|
|
50
|
+
export interface BaseEffectDefinition {
|
|
51
|
+
conditions: ConditionDefinition[];
|
|
52
|
+
/** How multiple conditions are combined (AND vs OR) */
|
|
53
|
+
combination: ConditionCombination;
|
|
54
|
+
tooltip?: string | undefined;
|
|
55
|
+
}
|
|
56
|
+
export interface FormattingEffectDefinition extends BaseEffectDefinition {
|
|
57
|
+
formatType: RuleFormattingType.FORMATTING;
|
|
58
|
+
formatting: {
|
|
59
|
+
/** If specified, the color to use for affected block fills */
|
|
60
|
+
fillColor?: string;
|
|
61
|
+
/** If specified, the color to use for affected block borders */
|
|
62
|
+
borderColor?: string;
|
|
63
|
+
/** If specified, the width to use for affected block borders */
|
|
64
|
+
borderWidth?: number;
|
|
65
|
+
/** If specified, the style to use for affected block borders */
|
|
66
|
+
borderStyle?: StrokeStyle;
|
|
67
|
+
/** If specified, the color to use for affected lines */
|
|
68
|
+
lineColor?: string;
|
|
69
|
+
/** If specified, the width to use for affected lines */
|
|
70
|
+
lineWidth?: number;
|
|
71
|
+
/** If specified, the style to use for affected lines */
|
|
72
|
+
lineStyle?: StrokeStyle;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export interface DataGraphicEffectDefinition extends BaseEffectDefinition {
|
|
76
|
+
formatType: RuleFormattingType.DATA_GRAPHICS;
|
|
77
|
+
dataGraphic: {
|
|
78
|
+
set: Exclude<DataGraphicIconSets, DataGraphicIconSets.CUSTOM_ICONS>;
|
|
79
|
+
index: number;
|
|
80
|
+
position: BadgeEnumPosition;
|
|
81
|
+
color?: string;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export interface CustomIconEffectDefinition extends BaseEffectDefinition {
|
|
85
|
+
formatType: RuleFormattingType.DATA_GRAPHICS;
|
|
86
|
+
dataGraphic: {
|
|
87
|
+
set: DataGraphicIconSets.CUSTOM_ICONS;
|
|
88
|
+
position: BadgeEnumPosition;
|
|
89
|
+
image: {
|
|
90
|
+
url: string;
|
|
91
|
+
width: number;
|
|
92
|
+
height: number;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export declare type EffectDefinition = FormattingEffectDefinition | DataGraphicEffectDefinition | CustomIconEffectDefinition;
|
|
97
|
+
export interface RuleDefinition {
|
|
98
|
+
/** User-readable name of this conditional formatting rule */
|
|
99
|
+
name: string;
|
|
100
|
+
/**
|
|
101
|
+
* The possible visual effects of this conditional formatting rule,
|
|
102
|
+
* in priority order. The first effect whose conditions are met is used.
|
|
103
|
+
*/
|
|
104
|
+
effects: EffectDefinition[];
|
|
105
|
+
}
|
|
106
|
+
/** @ignore */
|
|
107
|
+
export declare function serializeConditionDefinition(condition: ConditionDefinition): SerializedCondition;
|
|
108
|
+
/** @ignore */
|
|
109
|
+
export declare function serializeEffectDefinition(effect: EffectDefinition, conditionOrder: number[]): SerializedEffect;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeEffectDefinition = exports.serializeConditionDefinition = void 0;
|
|
4
|
+
const badgeposition_1 = require("../core/properties/datagraphic/badgeposition");
|
|
5
|
+
const datagraphicindexes_1 = require("../core/properties/datagraphic/datagraphicindexes");
|
|
6
|
+
const conditiontype_1 = require("../core/rules/conditiontype");
|
|
7
|
+
const serializedeffect_1 = require("../core/rules/serializedeffect");
|
|
8
|
+
/** @ignore */
|
|
9
|
+
function serializeConditionDefinition(condition) {
|
|
10
|
+
return Object.assign({ 'Type': condition.type, 'Source': 'this', 'Condition': 0 }, (condition.type === conditiontype_1.ConditionType.Formula
|
|
11
|
+
? {
|
|
12
|
+
'Value': condition.formula,
|
|
13
|
+
}
|
|
14
|
+
: condition.type === conditiontype_1.ConditionType.Text
|
|
15
|
+
? {
|
|
16
|
+
'Condition': condition.condition,
|
|
17
|
+
'Value': condition.value,
|
|
18
|
+
}
|
|
19
|
+
: condition.type === conditiontype_1.ConditionType.ShapeData
|
|
20
|
+
? {
|
|
21
|
+
'Condition': condition.condition,
|
|
22
|
+
'Value': condition.value,
|
|
23
|
+
'Label': condition.field,
|
|
24
|
+
'DisplayLabel': condition.fieldLabel,
|
|
25
|
+
}
|
|
26
|
+
: {}));
|
|
27
|
+
}
|
|
28
|
+
exports.serializeConditionDefinition = serializeConditionDefinition;
|
|
29
|
+
/** @ignore */
|
|
30
|
+
function serializeEffectDefinition(effect, conditionOrder) {
|
|
31
|
+
var _a;
|
|
32
|
+
return {
|
|
33
|
+
'ConditionOrder': conditionOrder,
|
|
34
|
+
'Combination': effect.combination,
|
|
35
|
+
'FormatType': effect.formatType,
|
|
36
|
+
'Formatting': effect.formatType === serializedeffect_1.RuleFormattingType.FORMATTING
|
|
37
|
+
? {
|
|
38
|
+
'Block': {
|
|
39
|
+
'FillColor': JSON.stringify(effect.formatting.fillColor),
|
|
40
|
+
'LineColor': JSON.stringify(effect.formatting.borderColor),
|
|
41
|
+
'LineWidth': JSON.stringify(effect.formatting.borderWidth),
|
|
42
|
+
'StrokeStyle': JSON.stringify(effect.formatting.borderStyle),
|
|
43
|
+
},
|
|
44
|
+
'Line': {
|
|
45
|
+
'LineColor': JSON.stringify(effect.formatting.lineColor),
|
|
46
|
+
'LineWidth': JSON.stringify(effect.formatting.lineWidth),
|
|
47
|
+
'StrokeStyle': JSON.stringify(effect.formatting.lineStyle),
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
: {},
|
|
51
|
+
'DataGraphic': effect.formatType === serializedeffect_1.RuleFormattingType.DATA_GRAPHICS
|
|
52
|
+
? effect.dataGraphic.set === datagraphicindexes_1.DataGraphicIconSets.CUSTOM_ICONS
|
|
53
|
+
? {
|
|
54
|
+
'Set': effect.dataGraphic.set,
|
|
55
|
+
'Index': 0,
|
|
56
|
+
'Position': (0, badgeposition_1.serializeBadgeEnumPosition)(effect.dataGraphic.position),
|
|
57
|
+
'Image': {
|
|
58
|
+
'url': effect.dataGraphic.image.url,
|
|
59
|
+
'w': effect.dataGraphic.image.width,
|
|
60
|
+
'h': effect.dataGraphic.image.height,
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
: {
|
|
64
|
+
'Set': effect.dataGraphic.set,
|
|
65
|
+
'Index': (_a = effect.dataGraphic.index) !== null && _a !== void 0 ? _a : 0,
|
|
66
|
+
'Position': (0, badgeposition_1.serializeBadgeEnumPosition)(effect.dataGraphic.position),
|
|
67
|
+
'Color': effect.dataGraphic.color,
|
|
68
|
+
}
|
|
69
|
+
: undefined,
|
|
70
|
+
'Tooltip': effect.tooltip,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
exports.serializeEffectDefinition = serializeEffectDefinition;
|
package/editorclient.d.ts
CHANGED
|
@@ -221,6 +221,18 @@ export declare class EditorClient {
|
|
|
221
221
|
* @returns a promise that resolves when the block classes can be used to create new blocks on the document
|
|
222
222
|
*/
|
|
223
223
|
loadBlockClasses(classNames: string[]): Promise<undefined>;
|
|
224
|
+
/**
|
|
225
|
+
* Import one or pages of the specified document or template into the current document
|
|
226
|
+
* as new pages.
|
|
227
|
+
* NOTE: The indices of the pages to import will change if the pages are rearranged
|
|
228
|
+
* on the source document or template.
|
|
229
|
+
*
|
|
230
|
+
* @param documentId The ID of the document or template to import
|
|
231
|
+
* @param pageNums An array of zero-indexed page indices to import from the document or template
|
|
232
|
+
* @returns a promise that resolves to void when the pages have been imported or the
|
|
233
|
+
* the import failed
|
|
234
|
+
*/
|
|
235
|
+
importPage(documentId: string, pageNums: number[]): Promise<void>;
|
|
224
236
|
/**
|
|
225
237
|
* Load the requested shape library's content, and if it was found, return a block definition ready to be
|
|
226
238
|
* created.
|
package/editorclient.js
CHANGED
|
@@ -373,6 +373,20 @@ class EditorClient {
|
|
|
373
373
|
loadBlockClasses(classNames) {
|
|
374
374
|
return this.sendCommand("lbc" /* CommandName.LoadBlockClasses */, classNames);
|
|
375
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* Import one or pages of the specified document or template into the current document
|
|
378
|
+
* as new pages.
|
|
379
|
+
* NOTE: The indices of the pages to import will change if the pages are rearranged
|
|
380
|
+
* on the source document or template.
|
|
381
|
+
*
|
|
382
|
+
* @param documentId The ID of the document or template to import
|
|
383
|
+
* @param pageNums An array of zero-indexed page indices to import from the document or template
|
|
384
|
+
* @returns a promise that resolves to void when the pages have been imported or the
|
|
385
|
+
* the import failed
|
|
386
|
+
*/
|
|
387
|
+
async importPage(documentId, pageNums) {
|
|
388
|
+
return await this.sendCommand("imp" /* CommandName.ImportPage */, { 'id': documentId, 'n': pageNums });
|
|
389
|
+
}
|
|
376
390
|
/**
|
|
377
391
|
* Load the requested shape library's content, and if it was found, return a block definition ready to be
|
|
378
392
|
* created.
|
package/index.d.ts
CHANGED
|
@@ -42,6 +42,10 @@ export * from './core/properties/datagraphic/datagraphicindexes';
|
|
|
42
42
|
export * from './core/properties/datagraphic/staticdatagraphicsettings';
|
|
43
43
|
export * from './core/properties/fillcolor';
|
|
44
44
|
export * from './core/properties/shadow';
|
|
45
|
+
export * from './core/properties/strokestyle';
|
|
46
|
+
export * from './core/rules/conditions';
|
|
47
|
+
export * from './core/rules/conditiontype';
|
|
48
|
+
export * from './core/rules/serializedeffect';
|
|
45
49
|
export * from './core/serializeddataerror';
|
|
46
50
|
export * from './core/shapedatainheritance';
|
|
47
51
|
export * from './core/spreadsheetintegration/lucidspreadsheetintegration';
|
package/index.js
CHANGED
|
@@ -58,6 +58,10 @@ __exportStar(require("./core/properties/datagraphic/datagraphicindexes"), export
|
|
|
58
58
|
__exportStar(require("./core/properties/datagraphic/staticdatagraphicsettings"), exports);
|
|
59
59
|
__exportStar(require("./core/properties/fillcolor"), exports);
|
|
60
60
|
__exportStar(require("./core/properties/shadow"), exports);
|
|
61
|
+
__exportStar(require("./core/properties/strokestyle"), exports);
|
|
62
|
+
__exportStar(require("./core/rules/conditions"), exports);
|
|
63
|
+
__exportStar(require("./core/rules/conditiontype"), exports);
|
|
64
|
+
__exportStar(require("./core/rules/serializedeffect"), exports);
|
|
61
65
|
__exportStar(require("./core/serializeddataerror"), exports);
|
|
62
66
|
__exportStar(require("./core/shapedatainheritance"), exports);
|
|
63
67
|
__exportStar(require("./core/spreadsheetintegration/lucidspreadsheetintegration"), exports);
|