@dotcms/react 0.0.1-alpha.1 → 0.0.1-alpha.3
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 +16 -21
- package/index.esm.d.ts +1 -0
- package/{index.js → index.esm.js} +1033 -589
- package/package.json +3 -4
- package/src/index.d.ts +5 -5
- package/src/lib/components/Column/Column.d.ts +5 -7
- package/src/lib/components/Container/Container.d.ts +5 -6
- package/src/lib/components/DotcmsLayout/DotcmsLayout.d.ts +32 -32
- package/src/lib/components/PageProvider/PageProvider.d.ts +82 -81
- package/src/lib/components/Row/Row.d.ts +25 -25
- package/src/lib/contexts/PageContext.d.ts +3 -3
- package/src/lib/hooks/useDotcmsPageContext.d.ts +9 -9
- package/src/lib/hooks/usePageEditor.d.ts +50 -48
- package/src/lib/mocks/index.d.ts +1 -1
- package/src/lib/mocks/mockPageContext.d.ts +7 -2
- package/src/lib/utils/utils.d.ts +55 -50
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotcms/react",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": "^18",
|
|
6
6
|
"react-dom": "^18",
|
|
@@ -26,8 +26,7 @@
|
|
|
26
26
|
"url": "https://github.com/dotCMS/core/issues"
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/dotCMS/core/tree/master/core-web/libs/sdk/react/README.md",
|
|
29
|
-
"module": "./index.js",
|
|
30
|
-
"main": "./index.js",
|
|
29
|
+
"module": "./index.esm.js",
|
|
31
30
|
"type": "module",
|
|
32
|
-
"
|
|
31
|
+
"main": "./index.esm.js"
|
|
33
32
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './lib/components/DotcmsLayout/DotcmsLayout';
|
|
2
|
-
export * from './lib/components/PageProvider/PageProvider';
|
|
3
|
-
export * from './lib/components/Row/Row';
|
|
4
|
-
export * from './lib/hooks/useDotcmsPageContext';
|
|
5
|
-
export * from './lib/hooks/usePageEditor';
|
|
1
|
+
export * from './lib/components/DotcmsLayout/DotcmsLayout';
|
|
2
|
+
export * from './lib/components/PageProvider/PageProvider';
|
|
3
|
+
export * from './lib/components/Row/Row';
|
|
4
|
+
export * from './lib/hooks/useDotcmsPageContext';
|
|
5
|
+
export * from './lib/hooks/usePageEditor';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export declare function Column({ column }: ColumnProps): JSX.Element;
|
|
7
|
-
export {};
|
|
1
|
+
import { PageProviderContext } from '../PageProvider/PageProvider';
|
|
2
|
+
export interface ColumnProps {
|
|
3
|
+
readonly column: PageProviderContext['layout']['body']['rows'][0]['columns'][0];
|
|
4
|
+
}
|
|
5
|
+
export declare function Column({ column }: ColumnProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export declare function Container({ containerRef }: ContainerProps): JSX.Element;
|
|
1
|
+
import { PageProviderContext } from '../PageProvider/PageProvider';
|
|
2
|
+
export interface ContainerProps {
|
|
3
|
+
readonly containerRef: PageProviderContext['layout']['body']['rows'][0]['columns'][0]['containers'][0];
|
|
4
|
+
}
|
|
5
|
+
export declare function Container({ containerRef }: ContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { PageProviderContext } from '../PageProvider/PageProvider';
|
|
3
|
-
/**
|
|
4
|
-
* `DotcmsPageProps` is a type that defines the properties for the `DotcmsLayout` component.
|
|
5
|
-
* It includes a readonly `entity` property that represents the context for a DotCMS page.
|
|
6
|
-
*
|
|
7
|
-
* @typedef {Object} DotcmsPageProps
|
|
8
|
-
*
|
|
9
|
-
* @property {PageProviderContext} entity - The context for a DotCMS page.
|
|
10
|
-
* @readonly
|
|
11
|
-
*/
|
|
12
|
-
export type DotcmsPageProps = {
|
|
13
|
-
/**
|
|
14
|
-
* `entity` is a readonly property of the `DotcmsPageProps` type.
|
|
15
|
-
* It represents the context for a DotCMS page and is of type `PageProviderContext`.
|
|
16
|
-
*
|
|
17
|
-
* @property {PageProviderContext} entity
|
|
18
|
-
* @memberof DotcmsPageProps
|
|
19
|
-
* @type {PageProviderContext}
|
|
20
|
-
* @readonly
|
|
21
|
-
*/
|
|
22
|
-
readonly entity: PageProviderContext;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* `DotcmsLayout` is a functional component that renders a layout for a DotCMS page.
|
|
26
|
-
* It takes a `DotcmsPageProps` object as a parameter and returns a JSX element.
|
|
27
|
-
*
|
|
28
|
-
* @category Components
|
|
29
|
-
* @param {DotcmsPageProps} props - The properties for the DotCMS page.
|
|
30
|
-
* @returns {JSX.Element} - A JSX element that represents the layout for a DotCMS page.
|
|
31
|
-
*/
|
|
32
|
-
export declare function DotcmsLayout(props: DotcmsPageProps): JSX.Element;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PageProviderContext } from '../PageProvider/PageProvider';
|
|
3
|
+
/**
|
|
4
|
+
* `DotcmsPageProps` is a type that defines the properties for the `DotcmsLayout` component.
|
|
5
|
+
* It includes a readonly `entity` property that represents the context for a DotCMS page.
|
|
6
|
+
*
|
|
7
|
+
* @typedef {Object} DotcmsPageProps
|
|
8
|
+
*
|
|
9
|
+
* @property {PageProviderContext} entity - The context for a DotCMS page.
|
|
10
|
+
* @readonly
|
|
11
|
+
*/
|
|
12
|
+
export type DotcmsPageProps = {
|
|
13
|
+
/**
|
|
14
|
+
* `entity` is a readonly property of the `DotcmsPageProps` type.
|
|
15
|
+
* It represents the context for a DotCMS page and is of type `PageProviderContext`.
|
|
16
|
+
*
|
|
17
|
+
* @property {PageProviderContext} entity
|
|
18
|
+
* @memberof DotcmsPageProps
|
|
19
|
+
* @type {PageProviderContext}
|
|
20
|
+
* @readonly
|
|
21
|
+
*/
|
|
22
|
+
readonly entity: PageProviderContext;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* `DotcmsLayout` is a functional component that renders a layout for a DotCMS page.
|
|
26
|
+
* It takes a `DotcmsPageProps` object as a parameter and returns a JSX element.
|
|
27
|
+
*
|
|
28
|
+
* @category Components
|
|
29
|
+
* @param {DotcmsPageProps} props - The properties for the DotCMS page.
|
|
30
|
+
* @returns {JSX.Element} - A JSX element that represents the layout for a DotCMS page.
|
|
31
|
+
*/
|
|
32
|
+
export declare function DotcmsLayout(props: DotcmsPageProps): JSX.Element;
|
|
@@ -1,81 +1,82 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export interface PageProviderProps {
|
|
3
|
-
readonly entity: any;
|
|
4
|
-
readonly children: ReactNode;
|
|
5
|
-
}
|
|
6
|
-
export interface ContainerData {
|
|
7
|
-
[key: string]: {
|
|
8
|
-
container: {
|
|
9
|
-
path: string;
|
|
10
|
-
identifier: string;
|
|
11
|
-
maxContentlets: number;
|
|
12
|
-
};
|
|
13
|
-
containerStructures: {
|
|
14
|
-
contentTypeVar: string;
|
|
15
|
-
}[];
|
|
16
|
-
contentlets: {
|
|
17
|
-
[key: string]: {
|
|
18
|
-
contentType: string;
|
|
19
|
-
identifier: string;
|
|
20
|
-
title: string;
|
|
21
|
-
inode: string;
|
|
22
|
-
widgetTitle?: string;
|
|
23
|
-
}[];
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export interface PageProviderContext {
|
|
28
|
-
/**
|
|
29
|
-
* `components` is a property of the `PageProviderProps` type.
|
|
30
|
-
* It is an object that maps content type variables to their corresponding React components.
|
|
31
|
-
*
|
|
32
|
-
* It will be use to render the contentlets in the page.
|
|
33
|
-
*
|
|
34
|
-
* @property {Object} components
|
|
35
|
-
* @memberof PageProviderProps
|
|
36
|
-
* @type {Object.<string, React.ElementType>}
|
|
37
|
-
*/
|
|
38
|
-
components: {
|
|
39
|
-
[contentTypeVariable: string]: React.ElementType;
|
|
40
|
-
};
|
|
41
|
-
containers: ContainerData;
|
|
42
|
-
layout: {
|
|
43
|
-
header: boolean;
|
|
44
|
-
footer: boolean;
|
|
45
|
-
body: {
|
|
46
|
-
rows: {
|
|
47
|
-
styleClass: string;
|
|
48
|
-
columns: {
|
|
49
|
-
styleClass: string;
|
|
50
|
-
width: number;
|
|
51
|
-
leftOffset: number;
|
|
52
|
-
containers: {
|
|
53
|
-
identifier: string;
|
|
54
|
-
uuid: string;
|
|
55
|
-
}[];
|
|
56
|
-
}[];
|
|
57
|
-
}[];
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
page: {
|
|
61
|
-
title: string;
|
|
62
|
-
identifier: string;
|
|
63
|
-
};
|
|
64
|
-
viewAs: {
|
|
65
|
-
language: {
|
|
66
|
-
id: string;
|
|
67
|
-
};
|
|
68
|
-
persona: {
|
|
69
|
-
keyTag: string;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* @
|
|
79
|
-
* @
|
|
80
|
-
|
|
81
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface PageProviderProps {
|
|
3
|
+
readonly entity: any;
|
|
4
|
+
readonly children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export interface ContainerData {
|
|
7
|
+
[key: string]: {
|
|
8
|
+
container: {
|
|
9
|
+
path: string;
|
|
10
|
+
identifier: string;
|
|
11
|
+
maxContentlets: number;
|
|
12
|
+
};
|
|
13
|
+
containerStructures: {
|
|
14
|
+
contentTypeVar: string;
|
|
15
|
+
}[];
|
|
16
|
+
contentlets: {
|
|
17
|
+
[key: string]: {
|
|
18
|
+
contentType: string;
|
|
19
|
+
identifier: string;
|
|
20
|
+
title: string;
|
|
21
|
+
inode: string;
|
|
22
|
+
widgetTitle?: string;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface PageProviderContext {
|
|
28
|
+
/**
|
|
29
|
+
* `components` is a property of the `PageProviderProps` type.
|
|
30
|
+
* It is an object that maps content type variables to their corresponding React components.
|
|
31
|
+
*
|
|
32
|
+
* It will be use to render the contentlets in the page.
|
|
33
|
+
*
|
|
34
|
+
* @property {Object} components
|
|
35
|
+
* @memberof PageProviderProps
|
|
36
|
+
* @type {Object.<string, React.ElementType>}
|
|
37
|
+
*/
|
|
38
|
+
components: {
|
|
39
|
+
[contentTypeVariable: string]: React.ElementType;
|
|
40
|
+
};
|
|
41
|
+
containers: ContainerData;
|
|
42
|
+
layout: {
|
|
43
|
+
header: boolean;
|
|
44
|
+
footer: boolean;
|
|
45
|
+
body: {
|
|
46
|
+
rows: {
|
|
47
|
+
styleClass: string;
|
|
48
|
+
columns: {
|
|
49
|
+
styleClass: string;
|
|
50
|
+
width: number;
|
|
51
|
+
leftOffset: number;
|
|
52
|
+
containers: {
|
|
53
|
+
identifier: string;
|
|
54
|
+
uuid: string;
|
|
55
|
+
}[];
|
|
56
|
+
}[];
|
|
57
|
+
}[];
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
page: {
|
|
61
|
+
title: string;
|
|
62
|
+
identifier: string;
|
|
63
|
+
};
|
|
64
|
+
viewAs: {
|
|
65
|
+
language: {
|
|
66
|
+
id: string;
|
|
67
|
+
};
|
|
68
|
+
persona: {
|
|
69
|
+
keyTag: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
isInsideEditor: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* `PageProvider` is a functional component that provides a context for a DotCMS page.
|
|
76
|
+
* It takes a `PageProviderProps` object as a parameter and returns a JSX element.
|
|
77
|
+
*
|
|
78
|
+
* @category Components
|
|
79
|
+
* @param {PageProviderProps} props - The properties for the PageProvider. Includes an `entity` and `children`.
|
|
80
|
+
* @returns {JSX.Element} - A JSX element that provides a context for a DotCMS page.
|
|
81
|
+
*/
|
|
82
|
+
export declare function PageProvider(props: PageProviderProps): JSX.Element;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { PageProviderContext } from '../PageProvider/PageProvider';
|
|
3
|
-
/**
|
|
4
|
-
* Props for the row component
|
|
5
|
-
*
|
|
6
|
-
* @interface RowProps
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
export interface RowProps {
|
|
10
|
-
/**
|
|
11
|
-
* Row data
|
|
12
|
-
*
|
|
13
|
-
* @type {PageProviderContext['layout']['body']['rows'][0]}
|
|
14
|
-
* @memberof RowProps
|
|
15
|
-
*/
|
|
16
|
-
row: PageProviderContext['layout']['body']['rows'][0];
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Renders a row
|
|
20
|
-
*
|
|
21
|
-
* @category Components
|
|
22
|
-
* @param {React.ForwardedRef<HTMLDivElement, RowProps>} ref
|
|
23
|
-
* @return {*}
|
|
24
|
-
*/
|
|
25
|
-
export declare const Row: import("react").ForwardRefExoticComponent<RowProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PageProviderContext } from '../PageProvider/PageProvider';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the row component
|
|
5
|
+
*
|
|
6
|
+
* @interface RowProps
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export interface RowProps {
|
|
10
|
+
/**
|
|
11
|
+
* Row data
|
|
12
|
+
*
|
|
13
|
+
* @type {PageProviderContext['layout']['body']['rows'][0]}
|
|
14
|
+
* @memberof RowProps
|
|
15
|
+
*/
|
|
16
|
+
row: PageProviderContext['layout']['body']['rows'][0];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Renders a row
|
|
20
|
+
*
|
|
21
|
+
* @category Components
|
|
22
|
+
* @param {React.ForwardedRef<HTMLDivElement, RowProps>} ref
|
|
23
|
+
* @return {*}
|
|
24
|
+
*/
|
|
25
|
+
export declare const Row: import("react").ForwardRefExoticComponent<RowProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { PageProviderContext } from '../components/PageProvider/PageProvider';
|
|
3
|
-
export declare const PageContext: import("react").Context<PageProviderContext | null>;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PageProviderContext } from '../components/PageProvider/PageProvider';
|
|
3
|
+
export declare const PageContext: import("react").Context<PageProviderContext | null>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { PageProviderContext } from '../components/PageProvider/PageProvider';
|
|
2
|
-
/**
|
|
3
|
-
* `useDotcmsPageContext` is a custom React hook that provides access to the `PageProviderContext`.
|
|
4
|
-
* It takes no parameters and returns the context value or `null` if it's not available.
|
|
5
|
-
*
|
|
6
|
-
* @category Hooks
|
|
7
|
-
* @returns {PageProviderContext | null} - The context value or `null` if it's not available.
|
|
8
|
-
*/
|
|
9
|
-
export declare function useDotcmsPageContext(): PageProviderContext | null;
|
|
1
|
+
import { PageProviderContext } from '../components/PageProvider/PageProvider';
|
|
2
|
+
/**
|
|
3
|
+
* `useDotcmsPageContext` is a custom React hook that provides access to the `PageProviderContext`.
|
|
4
|
+
* It takes no parameters and returns the context value or `null` if it's not available.
|
|
5
|
+
*
|
|
6
|
+
* @category Hooks
|
|
7
|
+
* @returns {PageProviderContext | null} - The context value or `null` if it's not available.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useDotcmsPageContext(): PageProviderContext | null;
|
|
@@ -1,48 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @property {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
19
|
-
* @
|
|
20
|
-
* @
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @
|
|
29
|
-
* @
|
|
30
|
-
* @
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* `
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @
|
|
43
|
-
* @
|
|
44
|
-
* @
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `PageEditorOptions` is an interface that defines the options for the `usePageEditor` hook.
|
|
3
|
+
* It includes an optional `reloadFunction` that is called when the editor needs to reload the page to get changes,
|
|
4
|
+
* and an optional `pathname` that represents the path of the page that the editor is editing.
|
|
5
|
+
*
|
|
6
|
+
* @interface PageEditorOptions
|
|
7
|
+
*
|
|
8
|
+
* @property {Function} reloadFunction - An optional function that is called when the editor needs to reload the page to get changes.
|
|
9
|
+
* @property {string} pathname - An optional string that represents the path of the page that the editor is editing.
|
|
10
|
+
*/
|
|
11
|
+
interface PageEditorOptions {
|
|
12
|
+
/**
|
|
13
|
+
* `reloadFunction` is an optional function that can be provided to the `PageEditorOptions` object.
|
|
14
|
+
* It is called when the dotcms editor needs to reload the page to get changes.
|
|
15
|
+
*
|
|
16
|
+
* @property {Function} reloadFunction
|
|
17
|
+
* @default window.location.reload
|
|
18
|
+
* @memberof PageEditorOptions
|
|
19
|
+
* @type {() => void}
|
|
20
|
+
* @optional
|
|
21
|
+
*/
|
|
22
|
+
reloadFunction?: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* `pathname` is an optional string that can be provided to the `PageEditorOptions` object.
|
|
25
|
+
* It represents the path of the page that the editor is editing.
|
|
26
|
+
* When this path changes, the editor will update its own state and reload the page to get the changes.
|
|
27
|
+
* @property {string} pathname
|
|
28
|
+
* @memberof PageEditorOptions
|
|
29
|
+
* @type {string}
|
|
30
|
+
* @optional
|
|
31
|
+
*/
|
|
32
|
+
pathname?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* `usePageEditor` is a custom React hook that sets up the page editor for a DotCMS page.
|
|
36
|
+
* It takes a `PageEditorOptions` object as a parameter and returns a reference to the rows of the page.
|
|
37
|
+
*
|
|
38
|
+
* This hook is the main brigde between your webapp and the dotcms page editor.
|
|
39
|
+
*
|
|
40
|
+
*
|
|
41
|
+
* @category Hooks
|
|
42
|
+
* @param {PageEditorOptions} props - The options for the page editor. Includes a `reloadFunction` and a `pathname`.
|
|
43
|
+
* @returns {{rowsRef: React.RefObject<HTMLDivElement>[], isInsideEditor: boolean}} - Returns a reference to the rows of the page and a boolean that indicates if the page is inside the editor.
|
|
44
|
+
* @throws {Error} - Throws an error if the `pathname` is not provided.
|
|
45
|
+
*/
|
|
46
|
+
export declare const usePageEditor: (props: PageEditorOptions) => {
|
|
47
|
+
rowsRef: React.MutableRefObject<HTMLDivElement[]>;
|
|
48
|
+
isInsideEditor: boolean;
|
|
49
|
+
};
|
|
50
|
+
export {};
|
package/src/lib/mocks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './mockPageContext';
|
|
1
|
+
export * from './mockPageContext';
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PageProviderContext } from '../components/PageProvider/PageProvider';
|
|
3
|
+
export declare const mockPageContext: PageProviderContext;
|
|
4
|
+
export declare const MockContextRender: ({ children, mockContext }: {
|
|
5
|
+
children: JSX.Element;
|
|
6
|
+
mockContext: Partial<PageProviderContext>;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
package/src/lib/utils/utils.d.ts
CHANGED
|
@@ -1,50 +1,55 @@
|
|
|
1
|
-
import { ContainerData, PageProviderContext } from '../components/PageProvider/PageProvider';
|
|
2
|
-
export declare function getPageElementBound(rowsNodes: HTMLDivElement[] | null): {
|
|
3
|
-
x: number;
|
|
4
|
-
y: number;
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
columns: {
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
width: number;
|
|
11
|
-
height: number;
|
|
12
|
-
containers: {
|
|
13
|
-
x: number;
|
|
14
|
-
y: number;
|
|
15
|
-
width: number;
|
|
16
|
-
height: number;
|
|
17
|
-
payload: string | undefined;
|
|
18
|
-
contentlets: {
|
|
19
|
-
x: number;
|
|
20
|
-
y: number;
|
|
21
|
-
width: number;
|
|
22
|
-
height: number;
|
|
23
|
-
payload: string | undefined;
|
|
24
|
-
}[];
|
|
25
|
-
}[];
|
|
26
|
-
}[];
|
|
27
|
-
}[];
|
|
28
|
-
export declare const getPageContainers: (containers: ContainerData) => {
|
|
29
|
-
identifier: string;
|
|
30
|
-
uuid: string;
|
|
31
|
-
contentletsId: string[];
|
|
32
|
-
}[];
|
|
33
|
-
export declare const getContainersData: (containers: ContainerData, containerRef: PageProviderContext['layout']['body']['rows'][0]['columns'][0]['containers'][0]) => {
|
|
34
|
-
acceptTypes: string;
|
|
35
|
-
contentlets: {
|
|
36
|
-
contentType: string;
|
|
37
|
-
identifier: string;
|
|
38
|
-
title: string;
|
|
39
|
-
inode: string;
|
|
40
|
-
widgetTitle?: string | undefined;
|
|
41
|
-
}[];
|
|
42
|
-
pageContainers: {
|
|
43
|
-
identifier: string;
|
|
44
|
-
uuid: string;
|
|
45
|
-
contentletsId: string[];
|
|
46
|
-
}[];
|
|
47
|
-
path: string;
|
|
48
|
-
identifier: string;
|
|
49
|
-
maxContentlets: number;
|
|
50
|
-
};
|
|
1
|
+
import { ContainerData, PageProviderContext } from '../components/PageProvider/PageProvider';
|
|
2
|
+
export declare function getPageElementBound(rowsNodes: HTMLDivElement[] | null): {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
columns: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
containers: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
payload: string | undefined;
|
|
18
|
+
contentlets: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
payload: string | undefined;
|
|
24
|
+
}[];
|
|
25
|
+
}[];
|
|
26
|
+
}[];
|
|
27
|
+
}[];
|
|
28
|
+
export declare const getPageContainers: (containers: ContainerData) => {
|
|
29
|
+
identifier: string;
|
|
30
|
+
uuid: string;
|
|
31
|
+
contentletsId: string[];
|
|
32
|
+
}[];
|
|
33
|
+
export declare const getContainersData: (containers: ContainerData, containerRef: PageProviderContext['layout']['body']['rows'][0]['columns'][0]['containers'][0]) => {
|
|
34
|
+
acceptTypes: string;
|
|
35
|
+
contentlets: {
|
|
36
|
+
contentType: string;
|
|
37
|
+
identifier: string;
|
|
38
|
+
title: string;
|
|
39
|
+
inode: string;
|
|
40
|
+
widgetTitle?: string | undefined;
|
|
41
|
+
}[];
|
|
42
|
+
pageContainers: {
|
|
43
|
+
identifier: string;
|
|
44
|
+
uuid: string;
|
|
45
|
+
contentletsId: string[];
|
|
46
|
+
}[];
|
|
47
|
+
path: string;
|
|
48
|
+
identifier: string;
|
|
49
|
+
maxContentlets: number;
|
|
50
|
+
};
|
|
51
|
+
export declare const combineClasses: (classes: string[]) => string;
|
|
52
|
+
export declare const getPositionStyleClasses: (width: number, leftOffset: number) => {
|
|
53
|
+
widthClass: string;
|
|
54
|
+
startClass: string;
|
|
55
|
+
};
|