@elementor/editor-components 4.0.0-513 → 4.0.0-514
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.mjs
CHANGED
|
@@ -3844,6 +3844,7 @@ import {
|
|
|
3844
3844
|
controlsRegistry,
|
|
3845
3845
|
createTopLevelObjectType,
|
|
3846
3846
|
ElementProvider as ElementProvider2,
|
|
3847
|
+
isDynamicPropValue,
|
|
3847
3848
|
SettingsField,
|
|
3848
3849
|
useElement as useElement2
|
|
3849
3850
|
} from "@elementor/editor-editing-panel";
|
|
@@ -3966,12 +3967,10 @@ var getPropTypeForComponentOverride = (overridableProp) => {
|
|
|
3966
3967
|
if (overridableProp.originPropFields) {
|
|
3967
3968
|
return getPropType(overridableProp.originPropFields);
|
|
3968
3969
|
}
|
|
3969
|
-
const {
|
|
3970
|
+
const { widgetType, propKey } = overridableProp;
|
|
3970
3971
|
return getPropType({
|
|
3971
|
-
elType,
|
|
3972
3972
|
widgetType,
|
|
3973
|
-
propKey
|
|
3974
|
-
elementId
|
|
3973
|
+
propKey
|
|
3975
3974
|
});
|
|
3976
3975
|
};
|
|
3977
3976
|
function getPropType({ widgetType, propKey }) {
|
|
@@ -4098,11 +4097,6 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
4098
4097
|
if (!propType) {
|
|
4099
4098
|
return null;
|
|
4100
4099
|
}
|
|
4101
|
-
const propTypeSchema = createTopLevelObjectType({
|
|
4102
|
-
schema: {
|
|
4103
|
-
[overridableProp.overrideKey]: propType
|
|
4104
|
-
}
|
|
4105
|
-
});
|
|
4106
4100
|
const componentInstanceId = instanceValue.component_id?.value;
|
|
4107
4101
|
if (!componentInstanceId) {
|
|
4108
4102
|
throw new Error("Component ID is required");
|
|
@@ -4113,7 +4107,11 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
4113
4107
|
[overridableProp.overrideKey]: propValue
|
|
4114
4108
|
};
|
|
4115
4109
|
const setValue = (newValue) => {
|
|
4116
|
-
const newPropValue =
|
|
4110
|
+
const newPropValue = getTempNewValueForDynamicProp(
|
|
4111
|
+
propType,
|
|
4112
|
+
propValue,
|
|
4113
|
+
newValue[overridableProp.overrideKey]
|
|
4114
|
+
);
|
|
4117
4115
|
const newOverrideValue = createOverrideValue({
|
|
4118
4116
|
matchingOverride,
|
|
4119
4117
|
overrideKey: overridableProp.overrideKey,
|
|
@@ -4155,6 +4153,11 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
4155
4153
|
if (!elementType) {
|
|
4156
4154
|
return null;
|
|
4157
4155
|
}
|
|
4156
|
+
const propTypeSchema = createTopLevelObjectType({
|
|
4157
|
+
schema: {
|
|
4158
|
+
[overridableProp.overrideKey]: propType
|
|
4159
|
+
}
|
|
4160
|
+
});
|
|
4158
4161
|
return /* @__PURE__ */ React26.createElement(
|
|
4159
4162
|
OverridablePropProvider,
|
|
4160
4163
|
{
|
|
@@ -4175,6 +4178,13 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
4175
4178
|
)))
|
|
4176
4179
|
);
|
|
4177
4180
|
}
|
|
4181
|
+
function getTempNewValueForDynamicProp(propType, propValue, newPropValue) {
|
|
4182
|
+
const isRemovingOverride = newPropValue === null;
|
|
4183
|
+
if (isRemovingOverride && isDynamicPropValue(propValue)) {
|
|
4184
|
+
return propType.default ?? null;
|
|
4185
|
+
}
|
|
4186
|
+
return newPropValue;
|
|
4187
|
+
}
|
|
4178
4188
|
function getMatchingOverride(overrides, overrideKey) {
|
|
4179
4189
|
const result = overrides?.find((override) => {
|
|
4180
4190
|
const overridableValue = componentOverridablePropTypeUtil.extract(override);
|