datocms-plugin-sdk 0.7.3 → 0.7.5
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/cjs/connect.js +21 -11
- package/dist/cjs/connect.js.map +1 -1
- package/dist/esm/connect.d.ts +15 -1
- package/dist/esm/connect.js +21 -11
- package/dist/esm/connect.js.map +1 -1
- package/dist/esm/types.d.ts +35 -1
- package/dist/types/connect.d.ts +15 -1
- package/dist/types/types.d.ts +35 -1
- package/package.json +2 -2
- package/src/connect.ts +46 -11
- package/src/types.ts +47 -3
- package/types.json +3145 -2428
package/dist/cjs/connect.js
CHANGED
|
@@ -88,23 +88,33 @@ var buildRenderUtils = function (parent) {
|
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
90
|
var resizeObserver = null;
|
|
91
|
+
var mutationObserver = null;
|
|
92
|
+
var onMutation = function () { return updateHeight(); };
|
|
91
93
|
var startAutoResizer = function () {
|
|
92
94
|
updateHeight();
|
|
93
|
-
if (resizeObserver) {
|
|
94
|
-
|
|
95
|
+
if (!resizeObserver) {
|
|
96
|
+
resizeObserver = new ResizeObserver(onMutation);
|
|
97
|
+
resizeObserver.observe(document.documentElement);
|
|
98
|
+
}
|
|
99
|
+
if (!mutationObserver) {
|
|
100
|
+
mutationObserver = new MutationObserver(onMutation);
|
|
101
|
+
mutationObserver.observe(window.document.body, {
|
|
102
|
+
attributes: true,
|
|
103
|
+
childList: true,
|
|
104
|
+
subtree: true,
|
|
105
|
+
characterData: true,
|
|
106
|
+
});
|
|
95
107
|
}
|
|
96
|
-
resizeObserver = new ResizeObserver(function () {
|
|
97
|
-
// entries[entries.length - 1].borderBoxSize[0].blockSize;
|
|
98
|
-
updateHeight();
|
|
99
|
-
});
|
|
100
|
-
resizeObserver.observe(document.documentElement);
|
|
101
108
|
};
|
|
102
109
|
var stopAutoResizer = function () {
|
|
103
|
-
if (
|
|
104
|
-
|
|
110
|
+
if (resizeObserver) {
|
|
111
|
+
resizeObserver.disconnect();
|
|
112
|
+
resizeObserver = null;
|
|
113
|
+
}
|
|
114
|
+
if (mutationObserver) {
|
|
115
|
+
mutationObserver.disconnect();
|
|
116
|
+
mutationObserver = null;
|
|
105
117
|
}
|
|
106
|
-
resizeObserver.disconnect();
|
|
107
|
-
resizeObserver = null;
|
|
108
118
|
};
|
|
109
119
|
return { updateHeight: updateHeight, startAutoResizer: startAutoResizer, stopAutoResizer: stopAutoResizer };
|
|
110
120
|
};
|
package/dist/cjs/connect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAAyD;
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAAyD;AAoCzD,mCAWkB;AA2SlB,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,CAC1B,CAAC;YACd,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;AAOD,IAAM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,CAAC,EAAE;wBAKnD,gBAAc,gBAAgB,CAAC,MAAM,CAAC,CAAC;wBAEvC,MAAM,GAAG,UAAC,QAAkB;4BAChC,IAAI,CAAC,aAAa,CAAC,oBAAoB,EAAE;gCACvC,OAAO;6BACR;4BAED,aAAa,CAAC,oBAAoB,CAAC,QAAQ,CAAC,gBAAgB,iCACvD,MAAM,GACN,QAAQ,GACR,aAAW,EACd,CAAC;wBACL,CAAC,CAAC;wBAEF,QAAQ,GAAG,MAAM,CAAC;wBAClB,MAAM,CAAC,eAA2B,CAAC,CAAC;qBACrC;oBAED,IAAI,IAAA,uDAA8C,EAAC,MAAM,EAAE,eAAe,CAAC,EAAE;wBAKrE,gBAAc,gBAAgB,CAAC,MAAM,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;AA1RD,0BA0RC"}
|
package/dist/esm/connect.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Field, Item, ItemCreateSchema, ItemType, ItemUpdateSchema } from './SiteApiSchema';
|
|
2
|
-
import { AssetSource, ContentAreaSidebarItem, FieldExtensionOverride, InitPropertiesAndMethods, ItemFormSidebarPanel, MainNavigationTab, ManualFieldExtension, OnBootPropertiesAndMethods, RenderAssetSourcePropertiesAndMethods, RenderConfigScreenPropertiesAndMethods, RenderFieldExtensionPropertiesAndMethods, RenderManualFieldExtensionConfigScreenPropertiesAndMethods, RenderModalPropertiesAndMethods, RenderPagePropertiesAndMethods, RenderSidebarPanelPropertiesAndMethods, SettingsAreaSidebarItemGroup } from './types';
|
|
2
|
+
import { AssetSource, ContentAreaSidebarItem, FieldExtensionOverride, InitialLocationQueryForItemSelector, InitPropertiesAndMethods, ItemFormSidebarPanel, ItemPresentationInfo, MainNavigationTab, ManualFieldExtension, OnBootPropertiesAndMethods, RenderAssetSourcePropertiesAndMethods, RenderConfigScreenPropertiesAndMethods, RenderFieldExtensionPropertiesAndMethods, RenderManualFieldExtensionConfigScreenPropertiesAndMethods, RenderModalPropertiesAndMethods, RenderPagePropertiesAndMethods, RenderSidebarPanelPropertiesAndMethods, SettingsAreaSidebarItemGroup } from './types';
|
|
3
3
|
import { ItemFormOutlet, RenderItemFormOutletPropertiesAndMethods, StructuredTextCustomBlockStyle, StructuredTextCustomMark } from '.';
|
|
4
4
|
export declare type SizingUtilities = {
|
|
5
5
|
/**
|
|
@@ -69,6 +69,20 @@ export declare type FullConnectParameters = {
|
|
|
69
69
|
* @tag beforeHooks
|
|
70
70
|
*/
|
|
71
71
|
onBeforeItemUpsert: (createOrUpdateItemPayload: ItemUpdateSchema | ItemCreateSchema, ctx: OnBootCtx) => MaybePromise<boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* Use this function to customize the presentation of a record action by
|
|
74
|
+
* returning `false`
|
|
75
|
+
*
|
|
76
|
+
* @tag customizeHooks
|
|
77
|
+
*/
|
|
78
|
+
buildItemPresentationInfo: (item: Item, ctx: OnBootCtx) => MaybePromise<ItemPresentationInfo | undefined>;
|
|
79
|
+
/**
|
|
80
|
+
* Use this function to customize the initial filters when opening an record
|
|
81
|
+
* selector via a "Single link" or "Multiple links" field
|
|
82
|
+
*
|
|
83
|
+
* @tag customizeHooks
|
|
84
|
+
*/
|
|
85
|
+
initialLocationQueryForItemSelector: (openerfield: Item, itemType: ItemType, ctx: OnBootCtx) => MaybePromise<InitialLocationQueryForItemSelector | undefined>;
|
|
72
86
|
/**
|
|
73
87
|
* Use this function to declare new tabs you want to add in the top-bar of the
|
|
74
88
|
* UI
|
package/dist/esm/connect.js
CHANGED
|
@@ -82,23 +82,33 @@ var buildRenderUtils = function (parent) {
|
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
var resizeObserver = null;
|
|
85
|
+
var mutationObserver = null;
|
|
86
|
+
var onMutation = function () { return updateHeight(); };
|
|
85
87
|
var startAutoResizer = function () {
|
|
86
88
|
updateHeight();
|
|
87
|
-
if (resizeObserver) {
|
|
88
|
-
|
|
89
|
+
if (!resizeObserver) {
|
|
90
|
+
resizeObserver = new ResizeObserver(onMutation);
|
|
91
|
+
resizeObserver.observe(document.documentElement);
|
|
92
|
+
}
|
|
93
|
+
if (!mutationObserver) {
|
|
94
|
+
mutationObserver = new MutationObserver(onMutation);
|
|
95
|
+
mutationObserver.observe(window.document.body, {
|
|
96
|
+
attributes: true,
|
|
97
|
+
childList: true,
|
|
98
|
+
subtree: true,
|
|
99
|
+
characterData: true,
|
|
100
|
+
});
|
|
89
101
|
}
|
|
90
|
-
resizeObserver = new ResizeObserver(function () {
|
|
91
|
-
// entries[entries.length - 1].borderBoxSize[0].blockSize;
|
|
92
|
-
updateHeight();
|
|
93
|
-
});
|
|
94
|
-
resizeObserver.observe(document.documentElement);
|
|
95
102
|
};
|
|
96
103
|
var stopAutoResizer = function () {
|
|
97
|
-
if (
|
|
98
|
-
|
|
104
|
+
if (resizeObserver) {
|
|
105
|
+
resizeObserver.disconnect();
|
|
106
|
+
resizeObserver = null;
|
|
107
|
+
}
|
|
108
|
+
if (mutationObserver) {
|
|
109
|
+
mutationObserver.disconnect();
|
|
110
|
+
mutationObserver = null;
|
|
99
111
|
}
|
|
100
|
-
resizeObserver.disconnect();
|
|
101
|
-
resizeObserver = null;
|
|
102
112
|
};
|
|
103
113
|
return { updateHeight: updateHeight, startAutoResizer: startAutoResizer, stopAutoResizer: stopAutoResizer };
|
|
104
114
|
};
|
package/dist/esm/connect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mapp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AC;wBAEF,QAAQ,GAAG,MAAM,CAAC;wBAClB,MAAM,CAAC,eAA2B,CAAC,CAAC;qBACrC;oBAED,IAAI,8CAA8C,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE;wBAKrE,gBAAc,gBAAgB,CAAC,MAAM,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"}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -6,6 +6,38 @@ export declare type Icon = string | {
|
|
|
6
6
|
viewBox: string;
|
|
7
7
|
content: string;
|
|
8
8
|
};
|
|
9
|
+
export declare type ItemListLocationQuery = {
|
|
10
|
+
locale?: string;
|
|
11
|
+
filter?: {
|
|
12
|
+
query?: string;
|
|
13
|
+
fields?: Record<string, unknown>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare type ItemPresentationInfo = {
|
|
17
|
+
/** The title to present the record */
|
|
18
|
+
title: string;
|
|
19
|
+
/** An image representative of the record */
|
|
20
|
+
imageUrl?: string;
|
|
21
|
+
/**
|
|
22
|
+
* If different plugins implement the `buildItemPresentationInfo` hook, the
|
|
23
|
+
* one with the lowest `rank` will be used. If you want to specify an explicit
|
|
24
|
+
* value for `rank`, make sure to offer a way for final users to customize it
|
|
25
|
+
* inside the plugin's settings form, otherwise the hardcoded value you choose
|
|
26
|
+
* might clash with the one of another plugin!
|
|
27
|
+
*/
|
|
28
|
+
rank?: number;
|
|
29
|
+
};
|
|
30
|
+
export declare type InitialLocationQueryForItemSelector = {
|
|
31
|
+
locationQuery: ItemListLocationQuery;
|
|
32
|
+
/**
|
|
33
|
+
* If different plugins implement the `initialLocationQueryForItemSelector`
|
|
34
|
+
* hook, the one with the lowest `rank` will be used. If you want to specify
|
|
35
|
+
* an explicit value for `rank`, make sure to offer a way for final users to
|
|
36
|
+
* customize it inside the plugin's settings form, otherwise the hardcoded
|
|
37
|
+
* value you choose might clash with the one of another plugin!
|
|
38
|
+
*/
|
|
39
|
+
rank?: number;
|
|
40
|
+
};
|
|
9
41
|
/** A tab to be displayed in the top-bar of the UI */
|
|
10
42
|
export declare type MainNavigationTab = {
|
|
11
43
|
/** Label to be shown. Must be unique. */
|
|
@@ -241,7 +273,7 @@ export declare type EditorOverride = {
|
|
|
241
273
|
*/
|
|
242
274
|
parameters?: Record<string, unknown>;
|
|
243
275
|
/**
|
|
244
|
-
* If multiple plugins override a field, the one with the
|
|
276
|
+
* If multiple plugins override a field, the one with the lowest `rank` will
|
|
245
277
|
* win. If you want to specify an explicit value for `rank`, make sure to
|
|
246
278
|
* offer a way for final users to customize it inside the plugin's settings
|
|
247
279
|
* form, otherwise the hardcoded value you choose might clash with the one of
|
|
@@ -788,9 +820,11 @@ export declare type ItemDialogMethods = {
|
|
|
788
820
|
selectItem: {
|
|
789
821
|
(itemTypeId: string, options: {
|
|
790
822
|
multiple: true;
|
|
823
|
+
initialLocationQuery?: ItemListLocationQuery;
|
|
791
824
|
}): Promise<Item[] | null>;
|
|
792
825
|
(itemTypeId: string, options?: {
|
|
793
826
|
multiple: false;
|
|
827
|
+
initialLocationQuery?: ItemListLocationQuery;
|
|
794
828
|
}): Promise<Item | null>;
|
|
795
829
|
};
|
|
796
830
|
/**
|
package/dist/types/connect.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Field, Item, ItemCreateSchema, ItemType, ItemUpdateSchema } from './SiteApiSchema';
|
|
2
|
-
import { AssetSource, ContentAreaSidebarItem, FieldExtensionOverride, InitPropertiesAndMethods, ItemFormSidebarPanel, MainNavigationTab, ManualFieldExtension, OnBootPropertiesAndMethods, RenderAssetSourcePropertiesAndMethods, RenderConfigScreenPropertiesAndMethods, RenderFieldExtensionPropertiesAndMethods, RenderManualFieldExtensionConfigScreenPropertiesAndMethods, RenderModalPropertiesAndMethods, RenderPagePropertiesAndMethods, RenderSidebarPanelPropertiesAndMethods, SettingsAreaSidebarItemGroup } from './types';
|
|
2
|
+
import { AssetSource, ContentAreaSidebarItem, FieldExtensionOverride, InitialLocationQueryForItemSelector, InitPropertiesAndMethods, ItemFormSidebarPanel, ItemPresentationInfo, MainNavigationTab, ManualFieldExtension, OnBootPropertiesAndMethods, RenderAssetSourcePropertiesAndMethods, RenderConfigScreenPropertiesAndMethods, RenderFieldExtensionPropertiesAndMethods, RenderManualFieldExtensionConfigScreenPropertiesAndMethods, RenderModalPropertiesAndMethods, RenderPagePropertiesAndMethods, RenderSidebarPanelPropertiesAndMethods, SettingsAreaSidebarItemGroup } from './types';
|
|
3
3
|
import { ItemFormOutlet, RenderItemFormOutletPropertiesAndMethods, StructuredTextCustomBlockStyle, StructuredTextCustomMark } from '.';
|
|
4
4
|
export declare type SizingUtilities = {
|
|
5
5
|
/**
|
|
@@ -69,6 +69,20 @@ export declare type FullConnectParameters = {
|
|
|
69
69
|
* @tag beforeHooks
|
|
70
70
|
*/
|
|
71
71
|
onBeforeItemUpsert: (createOrUpdateItemPayload: ItemUpdateSchema | ItemCreateSchema, ctx: OnBootCtx) => MaybePromise<boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* Use this function to customize the presentation of a record action by
|
|
74
|
+
* returning `false`
|
|
75
|
+
*
|
|
76
|
+
* @tag customizeHooks
|
|
77
|
+
*/
|
|
78
|
+
buildItemPresentationInfo: (item: Item, ctx: OnBootCtx) => MaybePromise<ItemPresentationInfo | undefined>;
|
|
79
|
+
/**
|
|
80
|
+
* Use this function to customize the initial filters when opening an record
|
|
81
|
+
* selector via a "Single link" or "Multiple links" field
|
|
82
|
+
*
|
|
83
|
+
* @tag customizeHooks
|
|
84
|
+
*/
|
|
85
|
+
initialLocationQueryForItemSelector: (openerfield: Item, itemType: ItemType, ctx: OnBootCtx) => MaybePromise<InitialLocationQueryForItemSelector | undefined>;
|
|
72
86
|
/**
|
|
73
87
|
* Use this function to declare new tabs you want to add in the top-bar of the
|
|
74
88
|
* UI
|
package/dist/types/types.d.ts
CHANGED
|
@@ -6,6 +6,38 @@ export declare type Icon = string | {
|
|
|
6
6
|
viewBox: string;
|
|
7
7
|
content: string;
|
|
8
8
|
};
|
|
9
|
+
export declare type ItemListLocationQuery = {
|
|
10
|
+
locale?: string;
|
|
11
|
+
filter?: {
|
|
12
|
+
query?: string;
|
|
13
|
+
fields?: Record<string, unknown>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare type ItemPresentationInfo = {
|
|
17
|
+
/** The title to present the record */
|
|
18
|
+
title: string;
|
|
19
|
+
/** An image representative of the record */
|
|
20
|
+
imageUrl?: string;
|
|
21
|
+
/**
|
|
22
|
+
* If different plugins implement the `buildItemPresentationInfo` hook, the
|
|
23
|
+
* one with the lowest `rank` will be used. If you want to specify an explicit
|
|
24
|
+
* value for `rank`, make sure to offer a way for final users to customize it
|
|
25
|
+
* inside the plugin's settings form, otherwise the hardcoded value you choose
|
|
26
|
+
* might clash with the one of another plugin!
|
|
27
|
+
*/
|
|
28
|
+
rank?: number;
|
|
29
|
+
};
|
|
30
|
+
export declare type InitialLocationQueryForItemSelector = {
|
|
31
|
+
locationQuery: ItemListLocationQuery;
|
|
32
|
+
/**
|
|
33
|
+
* If different plugins implement the `initialLocationQueryForItemSelector`
|
|
34
|
+
* hook, the one with the lowest `rank` will be used. If you want to specify
|
|
35
|
+
* an explicit value for `rank`, make sure to offer a way for final users to
|
|
36
|
+
* customize it inside the plugin's settings form, otherwise the hardcoded
|
|
37
|
+
* value you choose might clash with the one of another plugin!
|
|
38
|
+
*/
|
|
39
|
+
rank?: number;
|
|
40
|
+
};
|
|
9
41
|
/** A tab to be displayed in the top-bar of the UI */
|
|
10
42
|
export declare type MainNavigationTab = {
|
|
11
43
|
/** Label to be shown. Must be unique. */
|
|
@@ -241,7 +273,7 @@ export declare type EditorOverride = {
|
|
|
241
273
|
*/
|
|
242
274
|
parameters?: Record<string, unknown>;
|
|
243
275
|
/**
|
|
244
|
-
* If multiple plugins override a field, the one with the
|
|
276
|
+
* If multiple plugins override a field, the one with the lowest `rank` will
|
|
245
277
|
* win. If you want to specify an explicit value for `rank`, make sure to
|
|
246
278
|
* offer a way for final users to customize it inside the plugin's settings
|
|
247
279
|
* form, otherwise the hardcoded value you choose might clash with the one of
|
|
@@ -788,9 +820,11 @@ export declare type ItemDialogMethods = {
|
|
|
788
820
|
selectItem: {
|
|
789
821
|
(itemTypeId: string, options: {
|
|
790
822
|
multiple: true;
|
|
823
|
+
initialLocationQuery?: ItemListLocationQuery;
|
|
791
824
|
}): Promise<Item[] | null>;
|
|
792
825
|
(itemTypeId: string, options?: {
|
|
793
826
|
multiple: false;
|
|
827
|
+
initialLocationQuery?: ItemListLocationQuery;
|
|
794
828
|
}): Promise<Item | null>;
|
|
795
829
|
};
|
|
796
830
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datocms-plugin-sdk",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "DatoCMS Plugin SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datocms",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"typedoc": "^0.23.20"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "e995d904046a1f1057c86344e3b985511c6d5e13"
|
|
47
47
|
}
|
package/src/connect.ts
CHANGED
|
@@ -10,8 +10,10 @@ import {
|
|
|
10
10
|
AssetSource,
|
|
11
11
|
ContentAreaSidebarItem,
|
|
12
12
|
FieldExtensionOverride,
|
|
13
|
+
InitialLocationQueryForItemSelector,
|
|
13
14
|
InitPropertiesAndMethods,
|
|
14
15
|
ItemFormSidebarPanel,
|
|
16
|
+
ItemPresentationInfo,
|
|
15
17
|
MainNavigationTab,
|
|
16
18
|
ManualFieldExtension,
|
|
17
19
|
OnBootMethods,
|
|
@@ -147,6 +149,29 @@ export type FullConnectParameters = {
|
|
|
147
149
|
ctx: OnBootCtx,
|
|
148
150
|
) => MaybePromise<boolean>;
|
|
149
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Use this function to customize the presentation of a record action by
|
|
154
|
+
* returning `false`
|
|
155
|
+
*
|
|
156
|
+
* @tag customizeHooks
|
|
157
|
+
*/
|
|
158
|
+
buildItemPresentationInfo: (
|
|
159
|
+
item: Item,
|
|
160
|
+
ctx: OnBootCtx,
|
|
161
|
+
) => MaybePromise<ItemPresentationInfo | undefined>;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Use this function to customize the initial filters when opening an record
|
|
165
|
+
* selector via a "Single link" or "Multiple links" field
|
|
166
|
+
*
|
|
167
|
+
* @tag customizeHooks
|
|
168
|
+
*/
|
|
169
|
+
initialLocationQueryForItemSelector: (
|
|
170
|
+
openerfield: Item,
|
|
171
|
+
itemType: ItemType,
|
|
172
|
+
ctx: OnBootCtx,
|
|
173
|
+
) => MaybePromise<InitialLocationQueryForItemSelector | undefined>;
|
|
174
|
+
|
|
150
175
|
/**
|
|
151
176
|
* Use this function to declare new tabs you want to add in the top-bar of the
|
|
152
177
|
* UI
|
|
@@ -370,29 +395,39 @@ const buildRenderUtils = (parent: { setHeight: (number: number) => void }) => {
|
|
|
370
395
|
};
|
|
371
396
|
|
|
372
397
|
let resizeObserver: ResizeObserver | null = null;
|
|
398
|
+
let mutationObserver: MutationObserver | null = null;
|
|
399
|
+
const onMutation = () => updateHeight();
|
|
373
400
|
|
|
374
401
|
const startAutoResizer = () => {
|
|
375
402
|
updateHeight();
|
|
376
403
|
|
|
377
|
-
if (resizeObserver) {
|
|
378
|
-
|
|
404
|
+
if (!resizeObserver) {
|
|
405
|
+
resizeObserver = new ResizeObserver(onMutation);
|
|
406
|
+
resizeObserver.observe(document.documentElement);
|
|
379
407
|
}
|
|
380
408
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
updateHeight();
|
|
384
|
-
});
|
|
409
|
+
if (!mutationObserver) {
|
|
410
|
+
mutationObserver = new MutationObserver(onMutation);
|
|
385
411
|
|
|
386
|
-
|
|
412
|
+
mutationObserver.observe(window.document.body, {
|
|
413
|
+
attributes: true,
|
|
414
|
+
childList: true,
|
|
415
|
+
subtree: true,
|
|
416
|
+
characterData: true,
|
|
417
|
+
});
|
|
418
|
+
}
|
|
387
419
|
};
|
|
388
420
|
|
|
389
421
|
const stopAutoResizer = () => {
|
|
390
|
-
if (
|
|
391
|
-
|
|
422
|
+
if (resizeObserver) {
|
|
423
|
+
resizeObserver.disconnect();
|
|
424
|
+
resizeObserver = null;
|
|
392
425
|
}
|
|
393
426
|
|
|
394
|
-
|
|
395
|
-
|
|
427
|
+
if (mutationObserver) {
|
|
428
|
+
mutationObserver.disconnect();
|
|
429
|
+
mutationObserver = null;
|
|
430
|
+
}
|
|
396
431
|
};
|
|
397
432
|
|
|
398
433
|
return { updateHeight, startAutoResizer, stopAutoResizer };
|
package/src/types.ts
CHANGED
|
@@ -17,6 +17,41 @@ import {
|
|
|
17
17
|
|
|
18
18
|
export type Icon = string | { type: 'svg'; viewBox: string; content: string };
|
|
19
19
|
|
|
20
|
+
export type ItemListLocationQuery = {
|
|
21
|
+
locale?: string;
|
|
22
|
+
filter?: {
|
|
23
|
+
query?: string;
|
|
24
|
+
fields?: Record<string, unknown>;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type ItemPresentationInfo = {
|
|
29
|
+
/** The title to present the record */
|
|
30
|
+
title: string;
|
|
31
|
+
/** An image representative of the record */
|
|
32
|
+
imageUrl?: string;
|
|
33
|
+
/**
|
|
34
|
+
* If different plugins implement the `buildItemPresentationInfo` hook, the
|
|
35
|
+
* one with the lowest `rank` will be used. If you want to specify an explicit
|
|
36
|
+
* value for `rank`, make sure to offer a way for final users to customize it
|
|
37
|
+
* inside the plugin's settings form, otherwise the hardcoded value you choose
|
|
38
|
+
* might clash with the one of another plugin!
|
|
39
|
+
*/
|
|
40
|
+
rank?: number;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type InitialLocationQueryForItemSelector = {
|
|
44
|
+
locationQuery: ItemListLocationQuery;
|
|
45
|
+
/**
|
|
46
|
+
* If different plugins implement the `initialLocationQueryForItemSelector`
|
|
47
|
+
* hook, the one with the lowest `rank` will be used. If you want to specify
|
|
48
|
+
* an explicit value for `rank`, make sure to offer a way for final users to
|
|
49
|
+
* customize it inside the plugin's settings form, otherwise the hardcoded
|
|
50
|
+
* value you choose might clash with the one of another plugin!
|
|
51
|
+
*/
|
|
52
|
+
rank?: number;
|
|
53
|
+
};
|
|
54
|
+
|
|
20
55
|
/** A tab to be displayed in the top-bar of the UI */
|
|
21
56
|
export type MainNavigationTab = {
|
|
22
57
|
/** Label to be shown. Must be unique. */
|
|
@@ -285,7 +320,7 @@ export type EditorOverride = {
|
|
|
285
320
|
*/
|
|
286
321
|
parameters?: Record<string, unknown>;
|
|
287
322
|
/**
|
|
288
|
-
* If multiple plugins override a field, the one with the
|
|
323
|
+
* If multiple plugins override a field, the one with the lowest `rank` will
|
|
289
324
|
* win. If you want to specify an explicit value for `rank`, make sure to
|
|
290
325
|
* offer a way for final users to customize it inside the plugin's settings
|
|
291
326
|
* form, otherwise the hardcoded value you choose might clash with the one of
|
|
@@ -866,8 +901,17 @@ export type ItemDialogMethods = {
|
|
|
866
901
|
* ```
|
|
867
902
|
*/
|
|
868
903
|
selectItem: {
|
|
869
|
-
(
|
|
870
|
-
|
|
904
|
+
(
|
|
905
|
+
itemTypeId: string,
|
|
906
|
+
options: { multiple: true; initialLocationQuery?: ItemListLocationQuery },
|
|
907
|
+
): Promise<Item[] | null>;
|
|
908
|
+
(
|
|
909
|
+
itemTypeId: string,
|
|
910
|
+
options?: {
|
|
911
|
+
multiple: false;
|
|
912
|
+
initialLocationQuery?: ItemListLocationQuery;
|
|
913
|
+
},
|
|
914
|
+
): Promise<Item | null>;
|
|
871
915
|
};
|
|
872
916
|
/**
|
|
873
917
|
* Opens a dialog for editing an existing record. It returns a promise
|