@gem-sdk/core 1.53.0-dev.121 → 1.53.0-dev.123
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.
|
@@ -35,7 +35,7 @@ const componentIconList = [
|
|
|
35
35
|
const componentUsingAdvanced = [
|
|
36
36
|
'IconList'
|
|
37
37
|
];
|
|
38
|
-
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, ...passProps })=>{
|
|
38
|
+
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, largeComponent = [], sizeLargeComponent = 50, ...passProps })=>{
|
|
39
39
|
const item = builder[uid];
|
|
40
40
|
const Component = components[item?.tag];
|
|
41
41
|
if (!Component) {
|
|
@@ -74,6 +74,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
74
74
|
advanced: item.advanced,
|
|
75
75
|
parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
|
|
76
76
|
pageContext,
|
|
77
|
+
largeComponent,
|
|
77
78
|
...passProps,
|
|
78
79
|
builderAttrs: {
|
|
79
80
|
...passProps.builderAttrs
|
|
@@ -85,7 +86,8 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
85
86
|
builder,
|
|
86
87
|
components,
|
|
87
88
|
customProps,
|
|
88
|
-
pageContext
|
|
89
|
+
pageContext,
|
|
90
|
+
largeComponent
|
|
89
91
|
};
|
|
90
92
|
}),
|
|
91
93
|
children: !constant.customRenderChildren.includes(item.tag) ? WrapRenderChildren({
|
|
@@ -97,11 +99,12 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
97
99
|
components,
|
|
98
100
|
customProps,
|
|
99
101
|
parentTag: item.tag,
|
|
100
|
-
pageContext
|
|
102
|
+
pageContext,
|
|
103
|
+
largeComponent
|
|
101
104
|
}))) : ''
|
|
102
105
|
});
|
|
103
106
|
}, ()=>{
|
|
104
|
-
|
|
107
|
+
const liquid = Component({
|
|
105
108
|
builderProps: {
|
|
106
109
|
uid,
|
|
107
110
|
builderData: item
|
|
@@ -113,11 +116,16 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
113
116
|
isText: componentTexts.includes(item.tag) ? true : null,
|
|
114
117
|
parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
|
|
115
118
|
pageContext,
|
|
119
|
+
largeComponent,
|
|
116
120
|
...passProps,
|
|
117
121
|
builderAttrs: {
|
|
118
122
|
...passProps.builderAttrs
|
|
119
123
|
}
|
|
120
124
|
});
|
|
125
|
+
if (isLimitSize(liquid, sizeLargeComponent)) {
|
|
126
|
+
largeComponent.push(item.uid);
|
|
127
|
+
}
|
|
128
|
+
return liquid;
|
|
121
129
|
});
|
|
122
130
|
} else {
|
|
123
131
|
liquid = render.template`<div gp-el-wrapper style="${!componentIconList.includes(item.tag) ? style : ''}" class="${item.uid} ${!item?.childrens?.length && item.tag === 'IconListItemHoz' ? 'hidden' : ''}">
|
|
@@ -134,6 +142,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
134
142
|
cssClass: item?.advanced?.cssClass
|
|
135
143
|
},
|
|
136
144
|
pageContext,
|
|
145
|
+
largeComponent,
|
|
137
146
|
...passProps,
|
|
138
147
|
builderAttrs: {
|
|
139
148
|
...passProps.builderAttrs
|
|
@@ -145,7 +154,8 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
145
154
|
builder,
|
|
146
155
|
components,
|
|
147
156
|
customProps,
|
|
148
|
-
pageContext
|
|
157
|
+
pageContext,
|
|
158
|
+
largeComponent
|
|
149
159
|
};
|
|
150
160
|
}),
|
|
151
161
|
children: !constant.customRenderChildren.includes(item.tag) ? WrapRenderChildren({
|
|
@@ -157,11 +167,12 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
157
167
|
components,
|
|
158
168
|
customProps,
|
|
159
169
|
parentTag: item.tag,
|
|
160
|
-
pageContext
|
|
170
|
+
pageContext,
|
|
171
|
+
largeComponent
|
|
161
172
|
}))) : ''
|
|
162
173
|
});
|
|
163
174
|
}, ()=>{
|
|
164
|
-
|
|
175
|
+
const liquid = Component({
|
|
165
176
|
builderProps: {
|
|
166
177
|
uid,
|
|
167
178
|
builderData: item
|
|
@@ -179,6 +190,10 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
179
190
|
...passProps.builderAttrs
|
|
180
191
|
}
|
|
181
192
|
});
|
|
193
|
+
if (isLimitSize(liquid, sizeLargeComponent)) {
|
|
194
|
+
largeComponent.push(item.uid);
|
|
195
|
+
}
|
|
196
|
+
return liquid;
|
|
182
197
|
})}
|
|
183
198
|
</div>`;
|
|
184
199
|
}
|
|
@@ -303,6 +318,11 @@ const WrapRenderChildren = ({ uid, customProps }, codes)=>{
|
|
|
303
318
|
}
|
|
304
319
|
return liquid;
|
|
305
320
|
};
|
|
321
|
+
const isLimitSize = (liquid, size = 50)=>{
|
|
322
|
+
const textEncoder = new TextEncoder();
|
|
323
|
+
const byteSize = textEncoder.encode(liquid).length;
|
|
324
|
+
return byteSize >= size * 1024;
|
|
325
|
+
};
|
|
306
326
|
|
|
307
327
|
exports.RenderChildren = RenderChildren;
|
|
308
328
|
exports.WrapRenderChildren = WrapRenderChildren;
|
|
@@ -31,7 +31,7 @@ const componentIconList = [
|
|
|
31
31
|
const componentUsingAdvanced = [
|
|
32
32
|
'IconList'
|
|
33
33
|
];
|
|
34
|
-
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, ...passProps })=>{
|
|
34
|
+
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, largeComponent = [], sizeLargeComponent = 50, ...passProps })=>{
|
|
35
35
|
const item = builder[uid];
|
|
36
36
|
const Component = components[item?.tag];
|
|
37
37
|
if (!Component) {
|
|
@@ -70,6 +70,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
70
70
|
advanced: item.advanced,
|
|
71
71
|
parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
|
|
72
72
|
pageContext,
|
|
73
|
+
largeComponent,
|
|
73
74
|
...passProps,
|
|
74
75
|
builderAttrs: {
|
|
75
76
|
...passProps.builderAttrs
|
|
@@ -81,7 +82,8 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
81
82
|
builder,
|
|
82
83
|
components,
|
|
83
84
|
customProps,
|
|
84
|
-
pageContext
|
|
85
|
+
pageContext,
|
|
86
|
+
largeComponent
|
|
85
87
|
};
|
|
86
88
|
}),
|
|
87
89
|
children: !customRenderChildren.includes(item.tag) ? WrapRenderChildren({
|
|
@@ -93,11 +95,12 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
93
95
|
components,
|
|
94
96
|
customProps,
|
|
95
97
|
parentTag: item.tag,
|
|
96
|
-
pageContext
|
|
98
|
+
pageContext,
|
|
99
|
+
largeComponent
|
|
97
100
|
}))) : ''
|
|
98
101
|
});
|
|
99
102
|
}, ()=>{
|
|
100
|
-
|
|
103
|
+
const liquid = Component({
|
|
101
104
|
builderProps: {
|
|
102
105
|
uid,
|
|
103
106
|
builderData: item
|
|
@@ -109,11 +112,16 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
109
112
|
isText: componentTexts.includes(item.tag) ? true : null,
|
|
110
113
|
parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
|
|
111
114
|
pageContext,
|
|
115
|
+
largeComponent,
|
|
112
116
|
...passProps,
|
|
113
117
|
builderAttrs: {
|
|
114
118
|
...passProps.builderAttrs
|
|
115
119
|
}
|
|
116
120
|
});
|
|
121
|
+
if (isLimitSize(liquid, sizeLargeComponent)) {
|
|
122
|
+
largeComponent.push(item.uid);
|
|
123
|
+
}
|
|
124
|
+
return liquid;
|
|
117
125
|
});
|
|
118
126
|
} else {
|
|
119
127
|
liquid = template`<div gp-el-wrapper style="${!componentIconList.includes(item.tag) ? style : ''}" class="${item.uid} ${!item?.childrens?.length && item.tag === 'IconListItemHoz' ? 'hidden' : ''}">
|
|
@@ -130,6 +138,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
130
138
|
cssClass: item?.advanced?.cssClass
|
|
131
139
|
},
|
|
132
140
|
pageContext,
|
|
141
|
+
largeComponent,
|
|
133
142
|
...passProps,
|
|
134
143
|
builderAttrs: {
|
|
135
144
|
...passProps.builderAttrs
|
|
@@ -141,7 +150,8 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
141
150
|
builder,
|
|
142
151
|
components,
|
|
143
152
|
customProps,
|
|
144
|
-
pageContext
|
|
153
|
+
pageContext,
|
|
154
|
+
largeComponent
|
|
145
155
|
};
|
|
146
156
|
}),
|
|
147
157
|
children: !customRenderChildren.includes(item.tag) ? WrapRenderChildren({
|
|
@@ -153,11 +163,12 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
153
163
|
components,
|
|
154
164
|
customProps,
|
|
155
165
|
parentTag: item.tag,
|
|
156
|
-
pageContext
|
|
166
|
+
pageContext,
|
|
167
|
+
largeComponent
|
|
157
168
|
}))) : ''
|
|
158
169
|
});
|
|
159
170
|
}, ()=>{
|
|
160
|
-
|
|
171
|
+
const liquid = Component({
|
|
161
172
|
builderProps: {
|
|
162
173
|
uid,
|
|
163
174
|
builderData: item
|
|
@@ -175,6 +186,10 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
175
186
|
...passProps.builderAttrs
|
|
176
187
|
}
|
|
177
188
|
});
|
|
189
|
+
if (isLimitSize(liquid, sizeLargeComponent)) {
|
|
190
|
+
largeComponent.push(item.uid);
|
|
191
|
+
}
|
|
192
|
+
return liquid;
|
|
178
193
|
})}
|
|
179
194
|
</div>`;
|
|
180
195
|
}
|
|
@@ -299,5 +314,10 @@ const WrapRenderChildren = ({ uid, customProps }, codes)=>{
|
|
|
299
314
|
}
|
|
300
315
|
return liquid;
|
|
301
316
|
};
|
|
317
|
+
const isLimitSize = (liquid, size = 50)=>{
|
|
318
|
+
const textEncoder = new TextEncoder();
|
|
319
|
+
const byteSize = textEncoder.encode(liquid).length;
|
|
320
|
+
return byteSize >= size * 1024;
|
|
321
|
+
};
|
|
302
322
|
|
|
303
323
|
export { RenderChildren, WrapRenderChildren, Render as default };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -31149,7 +31149,7 @@ type Props = {
|
|
|
31149
31149
|
pageContext?: PageContext;
|
|
31150
31150
|
[key: string]: any;
|
|
31151
31151
|
};
|
|
31152
|
-
declare const Render: ({ uid, builder, components, parentId, extraFiles, pageContext, ...passProps }: Props) => {
|
|
31152
|
+
declare const Render: ({ uid, builder, components, parentId, extraFiles, pageContext, largeComponent, sizeLargeComponent, ...passProps }: Props) => {
|
|
31153
31153
|
liquid: string;
|
|
31154
31154
|
extraFiles: ExtraFiles;
|
|
31155
31155
|
};
|