@combeenation/custom-code-sdk 0.0.1-alpha11 → 0.0.1-alpha13
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/dist/bundle.cjs.js +1 -1
- package/dist/bundle.es.js +400 -509
- package/dist/index.d.ts +338 -62
- package/package.json +8 -6
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,13 @@ export declare class Button {
|
|
|
8
8
|
#private;
|
|
9
9
|
readonly id: CtrlId;
|
|
10
10
|
constructor(id: CtrlId);
|
|
11
|
+
/**
|
|
12
|
+
* See {@link CustomControl.onRendered} for detailed information on what you can do with this listener and what it is
|
|
13
|
+
* not meant for.
|
|
14
|
+
*
|
|
15
|
+
* Also see {@link OnRenderedCallback} for important information regarding the `element` which is passed to the
|
|
16
|
+
* callback.
|
|
17
|
+
*/
|
|
11
18
|
onRendered(callback: OnRenderedCallback<HTMLButtonElement>): CallbackUnsubscribeOption;
|
|
12
19
|
onClick(callback: OnClickCallback): CallbackUnsubscribeOption;
|
|
13
20
|
setVisible(visible: boolean): Promise<void>;
|
|
@@ -25,6 +32,7 @@ export declare namespace CbnSdk {
|
|
|
25
32
|
fireAnalyticsEvent,
|
|
26
33
|
getAssetPaths,
|
|
27
34
|
getParentPageUrl,
|
|
35
|
+
onParentPageEvent,
|
|
28
36
|
navigateToLogin,
|
|
29
37
|
onAnyCmpValueChanged,
|
|
30
38
|
redirectParentPage,
|
|
@@ -34,6 +42,8 @@ export declare namespace CbnSdk {
|
|
|
34
42
|
createSyncCmpValuesStore,
|
|
35
43
|
uploadFiles,
|
|
36
44
|
uploadImages,
|
|
45
|
+
uploadTempFiles,
|
|
46
|
+
uploadTempImages,
|
|
37
47
|
convertDocument,
|
|
38
48
|
createPdfFromAssets,
|
|
39
49
|
createArPage,
|
|
@@ -52,6 +62,13 @@ export declare class Checkbox {
|
|
|
52
62
|
#private;
|
|
53
63
|
readonly id: CtrlId;
|
|
54
64
|
constructor(id: CtrlId);
|
|
65
|
+
/**
|
|
66
|
+
* See {@link CustomControl.onRendered} for detailed information on what you can do with this listener and what it is
|
|
67
|
+
* not meant for.
|
|
68
|
+
*
|
|
69
|
+
* Also see {@link OnRenderedCallback} for important information regarding the `element` which is passed to the
|
|
70
|
+
* callback.
|
|
71
|
+
*/
|
|
55
72
|
onRendered(callback: OnRenderedCallback<HTMLLabelElement>): CallbackUnsubscribeOption;
|
|
56
73
|
setVisible(visible: boolean): Promise<void>;
|
|
57
74
|
}
|
|
@@ -96,10 +113,128 @@ export declare class Collapsible {
|
|
|
96
113
|
#private;
|
|
97
114
|
readonly id: CtrlId;
|
|
98
115
|
constructor(id: CtrlId);
|
|
116
|
+
/**
|
|
117
|
+
* See {@link CustomControl.onRendered} for detailed information on what you can do with this listener and what it is
|
|
118
|
+
* not meant for.
|
|
119
|
+
*
|
|
120
|
+
* Also see {@link OnRenderedCallback} for important information regarding the `element` which is passed to the
|
|
121
|
+
* callback.
|
|
122
|
+
*/
|
|
99
123
|
onRendered(callback: OnRenderedCallback<HTMLDivElement>): CallbackUnsubscribeOption;
|
|
100
124
|
setVisible(visible: boolean): Promise<void>;
|
|
101
125
|
}
|
|
102
126
|
|
|
127
|
+
export declare class Combobox<TValue extends NonNullable<DataListValue>> {
|
|
128
|
+
#private;
|
|
129
|
+
readonly id: CtrlId;
|
|
130
|
+
constructor(id: CtrlId);
|
|
131
|
+
/**
|
|
132
|
+
* See {@link CustomControlV1.onRendered} for detailed information on what you can do with this listener and what it
|
|
133
|
+
* is not meant for.
|
|
134
|
+
*
|
|
135
|
+
* Also see {@link OnRenderedCallback} for important information regarding the `element` which is passed to the
|
|
136
|
+
* callback.
|
|
137
|
+
*/
|
|
138
|
+
onRendered(callback: OnRenderedCallback<HTMLDivElement>): CallbackUnsubscribeOption;
|
|
139
|
+
/**
|
|
140
|
+
* See {@link CustomControlV1.onRendered} for detailed information on what you can do with this listener and what it
|
|
141
|
+
* is not meant for. Most of the information there also applies to `onItemRendered`.
|
|
142
|
+
*
|
|
143
|
+
* Also see {@link OnRenderedCallback} for important information regarding the `element` which is passed to the
|
|
144
|
+
* callback which also applies here.
|
|
145
|
+
*
|
|
146
|
+
* @param callback Callback function which is given the rendered HTML element and the corresponding item data.
|
|
147
|
+
*
|
|
148
|
+
* Typical usage for type safe access to the item data where `IProductsTable` is the auto generated
|
|
149
|
+
* type of the table component from which the combobox entries are populated:
|
|
150
|
+
*
|
|
151
|
+
* ```ts
|
|
152
|
+
* combobox.onItemRendered<IProductsTable[number]>((el, itemData) => { ... })
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
onItemRendered<TItemData>(callback: (element: HTMLDivElement, itemData: TItemData) => void): CallbackUnsubscribeOption;
|
|
156
|
+
/**
|
|
157
|
+
* See {@link CustomControlV1.onRendered} for detailed information on what you can do with this listener and what it
|
|
158
|
+
* is not meant for. Most of the information there also applies to `onValueItemRendered`.
|
|
159
|
+
*
|
|
160
|
+
* Also see {@link OnRenderedCallback} for important information regarding the `element` which is passed to the
|
|
161
|
+
* callback which also applies here.
|
|
162
|
+
*
|
|
163
|
+
* @param callback Callback function which is given the rendered HTML element and the corresponding item data of the
|
|
164
|
+
* currently selected value item shown in the trigger.
|
|
165
|
+
*
|
|
166
|
+
* Typical usage for type safe access to the item data where `IProductsTable` is the auto generated
|
|
167
|
+
* type of the table component from which the combobox entries are populated:
|
|
168
|
+
*
|
|
169
|
+
* ```ts
|
|
170
|
+
* combobox.onValueItemRendered<IProductsTable[number]>((el, itemData) => { ... })
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
onValueItemRendered<TItemData>(callback: (element: HTMLDivElement, itemData: TItemData) => void): CallbackUnsubscribeOption;
|
|
174
|
+
/**
|
|
175
|
+
* See {@link CustomControlV1.onRendered} for detailed information on what you can do with this listener and what it
|
|
176
|
+
* is not meant for. Most of the information there also applies to `onGroupHeaderRendered`.
|
|
177
|
+
*
|
|
178
|
+
* Also see {@link OnRenderedCallback} for important information regarding the `element` which is passed to the
|
|
179
|
+
* callback which also applies here.
|
|
180
|
+
*
|
|
181
|
+
* @param callback Callback function which is given the rendered HTML element and the corresponding group data.
|
|
182
|
+
*
|
|
183
|
+
* Typical usage for type safe access to the group data where `IProductGroupsTable` is the auto
|
|
184
|
+
* generated type of the table component from which the combobox groups are populated:
|
|
185
|
+
*
|
|
186
|
+
* ```ts
|
|
187
|
+
* combobox.onGroupHeaderRendered<IProductGroupsTable[number]>((el, groupData) => { ... })
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
onGroupHeaderRendered<TGroupData>(callback: (element: HTMLDivElement, groupData: TGroupData) => void): CallbackUnsubscribeOption;
|
|
191
|
+
/**
|
|
192
|
+
* Fires when the selection is committed which is:
|
|
193
|
+
* - in single select mode: when the popup closes (or when an option is clicked).
|
|
194
|
+
* - in multi select mode: immediately on every selection change.
|
|
195
|
+
*
|
|
196
|
+
* @param callback Callback function which is given the raw selection value/keys and the corresponding item data of
|
|
197
|
+
* all the selected items.
|
|
198
|
+
*
|
|
199
|
+
* Typical usage for type safe access to the item data where `IProductsTable` is the auto generated
|
|
200
|
+
* type of the table component from which the combobox entries are populated:
|
|
201
|
+
*
|
|
202
|
+
* ```ts
|
|
203
|
+
* // Single selection:
|
|
204
|
+
* combobox.onValueChange<IProductsTable[number]>((value, valueItemData) => { ... })
|
|
205
|
+
*
|
|
206
|
+
* // Multi selection:
|
|
207
|
+
* combobox.onValueChange<IProductsTable>((value, valueItemData) => { ... })
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
onValueChange<TItemData extends TValue extends any[] ? any[] : any>(callback: (value: TValue | undefined, valueItemData: TItemData | undefined) => void): CallbackUnsubscribeOption;
|
|
211
|
+
/**
|
|
212
|
+
* Registers a callback that fires when a combobox item is clicked.
|
|
213
|
+
*
|
|
214
|
+
* - Fires **before** `onValueChange`.
|
|
215
|
+
* - Fires even when the clicked item is already selected.
|
|
216
|
+
*
|
|
217
|
+
* @param callback Callback function which is given the item data of the clicked item and the raw mouse event.
|
|
218
|
+
*
|
|
219
|
+
* Typical usage for type safe access to the item data where `IProductsTable` is the auto generated
|
|
220
|
+
* type of the table component from which the combobox entries are populated:
|
|
221
|
+
*
|
|
222
|
+
* ```ts
|
|
223
|
+
* combobox.onItemClicked<IProductsTable[number]>((itemData, event) => { ... })
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
onItemClicked<TItemData>(callback: (itemData: TItemData, event: MouseEvent) => void): CallbackUnsubscribeOption;
|
|
227
|
+
setVisible(visible: boolean): Promise<void>;
|
|
228
|
+
/**
|
|
229
|
+
* Sets the entries (data items) displayed by the combobox. Existing entries are overwritten.
|
|
230
|
+
*/
|
|
231
|
+
setEntries(entries: TemplateData[]): void;
|
|
232
|
+
/**
|
|
233
|
+
* Sets the group data used to render the group headers of the combobox. Existing group data is overwritten.
|
|
234
|
+
*/
|
|
235
|
+
setGroupData(groupData: TemplateData[]): void;
|
|
236
|
+
}
|
|
237
|
+
|
|
103
238
|
/**
|
|
104
239
|
* Checks if the configurator is embedded inside an IFrame.
|
|
105
240
|
*/
|
|
@@ -109,8 +244,7 @@ export declare const configuratorIsInIFrame: () => boolean;
|
|
|
109
244
|
* Create and convert a document (e.g. HTML to PDF).\
|
|
110
245
|
* The conversion consists of multiple individual tasks to allow full flexibility when creating documents.
|
|
111
246
|
*
|
|
112
|
-
* Example case: Create a PDF with dynamic content (PDF asset)
|
|
113
|
-
* and put a watermark on each page.
|
|
247
|
+
* Example case: Create a PDF with dynamic content (PDF asset) and append a static product datasheet.
|
|
114
248
|
*
|
|
115
249
|
* See also {@link createPdfFromAssets} for a simplified version to create a PDF.
|
|
116
250
|
* @param tasks The tasks are executed based on their connection with the properties `name` and `inputTaskName`
|
|
@@ -130,18 +264,9 @@ export declare const configuratorIsInIFrame: () => boolean;
|
|
|
130
264
|
* },
|
|
131
265
|
* },
|
|
132
266
|
* {
|
|
133
|
-
* type: DocumentConvertTaskTypes.Watermark,
|
|
134
|
-
* inputTaskName: 'HtmlToPdfTask',
|
|
135
|
-
* name: 'WatermarkTask',
|
|
136
|
-
* options: {
|
|
137
|
-
* text: 'My Watermark',
|
|
138
|
-
* opacity: 50
|
|
139
|
-
* },
|
|
140
|
-
* },
|
|
141
|
-
* {
|
|
142
267
|
* type: DocumentConvertTaskTypes.OutputToCfgnFile,
|
|
143
268
|
* name: 'OutputPdfTask',
|
|
144
|
-
* inputTaskName: '
|
|
269
|
+
* inputTaskName: 'HtmlToPdfTask',
|
|
145
270
|
* cfgnFileName: 'QuotePdf',
|
|
146
271
|
* cfgnFileExtension: 'pdf',
|
|
147
272
|
* cfgnFileDisplayName: `Your_quote_${new Date().toISOString()}`,
|
|
@@ -164,7 +289,7 @@ export declare const createArPage: (glb: File, options?: SdkCreateArPageOptions)
|
|
|
164
289
|
* Creates a PDF from one or more assets which will be merged in the given order.
|
|
165
290
|
*
|
|
166
291
|
* Simplified helper built on top of {@link convertDocument}.
|
|
167
|
-
* Use {@link convertDocument} directly for advanced scenarios
|
|
292
|
+
* Use {@link convertDocument} directly for advanced scenarios.
|
|
168
293
|
*
|
|
169
294
|
* @param bundleAliasName Bundle name where the assets are stored
|
|
170
295
|
* @param assetTasks One or more "assets tasks" which will be merged in the given order
|
|
@@ -325,6 +450,10 @@ export declare class CustomControl {
|
|
|
325
450
|
*
|
|
326
451
|
* !!! Important !!!
|
|
327
452
|
*
|
|
453
|
+
* See {@link OnRenderedCallback} for important information regarding the `element` which is passed to the callback.
|
|
454
|
+
*
|
|
455
|
+
* !!! Important !!!
|
|
456
|
+
*
|
|
328
457
|
* This is **not** meant to be used for manipulating the rendered content of the control besides simple,
|
|
329
458
|
* non-structural/-behavioral changes like adding CSS classes or data attributes etc.
|
|
330
459
|
*
|
|
@@ -343,12 +472,99 @@ export declare class CustomControl {
|
|
|
343
472
|
*/
|
|
344
473
|
declare type CustomCtrlRenderFn = (element: HTMLDivElement, rawHtml: string | undefined) => void | Promise<void>;
|
|
345
474
|
|
|
346
|
-
|
|
475
|
+
/**
|
|
476
|
+
* The actual value which comes from the entries data and which is converted to `DataListHtmlValue` before being passed
|
|
477
|
+
* to the DOM elements.
|
|
478
|
+
*/
|
|
479
|
+
declare type DataListValue = string | string[] | number | number[] | undefined;
|
|
480
|
+
|
|
481
|
+
export declare class Dataview<TValue extends NonNullable<DataListValue>> {
|
|
347
482
|
#private;
|
|
348
483
|
readonly id: CtrlId;
|
|
349
484
|
constructor(id: CtrlId);
|
|
485
|
+
/**
|
|
486
|
+
* See {@link CustomControl.onRendered} for detailed information on what you can do with this listener and what it is
|
|
487
|
+
* not meant for.
|
|
488
|
+
*
|
|
489
|
+
* Also see {@link OnRenderedCallback} for important information regarding the `element` which is passed to the
|
|
490
|
+
* callback.
|
|
491
|
+
*/
|
|
350
492
|
onRendered(callback: OnRenderedCallback<HTMLDivElement>): CallbackUnsubscribeOption;
|
|
493
|
+
/**
|
|
494
|
+
* See {@link CustomControl.onRendered} for detailed information on what you can do with this listener and what it is
|
|
495
|
+
* not meant for. Most of the information there also applies to `onItemRendered`.
|
|
496
|
+
*
|
|
497
|
+
* Also see {@link OnRenderedCallback} for important information regarding the `element` which is passed to the
|
|
498
|
+
* callback which also applies here.
|
|
499
|
+
*
|
|
500
|
+
* @param callback Callback function which is given the rendered HTML element and the corresponding item data.
|
|
501
|
+
*
|
|
502
|
+
* Typical usage for type safe access to the item data where `IProductsTable` is the auto generated
|
|
503
|
+
* type of the table component from which the dataview entries are populated:
|
|
504
|
+
*
|
|
505
|
+
* ```ts
|
|
506
|
+
* dataview.onItemRendered<IProductsTable[number]>(el, itemData) => { ... }
|
|
507
|
+
* ```
|
|
508
|
+
*/
|
|
509
|
+
onItemRendered<TItemData>(callback: (element: HTMLDivElement, itemData: TItemData) => void): CallbackUnsubscribeOption;
|
|
510
|
+
/**
|
|
511
|
+
* See {@link CustomControl.onRendered} for detailed information on what you can do with this listener and what it is
|
|
512
|
+
* not meant for. Most of the information there also applies to `onGroupHeaderRendered`.
|
|
513
|
+
*
|
|
514
|
+
* Also see {@link OnRenderedCallback} for important information regarding the `element` which is passed to the
|
|
515
|
+
* callback which also applies here.
|
|
516
|
+
*
|
|
517
|
+
* @param callback Callback function which is given the rendered HTML element and the corresponding group data.
|
|
518
|
+
*
|
|
519
|
+
* Typical usage for type safe access to the group data where `IProductGroupsTable` is the auto
|
|
520
|
+
* generated type of the table component from which the dataview groups are populated:
|
|
521
|
+
*
|
|
522
|
+
* ```ts
|
|
523
|
+
* dataview.onGroupHeaderRendered<IProductGroupsTable[number]>((el, groupData) => { ... })
|
|
524
|
+
* ```
|
|
525
|
+
*/
|
|
526
|
+
onGroupHeaderRendered<TGroupData>(callback: (element: HTMLDivElement, groupData: TGroupData) => void): CallbackUnsubscribeOption;
|
|
527
|
+
/**
|
|
528
|
+
* @param callback Callback function which is given the raw selection value/keys and the corresponding item data of
|
|
529
|
+
* all the selected items.
|
|
530
|
+
*
|
|
531
|
+
* Typical usage for type safe access to the item data where `IProductsTable` is the auto generated
|
|
532
|
+
* type of the table component from which the dataview entries are populated:
|
|
533
|
+
*
|
|
534
|
+
* ```ts
|
|
535
|
+
* // Single selection list:
|
|
536
|
+
* dataview.onValueChange<IProductsTable[number]>(value, valueItemData) => { ... }
|
|
537
|
+
*
|
|
538
|
+
* // Multi selection list:
|
|
539
|
+
* dataview.onValueChange<IProductsTable>(value, valueItemData) => { ... }
|
|
540
|
+
* ```
|
|
541
|
+
*/
|
|
542
|
+
onValueChange<TItemData extends TValue extends any[] ? any[] : any>(callback: (value: TValue | undefined, valueItemData: TItemData | undefined) => void): CallbackUnsubscribeOption;
|
|
543
|
+
/**
|
|
544
|
+
* Registers a callback that fires when a datalist item is clicked.
|
|
545
|
+
*
|
|
546
|
+
* - Fires **before** `onValueChange`.
|
|
547
|
+
* - Fires even when the clicked item is already selected.
|
|
548
|
+
*
|
|
549
|
+
* @param callback Callback function which is given the item data of rendered item and the raw mouse event.
|
|
550
|
+
*
|
|
551
|
+
* Typical usage for type safe access to the item data where `IProductsTable` is the auto generated
|
|
552
|
+
* type of the table component from which the dataview entries are populated:
|
|
553
|
+
*
|
|
554
|
+
* ```ts
|
|
555
|
+
* dataview.onItemClicked<IProductsTable[number]>(itemData, event) => { ... }
|
|
556
|
+
* ```
|
|
557
|
+
*/
|
|
558
|
+
onItemClicked<TItemData>(callback: (itemData: TItemData, event: MouseEvent) => void): CallbackUnsubscribeOption;
|
|
351
559
|
setVisible(visible: boolean): Promise<void>;
|
|
560
|
+
/**
|
|
561
|
+
* Sets the entries (data items) displayed by the dataview. Existing entries are overwritten.
|
|
562
|
+
*/
|
|
563
|
+
setEntries(entries: TemplateData[]): void;
|
|
564
|
+
/**
|
|
565
|
+
* Sets the group data used to render the group headers of the dataview. Existing group data is overwritten.
|
|
566
|
+
*/
|
|
567
|
+
setGroupData(groupData: TemplateData[]): void;
|
|
352
568
|
}
|
|
353
569
|
|
|
354
570
|
export declare type DocumentConvertTask = {
|
|
@@ -372,13 +588,6 @@ export declare type DocumentConvertTask = {
|
|
|
372
588
|
name: string;
|
|
373
589
|
/** Names of the tasks which should be merged in the given order */
|
|
374
590
|
inputTaskNames: string[];
|
|
375
|
-
} | {
|
|
376
|
-
type: DocumentConvertTaskTypes.Watermark;
|
|
377
|
-
name: string;
|
|
378
|
-
inputTaskName: string;
|
|
379
|
-
/** Minimum property requirement is either a `text` or a `imageInputTaskName`
|
|
380
|
-
* (which points to a task of type {@link DocumentConvertTaskTypes.Asset}) */
|
|
381
|
-
options: WatermarkImageOptions | WatermarkTextOptions;
|
|
382
591
|
} | {
|
|
383
592
|
type: DocumentConvertTaskTypes.OutputToCfgnFile;
|
|
384
593
|
name: string;
|
|
@@ -393,12 +602,10 @@ export declare type DocumentConvertTask = {
|
|
|
393
602
|
export declare enum DocumentConvertTaskTypes {
|
|
394
603
|
/** Create a PDF with dynamic content based on the given `context` */
|
|
395
604
|
PdfAsset = 0,
|
|
396
|
-
/** Retrieve an asset to be used for suceeding tasks (e.g. static PDF for merge
|
|
605
|
+
/** Retrieve an asset to be used for suceeding tasks (e.g. static PDF for merge) */
|
|
397
606
|
Asset = 1,
|
|
398
607
|
/** Merge multiple input tasks into a single document */
|
|
399
608
|
Merge = 2,
|
|
400
|
-
/** Add a repeating watermark onto the whole document */
|
|
401
|
-
Watermark = 3,
|
|
402
609
|
/** Finalize the conversion by storing it as `Configuration file` */
|
|
403
610
|
OutputToCfgnFile = 4
|
|
404
611
|
}
|
|
@@ -493,6 +700,13 @@ export declare class Input {
|
|
|
493
700
|
#private;
|
|
494
701
|
readonly id: CtrlId;
|
|
495
702
|
constructor(id: CtrlId);
|
|
703
|
+
/**
|
|
704
|
+
* See {@link CustomControl.onRendered} for detailed information on what you can do with this listener and what it is
|
|
705
|
+
* not meant for.
|
|
706
|
+
*
|
|
707
|
+
* Also see {@link OnRenderedCallback} for important information regarding the `element` which is passed to the
|
|
708
|
+
* callback.
|
|
709
|
+
*/
|
|
496
710
|
onRendered(callback: OnRenderedCallback<HTMLDivElement>): CallbackUnsubscribeOption;
|
|
497
711
|
setVisible(visible: boolean): Promise<void>;
|
|
498
712
|
}
|
|
@@ -558,12 +772,54 @@ export declare const onAnyCmpValueChanged: <TInput extends ValueComponent>(liste
|
|
|
558
772
|
|
|
559
773
|
declare type OnClickCallback = () => void;
|
|
560
774
|
|
|
775
|
+
/**
|
|
776
|
+
* Registers a callback for events from the parent page.\
|
|
777
|
+
* The parent page can send those events by calling `Combeenation.sendEventToConfigurator`.
|
|
778
|
+
*/
|
|
779
|
+
export declare const onParentPageEvent: (callback: (type: "success" | "error", data: unknown) => void) => CallbackUnsubscribeOption;
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* @param element The rendered DOM element.
|
|
783
|
+
*
|
|
784
|
+
* !!! Important !!!
|
|
785
|
+
*
|
|
786
|
+
* This can either be a newly created element or the same, reused element which was already passed to a
|
|
787
|
+
* previous `onRendered` callback invocation.
|
|
788
|
+
*
|
|
789
|
+
* What does this mean?
|
|
790
|
+
* - When registering event listener, avoid `element.addEventListener` but use the form
|
|
791
|
+
* `element.onclick = ...` instead.
|
|
792
|
+
* - Be careful when using API like `MutationObserver` on the element and ensure to not register multiple
|
|
793
|
+
* observer on the same element over time.
|
|
794
|
+
* - Be careful when binding/using the element in external libraries which might use `addEventListener`
|
|
795
|
+
* or things like `MutationObserver` internally (e.g. DnD libraries etc.).
|
|
796
|
+
* - If you **need to** use `addEventListener` etc. e.g. because you have to use a library which uses it
|
|
797
|
+
* internally, make sure to manually check whether the element was already processed/initialized in a
|
|
798
|
+
* previous `onRendered` invocation or not.
|
|
799
|
+
*
|
|
800
|
+
* E.g. something like this:
|
|
801
|
+
*
|
|
802
|
+
* ```ts
|
|
803
|
+
* dataview.onRendered((element) => {
|
|
804
|
+
* if (element.dataset.wasVisited) return;
|
|
805
|
+
* element.dataset.wasVisited = 'true';
|
|
806
|
+
*
|
|
807
|
+
* // -> Safely use `element.addEventListener` or `dndManager.init(element)` etc.
|
|
808
|
+
* });
|
|
809
|
+
*/
|
|
561
810
|
declare type OnRenderedCallback<T extends HTMLElement = HTMLElement> = (element: T) => void;
|
|
562
811
|
|
|
563
812
|
export declare class Panel {
|
|
564
813
|
#private;
|
|
565
814
|
readonly id: CtrlId;
|
|
566
815
|
constructor(id: CtrlId);
|
|
816
|
+
/**
|
|
817
|
+
* See {@link CustomControl.onRendered} for detailed information on what you can do with this listener and what it is
|
|
818
|
+
* not meant for.
|
|
819
|
+
*
|
|
820
|
+
* Also see {@link OnRenderedCallback} for important information regarding the `element` which is passed to the
|
|
821
|
+
* callback.
|
|
822
|
+
*/
|
|
567
823
|
onRendered(callback: OnRenderedCallback<HTMLDivElement>): CallbackUnsubscribeOption;
|
|
568
824
|
setVisible(visible: boolean): Promise<void>;
|
|
569
825
|
}
|
|
@@ -666,10 +922,18 @@ declare type SdkCfgnFileUploadResult<T extends string = string> = {
|
|
|
666
922
|
} | {
|
|
667
923
|
success: true;
|
|
668
924
|
urls: {
|
|
669
|
-
[fileName in T]:
|
|
925
|
+
[fileName in T]: string;
|
|
670
926
|
};
|
|
671
927
|
};
|
|
672
928
|
|
|
929
|
+
declare type SdkCfgnTempFileUploadResult = {
|
|
930
|
+
success: false;
|
|
931
|
+
urls?: never;
|
|
932
|
+
} | {
|
|
933
|
+
success: true;
|
|
934
|
+
urls: string[];
|
|
935
|
+
};
|
|
936
|
+
|
|
673
937
|
declare type SdkCreateArPageOptions = {
|
|
674
938
|
qrSubTitle?: string;
|
|
675
939
|
qrDescription?: string;
|
|
@@ -838,10 +1102,23 @@ declare type SyncCmpValuesStore<TCmps extends Record<CmpName, ValueComponent>> =
|
|
|
838
1102
|
[K in keyof TCmps & CmpName]: TCmps[K] extends ValueComponent<any, infer TValue, any> ? TValue | undefined : never;
|
|
839
1103
|
};
|
|
840
1104
|
|
|
1105
|
+
/**
|
|
1106
|
+
* The raw data passed to the corresponding liquid template (e.g. to a datalist item template or a group header
|
|
1107
|
+
* template etc.)
|
|
1108
|
+
*/
|
|
1109
|
+
declare type TemplateData = Record<string, unknown>;
|
|
1110
|
+
|
|
841
1111
|
declare class Text_2 {
|
|
842
1112
|
#private;
|
|
843
1113
|
readonly id: CtrlId;
|
|
844
1114
|
constructor(id: CtrlId);
|
|
1115
|
+
/**
|
|
1116
|
+
* See {@link CustomControl.onRendered} for detailed information on what you can do with this listener and what it is
|
|
1117
|
+
* not meant for.
|
|
1118
|
+
*
|
|
1119
|
+
* Also see {@link OnRenderedCallback} for important information regarding the `element` which is passed to the
|
|
1120
|
+
* callback.
|
|
1121
|
+
*/
|
|
845
1122
|
onRendered(callback: OnRenderedCallback<HTMLSpanElement>): CallbackUnsubscribeOption;
|
|
846
1123
|
setVisible(visible: boolean): Promise<void>;
|
|
847
1124
|
setText(text: string): void;
|
|
@@ -851,19 +1128,53 @@ export { Text_2 as Text }
|
|
|
851
1128
|
/**
|
|
852
1129
|
* Upload one or more files into the current configuration
|
|
853
1130
|
*
|
|
1131
|
+
* Consider using {@link uploadTempFiles} if the files don't need to be persisted and
|
|
1132
|
+
* aren't relevant for the finished configuration.
|
|
1133
|
+
*
|
|
854
1134
|
* @param files The key represents the name, which can be used in Hive with `configuration.GetFile("")`
|
|
855
1135
|
* @returns An object with the same keys as the input. The values contain according result information.
|
|
856
1136
|
*/
|
|
857
1137
|
export declare const uploadFiles: <T extends string>(files: CfgnFileUploadData<T>) => Promise<SdkCfgnFileUploadResult<T>>;
|
|
858
1138
|
|
|
859
1139
|
/**
|
|
860
|
-
* Upload one or more images into the current configuration
|
|
1140
|
+
* Upload one or more images into the current configuration.
|
|
1141
|
+
*
|
|
1142
|
+
* Consider using {@link uploadTempImages} if the images don't need to be persisted and
|
|
1143
|
+
* aren't relevant for the finished configuration.
|
|
861
1144
|
*
|
|
862
|
-
* @param
|
|
1145
|
+
* @param images The key represents the name, which can be used in Hive with `configuration.GetImage("")`
|
|
863
1146
|
* @returns An object with the same keys as the input. The values contain according result information.
|
|
864
1147
|
*/
|
|
865
1148
|
export declare const uploadImages: <T extends string>(images: CfgnFileUploadData<T>) => Promise<SdkCfgnFileUploadResult<T>>;
|
|
866
1149
|
|
|
1150
|
+
/**
|
|
1151
|
+
* Upload temporary files into the current configuration. This should only be used for files which don't need to be
|
|
1152
|
+
* persisted or aren't relevant for the finished configuration.
|
|
1153
|
+
* Examples:
|
|
1154
|
+
* - The user can upload multiple files but he still has to apply them on the product in a second step.
|
|
1155
|
+
* It's recommended to upload the files as temporary files and only upload them as cfgn files after they were
|
|
1156
|
+
* actually applied.
|
|
1157
|
+
*
|
|
1158
|
+
* @param files files to be uploaded
|
|
1159
|
+
* @returns on success it returns the URLs of the uploaded files in the same order as they were provided.
|
|
1160
|
+
*/
|
|
1161
|
+
export declare const uploadTempFiles: (files: FileOrDataUri[]) => Promise<SdkCfgnTempFileUploadResult>;
|
|
1162
|
+
|
|
1163
|
+
/**
|
|
1164
|
+
* Upload temporary images into the current configuration. This should only be used for files which don't need to be
|
|
1165
|
+
* persisted or aren't relevant for the finished configuration.
|
|
1166
|
+
* Examples:
|
|
1167
|
+
* - When creating a PDF with screenshots of the 3d model, the images can be uploaded as temporary files, as they
|
|
1168
|
+
* will be embedded in the PDF.
|
|
1169
|
+
* - The user can upload multiple images but he still has to apply them on the product in a second step.
|
|
1170
|
+
* It's recommended to upload the images as temporary files and only upload them as cfgn files after they were
|
|
1171
|
+
* actually applied.
|
|
1172
|
+
*
|
|
1173
|
+
* @param images images to be uploaded
|
|
1174
|
+
* @returns on success it returns the URLs of the uploaded images in the same order as they were provided.
|
|
1175
|
+
*/
|
|
1176
|
+
export declare const uploadTempImages: (images: FileOrDataUri[]) => Promise<SdkCfgnTempFileUploadResult>;
|
|
1177
|
+
|
|
867
1178
|
declare type UrlString = z.infer<typeof ZUrlString>;
|
|
868
1179
|
|
|
869
1180
|
/**
|
|
@@ -895,41 +1206,6 @@ export declare class ValueComponent<TName extends CmpName = CmpName, TValue exte
|
|
|
895
1206
|
|
|
896
1207
|
export declare const version: string;
|
|
897
1208
|
|
|
898
|
-
export declare enum WatermarkHorizontalAlignment {
|
|
899
|
-
Left = 0,
|
|
900
|
-
Center = 1,
|
|
901
|
-
Right = 2
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
declare type WatermarkImageOptions = WatermarkOptionsBase & {
|
|
905
|
-
imageInputTaskName: string;
|
|
906
|
-
imageHeight?: number;
|
|
907
|
-
imageWidth?: number;
|
|
908
|
-
text?: never;
|
|
909
|
-
};
|
|
910
|
-
|
|
911
|
-
declare type WatermarkOptionsBase = {
|
|
912
|
-
/** Opacity in % to make the watermark transparent. A value of 100 means it is fully visible. */
|
|
913
|
-
opacity?: number;
|
|
914
|
-
rotation?: number;
|
|
915
|
-
positionVertical?: WatermarkVerticalAlignment;
|
|
916
|
-
positionHorizontal?: WatermarkHorizontalAlignment;
|
|
917
|
-
};
|
|
918
|
-
|
|
919
|
-
declare type WatermarkTextOptions = WatermarkOptionsBase & {
|
|
920
|
-
text: string;
|
|
921
|
-
textFontSize?: number;
|
|
922
|
-
textFontColor?: string;
|
|
923
|
-
textFontName?: string;
|
|
924
|
-
imageInputTaskName?: never;
|
|
925
|
-
};
|
|
926
|
-
|
|
927
|
-
export declare enum WatermarkVerticalAlignment {
|
|
928
|
-
Top = 0,
|
|
929
|
-
Center = 1,
|
|
930
|
-
Bottom = 2
|
|
931
|
-
}
|
|
932
|
-
|
|
933
1209
|
declare const ZAssetName: z.ZodString;
|
|
934
1210
|
|
|
935
1211
|
declare const ZCmpValue: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>, "many">, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, z.ZodUnknown]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combeenation/custom-code-sdk",
|
|
3
|
-
"version": "0.0.1-
|
|
3
|
+
"version": "0.0.1-alpha13",
|
|
4
4
|
"description": "Combeenation custom code SDK package",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "",
|
|
@@ -30,13 +30,15 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@combeenation/configurator-client": "*",
|
|
33
|
+
"@microsoft/api-extractor": "7.58.7",
|
|
33
34
|
"@repo/std-configs": "*",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
35
|
+
"@repo/std-lib": "*",
|
|
36
|
+
"typescript": "6.0.3",
|
|
37
|
+
"unplugin-dts": "1.0.1",
|
|
38
|
+
"vite": "8.0.14"
|
|
37
39
|
},
|
|
38
40
|
"@comment dependencies": [
|
|
39
|
-
"All our external (!) sub dependencies shall be included in `vite.config.ts:
|
|
41
|
+
"All our external (!) sub dependencies shall be included in `vite.config.ts:rolldownOptions.external`.",
|
|
40
42
|
"See comment there for more details on why."
|
|
41
43
|
],
|
|
42
44
|
"@comment devDependencies": {
|
|
@@ -47,7 +49,7 @@
|
|
|
47
49
|
"",
|
|
48
50
|
"Listing it as `devDependencies` prevents the package from showing up in the builts package's `package.json` and",
|
|
49
51
|
"Vite embeds the required code from the dependency directly into our built package as long as it is not listed",
|
|
50
|
-
"in Vite's `
|
|
52
|
+
"in Vite's `rolldownOptions.external`.",
|
|
51
53
|
"",
|
|
52
54
|
"In theory, we could list it as a normal dependency and pin it to a published version but that makes dev life",
|
|
53
55
|
"much harder e.g. when locally testing changes to the `custom-code-sdk` in a consuming project.",
|