lucid-extension-sdk 0.0.26 → 0.0.29
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/package.json +1 -1
- package/sdk/commandtypes.d.ts +16 -0
- package/sdk/commandtypes.js +1 -0
- package/sdk/core/data/fieldtypedefinition/fieldtypearray.d.ts +7 -6
- package/sdk/core/data/fieldtypedefinition/fieldtypearray.js +8 -1
- package/sdk/core/properties/cardintegration.d.ts +85 -0
- package/sdk/core/properties/cardintegration.js +72 -0
- package/sdk/document/taskmanagementcardintegration.d.ts +13 -0
- package/sdk/document/taskmanagementcardintegration.js +39 -0
- package/sdk/ui/panel.d.ts +3 -1
- package/sdk/ui/panel.js +2 -0
package/package.json
CHANGED
package/sdk/commandtypes.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { PanelLocation } from './ui/panel';
|
|
|
17
17
|
* To use these directly, use [EditorClient.sendCommand](#classes_editorclient-EditorClient_sendcommand).
|
|
18
18
|
*/
|
|
19
19
|
export declare const enum CommandName {
|
|
20
|
+
AddCardIntegration = "aci",
|
|
20
21
|
AddLineTextArea = "alta",
|
|
21
22
|
AddMenuItem = "ami",
|
|
22
23
|
AddShapeData = "asd",
|
|
@@ -97,6 +98,10 @@ export declare const commandTitles: Map<CommandName, string>;
|
|
|
97
98
|
* which command name you pass in as the first parameter.
|
|
98
99
|
*/
|
|
99
100
|
export declare type CommandArgs = {
|
|
101
|
+
[CommandName.AddCardIntegration]: {
|
|
102
|
+
query: AddCardIntegrationQuery;
|
|
103
|
+
result: AddCardIntegrationResult;
|
|
104
|
+
};
|
|
100
105
|
[CommandName.AddLineTextArea]: {
|
|
101
106
|
query: AddLineTextAreaQuery;
|
|
102
107
|
result: AddLineTextAreaResult;
|
|
@@ -382,6 +387,17 @@ export declare type CommandArgs = {
|
|
|
382
387
|
result: UnhookTextEditResult;
|
|
383
388
|
};
|
|
384
389
|
};
|
|
390
|
+
export declare type AddCardIntegrationQuery = {
|
|
391
|
+
/** Title/name */
|
|
392
|
+
'n': string;
|
|
393
|
+
/** Icon url */
|
|
394
|
+
'u': string;
|
|
395
|
+
/** Callback to get field definitions for a given imported collection */
|
|
396
|
+
'gf': string;
|
|
397
|
+
/** Show intro if user has not yet authorized this integration */
|
|
398
|
+
'i'?: string;
|
|
399
|
+
};
|
|
400
|
+
export declare type AddCardIntegrationResult = undefined;
|
|
385
401
|
export declare type AddLineTextAreaQuery = {
|
|
386
402
|
/** Which line */
|
|
387
403
|
'id': string;
|
package/sdk/commandtypes.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.isRawSendXHRResponse = exports.commandTitles = void 0;
|
|
|
4
4
|
const checks_1 = require("./core/checks");
|
|
5
5
|
/** @ignore */
|
|
6
6
|
exports.commandTitles = new Map([
|
|
7
|
+
["aci" /* AddCardIntegration */, 'AddCardIntegration'],
|
|
7
8
|
["alta" /* AddLineTextArea */, 'AddLineTextArea'],
|
|
8
9
|
["ami" /* AddMenuItem */, 'AddMenuItem'],
|
|
9
10
|
["asd" /* AddShapeData */, 'AddShapeData'],
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { CollectionEnumFieldType, SerializedCollectionEnumFieldType } from './collectionenumfieldtype';
|
|
1
2
|
import { LiteralFieldType, SerializedLiteralFieldType } from './literalfieldtype';
|
|
2
3
|
import { ScalarFieldTypeEnum } from './scalarfieldtype';
|
|
3
4
|
export declare class FieldTypeArray {
|
|
4
|
-
readonly validTypesArray: (ScalarFieldTypeEnum | LiteralFieldType | FieldTypeArray)[];
|
|
5
|
-
constructor(validTypesArray: (ScalarFieldTypeEnum | LiteralFieldType | FieldTypeArray)[]);
|
|
6
|
-
getInnerTypes(): (ScalarFieldTypeEnum | LiteralFieldType | FieldTypeArray)[];
|
|
7
|
-
getInnerNonArrayTypes(): (ScalarFieldTypeEnum | LiteralFieldType | FieldTypeArray)[];
|
|
5
|
+
readonly validTypesArray: (ScalarFieldTypeEnum | CollectionEnumFieldType | LiteralFieldType | FieldTypeArray)[];
|
|
6
|
+
constructor(validTypesArray: (ScalarFieldTypeEnum | CollectionEnumFieldType | LiteralFieldType | FieldTypeArray)[]);
|
|
7
|
+
getInnerTypes(): (CollectionEnumFieldType | ScalarFieldTypeEnum | LiteralFieldType | FieldTypeArray)[];
|
|
8
|
+
getInnerNonArrayTypes(): (CollectionEnumFieldType | ScalarFieldTypeEnum | LiteralFieldType | FieldTypeArray)[];
|
|
8
9
|
serialize(): SerializedFieldTypeArray;
|
|
9
10
|
}
|
|
10
|
-
export declare function isValidTypeForFieldTypeArray(fieldType: any): fieldType is ScalarFieldTypeEnum | LiteralFieldType | FieldTypeArray;
|
|
11
|
+
export declare function isValidTypeForFieldTypeArray(fieldType: any): fieldType is ScalarFieldTypeEnum | LiteralFieldType | CollectionEnumFieldType | FieldTypeArray;
|
|
11
12
|
export declare type SerializedFieldTypeArray = {
|
|
12
13
|
'ND': false;
|
|
13
|
-
'validTypes': (ScalarFieldTypeEnum | SerializedLiteralFieldType | SerializedFieldTypeArray)[];
|
|
14
|
+
'validTypes': (ScalarFieldTypeEnum | SerializedLiteralFieldType | SerializedFieldTypeArray | SerializedCollectionEnumFieldType)[];
|
|
14
15
|
};
|
|
15
16
|
export declare function isSerializedFieldTypeArray(fieldType: any, validateTypeCheck: (t: unknown) => boolean): fieldType is SerializedFieldTypeArray;
|
|
16
17
|
export declare function deserializeFieldTypeArray(serializedFieldTypeArray: SerializedFieldTypeArray): FieldTypeArray;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deserializeFieldTypeArray = exports.isSerializedFieldTypeArray = exports.isValidTypeForFieldTypeArray = exports.FieldTypeArray = void 0;
|
|
4
4
|
const checks_1 = require("../../checks");
|
|
5
|
+
const collectionenumfieldtype_1 = require("./collectionenumfieldtype");
|
|
5
6
|
const literalfieldtype_1 = require("./literalfieldtype");
|
|
6
7
|
const scalarfieldtype_1 = require("./scalarfieldtype");
|
|
7
8
|
class FieldTypeArray {
|
|
@@ -23,7 +24,10 @@ class FieldTypeArray {
|
|
|
23
24
|
}
|
|
24
25
|
exports.FieldTypeArray = FieldTypeArray;
|
|
25
26
|
function isValidTypeForFieldTypeArray(fieldType) {
|
|
26
|
-
return (0, scalarfieldtype_1.isScalarFieldTypeEnum)(fieldType) ||
|
|
27
|
+
return ((0, scalarfieldtype_1.isScalarFieldTypeEnum)(fieldType) ||
|
|
28
|
+
(0, literalfieldtype_1.isLiteralFieldType)(fieldType) ||
|
|
29
|
+
(0, collectionenumfieldtype_1.isCollectionEnumFieldType)(fieldType) ||
|
|
30
|
+
fieldType instanceof FieldTypeArray);
|
|
27
31
|
}
|
|
28
32
|
exports.isValidTypeForFieldTypeArray = isValidTypeForFieldTypeArray;
|
|
29
33
|
function isSerializedFieldTypeArray(fieldType, validateTypeCheck) {
|
|
@@ -41,6 +45,9 @@ function deserializeFieldTypeArray(serializedFieldTypeArray) {
|
|
|
41
45
|
if ((0, literalfieldtype_1.isSerializedLiteralFieldType)(t)) {
|
|
42
46
|
return (0, literalfieldtype_1.deserializeLiteralFieldType)(t);
|
|
43
47
|
}
|
|
48
|
+
else if ((0, collectionenumfieldtype_1.isSerializedCollectionEnumFieldType)(t)) {
|
|
49
|
+
return (0, collectionenumfieldtype_1.deserializeCollectionEnumFieldType)(t);
|
|
50
|
+
}
|
|
44
51
|
else if ((0, checks_1.isObject)(t)) {
|
|
45
52
|
return deserializeFieldTypeArray(t);
|
|
46
53
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { CollectionProxy } from '../../data/collectionproxy';
|
|
2
|
+
/**
|
|
3
|
+
* When this field is displayed on a card shape, how should it be displayed?
|
|
4
|
+
*/
|
|
5
|
+
export declare enum CardFieldDisplayType {
|
|
6
|
+
Text = 1,
|
|
7
|
+
TextBadge = 2,
|
|
8
|
+
ImageBadge = 3
|
|
9
|
+
}
|
|
10
|
+
export declare enum CardFieldDataType {
|
|
11
|
+
Text = 1,
|
|
12
|
+
Number = 2,
|
|
13
|
+
/** An enumerated list of options, stored as a string */
|
|
14
|
+
Option = 3,
|
|
15
|
+
Checkbox = 4
|
|
16
|
+
}
|
|
17
|
+
/** For fields with Option or ApiOption type, the label and value for each available option */
|
|
18
|
+
export interface ExtensionCardFieldOption {
|
|
19
|
+
label: string;
|
|
20
|
+
value: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ExtensionCardFieldDefinition {
|
|
23
|
+
/** Data identifier */
|
|
24
|
+
fieldName: string;
|
|
25
|
+
/** The text to display on the menu item */
|
|
26
|
+
label: string;
|
|
27
|
+
/** Additional information we can provide to users */
|
|
28
|
+
description?: string;
|
|
29
|
+
/** How a field is displayed */
|
|
30
|
+
displayType: CardFieldDisplayType;
|
|
31
|
+
/** Data type backing the field */
|
|
32
|
+
dataType: CardFieldDataType;
|
|
33
|
+
/** If dataType is Option, the list of options available to choose from */
|
|
34
|
+
options?: ExtensionCardFieldOption[];
|
|
35
|
+
}
|
|
36
|
+
/** @ignore */
|
|
37
|
+
export declare type SerializedCardFieldOption = {
|
|
38
|
+
'l': string;
|
|
39
|
+
'v': string;
|
|
40
|
+
};
|
|
41
|
+
/** @ignore */
|
|
42
|
+
export declare function serializeCardFieldOption(option: ExtensionCardFieldOption): SerializedCardFieldOption;
|
|
43
|
+
/** @ignore */
|
|
44
|
+
export declare type SerializedExtensionCardFieldDefinition = {
|
|
45
|
+
'n': string;
|
|
46
|
+
't': string;
|
|
47
|
+
'd'?: string;
|
|
48
|
+
'diT': number;
|
|
49
|
+
'daT': number;
|
|
50
|
+
'op'?: SerializedCardFieldOption[];
|
|
51
|
+
};
|
|
52
|
+
/** @ignore */
|
|
53
|
+
export declare function serializeCardFieldDefinition(field: ExtensionCardFieldDefinition): SerializedExtensionCardFieldDefinition;
|
|
54
|
+
/** @ignore */
|
|
55
|
+
export declare function serializeCardFieldArrayDefinition(fields: ExtensionCardFieldDefinition[]): SerializedExtensionCardFieldDefinition[];
|
|
56
|
+
/** @ignore */
|
|
57
|
+
export declare function deseializeFieldOption(option: SerializedCardFieldOption): ExtensionCardFieldOption;
|
|
58
|
+
/** @ignore */
|
|
59
|
+
export declare function deserializeCardFieldDefinition(field: SerializedExtensionCardFieldDefinition): ExtensionCardFieldDefinition;
|
|
60
|
+
/** @ignore */
|
|
61
|
+
export declare function deserializeCardFieldArrayDefinition(fields: SerializedExtensionCardFieldDefinition[]): ExtensionCardFieldDefinition[];
|
|
62
|
+
export interface CardIntegration {
|
|
63
|
+
/**
|
|
64
|
+
* Label used to identify the integration, e.g. "Jira", which will be used in menu items, etc.
|
|
65
|
+
* Should be unique within any given extension.
|
|
66
|
+
*/
|
|
67
|
+
label: string;
|
|
68
|
+
/**
|
|
69
|
+
* URL for an icon to display in toolbars, etc. Should be at least 24x24.
|
|
70
|
+
*/
|
|
71
|
+
iconUrl: string;
|
|
72
|
+
/**
|
|
73
|
+
* Callback to provide a list of field definitions for the given collection, if that collection
|
|
74
|
+
* was imported as part of this card integration.
|
|
75
|
+
*
|
|
76
|
+
* Any fields on the schema of the collection that you don't provide a ExtensionCardFieldDefinition
|
|
77
|
+
* for will have a default definition generated based on the type specified in the schema.
|
|
78
|
+
*/
|
|
79
|
+
getAllFields: (collection: CollectionProxy) => Promise<ExtensionCardFieldDefinition[]>;
|
|
80
|
+
/**
|
|
81
|
+
* If specified, and the user hasn't yet authorized the data connector for this extension,
|
|
82
|
+
* this should show the user an intro dialog or take some other action.
|
|
83
|
+
*/
|
|
84
|
+
showIntro?: () => void;
|
|
85
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeCardFieldArrayDefinition = exports.deserializeCardFieldDefinition = exports.deseializeFieldOption = exports.serializeCardFieldArrayDefinition = exports.serializeCardFieldDefinition = exports.serializeCardFieldOption = exports.CardFieldDataType = exports.CardFieldDisplayType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* When this field is displayed on a card shape, how should it be displayed?
|
|
6
|
+
*/
|
|
7
|
+
var CardFieldDisplayType;
|
|
8
|
+
(function (CardFieldDisplayType) {
|
|
9
|
+
CardFieldDisplayType[CardFieldDisplayType["Text"] = 1] = "Text";
|
|
10
|
+
CardFieldDisplayType[CardFieldDisplayType["TextBadge"] = 2] = "TextBadge";
|
|
11
|
+
CardFieldDisplayType[CardFieldDisplayType["ImageBadge"] = 3] = "ImageBadge";
|
|
12
|
+
})(CardFieldDisplayType = exports.CardFieldDisplayType || (exports.CardFieldDisplayType = {}));
|
|
13
|
+
var CardFieldDataType;
|
|
14
|
+
(function (CardFieldDataType) {
|
|
15
|
+
CardFieldDataType[CardFieldDataType["Text"] = 1] = "Text";
|
|
16
|
+
CardFieldDataType[CardFieldDataType["Number"] = 2] = "Number";
|
|
17
|
+
/** An enumerated list of options, stored as a string */
|
|
18
|
+
CardFieldDataType[CardFieldDataType["Option"] = 3] = "Option";
|
|
19
|
+
CardFieldDataType[CardFieldDataType["Checkbox"] = 4] = "Checkbox";
|
|
20
|
+
})(CardFieldDataType = exports.CardFieldDataType || (exports.CardFieldDataType = {}));
|
|
21
|
+
/** @ignore */
|
|
22
|
+
function serializeCardFieldOption(option) {
|
|
23
|
+
return {
|
|
24
|
+
'l': option.label,
|
|
25
|
+
'v': option.value,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.serializeCardFieldOption = serializeCardFieldOption;
|
|
29
|
+
/** @ignore */
|
|
30
|
+
function serializeCardFieldDefinition(field) {
|
|
31
|
+
var _a;
|
|
32
|
+
return {
|
|
33
|
+
'n': field.fieldName,
|
|
34
|
+
't': field.label,
|
|
35
|
+
'd': field.description,
|
|
36
|
+
'diT': field.displayType,
|
|
37
|
+
'daT': field.dataType,
|
|
38
|
+
'op': (_a = field.options) === null || _a === void 0 ? void 0 : _a.map(serializeCardFieldOption),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
exports.serializeCardFieldDefinition = serializeCardFieldDefinition;
|
|
42
|
+
/** @ignore */
|
|
43
|
+
function serializeCardFieldArrayDefinition(fields) {
|
|
44
|
+
return fields.map(serializeCardFieldDefinition);
|
|
45
|
+
}
|
|
46
|
+
exports.serializeCardFieldArrayDefinition = serializeCardFieldArrayDefinition;
|
|
47
|
+
/** @ignore */
|
|
48
|
+
function deseializeFieldOption(option) {
|
|
49
|
+
return {
|
|
50
|
+
label: option['l'],
|
|
51
|
+
value: option['v'],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
exports.deseializeFieldOption = deseializeFieldOption;
|
|
55
|
+
/** @ignore */
|
|
56
|
+
function deserializeCardFieldDefinition(field) {
|
|
57
|
+
var _a;
|
|
58
|
+
return {
|
|
59
|
+
fieldName: field['n'],
|
|
60
|
+
label: field['t'],
|
|
61
|
+
description: field['d'],
|
|
62
|
+
displayType: field['diT'],
|
|
63
|
+
dataType: field['daT'],
|
|
64
|
+
options: (_a = field['op']) === null || _a === void 0 ? void 0 : _a.map(deseializeFieldOption),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
exports.deserializeCardFieldDefinition = deserializeCardFieldDefinition;
|
|
68
|
+
/** @ignore */
|
|
69
|
+
function deserializeCardFieldArrayDefinition(fields) {
|
|
70
|
+
return fields.map(deserializeCardFieldDefinition);
|
|
71
|
+
}
|
|
72
|
+
exports.deserializeCardFieldArrayDefinition = deserializeCardFieldArrayDefinition;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CardIntegration } from '../core/properties/cardintegration';
|
|
2
|
+
import { EditorClient } from '../editorclient';
|
|
3
|
+
export declare class TaskManagementCardIntegration {
|
|
4
|
+
private readonly client;
|
|
5
|
+
constructor(client: EditorClient);
|
|
6
|
+
private static nextHookId;
|
|
7
|
+
private static nextHookName;
|
|
8
|
+
/**
|
|
9
|
+
* Register a new card integration.
|
|
10
|
+
* @param card The definition of the new card integration
|
|
11
|
+
*/
|
|
12
|
+
addCardIntegration(card: CardIntegration): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaskManagementCardIntegration = void 0;
|
|
4
|
+
const cardintegration_1 = require("../core/properties/cardintegration");
|
|
5
|
+
const collectionproxy_1 = require("../data/collectionproxy");
|
|
6
|
+
class TaskManagementCardIntegration {
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
static nextHookName() {
|
|
11
|
+
return '__taskmanagementcard__hook' + TaskManagementCardIntegration.nextHookId++;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Register a new card integration.
|
|
15
|
+
* @param card The definition of the new card integration
|
|
16
|
+
*/
|
|
17
|
+
addCardIntegration(card) {
|
|
18
|
+
const getFieldsActionName = TaskManagementCardIntegration.nextHookName();
|
|
19
|
+
this.client.registerAction(getFieldsActionName, async (param) => {
|
|
20
|
+
const collection = new collectionproxy_1.CollectionProxy(param['c'], this.client);
|
|
21
|
+
const fields = await card.getAllFields(collection);
|
|
22
|
+
const serializedFields = (0, cardintegration_1.serializeCardFieldArrayDefinition)(fields);
|
|
23
|
+
return serializedFields;
|
|
24
|
+
});
|
|
25
|
+
let showIntroActionName = undefined;
|
|
26
|
+
if (card.showIntro) {
|
|
27
|
+
showIntroActionName = TaskManagementCardIntegration.nextHookName();
|
|
28
|
+
this.client.registerAction(showIntroActionName, card.showIntro);
|
|
29
|
+
}
|
|
30
|
+
this.client.sendCommand("aci" /* AddCardIntegration */, {
|
|
31
|
+
'n': card.label,
|
|
32
|
+
'u': card.iconUrl,
|
|
33
|
+
'gf': getFieldsActionName,
|
|
34
|
+
'i': showIntroActionName,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.TaskManagementCardIntegration = TaskManagementCardIntegration;
|
|
39
|
+
TaskManagementCardIntegration.nextHookId = 0;
|
package/sdk/ui/panel.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ import { IframeUI } from './iframeui';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare enum PanelLocation {
|
|
7
7
|
/** In Lucidchart, create a sibling to the Contextual Panel */
|
|
8
|
-
RightDock = 1
|
|
8
|
+
RightDock = 1,
|
|
9
|
+
/** In Lucidchart, create a sibling to the shape toolbox */
|
|
10
|
+
ContentDock = 2
|
|
9
11
|
}
|
|
10
12
|
export interface PanelConfig {
|
|
11
13
|
/** Title to display at the top of the panel */
|
package/sdk/ui/panel.js
CHANGED
|
@@ -9,6 +9,8 @@ var PanelLocation;
|
|
|
9
9
|
(function (PanelLocation) {
|
|
10
10
|
/** In Lucidchart, create a sibling to the Contextual Panel */
|
|
11
11
|
PanelLocation[PanelLocation["RightDock"] = 1] = "RightDock";
|
|
12
|
+
/** In Lucidchart, create a sibling to the shape toolbox */
|
|
13
|
+
PanelLocation[PanelLocation["ContentDock"] = 2] = "ContentDock";
|
|
12
14
|
})(PanelLocation = exports.PanelLocation || (exports.PanelLocation = {}));
|
|
13
15
|
/**
|
|
14
16
|
* Extend this class to show a custom panel to the user, whose contents are displayed in a sandboxed
|