@dotcms/react 0.0.1-alpha.41 → 0.0.1-alpha.42
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/index.esm.js +16 -56
- package/package.json +4 -4
- package/src/lib/hooks/useCheckHaveContent.d.ts +0 -5
package/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { useState, useEffect, createContext,
|
|
2
|
+
import { useState, useEffect, createContext, useContext, createElement as createElement$1, forwardRef, useRef } from 'react';
|
|
3
3
|
import { isInsideEditor, initEditor, updateNavigation, destroyEditor, DotCmsClient, postMessageToEditor, CUSTOMER_ACTIONS } from '@dotcms/client';
|
|
4
4
|
import { Editor } from '@tinymce/tinymce-react';
|
|
5
5
|
|
|
@@ -1761,10 +1761,6 @@ var css_248z$1 = ".row-module_row__8V7Eh {\n display: grid;\n grid-templat
|
|
|
1761
1761
|
var styles$1 = {"row":"row-module_row__8V7Eh"};
|
|
1762
1762
|
styleInject(css_248z$1);
|
|
1763
1763
|
|
|
1764
|
-
var css_248z = ".column-module_col-start-1__GK-q- {\n grid-column-start: 1;\n}\n\n.column-module_col-start-2__1DmkY {\n grid-column-start: 2;\n}\n\n.column-module_col-start-3__HNEPh {\n grid-column-start: 3;\n}\n\n.column-module_col-start-4__oCAwh {\n grid-column-start: 4;\n}\n\n.column-module_col-start-5__re1rB {\n grid-column-start: 5;\n}\n\n.column-module_col-start-6__dkB4w {\n grid-column-start: 6;\n}\n\n.column-module_col-start-7__kEfJb {\n grid-column-start: 7;\n}\n\n.column-module_col-start-8__Yx31z {\n grid-column-start: 8;\n}\n\n.column-module_col-start-9__9YiVY {\n grid-column-start: 9;\n}\n\n.column-module_col-start-10__6AFbk {\n grid-column-start: 10;\n}\n\n.column-module_col-start-11__LP24D {\n grid-column-start: 11;\n}\n\n.column-module_col-start-12__8p0QS {\n grid-column-start: 12;\n}\n\n.column-module_col-end-1__G9axv {\n grid-column-end: 1;\n}\n\n.column-module_col-end-2__pYjHG {\n grid-column-end: 2;\n}\n\n.column-module_col-end-3__4woe6 {\n grid-column-end: 3;\n}\n\n.column-module_col-end-4__zlBaT {\n grid-column-end: 4;\n}\n\n.column-module_col-end-5__aC-y8 {\n grid-column-end: 5;\n}\n\n.column-module_col-end-6__YljAP {\n grid-column-end: 6;\n}\n\n.column-module_col-end-7__lpQrW {\n grid-column-end: 7;\n}\n\n.column-module_col-end-8__F6UVd {\n grid-column-end: 8;\n}\n\n.column-module_col-end-9__kvQ3T {\n grid-column-end: 9;\n}\n\n.column-module_col-end-10__XJhrd {\n grid-column-end: 10;\n}\n\n.column-module_col-end-11__nx-lF {\n grid-column-end: 11;\n}\n\n.column-module_col-end-12__LIRnk {\n grid-column-end: 12;\n}\n\n.column-module_col-end-13__0p7YI {\n grid-column-end: 13;\n}\n";
|
|
1765
|
-
var styles = {"col-start-1":"column-module_col-start-1__GK-q-","col-start-2":"column-module_col-start-2__1DmkY","col-start-3":"column-module_col-start-3__HNEPh","col-start-4":"column-module_col-start-4__oCAwh","col-start-5":"column-module_col-start-5__re1rB","col-start-6":"column-module_col-start-6__dkB4w","col-start-7":"column-module_col-start-7__kEfJb","col-start-8":"column-module_col-start-8__Yx31z","col-start-9":"column-module_col-start-9__9YiVY","col-start-10":"column-module_col-start-10__6AFbk","col-start-11":"column-module_col-start-11__LP24D","col-start-12":"column-module_col-start-12__8p0QS","col-end-1":"column-module_col-end-1__G9axv","col-end-2":"column-module_col-end-2__pYjHG","col-end-3":"column-module_col-end-3__4woe6","col-end-4":"column-module_col-end-4__zlBaT","col-end-5":"column-module_col-end-5__aC-y8","col-end-6":"column-module_col-end-6__YljAP","col-end-7":"column-module_col-end-7__lpQrW","col-end-8":"column-module_col-end-8__F6UVd","col-end-9":"column-module_col-end-9__kvQ3T","col-end-10":"column-module_col-end-10__XJhrd","col-end-11":"column-module_col-end-11__nx-lF","col-end-12":"column-module_col-end-12__LIRnk","col-end-13":"column-module_col-end-13__0p7YI"};
|
|
1766
|
-
styleInject(css_248z);
|
|
1767
|
-
|
|
1768
1764
|
const endClassMap = {
|
|
1769
1765
|
1: 'col-end-1',
|
|
1770
1766
|
2: 'col-end-2',
|
|
@@ -1847,6 +1843,10 @@ const getPositionStyleClasses = (start, end) => {
|
|
|
1847
1843
|
};
|
|
1848
1844
|
};
|
|
1849
1845
|
|
|
1846
|
+
var css_248z = ".column-module_col-start-1__GK-q- {\n grid-column-start: 1;\n}\n\n.column-module_col-start-2__1DmkY {\n grid-column-start: 2;\n}\n\n.column-module_col-start-3__HNEPh {\n grid-column-start: 3;\n}\n\n.column-module_col-start-4__oCAwh {\n grid-column-start: 4;\n}\n\n.column-module_col-start-5__re1rB {\n grid-column-start: 5;\n}\n\n.column-module_col-start-6__dkB4w {\n grid-column-start: 6;\n}\n\n.column-module_col-start-7__kEfJb {\n grid-column-start: 7;\n}\n\n.column-module_col-start-8__Yx31z {\n grid-column-start: 8;\n}\n\n.column-module_col-start-9__9YiVY {\n grid-column-start: 9;\n}\n\n.column-module_col-start-10__6AFbk {\n grid-column-start: 10;\n}\n\n.column-module_col-start-11__LP24D {\n grid-column-start: 11;\n}\n\n.column-module_col-start-12__8p0QS {\n grid-column-start: 12;\n}\n\n.column-module_col-end-1__G9axv {\n grid-column-end: 1;\n}\n\n.column-module_col-end-2__pYjHG {\n grid-column-end: 2;\n}\n\n.column-module_col-end-3__4woe6 {\n grid-column-end: 3;\n}\n\n.column-module_col-end-4__zlBaT {\n grid-column-end: 4;\n}\n\n.column-module_col-end-5__aC-y8 {\n grid-column-end: 5;\n}\n\n.column-module_col-end-6__YljAP {\n grid-column-end: 6;\n}\n\n.column-module_col-end-7__lpQrW {\n grid-column-end: 7;\n}\n\n.column-module_col-end-8__F6UVd {\n grid-column-end: 8;\n}\n\n.column-module_col-end-9__kvQ3T {\n grid-column-end: 9;\n}\n\n.column-module_col-end-10__XJhrd {\n grid-column-end: 10;\n}\n\n.column-module_col-end-11__nx-lF {\n grid-column-end: 11;\n}\n\n.column-module_col-end-12__LIRnk {\n grid-column-end: 12;\n}\n\n.column-module_col-end-13__0p7YI {\n grid-column-end: 13;\n}\n";
|
|
1847
|
+
var styles = {"col-start-1":"column-module_col-start-1__GK-q-","col-start-2":"column-module_col-start-2__1DmkY","col-start-3":"column-module_col-start-3__HNEPh","col-start-4":"column-module_col-start-4__oCAwh","col-start-5":"column-module_col-start-5__re1rB","col-start-6":"column-module_col-start-6__dkB4w","col-start-7":"column-module_col-start-7__kEfJb","col-start-8":"column-module_col-start-8__Yx31z","col-start-9":"column-module_col-start-9__9YiVY","col-start-10":"column-module_col-start-10__6AFbk","col-start-11":"column-module_col-start-11__LP24D","col-start-12":"column-module_col-start-12__8p0QS","col-end-1":"column-module_col-end-1__G9axv","col-end-2":"column-module_col-end-2__pYjHG","col-end-3":"column-module_col-end-3__4woe6","col-end-4":"column-module_col-end-4__zlBaT","col-end-5":"column-module_col-end-5__aC-y8","col-end-6":"column-module_col-end-6__YljAP","col-end-7":"column-module_col-end-7__lpQrW","col-end-8":"column-module_col-end-8__F6UVd","col-end-9":"column-module_col-end-9__kvQ3T","col-end-10":"column-module_col-end-10__XJhrd","col-end-11":"column-module_col-end-11__nx-lF","col-end-12":"column-module_col-end-12__LIRnk","col-end-13":"column-module_col-end-13__0p7YI"};
|
|
1848
|
+
styleInject(css_248z);
|
|
1849
|
+
|
|
1850
1850
|
var NATIVE_BIND$1 = functionBindNative;
|
|
1851
1851
|
|
|
1852
1852
|
var FunctionPrototype = Function.prototype;
|
|
@@ -2022,30 +2022,6 @@ if ($stringify) {
|
|
|
2022
2022
|
});
|
|
2023
2023
|
}
|
|
2024
2024
|
|
|
2025
|
-
const useCheckHaveContent = () => {
|
|
2026
|
-
const contentletDivRef = useRef(null);
|
|
2027
|
-
const [haveContent, setHaveContent] = useState(false);
|
|
2028
|
-
useEffect(() => {
|
|
2029
|
-
if (!contentletDivRef.current) {
|
|
2030
|
-
return;
|
|
2031
|
-
}
|
|
2032
|
-
const childElement = contentletDivRef.current.firstElementChild;
|
|
2033
|
-
if (!childElement) {
|
|
2034
|
-
return;
|
|
2035
|
-
}
|
|
2036
|
-
const height = childElement.getBoundingClientRect().height;
|
|
2037
|
-
if (height > 0) {
|
|
2038
|
-
setHaveContent(true);
|
|
2039
|
-
return;
|
|
2040
|
-
}
|
|
2041
|
-
setHaveContent(false);
|
|
2042
|
-
}, [contentletDivRef]);
|
|
2043
|
-
return {
|
|
2044
|
-
contentletDivRef,
|
|
2045
|
-
haveContent
|
|
2046
|
-
};
|
|
2047
|
-
};
|
|
2048
|
-
|
|
2049
2025
|
/**
|
|
2050
2026
|
* Component to render when there is no component for the content type.
|
|
2051
2027
|
*
|
|
@@ -2086,10 +2062,6 @@ function Container({
|
|
|
2086
2062
|
identifier,
|
|
2087
2063
|
uuid
|
|
2088
2064
|
} = containerRef;
|
|
2089
|
-
const {
|
|
2090
|
-
haveContent,
|
|
2091
|
-
contentletDivRef
|
|
2092
|
-
} = useCheckHaveContent();
|
|
2093
2065
|
// Get the containers from the global context
|
|
2094
2066
|
const {
|
|
2095
2067
|
pageAsset: {
|
|
@@ -2134,10 +2106,6 @@ function Container({
|
|
|
2134
2106
|
"data-dot-type": contentlet.contentType,
|
|
2135
2107
|
"data-dot-container": JSON.stringify(container),
|
|
2136
2108
|
"data-dot-on-number-of-pages": contentlet.onNumberOfPages,
|
|
2137
|
-
ref: contentletDivRef,
|
|
2138
|
-
style: {
|
|
2139
|
-
minHeight: haveContent ? undefined : '4rem'
|
|
2140
|
-
},
|
|
2141
2109
|
children: jsx(Component, Object.assign({}, contentlet))
|
|
2142
2110
|
}, contentlet.identifier) : ( /*#__PURE__*/createElement$1(Component, Object.assign({}, contentlet, {
|
|
2143
2111
|
key: contentlet.identifier
|
|
@@ -2177,19 +2145,16 @@ function Column({
|
|
|
2177
2145
|
startClass,
|
|
2178
2146
|
endClass
|
|
2179
2147
|
} = getPositionStyleClasses(column.leftOffset, column.width + column.leftOffset);
|
|
2180
|
-
const combinedClasses = combineClasses([styles[endClass], styles[startClass]]);
|
|
2148
|
+
const combinedClasses = combineClasses([styles[endClass], styles[startClass], column.styleClass]);
|
|
2181
2149
|
const columnProps = isInsideEditor ? {
|
|
2182
2150
|
'data-dot': 'column',
|
|
2183
2151
|
'data-testid': 'column'
|
|
2184
2152
|
} : {};
|
|
2185
2153
|
return jsx("div", Object.assign({}, columnProps, {
|
|
2186
2154
|
className: combinedClasses,
|
|
2187
|
-
children: jsx(
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
containerRef: container
|
|
2191
|
-
}, `${container.identifier}-${container.uuid}`))
|
|
2192
|
-
})
|
|
2155
|
+
children: column.containers.map(container => jsx(Container, {
|
|
2156
|
+
containerRef: container
|
|
2157
|
+
}, `${container.identifier}-${container.uuid}`))
|
|
2193
2158
|
}));
|
|
2194
2159
|
}
|
|
2195
2160
|
|
|
@@ -2208,23 +2173,18 @@ const Row = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2208
2173
|
const {
|
|
2209
2174
|
row
|
|
2210
2175
|
} = props;
|
|
2176
|
+
const combinedClasses = combineClasses([styles$1.row, row.styleClass]);
|
|
2211
2177
|
const rowProps = isInsideEditor ? {
|
|
2212
2178
|
'data-dot': 'row',
|
|
2213
2179
|
'data-testid': 'row',
|
|
2214
2180
|
ref
|
|
2215
2181
|
} : {};
|
|
2216
|
-
return jsx("div", {
|
|
2217
|
-
className:
|
|
2218
|
-
children: jsx(
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
children: row.columns.map((column, index) => jsx(Column, {
|
|
2223
|
-
column: column
|
|
2224
|
-
}, index))
|
|
2225
|
-
}))
|
|
2226
|
-
})
|
|
2227
|
-
});
|
|
2182
|
+
return jsx("div", Object.assign({}, rowProps, {
|
|
2183
|
+
className: combinedClasses,
|
|
2184
|
+
children: row.columns.map((column, index) => jsx(Column, {
|
|
2185
|
+
column: column
|
|
2186
|
+
}, index))
|
|
2187
|
+
}));
|
|
2228
2188
|
});
|
|
2229
2189
|
|
|
2230
2190
|
/**
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotcms/react",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.42",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": ">=18",
|
|
6
6
|
"react-dom": ">=18",
|
|
7
|
-
"@dotcms/client": "0.0.1-alpha.
|
|
7
|
+
"@dotcms/client": "0.0.1-alpha.42",
|
|
8
8
|
"@tinymce/tinymce-react": "^5.1.1"
|
|
9
9
|
},
|
|
10
10
|
"description": "Official React Components library to render a dotCMS page.",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "git+https://github.com/dotCMS/core.git#
|
|
13
|
+
"url": "git+https://github.com/dotCMS/core.git#master"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"dotCMS",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"bugs": {
|
|
27
27
|
"url": "https://github.com/dotCMS/core/issues"
|
|
28
28
|
},
|
|
29
|
-
"homepage": "https://github.com/dotCMS/core/tree/
|
|
29
|
+
"homepage": "https://github.com/dotCMS/core/tree/master/core-web/libs/sdk/react/README.md",
|
|
30
30
|
"module": "./index.esm.js",
|
|
31
31
|
"type": "module",
|
|
32
32
|
"main": "./index.esm.js",
|