datocms-plugin-sdk 2.0.0 → 2.0.2
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/hooks/renderItemCollectionOutlet.js.map +1 -1
- package/dist/cjs/manifest.js +2446 -2111
- package/dist/cjs/manifest.js.map +1 -1
- package/dist/esm/ctx/base.d.ts +43 -29
- package/dist/esm/ctx/commonExtras/field.d.ts +4 -0
- package/dist/esm/ctx/commonExtras/itemForm.d.ts +14 -12
- package/dist/esm/ctx/commonExtras/sizing.d.ts +1 -0
- package/dist/esm/hooks/assetSources.d.ts +2 -1
- package/dist/esm/hooks/buildItemPresentationInfo.d.ts +2 -1
- package/dist/esm/hooks/contentAreaSidebarItems.d.ts +2 -1
- package/dist/esm/hooks/customBlockStylesForStructuredTextField.d.ts +2 -2
- package/dist/esm/hooks/customMarksForStructuredTextField.d.ts +2 -2
- package/dist/esm/hooks/executeFieldDropdownAction.d.ts +9 -1
- package/dist/esm/hooks/executeItemFormDropdownAction.d.ts +9 -1
- package/dist/esm/hooks/executeItemsDropdownAction.d.ts +11 -1
- package/dist/esm/hooks/executeUploadsDropdownAction.d.ts +11 -1
- package/dist/esm/hooks/fieldDropdownActions.d.ts +9 -0
- package/dist/esm/hooks/initialLocationQueryForItemSelector.d.ts +2 -1
- package/dist/esm/hooks/itemCollectionOutlets.d.ts +8 -1
- package/dist/esm/hooks/itemFormDropdownActions.d.ts +9 -0
- package/dist/esm/hooks/itemFormOutlets.d.ts +3 -2
- package/dist/esm/hooks/itemFormSidebarPanels.d.ts +2 -1
- package/dist/esm/hooks/itemFormSidebars.d.ts +2 -1
- package/dist/esm/hooks/itemsDropdownActions.d.ts +12 -0
- package/dist/esm/hooks/mainNavigationTabs.d.ts +2 -1
- package/dist/esm/hooks/manualFieldExtensions.d.ts +2 -1
- package/dist/esm/hooks/onBeforeItemUpsert.d.ts +2 -1
- package/dist/esm/hooks/onBeforeItemsDestroy.d.ts +2 -1
- package/dist/esm/hooks/onBeforeItemsPublish.d.ts +2 -1
- package/dist/esm/hooks/onBeforeItemsUnpublish.d.ts +2 -1
- package/dist/esm/hooks/overrideFieldExtensions.d.ts +2 -2
- package/dist/esm/hooks/renderItemCollectionOutlet.d.ts +6 -0
- package/dist/esm/hooks/renderItemCollectionOutlet.js.map +1 -1
- package/dist/esm/hooks/renderItemFormOutlet.d.ts +3 -3
- package/dist/esm/hooks/settingsAreaSidebarItemGroups.d.ts +2 -1
- package/dist/esm/hooks/uploadSidebarPanels.d.ts +2 -1
- package/dist/esm/hooks/uploadSidebars.d.ts +2 -1
- package/dist/esm/hooks/uploadsDropdownActions.d.ts +15 -1
- package/dist/esm/manifest.js +2446 -2111
- package/dist/esm/manifest.js.map +1 -1
- package/dist/esm/manifestTypes.d.ts +117 -22
- package/dist/types/ctx/base.d.ts +43 -29
- package/dist/types/ctx/commonExtras/field.d.ts +4 -0
- package/dist/types/ctx/commonExtras/itemForm.d.ts +14 -12
- package/dist/types/ctx/commonExtras/sizing.d.ts +1 -0
- package/dist/types/hooks/assetSources.d.ts +2 -1
- package/dist/types/hooks/buildItemPresentationInfo.d.ts +2 -1
- package/dist/types/hooks/contentAreaSidebarItems.d.ts +2 -1
- package/dist/types/hooks/customBlockStylesForStructuredTextField.d.ts +2 -2
- package/dist/types/hooks/customMarksForStructuredTextField.d.ts +2 -2
- package/dist/types/hooks/executeFieldDropdownAction.d.ts +9 -1
- package/dist/types/hooks/executeItemFormDropdownAction.d.ts +9 -1
- package/dist/types/hooks/executeItemsDropdownAction.d.ts +11 -1
- package/dist/types/hooks/executeUploadsDropdownAction.d.ts +11 -1
- package/dist/types/hooks/fieldDropdownActions.d.ts +9 -0
- package/dist/types/hooks/initialLocationQueryForItemSelector.d.ts +2 -1
- package/dist/types/hooks/itemCollectionOutlets.d.ts +8 -1
- package/dist/types/hooks/itemFormDropdownActions.d.ts +9 -0
- package/dist/types/hooks/itemFormOutlets.d.ts +3 -2
- package/dist/types/hooks/itemFormSidebarPanels.d.ts +2 -1
- package/dist/types/hooks/itemFormSidebars.d.ts +2 -1
- package/dist/types/hooks/itemsDropdownActions.d.ts +12 -0
- package/dist/types/hooks/mainNavigationTabs.d.ts +2 -1
- package/dist/types/hooks/manualFieldExtensions.d.ts +2 -1
- package/dist/types/hooks/onBeforeItemUpsert.d.ts +2 -1
- package/dist/types/hooks/onBeforeItemsDestroy.d.ts +2 -1
- package/dist/types/hooks/onBeforeItemsPublish.d.ts +2 -1
- package/dist/types/hooks/onBeforeItemsUnpublish.d.ts +2 -1
- package/dist/types/hooks/overrideFieldExtensions.d.ts +2 -2
- package/dist/types/hooks/renderItemCollectionOutlet.d.ts +6 -0
- package/dist/types/hooks/renderItemFormOutlet.d.ts +3 -3
- package/dist/types/hooks/settingsAreaSidebarItemGroups.d.ts +2 -1
- package/dist/types/hooks/uploadSidebarPanels.d.ts +2 -1
- package/dist/types/hooks/uploadSidebars.d.ts +2 -1
- package/dist/types/hooks/uploadsDropdownActions.d.ts +15 -1
- package/dist/types/manifestTypes.d.ts +117 -22
- package/manifest.json +2354 -2019
- package/package.json +4 -4
- package/src/ctx/base.ts +62 -30
- package/src/ctx/commonExtras/field.ts +4 -0
- package/src/ctx/commonExtras/itemForm.ts +15 -12
- package/src/ctx/commonExtras/sizing.ts +1 -0
- package/src/hooks/assetSources.ts +3 -1
- package/src/hooks/buildItemPresentationInfo.ts +3 -1
- package/src/hooks/contentAreaSidebarItems.ts +5 -1
- package/src/hooks/customBlockStylesForStructuredTextField.ts +2 -2
- package/src/hooks/customMarksForStructuredTextField.ts +2 -2
- package/src/hooks/executeFieldDropdownAction.ts +7 -0
- package/src/hooks/executeItemFormDropdownAction.ts +7 -0
- package/src/hooks/executeItemsDropdownAction.ts +8 -0
- package/src/hooks/executeUploadsDropdownAction.ts +9 -0
- package/src/hooks/fieldDropdownActions.ts +9 -0
- package/src/hooks/initialLocationQueryForItemSelector.ts +3 -1
- package/src/hooks/itemCollectionOutlets.ts +9 -1
- package/src/hooks/itemFormDropdownActions.ts +9 -0
- package/src/hooks/itemFormOutlets.ts +7 -2
- package/src/hooks/itemFormSidebarPanels.ts +3 -1
- package/src/hooks/itemFormSidebars.ts +6 -1
- package/src/hooks/itemsDropdownActions.ts +12 -0
- package/src/hooks/mainNavigationTabs.ts +3 -1
- package/src/hooks/manualFieldExtensions.ts +5 -1
- package/src/hooks/onBeforeItemUpsert.ts +3 -1
- package/src/hooks/onBeforeItemsDestroy.ts +6 -1
- package/src/hooks/onBeforeItemsPublish.ts +6 -1
- package/src/hooks/onBeforeItemsUnpublish.ts +6 -1
- package/src/hooks/overrideFieldExtensions.ts +2 -2
- package/src/hooks/renderItemCollectionOutlet.ts +6 -0
- package/src/hooks/renderItemFormOutlet.ts +3 -3
- package/src/hooks/settingsAreaSidebarItemGroups.ts +5 -1
- package/src/hooks/uploadSidebarPanels.ts +3 -1
- package/src/hooks/uploadSidebars.ts +3 -1
- package/src/hooks/uploadsDropdownActions.ts +15 -1
- package/src/manifest.ts +2562 -2151
- package/src/manifestTypes.ts +125 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datocms-plugin-sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "DatoCMS Plugin SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datocms",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"url": "git+https://github.com/datocms/plugins-sdk.git"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
|
-
"build": "npm run generate-
|
|
32
|
-
"generate-
|
|
31
|
+
"build": "npm run generate-manifest && tsc && tsc --project ./tsconfig.esnext.json",
|
|
32
|
+
"generate-manifest": "tsx generateManifest.ts && biome format --write src/manifest.ts",
|
|
33
33
|
"prebuild": "rimraf dist"
|
|
34
34
|
},
|
|
35
35
|
"bugs": {
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"glob": "^11.0.0",
|
|
46
46
|
"typescript": "^5.6.2"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "ba6263cc54345109ef3a4d4e60726e49888a70b2"
|
|
49
49
|
}
|
package/src/ctx/base.ts
CHANGED
|
@@ -18,14 +18,15 @@ export type Ctx<
|
|
|
18
18
|
AdditionalMethods extends Record<string, unknown> = Record<string, never>,
|
|
19
19
|
> = BaseProperties & AdditionalProperties & BaseMethods & AdditionalMethods;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
export type BaseProperties = PluginProperties &
|
|
22
|
+
AuthenticationProperties &
|
|
23
|
+
ProjectProperties &
|
|
24
|
+
EntityReposProperties;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Information about the current user using the CMS
|
|
28
|
+
*/
|
|
29
|
+
type AuthenticationProperties = {
|
|
29
30
|
/**
|
|
30
31
|
* The current DatoCMS user. It can either be the owner or one of the
|
|
31
32
|
* collaborators (regular or SSO).
|
|
@@ -38,8 +39,38 @@ export type BaseProperties = {
|
|
|
38
39
|
* available if `currentUserAccessToken` additional permission is granted
|
|
39
40
|
*/
|
|
40
41
|
currentUserAccessToken: string | undefined;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Information about the current plugin. Useful to access the plugin's global
|
|
46
|
+
* configuration object.
|
|
47
|
+
*/
|
|
48
|
+
type PluginProperties = {
|
|
41
49
|
/** The current plugin */
|
|
42
50
|
plugin: Plugin;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/*
|
|
54
|
+
* Information about the project
|
|
55
|
+
*/
|
|
56
|
+
type ProjectProperties = {
|
|
57
|
+
/** The current DatoCMS project */
|
|
58
|
+
site: Site;
|
|
59
|
+
|
|
60
|
+
/** The ID of the current environment */
|
|
61
|
+
environment: string;
|
|
62
|
+
|
|
63
|
+
/** The account that is the project owner */
|
|
64
|
+
owner: Account | Organization;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The account that is the project owner
|
|
68
|
+
*
|
|
69
|
+
* @deprecated Please use `.owner` instead, as the project owner can also be
|
|
70
|
+
* an organization
|
|
71
|
+
*/
|
|
72
|
+
account: Account | undefined;
|
|
73
|
+
|
|
43
74
|
/**
|
|
44
75
|
* UI preferences of the current user (right now, only the preferred locale is
|
|
45
76
|
* available)
|
|
@@ -48,46 +79,47 @@ export type BaseProperties = {
|
|
|
48
79
|
/** Preferred locale */
|
|
49
80
|
locale: string;
|
|
50
81
|
};
|
|
82
|
+
|
|
83
|
+
/** An object containing the theme colors for the current DatoCMS project */
|
|
84
|
+
theme: Theme;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* These properties provide access to "entity repos", that is, the collection of
|
|
89
|
+
* resources of a particular type that have been loaded by the CMS up to this
|
|
90
|
+
* moment. The entity repos are objects, indexed by the ID of the entity itself.
|
|
91
|
+
*/
|
|
92
|
+
type EntityReposProperties = {
|
|
93
|
+
/** All the models of the current DatoCMS project, indexed by ID */
|
|
94
|
+
itemTypes: Partial<Record<string, ItemType>>;
|
|
95
|
+
|
|
51
96
|
/**
|
|
52
97
|
* All the fields currently loaded for the current DatoCMS project, indexed by
|
|
53
|
-
* ID.
|
|
54
|
-
*
|
|
55
|
-
* some fields you need are not present, use the `loadItemTypeFields` function
|
|
56
|
-
* to load them.
|
|
98
|
+
* ID. If some fields you need are not present, use the `loadItemTypeFields`
|
|
99
|
+
* function to load them.
|
|
57
100
|
*/
|
|
58
101
|
fields: Partial<Record<string, Field>>;
|
|
102
|
+
|
|
59
103
|
/**
|
|
60
104
|
* All the fieldsets currently loaded for the current DatoCMS project, indexed
|
|
61
|
-
* by ID.
|
|
62
|
-
*
|
|
63
|
-
* If some fields you need are not present, use the `loadItemTypeFieldsets`
|
|
64
|
-
* function to load them.
|
|
105
|
+
* by ID. If some fields you need are not present, use the
|
|
106
|
+
* `loadItemTypeFieldsets` function to load them.
|
|
65
107
|
*/
|
|
66
108
|
fieldsets: Partial<Record<string, Fieldset>>;
|
|
67
|
-
|
|
68
|
-
theme: Theme;
|
|
109
|
+
|
|
69
110
|
/**
|
|
70
111
|
* All the regular users currently loaded for the current DatoCMS project,
|
|
71
112
|
* indexed by ID. It will always contain the current user. If some users you
|
|
72
113
|
* need are not present, use the `loadUsers` function to load them.
|
|
73
114
|
*/
|
|
74
115
|
users: Partial<Record<string, User>>;
|
|
116
|
+
|
|
75
117
|
/**
|
|
76
118
|
* All the SSO users currently loaded for the current DatoCMS project, indexed
|
|
77
119
|
* by ID. It will always contain the current user. If some users you need are
|
|
78
120
|
* not present, use the `loadSsoUsers` function to load them.
|
|
79
121
|
*/
|
|
80
122
|
ssoUsers: Partial<Record<string, SsoUser>>;
|
|
81
|
-
/**
|
|
82
|
-
* The account that is the project owner
|
|
83
|
-
*
|
|
84
|
-
* @deprecated Please use `.owner` instead, as the project owner can also be
|
|
85
|
-
* an organization
|
|
86
|
-
*/
|
|
87
|
-
account: Account | undefined;
|
|
88
|
-
/** The account that is the project owner */
|
|
89
|
-
owner: Account | Organization;
|
|
90
|
-
/** The padding in px that must be applied to the body */
|
|
91
123
|
};
|
|
92
124
|
|
|
93
125
|
/** An object containing the theme colors for the current DatoCMS project */
|
|
@@ -100,7 +132,7 @@ export type Theme = {
|
|
|
100
132
|
};
|
|
101
133
|
|
|
102
134
|
export type BaseMethods = LoadDataMethods &
|
|
103
|
-
|
|
135
|
+
UpdatePluginParametersMethods &
|
|
104
136
|
ToastMethods &
|
|
105
137
|
ItemDialogMethods &
|
|
106
138
|
UploadDialogMethods &
|
|
@@ -199,7 +231,7 @@ type LoadDataMethods = {
|
|
|
199
231
|
* These methods can be used to update both plugin parameters and manual field
|
|
200
232
|
* extensions configuration.
|
|
201
233
|
*/
|
|
202
|
-
type
|
|
234
|
+
type UpdatePluginParametersMethods = {
|
|
203
235
|
/**
|
|
204
236
|
* Updates the plugin parameters.
|
|
205
237
|
*
|
|
@@ -3,6 +3,10 @@ import type { SchemaTypes } from '@datocms/cma-client';
|
|
|
3
3
|
type Field = SchemaTypes.Field;
|
|
4
4
|
type ItemType = SchemaTypes.ItemType;
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* These information describe the current state of the field where this plugin
|
|
8
|
+
* is applied to.
|
|
9
|
+
*/
|
|
6
10
|
export type FieldAdditionalProperties = {
|
|
7
11
|
/** Whether the field is currently disabled or not */
|
|
8
12
|
disabled: boolean;
|
|
@@ -25,19 +25,22 @@ export type ItemFormAdditionalProperties = {
|
|
|
25
25
|
isSubmitting: boolean;
|
|
26
26
|
/** Whether the form has some non-persisted changes or not */
|
|
27
27
|
isFormDirty: boolean;
|
|
28
|
-
/**
|
|
29
|
-
blocksAnalysis:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
/** Provides information on how many blocks are currently present in the form */
|
|
29
|
+
blocksAnalysis: BlocksAnalysis;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** Current number of blocks present in form state */
|
|
33
|
+
export type BlocksAnalysis = {
|
|
34
|
+
usage: {
|
|
35
|
+
/** Total number of blocks present in form state */
|
|
36
|
+
total: number;
|
|
37
|
+
/** Total number of blocks present in non-localized fields */
|
|
38
|
+
nonLocalized: number;
|
|
39
|
+
/** Total number of blocks present in localized fields, per locale */
|
|
40
|
+
perLocale: Record<string, number>;
|
|
40
41
|
};
|
|
42
|
+
/** Maximum number of blocks per item */
|
|
43
|
+
maximumPerItem: number;
|
|
41
44
|
};
|
|
42
45
|
|
|
43
46
|
/**
|
|
@@ -8,9 +8,11 @@ export type AssetSourcesHook = {
|
|
|
8
8
|
*
|
|
9
9
|
* @tag assetSources
|
|
10
10
|
*/
|
|
11
|
-
assetSources: (ctx:
|
|
11
|
+
assetSources: (ctx: AssetSourcesCtx) => AssetSource[] | undefined;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
export type AssetSourcesCtx = Ctx;
|
|
15
|
+
|
|
14
16
|
/** An additional asset source */
|
|
15
17
|
export type AssetSource = {
|
|
16
18
|
/**
|
|
@@ -13,10 +13,12 @@ export type BuildItemPresentationInfoHook = {
|
|
|
13
13
|
*/
|
|
14
14
|
buildItemPresentationInfo: (
|
|
15
15
|
item: Item,
|
|
16
|
-
ctx:
|
|
16
|
+
ctx: BuildItemPresentationInfoCtx,
|
|
17
17
|
) => MaybePromise<ItemPresentationInfo | undefined>;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
export type BuildItemPresentationInfoCtx = Ctx;
|
|
21
|
+
|
|
20
22
|
export type ItemPresentationInfo = {
|
|
21
23
|
/** The title to present the record */
|
|
22
24
|
title: string;
|
|
@@ -7,9 +7,13 @@ export type ContentAreaSidebarItemsHook = {
|
|
|
7
7
|
*
|
|
8
8
|
* @tag sidebarItems
|
|
9
9
|
*/
|
|
10
|
-
contentAreaSidebarItems: (
|
|
10
|
+
contentAreaSidebarItems: (
|
|
11
|
+
ctx: ContentAreaSidebarItemsCtx,
|
|
12
|
+
) => ContentAreaSidebarItem[];
|
|
11
13
|
};
|
|
12
14
|
|
|
15
|
+
export type ContentAreaSidebarItemsCtx = Ctx;
|
|
16
|
+
|
|
13
17
|
export type ContentAreaSidebarItem = {
|
|
14
18
|
/** Label to be shown. Must be unique. */
|
|
15
19
|
label: string;
|
|
@@ -14,11 +14,11 @@ export type CustomBlockStylesForStructuredTextFieldHook = {
|
|
|
14
14
|
*/
|
|
15
15
|
customBlockStylesForStructuredTextField: (
|
|
16
16
|
field: Field,
|
|
17
|
-
ctx:
|
|
17
|
+
ctx: CustomBlockStylesForStructuredTextFieldCtx,
|
|
18
18
|
) => StructuredTextCustomBlockStyle[] | undefined;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export type
|
|
21
|
+
export type CustomBlockStylesForStructuredTextFieldCtx = Ctx<{
|
|
22
22
|
itemType: ItemType;
|
|
23
23
|
}>;
|
|
24
24
|
|
|
@@ -14,11 +14,11 @@ export type CustomMarksForStructuredTextFieldHook = {
|
|
|
14
14
|
*/
|
|
15
15
|
customMarksForStructuredTextField: (
|
|
16
16
|
field: Field,
|
|
17
|
-
ctx:
|
|
17
|
+
ctx: CustomMarksForStructuredTextFieldCtx,
|
|
18
18
|
) => StructuredTextCustomMark[] | undefined;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export type
|
|
21
|
+
export type CustomMarksForStructuredTextFieldCtx = Ctx<{
|
|
22
22
|
itemType: ItemType;
|
|
23
23
|
}>;
|
|
24
24
|
|
|
@@ -6,7 +6,14 @@ import type {
|
|
|
6
6
|
} from '../ctx/commonExtras/itemForm';
|
|
7
7
|
|
|
8
8
|
export type ExecuteFieldDropdownActionHook = {
|
|
9
|
+
/**
|
|
10
|
+
* Use this function to execute a particular dropdown action defined via
|
|
11
|
+
* the `fieldDropdownActions()` hook.
|
|
12
|
+
*
|
|
13
|
+
* @tag dropdownActions
|
|
14
|
+
*/
|
|
9
15
|
executeFieldDropdownAction: (
|
|
16
|
+
/** The ID of the action that was requested by the user */
|
|
10
17
|
actionId: string,
|
|
11
18
|
ctx: ExecuteFieldDropdownActionCtx,
|
|
12
19
|
) => Promise<void>;
|
|
@@ -5,7 +5,14 @@ import type {
|
|
|
5
5
|
} from '../ctx/commonExtras/itemForm';
|
|
6
6
|
|
|
7
7
|
export type ExecuteItemFormDropdownActionHook = {
|
|
8
|
+
/**
|
|
9
|
+
* Use this function to execute a particular dropdown action defined via
|
|
10
|
+
* the `itemFormDropdownActions()` hook.
|
|
11
|
+
*
|
|
12
|
+
* @tag dropdownActions
|
|
13
|
+
*/
|
|
8
14
|
executeItemFormDropdownAction: (
|
|
15
|
+
/** The ID of the action that was requested by the user */
|
|
9
16
|
actionId: string,
|
|
10
17
|
ctx: ExecuteItemFormDropdownActionCtx,
|
|
11
18
|
) => Promise<void>;
|
|
@@ -4,8 +4,16 @@ import { Ctx } from '../ctx/base';
|
|
|
4
4
|
type Item = SchemaTypes.Item;
|
|
5
5
|
|
|
6
6
|
export type ExecuteItemsDropdownActionHook = {
|
|
7
|
+
/**
|
|
8
|
+
* Use this function to execute a particular dropdown action defined via
|
|
9
|
+
* the `itemsDropdownActions()` hook.
|
|
10
|
+
*
|
|
11
|
+
* @tag dropdownActions
|
|
12
|
+
*/
|
|
7
13
|
executeItemsDropdownAction: (
|
|
14
|
+
/** The ID of the action that was requested by the user */
|
|
8
15
|
actionId: string,
|
|
16
|
+
/** The records on which the action should be executed */
|
|
9
17
|
items: Item[],
|
|
10
18
|
ctx: ExecuteItemsDropdownActionCtx,
|
|
11
19
|
) => Promise<void>;
|
|
@@ -4,12 +4,21 @@ import { Ctx } from '../ctx/base';
|
|
|
4
4
|
type Upload = SchemaTypes.Upload;
|
|
5
5
|
|
|
6
6
|
export type ExecuteUploadsDropdownActionHook = {
|
|
7
|
+
/**
|
|
8
|
+
* Use this function to execute a particular dropdown action defined via
|
|
9
|
+
* the `uploadsDropdownActions()` hook.
|
|
10
|
+
*
|
|
11
|
+
* @tag dropdownActions
|
|
12
|
+
*/
|
|
7
13
|
executeUploadsDropdownAction: (
|
|
14
|
+
/** The ID of the action that was requested by the user */
|
|
8
15
|
actionId: string,
|
|
16
|
+
/** The assets on which the action should be executed */
|
|
9
17
|
uploads: Upload[],
|
|
10
18
|
ctx: ExecuteUploadsDropdownActionCtx,
|
|
11
19
|
) => Promise<void>;
|
|
12
20
|
};
|
|
21
|
+
|
|
13
22
|
export type ExecuteUploadsDropdownActionCtx = Ctx<{
|
|
14
23
|
parameters: Record<string, unknown> | undefined;
|
|
15
24
|
}>;
|
|
@@ -7,6 +7,15 @@ import { DropdownAction, DropdownActionGroup } from '../shared';
|
|
|
7
7
|
type Field = SchemaTypes.Field;
|
|
8
8
|
|
|
9
9
|
export type FieldDropdownActionsHook = {
|
|
10
|
+
/**
|
|
11
|
+
* Use this function to define custom actions (or groups of actions) to be
|
|
12
|
+
* displayed at the individual field level in the record editing form.
|
|
13
|
+
*
|
|
14
|
+
* The `executeFieldDropdownAction()` hook will be triggered once the user
|
|
15
|
+
* clicks on one of the defined actions.
|
|
16
|
+
*
|
|
17
|
+
* @tag dropdownActions
|
|
18
|
+
*/
|
|
10
19
|
fieldDropdownActions: (
|
|
11
20
|
field: Field,
|
|
12
21
|
ctx: FieldDropdownActionsCtx,
|
|
@@ -16,10 +16,12 @@ export type InitialLocationQueryForItemSelectorHook = {
|
|
|
16
16
|
initialLocationQueryForItemSelector: (
|
|
17
17
|
openerField: Field,
|
|
18
18
|
itemType: ItemType,
|
|
19
|
-
ctx:
|
|
19
|
+
ctx: InitialLocationQueryForItemSelectorCtx,
|
|
20
20
|
) => MaybePromise<InitialLocationQueryForItemSelector | undefined>;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
export type InitialLocationQueryForItemSelectorCtx = Ctx;
|
|
24
|
+
|
|
23
25
|
export type InitialLocationQueryForItemSelector = {
|
|
24
26
|
locationQuery: ItemListLocationQuery;
|
|
25
27
|
/**
|
|
@@ -4,12 +4,20 @@ import { Ctx } from '../ctx/base';
|
|
|
4
4
|
type ItemType = SchemaTypes.ItemType;
|
|
5
5
|
|
|
6
6
|
export type ItemCollectionOutletsHook = {
|
|
7
|
+
/**
|
|
8
|
+
* Use this function to declare custom outlets to be shown at the top of a
|
|
9
|
+
* collection of records of a particular model
|
|
10
|
+
*
|
|
11
|
+
* @tag outlets
|
|
12
|
+
*/
|
|
7
13
|
itemCollectionOutlets: (
|
|
8
14
|
itemType: ItemType,
|
|
9
|
-
ctx:
|
|
15
|
+
ctx: ItemCollectionOutletsCtx,
|
|
10
16
|
) => ItemCollectionOutlet[];
|
|
11
17
|
};
|
|
12
18
|
|
|
19
|
+
export type ItemCollectionOutletsCtx = Ctx;
|
|
20
|
+
|
|
13
21
|
/** An outlet to be shown at the top of a record's collection page */
|
|
14
22
|
export type ItemCollectionOutlet = {
|
|
15
23
|
/**
|
|
@@ -6,6 +6,15 @@ import { DropdownAction, DropdownActionGroup } from '../shared';
|
|
|
6
6
|
type ItemType = SchemaTypes.ItemType;
|
|
7
7
|
|
|
8
8
|
export type ItemFormDropdownActionsHook = {
|
|
9
|
+
/**
|
|
10
|
+
* Use this function to define custom actions (or groups of actions) to be
|
|
11
|
+
* displayed at when editing a particular record.
|
|
12
|
+
*
|
|
13
|
+
* The `executeItemFormDropdownAction()` hook will be triggered once the user
|
|
14
|
+
* clicks on one of the defined actions.
|
|
15
|
+
*
|
|
16
|
+
* @tag dropdownActions
|
|
17
|
+
*/
|
|
9
18
|
itemFormDropdownActions: (
|
|
10
19
|
itemType: ItemType,
|
|
11
20
|
ctx: ItemFormDropdownActionsCtx,
|
|
@@ -8,11 +8,16 @@ export type ItemFormOutletsHook = {
|
|
|
8
8
|
* Use this function to declare custom outlets to be shown at the top of the
|
|
9
9
|
* record's editing page
|
|
10
10
|
*
|
|
11
|
-
* @tag
|
|
11
|
+
* @tag outlets
|
|
12
12
|
*/
|
|
13
|
-
itemFormOutlets: (
|
|
13
|
+
itemFormOutlets: (
|
|
14
|
+
itemType: ItemType,
|
|
15
|
+
ctx: ItemFormOutletsCtx,
|
|
16
|
+
) => ItemFormOutlet[];
|
|
14
17
|
};
|
|
15
18
|
|
|
19
|
+
export type ItemFormOutletsCtx = Ctx;
|
|
20
|
+
|
|
16
21
|
export type ItemFormOutlet = {
|
|
17
22
|
/**
|
|
18
23
|
* ID of the outlet. Will be the first argument for the `renderItemFormOutlet`
|
|
@@ -13,10 +13,12 @@ export type ItemFormSidebarPanelsHook = {
|
|
|
13
13
|
*/
|
|
14
14
|
itemFormSidebarPanels: (
|
|
15
15
|
itemType: ItemType,
|
|
16
|
-
ctx:
|
|
16
|
+
ctx: ItemFormSidebarPanelsCtx,
|
|
17
17
|
) => ItemFormSidebarPanel[];
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
export type ItemFormSidebarPanelsCtx = Ctx;
|
|
21
|
+
|
|
20
22
|
export type ItemFormSidebarPanel = {
|
|
21
23
|
/**
|
|
22
24
|
* ID of the panel. Will be the first argument for the
|
|
@@ -10,9 +10,14 @@ export type ItemFormSidebarsHook = {
|
|
|
10
10
|
*
|
|
11
11
|
* @tag sidebarPanels
|
|
12
12
|
*/
|
|
13
|
-
itemFormSidebars: (
|
|
13
|
+
itemFormSidebars: (
|
|
14
|
+
itemType: ItemType,
|
|
15
|
+
ctx: ItemFormSidebarsCtx,
|
|
16
|
+
) => ItemFormSidebar[];
|
|
14
17
|
};
|
|
15
18
|
|
|
19
|
+
export type ItemFormSidebarsCtx = Ctx;
|
|
20
|
+
|
|
16
21
|
export type ItemFormSidebar = {
|
|
17
22
|
/**
|
|
18
23
|
* ID of the sidebar. Will be the first argument for the
|
|
@@ -5,6 +5,18 @@ import { DropdownAction, DropdownActionGroup } from '../shared';
|
|
|
5
5
|
type ItemType = SchemaTypes.ItemType;
|
|
6
6
|
|
|
7
7
|
export type ItemsDropdownActionsHook = {
|
|
8
|
+
/**
|
|
9
|
+
* This function lets you set up custom actions (or groups of actions) that
|
|
10
|
+
* show up when the user:
|
|
11
|
+
*
|
|
12
|
+
* * selects multiple records in the collection view for batch operations, or
|
|
13
|
+
* * starts editing a specific record.
|
|
14
|
+
*
|
|
15
|
+
* The `executeItemsDropdownAction()` hook will be triggered once the user
|
|
16
|
+
* clicks on one of the defined actions.
|
|
17
|
+
*
|
|
18
|
+
* @tag dropdownActions
|
|
19
|
+
*/
|
|
8
20
|
itemsDropdownActions: (
|
|
9
21
|
itemType: ItemType,
|
|
10
22
|
ctx: ItemDropdownActionsCtx,
|
|
@@ -8,9 +8,11 @@ export type MainNavigationTabsHook = {
|
|
|
8
8
|
*
|
|
9
9
|
* @tag pages
|
|
10
10
|
*/
|
|
11
|
-
mainNavigationTabs: (ctx:
|
|
11
|
+
mainNavigationTabs: (ctx: MainNavigationTabsCtx) => MainNavigationTab[];
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
export type MainNavigationTabsCtx = Ctx;
|
|
15
|
+
|
|
14
16
|
/** A tab to be displayed in the top-bar of the UI */
|
|
15
17
|
export type MainNavigationTab = {
|
|
16
18
|
/** Label to be shown. Must be unique. */
|
|
@@ -7,9 +7,13 @@ export type ManualFieldExtensionsHook = {
|
|
|
7
7
|
*
|
|
8
8
|
* @tag manualFieldExtensions
|
|
9
9
|
*/
|
|
10
|
-
manualFieldExtensions: (
|
|
10
|
+
manualFieldExtensions: (
|
|
11
|
+
ctx: ManualFieldExtensionsCtx,
|
|
12
|
+
) => ManualFieldExtension[];
|
|
11
13
|
};
|
|
12
14
|
|
|
15
|
+
export type ManualFieldExtensionsCtx = Ctx;
|
|
16
|
+
|
|
13
17
|
export type ManualFieldExtension = {
|
|
14
18
|
/**
|
|
15
19
|
* ID of field extension. Will be the first argument for the
|
|
@@ -14,6 +14,8 @@ export type OnBeforeItemUpsertHook = {
|
|
|
14
14
|
*/
|
|
15
15
|
onBeforeItemUpsert: (
|
|
16
16
|
createOrUpdateItemPayload: ItemUpdateSchema | ItemCreateSchema,
|
|
17
|
-
ctx:
|
|
17
|
+
ctx: OnBeforeItemUpsertCtx,
|
|
18
18
|
) => MaybePromise<boolean>;
|
|
19
19
|
};
|
|
20
|
+
|
|
21
|
+
export type OnBeforeItemUpsertCtx = Ctx;
|
|
@@ -11,5 +11,10 @@ export type OnBeforeItemsDestroyHook = {
|
|
|
11
11
|
*
|
|
12
12
|
* @tag beforeHooks
|
|
13
13
|
*/
|
|
14
|
-
onBeforeItemsDestroy: (
|
|
14
|
+
onBeforeItemsDestroy: (
|
|
15
|
+
items: Item[],
|
|
16
|
+
ctx: OnBeforeItemsDestroyCtx,
|
|
17
|
+
) => MaybePromise<boolean>;
|
|
15
18
|
};
|
|
19
|
+
|
|
20
|
+
export type OnBeforeItemsDestroyCtx = Ctx;
|
|
@@ -11,5 +11,10 @@ export type OnBeforeItemsPublishHook = {
|
|
|
11
11
|
*
|
|
12
12
|
* @tag beforeHooks
|
|
13
13
|
*/
|
|
14
|
-
onBeforeItemsPublish: (
|
|
14
|
+
onBeforeItemsPublish: (
|
|
15
|
+
items: Item[],
|
|
16
|
+
ctx: OnBeforeItemsPublishCtx,
|
|
17
|
+
) => MaybePromise<boolean>;
|
|
15
18
|
};
|
|
19
|
+
|
|
20
|
+
export type OnBeforeItemsPublishCtx = Ctx;
|
|
@@ -11,5 +11,10 @@ export type OnBeforeItemsUnpublishHook = {
|
|
|
11
11
|
*
|
|
12
12
|
* @tag beforeHooks
|
|
13
13
|
*/
|
|
14
|
-
onBeforeItemsUnpublish: (
|
|
14
|
+
onBeforeItemsUnpublish: (
|
|
15
|
+
items: Item[],
|
|
16
|
+
ctx: OnBeforeItemsUnpublishCtx,
|
|
17
|
+
) => MaybePromise<boolean>;
|
|
15
18
|
};
|
|
19
|
+
|
|
20
|
+
export type OnBeforeItemsUnpublishCtx = Ctx;
|
|
@@ -14,11 +14,11 @@ export type OverrideFieldExtensionsHook = {
|
|
|
14
14
|
*/
|
|
15
15
|
overrideFieldExtensions: (
|
|
16
16
|
field: Field,
|
|
17
|
-
ctx:
|
|
17
|
+
ctx: OverrideFieldExtensionsCtx,
|
|
18
18
|
) => FieldExtensionOverride | undefined;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export type
|
|
21
|
+
export type OverrideFieldExtensionsCtx = Ctx<{
|
|
22
22
|
itemType: ItemType;
|
|
23
23
|
}>;
|
|
24
24
|
|
|
@@ -2,6 +2,12 @@ import { SelfResizingPluginFrameCtx } from '../ctx/pluginFrame';
|
|
|
2
2
|
import { containedRenderModeBootstrapper } from '../utils';
|
|
3
3
|
|
|
4
4
|
export type RenderItemCollectionOutletHook = {
|
|
5
|
+
/**
|
|
6
|
+
* This function will be called when the plugin needs to render an outlet
|
|
7
|
+
* defined by the `itemFormOutlets()` hook.
|
|
8
|
+
*
|
|
9
|
+
* @tag outlets
|
|
10
|
+
*/
|
|
5
11
|
renderItemCollectionOutlet: (
|
|
6
12
|
itemCollectionOutletId: string,
|
|
7
13
|
ctx: RenderItemCollectionOutletCtx,
|
|
@@ -7,10 +7,10 @@ import { containedRenderModeBootstrapper } from '../utils';
|
|
|
7
7
|
|
|
8
8
|
export type RenderItemFormOutletHook = {
|
|
9
9
|
/**
|
|
10
|
-
* This function will be called when the plugin needs to render an outlet
|
|
11
|
-
* the `itemFormOutlets`
|
|
10
|
+
* This function will be called when the plugin needs to render an outlet
|
|
11
|
+
* defined by the `itemFormOutlets()` hook.
|
|
12
12
|
*
|
|
13
|
-
* @tag
|
|
13
|
+
* @tag outlets
|
|
14
14
|
*/
|
|
15
15
|
renderItemFormOutlet: (
|
|
16
16
|
itemFormOutletId: string,
|
|
@@ -8,9 +8,13 @@ export type SettingsAreaSidebarItemGroupsHook = {
|
|
|
8
8
|
*
|
|
9
9
|
* @tag pages
|
|
10
10
|
*/
|
|
11
|
-
settingsAreaSidebarItemGroups: (
|
|
11
|
+
settingsAreaSidebarItemGroups: (
|
|
12
|
+
ctx: SettingsAreaSidebarItemGroupsCtx,
|
|
13
|
+
) => SettingsAreaSidebarItemGroup[];
|
|
12
14
|
};
|
|
13
15
|
|
|
16
|
+
export type SettingsAreaSidebarItemGroupsCtx = Ctx;
|
|
17
|
+
|
|
14
18
|
/**
|
|
15
19
|
* The sidebar in the Settings Area presents a number of pages grouped by topic.
|
|
16
20
|
* This object represents a new group to be added in the sideebar to the
|