@dotcms/react 0.0.1-alpha.9 → 0.0.1-beta.10
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 +45 -4
- package/es.regexp.to-string.esm.js +1878 -0
- package/index.esm.d.ts +1 -0
- package/index.esm.js +3464 -0
- package/next.esm.d.ts +1 -0
- package/next.esm.js +738 -0
- package/package.json +54 -27
- package/src/index.d.ts +1 -0
- package/src/lib/deprecated/components/BlockEditorRenderer/BlockEditorRenderer.d.ts +37 -0
- package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Code.d.ts +17 -0
- package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Contentlet.d.ts +41 -0
- package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Image.d.ts +8 -0
- package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Lists.d.ts +22 -0
- package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Table.d.ts +16 -0
- package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Texts.d.ts +71 -0
- package/src/lib/deprecated/components/BlockEditorRenderer/blocks/Video.d.ts +8 -0
- package/src/lib/deprecated/components/BlockEditorRenderer/item/BlockEditorBlock.d.ts +12 -0
- package/src/lib/deprecated/components/Column/Column.d.ts +19 -0
- package/src/lib/deprecated/components/Container/Container.d.ts +19 -0
- package/src/lib/deprecated/components/DotEditableText/DotEditableText.d.ts +30 -0
- package/src/lib/deprecated/components/DotEditableText/utils.d.ts +36 -0
- package/src/lib/{components/DotcmsLayout/DotcmsLayout.tsx → deprecated/components/DotcmsLayout/DotcmsLayout.d.ts} +9 -23
- package/src/lib/deprecated/components/PageProvider/PageProvider.d.ts +14 -0
- package/src/lib/deprecated/components/Row/Row.d.ts +26 -0
- package/src/lib/deprecated/contexts/PageContext.d.ts +8 -0
- package/src/lib/deprecated/deprecated_api.d.ts +7 -0
- package/src/lib/deprecated/hooks/useCheckHaveContent.d.ts +5 -0
- package/src/lib/deprecated/hooks/useDotcmsEditor.d.ts +13 -0
- package/src/lib/deprecated/hooks/useDotcmsPageContext.d.ts +9 -0
- package/src/lib/deprecated/mocks/mockPageContext.d.ts +7 -0
- package/src/lib/deprecated/models/blocks.interface.d.ts +89 -0
- package/src/lib/deprecated/models/content-node.interface.d.ts +82 -0
- package/src/lib/deprecated/models/index.d.ts +127 -0
- package/src/lib/deprecated/utils/utils.d.ts +58 -0
- package/src/lib/next/__test__/mock.d.ts +11 -0
- package/src/lib/next/components/Column/Column.d.ts +37 -0
- package/src/lib/next/components/Container/Container.d.ts +32 -0
- package/src/lib/next/components/Container/ContainerFallbakcs.d.ts +24 -0
- package/src/lib/next/components/Contentlet/Contentlet.d.ts +32 -0
- package/src/lib/next/components/DotCMSLayoutBody/DotCMSLayoutBody.d.ts +26 -0
- package/src/lib/next/components/DotCMSLayoutBody/components/ErrorMessage.d.ts +9 -0
- package/src/lib/next/components/DotCMSShow/DotCMSShow.d.ts +49 -0
- package/src/lib/next/components/FallbackComponent/FallbackComponent.d.ts +41 -0
- package/src/lib/next/components/Row/Row.d.ts +21 -0
- package/src/lib/next/contexts/DotCMSPageContext.d.ts +23 -0
- package/src/lib/next/hooks/useCheckVisibleContent.d.ts +24 -0
- package/src/lib/next/hooks/useDotCMSShowWhen.d.ts +31 -0
- package/src/lib/next/hooks/useIsDevMode.d.ts +13 -0
- package/src/lib/next/types.d.ts +421 -0
- package/src/lib/next/utils/index.d.ts +136 -0
- package/src/next.d.ts +3 -0
- package/.babelrc +0 -12
- package/.eslintrc.json +0 -18
- package/jest.config.ts +0 -11
- package/project.json +0 -51
- package/src/index.ts +0 -4
- package/src/lib/components/Column/Column.module.css +0 -99
- package/src/lib/components/Column/Column.spec.tsx +0 -78
- package/src/lib/components/Column/Column.tsx +0 -45
- package/src/lib/components/Container/Container.module.css +0 -7
- package/src/lib/components/Container/Container.spec.tsx +0 -82
- package/src/lib/components/Container/Container.tsx +0 -105
- package/src/lib/components/DotcmsLayout/DotcmsLayout.module.css +0 -7
- package/src/lib/components/DotcmsLayout/DotcmsLayout.spec.tsx +0 -41
- package/src/lib/components/PageProvider/PageProvider.module.css +0 -7
- package/src/lib/components/PageProvider/PageProvider.spec.tsx +0 -54
- package/src/lib/components/PageProvider/PageProvider.tsx +0 -95
- package/src/lib/components/Row/Row.module.css +0 -5
- package/src/lib/components/Row/Row.spec.tsx +0 -92
- package/src/lib/components/Row/Row.tsx +0 -51
- package/src/lib/contexts/PageContext.tsx +0 -5
- package/src/lib/hooks/useDotcmsEditor.spec.ts +0 -56
- package/src/lib/hooks/useDotcmsEditor.ts +0 -29
- package/src/lib/hooks/useDotcmsPageContext.spec.tsx +0 -43
- package/src/lib/hooks/useDotcmsPageContext.tsx +0 -15
- package/src/lib/mocks/mockPageContext.tsx +0 -84
- package/src/lib/utils/utils.ts +0 -69
- package/tsconfig.json +0 -20
- package/tsconfig.lib.json +0 -23
- package/tsconfig.spec.json +0 -20
- /package/src/lib/{mocks/index.ts → deprecated/mocks/index.d.ts} +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* A custom React hook that checks whether a referenced HTMLDivElement has visible content based on its height.
|
|
5
|
+
*
|
|
6
|
+
* @param {RefObject<HTMLDivElement>} ref - A React ref object pointing to an HTMLDivElement.
|
|
7
|
+
* @returns {boolean} - Returns true if the element's height is greater than zero (indicating visible content), otherwise false.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { useRef } from 'react';
|
|
11
|
+
* import { useCheckVisibleContent } from 'src/lib/next/hooks/useCheckVisibleContent';
|
|
12
|
+
*
|
|
13
|
+
* function MyComponent() {
|
|
14
|
+
* const contentRef = useRef<HTMLDivElement>(null);
|
|
15
|
+
* const isContentVisible = useCheckVisibleContent(contentRef);
|
|
16
|
+
*
|
|
17
|
+
* return (
|
|
18
|
+
* <div ref={contentRef}>
|
|
19
|
+
* {isContentVisible ? 'Content is visible' : 'Content is not visible'}
|
|
20
|
+
* </div>
|
|
21
|
+
* );
|
|
22
|
+
* }
|
|
23
|
+
*/
|
|
24
|
+
export declare const useCheckVisibleContent: (ref: RefObject<HTMLDivElement>) => boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { UVE_MODE } from '@dotcms/uve/types';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook to determine if the current UVE (Universal Visual Editor) mode
|
|
4
|
+
* matches the specified mode. This hook is useful for conditionally rendering
|
|
5
|
+
* components based on the UVE mode.
|
|
6
|
+
*
|
|
7
|
+
* @param {UVE_MODE} when - The UVE mode to check against.
|
|
8
|
+
* @returns {boolean} True if the current UVE mode matches the specified mode, otherwise false.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Basic usage: Check if the UVE is in edit mode
|
|
12
|
+
* const showInEditMode = useDotCMSShowWhen(UVE_MODE.EDIT);
|
|
13
|
+
* if (showInEditMode) {
|
|
14
|
+
* // Render edit-specific components
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Check if the UVE is in preview mode
|
|
19
|
+
* const showInPreviewMode = useDotCMSShowWhen(UVE_MODE.PREVIEW);
|
|
20
|
+
* if (showInPreviewMode) {
|
|
21
|
+
* // Render preview-specific components
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // Check if the UVE is in live mode
|
|
26
|
+
* const showInLiveMode = useDotCMSShowWhen(UVE_MODE.LIVE);
|
|
27
|
+
* if (showInLiveMode) {
|
|
28
|
+
* // Render live-specific components
|
|
29
|
+
* }
|
|
30
|
+
*/
|
|
31
|
+
export declare const useDotCMSShowWhen: (when: UVE_MODE) => boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DotCMSPageRendererMode } from '../contexts/DotCMSPageContext';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* A React hook that determines if the current environment is in development mode.
|
|
5
|
+
*
|
|
6
|
+
* The hook returns `true` if either:
|
|
7
|
+
* - The context mode (or the optional `renderMode` argument) is set to 'development', or
|
|
8
|
+
* - The application is running inside the DotCMS editor (as determined by `isInsideEditor()`).
|
|
9
|
+
*
|
|
10
|
+
* @param {DotCMSPageRendererMode} [renderMode] - Optional override for the render mode.
|
|
11
|
+
* @returns {boolean} - `true` if in development mode or inside the editor; otherwise, `false`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useIsDevMode: (renderMode?: DotCMSPageRendererMode) => boolean;
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
export interface DotCMSPageAsset {
|
|
2
|
+
canCreateTemplate?: boolean;
|
|
3
|
+
containers: {
|
|
4
|
+
[key: string]: DotCMSPageAssetContainer;
|
|
5
|
+
};
|
|
6
|
+
layout: DotCMSLayout;
|
|
7
|
+
page: DotCMSPage;
|
|
8
|
+
site: DotCMSSite;
|
|
9
|
+
template: DotCMSTemplate;
|
|
10
|
+
viewAs?: DotCMSViewAs;
|
|
11
|
+
vanityUrl?: DotCMSVanityUrl;
|
|
12
|
+
}
|
|
13
|
+
export interface DotPageAssetLayoutRow {
|
|
14
|
+
identifier: number;
|
|
15
|
+
value?: string;
|
|
16
|
+
id?: string;
|
|
17
|
+
columns: DotPageAssetLayoutColumn[];
|
|
18
|
+
styleClass?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface DotCMSVanityUrl {
|
|
21
|
+
pattern: string;
|
|
22
|
+
vanityUrlId: string;
|
|
23
|
+
url: string;
|
|
24
|
+
siteId: string;
|
|
25
|
+
languageId: number;
|
|
26
|
+
forwardTo: string;
|
|
27
|
+
response: number;
|
|
28
|
+
order: number;
|
|
29
|
+
temporaryRedirect: boolean;
|
|
30
|
+
permanentRedirect: boolean;
|
|
31
|
+
forward: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface DotPageAssetLayoutColumn {
|
|
34
|
+
preview: boolean;
|
|
35
|
+
containers: DotCMSColumnContainer[];
|
|
36
|
+
widthPercent: number;
|
|
37
|
+
width: number;
|
|
38
|
+
leftOffset: number;
|
|
39
|
+
left: number;
|
|
40
|
+
styleClass?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface DotCMSColumnContainer {
|
|
43
|
+
identifier: string;
|
|
44
|
+
uuid: string;
|
|
45
|
+
historyUUIDs: string[];
|
|
46
|
+
}
|
|
47
|
+
export interface DotCMSPageAssetContainer {
|
|
48
|
+
container: DotCMSContainer;
|
|
49
|
+
containerStructures: DotCMSContainerStructure[];
|
|
50
|
+
contentlets: {
|
|
51
|
+
[key: string]: DotCMSContentlet[];
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface DotCMSContainer {
|
|
55
|
+
identifier: string;
|
|
56
|
+
uuid: string;
|
|
57
|
+
iDate: number;
|
|
58
|
+
type: string;
|
|
59
|
+
owner?: string;
|
|
60
|
+
inode: string;
|
|
61
|
+
source: string;
|
|
62
|
+
title: string;
|
|
63
|
+
friendlyName: string;
|
|
64
|
+
modDate: number;
|
|
65
|
+
modUser: string;
|
|
66
|
+
sortOrder: number;
|
|
67
|
+
showOnMenu: boolean;
|
|
68
|
+
code?: string;
|
|
69
|
+
maxContentlets: number;
|
|
70
|
+
useDiv: boolean;
|
|
71
|
+
sortContentletsBy?: string;
|
|
72
|
+
preLoop: string;
|
|
73
|
+
postLoop: string;
|
|
74
|
+
staticify: boolean;
|
|
75
|
+
luceneQuery?: string;
|
|
76
|
+
notes: string;
|
|
77
|
+
languageId?: number;
|
|
78
|
+
path?: string;
|
|
79
|
+
live: boolean;
|
|
80
|
+
locked: boolean;
|
|
81
|
+
working: boolean;
|
|
82
|
+
deleted: boolean;
|
|
83
|
+
name: string;
|
|
84
|
+
archived: boolean;
|
|
85
|
+
permissionId: string;
|
|
86
|
+
versionId: string;
|
|
87
|
+
versionType: string;
|
|
88
|
+
permissionType: string;
|
|
89
|
+
categoryId: string;
|
|
90
|
+
idate: number;
|
|
91
|
+
new: boolean;
|
|
92
|
+
acceptTypes: string;
|
|
93
|
+
contentlets: DotCMSContentlet[];
|
|
94
|
+
parentPermissionable: DotCMSSiteParentPermissionable;
|
|
95
|
+
}
|
|
96
|
+
export interface DotCMSContentlet {
|
|
97
|
+
archived: boolean;
|
|
98
|
+
baseType: string;
|
|
99
|
+
deleted?: boolean;
|
|
100
|
+
binary?: string;
|
|
101
|
+
binaryContentAsset?: string;
|
|
102
|
+
binaryVersion?: string;
|
|
103
|
+
contentType: string;
|
|
104
|
+
file?: string;
|
|
105
|
+
folder: string;
|
|
106
|
+
hasLiveVersion?: boolean;
|
|
107
|
+
hasTitleImage: boolean;
|
|
108
|
+
host: string;
|
|
109
|
+
hostName: string;
|
|
110
|
+
identifier: string;
|
|
111
|
+
inode: string;
|
|
112
|
+
image?: any;
|
|
113
|
+
languageId: number;
|
|
114
|
+
language?: string;
|
|
115
|
+
live: boolean;
|
|
116
|
+
locked: boolean;
|
|
117
|
+
mimeType?: string;
|
|
118
|
+
modDate: string;
|
|
119
|
+
modUser: string;
|
|
120
|
+
modUserName: string;
|
|
121
|
+
owner: string;
|
|
122
|
+
sortOrder: number;
|
|
123
|
+
stInode: string;
|
|
124
|
+
title: string;
|
|
125
|
+
titleImage: string;
|
|
126
|
+
text?: string;
|
|
127
|
+
url: string;
|
|
128
|
+
working: boolean;
|
|
129
|
+
body?: string;
|
|
130
|
+
contentTypeIcon?: string;
|
|
131
|
+
variant?: string;
|
|
132
|
+
__icon__?: string;
|
|
133
|
+
[key: string]: any;
|
|
134
|
+
}
|
|
135
|
+
export interface DotcmsNavigationItem {
|
|
136
|
+
code?: any;
|
|
137
|
+
folder: string;
|
|
138
|
+
children?: DotcmsNavigationItem[];
|
|
139
|
+
host: string;
|
|
140
|
+
languageId: number;
|
|
141
|
+
href: string;
|
|
142
|
+
title: string;
|
|
143
|
+
type: string;
|
|
144
|
+
hash: number;
|
|
145
|
+
target: string;
|
|
146
|
+
order: number;
|
|
147
|
+
}
|
|
148
|
+
interface DotCMSTemplate {
|
|
149
|
+
iDate: number;
|
|
150
|
+
type: string;
|
|
151
|
+
owner: string;
|
|
152
|
+
inode: string;
|
|
153
|
+
identifier: string;
|
|
154
|
+
source: string;
|
|
155
|
+
title: string;
|
|
156
|
+
friendlyName: string;
|
|
157
|
+
modDate: number;
|
|
158
|
+
modUser: string;
|
|
159
|
+
sortOrder: number;
|
|
160
|
+
showOnMenu: boolean;
|
|
161
|
+
image: string;
|
|
162
|
+
drawed: boolean;
|
|
163
|
+
drawedBody: string;
|
|
164
|
+
theme: string;
|
|
165
|
+
anonymous: boolean;
|
|
166
|
+
template: boolean;
|
|
167
|
+
name: string;
|
|
168
|
+
live: boolean;
|
|
169
|
+
archived: boolean;
|
|
170
|
+
locked: boolean;
|
|
171
|
+
working: boolean;
|
|
172
|
+
permissionId: string;
|
|
173
|
+
versionId: string;
|
|
174
|
+
versionType: string;
|
|
175
|
+
deleted: boolean;
|
|
176
|
+
permissionType: string;
|
|
177
|
+
categoryId: string;
|
|
178
|
+
idate: number;
|
|
179
|
+
new: boolean;
|
|
180
|
+
canEdit: boolean;
|
|
181
|
+
}
|
|
182
|
+
interface DotCMSPage {
|
|
183
|
+
template: string;
|
|
184
|
+
modDate: number;
|
|
185
|
+
metadata: string;
|
|
186
|
+
cachettl: string;
|
|
187
|
+
pageURI: string;
|
|
188
|
+
title: string;
|
|
189
|
+
type: string;
|
|
190
|
+
showOnMenu: string;
|
|
191
|
+
httpsRequired: boolean;
|
|
192
|
+
inode: string;
|
|
193
|
+
disabledWYSIWYG: any[];
|
|
194
|
+
seokeywords: string;
|
|
195
|
+
host: string;
|
|
196
|
+
lastReview: number;
|
|
197
|
+
working: boolean;
|
|
198
|
+
locked: boolean;
|
|
199
|
+
stInode: string;
|
|
200
|
+
friendlyName: string;
|
|
201
|
+
live: boolean;
|
|
202
|
+
owner: string;
|
|
203
|
+
identifier: string;
|
|
204
|
+
nullProperties: any[];
|
|
205
|
+
friendlyname: string;
|
|
206
|
+
pagemetadata: string;
|
|
207
|
+
languageId: number;
|
|
208
|
+
url: string;
|
|
209
|
+
seodescription: string;
|
|
210
|
+
modUserName: string;
|
|
211
|
+
folder: string;
|
|
212
|
+
deleted: boolean;
|
|
213
|
+
sortOrder: number;
|
|
214
|
+
modUser: string;
|
|
215
|
+
pageUrl: string;
|
|
216
|
+
workingInode: string;
|
|
217
|
+
shortyWorking: string;
|
|
218
|
+
canEdit: boolean;
|
|
219
|
+
canRead: boolean;
|
|
220
|
+
canLock: boolean;
|
|
221
|
+
lockedOn: number;
|
|
222
|
+
lockedBy: string;
|
|
223
|
+
lockedByName: string;
|
|
224
|
+
liveInode: string;
|
|
225
|
+
shortyLive: string;
|
|
226
|
+
}
|
|
227
|
+
interface DotCMSViewAs {
|
|
228
|
+
language: {
|
|
229
|
+
id: number;
|
|
230
|
+
languageCode: string;
|
|
231
|
+
countryCode: string;
|
|
232
|
+
language: string;
|
|
233
|
+
country: string;
|
|
234
|
+
};
|
|
235
|
+
mode: string;
|
|
236
|
+
}
|
|
237
|
+
interface DotCMSLayout {
|
|
238
|
+
pageWidth: string;
|
|
239
|
+
width: string;
|
|
240
|
+
layout: string;
|
|
241
|
+
title: string;
|
|
242
|
+
header: boolean;
|
|
243
|
+
footer: boolean;
|
|
244
|
+
body: DotPageAssetLayoutBody;
|
|
245
|
+
sidebar: DotPageAssetLayoutSidebar;
|
|
246
|
+
}
|
|
247
|
+
interface DotCMSContainerStructure {
|
|
248
|
+
id: string;
|
|
249
|
+
structureId: string;
|
|
250
|
+
containerInode: string;
|
|
251
|
+
containerId: string;
|
|
252
|
+
code: string;
|
|
253
|
+
contentTypeVar: string;
|
|
254
|
+
}
|
|
255
|
+
interface DotPageAssetLayoutSidebar {
|
|
256
|
+
preview: boolean;
|
|
257
|
+
containers: DotCMSContainer[];
|
|
258
|
+
location: string;
|
|
259
|
+
widthPercent: number;
|
|
260
|
+
width: string;
|
|
261
|
+
}
|
|
262
|
+
interface DotPageAssetLayoutBody {
|
|
263
|
+
rows: DotPageAssetLayoutRow[];
|
|
264
|
+
}
|
|
265
|
+
interface DotCMSSite {
|
|
266
|
+
lowIndexPriority: boolean;
|
|
267
|
+
name: string;
|
|
268
|
+
default: boolean;
|
|
269
|
+
aliases: string;
|
|
270
|
+
parent: boolean;
|
|
271
|
+
tagStorage: string;
|
|
272
|
+
systemHost: boolean;
|
|
273
|
+
inode: string;
|
|
274
|
+
versionType: string;
|
|
275
|
+
structureInode: string;
|
|
276
|
+
hostname: string;
|
|
277
|
+
hostThumbnail?: any;
|
|
278
|
+
owner: string;
|
|
279
|
+
permissionId: string;
|
|
280
|
+
permissionType: string;
|
|
281
|
+
type: string;
|
|
282
|
+
identifier: string;
|
|
283
|
+
modDate: number;
|
|
284
|
+
host: string;
|
|
285
|
+
live: boolean;
|
|
286
|
+
indexPolicy: string;
|
|
287
|
+
categoryId: string;
|
|
288
|
+
actionId?: any;
|
|
289
|
+
new: boolean;
|
|
290
|
+
archived: boolean;
|
|
291
|
+
locked: boolean;
|
|
292
|
+
disabledWysiwyg: any[];
|
|
293
|
+
modUser: string;
|
|
294
|
+
working: boolean;
|
|
295
|
+
titleImage: {
|
|
296
|
+
present: boolean;
|
|
297
|
+
};
|
|
298
|
+
folder: string;
|
|
299
|
+
htmlpage: boolean;
|
|
300
|
+
fileAsset: boolean;
|
|
301
|
+
vanityUrl: boolean;
|
|
302
|
+
keyValue: boolean;
|
|
303
|
+
structure?: DotCMSSiteStructure;
|
|
304
|
+
title: string;
|
|
305
|
+
languageId: number;
|
|
306
|
+
indexPolicyDependencies: string;
|
|
307
|
+
contentTypeId: string;
|
|
308
|
+
versionId: string;
|
|
309
|
+
lastReview: number;
|
|
310
|
+
nextReview?: any;
|
|
311
|
+
reviewInterval?: any;
|
|
312
|
+
sortOrder: number;
|
|
313
|
+
contentType: DotCMSSiteContentType;
|
|
314
|
+
}
|
|
315
|
+
interface DotCMSSiteContentType {
|
|
316
|
+
owner?: any;
|
|
317
|
+
parentPermissionable: DotCMSSiteParentPermissionable;
|
|
318
|
+
permissionId: string;
|
|
319
|
+
permissionType: string;
|
|
320
|
+
}
|
|
321
|
+
export interface DotCMSSiteParentPermissionable {
|
|
322
|
+
Inode: string;
|
|
323
|
+
Identifier: string;
|
|
324
|
+
permissionByIdentifier: boolean;
|
|
325
|
+
type: string;
|
|
326
|
+
owner?: any;
|
|
327
|
+
identifier: string;
|
|
328
|
+
permissionId: string;
|
|
329
|
+
parentPermissionable?: any;
|
|
330
|
+
permissionType: string;
|
|
331
|
+
inode: string;
|
|
332
|
+
childrenPermissionable?: any;
|
|
333
|
+
variantId?: string;
|
|
334
|
+
}
|
|
335
|
+
interface DotCMSSiteStructure {
|
|
336
|
+
iDate: number;
|
|
337
|
+
type: string;
|
|
338
|
+
owner?: any;
|
|
339
|
+
inode: string;
|
|
340
|
+
identifier: string;
|
|
341
|
+
name: string;
|
|
342
|
+
description: string;
|
|
343
|
+
defaultStructure: boolean;
|
|
344
|
+
reviewInterval?: any;
|
|
345
|
+
reviewerRole?: any;
|
|
346
|
+
pagedetail?: any;
|
|
347
|
+
structureType: number;
|
|
348
|
+
fixed: boolean;
|
|
349
|
+
system: boolean;
|
|
350
|
+
velocityVarName: string;
|
|
351
|
+
urlMapPattern?: any;
|
|
352
|
+
host: string;
|
|
353
|
+
folder: string;
|
|
354
|
+
publishDateVar?: any;
|
|
355
|
+
expireDateVar?: any;
|
|
356
|
+
modDate: number;
|
|
357
|
+
fields: DotCMSSiteField[];
|
|
358
|
+
widget: boolean;
|
|
359
|
+
detailPage?: any;
|
|
360
|
+
fieldsBySortOrder: DotCMSSiteField[];
|
|
361
|
+
form: boolean;
|
|
362
|
+
htmlpageAsset: boolean;
|
|
363
|
+
content: boolean;
|
|
364
|
+
fileAsset: boolean;
|
|
365
|
+
persona: boolean;
|
|
366
|
+
permissionId: string;
|
|
367
|
+
permissionType: string;
|
|
368
|
+
live: boolean;
|
|
369
|
+
categoryId: string;
|
|
370
|
+
idate: number;
|
|
371
|
+
new: boolean;
|
|
372
|
+
archived: boolean;
|
|
373
|
+
locked: boolean;
|
|
374
|
+
modUser: string;
|
|
375
|
+
working: boolean;
|
|
376
|
+
title: string;
|
|
377
|
+
versionId: string;
|
|
378
|
+
versionType: string;
|
|
379
|
+
}
|
|
380
|
+
interface DotCMSSiteField {
|
|
381
|
+
iDate: number;
|
|
382
|
+
type: string;
|
|
383
|
+
owner?: any;
|
|
384
|
+
inode: string;
|
|
385
|
+
identifier: string;
|
|
386
|
+
structureInode: string;
|
|
387
|
+
fieldName: string;
|
|
388
|
+
fieldType: string;
|
|
389
|
+
fieldRelationType?: any;
|
|
390
|
+
fieldContentlet: string;
|
|
391
|
+
required: boolean;
|
|
392
|
+
velocityVarName: string;
|
|
393
|
+
sortOrder: number;
|
|
394
|
+
values?: any;
|
|
395
|
+
regexCheck?: any;
|
|
396
|
+
hint?: any;
|
|
397
|
+
defaultValue?: any;
|
|
398
|
+
indexed: boolean;
|
|
399
|
+
listed: boolean;
|
|
400
|
+
fixed: boolean;
|
|
401
|
+
readOnly: boolean;
|
|
402
|
+
searchable: boolean;
|
|
403
|
+
unique: boolean;
|
|
404
|
+
modDate: number;
|
|
405
|
+
dataType: string;
|
|
406
|
+
live: boolean;
|
|
407
|
+
categoryId: string;
|
|
408
|
+
idate: number;
|
|
409
|
+
new: boolean;
|
|
410
|
+
archived: boolean;
|
|
411
|
+
locked: boolean;
|
|
412
|
+
modUser: string;
|
|
413
|
+
working: boolean;
|
|
414
|
+
permissionId: string;
|
|
415
|
+
parentPermissionable?: any;
|
|
416
|
+
permissionType: string;
|
|
417
|
+
title: string;
|
|
418
|
+
versionId: string;
|
|
419
|
+
versionType: string;
|
|
420
|
+
}
|
|
421
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { DotPageAssetLayoutColumn, DotCMSContentlet, DotCMSColumnContainer, DotCMSPageAsset } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* Interface representing the data needed for container editing
|
|
6
|
+
* @interface EditableContainerData
|
|
7
|
+
*/
|
|
8
|
+
interface EditableContainerData {
|
|
9
|
+
uuid: string;
|
|
10
|
+
identifier: string;
|
|
11
|
+
acceptTypes: string;
|
|
12
|
+
maxContentlets: number;
|
|
13
|
+
variantId?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*
|
|
18
|
+
* Interface representing the data attributes of a DotCMS container.
|
|
19
|
+
* @interface DotContainerAttributes
|
|
20
|
+
*/
|
|
21
|
+
export interface DotContainerAttributes {
|
|
22
|
+
'data-dot-object': string;
|
|
23
|
+
'data-dot-accept-types': string;
|
|
24
|
+
'data-dot-identifier': string;
|
|
25
|
+
'data-max-contentlets': string;
|
|
26
|
+
'data-dot-uuid': string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*
|
|
31
|
+
* Interface representing the data attributes of a DotCMS contentlet.
|
|
32
|
+
* @interface DotContentletAttributes
|
|
33
|
+
*/
|
|
34
|
+
export interface DotContentletAttributes {
|
|
35
|
+
'data-dot-identifier': string;
|
|
36
|
+
'data-dot-basetype': string;
|
|
37
|
+
'data-dot-title': string;
|
|
38
|
+
'data-dot-inode': string;
|
|
39
|
+
'data-dot-type': string;
|
|
40
|
+
'data-dot-container': string;
|
|
41
|
+
'data-dot-on-number-of-pages': string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
*
|
|
46
|
+
* Combine classes into a single string.
|
|
47
|
+
*
|
|
48
|
+
* @param {string[]} classes
|
|
49
|
+
* @returns {string} Combined classes
|
|
50
|
+
*/
|
|
51
|
+
export declare const combineClasses: (classes: string[]) => string;
|
|
52
|
+
/**
|
|
53
|
+
* @internal
|
|
54
|
+
*
|
|
55
|
+
* Calculates and returns the CSS Grid positioning classes for a column based on its configuration.
|
|
56
|
+
* Uses a 12-column grid system where columns are positioned using grid-column-start and grid-column-end.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const classes = getColumnPositionClasses({
|
|
61
|
+
* leftOffset: 1, // Starts at the first column
|
|
62
|
+
* width: 6 // Spans 6 columns
|
|
63
|
+
* });
|
|
64
|
+
* // Returns: { startClass: 'col-start-1', endClass: 'col-end-7' }
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @param {DotPageAssetLayoutColumn} column - Column configuration object
|
|
68
|
+
* @param {number} column.leftOffset - Starting position (0-based) in the grid
|
|
69
|
+
* @param {number} column.width - Number of columns to span
|
|
70
|
+
* @returns {{ startClass: string, endClass: string }} Object containing CSS class names for grid positioning
|
|
71
|
+
*/
|
|
72
|
+
export declare const getColumnPositionClasses: (column: DotPageAssetLayoutColumn) => {
|
|
73
|
+
startClass: string;
|
|
74
|
+
endClass: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* @internal
|
|
78
|
+
*
|
|
79
|
+
* Helper function that returns an object containing the dotCMS data attributes.
|
|
80
|
+
* @param {DotCMSContentlet} contentlet - The contentlet to get the attributes for
|
|
81
|
+
* @param {string} container - The container to get the attributes for
|
|
82
|
+
* @returns {DotContentletAttributes} The dotCMS data attributes
|
|
83
|
+
*/
|
|
84
|
+
export declare function getDotContentletAttributes(contentlet: DotCMSContentlet, container: string): DotContentletAttributes;
|
|
85
|
+
/**
|
|
86
|
+
* @internal
|
|
87
|
+
*
|
|
88
|
+
* Retrieves container data from a DotCMS page asset using the container reference.
|
|
89
|
+
* This function processes the container information and returns a standardized format
|
|
90
|
+
* for container editing.
|
|
91
|
+
*
|
|
92
|
+
* @param {DotCMSPageAsset} dotCMSPageAsset - The page asset containing all containers data
|
|
93
|
+
* @param {DotCMSColumnContainer} columContainer - The container reference from the layout
|
|
94
|
+
* @throws {Error} When page asset is invalid or container is not found
|
|
95
|
+
* @returns {EditableContainerData} Formatted container data for editing
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* const containerData = getContainersData(pageAsset, containerRef);
|
|
99
|
+
* // Returns: { uuid: '123', identifier: 'cont1', acceptTypes: 'type1,type2', maxContentlets: 5 }
|
|
100
|
+
*/
|
|
101
|
+
export declare const getContainersData: (dotCMSPageAsset: DotCMSPageAsset, columContainer: DotCMSColumnContainer) => EditableContainerData | null;
|
|
102
|
+
/**
|
|
103
|
+
* @internal
|
|
104
|
+
*
|
|
105
|
+
* Retrieves the contentlets (content items) associated with a specific container.
|
|
106
|
+
* Handles different UUID formats and provides warning for missing contentlets.
|
|
107
|
+
*
|
|
108
|
+
* @param {DotCMSPageAsset} dotCMSPageAsset - The page asset containing all containers data
|
|
109
|
+
* @param {DotCMSColumnContainer} columContainer - The container reference from the layout
|
|
110
|
+
* @returns {DotCMSContentlet[]} Array of contentlets in the container
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* const contentlets = getContentletsInContainer(pageAsset, containerRef);
|
|
114
|
+
* // Returns: [{ identifier: 'cont1', ... }, { identifier: 'cont2', ... }]
|
|
115
|
+
*/
|
|
116
|
+
export declare const getContentletsInContainer: (dotCMSPageAsset: DotCMSPageAsset, columContainer: DotCMSColumnContainer) => DotCMSContentlet[];
|
|
117
|
+
/**
|
|
118
|
+
* @internal
|
|
119
|
+
*
|
|
120
|
+
* Generates the required DotCMS data attributes for a container element.
|
|
121
|
+
* These attributes are used by DotCMS for container identification and functionality.
|
|
122
|
+
*
|
|
123
|
+
* @param {EditableContainerData} params - Container data including uuid, identifier, acceptTypes, and maxContentlets
|
|
124
|
+
* @returns {DotContainerAttributes} Object containing all necessary data attributes
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* const attributes = getDotContainerAttributes({
|
|
128
|
+
* uuid: '123',
|
|
129
|
+
* identifier: 'cont1',
|
|
130
|
+
* acceptTypes: 'type1,type2',
|
|
131
|
+
* maxContentlets: 5
|
|
132
|
+
* });
|
|
133
|
+
* // Returns: { 'data-dot-object': 'container', 'data-dot-identifier': 'cont1', ... }
|
|
134
|
+
*/
|
|
135
|
+
export declare function getDotContainerAttributes({ uuid, identifier, acceptTypes, maxContentlets }: EditableContainerData): DotContainerAttributes;
|
|
136
|
+
export {};
|
package/src/next.d.ts
ADDED
package/.babelrc
DELETED
package/.eslintrc.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["plugin:@nrwl/nx/react", "../../../.eslintrc.base.json"],
|
|
3
|
-
"ignorePatterns": ["!**/*"],
|
|
4
|
-
"overrides": [
|
|
5
|
-
{
|
|
6
|
-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
7
|
-
"rules": {}
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"files": ["*.ts", "*.tsx"],
|
|
11
|
-
"rules": {}
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"files": ["*.js", "*.jsx"],
|
|
15
|
-
"rules": {}
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
}
|
package/jest.config.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
export default {
|
|
3
|
-
displayName: 'sdk-react',
|
|
4
|
-
preset: '../../../jest.preset.js',
|
|
5
|
-
transform: {
|
|
6
|
-
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
|
|
7
|
-
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nrwl/react/babel'] }]
|
|
8
|
-
},
|
|
9
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
|
10
|
-
coverageDirectory: '../../../coverage/libs/sdk/react'
|
|
11
|
-
};
|