@elementor/editor-editing-panel 3.35.0-447 → 3.35.0-449
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.js +25 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/controls-registry/settings-field.tsx +35 -3
package/dist/index.js
CHANGED
|
@@ -2335,7 +2335,10 @@ var SettingsField = ({ bind, children, propDisplayName }) => {
|
|
|
2335
2335
|
elementType: { propsSchema, dependenciesPerTargetMapping = {} }
|
|
2336
2336
|
} = useElement();
|
|
2337
2337
|
const elementSettingValues = (0, import_editor_elements7.useElementSettings)(elementId, Object.keys(propsSchema));
|
|
2338
|
-
const
|
|
2338
|
+
const migratedValues = (0, import_react20.useMemo)(() => {
|
|
2339
|
+
return migratePropValues(elementSettingValues, propsSchema);
|
|
2340
|
+
}, [elementSettingValues, propsSchema]);
|
|
2341
|
+
const value = { [bind]: migratedValues?.[bind] ?? null };
|
|
2339
2342
|
const propType = createTopLevelObjectType({ schema: propsSchema });
|
|
2340
2343
|
const undoableUpdateElementProp = useUndoableUpdateElementProp({
|
|
2341
2344
|
elementId,
|
|
@@ -2344,14 +2347,14 @@ var SettingsField = ({ bind, children, propDisplayName }) => {
|
|
|
2344
2347
|
const setValue = (newValue, _ = {}, meta) => {
|
|
2345
2348
|
const { withHistory = true } = meta ?? {};
|
|
2346
2349
|
const dependents = extractOrderedDependencies(dependenciesPerTargetMapping);
|
|
2347
|
-
const settings = getUpdatedValues(newValue, dependents, propsSchema,
|
|
2350
|
+
const settings = getUpdatedValues(newValue, dependents, propsSchema, migratedValues, elementId);
|
|
2348
2351
|
if (withHistory) {
|
|
2349
2352
|
undoableUpdateElementProp(settings);
|
|
2350
2353
|
} else {
|
|
2351
2354
|
(0, import_editor_elements7.updateElementSettings)({ id: elementId, props: settings, withHistory: false });
|
|
2352
2355
|
}
|
|
2353
2356
|
};
|
|
2354
|
-
const isDisabled = (prop) => !(0, import_editor_props6.isDependencyMet)(prop?.dependencies,
|
|
2357
|
+
const isDisabled = (prop) => !(0, import_editor_props6.isDependencyMet)(prop?.dependencies, migratedValues).isMet;
|
|
2355
2358
|
return /* @__PURE__ */ React22.createElement(import_editor_controls4.PropProvider, { propType, value, setValue, isDisabled }, /* @__PURE__ */ React22.createElement(import_editor_controls4.PropKeyProvider, { bind }, children));
|
|
2356
2359
|
};
|
|
2357
2360
|
function useUndoableUpdateElementProp({
|
|
@@ -2380,6 +2383,25 @@ function useUndoableUpdateElementProp({
|
|
|
2380
2383
|
);
|
|
2381
2384
|
}, [elementId, propDisplayName]);
|
|
2382
2385
|
}
|
|
2386
|
+
function migratePropValues(values, schema) {
|
|
2387
|
+
if (!values) {
|
|
2388
|
+
return values;
|
|
2389
|
+
}
|
|
2390
|
+
const migrated = {};
|
|
2391
|
+
for (const [key, value] of Object.entries(values)) {
|
|
2392
|
+
if (value === null || value === void 0) {
|
|
2393
|
+
migrated[key] = value;
|
|
2394
|
+
continue;
|
|
2395
|
+
}
|
|
2396
|
+
const propType = schema[key];
|
|
2397
|
+
if (!propType) {
|
|
2398
|
+
migrated[key] = value;
|
|
2399
|
+
continue;
|
|
2400
|
+
}
|
|
2401
|
+
migrated[key] = (0, import_editor_props6.migratePropValue)(value, propType);
|
|
2402
|
+
}
|
|
2403
|
+
return migrated;
|
|
2404
|
+
}
|
|
2383
2405
|
|
|
2384
2406
|
// src/field-indicators-registry.ts
|
|
2385
2407
|
var indicatorsRegistry = {
|