@elementor/editor-editing-panel 4.2.0-872 → 4.2.0-874
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 +246 -221
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +245 -220
- package/dist/index.mjs.map +1 -1
- package/package.json +24 -24
- package/src/components/settings-tab.tsx +49 -9
package/dist/index.mjs
CHANGED
|
@@ -2001,6 +2001,219 @@ var InteractionsTab = () => {
|
|
|
2001
2001
|
import * as React23 from "react";
|
|
2002
2002
|
import { SessionStorageProvider } from "@elementor/session";
|
|
2003
2003
|
|
|
2004
|
+
// src/utils/prop-dependency-utils.ts
|
|
2005
|
+
import {
|
|
2006
|
+
extractValue,
|
|
2007
|
+
isDependency,
|
|
2008
|
+
isDependencyMet,
|
|
2009
|
+
isOverridable,
|
|
2010
|
+
isTransformable,
|
|
2011
|
+
rewrapOverridableValue
|
|
2012
|
+
} from "@elementor/editor-props";
|
|
2013
|
+
import { getSessionStorageItem as getSessionStorageItem2, removeSessionStorageItem, setSessionStorageItem as setSessionStorageItem2 } from "@elementor/session";
|
|
2014
|
+
function getElementSettingsWithDefaults(propsSchema, elementSettings) {
|
|
2015
|
+
const elementSettingsWithDefaults = { ...elementSettings };
|
|
2016
|
+
Object.keys(propsSchema).forEach((key) => {
|
|
2017
|
+
if (elementSettingsWithDefaults[key] === null && propsSchema[key].default !== null) {
|
|
2018
|
+
elementSettingsWithDefaults[key] = propsSchema[key].default;
|
|
2019
|
+
}
|
|
2020
|
+
});
|
|
2021
|
+
return elementSettingsWithDefaults;
|
|
2022
|
+
}
|
|
2023
|
+
function extractDependencyEffect(bind, propsSchema, settings) {
|
|
2024
|
+
const settingsWithDefaults = getElementSettingsWithDefaults(propsSchema, settings);
|
|
2025
|
+
const propType = propsSchema[bind];
|
|
2026
|
+
const depCheck = isDependencyMet(propType?.dependencies, settingsWithDefaults);
|
|
2027
|
+
const failingTerm = !depCheck.isMet ? depCheck.failingDependencies[0] : void 0;
|
|
2028
|
+
const isHidden = !!failingTerm && !isDependency(failingTerm) && failingTerm?.effect === "hide";
|
|
2029
|
+
return {
|
|
2030
|
+
isHidden,
|
|
2031
|
+
isDisabled: (prop) => !isDependencyMet(prop?.dependencies, settingsWithDefaults).isMet
|
|
2032
|
+
};
|
|
2033
|
+
}
|
|
2034
|
+
function extractOrderedDependencies(dependenciesPerTargetMapping) {
|
|
2035
|
+
return Object.values(dependenciesPerTargetMapping).flat().filter((dependent, index, self) => self.indexOf(dependent) === index);
|
|
2036
|
+
}
|
|
2037
|
+
function getUpdatedValues(values, dependencies, propsSchema, elementValues, elementId) {
|
|
2038
|
+
if (!dependencies.length) {
|
|
2039
|
+
return values;
|
|
2040
|
+
}
|
|
2041
|
+
return dependencies.reduce(
|
|
2042
|
+
(newValues, dependency) => {
|
|
2043
|
+
const path = dependency.split(".");
|
|
2044
|
+
const combinedValues = { ...elementValues, ...newValues };
|
|
2045
|
+
const propType = getPropType(propsSchema, combinedValues, path);
|
|
2046
|
+
if (!propType) {
|
|
2047
|
+
return newValues;
|
|
2048
|
+
}
|
|
2049
|
+
const testDependencies = {
|
|
2050
|
+
previousValues: isDependencyMet(propType.dependencies, elementValues),
|
|
2051
|
+
newValues: isDependencyMet(propType.dependencies, combinedValues)
|
|
2052
|
+
};
|
|
2053
|
+
if (!testDependencies.newValues.isMet) {
|
|
2054
|
+
const newValue = handleUnmetCondition({
|
|
2055
|
+
failingDependencies: testDependencies.newValues.failingDependencies,
|
|
2056
|
+
dependency,
|
|
2057
|
+
elementValues: combinedValues,
|
|
2058
|
+
defaultValue: propType.default,
|
|
2059
|
+
elementId
|
|
2060
|
+
});
|
|
2061
|
+
return {
|
|
2062
|
+
...newValues,
|
|
2063
|
+
...updateValue(path, newValue, combinedValues)
|
|
2064
|
+
};
|
|
2065
|
+
}
|
|
2066
|
+
if (!testDependencies.previousValues.isMet) {
|
|
2067
|
+
const savedValue = retrievePreviousValueFromStorage({ path: dependency, elementId });
|
|
2068
|
+
const currentValue = extractValue(path, combinedValues, [], {
|
|
2069
|
+
unwrapOverridableLeaf: false
|
|
2070
|
+
});
|
|
2071
|
+
removePreviousValueFromStorage({ path: dependency, elementId });
|
|
2072
|
+
const restored = isCompatibleSavedValue(savedValue, currentValue) ? savedValue : propType.default;
|
|
2073
|
+
return {
|
|
2074
|
+
...newValues,
|
|
2075
|
+
...updateValue(path, restored, combinedValues)
|
|
2076
|
+
};
|
|
2077
|
+
}
|
|
2078
|
+
return newValues;
|
|
2079
|
+
},
|
|
2080
|
+
{ ...values }
|
|
2081
|
+
);
|
|
2082
|
+
}
|
|
2083
|
+
function getPropType(schema, elementValues, path) {
|
|
2084
|
+
if (!path.length) {
|
|
2085
|
+
return null;
|
|
2086
|
+
}
|
|
2087
|
+
const [basePropKey, ...keys] = path;
|
|
2088
|
+
const baseProp = schema[basePropKey];
|
|
2089
|
+
if (!baseProp) {
|
|
2090
|
+
return null;
|
|
2091
|
+
}
|
|
2092
|
+
return keys.reduce(
|
|
2093
|
+
(prop, key, index) => evaluatePropType({ prop, key, index, path, elementValues, basePropKey }),
|
|
2094
|
+
baseProp
|
|
2095
|
+
);
|
|
2096
|
+
}
|
|
2097
|
+
function evaluatePropType(props) {
|
|
2098
|
+
const { prop } = props;
|
|
2099
|
+
if (!prop?.kind) {
|
|
2100
|
+
return null;
|
|
2101
|
+
}
|
|
2102
|
+
const { key, index, path, elementValues, basePropKey } = props;
|
|
2103
|
+
switch (prop.kind) {
|
|
2104
|
+
case "union":
|
|
2105
|
+
const value = extractValue(path.slice(0, index + 1), elementValues);
|
|
2106
|
+
const type = value?.$$type ?? null;
|
|
2107
|
+
return getPropType(
|
|
2108
|
+
{ [basePropKey]: prop.prop_types?.[type] },
|
|
2109
|
+
elementValues,
|
|
2110
|
+
path.slice(0, index + 2)
|
|
2111
|
+
);
|
|
2112
|
+
case "array":
|
|
2113
|
+
return prop.item_prop_type;
|
|
2114
|
+
case "object":
|
|
2115
|
+
return prop.shape[key];
|
|
2116
|
+
}
|
|
2117
|
+
return prop[key];
|
|
2118
|
+
}
|
|
2119
|
+
function updateValue(path, value, values) {
|
|
2120
|
+
const topPropKey = path[0];
|
|
2121
|
+
const root = { ...values };
|
|
2122
|
+
let carry = root;
|
|
2123
|
+
for (let index = 0; index < path.length; index++) {
|
|
2124
|
+
const key = path[index];
|
|
2125
|
+
const isLeaf = index === path.length - 1;
|
|
2126
|
+
if (isLeaf) {
|
|
2127
|
+
carry[key] = mergeLeafValue(carry[key], value);
|
|
2128
|
+
break;
|
|
2129
|
+
}
|
|
2130
|
+
const next = cloneDescent(carry[key]);
|
|
2131
|
+
if (!next) {
|
|
2132
|
+
break;
|
|
2133
|
+
}
|
|
2134
|
+
carry[key] = next.replacement;
|
|
2135
|
+
carry = next.descended;
|
|
2136
|
+
}
|
|
2137
|
+
return { [topPropKey]: root[topPropKey] ?? null };
|
|
2138
|
+
}
|
|
2139
|
+
function cloneDescent(child) {
|
|
2140
|
+
if (!child) {
|
|
2141
|
+
return null;
|
|
2142
|
+
}
|
|
2143
|
+
if (isOverridable(child)) {
|
|
2144
|
+
const origin = child.value.origin_value;
|
|
2145
|
+
if (!origin || !isTransformable(origin)) {
|
|
2146
|
+
return null;
|
|
2147
|
+
}
|
|
2148
|
+
const descended = { ...origin.value };
|
|
2149
|
+
const replacement = {
|
|
2150
|
+
...child,
|
|
2151
|
+
value: {
|
|
2152
|
+
...child.value,
|
|
2153
|
+
origin_value: { ...origin, value: descended }
|
|
2154
|
+
}
|
|
2155
|
+
};
|
|
2156
|
+
return { replacement, descended };
|
|
2157
|
+
}
|
|
2158
|
+
if (isTransformable(child)) {
|
|
2159
|
+
const descended = { ...child.value };
|
|
2160
|
+
const replacement = { ...child, value: descended };
|
|
2161
|
+
return { replacement, descended };
|
|
2162
|
+
}
|
|
2163
|
+
return null;
|
|
2164
|
+
}
|
|
2165
|
+
function isCompatibleSavedValue(saved, current) {
|
|
2166
|
+
if (!saved) {
|
|
2167
|
+
return false;
|
|
2168
|
+
}
|
|
2169
|
+
return isOverridable(saved) === isOverridable(current);
|
|
2170
|
+
}
|
|
2171
|
+
function mergeLeafValue(existing, incoming) {
|
|
2172
|
+
if (incoming === null) {
|
|
2173
|
+
return null;
|
|
2174
|
+
}
|
|
2175
|
+
if (incoming && isOverridable(incoming)) {
|
|
2176
|
+
return incoming;
|
|
2177
|
+
}
|
|
2178
|
+
if (existing && isOverridable(existing) && incoming) {
|
|
2179
|
+
return rewrapOverridableValue(existing, incoming);
|
|
2180
|
+
}
|
|
2181
|
+
return incoming;
|
|
2182
|
+
}
|
|
2183
|
+
function handleUnmetCondition(props) {
|
|
2184
|
+
const { failingDependencies, dependency, elementValues, defaultValue, elementId } = props;
|
|
2185
|
+
const termWithNewValue = failingDependencies.find(
|
|
2186
|
+
(term) => "newValue" in term && !!term.newValue
|
|
2187
|
+
);
|
|
2188
|
+
const newValue = termWithNewValue?.newValue ?? null;
|
|
2189
|
+
const currentValue = extractValue(dependency.split("."), elementValues, [], { unwrapOverridableLeaf: false }) ?? defaultValue;
|
|
2190
|
+
savePreviousValueToStorage({
|
|
2191
|
+
path: dependency,
|
|
2192
|
+
elementId,
|
|
2193
|
+
value: currentValue
|
|
2194
|
+
});
|
|
2195
|
+
return newValue;
|
|
2196
|
+
}
|
|
2197
|
+
function savePreviousValueToStorage({ path, elementId, value }) {
|
|
2198
|
+
const prefix = `elementor/${elementId}`;
|
|
2199
|
+
const savedValue = retrievePreviousValueFromStorage({ path, elementId });
|
|
2200
|
+
if (savedValue) {
|
|
2201
|
+
return;
|
|
2202
|
+
}
|
|
2203
|
+
const key = `${prefix}:${path}`;
|
|
2204
|
+
setSessionStorageItem2(key, value);
|
|
2205
|
+
}
|
|
2206
|
+
function retrievePreviousValueFromStorage({ path, elementId }) {
|
|
2207
|
+
const prefix = `elementor/${elementId}`;
|
|
2208
|
+
const key = `${prefix}:${path}`;
|
|
2209
|
+
return getSessionStorageItem2(key) ?? null;
|
|
2210
|
+
}
|
|
2211
|
+
function removePreviousValueFromStorage({ path, elementId }) {
|
|
2212
|
+
const prefix = `elementor/${elementId}`;
|
|
2213
|
+
const key = `${prefix}:${path}`;
|
|
2214
|
+
removeSessionStorageItem(key);
|
|
2215
|
+
}
|
|
2216
|
+
|
|
2004
2217
|
// src/components/section.tsx
|
|
2005
2218
|
import * as React17 from "react";
|
|
2006
2219
|
import { useId as useId2, useRef as useRef3 } from "react";
|
|
@@ -2244,219 +2457,6 @@ import { getElementLabel as getElementLabel3, getElementSettings, updateElementS
|
|
|
2244
2457
|
import { undoable as undoable4 } from "@elementor/editor-v1-adapters";
|
|
2245
2458
|
import { __ as __8 } from "@wordpress/i18n";
|
|
2246
2459
|
|
|
2247
|
-
// src/utils/prop-dependency-utils.ts
|
|
2248
|
-
import {
|
|
2249
|
-
extractValue,
|
|
2250
|
-
isDependency,
|
|
2251
|
-
isDependencyMet,
|
|
2252
|
-
isOverridable,
|
|
2253
|
-
isTransformable,
|
|
2254
|
-
rewrapOverridableValue
|
|
2255
|
-
} from "@elementor/editor-props";
|
|
2256
|
-
import { getSessionStorageItem as getSessionStorageItem2, removeSessionStorageItem, setSessionStorageItem as setSessionStorageItem2 } from "@elementor/session";
|
|
2257
|
-
function getElementSettingsWithDefaults(propsSchema, elementSettings) {
|
|
2258
|
-
const elementSettingsWithDefaults = { ...elementSettings };
|
|
2259
|
-
Object.keys(propsSchema).forEach((key) => {
|
|
2260
|
-
if (elementSettingsWithDefaults[key] === null && propsSchema[key].default !== null) {
|
|
2261
|
-
elementSettingsWithDefaults[key] = propsSchema[key].default;
|
|
2262
|
-
}
|
|
2263
|
-
});
|
|
2264
|
-
return elementSettingsWithDefaults;
|
|
2265
|
-
}
|
|
2266
|
-
function extractDependencyEffect(bind, propsSchema, settings) {
|
|
2267
|
-
const settingsWithDefaults = getElementSettingsWithDefaults(propsSchema, settings);
|
|
2268
|
-
const propType = propsSchema[bind];
|
|
2269
|
-
const depCheck = isDependencyMet(propType?.dependencies, settingsWithDefaults);
|
|
2270
|
-
const failingTerm = !depCheck.isMet ? depCheck.failingDependencies[0] : void 0;
|
|
2271
|
-
const isHidden = !!failingTerm && !isDependency(failingTerm) && failingTerm?.effect === "hide";
|
|
2272
|
-
return {
|
|
2273
|
-
isHidden,
|
|
2274
|
-
isDisabled: (prop) => !isDependencyMet(prop?.dependencies, settingsWithDefaults).isMet
|
|
2275
|
-
};
|
|
2276
|
-
}
|
|
2277
|
-
function extractOrderedDependencies(dependenciesPerTargetMapping) {
|
|
2278
|
-
return Object.values(dependenciesPerTargetMapping).flat().filter((dependent, index, self) => self.indexOf(dependent) === index);
|
|
2279
|
-
}
|
|
2280
|
-
function getUpdatedValues(values, dependencies, propsSchema, elementValues, elementId) {
|
|
2281
|
-
if (!dependencies.length) {
|
|
2282
|
-
return values;
|
|
2283
|
-
}
|
|
2284
|
-
return dependencies.reduce(
|
|
2285
|
-
(newValues, dependency) => {
|
|
2286
|
-
const path = dependency.split(".");
|
|
2287
|
-
const combinedValues = { ...elementValues, ...newValues };
|
|
2288
|
-
const propType = getPropType(propsSchema, combinedValues, path);
|
|
2289
|
-
if (!propType) {
|
|
2290
|
-
return newValues;
|
|
2291
|
-
}
|
|
2292
|
-
const testDependencies = {
|
|
2293
|
-
previousValues: isDependencyMet(propType.dependencies, elementValues),
|
|
2294
|
-
newValues: isDependencyMet(propType.dependencies, combinedValues)
|
|
2295
|
-
};
|
|
2296
|
-
if (!testDependencies.newValues.isMet) {
|
|
2297
|
-
const newValue = handleUnmetCondition({
|
|
2298
|
-
failingDependencies: testDependencies.newValues.failingDependencies,
|
|
2299
|
-
dependency,
|
|
2300
|
-
elementValues: combinedValues,
|
|
2301
|
-
defaultValue: propType.default,
|
|
2302
|
-
elementId
|
|
2303
|
-
});
|
|
2304
|
-
return {
|
|
2305
|
-
...newValues,
|
|
2306
|
-
...updateValue(path, newValue, combinedValues)
|
|
2307
|
-
};
|
|
2308
|
-
}
|
|
2309
|
-
if (!testDependencies.previousValues.isMet) {
|
|
2310
|
-
const savedValue = retrievePreviousValueFromStorage({ path: dependency, elementId });
|
|
2311
|
-
const currentValue = extractValue(path, combinedValues, [], {
|
|
2312
|
-
unwrapOverridableLeaf: false
|
|
2313
|
-
});
|
|
2314
|
-
removePreviousValueFromStorage({ path: dependency, elementId });
|
|
2315
|
-
const restored = isCompatibleSavedValue(savedValue, currentValue) ? savedValue : propType.default;
|
|
2316
|
-
return {
|
|
2317
|
-
...newValues,
|
|
2318
|
-
...updateValue(path, restored, combinedValues)
|
|
2319
|
-
};
|
|
2320
|
-
}
|
|
2321
|
-
return newValues;
|
|
2322
|
-
},
|
|
2323
|
-
{ ...values }
|
|
2324
|
-
);
|
|
2325
|
-
}
|
|
2326
|
-
function getPropType(schema, elementValues, path) {
|
|
2327
|
-
if (!path.length) {
|
|
2328
|
-
return null;
|
|
2329
|
-
}
|
|
2330
|
-
const [basePropKey, ...keys] = path;
|
|
2331
|
-
const baseProp = schema[basePropKey];
|
|
2332
|
-
if (!baseProp) {
|
|
2333
|
-
return null;
|
|
2334
|
-
}
|
|
2335
|
-
return keys.reduce(
|
|
2336
|
-
(prop, key, index) => evaluatePropType({ prop, key, index, path, elementValues, basePropKey }),
|
|
2337
|
-
baseProp
|
|
2338
|
-
);
|
|
2339
|
-
}
|
|
2340
|
-
function evaluatePropType(props) {
|
|
2341
|
-
const { prop } = props;
|
|
2342
|
-
if (!prop?.kind) {
|
|
2343
|
-
return null;
|
|
2344
|
-
}
|
|
2345
|
-
const { key, index, path, elementValues, basePropKey } = props;
|
|
2346
|
-
switch (prop.kind) {
|
|
2347
|
-
case "union":
|
|
2348
|
-
const value = extractValue(path.slice(0, index + 1), elementValues);
|
|
2349
|
-
const type = value?.$$type ?? null;
|
|
2350
|
-
return getPropType(
|
|
2351
|
-
{ [basePropKey]: prop.prop_types?.[type] },
|
|
2352
|
-
elementValues,
|
|
2353
|
-
path.slice(0, index + 2)
|
|
2354
|
-
);
|
|
2355
|
-
case "array":
|
|
2356
|
-
return prop.item_prop_type;
|
|
2357
|
-
case "object":
|
|
2358
|
-
return prop.shape[key];
|
|
2359
|
-
}
|
|
2360
|
-
return prop[key];
|
|
2361
|
-
}
|
|
2362
|
-
function updateValue(path, value, values) {
|
|
2363
|
-
const topPropKey = path[0];
|
|
2364
|
-
const root = { ...values };
|
|
2365
|
-
let carry = root;
|
|
2366
|
-
for (let index = 0; index < path.length; index++) {
|
|
2367
|
-
const key = path[index];
|
|
2368
|
-
const isLeaf = index === path.length - 1;
|
|
2369
|
-
if (isLeaf) {
|
|
2370
|
-
carry[key] = mergeLeafValue(carry[key], value);
|
|
2371
|
-
break;
|
|
2372
|
-
}
|
|
2373
|
-
const next = cloneDescent(carry[key]);
|
|
2374
|
-
if (!next) {
|
|
2375
|
-
break;
|
|
2376
|
-
}
|
|
2377
|
-
carry[key] = next.replacement;
|
|
2378
|
-
carry = next.descended;
|
|
2379
|
-
}
|
|
2380
|
-
return { [topPropKey]: root[topPropKey] ?? null };
|
|
2381
|
-
}
|
|
2382
|
-
function cloneDescent(child) {
|
|
2383
|
-
if (!child) {
|
|
2384
|
-
return null;
|
|
2385
|
-
}
|
|
2386
|
-
if (isOverridable(child)) {
|
|
2387
|
-
const origin = child.value.origin_value;
|
|
2388
|
-
if (!origin || !isTransformable(origin)) {
|
|
2389
|
-
return null;
|
|
2390
|
-
}
|
|
2391
|
-
const descended = { ...origin.value };
|
|
2392
|
-
const replacement = {
|
|
2393
|
-
...child,
|
|
2394
|
-
value: {
|
|
2395
|
-
...child.value,
|
|
2396
|
-
origin_value: { ...origin, value: descended }
|
|
2397
|
-
}
|
|
2398
|
-
};
|
|
2399
|
-
return { replacement, descended };
|
|
2400
|
-
}
|
|
2401
|
-
if (isTransformable(child)) {
|
|
2402
|
-
const descended = { ...child.value };
|
|
2403
|
-
const replacement = { ...child, value: descended };
|
|
2404
|
-
return { replacement, descended };
|
|
2405
|
-
}
|
|
2406
|
-
return null;
|
|
2407
|
-
}
|
|
2408
|
-
function isCompatibleSavedValue(saved, current) {
|
|
2409
|
-
if (!saved) {
|
|
2410
|
-
return false;
|
|
2411
|
-
}
|
|
2412
|
-
return isOverridable(saved) === isOverridable(current);
|
|
2413
|
-
}
|
|
2414
|
-
function mergeLeafValue(existing, incoming) {
|
|
2415
|
-
if (incoming === null) {
|
|
2416
|
-
return null;
|
|
2417
|
-
}
|
|
2418
|
-
if (incoming && isOverridable(incoming)) {
|
|
2419
|
-
return incoming;
|
|
2420
|
-
}
|
|
2421
|
-
if (existing && isOverridable(existing) && incoming) {
|
|
2422
|
-
return rewrapOverridableValue(existing, incoming);
|
|
2423
|
-
}
|
|
2424
|
-
return incoming;
|
|
2425
|
-
}
|
|
2426
|
-
function handleUnmetCondition(props) {
|
|
2427
|
-
const { failingDependencies, dependency, elementValues, defaultValue, elementId } = props;
|
|
2428
|
-
const termWithNewValue = failingDependencies.find(
|
|
2429
|
-
(term) => "newValue" in term && !!term.newValue
|
|
2430
|
-
);
|
|
2431
|
-
const newValue = termWithNewValue?.newValue ?? null;
|
|
2432
|
-
const currentValue = extractValue(dependency.split("."), elementValues, [], { unwrapOverridableLeaf: false }) ?? defaultValue;
|
|
2433
|
-
savePreviousValueToStorage({
|
|
2434
|
-
path: dependency,
|
|
2435
|
-
elementId,
|
|
2436
|
-
value: currentValue
|
|
2437
|
-
});
|
|
2438
|
-
return newValue;
|
|
2439
|
-
}
|
|
2440
|
-
function savePreviousValueToStorage({ path, elementId, value }) {
|
|
2441
|
-
const prefix = `elementor/${elementId}`;
|
|
2442
|
-
const savedValue = retrievePreviousValueFromStorage({ path, elementId });
|
|
2443
|
-
if (savedValue) {
|
|
2444
|
-
return;
|
|
2445
|
-
}
|
|
2446
|
-
const key = `${prefix}:${path}`;
|
|
2447
|
-
setSessionStorageItem2(key, value);
|
|
2448
|
-
}
|
|
2449
|
-
function retrievePreviousValueFromStorage({ path, elementId }) {
|
|
2450
|
-
const prefix = `elementor/${elementId}`;
|
|
2451
|
-
const key = `${prefix}:${path}`;
|
|
2452
|
-
return getSessionStorageItem2(key) ?? null;
|
|
2453
|
-
}
|
|
2454
|
-
function removePreviousValueFromStorage({ path, elementId }) {
|
|
2455
|
-
const prefix = `elementor/${elementId}`;
|
|
2456
|
-
const key = `${prefix}:${path}`;
|
|
2457
|
-
removeSessionStorageItem(key);
|
|
2458
|
-
}
|
|
2459
|
-
|
|
2460
2460
|
// src/controls-registry/create-top-level-object-type.ts
|
|
2461
2461
|
var createTopLevelObjectType = ({ schema }) => {
|
|
2462
2462
|
const schemaPropType = {
|
|
@@ -2600,8 +2600,9 @@ function populateChildControlProps(props) {
|
|
|
2600
2600
|
|
|
2601
2601
|
// src/components/settings-tab.tsx
|
|
2602
2602
|
var SettingsTab = () => {
|
|
2603
|
-
const { elementType, element } = useElement();
|
|
2603
|
+
const { elementType, element, settings } = useElement();
|
|
2604
2604
|
const settingsDefault = useDefaultPanelSettings();
|
|
2605
|
+
const currentSettings = settings;
|
|
2605
2606
|
const isDefaultExpanded = (sectionId) => settingsDefault.defaultSectionsExpanded.settings?.includes(sectionId);
|
|
2606
2607
|
return /* @__PURE__ */ React23.createElement(SessionStorageProvider, { prefix: element.id }, /* @__PURE__ */ React23.createElement(SectionsList, null, elementType.controls.map((control, index) => {
|
|
2607
2608
|
if (isControl(control)) {
|
|
@@ -2609,6 +2610,15 @@ var SettingsTab = () => {
|
|
|
2609
2610
|
}
|
|
2610
2611
|
const { type, value } = control;
|
|
2611
2612
|
if (type === "section") {
|
|
2613
|
+
const sectionItems = renderSectionItems({
|
|
2614
|
+
items: value.items,
|
|
2615
|
+
element,
|
|
2616
|
+
propsSchema: elementType.propsSchema,
|
|
2617
|
+
settings: currentSettings
|
|
2618
|
+
});
|
|
2619
|
+
if (!sectionItems.length) {
|
|
2620
|
+
return null;
|
|
2621
|
+
}
|
|
2612
2622
|
return /* @__PURE__ */ React23.createElement(
|
|
2613
2623
|
Section,
|
|
2614
2624
|
{
|
|
@@ -2616,12 +2626,7 @@ var SettingsTab = () => {
|
|
|
2616
2626
|
key: type + "." + index,
|
|
2617
2627
|
defaultExpanded: isDefaultExpanded(value.label)
|
|
2618
2628
|
},
|
|
2619
|
-
|
|
2620
|
-
if (isControl(item)) {
|
|
2621
|
-
return /* @__PURE__ */ React23.createElement(SettingsControl, { key: getKey(item, element), control: item });
|
|
2622
|
-
}
|
|
2623
|
-
return null;
|
|
2624
|
-
})
|
|
2629
|
+
sectionItems
|
|
2625
2630
|
);
|
|
2626
2631
|
}
|
|
2627
2632
|
return null;
|
|
@@ -2636,6 +2641,26 @@ function getKey(control, element) {
|
|
|
2636
2641
|
function isControl(control) {
|
|
2637
2642
|
return control.type === "control" || control.type === "element-control";
|
|
2638
2643
|
}
|
|
2644
|
+
function renderSectionItems({
|
|
2645
|
+
items: items3,
|
|
2646
|
+
element,
|
|
2647
|
+
propsSchema,
|
|
2648
|
+
settings
|
|
2649
|
+
}) {
|
|
2650
|
+
return items3?.flatMap((item) => {
|
|
2651
|
+
if (!isControl(item)) {
|
|
2652
|
+
return [];
|
|
2653
|
+
}
|
|
2654
|
+
if (item.type === "control" && isControlHiddenByDependencies(item, propsSchema, settings)) {
|
|
2655
|
+
return [];
|
|
2656
|
+
}
|
|
2657
|
+
return [/* @__PURE__ */ React23.createElement(SettingsControl, { key: getKey(item, element), control: item })];
|
|
2658
|
+
}) ?? [];
|
|
2659
|
+
}
|
|
2660
|
+
function isControlHiddenByDependencies(control, propsSchema, settings) {
|
|
2661
|
+
const { isHidden } = extractDependencyEffect(control.value.bind, propsSchema, settings);
|
|
2662
|
+
return isHidden;
|
|
2663
|
+
}
|
|
2639
2664
|
|
|
2640
2665
|
// src/components/style-tab.tsx
|
|
2641
2666
|
import * as React85 from "react";
|