lucid-extension-sdk 0.0.58 → 0.0.60
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 +9 -2
- package/sdk/core/cardintegration/cardintegration.d.ts +17 -6
- package/sdk/core/cardintegration/cardintegrationconfig.d.ts +40 -15
- package/sdk/core/cardintegration/cardintegrationconfig.js +36 -13
- package/sdk/core/data/fieldtypedefinition/semantickind.d.ts +1 -0
- package/sdk/core/data/fieldtypedefinition/semantickind.js +3 -1
- package/sdk/data/datasourceproxy.d.ts +1 -1
- package/sdk/data/datasourceproxy.js +1 -1
- package/sdk/document/taskmanagementcardintegration.js +16 -2
package/package.json
CHANGED
package/sdk/commandtypes.d.ts
CHANGED
|
@@ -420,14 +420,21 @@ export declare type CommandArgs = {
|
|
|
420
420
|
export declare type AddCardIntegrationQuery = {
|
|
421
421
|
/** Title/name */
|
|
422
422
|
'n': string;
|
|
423
|
+
/** Data connector name */
|
|
424
|
+
'dcn': string;
|
|
423
425
|
/** Item label */
|
|
424
426
|
'il': string;
|
|
425
427
|
/** Items label */
|
|
426
428
|
'isl': string;
|
|
427
429
|
/** Icon url */
|
|
428
430
|
'u': string;
|
|
429
|
-
/**
|
|
430
|
-
'
|
|
431
|
+
/** Field configuration */
|
|
432
|
+
'fc': {
|
|
433
|
+
/** Callback to get field definitions for all fields supported by the card integration */
|
|
434
|
+
'gf': string;
|
|
435
|
+
/** Callback to handle a change in the fields the user want to be displayed */
|
|
436
|
+
'osfc'?: string;
|
|
437
|
+
};
|
|
431
438
|
/** Show intro if user has not yet authorized this integration */
|
|
432
439
|
'i'?: string;
|
|
433
440
|
/** Get default config action */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CollectionDefinition } from '../../data/collectiondefinition';
|
|
2
2
|
import { CollectionProxy } from '../../data/collectionproxy';
|
|
3
|
+
import { DataSourceProxy } from '../../data/datasourceproxy';
|
|
3
4
|
import { FieldDefinition } from '../../data/schemadefinition';
|
|
4
5
|
import { isString } from '../checks';
|
|
5
6
|
import { isSerializedFieldTypeDefinition } from '../data/fieldtypedefinition/fieldtypedefinition';
|
|
@@ -105,13 +106,23 @@ export interface CardIntegration {
|
|
|
105
106
|
*/
|
|
106
107
|
iconUrl: string;
|
|
107
108
|
/**
|
|
108
|
-
*
|
|
109
|
-
* was imported as part of this card integration.
|
|
110
|
-
*
|
|
111
|
-
* Any fields on the schema of the collection that you don't provide a ExtensionCardFieldDefinition
|
|
112
|
-
* for will have a default definition generated based on the type specified in the schema.
|
|
109
|
+
* The name of the data connector associated with the card integration.
|
|
113
110
|
*/
|
|
114
|
-
|
|
111
|
+
dataConnectorName: string;
|
|
112
|
+
fieldConfiguration: {
|
|
113
|
+
/**
|
|
114
|
+
* Callback to provide a list of all supported field definitions for the card integration.
|
|
115
|
+
*
|
|
116
|
+
* Any fields on the schema of the collection that you don't provide a ExtensionCardFieldDefinition
|
|
117
|
+
* for will have a default definition generated based on the type specified in the schema.
|
|
118
|
+
*/
|
|
119
|
+
getAllFields: (collection: CollectionProxy) => Promise<ExtensionCardFieldDefinition[]>;
|
|
120
|
+
/**
|
|
121
|
+
* Callback that handled changes in the fields the user wants to be displayed in the card integration.
|
|
122
|
+
* If this callback is not provided then the user will not be shown the modal to configure fields.
|
|
123
|
+
*/
|
|
124
|
+
onSelectedFieldsChange?: (dataSource: DataSourceProxy, selectedFields: string[]) => void;
|
|
125
|
+
};
|
|
115
126
|
/**
|
|
116
127
|
* If specified, and the user hasn't yet authorized the data connector for this extension,
|
|
117
128
|
* this should show the user an intro dialog or take some other action.
|
|
@@ -1,23 +1,48 @@
|
|
|
1
1
|
import { LucidCardFieldDisplaySettings, SerializedLucidCardFieldDisplaySettings } from './cardfielddisplaysettings';
|
|
2
2
|
export interface CardIntegrationConfig {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
cardConfig: {
|
|
4
|
+
/**
|
|
5
|
+
* The data fields to be displayed on cards, as data-linked text fields
|
|
6
|
+
*/
|
|
7
|
+
fieldNames: string[];
|
|
8
|
+
/**
|
|
9
|
+
* The data fields to be displayed on cards as data graphics
|
|
10
|
+
*/
|
|
11
|
+
fieldDisplaySettings?: Map<string, LucidCardFieldDisplaySettings>;
|
|
12
|
+
/**
|
|
13
|
+
* The field name to use as the displayed ID of the card, if any
|
|
14
|
+
*/
|
|
15
|
+
idFieldName?: string;
|
|
16
|
+
};
|
|
17
|
+
cardDetailsPanelConfig: {
|
|
18
|
+
/**
|
|
19
|
+
* The data fields to be displayed in the details panel of a card
|
|
20
|
+
*/
|
|
21
|
+
fields: {
|
|
22
|
+
/**
|
|
23
|
+
* The field name
|
|
24
|
+
*/
|
|
25
|
+
name: string;
|
|
26
|
+
/**
|
|
27
|
+
* If true then the visibility of this field in the details panel cannot be modified by a user.
|
|
28
|
+
*/
|
|
29
|
+
locked?: boolean;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
15
32
|
}
|
|
16
33
|
/** @ignore */
|
|
17
34
|
export declare type SerializedCardIntegrationConfig = {
|
|
18
|
-
'
|
|
19
|
-
|
|
20
|
-
|
|
35
|
+
'cc': {
|
|
36
|
+
'f': string[];
|
|
37
|
+
'fd'?: [string, SerializedLucidCardFieldDisplaySettings][];
|
|
38
|
+
'id'?: string;
|
|
39
|
+
};
|
|
40
|
+
'cdpc': {
|
|
41
|
+
'f': {
|
|
42
|
+
'n': string;
|
|
43
|
+
'l'?: boolean;
|
|
44
|
+
}[];
|
|
45
|
+
};
|
|
21
46
|
};
|
|
22
47
|
/** @ignore */
|
|
23
48
|
export declare function serializeCardIntegrationConfig(config: CardIntegrationConfig): SerializedCardIntegrationConfig;
|
|
@@ -5,25 +5,48 @@ const cardfielddisplaysettings_1 = require("./cardfielddisplaysettings");
|
|
|
5
5
|
/** @ignore */
|
|
6
6
|
function serializeCardIntegrationConfig(config) {
|
|
7
7
|
return {
|
|
8
|
-
'
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
key,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
'cc': {
|
|
9
|
+
'f': config.cardConfig.fieldNames,
|
|
10
|
+
'fd': config.cardConfig.fieldDisplaySettings
|
|
11
|
+
? [...config.cardConfig.fieldDisplaySettings].map(([key, settings]) => [
|
|
12
|
+
key,
|
|
13
|
+
(0, cardfielddisplaysettings_1.serializeLucidCardFieldDisplaySettings)(settings),
|
|
14
|
+
])
|
|
15
|
+
: undefined,
|
|
16
|
+
'id': config.cardConfig.idFieldName,
|
|
17
|
+
},
|
|
18
|
+
'cdpc': {
|
|
19
|
+
'f': config.cardDetailsPanelConfig.fields.map((field) => {
|
|
20
|
+
return {
|
|
21
|
+
'n': field.name,
|
|
22
|
+
'l': field.locked,
|
|
23
|
+
};
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
16
26
|
};
|
|
17
27
|
}
|
|
18
28
|
exports.serializeCardIntegrationConfig = serializeCardIntegrationConfig;
|
|
19
29
|
/** @ignore */
|
|
20
30
|
function deserializeCardIntegrationConfig(raw) {
|
|
21
31
|
return {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
cardConfig: {
|
|
33
|
+
fieldNames: raw['cc']['f'],
|
|
34
|
+
fieldDisplaySettings: raw['cc']['fd']
|
|
35
|
+
? new Map(raw['cc']['fd'].map(([key, settings]) => [
|
|
36
|
+
key,
|
|
37
|
+
(0, cardfielddisplaysettings_1.deserializeLucidCardFieldDisplaySettings)(settings),
|
|
38
|
+
]))
|
|
39
|
+
: undefined,
|
|
40
|
+
idFieldName: raw['cc']['id'],
|
|
41
|
+
},
|
|
42
|
+
cardDetailsPanelConfig: {
|
|
43
|
+
fields: raw['cdpc']['f'].map((field) => {
|
|
44
|
+
return {
|
|
45
|
+
name: field['n'],
|
|
46
|
+
locked: field['l'],
|
|
47
|
+
};
|
|
48
|
+
}),
|
|
49
|
+
},
|
|
27
50
|
};
|
|
28
51
|
}
|
|
29
52
|
exports.deserializeCardIntegrationConfig = deserializeCardIntegrationConfig;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SemanticKind = void 0;
|
|
3
|
+
exports.isSemanticKind = exports.SemanticKind = void 0;
|
|
4
|
+
const validators_1 = require("../../validators/validators");
|
|
4
5
|
var SemanticKind;
|
|
5
6
|
(function (SemanticKind) {
|
|
6
7
|
SemanticKind["Id"] = "id";
|
|
@@ -16,3 +17,4 @@ var SemanticKind;
|
|
|
16
17
|
SemanticKind["GroupByHint"] = "groupbyhint";
|
|
17
18
|
SemanticKind["PrimaryKeyReference"] = "primarykeyreference";
|
|
18
19
|
})(SemanticKind = exports.SemanticKind || (exports.SemanticKind = {}));
|
|
20
|
+
exports.isSemanticKind = (0, validators_1.enumValidator)(SemanticKind);
|
|
@@ -11,7 +11,7 @@ import { SchemaDefinition } from './schemadefinition';
|
|
|
11
11
|
export declare class DataSourceProxy extends PropertyStoreProxy {
|
|
12
12
|
readonly id: string;
|
|
13
13
|
/**
|
|
14
|
-
* @param id ID of the
|
|
14
|
+
* @param id ID of the dataSource on the current document
|
|
15
15
|
* @param client
|
|
16
16
|
*/
|
|
17
17
|
constructor(id: string, client: EditorClient);
|
|
@@ -12,7 +12,7 @@ const collectionproxy_1 = require("./collectionproxy");
|
|
|
12
12
|
*/
|
|
13
13
|
class DataSourceProxy extends propertystoreproxy_1.PropertyStoreProxy {
|
|
14
14
|
/**
|
|
15
|
-
* @param id ID of the
|
|
15
|
+
* @param id ID of the dataSource on the current document
|
|
16
16
|
* @param client
|
|
17
17
|
*/
|
|
18
18
|
constructor(id, client) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TaskManagementCardIntegration = void 0;
|
|
4
|
+
const lucid_extension_sdk_1 = require("../../lucid-extension-sdk");
|
|
4
5
|
const cardintegration_1 = require("../core/cardintegration/cardintegration");
|
|
5
6
|
const cardintegrationconfig_1 = require("../core/cardintegration/cardintegrationconfig");
|
|
6
7
|
const collectiondefinition_1 = require("../data/collectiondefinition");
|
|
@@ -36,10 +37,19 @@ class TaskManagementCardIntegration {
|
|
|
36
37
|
const getFieldsActionName = TaskManagementCardIntegration.nextHookName();
|
|
37
38
|
this.client.registerAction(getFieldsActionName, async (param) => {
|
|
38
39
|
const collection = new collectionproxy_1.CollectionProxy(param['c'], this.client);
|
|
39
|
-
const fields = await card.getAllFields(collection);
|
|
40
|
+
const fields = await card.fieldConfiguration.getAllFields(collection);
|
|
40
41
|
const serializedFields = (0, cardintegration_1.serializeCardFieldArrayDefinition)(fields);
|
|
41
42
|
return serializedFields;
|
|
42
43
|
});
|
|
44
|
+
let onSelectedFieldsChangeActionName = undefined;
|
|
45
|
+
const onSelectedFieldsChange = card.fieldConfiguration.onSelectedFieldsChange;
|
|
46
|
+
if (onSelectedFieldsChange) {
|
|
47
|
+
onSelectedFieldsChangeActionName = TaskManagementCardIntegration.nextHookName();
|
|
48
|
+
this.client.registerAction(onSelectedFieldsChangeActionName, (param) => {
|
|
49
|
+
const dataSource = new lucid_extension_sdk_1.DataSourceProxy(param['ds'], this.client);
|
|
50
|
+
onSelectedFieldsChange(dataSource, param['sf']);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
43
53
|
const getDefaultConfigActionName = TaskManagementCardIntegration.nextHookName();
|
|
44
54
|
this.client.registerAction(getDefaultConfigActionName, async (param) => {
|
|
45
55
|
const collection = new collectionproxy_1.CollectionProxy(param['c'], this.client);
|
|
@@ -52,10 +62,14 @@ class TaskManagementCardIntegration {
|
|
|
52
62
|
}
|
|
53
63
|
const serialized = {
|
|
54
64
|
'n': card.label,
|
|
65
|
+
'dcn': card.dataConnectorName,
|
|
55
66
|
'il': card.itemLabel,
|
|
56
67
|
'isl': card.itemsLabel,
|
|
57
68
|
'u': card.iconUrl,
|
|
58
|
-
'
|
|
69
|
+
'fc': {
|
|
70
|
+
'gf': getFieldsActionName,
|
|
71
|
+
'osfc': onSelectedFieldsChangeActionName,
|
|
72
|
+
},
|
|
59
73
|
'gdc': getDefaultConfigActionName,
|
|
60
74
|
'i': showIntroActionName,
|
|
61
75
|
};
|