@elementor/editor-editing-panel 3.35.0-447 → 3.35.0-448
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.mjs
CHANGED
|
@@ -2183,7 +2183,8 @@ import {
|
|
|
2183
2183
|
useElementSettings
|
|
2184
2184
|
} from "@elementor/editor-elements";
|
|
2185
2185
|
import {
|
|
2186
|
-
isDependencyMet as isDependencyMet2
|
|
2186
|
+
isDependencyMet as isDependencyMet2,
|
|
2187
|
+
migratePropValue
|
|
2187
2188
|
} from "@elementor/editor-props";
|
|
2188
2189
|
import { undoable as undoable4 } from "@elementor/editor-v1-adapters";
|
|
2189
2190
|
import { __ as __8 } from "@wordpress/i18n";
|
|
@@ -2342,7 +2343,10 @@ var SettingsField = ({ bind, children, propDisplayName }) => {
|
|
|
2342
2343
|
elementType: { propsSchema, dependenciesPerTargetMapping = {} }
|
|
2343
2344
|
} = useElement();
|
|
2344
2345
|
const elementSettingValues = useElementSettings(elementId, Object.keys(propsSchema));
|
|
2345
|
-
const
|
|
2346
|
+
const migratedValues = useMemo7(() => {
|
|
2347
|
+
return migratePropValues(elementSettingValues, propsSchema);
|
|
2348
|
+
}, [elementSettingValues, propsSchema]);
|
|
2349
|
+
const value = { [bind]: migratedValues?.[bind] ?? null };
|
|
2346
2350
|
const propType = createTopLevelObjectType({ schema: propsSchema });
|
|
2347
2351
|
const undoableUpdateElementProp = useUndoableUpdateElementProp({
|
|
2348
2352
|
elementId,
|
|
@@ -2351,14 +2355,14 @@ var SettingsField = ({ bind, children, propDisplayName }) => {
|
|
|
2351
2355
|
const setValue = (newValue, _ = {}, meta) => {
|
|
2352
2356
|
const { withHistory = true } = meta ?? {};
|
|
2353
2357
|
const dependents = extractOrderedDependencies(dependenciesPerTargetMapping);
|
|
2354
|
-
const settings = getUpdatedValues(newValue, dependents, propsSchema,
|
|
2358
|
+
const settings = getUpdatedValues(newValue, dependents, propsSchema, migratedValues, elementId);
|
|
2355
2359
|
if (withHistory) {
|
|
2356
2360
|
undoableUpdateElementProp(settings);
|
|
2357
2361
|
} else {
|
|
2358
2362
|
updateElementSettings3({ id: elementId, props: settings, withHistory: false });
|
|
2359
2363
|
}
|
|
2360
2364
|
};
|
|
2361
|
-
const isDisabled = (prop) => !isDependencyMet2(prop?.dependencies,
|
|
2365
|
+
const isDisabled = (prop) => !isDependencyMet2(prop?.dependencies, migratedValues).isMet;
|
|
2362
2366
|
return /* @__PURE__ */ React22.createElement(PropProvider, { propType, value, setValue, isDisabled }, /* @__PURE__ */ React22.createElement(PropKeyProvider, { bind }, children));
|
|
2363
2367
|
};
|
|
2364
2368
|
function useUndoableUpdateElementProp({
|
|
@@ -2387,6 +2391,25 @@ function useUndoableUpdateElementProp({
|
|
|
2387
2391
|
);
|
|
2388
2392
|
}, [elementId, propDisplayName]);
|
|
2389
2393
|
}
|
|
2394
|
+
function migratePropValues(values, schema) {
|
|
2395
|
+
if (!values) {
|
|
2396
|
+
return values;
|
|
2397
|
+
}
|
|
2398
|
+
const migrated = {};
|
|
2399
|
+
for (const [key, value] of Object.entries(values)) {
|
|
2400
|
+
if (value === null || value === void 0) {
|
|
2401
|
+
migrated[key] = value;
|
|
2402
|
+
continue;
|
|
2403
|
+
}
|
|
2404
|
+
const propType = schema[key];
|
|
2405
|
+
if (!propType) {
|
|
2406
|
+
migrated[key] = value;
|
|
2407
|
+
continue;
|
|
2408
|
+
}
|
|
2409
|
+
migrated[key] = migratePropValue(value, propType);
|
|
2410
|
+
}
|
|
2411
|
+
return migrated;
|
|
2412
|
+
}
|
|
2390
2413
|
|
|
2391
2414
|
// src/field-indicators-registry.ts
|
|
2392
2415
|
var indicatorsRegistry = {
|