lucid-extension-sdk 0.0.388 → 0.0.390

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 CHANGED
@@ -735,6 +735,18 @@ export type AddCardsActions = {
735
735
  /** Create card action */
736
736
  'cc': string;
737
737
  };
738
+ export type SerializedFieldConfiguration = {
739
+ /** Callback to get field definitions for all fields supported by the card integration */
740
+ 'gf': string;
741
+ /** Callback to handle a change in the fields the user want to be displayed */
742
+ 'osfc'?: string | undefined;
743
+ /** Field name -> callback name tuples for searching for legal field values in an enum */
744
+ 'fvsc'?: [string, string][] | undefined;
745
+ /** Default search callback for searching for legal field values in an enum */
746
+ 'dsc'?: string | undefined;
747
+ /** Custom field display settings */
748
+ 'cfds'?: SerializedCustomFieldDisplaySettings;
749
+ };
738
750
  export type AddCardIntegrationQuery = {
739
751
  /** Title/name */
740
752
  'n': string;
@@ -744,23 +756,14 @@ export type AddCardIntegrationQuery = {
744
756
  'il': string;
745
757
  /** Items label */
746
758
  'isl': string;
759
+ /** Item collection label */
760
+ 'icl': string;
747
761
  /** Icon url. Replaced by iconConfiguration.primaryIconUrl */
748
762
  'u': string;
749
763
  /** Text style */
750
764
  'ts'?: Partial<TextStyle> | undefined;
751
765
  /** Field configuration */
752
- 'fc': {
753
- /** Callback to get field definitions for all fields supported by the card integration */
754
- 'gf': string;
755
- /** Callback to handle a change in the fields the user want to be displayed */
756
- 'osfc'?: string | undefined;
757
- /** Field name -> callback name tuples for searching for legal field values in an enum */
758
- 'fvsc'?: [string, string][] | undefined;
759
- /** Default search callback for searching for legal field values in an enum */
760
- 'dsc'?: string | undefined;
761
- /** Custom field display settings */
762
- 'cfds'?: SerializedCustomFieldDisplaySettings;
763
- };
766
+ 'fc': SerializedFieldConfiguration;
764
767
  /** If we can only search for user by their name (and not email) in the card integration. */
765
768
  'subn'?: boolean | undefined;
766
769
  /** Callback to search for a user in the card integration */
@@ -1191,6 +1194,12 @@ export type CreateUserImageResult = Promise<RawCreateUserImageResult>;
1191
1194
  export type SerializedCustomFieldDisplaySettings = {
1192
1195
  /** Default to multiline text */
1193
1196
  'd'?: boolean | undefined;
1197
+ /** allowMultiSelectEnums */
1198
+ 'amse'?: boolean | undefined;
1199
+ /** useRoundIcons */
1200
+ 'uri'?: boolean | undefined;
1201
+ /** displayMappedDatesAsDateRange */
1202
+ 'dadr'?: boolean | undefined;
1194
1203
  };
1195
1204
  export type DataActionQuery = {
1196
1205
  /** Flow Name */
@@ -4,7 +4,7 @@ import { TextStyle } from '../../document/text/textstyle';
4
4
  import { EditorClient } from '../../editorclient';
5
5
  import { isString } from '../checks';
6
6
  import { SerializedFieldType } from '../data/serializedfield/serializedfields';
7
- import { CustomFieldDisplaySettings, DependenciesForItems, ExtensionCardFieldDefinition, ImportResult } from '../sharedcardintegration/cardintegrationdefinitions';
7
+ import { DependenciesForItems, ExtensionCardFieldDefinition, ExtensionFieldConfiguration, ImportResult } from '../sharedcardintegration/cardintegrationdefinitions';
8
8
  import { CardIntegrationConfig } from './cardintegrationconfig';
9
9
  import { DependencyMappingPhrasesType } from './dependencymappingphrases';
10
10
  import { LucidCardIntegrationCustomImportModal } from './lucidcardintegrationcustomimportmodal';
@@ -35,6 +35,11 @@ export declare abstract class LucidCardIntegration {
35
35
  * Label used to identify multiple cards worth of data, e.g. "Jira tasks"
36
36
  */
37
37
  abstract itemsLabel: string;
38
+ /**
39
+ * Label used to identify a collection of cards worth of data ("project" is the default if you don't
40
+ * override and provide a different label)
41
+ */
42
+ readonly itemCollectionLabel: string;
38
43
  /**
39
44
  * @deprecated Use iconConfiguration.primaryIconUrl.
40
45
  * URL for an icon to display in toolbars, etc. Should be at least 24x24.
@@ -50,37 +55,7 @@ export declare abstract class LucidCardIntegration {
50
55
  * individual fields that should have different styles.
51
56
  */
52
57
  textStyle?: Partial<TextStyle>;
53
- abstract fieldConfiguration: {
54
- /**
55
- * Callback to provide a list of all supported field names for the card integration.
56
- */
57
- getAllFields: (dataSource: DataSourceProxy) => Promise<string[] | FieldDescriptor[]>;
58
- /**
59
- * Callback that handled changes in the fields the user wants to be displayed in the card integration.
60
- * If this callback is not provided then the user will not be shown the modal to configure fields.
61
- */
62
- onSelectedFieldsChange?: (dataSource: DataSourceProxy, selectedFields: string[]) => Promise<void>;
63
- /**
64
- * Specify callbacks for searching for legal values for the given fields.
65
- *
66
- * For example, a Task collection may have an Assignee field that references a User collection,
67
- * but you don't import all the users in the entire source data set. Here, you can provide a way
68
- * to search for legal values for the Assignee field, similar to the `ExtensionCardFieldDefinition.search`
69
- * functionality.
70
- *
71
- * Register a search callback using LucidCardIntegrationRegistry.registerFieldSearchCallback, then set
72
- * the returned string as a value in this Map. The `inputSoFar` parameter passed to the callback will
73
- * be all the current field values on the item being edited.
74
- */
75
- fieldValueSearchCallbacks?: Map<string, string>;
76
- /**
77
- * Optional callback that's used when a field name may not map to any field defined in fieldValueSearchCallbacks.
78
- * Useful for when you don't know the field name ahead of time (e.g. a dynamically generated field name).
79
- */
80
- defaultSearchCallback?: string;
81
- /** Optional properties to configure how fields are displayed */
82
- customFieldDisplaySettings?: CustomFieldDisplaySettings;
83
- };
58
+ abstract fieldConfiguration: ExtensionFieldConfiguration;
84
59
  iconConfiguration?: {
85
60
  /**
86
61
  * URL for the primary icon to display in most components, usually on a white background.
@@ -11,6 +11,11 @@ exports.isFieldDescriptor = (0, validators_1.objectValidator)({
11
11
  class LucidCardIntegration {
12
12
  constructor(client) {
13
13
  this.client = client;
14
+ /**
15
+ * Label used to identify a collection of cards worth of data ("project" is the default if you don't
16
+ * override and provide a different label)
17
+ */
18
+ this.itemCollectionLabel = 'project';
14
19
  }
15
20
  showCardImport(name) {
16
21
  return this.client.sendCommand("ic" /* CommandName.ImportCards */, name);
@@ -156,6 +156,7 @@ class LucidCardIntegrationRegistry {
156
156
  * Register a card integration.
157
157
  */
158
158
  static addCardIntegration(client, cardIntegration) {
159
+ var _a, _b, _c, _d, _e, _f;
159
160
  const getFieldsActionName = LucidCardIntegrationRegistry.nextHookName();
160
161
  client.registerAction(getFieldsActionName, async (param) => {
161
162
  const dataSource = new datasourceproxy_1.DataSourceProxy(param['d'], client);
@@ -186,6 +187,7 @@ class LucidCardIntegrationRegistry {
186
187
  'dcn': cardIntegration.dataConnectorName,
187
188
  'il': cardIntegration.itemLabel,
188
189
  'isl': cardIntegration.itemsLabel,
190
+ 'icl': cardIntegration.itemCollectionLabel,
189
191
  'u': cardIntegration.iconUrl,
190
192
  'ts': cardIntegration.textStyle,
191
193
  'fc': {
@@ -290,6 +292,9 @@ class LucidCardIntegrationRegistry {
290
292
  if (cardIntegration.fieldConfiguration.customFieldDisplaySettings) {
291
293
  serialized['fc']['cfds'] = {
292
294
  'd': cardIntegration.fieldConfiguration.customFieldDisplaySettings.defaultToMultilineText,
295
+ 'amse': (_b = (_a = cardIntegration.fieldConfiguration) === null || _a === void 0 ? void 0 : _a.customFieldDisplaySettings) === null || _b === void 0 ? void 0 : _b.allowMultiSelectEnums,
296
+ 'uri': (_d = (_c = cardIntegration.fieldConfiguration) === null || _c === void 0 ? void 0 : _c.customFieldDisplaySettings) === null || _d === void 0 ? void 0 : _d.useRoundIcons,
297
+ 'dadr': (_f = (_e = cardIntegration.fieldConfiguration) === null || _e === void 0 ? void 0 : _e.customFieldDisplaySettings) === null || _f === void 0 ? void 0 : _f.displayMappedDatesAsDateRange,
293
298
  };
294
299
  }
295
300
  this.registerDependencyMapping(client, cardIntegration, serialized);
@@ -1,7 +1,9 @@
1
1
  import { CollectionDefinition } from '../../data/collectiondefinition';
2
2
  import { CollectionProxy } from '../../data/collectionproxy';
3
3
  import { DataItemProxy } from '../../data/dataitemproxy';
4
+ import { DataSourceProxy } from '../../data/datasourceproxy';
4
5
  import { FieldDefinition } from '../../data/schemadefinition';
6
+ import { FieldDescriptor } from '../cardintegration/lucidcardintegration';
5
7
  import { isString } from '../checks';
6
8
  import { isSerializedFieldTypeDefinition } from '../data/fieldtypedefinition/fieldtypedefinition';
7
9
  import { SerializedFieldDefinition } from '../data/serializedfield/serializedfielddefinition';
@@ -157,5 +159,47 @@ export interface CustomFieldDisplaySettings {
157
159
  * If you would like certain fields to be shown as single line text, you can add the
158
160
  * `FieldConstraintType.SINGLE_LINE_ONLY` constraint to the necessary fields.
159
161
  * */
160
- defaultToMultilineText: boolean;
162
+ defaultToMultilineText?: boolean;
163
+ /** Whether multi-select dropdown fields are allowed.
164
+ * If false, all enum fields are coerced to single-select regardless of their type.
165
+ */
166
+ allowMultiSelectEnums?: boolean;
167
+ /** Whether to default to using round icons in dropdowns in both the edit details panel and basic edit panel */
168
+ useRoundIcons?: boolean;
169
+ /**
170
+ * When this is true and a user has setup their mappings for LucidFields.Time and LucidFields.EndTime, the dates
171
+ * will be combined into a single date field in the edit panel.
172
+ */
173
+ displayMappedDatesAsDateRange?: boolean;
161
174
  }
175
+ export type ExtensionFieldConfiguration = {
176
+ /**
177
+ * Callback to provide a list of all supported field names for the card integration.
178
+ */
179
+ getAllFields: (dataSource: DataSourceProxy) => Promise<string[] | FieldDescriptor[]>;
180
+ /**
181
+ * Callback that handled changes in the fields the user wants to be displayed in the card integration.
182
+ * If this callback is not provided then the user will not be shown the modal to configure fields.
183
+ */
184
+ onSelectedFieldsChange?: (dataSource: DataSourceProxy, selectedFields: string[]) => Promise<void>;
185
+ /**
186
+ * Specify callbacks for searching for legal values for the given fields.
187
+ *
188
+ * For example, a Task collection may have an Assignee field that references a User collection,
189
+ * but you don't import all the users in the entire source data set. Here, you can provide a way
190
+ * to search for legal values for the Assignee field, similar to the `ExtensionCardFieldDefinition.search`
191
+ * functionality.
192
+ *
193
+ * Register a search callback using LucidCardIntegrationRegistry.registerFieldSearchCallback, then set
194
+ * the returned string as a value in this Map. The `inputSoFar` parameter passed to the callback will
195
+ * be all the current field values on the item being edited.
196
+ */
197
+ fieldValueSearchCallbacks?: Map<string, string>;
198
+ /**
199
+ * Optional callback that's used when a field name may not map to any field defined in fieldValueSearchCallbacks.
200
+ * Useful for when you don't know the field name ahead of time (e.g. a dynamically generated field name).
201
+ */
202
+ defaultSearchCallback?: string;
203
+ /** Optional properties to configure how fields are displayed */
204
+ customFieldDisplaySettings?: CustomFieldDisplaySettings;
205
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.388",
3
+ "version": "0.0.390",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",