datocms-plugin-sdk 0.2.0-alpha.65
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/LICENSE.md +21 -0
- package/README.md +17 -0
- package/dist/cjs/SiteApiSchema.js +6 -0
- package/dist/cjs/SiteApiSchema.js.map +1 -0
- package/dist/cjs/connect.js +236 -0
- package/dist/cjs/connect.js.map +1 -0
- package/dist/cjs/guards.js +17 -0
- package/dist/cjs/guards.js.map +1 -0
- package/dist/cjs/index.js +15 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/SiteApiSchema.d.ts +6841 -0
- package/dist/esm/SiteApiSchema.js +5 -0
- package/dist/esm/SiteApiSchema.js.map +1 -0
- package/dist/esm/connect.d.ts +126 -0
- package/dist/esm/connect.js +229 -0
- package/dist/esm/connect.js.map +1 -0
- package/dist/esm/guards.d.ts +30 -0
- package/dist/esm/guards.js +14 -0
- package/dist/esm/guards.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types.d.ts +937 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/types/SiteApiSchema.d.ts +6841 -0
- package/dist/types/connect.d.ts +126 -0
- package/dist/types/guards.d.ts +30 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/types.d.ts +937 -0
- package/package.json +45 -0
- package/types.json +11672 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SiteApiSchema.js","sourceRoot":"","sources":["../../src/SiteApiSchema.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,oBAAoB;AACpB,4FAA4F"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Field, ModelBlock } from './SiteApiSchema';
|
|
2
|
+
import { ContentAreaSidebarItem, FieldExtensionOverride, InitPropertiesAndMethods, ItemFormSidebarPanel, MainNavigationTab, ManualFieldExtension, OnBootPropertiesAndMethods, RenderConfigScreenPropertiesAndMethods, RenderFieldExtensionPropertiesAndMethods, RenderManualFieldExtensionConfigScreenPropertiesAndMethods, RenderModalPropertiesAndMethods, RenderPagePropertiesAndMethods, RenderSidebarPanePropertiesAndMethods, SettingsAreaSidebarItemGroup } from './types';
|
|
3
|
+
export declare type SizingUtilities = {
|
|
4
|
+
/** Listens for DOM changes and automatically calls `setHeight` when it detects a change */
|
|
5
|
+
startAutoResizer: () => void;
|
|
6
|
+
/** Stops resizing the iframe automatically */
|
|
7
|
+
stopAutoResizer: () => void;
|
|
8
|
+
/**
|
|
9
|
+
* Triggers a change in the size of the iframe. If you don't explicitely pass
|
|
10
|
+
* a `newHeight` it will be automatically calculated using the iframe content
|
|
11
|
+
* at the moment
|
|
12
|
+
*/
|
|
13
|
+
updateHeight: (newHeight?: number) => void;
|
|
14
|
+
};
|
|
15
|
+
export type { Field, ModelBlock };
|
|
16
|
+
export declare type IntentCtx = InitPropertiesAndMethods;
|
|
17
|
+
export declare type OnBootCtx = OnBootPropertiesAndMethods;
|
|
18
|
+
export declare type FieldIntentCtx = InitPropertiesAndMethods & {
|
|
19
|
+
itemType: ModelBlock;
|
|
20
|
+
};
|
|
21
|
+
export declare type RenderPageCtx = RenderPagePropertiesAndMethods;
|
|
22
|
+
export declare type RenderModalCtx = RenderModalPropertiesAndMethods & SizingUtilities;
|
|
23
|
+
export declare type RenderItemFormSidebarPanelCtx = RenderSidebarPanePropertiesAndMethods & SizingUtilities;
|
|
24
|
+
export declare type RenderFieldExtensionCtx = RenderFieldExtensionPropertiesAndMethods & SizingUtilities;
|
|
25
|
+
export declare type RenderManualFieldExtensionConfigScreenCtx = RenderManualFieldExtensionConfigScreenPropertiesAndMethods & SizingUtilities;
|
|
26
|
+
export declare type RenderConfigScreenCtx = RenderConfigScreenPropertiesAndMethods & SizingUtilities;
|
|
27
|
+
/** The full options you can pass to the `connect` function */
|
|
28
|
+
export declare type FullConnectParameters = {
|
|
29
|
+
/**
|
|
30
|
+
* This function will be called once at boot time and can be used to perform
|
|
31
|
+
* ie. some initial integrity checks on the configuration.
|
|
32
|
+
*
|
|
33
|
+
* @group boot
|
|
34
|
+
*/
|
|
35
|
+
onBoot: (ctx: OnBootCtx) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Use this function to declare new tabs you want to add in the top-bar of the UI
|
|
38
|
+
*
|
|
39
|
+
* @group pages
|
|
40
|
+
*/
|
|
41
|
+
mainNavigationTabs: (ctx: IntentCtx) => MainNavigationTab[];
|
|
42
|
+
/**
|
|
43
|
+
* Use this function to declare new navigation sections in the Settings Area sidebar
|
|
44
|
+
*
|
|
45
|
+
* @group pages
|
|
46
|
+
*/
|
|
47
|
+
settingsAreaSidebarItemGroups: (ctx: IntentCtx) => SettingsAreaSidebarItemGroup[];
|
|
48
|
+
/**
|
|
49
|
+
* Use this function to declare new navigation items in the Content Area sidebar
|
|
50
|
+
*
|
|
51
|
+
* @group pages
|
|
52
|
+
*/
|
|
53
|
+
contentAreaSidebarItems: (ctx: IntentCtx) => ContentAreaSidebarItem[];
|
|
54
|
+
/**
|
|
55
|
+
* Use this function to declare new field extensions that users will be able
|
|
56
|
+
* to install manually in some field
|
|
57
|
+
*
|
|
58
|
+
* @group manualFieldExtensions
|
|
59
|
+
*/
|
|
60
|
+
manualFieldExtensions: (ctx: IntentCtx) => ManualFieldExtension[];
|
|
61
|
+
/**
|
|
62
|
+
* Use this function to declare new sidebar panels to be shown when the user
|
|
63
|
+
* edits records of a particular model
|
|
64
|
+
*
|
|
65
|
+
* @group sidebarPanels
|
|
66
|
+
*/
|
|
67
|
+
itemFormSidebarPanels: (itemType: ModelBlock, ctx: IntentCtx) => ItemFormSidebarPanel[];
|
|
68
|
+
/**
|
|
69
|
+
* Use this function to automatically force one or more field extensions to a
|
|
70
|
+
* particular field
|
|
71
|
+
*
|
|
72
|
+
* @group forcedFieldExtensions
|
|
73
|
+
*/
|
|
74
|
+
overrideFieldExtensions: (field: Field, ctx: FieldIntentCtx) => FieldExtensionOverride | void;
|
|
75
|
+
/**
|
|
76
|
+
* This function will be called when the plugin needs to render the plugin's
|
|
77
|
+
* configuration form
|
|
78
|
+
*
|
|
79
|
+
* @group configScreen
|
|
80
|
+
*/
|
|
81
|
+
renderConfigScreen: (ctx: RenderConfigScreenCtx) => void;
|
|
82
|
+
/**
|
|
83
|
+
* This function will be called when the plugin needs to render a specific
|
|
84
|
+
* page (see the `mainNavigationTabs`, `settingsAreaSidebarItemGroups` and
|
|
85
|
+
* `contentAreaSidebarItems` functions)
|
|
86
|
+
*
|
|
87
|
+
* @group pages
|
|
88
|
+
*/
|
|
89
|
+
renderPage: (pageId: string, ctx: RenderPageCtx) => void;
|
|
90
|
+
/**
|
|
91
|
+
* This function will be called when the plugin requested to open a modal (see
|
|
92
|
+
* the `openModal` function)
|
|
93
|
+
*
|
|
94
|
+
* @group modals
|
|
95
|
+
*/
|
|
96
|
+
renderModal: (modalId: string, ctx: RenderModalCtx) => void;
|
|
97
|
+
/**
|
|
98
|
+
* This function will be called when the plugin needs to render a sidebar
|
|
99
|
+
* panel (see the `itemFormSidebarPanels` function)
|
|
100
|
+
*
|
|
101
|
+
* @group sidebarPanels
|
|
102
|
+
*/
|
|
103
|
+
renderItemFormSidebarPanel: (sidebarPaneId: string, ctx: RenderItemFormSidebarPanelCtx) => void;
|
|
104
|
+
/**
|
|
105
|
+
* This function will be called when the plugin needs to render a field
|
|
106
|
+
* extension (see the `manualFieldExtensions` and `overrideFieldExtensions` functions)
|
|
107
|
+
*
|
|
108
|
+
* @group forcedFieldExtensions
|
|
109
|
+
*/
|
|
110
|
+
renderFieldExtension: (fieldExtensionId: string, ctx: RenderFieldExtensionCtx) => void;
|
|
111
|
+
/**
|
|
112
|
+
* This function will be called when the plugin needs to render the
|
|
113
|
+
* configuration form for installing a field extension inside a particular field
|
|
114
|
+
*
|
|
115
|
+
* @group manualFieldExtensions
|
|
116
|
+
*/
|
|
117
|
+
renderManualFieldExtensionConfigScreen: (fieldExtensionId: string, ctx: RenderManualFieldExtensionConfigScreenCtx) => void;
|
|
118
|
+
/**
|
|
119
|
+
* This function will be called each time the configuration object changes. It
|
|
120
|
+
* must return an object containing possible validation errors
|
|
121
|
+
*
|
|
122
|
+
* @group manualFieldExtensions
|
|
123
|
+
*/
|
|
124
|
+
validateManualFieldExtensionParameters: (fieldExtensionId: string, parameters: Record<string, unknown>) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
125
|
+
};
|
|
126
|
+
export declare function connect(configuration?: Partial<FullConnectParameters>): Promise<void>;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import connectToParent from 'penpal/lib/connectToParent';
|
|
49
|
+
import { isInitParent, isOnBootParent, isRenderConfigScreenParent, isRenderFieldExtensionParent, isRenderManualFieldExtensionConfigScreenParent, isRenderModalParent, isRenderPageParent, isRenderSidebarPaneParent, } from './guards';
|
|
50
|
+
function toMultifield(fn) {
|
|
51
|
+
return function (fields, ctx) {
|
|
52
|
+
if (!fn) {
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
55
|
+
var result = {};
|
|
56
|
+
for (var _i = 0, fields_1 = fields; _i < fields_1.length; _i++) {
|
|
57
|
+
var field = fields_1[_i];
|
|
58
|
+
var itemType = ctx.itemTypes[field.relationships.item_type.data.id];
|
|
59
|
+
result[field.id] = fn(field, __assign(__assign({}, ctx), { itemType: itemType }));
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
var buildRenderUtils = function (parent) {
|
|
65
|
+
var oldHeight = null;
|
|
66
|
+
var updateHeight = function (height) {
|
|
67
|
+
var realHeight = height === undefined
|
|
68
|
+
? Math.ceil(document.documentElement.getBoundingClientRect().height)
|
|
69
|
+
: height;
|
|
70
|
+
if (realHeight !== oldHeight) {
|
|
71
|
+
parent.setHeight(realHeight);
|
|
72
|
+
oldHeight = realHeight;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var autoResizingActive = false;
|
|
76
|
+
var mutationObserver = null;
|
|
77
|
+
var resetHeight = function () { return updateHeight(); };
|
|
78
|
+
var startAutoResizer = function () {
|
|
79
|
+
updateHeight();
|
|
80
|
+
if (autoResizingActive) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
autoResizingActive = true;
|
|
84
|
+
mutationObserver = new MutationObserver(resetHeight);
|
|
85
|
+
mutationObserver.observe(window.document.body, {
|
|
86
|
+
attributes: true,
|
|
87
|
+
childList: true,
|
|
88
|
+
subtree: true,
|
|
89
|
+
characterData: true,
|
|
90
|
+
});
|
|
91
|
+
window.addEventListener('resize', resetHeight);
|
|
92
|
+
};
|
|
93
|
+
var stopAutoResizer = function () {
|
|
94
|
+
if (!autoResizingActive) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
autoResizingActive = false;
|
|
98
|
+
if (mutationObserver) {
|
|
99
|
+
mutationObserver.disconnect();
|
|
100
|
+
}
|
|
101
|
+
window.removeEventListener('resize', resetHeight);
|
|
102
|
+
};
|
|
103
|
+
return { updateHeight: updateHeight, startAutoResizer: startAutoResizer, stopAutoResizer: stopAutoResizer };
|
|
104
|
+
};
|
|
105
|
+
export function connect(configuration) {
|
|
106
|
+
if (configuration === void 0) { configuration = {}; }
|
|
107
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
+
var mainNavigationTabs, settingsAreaSidebarItemGroups, contentAreaSidebarItems, manualFieldExtensions, itemFormSidebarPanels, listener, penpalConnection, parent, initialSettings, render, render, renderUtils_1, render, renderUtils_2, render, renderUtils_3, render, renderUtils_4, render, renderUtils_5, render;
|
|
109
|
+
return __generator(this, function (_a) {
|
|
110
|
+
switch (_a.label) {
|
|
111
|
+
case 0:
|
|
112
|
+
mainNavigationTabs = configuration.mainNavigationTabs, settingsAreaSidebarItemGroups = configuration.settingsAreaSidebarItemGroups, contentAreaSidebarItems = configuration.contentAreaSidebarItems, manualFieldExtensions = configuration.manualFieldExtensions, itemFormSidebarPanels = configuration.itemFormSidebarPanels;
|
|
113
|
+
listener = null;
|
|
114
|
+
penpalConnection = connectToParent({
|
|
115
|
+
methods: {
|
|
116
|
+
sdkVersion: function () { return '0.2.0'; },
|
|
117
|
+
implementedHooks: function () {
|
|
118
|
+
return Object.fromEntries(Object.entries(configuration).map(function (_a) {
|
|
119
|
+
var key = _a[0], value = _a[1];
|
|
120
|
+
if (typeof value === 'function') {
|
|
121
|
+
return [key, true];
|
|
122
|
+
}
|
|
123
|
+
return [key, value];
|
|
124
|
+
}));
|
|
125
|
+
},
|
|
126
|
+
mainNavigationTabs: mainNavigationTabs,
|
|
127
|
+
settingsAreaSidebarItemGroups: settingsAreaSidebarItemGroups,
|
|
128
|
+
contentAreaSidebarItems: contentAreaSidebarItems,
|
|
129
|
+
manualFieldExtensions: manualFieldExtensions,
|
|
130
|
+
itemFormSidebarPanels: itemFormSidebarPanels,
|
|
131
|
+
overrideFieldExtensions: toMultifield(configuration.overrideFieldExtensions),
|
|
132
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
133
|
+
onChange: function (newSettings) {
|
|
134
|
+
if (listener) {
|
|
135
|
+
listener(newSettings);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
validateManualFieldExtensionParameters: configuration.validateManualFieldExtensionParameters,
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
return [4 /*yield*/, penpalConnection.promise];
|
|
142
|
+
case 1:
|
|
143
|
+
parent = _a.sent();
|
|
144
|
+
return [4 /*yield*/, parent.getSettings()];
|
|
145
|
+
case 2:
|
|
146
|
+
initialSettings = _a.sent();
|
|
147
|
+
if (isInitParent(parent, initialSettings)) {
|
|
148
|
+
// Nothing to do. Parent calls the method they need.
|
|
149
|
+
}
|
|
150
|
+
if (isOnBootParent(parent, initialSettings)) {
|
|
151
|
+
render = function (settings) {
|
|
152
|
+
if (!configuration.onBoot) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
configuration.onBoot(__assign(__assign({}, parent), settings));
|
|
156
|
+
};
|
|
157
|
+
render(initialSettings);
|
|
158
|
+
}
|
|
159
|
+
if (isRenderPageParent(parent, initialSettings)) {
|
|
160
|
+
render = function (settings) {
|
|
161
|
+
if (!configuration.renderPage) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
configuration.renderPage(settings.pageId, __assign(__assign({}, parent), settings));
|
|
165
|
+
};
|
|
166
|
+
listener = render;
|
|
167
|
+
render(initialSettings);
|
|
168
|
+
}
|
|
169
|
+
if (isRenderConfigScreenParent(parent, initialSettings)) {
|
|
170
|
+
renderUtils_1 = buildRenderUtils(parent);
|
|
171
|
+
render = function (settings) {
|
|
172
|
+
if (!configuration.renderConfigScreen) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
configuration.renderConfigScreen(__assign(__assign(__assign({}, parent), settings), renderUtils_1));
|
|
176
|
+
};
|
|
177
|
+
listener = render;
|
|
178
|
+
render(initialSettings);
|
|
179
|
+
}
|
|
180
|
+
if (isRenderModalParent(parent, initialSettings)) {
|
|
181
|
+
renderUtils_2 = buildRenderUtils(parent);
|
|
182
|
+
render = function (settings) {
|
|
183
|
+
if (!configuration.renderModal) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
configuration.renderModal(settings.modalId, __assign(__assign(__assign({}, parent), settings), renderUtils_2));
|
|
187
|
+
};
|
|
188
|
+
listener = render;
|
|
189
|
+
render(initialSettings);
|
|
190
|
+
}
|
|
191
|
+
if (isRenderSidebarPaneParent(parent, initialSettings)) {
|
|
192
|
+
renderUtils_3 = buildRenderUtils(parent);
|
|
193
|
+
render = function (settings) {
|
|
194
|
+
if (!configuration.renderItemFormSidebarPanel) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
configuration.renderItemFormSidebarPanel(settings.sidebarPaneId, __assign(__assign(__assign({}, parent), settings), renderUtils_3));
|
|
198
|
+
};
|
|
199
|
+
listener = render;
|
|
200
|
+
render(initialSettings);
|
|
201
|
+
}
|
|
202
|
+
if (isRenderFieldExtensionParent(parent, initialSettings)) {
|
|
203
|
+
renderUtils_4 = buildRenderUtils(parent);
|
|
204
|
+
render = function (settings) {
|
|
205
|
+
if (!configuration.renderFieldExtension) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
configuration.renderFieldExtension(settings.fieldExtensionId, __assign(__assign(__assign({}, parent), settings), renderUtils_4));
|
|
209
|
+
};
|
|
210
|
+
listener = render;
|
|
211
|
+
render(initialSettings);
|
|
212
|
+
}
|
|
213
|
+
if (isRenderManualFieldExtensionConfigScreenParent(parent, initialSettings)) {
|
|
214
|
+
renderUtils_5 = buildRenderUtils(parent);
|
|
215
|
+
render = function (settings) {
|
|
216
|
+
if (!configuration.renderManualFieldExtensionConfigScreen) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
configuration.renderManualFieldExtensionConfigScreen(settings.fieldExtensionId, __assign(__assign(__assign({}, parent), settings), renderUtils_5));
|
|
220
|
+
};
|
|
221
|
+
listener = render;
|
|
222
|
+
render(initialSettings);
|
|
223
|
+
}
|
|
224
|
+
return [2 /*return*/];
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,eAAe,MAAM,4BAA4B,CAAC;AAyBzD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,0BAA0B,EAC1B,4BAA4B,EAC5B,8CAA8C,EAC9C,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,GAE1B,MAAM,UAAU,CAAC;AAyJlB,SAAS,YAAY,CACnB,EAA+D;IAE/D,OAAO,UACL,MAAe,EACf,GAA6B;QAE7B,IAAI,CAAC,EAAE,EAAE;YACP,OAAO,EAAE,CAAC;SACX;QAED,IAAM,MAAM,GAA2B,EAAE,CAAC;QAE1C,KAAoB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,EAAE;YAAvB,IAAM,KAAK,eAAA;YACd,IAAM,QAAQ,GAAG,GAAG,CAAC,SAAS,CAC5B,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CACxB,CAAC;YAChB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,wBAAO,GAAG,KAAE,QAAQ,UAAA,IAAG,CAAC;SACpD;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAcD,IAAM,gBAAgB,GAAG,UAAC,MAA+C;IACvE,IAAI,SAAS,G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AAM,CAAC,CAAC;wBAEvC,MAAM,GAAG,UAAC,QAAkB;4BAChC,IAAI,CAAC,aAAa,CAAC,sCAAsC,EAAE;gCACzD,OAAO;6BACR;4BAED,aAAa,CAAC,sCAAsC,CAClD,QAAQ,CAAC,gBAAgB,iCAEpB,MAAM,GACN,QAAQ,GACR,aAAW,EAEjB,CAAC;wBACJ,CAAC,CAAC;wBAEF,QAAQ,GAAG,MAAM,CAAC;wBAClB,MAAM,CAAC,eAA2B,CAAC,CAAC;qBACrC;;;;;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { InitMethods, OnBootMethods, RenderPageMethods, RenderFieldExtensionMethods, RenderConfigScreenMethods, RenderManualFieldExtensionConfigScreenMethods, RenderSidebarPanelMethods, RenderModalMethods } from './types';
|
|
2
|
+
export declare type Parent = {
|
|
3
|
+
getSettings: () => Promise<{
|
|
4
|
+
mode: string;
|
|
5
|
+
}>;
|
|
6
|
+
};
|
|
7
|
+
export declare const isInitParent: (parent: Parent, settings: {
|
|
8
|
+
mode: string;
|
|
9
|
+
}) => parent is InitMethods;
|
|
10
|
+
export declare const isOnBootParent: (parent: Parent, settings: {
|
|
11
|
+
mode: string;
|
|
12
|
+
}) => parent is OnBootMethods;
|
|
13
|
+
export declare const isRenderPageParent: (parent: Parent, settings: {
|
|
14
|
+
mode: string;
|
|
15
|
+
}) => parent is RenderPageMethods;
|
|
16
|
+
export declare const isRenderConfigScreenParent: (parent: Parent, settings: {
|
|
17
|
+
mode: string;
|
|
18
|
+
}) => parent is RenderConfigScreenMethods;
|
|
19
|
+
export declare const isRenderModalParent: (parent: Parent, settings: {
|
|
20
|
+
mode: string;
|
|
21
|
+
}) => parent is RenderModalMethods;
|
|
22
|
+
export declare const isRenderSidebarPaneParent: (parent: Parent, settings: {
|
|
23
|
+
mode: string;
|
|
24
|
+
}) => parent is RenderSidebarPanelMethods;
|
|
25
|
+
export declare const isRenderFieldExtensionParent: (parent: Parent, settings: {
|
|
26
|
+
mode: string;
|
|
27
|
+
}) => parent is RenderFieldExtensionMethods;
|
|
28
|
+
export declare const isRenderManualFieldExtensionConfigScreenParent: (parent: Parent, settings: {
|
|
29
|
+
mode: string;
|
|
30
|
+
}) => parent is RenderManualFieldExtensionConfigScreenMethods;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function buildGuard(mode) {
|
|
2
|
+
return function (parent, settings) {
|
|
3
|
+
return settings.mode === mode;
|
|
4
|
+
};
|
|
5
|
+
}
|
|
6
|
+
export var isInitParent = buildGuard('init');
|
|
7
|
+
export var isOnBootParent = buildGuard('onBoot');
|
|
8
|
+
export var isRenderPageParent = buildGuard('renderPage');
|
|
9
|
+
export var isRenderConfigScreenParent = buildGuard('renderConfigScreen');
|
|
10
|
+
export var isRenderModalParent = buildGuard('renderModal');
|
|
11
|
+
export var isRenderSidebarPaneParent = buildGuard('renderItemFormSidebarPanel');
|
|
12
|
+
export var isRenderFieldExtensionParent = buildGuard('renderFieldExtension');
|
|
13
|
+
export var isRenderManualFieldExtensionConfigScreenParent = buildGuard('renderManualFieldExtensionConfigScreen');
|
|
14
|
+
//# sourceMappingURL=guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/guards.ts"],"names":[],"mappings":"AAaA,SAAS,UAAU,CAAmB,IAAY;IAChD,OAAO,UAAC,MAAc,EAAE,QAA0B;QAChD,OAAA,QAAQ,CAAC,IAAI,KAAK,IAAI;IAAtB,CAAsB,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,IAAM,YAAY,GAAG,UAAU,CAAc,MAAM,CAAC,CAAC;AAE5D,MAAM,CAAC,IAAM,cAAc,GAAG,UAAU,CAAgB,QAAQ,CAAC,CAAC;AAElE,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAAU,CAAoB,YAAY,CAAC,CAAC;AAE9E,MAAM,CAAC,IAAM,0BAA0B,GAAG,UAAU,CAClD,oBAAoB,CACrB,CAAC;AAEF,MAAM,CAAC,IAAM,mBAAmB,GAAG,UAAU,CAC3C,aAAa,CACd,CAAC;AAEF,MAAM,CAAC,IAAM,yBAAyB,GAAG,UAAU,CACjD,4BAA4B,CAC7B,CAAC;AAEF,MAAM,CAAC,IAAM,4BAA4B,GAAG,UAAU,CACpD,sBAAsB,CACvB,CAAC;AAEF,MAAM,CAAC,IAAM,8CAA8C,GAAG,UAAU,CACtE,wCAAwC,CACzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AA0BA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|