@elementor/editor-components 4.1.0-763 → 4.1.0-764
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/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +22 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/api.ts +8 -7
- package/src/store/actions/load-components-overridable-props.ts +5 -22
- package/src/store/extensible-slice.ts +19 -0
package/dist/index.mjs
CHANGED
|
@@ -76,11 +76,12 @@ var apiClient = {
|
|
|
76
76
|
unlockComponent: async (componentId) => await httpService().post(`${BASE_URL}/unlock`, {
|
|
77
77
|
componentId
|
|
78
78
|
}).then((res) => res.data),
|
|
79
|
-
getOverridableProps: async (
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
getOverridableProps: async (componentIds) => await httpService().get(
|
|
80
|
+
`${BASE_URL}/overridable-props`,
|
|
81
|
+
{
|
|
82
|
+
params: { "componentIds[]": componentIds }
|
|
82
83
|
}
|
|
83
|
-
|
|
84
|
+
).then((res) => res.data),
|
|
84
85
|
updateArchivedComponents: async (componentIds, status) => await httpService().post(
|
|
85
86
|
`${BASE_URL}/archive`,
|
|
86
87
|
{
|
|
@@ -180,6 +181,18 @@ var baseSlice = createSlice({
|
|
|
180
181
|
}
|
|
181
182
|
component.overridableProps = payload.overridableProps;
|
|
182
183
|
},
|
|
184
|
+
loadOverridableProps: (state, { payload }) => {
|
|
185
|
+
const componentIds = Object.keys(payload);
|
|
186
|
+
componentIds.forEach((id) => {
|
|
187
|
+
const componentId = Number(id);
|
|
188
|
+
const overridableProps = payload[componentId];
|
|
189
|
+
const component = state.data.find((comp) => comp.id === componentId);
|
|
190
|
+
if (!component || !overridableProps) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
component.overridableProps = overridableProps;
|
|
194
|
+
});
|
|
195
|
+
},
|
|
183
196
|
rename: (state, { payload }) => {
|
|
184
197
|
const component = state.data.find((comp) => comp.uid === payload.componentUid);
|
|
185
198
|
if (!component) {
|
|
@@ -2520,27 +2533,13 @@ async function getDocumentsMap(ids, cache) {
|
|
|
2520
2533
|
|
|
2521
2534
|
// src/store/actions/load-components-overridable-props.ts
|
|
2522
2535
|
import { __dispatch as dispatch4, __getState as getState6 } from "@elementor/store";
|
|
2523
|
-
function loadComponentsOverridableProps(componentIds) {
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
}
|
|
2527
|
-
return Promise.all(componentIds.map(loadComponentOverrides));
|
|
2528
|
-
}
|
|
2529
|
-
async function loadComponentOverrides(componentId) {
|
|
2530
|
-
const isOverridablePropsLoaded = selectIsOverridablePropsLoaded(getState6(), componentId);
|
|
2531
|
-
if (isOverridablePropsLoaded) {
|
|
2536
|
+
async function loadComponentsOverridableProps(componentIds) {
|
|
2537
|
+
const unloadedIds = componentIds.filter((id) => !selectIsOverridablePropsLoaded(getState6(), id));
|
|
2538
|
+
if (!unloadedIds.length) {
|
|
2532
2539
|
return;
|
|
2533
2540
|
}
|
|
2534
|
-
const
|
|
2535
|
-
|
|
2536
|
-
return;
|
|
2537
|
-
}
|
|
2538
|
-
dispatch4(
|
|
2539
|
-
slice.actions.setOverridableProps({
|
|
2540
|
-
componentId,
|
|
2541
|
-
overridableProps
|
|
2542
|
-
})
|
|
2543
|
-
);
|
|
2541
|
+
const { data } = await apiClient.getOverridableProps(unloadedIds);
|
|
2542
|
+
dispatch4(slice.actions.loadOverridableProps(data));
|
|
2544
2543
|
}
|
|
2545
2544
|
|
|
2546
2545
|
// src/store/actions/load-components-styles.ts
|