lucid-extension-sdk 0.0.116 → 0.0.118

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.116",
3
+ "version": "0.0.118",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "sdk/index.js",
6
6
  "types": "sdk/index.d.ts",
@@ -491,6 +491,8 @@ export declare type AddCardIntegrationQuery = {
491
491
  'gf': string;
492
492
  /** Callback to handle a change in the fields the user want to be displayed */
493
493
  'osfc'?: string | undefined;
494
+ /** Field name -> callback name tuples for searching for legal field values in an enum */
495
+ 'fvsc'?: [string, string][] | undefined;
494
496
  };
495
497
  /** Show intro if user has not yet authorized this integration */
496
498
  'i'?: string | undefined;
@@ -642,6 +644,7 @@ export declare type CreateCollectionQuery = {
642
644
  'f': CreateCollectionFieldDefinition[];
643
645
  /** Field(s) to use as the primary key of this collection */
644
646
  'p': string[];
647
+ 'fl'?: Record<string, string> | undefined;
645
648
  };
646
649
  export declare type CreateCollectionResult = string;
647
650
  export declare type CreateDataSourceQuery = {
@@ -7,6 +7,7 @@ import { isSerializedFieldType, SerializedFieldType } from '../data/serializedfi
7
7
  export interface ExtensionCardFieldOption {
8
8
  label: string;
9
9
  value: SerializedFieldType;
10
+ iconUrl?: string;
10
11
  }
11
12
  export interface ExtensionCardFieldDefinition extends FieldDefinition {
12
13
  /** The label to display in the UI */
@@ -33,6 +34,7 @@ export interface ExtensionCardFieldDefinition extends FieldDefinition {
33
34
  export declare type SerializedCardFieldOption = {
34
35
  'l': string;
35
36
  'v'?: SerializedFieldType;
37
+ 'i'?: string | undefined;
36
38
  };
37
39
  /** @ignore */
38
40
  export declare function serializeCardFieldOption(option: ExtensionCardFieldOption): SerializedCardFieldOption;
@@ -53,10 +55,12 @@ export declare function deserializeFieldOption(option: SerializedCardFieldOption
53
55
  export declare const isSerializedFieldOption: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
54
56
  l: typeof isString;
55
57
  v: typeof isSerializedFieldType;
58
+ i: (x: unknown) => x is string | undefined;
56
59
  }>;
57
60
  export declare const isSerializedFieldOptions: (p1: unknown) => p1 is import("../guards").DestructureGuardedTypeObj<{
58
61
  l: typeof isString;
59
62
  v: typeof isSerializedFieldType;
63
+ i: (x: unknown) => x is string | undefined;
60
64
  }>[];
61
65
  export declare const isSerializedFieldConstraint: (subject: unknown) => subject is import("../guards").DestructureGuardedTypeObj<{
62
66
  Type: (x: unknown) => x is FieldConstraintType;
@@ -76,6 +80,7 @@ export declare const isSerializedExtensionCardFieldDefinition: (subject: unknown
76
80
  op: (x: unknown) => x is string | import("../guards").DestructureGuardedTypeObj<{
77
81
  l: typeof isString;
78
82
  v: typeof isSerializedFieldType;
83
+ i: (x: unknown) => x is string | undefined;
79
84
  }>[] | undefined;
80
85
  s: (x: unknown) => x is string | undefined;
81
86
  }>;
@@ -12,6 +12,7 @@ function serializeCardFieldOption(option) {
12
12
  return {
13
13
  'l': option.label,
14
14
  'v': option.value,
15
+ 'i': option.iconUrl,
15
16
  };
16
17
  }
17
18
  exports.serializeCardFieldOption = serializeCardFieldOption;
@@ -31,12 +32,14 @@ function deserializeFieldOption(option) {
31
32
  return {
32
33
  label: option['l'],
33
34
  value: option['v'],
35
+ iconUrl: option['i'],
34
36
  };
35
37
  }
36
38
  exports.deserializeFieldOption = deserializeFieldOption;
37
39
  exports.isSerializedFieldOption = (0, validators_1.objectValidator)({
38
40
  'l': checks_1.isString,
39
41
  'v': serializedfields_1.isSerializedFieldType,
42
+ 'i': (0, validators_1.option)(checks_1.isString),
40
43
  });
41
44
  exports.isSerializedFieldOptions = (0, validators_1.arrayValidator)(exports.isSerializedFieldOption);
42
45
  exports.isSerializedFieldConstraint = (0, validators_1.objectValidator)({
@@ -39,6 +39,19 @@ export declare abstract class LucidCardIntegration {
39
39
  * If this callback is not provided then the user will not be shown the modal to configure fields.
40
40
  */
41
41
  onSelectedFieldsChange?: (dataSource: DataSourceProxy, selectedFields: string[]) => Promise<void>;
42
+ /**
43
+ * Specify callbacks for searching for legal values for the given fields.
44
+ *
45
+ * For example, a Task collection may have an Assignee field that references a User collection,
46
+ * but you don't import all the users in the entire source data set. Here, you can provide a way
47
+ * to search for legal values for the Assignee field, similar to the `ExtensionCardFieldDefinition.search`
48
+ * functionality.
49
+ *
50
+ * Register a search callback using LucidCardIntegrationRegistry.registerFieldSearchCallback, then set
51
+ * the returned string as a value in this Map. The `inputSoFar` parameter passed to the callback will
52
+ * be all the current field values on the item being edited.
53
+ */
54
+ fieldValueSearchCallbacks?: Map<string, string>;
42
55
  };
43
56
  /**
44
57
  * If specified, and the user hasn't yet authorized the data connector for this extension,
@@ -63,6 +63,9 @@ class LucidCardIntegrationRegistry {
63
63
  'fc': {
64
64
  'gf': getFieldsActionName,
65
65
  'osfc': onSelectedFieldsChangeActionName,
66
+ 'fvsc': cardIntegration.fieldConfiguration.fieldValueSearchCallbacks
67
+ ? [...cardIntegration.fieldConfiguration.fieldValueSearchCallbacks.entries()]
68
+ : undefined,
66
69
  },
67
70
  'gdc': getDefaultConfigActionName,
68
71
  'i': showIntroActionName,
@@ -39,6 +39,7 @@ class DataSourceProxy extends propertystoreproxy_1.PropertyStoreProxy {
39
39
  return { 'n': field.name, 't': (0, fieldtypedefinition_1.serializeFieldTypeDefinition)(field.type) };
40
40
  }),
41
41
  'p': schema.primaryKey,
42
+ 'fl': schema.fieldLabels,
42
43
  }), this.client);
43
44
  }
44
45
  /**
@@ -11,5 +11,6 @@ export declare enum DocumentElementType {
11
11
  Rule = "Rule",
12
12
  DocumentFormula = "Formula",
13
13
  TaskCardFieldsConfig = "TaskCardFieldsConfig",
14
- GeneratorView = "GeneratorView"
14
+ GeneratorView = "GeneratorView",
15
+ ShapeStylePreset = "ShapeStylePreset"
15
16
  }
@@ -16,4 +16,5 @@ var DocumentElementType;
16
16
  DocumentElementType["DocumentFormula"] = "Formula";
17
17
  DocumentElementType["TaskCardFieldsConfig"] = "TaskCardFieldsConfig";
18
18
  DocumentElementType["GeneratorView"] = "GeneratorView";
19
+ DocumentElementType["ShapeStylePreset"] = "ShapeStylePreset";
19
20
  })(DocumentElementType = exports.DocumentElementType || (exports.DocumentElementType = {}));