@builder.io/sdk-react-native 0.0.1-44 → 0.0.1-50
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/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/blocks/button.js +23 -73
- package/src/blocks/button.lite.tsx +3 -3
- package/src/blocks/columns.js +56 -288
- package/src/blocks/columns.lite.tsx +22 -22
- package/src/blocks/custom-code.js +46 -76
- package/src/blocks/custom-code.lite.tsx +11 -19
- package/src/blocks/embed.js +46 -69
- package/src/blocks/embed.lite.tsx +11 -15
- package/src/blocks/form.js +194 -491
- package/src/blocks/form.lite.tsx +51 -51
- package/src/blocks/fragment.js +8 -16
- package/src/blocks/fragment.lite.tsx +2 -2
- package/src/blocks/image.js +91 -113
- package/src/blocks/image.lite.tsx +12 -13
- package/src/blocks/img.js +28 -51
- package/src/blocks/img.lite.tsx +6 -6
- package/src/blocks/input.js +28 -100
- package/src/blocks/input.lite.tsx +4 -4
- package/src/blocks/raw-text.js +10 -16
- package/src/blocks/raw-text.lite.tsx +3 -8
- package/src/blocks/section.js +23 -71
- package/src/blocks/section.lite.tsx +3 -3
- package/src/blocks/select.js +28 -78
- package/src/blocks/select.lite.tsx +5 -5
- package/src/blocks/submit-button.js +21 -47
- package/src/blocks/submit-button.lite.tsx +2 -2
- package/src/blocks/symbol.js +71 -20
- package/src/blocks/symbol.lite.tsx +48 -8
- package/src/blocks/text.js +27 -40
- package/src/blocks/text.lite.tsx +3 -8
- package/src/blocks/textarea.js +24 -60
- package/src/blocks/textarea.lite.tsx +2 -2
- package/src/blocks/video.js +66 -71
- package/src/blocks/video.lite.tsx +5 -5
- package/src/components/block-styles.js +4 -2
- package/src/components/block-styles.lite.tsx +2 -2
- package/src/components/error-boundary.js +9 -11
- package/src/components/error-boundary.lite.tsx +2 -2
- package/src/components/render-block.js +44 -100
- package/src/components/render-block.lite.tsx +23 -28
- package/src/components/render-blocks.js +41 -60
- package/src/components/render-blocks.lite.tsx +20 -14
- package/src/components/render-content.js +189 -142
- package/src/components/render-content.lite.tsx +166 -60
- package/src/constants/device-sizes.js +11 -8
- package/src/context/builder.context.js +10 -3
- package/src/functions/evaluate.js +20 -20
- package/src/functions/event-handler-name.js +3 -1
- package/src/functions/get-block-actions.js +17 -16
- package/src/functions/get-block-component-options.js +9 -16
- package/src/functions/get-block-properties.js +14 -18
- package/src/functions/get-block-styles.js +17 -34
- package/src/functions/get-block-tag.js +4 -2
- package/src/functions/get-builder-search-params/fn.test.js +14 -0
- package/src/functions/get-builder-search-params/index.js +23 -0
- package/src/functions/get-content/fn.test.js +32 -0
- package/src/functions/get-content/index.js +138 -0
- package/src/functions/get-fetch.js +7 -5
- package/src/functions/get-global-this.js +7 -5
- package/src/functions/get-processed-block.js +13 -17
- package/src/functions/get-processed-block.test.js +17 -16
- package/src/functions/get-target.js +4 -2
- package/src/functions/if-target.js +3 -1
- package/src/functions/is-browser.js +4 -2
- package/src/functions/is-editing.js +5 -5
- package/src/functions/is-iframe.js +4 -2
- package/src/functions/is-previewing.js +6 -4
- package/src/functions/is-react-native.js +3 -1
- package/src/functions/macro-eval.js +5 -2
- package/src/functions/on-change.js +7 -4
- package/src/functions/on-change.test.js +9 -10
- package/src/functions/previewing-model-name.js +5 -3
- package/src/functions/register-component.js +27 -38
- package/src/functions/register.js +10 -8
- package/src/functions/set-editor-settings.js +7 -5
- package/src/functions/set.js +5 -14
- package/src/functions/set.test.js +13 -14
- package/src/functions/track.js +12 -6
- package/src/functions/transform-block.js +13 -17
- package/src/index-helpers/blocks-exports.js +19 -0
- package/src/index-helpers/top-of-file.js +2 -0
- package/src/index.js +11 -26
- package/src/scripts/init-editing.js +40 -64
- package/src/types/typescript.js +1 -0
- package/src/functions/get-content.js +0 -152
- package/src/functions/get-content.test.js +0 -58
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { View, StyleSheet, Image, Text } from
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
3
|
|
|
4
4
|
export default function Video(props) {
|
|
5
5
|
return (
|
|
@@ -7,8 +7,8 @@ export default function Video(props) {
|
|
|
7
7
|
{...props.attributes}
|
|
8
8
|
preload="none"
|
|
9
9
|
style={{
|
|
10
|
-
width:
|
|
11
|
-
height:
|
|
10
|
+
width: "100%",
|
|
11
|
+
height: "100%",
|
|
12
12
|
...props.attributes?.style,
|
|
13
13
|
objectFit: props.fit,
|
|
14
14
|
objectPosition: props.position,
|
|
@@ -16,7 +16,7 @@ export default function Video(props) {
|
|
|
16
16
|
// not have the video overflow
|
|
17
17
|
borderRadius: 1,
|
|
18
18
|
}}
|
|
19
|
-
key={props.video ||
|
|
19
|
+
key={props.video || "no-src"}
|
|
20
20
|
poster={props.posterImage}
|
|
21
21
|
autoPlay={props.autoPlay}
|
|
22
22
|
muted={props.muted}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Text } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Text } from "react-native";
|
|
3
3
|
class ErrorBoundary extends React.Component {
|
|
4
4
|
constructor(props) {
|
|
5
5
|
super(props);
|
|
@@ -9,19 +9,17 @@ class ErrorBoundary extends React.Component {
|
|
|
9
9
|
return { hasError: true };
|
|
10
10
|
}
|
|
11
11
|
componentDidCatch(error, errorInfo) {
|
|
12
|
-
console.error(
|
|
12
|
+
console.error("Error rendering Builder.io block", error, errorInfo);
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
15
|
if (this.state.hasError) {
|
|
16
|
-
return /* @__PURE__ */ React.createElement(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
style: { color: 'gray' },
|
|
20
|
-
},
|
|
21
|
-
'Error rendering Builder.io block'
|
|
22
|
-
);
|
|
16
|
+
return /* @__PURE__ */ React.createElement(Text, {
|
|
17
|
+
style: { color: "gray" }
|
|
18
|
+
}, "Error rendering Builder.io block");
|
|
23
19
|
}
|
|
24
20
|
return this.props.children;
|
|
25
21
|
}
|
|
26
22
|
}
|
|
27
|
-
export {
|
|
23
|
+
export {
|
|
24
|
+
ErrorBoundary as default
|
|
25
|
+
};
|
|
@@ -4,47 +4,39 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
|
4
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) =>
|
|
8
|
-
key in obj
|
|
9
|
-
? __defProp(obj, key, {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
writable: true,
|
|
13
|
-
value,
|
|
14
|
-
})
|
|
15
|
-
: (obj[key] = value);
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16
8
|
var __spreadValues = (a, b) => {
|
|
17
9
|
for (var prop in b || (b = {}))
|
|
18
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
12
|
if (__getOwnPropSymbols)
|
|
20
13
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
21
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
22
16
|
}
|
|
23
17
|
return a;
|
|
24
18
|
};
|
|
25
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
|
-
import * as React from
|
|
27
|
-
import { useContext } from
|
|
28
|
-
import { getBlockComponentOptions } from
|
|
29
|
-
import { getBlockProperties } from
|
|
30
|
-
import { getBlockStyles } from
|
|
31
|
-
import { getBlockTag } from
|
|
32
|
-
import { components } from
|
|
33
|
-
import BuilderContext from
|
|
34
|
-
import { getBlockActions } from
|
|
35
|
-
import { getProcessedBlock } from
|
|
36
|
-
import BlockStyles from
|
|
20
|
+
import * as React from "react";
|
|
21
|
+
import { useContext } from "react";
|
|
22
|
+
import { getBlockComponentOptions } from "../functions/get-block-component-options";
|
|
23
|
+
import { getBlockProperties } from "../functions/get-block-properties";
|
|
24
|
+
import { getBlockStyles } from "../functions/get-block-styles";
|
|
25
|
+
import { getBlockTag } from "../functions/get-block-tag";
|
|
26
|
+
import { components } from "../functions/register-component";
|
|
27
|
+
import BuilderContext from "../context/builder.context";
|
|
28
|
+
import { getBlockActions } from "../functions/get-block-actions";
|
|
29
|
+
import { getProcessedBlock } from "../functions/get-processed-block";
|
|
30
|
+
import BlockStyles from "./block-styles";
|
|
37
31
|
function RenderBlock(props) {
|
|
38
32
|
var _a, _b, _c, _d;
|
|
39
33
|
function component() {
|
|
40
34
|
var _a2, _b2;
|
|
41
|
-
const componentName =
|
|
42
|
-
(_a2 = useBlock().component) == null ? void 0 : _a2.name;
|
|
35
|
+
const componentName = (_a2 = useBlock().component) == null ? void 0 : _a2.name;
|
|
43
36
|
if (!componentName) {
|
|
44
37
|
return null;
|
|
45
38
|
}
|
|
46
|
-
const ref =
|
|
47
|
-
components[(_b2 = useBlock().component) == null ? void 0 : _b2.name];
|
|
39
|
+
const ref = components[(_b2 = useBlock().component) == null ? void 0 : _b2.name];
|
|
48
40
|
if (componentName && !ref) {
|
|
49
41
|
console.warn(`
|
|
50
42
|
Could not find a registered component named "${componentName}".
|
|
@@ -54,38 +46,28 @@ function RenderBlock(props) {
|
|
|
54
46
|
}
|
|
55
47
|
function componentInfo() {
|
|
56
48
|
var _a2;
|
|
57
|
-
return (_a2 = component == null ? void 0 : component()) == null
|
|
58
|
-
? void 0
|
|
59
|
-
: _a2.info;
|
|
49
|
+
return (_a2 = component == null ? void 0 : component()) == null ? void 0 : _a2.info;
|
|
60
50
|
}
|
|
61
51
|
function componentRef() {
|
|
62
52
|
var _a2;
|
|
63
|
-
return (_a2 = component == null ? void 0 : component()) == null
|
|
64
|
-
? void 0
|
|
65
|
-
: _a2.component;
|
|
53
|
+
return (_a2 = component == null ? void 0 : component()) == null ? void 0 : _a2.component;
|
|
66
54
|
}
|
|
67
55
|
function tagName() {
|
|
68
56
|
return getBlockTag(useBlock());
|
|
69
57
|
}
|
|
70
|
-
function properties() {
|
|
71
|
-
return getBlockProperties(useBlock());
|
|
72
|
-
}
|
|
73
58
|
function useBlock() {
|
|
74
59
|
return getProcessedBlock({
|
|
75
60
|
block: props.block,
|
|
76
61
|
state: builderContext.state,
|
|
77
|
-
context: builderContext.context
|
|
62
|
+
context: builderContext.context
|
|
78
63
|
});
|
|
79
64
|
}
|
|
80
65
|
function propertiesAndActions() {
|
|
81
|
-
return __spreadValues(__spreadValues({},
|
|
82
|
-
}
|
|
83
|
-
function actions() {
|
|
84
|
-
return getBlockActions({
|
|
66
|
+
return __spreadValues(__spreadValues({}, getBlockProperties(useBlock())), getBlockActions({
|
|
85
67
|
block: useBlock(),
|
|
86
68
|
state: builderContext.state,
|
|
87
|
-
context: builderContext.context
|
|
88
|
-
});
|
|
69
|
+
context: builderContext.context
|
|
70
|
+
}));
|
|
89
71
|
}
|
|
90
72
|
function css() {
|
|
91
73
|
return getBlockStyles(useBlock());
|
|
@@ -103,62 +85,24 @@ function RenderBlock(props) {
|
|
|
103
85
|
const builderContext = useContext(BuilderContext);
|
|
104
86
|
const ComponentRefRef = componentRef();
|
|
105
87
|
const TagNameRef = tagName();
|
|
106
|
-
return /* @__PURE__ */ React.createElement(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
componentRef()
|
|
124
|
-
? /* @__PURE__ */ React.createElement(
|
|
125
|
-
ComponentRefRef,
|
|
126
|
-
__spreadProps(__spreadValues({}, componentOptions()), {
|
|
127
|
-
builderBlock: useBlock(),
|
|
128
|
-
}),
|
|
129
|
-
(_b = children()) == null
|
|
130
|
-
? void 0
|
|
131
|
-
: _b.map((child) =>
|
|
132
|
-
/* @__PURE__ */ React.createElement(RenderBlock, {
|
|
133
|
-
block: child,
|
|
134
|
-
})
|
|
135
|
-
)
|
|
136
|
-
)
|
|
137
|
-
: null,
|
|
138
|
-
(_c = noCompRefChildren()) == null
|
|
139
|
-
? void 0
|
|
140
|
-
: _c.map((child) =>
|
|
141
|
-
/* @__PURE__ */ React.createElement(RenderBlock, {
|
|
142
|
-
block: child,
|
|
143
|
-
})
|
|
144
|
-
)
|
|
145
|
-
)
|
|
146
|
-
)
|
|
147
|
-
: /* @__PURE__ */ React.createElement(
|
|
148
|
-
ComponentRefRef,
|
|
149
|
-
__spreadProps(__spreadValues({}, componentOptions()), {
|
|
150
|
-
attributes: propertiesAndActions(),
|
|
151
|
-
builderBlock: useBlock(),
|
|
152
|
-
style: css(),
|
|
153
|
-
}),
|
|
154
|
-
(_d = children()) == null
|
|
155
|
-
? void 0
|
|
156
|
-
: _d.map((child) =>
|
|
157
|
-
/* @__PURE__ */ React.createElement(RenderBlock, {
|
|
158
|
-
block: child,
|
|
159
|
-
})
|
|
160
|
-
)
|
|
161
|
-
)
|
|
162
|
-
);
|
|
88
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, !((_a = componentInfo == null ? void 0 : componentInfo()) == null ? void 0 : _a.noWrap) ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TagNameRef, __spreadProps(__spreadValues({}, propertiesAndActions()), {
|
|
89
|
+
style: css()
|
|
90
|
+
}), /* @__PURE__ */ React.createElement(BlockStyles, {
|
|
91
|
+
block: useBlock()
|
|
92
|
+
}), componentRef() ? /* @__PURE__ */ React.createElement(ComponentRefRef, __spreadProps(__spreadValues({}, componentOptions()), {
|
|
93
|
+
builderBlock: useBlock()
|
|
94
|
+
}), (_b = children()) == null ? void 0 : _b.map((child, index) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
95
|
+
block: child
|
|
96
|
+
}))) : null, (_c = noCompRefChildren()) == null ? void 0 : _c.map((child, index) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
97
|
+
block: child
|
|
98
|
+
})))) : /* @__PURE__ */ React.createElement(ComponentRefRef, __spreadProps(__spreadValues({}, componentOptions()), {
|
|
99
|
+
attributes: propertiesAndActions(),
|
|
100
|
+
builderBlock: useBlock(),
|
|
101
|
+
style: css()
|
|
102
|
+
}), (_d = children()) == null ? void 0 : _d.map((child, index) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
103
|
+
block: child
|
|
104
|
+
}))));
|
|
163
105
|
}
|
|
164
|
-
export {
|
|
106
|
+
export {
|
|
107
|
+
RenderBlock as default
|
|
108
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { View, StyleSheet, Image, Text } from
|
|
3
|
-
import { useContext } from
|
|
4
|
-
import { getBlockComponentOptions } from
|
|
5
|
-
import { getBlockProperties } from
|
|
6
|
-
import { getBlockStyles } from
|
|
7
|
-
import { getBlockTag } from
|
|
8
|
-
import { components } from
|
|
9
|
-
import BuilderContext from
|
|
10
|
-
import { getBlockActions } from
|
|
11
|
-
import { getProcessedBlock } from
|
|
12
|
-
import BlockStyles from
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import { getBlockComponentOptions } from "../functions/get-block-component-options";
|
|
5
|
+
import { getBlockProperties } from "../functions/get-block-properties";
|
|
6
|
+
import { getBlockStyles } from "../functions/get-block-styles";
|
|
7
|
+
import { getBlockTag } from "../functions/get-block-tag";
|
|
8
|
+
import { components } from "../functions/register-component";
|
|
9
|
+
import BuilderContext from "../context/builder.context.lite";
|
|
10
|
+
import { getBlockActions } from "../functions/get-block-actions";
|
|
11
|
+
import { getProcessedBlock } from "../functions/get-processed-block";
|
|
12
|
+
import BlockStyles from "./block-styles.lite";
|
|
13
13
|
|
|
14
14
|
export default function RenderBlock(props) {
|
|
15
15
|
function component() {
|
|
@@ -43,10 +43,6 @@ export default function RenderBlock(props) {
|
|
|
43
43
|
return getBlockTag(useBlock());
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
function properties() {
|
|
47
|
-
return getBlockProperties(useBlock());
|
|
48
|
-
}
|
|
49
|
-
|
|
50
46
|
function useBlock() {
|
|
51
47
|
return getProcessedBlock({
|
|
52
48
|
block: props.block,
|
|
@@ -56,15 +52,14 @@ export default function RenderBlock(props) {
|
|
|
56
52
|
}
|
|
57
53
|
|
|
58
54
|
function propertiesAndActions() {
|
|
59
|
-
return {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
55
|
+
return {
|
|
56
|
+
...getBlockProperties(useBlock()),
|
|
57
|
+
...getBlockActions({
|
|
58
|
+
block: useBlock(),
|
|
59
|
+
state: builderContext.state,
|
|
60
|
+
context: builderContext.context,
|
|
61
|
+
}),
|
|
62
|
+
};
|
|
68
63
|
}
|
|
69
64
|
|
|
70
65
|
function css() {
|
|
@@ -104,13 +99,13 @@ export default function RenderBlock(props) {
|
|
|
104
99
|
{...componentOptions()}
|
|
105
100
|
builderBlock={useBlock()}
|
|
106
101
|
>
|
|
107
|
-
{children()?.map((child) => (
|
|
102
|
+
{children()?.map((child, index) => (
|
|
108
103
|
<RenderBlock block={child} />
|
|
109
104
|
))}
|
|
110
105
|
</ComponentRefRef>
|
|
111
106
|
) : null}
|
|
112
107
|
|
|
113
|
-
{noCompRefChildren()?.map((child) => (
|
|
108
|
+
{noCompRefChildren()?.map((child, index) => (
|
|
114
109
|
<RenderBlock block={child} />
|
|
115
110
|
))}
|
|
116
111
|
</TagNameRef>
|
|
@@ -122,7 +117,7 @@ export default function RenderBlock(props) {
|
|
|
122
117
|
builderBlock={useBlock()}
|
|
123
118
|
style={css()}
|
|
124
119
|
>
|
|
125
|
-
{children()?.map((child) => (
|
|
120
|
+
{children()?.map((child, index) => (
|
|
126
121
|
<RenderBlock block={child} />
|
|
127
122
|
))}
|
|
128
123
|
</ComponentRefRef>
|
|
@@ -1,73 +1,54 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { View, StyleSheet } from
|
|
3
|
-
import { isEditing } from
|
|
4
|
-
import RenderBlock from
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { isEditing } from "../functions/is-editing";
|
|
4
|
+
import RenderBlock from "./render-block";
|
|
5
5
|
function RenderBlocks(props) {
|
|
6
|
-
var _a
|
|
6
|
+
var _a;
|
|
7
|
+
function className() {
|
|
8
|
+
var _a2;
|
|
9
|
+
return "builder-blocks" + (!((_a2 = props.blocks) == null ? void 0 : _a2.length) ? " no-blocks" : "");
|
|
10
|
+
}
|
|
7
11
|
function onClick() {
|
|
8
|
-
var _a2,
|
|
12
|
+
var _a2, _b;
|
|
9
13
|
if (isEditing() && !((_a2 = props.blocks) == null ? void 0 : _a2.length)) {
|
|
10
|
-
(
|
|
11
|
-
|
|
12
|
-
:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
dataPath: props.path,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
'*'
|
|
21
|
-
);
|
|
14
|
+
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
15
|
+
type: "builder.clickEmptyBlocks",
|
|
16
|
+
data: {
|
|
17
|
+
parentElementId: props.parent,
|
|
18
|
+
dataPath: props.path
|
|
19
|
+
}
|
|
20
|
+
}, "*");
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
function onMouseEnter() {
|
|
25
|
-
var _a2,
|
|
24
|
+
var _a2, _b;
|
|
26
25
|
if (isEditing() && !((_a2 = props.blocks) == null ? void 0 : _a2.length)) {
|
|
27
|
-
(
|
|
28
|
-
|
|
29
|
-
:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
dataPath: props.path,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
'*'
|
|
38
|
-
);
|
|
26
|
+
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
27
|
+
type: "builder.hoverEmptyBlocks",
|
|
28
|
+
data: {
|
|
29
|
+
parentElementId: props.parent,
|
|
30
|
+
dataPath: props.path
|
|
31
|
+
}
|
|
32
|
+
}, "*");
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
|
-
return /* @__PURE__ */ React.createElement(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
onClick: (event) => onClick,
|
|
47
|
-
onMouseEnter: (event) => onMouseEnter,
|
|
48
|
-
className:
|
|
49
|
-
'builder-blocks' +
|
|
50
|
-
(!((_a = props.blocks) == null ? void 0 : _a.length)
|
|
51
|
-
? ' no-blocks'
|
|
52
|
-
: ''),
|
|
53
|
-
style: styles.view1,
|
|
35
|
+
return /* @__PURE__ */ React.createElement(View, {
|
|
36
|
+
"builder-path": props.path,
|
|
37
|
+
"builder-parent-id": props.parent,
|
|
38
|
+
dataSet: {
|
|
39
|
+
class: className()
|
|
54
40
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/* @__PURE__ */ React.createElement(RenderBlock, {
|
|
63
|
-
block,
|
|
64
|
-
})
|
|
65
|
-
)
|
|
66
|
-
)
|
|
67
|
-
: null
|
|
68
|
-
);
|
|
41
|
+
onClick: (event) => onClick(),
|
|
42
|
+
onMouseEnter: (event) => onMouseEnter(),
|
|
43
|
+
style: styles.view1
|
|
44
|
+
}, props.blocks ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = props.blocks) == null ? void 0 : _a.map((block, index) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
45
|
+
key: block.id,
|
|
46
|
+
block
|
|
47
|
+
}))) : null);
|
|
69
48
|
}
|
|
70
49
|
const styles = StyleSheet.create({
|
|
71
|
-
view1: { display:
|
|
50
|
+
view1: { display: "flex", flexDirection: "column", alignItems: "stretch" }
|
|
72
51
|
});
|
|
73
|
-
export {
|
|
52
|
+
export {
|
|
53
|
+
RenderBlocks as default
|
|
54
|
+
};
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { View, StyleSheet, Image, Text } from
|
|
3
|
-
import { isEditing } from
|
|
4
|
-
import RenderBlock from
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
|
+
import { isEditing } from "../functions/is-editing";
|
|
4
|
+
import RenderBlock from "./render-block.lite";
|
|
5
5
|
|
|
6
6
|
export default function RenderBlocks(props) {
|
|
7
|
+
function className() {
|
|
8
|
+
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
function onClick() {
|
|
8
12
|
if (isEditing() && !props.blocks?.length) {
|
|
9
13
|
window.parent?.postMessage(
|
|
10
14
|
{
|
|
11
|
-
type:
|
|
15
|
+
type: "builder.clickEmptyBlocks",
|
|
12
16
|
data: {
|
|
13
17
|
parentElementId: props.parent,
|
|
14
18
|
dataPath: props.path,
|
|
15
19
|
},
|
|
16
20
|
},
|
|
17
|
-
|
|
21
|
+
"*"
|
|
18
22
|
);
|
|
19
23
|
}
|
|
20
24
|
}
|
|
@@ -23,13 +27,13 @@ export default function RenderBlocks(props) {
|
|
|
23
27
|
if (isEditing() && !props.blocks?.length) {
|
|
24
28
|
window.parent?.postMessage(
|
|
25
29
|
{
|
|
26
|
-
type:
|
|
30
|
+
type: "builder.hoverEmptyBlocks",
|
|
27
31
|
data: {
|
|
28
32
|
parentElementId: props.parent,
|
|
29
33
|
dataPath: props.path,
|
|
30
34
|
},
|
|
31
35
|
},
|
|
32
|
-
|
|
36
|
+
"*"
|
|
33
37
|
);
|
|
34
38
|
}
|
|
35
39
|
}
|
|
@@ -38,15 +42,17 @@ export default function RenderBlocks(props) {
|
|
|
38
42
|
<View
|
|
39
43
|
builder-path={props.path}
|
|
40
44
|
builder-parent-id={props.parent}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
dataSet={{
|
|
46
|
+
class: className(),
|
|
47
|
+
}}
|
|
48
|
+
onClick={(event) => onClick()}
|
|
49
|
+
onMouseEnter={(event) => onMouseEnter()}
|
|
44
50
|
style={styles.view1}
|
|
45
51
|
>
|
|
46
52
|
{props.blocks ? (
|
|
47
53
|
<>
|
|
48
|
-
{props.blocks?.map((block) => (
|
|
49
|
-
<RenderBlock block={block} />
|
|
54
|
+
{props.blocks?.map((block, index) => (
|
|
55
|
+
<RenderBlock key={block.id} block={block} />
|
|
50
56
|
))}
|
|
51
57
|
</>
|
|
52
58
|
) : null}
|
|
@@ -55,5 +61,5 @@ export default function RenderBlocks(props) {
|
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
const styles = StyleSheet.create({
|
|
58
|
-
view1: { display:
|
|
64
|
+
view1: { display: "flex", flexDirection: "column", alignItems: "stretch" },
|
|
59
65
|
});
|