@combeenation/custom-code-sdk 0.0.1-alpha2 → 0.0.1-alpha4
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/README.md +0 -0
- package/dist/bundle.cjs.js +10 -10
- package/dist/bundle.es.js +5268 -5181
- package/dist/index.d.ts +77 -59
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
export declare class Button
|
|
3
|
+
export declare class Button {
|
|
4
4
|
#private;
|
|
5
|
-
readonly
|
|
6
|
-
|
|
7
|
-
constructor(name: TName);
|
|
5
|
+
readonly id: CtrlId;
|
|
6
|
+
constructor(id: CtrlId);
|
|
8
7
|
onRendered(callback: OnRenderedCallback<HTMLButtonElement>): CallbackUnsubscribeOption;
|
|
9
8
|
onClick(callback: OnClickCallback): CallbackUnsubscribeOption;
|
|
10
|
-
setVisible(visible: boolean): void
|
|
9
|
+
setVisible(visible: boolean): Promise<void>;
|
|
11
10
|
setText(text: string): void;
|
|
12
11
|
}
|
|
13
12
|
|
|
@@ -15,31 +14,21 @@ declare type CallbackUnsubscribeOption = {
|
|
|
15
14
|
unsubscribe: () => void;
|
|
16
15
|
};
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
* Our custom code SDK is using the `ConfiguratorClient` as its main gateway to communicate with cmps. It comes with the
|
|
22
|
-
* `ConfiguratorClient` built in and only knows about the API of the version is was built with.
|
|
23
|
-
*
|
|
24
|
-
* Therefore, we'll always have to support older versions of the public API for custom code as well at "system runtime".
|
|
25
|
-
*
|
|
26
|
-
* Custom code shall always access the `ConfiguratorClient` via some well defined "gateway fn" like
|
|
27
|
-
* `window.Cbn.getCustomCodeSdkBridge().createCfgrClient` which is responsible for returning the correct versioned API
|
|
28
|
-
* e.g. by "hotpatching" the returned runtime object based on the requested version.
|
|
29
|
-
*/
|
|
17
|
+
declare type CfgrClient = NonNullable<typeof client>;
|
|
18
|
+
|
|
30
19
|
declare interface CfgrClientApi_v1 {
|
|
20
|
+
finishConfiguration: (input?: string) => Promise<FinishResult>;
|
|
31
21
|
onAnyCmpValueChanged<TInput extends ValueComponent_2>(listener: CmpValuesChangedListener<TInput['name']>, components: TInput[], lazy?: boolean): Promise<void>;
|
|
32
22
|
getCmpValue<T extends CmpValue_2>(cmpName: CmpName_2): Promise<T | undefined>;
|
|
33
23
|
onCmpValueChanged<TValue extends CmpValue_2>(cmpName: CmpName_2, listener: CmpValueChangedListener_2<TValue>, condition?: CmpValueChangedCondition_2<TValue>, callImmediately?: boolean): Promise<void>;
|
|
34
24
|
}
|
|
35
25
|
|
|
36
|
-
export declare class Checkbox
|
|
26
|
+
export declare class Checkbox {
|
|
37
27
|
#private;
|
|
38
|
-
readonly
|
|
39
|
-
|
|
40
|
-
constructor(name: TName);
|
|
28
|
+
readonly id: CtrlId;
|
|
29
|
+
constructor(id: CtrlId);
|
|
41
30
|
onRendered(callback: OnRenderedCallback<HTMLLabelElement>): CallbackUnsubscribeOption;
|
|
42
|
-
setVisible(visible: boolean): void
|
|
31
|
+
setVisible(visible: boolean): Promise<void>;
|
|
43
32
|
}
|
|
44
33
|
|
|
45
34
|
declare const client: CfgrClientApi_v1 | undefined;
|
|
@@ -76,73 +65,102 @@ declare interface CmpValuesChangedListener<TName extends string = string> {
|
|
|
76
65
|
(changedCmps: CmpValueChangedMap<TName>): void;
|
|
77
66
|
}
|
|
78
67
|
|
|
79
|
-
export declare class Collapsible
|
|
68
|
+
export declare class Collapsible {
|
|
80
69
|
#private;
|
|
81
|
-
readonly
|
|
82
|
-
|
|
83
|
-
constructor(name: TName);
|
|
70
|
+
readonly id: CtrlId;
|
|
71
|
+
constructor(id: CtrlId);
|
|
84
72
|
onRendered(callback: OnRenderedCallback<HTMLDivElement>): CallbackUnsubscribeOption;
|
|
85
|
-
setVisible(visible: boolean): void
|
|
73
|
+
setVisible(visible: boolean): Promise<void>;
|
|
86
74
|
}
|
|
87
75
|
|
|
88
76
|
declare type CtrlId = z.infer<typeof ZCtrlId>;
|
|
89
77
|
|
|
90
|
-
export declare class CustomControl
|
|
78
|
+
export declare class CustomControl {
|
|
91
79
|
#private;
|
|
92
|
-
readonly
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
80
|
+
readonly id: CtrlId;
|
|
81
|
+
constructor(id: CtrlId);
|
|
82
|
+
/**
|
|
83
|
+
* Things to mention when writing docs:
|
|
84
|
+
* - Given `el` is only disconnected when ctrl is hidden
|
|
85
|
+
* -> Event listener on that element shall only be installed once in custom code
|
|
86
|
+
* Explicitly mention that this is only the case for `customCtrl.renderFn` and not for `otherCtrls.onRendered`.
|
|
87
|
+
* - Assigning a new fn does not trigger a re-render
|
|
88
|
+
* - Explain, when this fn is being called (automatically on show, manually on `.render()`)
|
|
89
|
+
* - Explain, why this should be used instead of a pattern like the following:
|
|
90
|
+
* ```ts
|
|
91
|
+
* const el = myCtrl.getElement();
|
|
92
|
+
* el.innerHTML = '...';
|
|
93
|
+
* ```
|
|
94
|
+
* - Explain difference to `onRendered` (see comments on `useCustomCodeSdkBridgeStoreBase`)
|
|
95
|
+
* - ...
|
|
96
|
+
*/
|
|
97
|
+
set renderFn(callback: CustomCtrlRenderFn);
|
|
98
|
+
/**
|
|
99
|
+
* @param renderFn Convenience param which allows setting the `renderFn` and triggering a render in one call.
|
|
100
|
+
* The `renderFn` will be permanently installed and will override any existing `renderFn`.
|
|
101
|
+
*/
|
|
102
|
+
render(renderFn?: CustomCtrlRenderFn): Promise<void>;
|
|
96
103
|
getElement(): HTMLElement | undefined;
|
|
97
|
-
setVisible(visible: boolean): void
|
|
104
|
+
setVisible(visible: boolean): Promise<void>;
|
|
98
105
|
}
|
|
99
106
|
|
|
100
|
-
|
|
101
|
-
declare type CustomCtrlRenderCallback = (element: HTMLDivElement, rawHtml: string | undefined) => void;
|
|
107
|
+
declare type CustomCtrlRenderFn = (element: HTMLDivElement, rawHtml: string | undefined) => void | Promise<void>;
|
|
102
108
|
|
|
103
|
-
export declare class Dataview
|
|
109
|
+
export declare class Dataview {
|
|
104
110
|
#private;
|
|
105
|
-
readonly
|
|
106
|
-
|
|
107
|
-
constructor(name: TName);
|
|
111
|
+
readonly id: CtrlId;
|
|
112
|
+
constructor(id: CtrlId);
|
|
108
113
|
onRendered(callback: OnRenderedCallback<HTMLDivElement>): CallbackUnsubscribeOption;
|
|
109
|
-
setVisible(visible: boolean): void
|
|
114
|
+
setVisible(visible: boolean): Promise<void>;
|
|
110
115
|
}
|
|
111
116
|
|
|
112
|
-
export declare
|
|
117
|
+
export declare const finishConfiguration: CfgrClient['finishConfiguration'];
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Why we need this?
|
|
121
|
+
*
|
|
122
|
+
* Our custom code SDK is using the `ConfiguratorClient` as its main gateway to communicate with cmps. It comes with the
|
|
123
|
+
* `ConfiguratorClient` built in and only knows about the API of the version is was built with.
|
|
124
|
+
*
|
|
125
|
+
* Therefore, we'll always have to support older versions of the public API for custom code as well at "system runtime".
|
|
126
|
+
*
|
|
127
|
+
* Custom code shall always access the `ConfiguratorClient` via some well defined "gateway fn" like
|
|
128
|
+
* `window.Cbn.getCustomCodeSdkBridge().createCfgrClient` which is responsible for returning the correct versioned API
|
|
129
|
+
* e.g. by "hotpatching" the returned runtime object based on the requested version.
|
|
130
|
+
*/
|
|
131
|
+
declare type FinishResult = {
|
|
132
|
+
newEditCfgnUrl: string;
|
|
133
|
+
actionResults: {};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export declare class Input {
|
|
113
137
|
#private;
|
|
114
|
-
readonly
|
|
115
|
-
|
|
116
|
-
constructor(name: TName);
|
|
138
|
+
readonly id: CtrlId;
|
|
139
|
+
constructor(id: CtrlId);
|
|
117
140
|
onRendered(callback: OnRenderedCallback<HTMLDivElement>): CallbackUnsubscribeOption;
|
|
118
|
-
setVisible(visible: boolean): void
|
|
141
|
+
setVisible(visible: boolean): Promise<void>;
|
|
119
142
|
}
|
|
120
143
|
|
|
121
|
-
declare
|
|
122
|
-
|
|
123
|
-
export declare const onAnyCmpValueChanged: OnAnyCmpValueChanged;
|
|
144
|
+
export declare const onAnyCmpValueChanged: CfgrClient['onAnyCmpValueChanged'];
|
|
124
145
|
|
|
125
146
|
declare type OnClickCallback = () => void;
|
|
126
147
|
|
|
127
|
-
/** See {@link useCustomCodeSdkBridgeStoreBase} for details about `render` & `onRendered` callbacks */
|
|
128
148
|
declare type OnRenderedCallback<T extends HTMLElement = HTMLElement> = (element: T) => void;
|
|
129
149
|
|
|
130
|
-
export declare class Panel
|
|
150
|
+
export declare class Panel {
|
|
131
151
|
#private;
|
|
132
|
-
readonly
|
|
133
|
-
|
|
134
|
-
constructor(name: TName);
|
|
152
|
+
readonly id: CtrlId;
|
|
153
|
+
constructor(id: CtrlId);
|
|
135
154
|
onRendered(callback: OnRenderedCallback<HTMLDivElement>): CallbackUnsubscribeOption;
|
|
136
|
-
setVisible(visible: boolean): void
|
|
155
|
+
setVisible(visible: boolean): Promise<void>;
|
|
137
156
|
}
|
|
138
157
|
|
|
139
|
-
declare class Text_2
|
|
158
|
+
declare class Text_2 {
|
|
140
159
|
#private;
|
|
141
|
-
readonly
|
|
142
|
-
|
|
143
|
-
constructor(name: TName);
|
|
160
|
+
readonly id: CtrlId;
|
|
161
|
+
constructor(id: CtrlId);
|
|
144
162
|
onRendered(callback: OnRenderedCallback<HTMLSpanElement>): CallbackUnsubscribeOption;
|
|
145
|
-
setVisible(visible: boolean): void
|
|
163
|
+
setVisible(visible: boolean): Promise<void>;
|
|
146
164
|
setText(text: string): void;
|
|
147
165
|
}
|
|
148
166
|
export { Text_2 as Text }
|